@av-pi-studio/cli 0.0.1
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/dist/.tsbuildinfo +1 -0
- package/dist/agent-commands.d.ts +70 -0
- package/dist/agent-commands.d.ts.map +1 -0
- package/dist/agent-commands.js +296 -0
- package/dist/agent-commands.js.map +1 -0
- package/dist/cli-core.d.ts +55 -0
- package/dist/cli-core.d.ts.map +1 -0
- package/dist/cli-core.js +85 -0
- package/dist/cli-core.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -0
- package/dist/client-id.d.ts +12 -0
- package/dist/client-id.d.ts.map +1 -0
- package/dist/client-id.js +47 -0
- package/dist/client-id.js.map +1 -0
- package/dist/connection.d.ts +44 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +83 -0
- package/dist/connection.js.map +1 -0
- package/dist/daemon-commands.d.ts +10 -0
- package/dist/daemon-commands.d.ts.map +1 -0
- package/dist/daemon-commands.js +108 -0
- package/dist/daemon-commands.js.map +1 -0
- package/dist/daemon-control.d.ts +67 -0
- package/dist/daemon-control.d.ts.map +1 -0
- package/dist/daemon-control.js +140 -0
- package/dist/daemon-control.js.map +1 -0
- package/dist/feature-commands.d.ts +56 -0
- package/dist/feature-commands.d.ts.map +1 -0
- package/dist/feature-commands.js +250 -0
- package/dist/feature-commands.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +25 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +65 -0
- package/dist/output.js.map +1 -0
- package/dist/pairing.d.ts +17 -0
- package/dist/pairing.d.ts.map +1 -0
- package/dist/pairing.js +33 -0
- package/dist/pairing.js.map +1 -0
- package/dist/program.d.ts +17 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +75 -0
- package/dist/program.js.map +1 -0
- package/dist/qr.d.ts +6 -0
- package/dist/qr.d.ts.map +1 -0
- package/dist/qr.js +9 -0
- package/dist/qr.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { request } from "node:http";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import bcrypt from "bcryptjs";
|
|
6
|
+
import { parseHost } from "./connection.js";
|
|
7
|
+
/**
|
|
8
|
+
* Local daemon control (features/cli.md § Command tree (daemon), § Behavior). The CLI and daemon
|
|
9
|
+
* share `$PI_STUDIO_HOME`, so control operations read/write that directory directly
|
|
10
|
+
* (`config.json`, `pi-studio.pid`, `daemon-keypair.json`) and probe the HTTP health endpoint.
|
|
11
|
+
*
|
|
12
|
+
* Side-effecting operations (process spawn/kill, network probe, password hashing) are injectable so
|
|
13
|
+
* the command layer is unit-testable without touching real processes or sockets.
|
|
14
|
+
*/
|
|
15
|
+
export const PID_FILE = "pi-studio.pid";
|
|
16
|
+
export const CONFIG_FILE = "config.json";
|
|
17
|
+
export const HEALTH_PATH = "/api/health";
|
|
18
|
+
export function daemonPaths(home) {
|
|
19
|
+
return {
|
|
20
|
+
config: join(home, CONFIG_FILE),
|
|
21
|
+
pid: join(home, PID_FILE),
|
|
22
|
+
keypair: join(home, "daemon-keypair.json"),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Read the recorded daemon pid (or null when no live lock file). */
|
|
26
|
+
export function readDaemonPid(home) {
|
|
27
|
+
const path = daemonPaths(home).pid;
|
|
28
|
+
if (!existsSync(path))
|
|
29
|
+
return null;
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
32
|
+
return typeof parsed.pid === "number" ? parsed.pid : null;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Default health probe via node:http GET /api/health (200 ⇒ up). */
|
|
39
|
+
export const httpHealthProbe = (host, port) => new Promise((resolve) => {
|
|
40
|
+
const req = request({ host, port, path: HEALTH_PATH, method: "GET", timeout: 1500 }, (res) => {
|
|
41
|
+
res.resume();
|
|
42
|
+
resolve((res.statusCode ?? 0) >= 200 && (res.statusCode ?? 0) < 300);
|
|
43
|
+
});
|
|
44
|
+
req.on("error", () => resolve(false));
|
|
45
|
+
req.on("timeout", () => {
|
|
46
|
+
req.destroy();
|
|
47
|
+
resolve(false);
|
|
48
|
+
});
|
|
49
|
+
req.end();
|
|
50
|
+
});
|
|
51
|
+
export const bcryptHasher = (plaintext) => bcrypt.hashSync(plaintext, 10);
|
|
52
|
+
export const signalKiller = (pid, signal = "SIGTERM") => {
|
|
53
|
+
try {
|
|
54
|
+
process.kill(pid, signal);
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Default daemon starter: spawn a detached Node process that boots the daemon from
|
|
63
|
+
* `@av-pi-studio/server`. Resolves once the process is spawned (health is then polled by the
|
|
64
|
+
* caller). The server entry is resolved lazily so the CLI does not hard-depend on the server build.
|
|
65
|
+
*/
|
|
66
|
+
export const subprocessStarter = ({ home, listen }) => new Promise((resolve, reject) => {
|
|
67
|
+
const code = `import('@av-pi-studio/server').then(m=>m.bootstrap({env:{...process.env,PI_STUDIO_HOME:${JSON.stringify(home)},PI_STUDIO_LISTEN:${JSON.stringify(listen)}}}))`;
|
|
68
|
+
const child = spawn(process.execPath, ["--input-type=module", "-e", code], {
|
|
69
|
+
detached: true,
|
|
70
|
+
stdio: "ignore",
|
|
71
|
+
env: { ...process.env, PI_STUDIO_HOME: home, PI_STUDIO_LISTEN: listen },
|
|
72
|
+
});
|
|
73
|
+
child.on("error", reject);
|
|
74
|
+
if (child.pid === undefined) {
|
|
75
|
+
reject(new Error("failed to spawn daemon process"));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
child.unref();
|
|
79
|
+
resolve(child.pid);
|
|
80
|
+
});
|
|
81
|
+
export function defaultDaemonRuntime() {
|
|
82
|
+
return {
|
|
83
|
+
probe: httpHealthProbe,
|
|
84
|
+
hash: bcryptHasher,
|
|
85
|
+
kill: signalKiller,
|
|
86
|
+
start: subprocessStarter,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// ─── Operations ──────────────────────────────────────────────────────────────────
|
|
90
|
+
/** Report whether the daemon at the given host is reachable. */
|
|
91
|
+
export async function daemonStatus(runtime, hostArg) {
|
|
92
|
+
const { host, port } = parseHost(hostArg);
|
|
93
|
+
const up = await runtime.probe(host, port);
|
|
94
|
+
return { up, host, port };
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Write a bcrypt-hashed password into `config.json` (daemon.auth.password). The daemon enforces it
|
|
98
|
+
* on its next (re)start. Preserves existing config; creates the file/home if missing.
|
|
99
|
+
*/
|
|
100
|
+
export function setDaemonPassword(home, plaintext, runtime) {
|
|
101
|
+
const path = daemonPaths(home).config;
|
|
102
|
+
let config = {};
|
|
103
|
+
if (existsSync(path)) {
|
|
104
|
+
try {
|
|
105
|
+
config = JSON.parse(readFileSync(path, "utf8"));
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
config = {};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const daemon = config.daemon ?? {};
|
|
112
|
+
const auth = daemon.auth ?? {};
|
|
113
|
+
auth.password = runtime.hash(plaintext);
|
|
114
|
+
daemon.auth = auth;
|
|
115
|
+
config.daemon = daemon;
|
|
116
|
+
if (config.version === undefined)
|
|
117
|
+
config.version = 1;
|
|
118
|
+
mkdirSync(home, { recursive: true });
|
|
119
|
+
writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
120
|
+
}
|
|
121
|
+
/** Stop the local daemon by signaling its recorded pid. Returns false when no daemon was found. */
|
|
122
|
+
export function stopDaemon(home, runtime) {
|
|
123
|
+
const pid = readDaemonPid(home);
|
|
124
|
+
if (pid === null)
|
|
125
|
+
return false;
|
|
126
|
+
return runtime.kill(pid);
|
|
127
|
+
}
|
|
128
|
+
/** Poll the health endpoint until the daemon is up or attempts are exhausted. */
|
|
129
|
+
export async function waitForDaemon(runtime, host, port, opts = {}) {
|
|
130
|
+
const attempts = opts.attempts ?? 40;
|
|
131
|
+
const delayMs = opts.delayMs ?? 150;
|
|
132
|
+
const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
133
|
+
for (let i = 0; i < attempts; i++) {
|
|
134
|
+
if (await runtime.probe(host, port))
|
|
135
|
+
return true;
|
|
136
|
+
await sleep(delayMs);
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=daemon-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-control.js","sourceRoot":"","sources":["../src/daemon-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;AACxC,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AAQzC,MAAM,UAAU,WAAW,CAA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F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,IAAI,MAAM,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACjD,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type CliContext, type GlobalOptions } from "./cli-core.js";
|
|
3
|
+
/**
|
|
4
|
+
* Feature command groups (features/cli.md § Command tree): chat, terminal, loop, schedule, permit,
|
|
5
|
+
* provider, worktree, plus top-level `open`/`<path>`. Each command maps to the same WS RPC as its
|
|
6
|
+
* app/MCP equivalent.
|
|
7
|
+
*
|
|
8
|
+
* Terminal / worktree / provider / permission RPC names match registered daemon handlers and MCP
|
|
9
|
+
* tools. Chat / loop / schedule wire names follow the daemon's `_request` convention and the message
|
|
10
|
+
* names in the per-feature scopes (e.g. `ChatCreateRequest` → `chat_create_request`); their daemon
|
|
11
|
+
* handlers land in an integration sprint — flagged TODO(verify) in `FEATURE_RPC`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const FEATURE_RPC: {
|
|
14
|
+
readonly chatCreate: "chat_create_request";
|
|
15
|
+
readonly chatList: "chat_list_request";
|
|
16
|
+
readonly chatInspect: "chat_inspect_request";
|
|
17
|
+
readonly chatPost: "chat_post_request";
|
|
18
|
+
readonly chatRead: "chat_read_request";
|
|
19
|
+
readonly chatWait: "chat_wait_request";
|
|
20
|
+
readonly chatDelete: "chat_delete_request";
|
|
21
|
+
readonly terminalList: "list_terminals_request";
|
|
22
|
+
readonly terminalCreate: "create_terminal_request";
|
|
23
|
+
readonly terminalCapture: "capture_terminal_request";
|
|
24
|
+
readonly terminalInput: "terminal_input";
|
|
25
|
+
readonly terminalKill: "kill_terminal_request";
|
|
26
|
+
readonly loopRun: "loop_run_request";
|
|
27
|
+
readonly loopList: "loop_list_request";
|
|
28
|
+
readonly loopInspect: "loop_inspect_request";
|
|
29
|
+
readonly loopLogs: "loop_logs_request";
|
|
30
|
+
readonly loopStop: "loop_stop_request";
|
|
31
|
+
readonly scheduleCreate: "schedule_create_request";
|
|
32
|
+
readonly scheduleList: "schedule_list_request";
|
|
33
|
+
readonly scheduleInspect: "schedule_inspect_request";
|
|
34
|
+
readonly scheduleUpdate: "schedule_update_request";
|
|
35
|
+
readonly schedulePause: "schedule_pause_request";
|
|
36
|
+
readonly scheduleResume: "schedule_resume_request";
|
|
37
|
+
readonly scheduleRunOnce: "schedule_run_once_request";
|
|
38
|
+
readonly scheduleLogs: "schedule_logs_request";
|
|
39
|
+
readonly scheduleDelete: "schedule_delete_request";
|
|
40
|
+
readonly permitRespond: "respond_to_permission";
|
|
41
|
+
readonly permitList: "list_permissions_request";
|
|
42
|
+
readonly providerList: "list_providers";
|
|
43
|
+
readonly providerModels: "list_models";
|
|
44
|
+
readonly worktreeCreate: "create_pistudio_worktree_request";
|
|
45
|
+
readonly worktreeList: "pistudio_worktree_list_request";
|
|
46
|
+
readonly worktreeArchive: "pistudio_worktree_archive_request";
|
|
47
|
+
readonly openProject: "open_project_request";
|
|
48
|
+
};
|
|
49
|
+
type RenderFn = (payload: unknown) => string;
|
|
50
|
+
/** Run a single RPC and render its payload, returning an exit code. */
|
|
51
|
+
export declare function featureRpc(ctx: CliContext, opts: GlobalOptions, type: string, params: Record<string, unknown>, render: RenderFn): Promise<number>;
|
|
52
|
+
export declare function registerFeatureCommands(program: Command, ctx: CliContext, setExit: (code: number) => void): void;
|
|
53
|
+
/** Open a project at `path` (used by `open <path>` and the bare `pi-studio <path>` form). */
|
|
54
|
+
export declare function runOpenProject(ctx: CliContext, opts: GlobalOptions, path: string): Promise<number>;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=feature-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-commands.d.ts","sourceRoot":"","sources":["../src/feature-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAuB,MAAM,eAAe,CAAC;AAGzF;;;;;;;;;GASG;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Cd,CAAC;AAEX,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC;AAoB7C,uEAAuE;AACvE,wBAAsB,UAAU,CAC9B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,QAAQ,GACf,OAAO,CAAC,MAAM,CAAC,CAMjB;AAID,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC9B,IAAI,CAkPN;AAED,6FAA6F;AAC7F,wBAAgB,cAAc,CAC5B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAEjB"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { EXIT_OK, withDaemon } from "./cli-core.js";
|
|
2
|
+
import { renderJson, renderObject, renderTable } from "./output.js";
|
|
3
|
+
/**
|
|
4
|
+
* Feature command groups (features/cli.md § Command tree): chat, terminal, loop, schedule, permit,
|
|
5
|
+
* provider, worktree, plus top-level `open`/`<path>`. Each command maps to the same WS RPC as its
|
|
6
|
+
* app/MCP equivalent.
|
|
7
|
+
*
|
|
8
|
+
* Terminal / worktree / provider / permission RPC names match registered daemon handlers and MCP
|
|
9
|
+
* tools. Chat / loop / schedule wire names follow the daemon's `_request` convention and the message
|
|
10
|
+
* names in the per-feature scopes (e.g. `ChatCreateRequest` → `chat_create_request`); their daemon
|
|
11
|
+
* handlers land in an integration sprint — flagged TODO(verify) in `FEATURE_RPC`.
|
|
12
|
+
*/
|
|
13
|
+
export const FEATURE_RPC = {
|
|
14
|
+
// chat (chat-rooms.md § Operations) — TODO(verify) wire names.
|
|
15
|
+
chatCreate: "chat_create_request",
|
|
16
|
+
chatList: "chat_list_request",
|
|
17
|
+
chatInspect: "chat_inspect_request",
|
|
18
|
+
chatPost: "chat_post_request",
|
|
19
|
+
chatRead: "chat_read_request",
|
|
20
|
+
chatWait: "chat_wait_request",
|
|
21
|
+
chatDelete: "chat_delete_request",
|
|
22
|
+
// terminal (registered handlers).
|
|
23
|
+
terminalList: "list_terminals_request",
|
|
24
|
+
terminalCreate: "create_terminal_request",
|
|
25
|
+
terminalCapture: "capture_terminal_request",
|
|
26
|
+
terminalInput: "terminal_input",
|
|
27
|
+
terminalKill: "kill_terminal_request",
|
|
28
|
+
// loop — TODO(verify) wire names.
|
|
29
|
+
loopRun: "loop_run_request",
|
|
30
|
+
loopList: "loop_list_request",
|
|
31
|
+
loopInspect: "loop_inspect_request",
|
|
32
|
+
loopLogs: "loop_logs_request",
|
|
33
|
+
loopStop: "loop_stop_request",
|
|
34
|
+
// schedule — TODO(verify) wire names.
|
|
35
|
+
scheduleCreate: "schedule_create_request",
|
|
36
|
+
scheduleList: "schedule_list_request",
|
|
37
|
+
scheduleInspect: "schedule_inspect_request",
|
|
38
|
+
scheduleUpdate: "schedule_update_request",
|
|
39
|
+
schedulePause: "schedule_pause_request",
|
|
40
|
+
scheduleResume: "schedule_resume_request",
|
|
41
|
+
scheduleRunOnce: "schedule_run_once_request",
|
|
42
|
+
scheduleLogs: "schedule_logs_request",
|
|
43
|
+
scheduleDelete: "schedule_delete_request",
|
|
44
|
+
// permit (registered: respond_to_permission alias). list — TODO(verify).
|
|
45
|
+
permitRespond: "respond_to_permission",
|
|
46
|
+
permitList: "list_permissions_request",
|
|
47
|
+
// provider (MCP tools / facade RPCs).
|
|
48
|
+
providerList: "list_providers",
|
|
49
|
+
providerModels: "list_models",
|
|
50
|
+
// worktree (registered handlers).
|
|
51
|
+
worktreeCreate: "create_pistudio_worktree_request",
|
|
52
|
+
worktreeList: "pistudio_worktree_list_request",
|
|
53
|
+
worktreeArchive: "pistudio_worktree_archive_request",
|
|
54
|
+
// open project (registered handler).
|
|
55
|
+
openProject: "open_project_request",
|
|
56
|
+
};
|
|
57
|
+
/** Render a list payload (`payload[key]`) as a table, or the whole payload otherwise. */
|
|
58
|
+
function tableOf(key, columns) {
|
|
59
|
+
return (payload) => {
|
|
60
|
+
const rows = payload?.[key];
|
|
61
|
+
if (Array.isArray(rows))
|
|
62
|
+
return renderTable(rows, columns);
|
|
63
|
+
return renderObject((payload ?? {}));
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const ack = (text) => () => text;
|
|
67
|
+
const objectRender = (payload) => renderObject((payload ?? {}));
|
|
68
|
+
// ─── Generic dispatch ─────────────────────────────────────────────────────────
|
|
69
|
+
/** Run a single RPC and render its payload, returning an exit code. */
|
|
70
|
+
export async function featureRpc(ctx, opts, type, params, render) {
|
|
71
|
+
return withDaemon(ctx, opts, async (client) => {
|
|
72
|
+
const payload = await client.request(type, params);
|
|
73
|
+
ctx.sink.write(opts.json ? renderJson(payload) : render(payload));
|
|
74
|
+
return EXIT_OK;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// ─── Commander wiring ───────────────────────────────────────────────────────────
|
|
78
|
+
export function registerFeatureCommands(program, ctx, setExit) {
|
|
79
|
+
const g = () => program.opts();
|
|
80
|
+
const run = (type, params, render) => featureRpc(ctx, g(), type, params, render).then(setExit);
|
|
81
|
+
// ── chat ──
|
|
82
|
+
const chat = program.command("chat").description("agent-to-agent / human-to-agent chat rooms");
|
|
83
|
+
chat
|
|
84
|
+
.command("create <name>")
|
|
85
|
+
.option("--purpose <purpose>", "room purpose")
|
|
86
|
+
.description("create a chat room")
|
|
87
|
+
.action((name, o) => run(FEATURE_RPC.chatCreate, { name, purpose: o.purpose }, objectRender));
|
|
88
|
+
chat
|
|
89
|
+
.command("ls")
|
|
90
|
+
.description("list chat rooms")
|
|
91
|
+
.action(() => run(FEATURE_RPC.chatList, {}, tableOf("rooms", ["roomId", "name", "purpose"])));
|
|
92
|
+
chat
|
|
93
|
+
.command("inspect <roomId>")
|
|
94
|
+
.description("inspect a chat room")
|
|
95
|
+
.action((roomId) => run(FEATURE_RPC.chatInspect, { roomId }, objectRender));
|
|
96
|
+
chat
|
|
97
|
+
.command("post <roomId> <message>")
|
|
98
|
+
.option("--from <author>", "author id")
|
|
99
|
+
.description("post a message")
|
|
100
|
+
.action((roomId, message, o) => run(FEATURE_RPC.chatPost, { roomId, message, from: o.from }, ack("posted")));
|
|
101
|
+
chat
|
|
102
|
+
.command("read <roomId>")
|
|
103
|
+
.option("-n, --limit <n>", "max messages")
|
|
104
|
+
.description("read messages")
|
|
105
|
+
.action((roomId, o) => run(FEATURE_RPC.chatRead, { roomId, limit: o.limit ? Number(o.limit) : undefined }, tableOf("messages", ["author", "text", "createdAt"])));
|
|
106
|
+
chat
|
|
107
|
+
.command("wait <roomId>")
|
|
108
|
+
.description("wait for new messages")
|
|
109
|
+
.action((roomId) => run(FEATURE_RPC.chatWait, { roomId }, tableOf("messages", ["author", "text"])));
|
|
110
|
+
chat
|
|
111
|
+
.command("delete <roomId>")
|
|
112
|
+
.description("delete a chat room")
|
|
113
|
+
.action((roomId) => run(FEATURE_RPC.chatDelete, { roomId }, ack("deleted")));
|
|
114
|
+
// ── terminal ──
|
|
115
|
+
const terminal = program.command("terminal").description("workspace terminals");
|
|
116
|
+
terminal
|
|
117
|
+
.command("ls")
|
|
118
|
+
.description("list terminals")
|
|
119
|
+
.action(() => run(FEATURE_RPC.terminalList, {}, tableOf("terminals", ["slot", "title", "cols", "rows"])));
|
|
120
|
+
terminal
|
|
121
|
+
.command("create")
|
|
122
|
+
.option("--workspace <id>", "workspace id")
|
|
123
|
+
.option("--cwd <dir>", "working directory")
|
|
124
|
+
.description("create a terminal")
|
|
125
|
+
.action((o) => run(FEATURE_RPC.terminalCreate, { workspaceId: o.workspace, cwd: o.cwd }, objectRender));
|
|
126
|
+
terminal
|
|
127
|
+
.command("capture <slot>")
|
|
128
|
+
.description("capture current screen text")
|
|
129
|
+
.action((slot) => run(FEATURE_RPC.terminalCapture, { slot: Number(slot) }, (p) => String(p.text ?? "")));
|
|
130
|
+
terminal
|
|
131
|
+
.command("send-keys <slot> <data>")
|
|
132
|
+
.description("send input to a terminal")
|
|
133
|
+
.action((slot, data) => run(FEATURE_RPC.terminalInput, { slot: Number(slot), data }, ack("sent")));
|
|
134
|
+
terminal
|
|
135
|
+
.command("kill <slot>")
|
|
136
|
+
.description("kill a terminal")
|
|
137
|
+
.action((slot) => run(FEATURE_RPC.terminalKill, { slot: Number(slot) }, ack("killed")));
|
|
138
|
+
// ── loop ──
|
|
139
|
+
const loop = program.command("loop").description("looping agent runs");
|
|
140
|
+
loop
|
|
141
|
+
.command("run <prompt>")
|
|
142
|
+
.option("--max <n>", "max iterations")
|
|
143
|
+
.description("start a loop")
|
|
144
|
+
.action((prompt, o) => run(FEATURE_RPC.loopRun, { prompt, maxIterations: o.max ? Number(o.max) : undefined }, objectRender));
|
|
145
|
+
loop
|
|
146
|
+
.command("ls")
|
|
147
|
+
.description("list loops")
|
|
148
|
+
.action(() => run(FEATURE_RPC.loopList, {}, tableOf("loops", ["loopId", "status", "iteration"])));
|
|
149
|
+
loop
|
|
150
|
+
.command("inspect <loopId>")
|
|
151
|
+
.description("inspect a loop")
|
|
152
|
+
.action((loopId) => run(FEATURE_RPC.loopInspect, { loopId }, objectRender));
|
|
153
|
+
loop
|
|
154
|
+
.command("logs <loopId>")
|
|
155
|
+
.description("loop logs")
|
|
156
|
+
.action((loopId) => run(FEATURE_RPC.loopLogs, { loopId }, tableOf("entries", ["seq", "message"])));
|
|
157
|
+
loop
|
|
158
|
+
.command("stop <loopId>")
|
|
159
|
+
.description("stop a loop")
|
|
160
|
+
.action((loopId) => run(FEATURE_RPC.loopStop, { loopId }, ack("stopped")));
|
|
161
|
+
// ── schedule ──
|
|
162
|
+
const schedule = program.command("schedule").description("cron-based scheduled agents");
|
|
163
|
+
schedule
|
|
164
|
+
.command("create <cron> <prompt>")
|
|
165
|
+
.description("create a schedule")
|
|
166
|
+
.action((cron, prompt) => run(FEATURE_RPC.scheduleCreate, { cron, prompt }, objectRender));
|
|
167
|
+
schedule
|
|
168
|
+
.command("ls")
|
|
169
|
+
.description("list schedules")
|
|
170
|
+
.action(() => run(FEATURE_RPC.scheduleList, {}, tableOf("schedules", ["scheduleId", "cron", "nextRunAt"])));
|
|
171
|
+
schedule
|
|
172
|
+
.command("inspect <id>")
|
|
173
|
+
.description("inspect a schedule")
|
|
174
|
+
.action((id) => run(FEATURE_RPC.scheduleInspect, { scheduleId: id }, objectRender));
|
|
175
|
+
schedule
|
|
176
|
+
.command("update <id>")
|
|
177
|
+
.option("--cron <cron>", "new cron expression")
|
|
178
|
+
.option("--prompt <prompt>", "new prompt")
|
|
179
|
+
.description("update a schedule")
|
|
180
|
+
.action((id, o) => run(FEATURE_RPC.scheduleUpdate, { scheduleId: id, cron: o.cron, prompt: o.prompt }, ack("updated")));
|
|
181
|
+
schedule
|
|
182
|
+
.command("pause <id>")
|
|
183
|
+
.description("pause a schedule")
|
|
184
|
+
.action((id) => run(FEATURE_RPC.schedulePause, { scheduleId: id }, ack("paused")));
|
|
185
|
+
schedule
|
|
186
|
+
.command("resume <id>")
|
|
187
|
+
.description("resume a schedule")
|
|
188
|
+
.action((id) => run(FEATURE_RPC.scheduleResume, { scheduleId: id }, ack("resumed")));
|
|
189
|
+
schedule
|
|
190
|
+
.command("run-once <id>")
|
|
191
|
+
.description("run a schedule once now")
|
|
192
|
+
.action((id) => run(FEATURE_RPC.scheduleRunOnce, { scheduleId: id }, objectRender));
|
|
193
|
+
schedule
|
|
194
|
+
.command("logs <id>")
|
|
195
|
+
.description("schedule run logs")
|
|
196
|
+
.action((id) => run(FEATURE_RPC.scheduleLogs, { scheduleId: id }, tableOf("runs", ["runAt", "status"])));
|
|
197
|
+
schedule
|
|
198
|
+
.command("delete <id>")
|
|
199
|
+
.description("delete a schedule")
|
|
200
|
+
.action((id) => run(FEATURE_RPC.scheduleDelete, { scheduleId: id }, ack("deleted")));
|
|
201
|
+
// ── permit ──
|
|
202
|
+
const permit = program.command("permit").description("tool-call permissions");
|
|
203
|
+
permit
|
|
204
|
+
.command("ls")
|
|
205
|
+
.description("list pending permission requests")
|
|
206
|
+
.action(() => run(FEATURE_RPC.permitList, {}, tableOf("permissions", ["permissionRequestId", "tool", "agentId"])));
|
|
207
|
+
permit
|
|
208
|
+
.command("allow <permissionRequestId>")
|
|
209
|
+
.description("allow a pending permission")
|
|
210
|
+
.action((id) => run(FEATURE_RPC.permitRespond, { permissionRequestId: id, response: "allow" }, ack("allowed")));
|
|
211
|
+
permit
|
|
212
|
+
.command("deny <permissionRequestId>")
|
|
213
|
+
.description("deny a pending permission")
|
|
214
|
+
.action((id) => run(FEATURE_RPC.permitRespond, { permissionRequestId: id, response: "deny" }, ack("denied")));
|
|
215
|
+
// ── provider ──
|
|
216
|
+
const provider = program.command("provider").description("agent providers");
|
|
217
|
+
provider
|
|
218
|
+
.command("ls")
|
|
219
|
+
.description("list providers")
|
|
220
|
+
.action(() => run(FEATURE_RPC.providerList, {}, tableOf("providers", ["providerId", "name", "available"])));
|
|
221
|
+
provider
|
|
222
|
+
.command("models <providerId>")
|
|
223
|
+
.description("list a provider's models")
|
|
224
|
+
.action((providerId) => run(FEATURE_RPC.providerModels, { providerId }, tableOf("models", ["id", "name"])));
|
|
225
|
+
// ── worktree ──
|
|
226
|
+
const worktree = program.command("worktree").description("Pi-Studio git worktrees");
|
|
227
|
+
worktree
|
|
228
|
+
.command("create <name>")
|
|
229
|
+
.option("--workspace <id>", "workspace id")
|
|
230
|
+
.description("create a worktree")
|
|
231
|
+
.action((name, o) => run(FEATURE_RPC.worktreeCreate, { name, workspaceId: o.workspace }, objectRender));
|
|
232
|
+
worktree
|
|
233
|
+
.command("ls")
|
|
234
|
+
.description("list worktrees")
|
|
235
|
+
.action(() => run(FEATURE_RPC.worktreeList, {}, tableOf("worktrees", ["name", "path", "branch"])));
|
|
236
|
+
worktree
|
|
237
|
+
.command("archive <name>")
|
|
238
|
+
.description("archive a worktree")
|
|
239
|
+
.action((name) => run(FEATURE_RPC.worktreeArchive, { name }, ack("archived")));
|
|
240
|
+
// ── open project (top-level `open` + positional `<path>`) ──
|
|
241
|
+
program
|
|
242
|
+
.command("open <path>")
|
|
243
|
+
.description("open a project at <path>")
|
|
244
|
+
.action((path) => runOpenProject(ctx, g(), path).then(setExit));
|
|
245
|
+
}
|
|
246
|
+
/** Open a project at `path` (used by `open <path>` and the bare `pi-studio <path>` form). */
|
|
247
|
+
export function runOpenProject(ctx, opts, path) {
|
|
248
|
+
return featureRpc(ctx, opts, FEATURE_RPC.openProject, { path }, objectRender);
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=feature-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-commands.js","sourceRoot":"","sources":["../src/feature-commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,+DAA+D;IAC/D,UAAU,EAAE,qBAAqB;IACjC,QAAQ,EAAE,mBAAmB;IAC7B,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,mBAAmB;IAC7B,UAAU,E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9D,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,0BAA0B,CAAC;SACvC,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAC5B,GAAe,EACf,IAAmB,EACnB,IAAY;IAEZ,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;AAChF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const CLI_PACKAGE: "@av-pi-studio/cli";
|
|
2
|
+
/** Proves the cli consumes protocol's emitted declarations. */
|
|
3
|
+
export declare const PROTOCOL_DEP: "@av-pi-studio/protocol";
|
|
4
|
+
export * from "./client-id.js";
|
|
5
|
+
export * from "./output.js";
|
|
6
|
+
export * from "./connection.js";
|
|
7
|
+
export * from "./cli-core.js";
|
|
8
|
+
export * from "./agent-commands.js";
|
|
9
|
+
export * from "./pairing.js";
|
|
10
|
+
export * from "./qr.js";
|
|
11
|
+
export * from "./daemon-control.js";
|
|
12
|
+
export * from "./daemon-commands.js";
|
|
13
|
+
export * from "./feature-commands.js";
|
|
14
|
+
export * from "./program.js";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,EAAG,mBAA4B,CAAC;AAExD,+DAA+D;AAC/D,eAAO,MAAM,YAAY,0BAAmB,CAAC;AAG7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @av-pi-studio/cli — Commander.js terminal client; can manage a local daemon.
|
|
2
|
+
import { PROTOCOL_PACKAGE } from "@av-pi-studio/protocol";
|
|
3
|
+
export const CLI_PACKAGE = "@av-pi-studio/cli";
|
|
4
|
+
/** Proves the cli consumes protocol's emitted declarations. */
|
|
5
|
+
export const PROTOCOL_DEP = PROTOCOL_PACKAGE;
|
|
6
|
+
// CLI core: connection, output rendering, dispatch helpers, exit codes.
|
|
7
|
+
export * from "./client-id.js";
|
|
8
|
+
export * from "./output.js";
|
|
9
|
+
export * from "./connection.js";
|
|
10
|
+
export * from "./cli-core.js";
|
|
11
|
+
export * from "./agent-commands.js";
|
|
12
|
+
export * from "./pairing.js";
|
|
13
|
+
export * from "./qr.js";
|
|
14
|
+
export * from "./daemon-control.js";
|
|
15
|
+
export * from "./daemon-commands.js";
|
|
16
|
+
export * from "./feature-commands.js";
|
|
17
|
+
export * from "./program.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,CAAC,MAAM,WAAW,GAAG,mBAA4B,CAAC;AAExD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE7C,wEAAwE;AACxE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output rendering for the CLI (features/cli.md § Behavior — "render output (table/json) to stdout").
|
|
3
|
+
* Every command renders either a human-friendly table or machine-readable JSON, selected by the
|
|
4
|
+
* global `--json` flag.
|
|
5
|
+
*/
|
|
6
|
+
export type OutputFormat = "table" | "json";
|
|
7
|
+
export interface OutputSink {
|
|
8
|
+
write(line: string): void;
|
|
9
|
+
error(line: string): void;
|
|
10
|
+
}
|
|
11
|
+
/** Default sink writes to process stdout/stderr. */
|
|
12
|
+
export declare const consoleSink: OutputSink;
|
|
13
|
+
/** Render a value as pretty JSON. */
|
|
14
|
+
export declare function renderJson(value: unknown): string;
|
|
15
|
+
/**
|
|
16
|
+
* Render an array of row objects as a fixed-width text table. `columns` selects/orders the fields;
|
|
17
|
+
* when omitted, the union of keys (in first-seen order) is used. Missing cells render empty.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderTable(rows: ReadonlyArray<Record<string, unknown>>, columns?: string[]): string;
|
|
20
|
+
/**
|
|
21
|
+
* Render any RPC result for a single-object response as aligned `key: value` lines (used by
|
|
22
|
+
* `inspect`-style commands).
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderObject(value: Record<string, unknown>): string;
|
|
25
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,oDAAoD;AACpD,eAAO,MAAM,WAAW,EAAE,UAGzB,CAAC;AAEF,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5C,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAKnE"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output rendering for the CLI (features/cli.md § Behavior — "render output (table/json) to stdout").
|
|
3
|
+
* Every command renders either a human-friendly table or machine-readable JSON, selected by the
|
|
4
|
+
* global `--json` flag.
|
|
5
|
+
*/
|
|
6
|
+
/** Default sink writes to process stdout/stderr. */
|
|
7
|
+
export const consoleSink = {
|
|
8
|
+
write: (line) => process.stdout.write(`${line}\n`),
|
|
9
|
+
error: (line) => process.stderr.write(`${line}\n`),
|
|
10
|
+
};
|
|
11
|
+
/** Render a value as pretty JSON. */
|
|
12
|
+
export function renderJson(value) {
|
|
13
|
+
return JSON.stringify(value, null, 2);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Render an array of row objects as a fixed-width text table. `columns` selects/orders the fields;
|
|
17
|
+
* when omitted, the union of keys (in first-seen order) is used. Missing cells render empty.
|
|
18
|
+
*/
|
|
19
|
+
export function renderTable(rows, columns) {
|
|
20
|
+
if (rows.length === 0)
|
|
21
|
+
return "(no results)";
|
|
22
|
+
const cols = columns ?? unionKeys(rows);
|
|
23
|
+
if (cols.length === 0)
|
|
24
|
+
return "(no columns)";
|
|
25
|
+
const cells = rows.map((row) => cols.map((c) => formatCell(row[c])));
|
|
26
|
+
const widths = cols.map((c, i) => Math.max(c.length, ...cells.map((r) => r[i].length)));
|
|
27
|
+
const header = cols.map((c, i) => c.toUpperCase().padEnd(widths[i])).join(" ");
|
|
28
|
+
const body = cells.map((r) => r.map((cell, i) => cell.padEnd(widths[i])).join(" "));
|
|
29
|
+
return [header, ...body].join("\n").trimEnd();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render any RPC result for a single-object response as aligned `key: value` lines (used by
|
|
33
|
+
* `inspect`-style commands).
|
|
34
|
+
*/
|
|
35
|
+
export function renderObject(value) {
|
|
36
|
+
const keys = Object.keys(value);
|
|
37
|
+
if (keys.length === 0)
|
|
38
|
+
return "(empty)";
|
|
39
|
+
const width = Math.max(...keys.map((k) => k.length));
|
|
40
|
+
return keys.map((k) => `${k.padEnd(width)} ${formatCell(value[k])}`).join("\n");
|
|
41
|
+
}
|
|
42
|
+
/** Format a single value for a table/object cell. */
|
|
43
|
+
function formatCell(value) {
|
|
44
|
+
if (value === null || value === undefined)
|
|
45
|
+
return "";
|
|
46
|
+
if (typeof value === "string")
|
|
47
|
+
return value;
|
|
48
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
49
|
+
return String(value);
|
|
50
|
+
return JSON.stringify(value);
|
|
51
|
+
}
|
|
52
|
+
function unionKeys(rows) {
|
|
53
|
+
const seen = [];
|
|
54
|
+
const set = new Set();
|
|
55
|
+
for (const row of rows) {
|
|
56
|
+
for (const key of Object.keys(row)) {
|
|
57
|
+
if (!set.has(key)) {
|
|
58
|
+
set.add(key);
|
|
59
|
+
seen.push(key);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return seen;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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