inhuman 0.1.0 → 0.3.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/README.md +49 -0
- package/bin/inhuman.mjs +2 -20
- package/dist/bin.d.ts +6 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +16 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli/blobs-command.d.ts +31 -0
- package/dist/cli/blobs-command.d.ts.map +1 -0
- package/dist/cli/blobs-command.js +184 -0
- package/dist/cli/blobs-command.js.map +1 -0
- package/dist/cli/browser.d.ts +3 -0
- package/dist/cli/browser.d.ts.map +1 -0
- package/dist/cli/browser.js +10 -0
- package/dist/cli/browser.js.map +1 -0
- package/dist/cli/completion-command.d.ts +15 -0
- package/dist/cli/completion-command.d.ts.map +1 -0
- package/dist/cli/completion-command.js +201 -0
- package/dist/cli/completion-command.js.map +1 -0
- package/dist/cli/context.d.ts +23 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +67 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/daemon.d.ts +22 -0
- package/dist/cli/daemon.d.ts.map +1 -0
- package/dist/cli/daemon.js +61 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/eval-command.d.ts +16 -0
- package/dist/cli/eval-command.d.ts.map +1 -0
- package/dist/cli/eval-command.js +114 -0
- package/dist/cli/eval-command.js.map +1 -0
- package/dist/cli/install-command.d.ts +8 -0
- package/dist/cli/install-command.d.ts.map +1 -0
- package/dist/cli/install-command.js +25 -0
- package/dist/cli/install-command.js.map +1 -0
- package/dist/cli/kernel-client.d.ts +3 -0
- package/dist/cli/kernel-client.d.ts.map +1 -0
- package/dist/cli/kernel-client.js +12 -0
- package/dist/cli/kernel-client.js.map +1 -0
- package/dist/cli/mcp-commands.d.ts +61 -0
- package/dist/cli/mcp-commands.d.ts.map +1 -0
- package/dist/cli/mcp-commands.js +139 -0
- package/dist/cli/mcp-commands.js.map +1 -0
- package/dist/cli/mcp.d.ts +25 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +261 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/register.d.ts +12 -0
- package/dist/cli/register.d.ts.map +1 -0
- package/dist/cli/register.js +133 -0
- package/dist/cli/register.js.map +1 -0
- package/dist/cli/remote-commands.d.ts +49 -0
- package/dist/cli/remote-commands.d.ts.map +1 -0
- package/dist/cli/remote-commands.js +184 -0
- package/dist/cli/remote-commands.js.map +1 -0
- package/dist/cli/resume-complete.d.ts +24 -0
- package/dist/cli/resume-complete.d.ts.map +1 -0
- package/dist/cli/resume-complete.js +35 -0
- package/dist/cli/resume-complete.js.map +1 -0
- package/dist/cli/shell-import.d.ts +22 -0
- package/dist/cli/shell-import.d.ts.map +1 -0
- package/dist/cli/shell-import.js +32 -0
- package/dist/cli/shell-import.js.map +1 -0
- package/dist/cli/tui-command.d.ts +11 -0
- package/dist/cli/tui-command.d.ts.map +1 -0
- package/dist/cli/tui-command.js +41 -0
- package/dist/cli/tui-command.js.map +1 -0
- package/dist/cli/web-commands.d.ts +54 -0
- package/dist/cli/web-commands.d.ts.map +1 -0
- package/dist/cli/web-commands.js +106 -0
- package/dist/cli/web-commands.js.map +1 -0
- package/dist/cli/web-door-command.d.ts +11 -0
- package/dist/cli/web-door-command.d.ts.map +1 -0
- package/dist/cli/web-door-command.js +151 -0
- package/dist/cli/web-door-command.js.map +1 -0
- package/dist/cli/web-door.d.ts +25 -0
- package/dist/cli/web-door.d.ts.map +1 -0
- package/dist/cli/web-door.js +116 -0
- package/dist/cli/web-door.js.map +1 -0
- package/dist/cli/web-static.d.ts +8 -0
- package/dist/cli/web-static.d.ts.map +1 -0
- package/dist/cli/web-static.js +23 -0
- package/dist/cli/web-static.js.map +1 -0
- package/dist/eval/progress.d.ts +8 -0
- package/dist/eval/progress.d.ts.map +1 -0
- package/dist/eval/progress.js +64 -0
- package/dist/eval/progress.js.map +1 -0
- package/dist/eval/run.d.ts +20 -0
- package/dist/eval/run.d.ts.map +1 -0
- package/dist/eval/run.js +301 -0
- package/dist/eval/run.js.map +1 -0
- package/package.json +42 -5
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { hasCliAgentFlags, unsupportedAgentFlagsError, } from "@inhuman.tools/harness-sdk/launch";
|
|
4
|
+
import { Command, Option } from "clipanion";
|
|
5
|
+
export class ShellContext {
|
|
6
|
+
stdin;
|
|
7
|
+
stdout;
|
|
8
|
+
stderr;
|
|
9
|
+
cwd;
|
|
10
|
+
env;
|
|
11
|
+
colorDepth;
|
|
12
|
+
// Own field, not a prototype method. Clipanion's Cli.process and Cli.run
|
|
13
|
+
// replace the context with `{ ...defaultContext, ...context }`, which drops
|
|
14
|
+
// the prototype. A method here is undefined on `this.context` inside commands.
|
|
15
|
+
writeErr = (error) => {
|
|
16
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
17
|
+
this.stderr.write(message.endsWith("\n") ? message : `${message}\n`);
|
|
18
|
+
};
|
|
19
|
+
constructor(streams) {
|
|
20
|
+
this.stdin = streams.stdin;
|
|
21
|
+
this.stdout = streams.stdout;
|
|
22
|
+
this.stderr = streams.stderr;
|
|
23
|
+
this.cwd = streams.cwd ?? process.cwd();
|
|
24
|
+
this.env = process.env;
|
|
25
|
+
this.colorDepth = this.#colorDepth();
|
|
26
|
+
}
|
|
27
|
+
#colorDepth() {
|
|
28
|
+
if (typeof this.stdout.getColorDepth === "function") {
|
|
29
|
+
try {
|
|
30
|
+
return this.stdout.getColorDepth();
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* NODE_COLOR_DEPTH: WriteStream.getColorDepth() throws off-TTY */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class KernelCommand extends Command {
|
|
40
|
+
kernel = Option.String("--kernel", join(homedir(), ".harness"), {
|
|
41
|
+
description: "system folder",
|
|
42
|
+
});
|
|
43
|
+
connection = Option.String("--connection", {
|
|
44
|
+
description: "completion connection id",
|
|
45
|
+
required: false,
|
|
46
|
+
});
|
|
47
|
+
model = Option.String("--model", {
|
|
48
|
+
description: "model id (unique across connections unless --connection)",
|
|
49
|
+
required: false,
|
|
50
|
+
});
|
|
51
|
+
kernelPath() {
|
|
52
|
+
return resolve(this.kernel);
|
|
53
|
+
}
|
|
54
|
+
cliAgentFlags() {
|
|
55
|
+
return {
|
|
56
|
+
...(this.connection == null ? {} : { connection: this.connection }),
|
|
57
|
+
...(this.model == null ? {} : { model: this.model }),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
rejectUnsupportedAgentFlags(surface) {
|
|
61
|
+
if (!hasCliAgentFlags(this.cliAgentFlags()))
|
|
62
|
+
return undefined;
|
|
63
|
+
this.context.writeErr(unsupportedAgentFlagsError(surface));
|
|
64
|
+
return 2;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/cli/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAI3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAoB,MAAM,WAAW,CAAC;AAI9D,MAAM,OAAO,YAAY;IACd,KAAK,CAAoB;IACzB,MAAM,CAAqB;IAC3B,MAAM,CAAqB;IAC3B,GAAG,CAAS;IACZ,GAAG,CAAoB;IACvB,UAAU,CAAS;IAE5B,yEAAyE;IACzE,4EAA4E;IAC5E,+EAA+E;IACtE,QAAQ,GAAG,CAAC,KAAc,EAAQ,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QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IACH,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;QAC/B,WAAW,EAAE,0DAA0D;QACvE,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,UAAU;QACR,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,aAAa;QACX,OAAO;YACL,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;YACnE,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;SACrD,CAAC;IACJ,CAAC;IAED,2BAA2B,CAAC,OAAe;QACzC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAAE,OAAO,SAAS,CAAC;QAC9D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { KernelCommand } from "./context.js";
|
|
2
|
+
export declare class DaemonCommand extends KernelCommand {
|
|
3
|
+
static paths: string[][];
|
|
4
|
+
static usage: import("clipanion").Usage;
|
|
5
|
+
execute(): Promise<number>;
|
|
6
|
+
}
|
|
7
|
+
export declare class DaemonStartCommand extends KernelCommand {
|
|
8
|
+
static paths: string[][];
|
|
9
|
+
static usage: import("clipanion").Usage;
|
|
10
|
+
execute(): Promise<number>;
|
|
11
|
+
}
|
|
12
|
+
export declare class DaemonStopCommand extends KernelCommand {
|
|
13
|
+
static paths: string[][];
|
|
14
|
+
static usage: import("clipanion").Usage;
|
|
15
|
+
execute(): Promise<number>;
|
|
16
|
+
}
|
|
17
|
+
export declare class DaemonRestartCommand extends KernelCommand {
|
|
18
|
+
static paths: string[][];
|
|
19
|
+
static usage: import("clipanion").Usage;
|
|
20
|
+
execute(): Promise<number>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=daemon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/cli/daemon.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,qBAAa,aAAc,SAAQ,aAAa;IAC9C,MAAM,CAAC,KAAK,aAAgB;IAC5B,MAAM,CAAC,KAAK,4BAGT;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAMjC;AAED,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,MAAM,CAAC,KAAK,aAAyB;IACrC,MAAM,CAAC,KAAK,4BAGT;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAGjC;AAED,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,MAAM,CAAC,KAAK,aAAwB;IACpC,MAAM,CAAC,KAAK,4BAGT;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAGjC;AAED,qBAAa,oBAAqB,SAAQ,aAAa;IACrD,MAAM,CAAC,KAAK,aAA2B;IACvC,MAAM,CAAC,KAAK,4BAGT;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAGjC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ensure, stop } from "@inhuman.tools/harness";
|
|
2
|
+
import { Command } from "clipanion";
|
|
3
|
+
import { KernelCommand } from "./context.js";
|
|
4
|
+
export class DaemonCommand extends KernelCommand {
|
|
5
|
+
static paths = [["daemon"]];
|
|
6
|
+
static usage = Command.Usage({
|
|
7
|
+
category: "Daemon",
|
|
8
|
+
description: "start or stop the daemon",
|
|
9
|
+
});
|
|
10
|
+
async execute() {
|
|
11
|
+
const blocked = this.rejectUnsupportedAgentFlags("inhuman daemon");
|
|
12
|
+
if (blocked !== undefined)
|
|
13
|
+
return blocked;
|
|
14
|
+
this.context.stderr.write("Specify a daemon command: start, stop, restart\n");
|
|
15
|
+
return 2;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class DaemonStartCommand extends KernelCommand {
|
|
19
|
+
static paths = [["daemon", "start"]];
|
|
20
|
+
static usage = Command.Usage({
|
|
21
|
+
category: "Daemon",
|
|
22
|
+
description: "start the daemon",
|
|
23
|
+
});
|
|
24
|
+
async execute() {
|
|
25
|
+
return runDaemon(this, "inhuman daemon start", () => ensure(this.kernelPath()));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export class DaemonStopCommand extends KernelCommand {
|
|
29
|
+
static paths = [["daemon", "stop"]];
|
|
30
|
+
static usage = Command.Usage({
|
|
31
|
+
category: "Daemon",
|
|
32
|
+
description: "stop the daemon",
|
|
33
|
+
});
|
|
34
|
+
async execute() {
|
|
35
|
+
return runDaemon(this, "inhuman daemon stop", () => stop(this.kernelPath()));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export class DaemonRestartCommand extends KernelCommand {
|
|
39
|
+
static paths = [["daemon", "restart"]];
|
|
40
|
+
static usage = Command.Usage({
|
|
41
|
+
category: "Daemon",
|
|
42
|
+
description: "restart the daemon",
|
|
43
|
+
});
|
|
44
|
+
async execute() {
|
|
45
|
+
return runDaemon(this, "inhuman daemon restart", () => ensure(this.kernelPath(), { restart: true }));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function runDaemon(cmd, surface, run) {
|
|
49
|
+
const blocked = cmd.rejectUnsupportedAgentFlags(surface);
|
|
50
|
+
if (blocked !== undefined)
|
|
51
|
+
return blocked;
|
|
52
|
+
try {
|
|
53
|
+
await run();
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
cmd.context.writeErr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AO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KernelCommand } from "./context.js";
|
|
2
|
+
export declare class EvalCommand extends KernelCommand {
|
|
3
|
+
static paths: string[][];
|
|
4
|
+
static usage: import("clipanion").Usage;
|
|
5
|
+
expression: string | undefined;
|
|
6
|
+
prompt: string | undefined;
|
|
7
|
+
file: string | undefined;
|
|
8
|
+
mode: "auto" | "yolo";
|
|
9
|
+
format: "scheme" | "json";
|
|
10
|
+
agent: string | undefined;
|
|
11
|
+
resume: string | undefined;
|
|
12
|
+
session: string | undefined;
|
|
13
|
+
continueLast: boolean;
|
|
14
|
+
execute(): Promise<number>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=eval-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval-command.d.ts","sourceRoot":"","sources":["../../src/cli/eval-command.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAkB7C,qBAAa,WAAY,SAAQ,aAAa;IAC5C,MAAM,CAAC,KAAK,aAAc;IAC1B,MAAM,CAAC,KAAK,4BAET;IAEH,UAAU,qBAA8E;IACxF,MAAM,qBAAqF;IAC3F,IAAI,qBAAoD;IACxD,IAAI,kBAGD;IACH,MAAM,oBAGH;IACH,KAAK,qBAAiF;IACtF,MAAM,qBAAgG;IACtG,OAAO,qBAAiG;IACxG,YAAY,UAET;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAyDjC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unattended program entry. Source is loaded before the session exists.
|
|
3
|
+
* `--resume` / `--session` / `--continue` belong to the TUI attach path.
|
|
4
|
+
*/
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
import { text } from "node:stream/consumers";
|
|
8
|
+
import { ensure } from "@inhuman.tools/harness";
|
|
9
|
+
import { isEvalPermissionMode } from "@inhuman.tools/harness-model";
|
|
10
|
+
import { Command, Option } from "clipanion";
|
|
11
|
+
import { isEnum, makeValidator } from "typanion";
|
|
12
|
+
import { KernelCommand } from "./context.js";
|
|
13
|
+
import { runEval } from "../eval/run.js";
|
|
14
|
+
const isEvalMode = makeValidator({
|
|
15
|
+
test: (value, state) => {
|
|
16
|
+
const id = value === "always-approve" ? "yolo" : value;
|
|
17
|
+
if (typeof id === "string" && isEvalPermissionMode(id)) {
|
|
18
|
+
if (id !== value && state?.coercions != null) {
|
|
19
|
+
if (state.coercion == null)
|
|
20
|
+
return false;
|
|
21
|
+
state.coercions.push([state.p ?? ".", state.coercion.bind(null, id)]);
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
state?.errors?.push(`Expected one of "auto", "yolo", or "always-approve" (got ${JSON.stringify(value)})`);
|
|
26
|
+
return false;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export class EvalCommand extends KernelCommand {
|
|
30
|
+
static paths = [["eval"]];
|
|
31
|
+
static usage = Command.Usage({
|
|
32
|
+
description: "run a program once and print its result",
|
|
33
|
+
});
|
|
34
|
+
expression = Option.String("-e", { description: "Scheme expression", required: false });
|
|
35
|
+
prompt = Option.String("-p", { description: "prompt text for bot/send", required: false });
|
|
36
|
+
file = Option.String({ required: false, name: "file" });
|
|
37
|
+
mode = Option.String("--mode", "auto", {
|
|
38
|
+
description: "authorization policy: auto, yolo, always-approve",
|
|
39
|
+
validator: isEvalMode,
|
|
40
|
+
});
|
|
41
|
+
format = Option.String("--format", "scheme", {
|
|
42
|
+
description: "stdout encoding: scheme, json",
|
|
43
|
+
validator: isEnum(["scheme", "json"]),
|
|
44
|
+
});
|
|
45
|
+
agent = Option.String("--agent", { description: "bot/send target", required: false });
|
|
46
|
+
resume = Option.String("--resume", { description: "TUI attach; illegal with eval", required: false });
|
|
47
|
+
session = Option.String("--session", { description: "TUI attach; illegal with eval", required: false });
|
|
48
|
+
continueLast = Option.Boolean("--continue,-c", false, {
|
|
49
|
+
description: "TUI attach; illegal with eval",
|
|
50
|
+
});
|
|
51
|
+
async execute() {
|
|
52
|
+
if (this.resume != null || this.session != null || this.continueLast) {
|
|
53
|
+
this.context.writeErr("eval cannot attach with --resume, --session, or --continue");
|
|
54
|
+
return 2;
|
|
55
|
+
}
|
|
56
|
+
if (this.prompt != null && (this.expression != null || this.file != null)) {
|
|
57
|
+
this.context.writeErr("-p cannot combine with -e or a .scm file");
|
|
58
|
+
return 2;
|
|
59
|
+
}
|
|
60
|
+
if (this.prompt == null && this.expression == null && this.file == null) {
|
|
61
|
+
this.context.writeErr("eval requires -e, -p, or a .scm file");
|
|
62
|
+
return 2;
|
|
63
|
+
}
|
|
64
|
+
let expr;
|
|
65
|
+
let source;
|
|
66
|
+
let sourcePath;
|
|
67
|
+
try {
|
|
68
|
+
if (this.file == null) {
|
|
69
|
+
const raw = this.expression ?? this.prompt ?? "";
|
|
70
|
+
const body = raw === "-" ? await text(this.context.stdin) : raw;
|
|
71
|
+
if (this.prompt == null) {
|
|
72
|
+
expr = body;
|
|
73
|
+
}
|
|
74
|
+
else if (this.agent == null || this.agent.trim() === "") {
|
|
75
|
+
this.context.writeErr("-p requires --agent");
|
|
76
|
+
return 2;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const atom = /^[a-z][\w/!?+.-]*$/i.test(this.agent) ? `'${this.agent}` : JSON.stringify(this.agent);
|
|
80
|
+
expr = `(bot/send ${atom} ${JSON.stringify(body)})`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
sourcePath = resolve(this.context.cwd, this.file);
|
|
85
|
+
const fileText = await readFile(sourcePath, "utf8");
|
|
86
|
+
if (this.expression == null) {
|
|
87
|
+
expr = fileText;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
source = fileText;
|
|
91
|
+
const raw = this.expression;
|
|
92
|
+
expr = raw === "-" ? await text(this.context.stdin) : raw;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.context.writeErr(error);
|
|
98
|
+
return 1;
|
|
99
|
+
}
|
|
100
|
+
return runEval({
|
|
101
|
+
kernel: this.kernelPath(),
|
|
102
|
+
project: this.context.cwd,
|
|
103
|
+
expr,
|
|
104
|
+
source,
|
|
105
|
+
sourcePath,
|
|
106
|
+
policy: this.mode,
|
|
107
|
+
format: this.format,
|
|
108
|
+
agent: this.cliAgentFlags(),
|
|
109
|
+
streams: this.context,
|
|
110
|
+
ensure,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=eval-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval-command.js","sourceRoot":"","sources":["../../src/cli/eval-command.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAA2B,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAA8B;IAC5D,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,EAA+B,EAAE;QAClD,MAAM,EAAE,GAAG,KAAK,KAAK,gBAAgB,CAAC,CAAC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AAC;YACH,CAAC;iBAAM,CAAC;gBACN,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBACpD,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;oBAC5B,IAAI,GAAG,QAAQ,CAAC;gBAClB,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,QAAQ,CAAC;oBAClB,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;oBAC5B,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC7B,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,OAAO,CAAC;YACb,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG;YACzB,IAAI;YACJ,MAAM;YACN,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,IAAI;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM;SACP,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { KernelCommand } from "./context.js";
|
|
2
|
+
export declare class InstallCommand extends KernelCommand {
|
|
3
|
+
static paths: string[][];
|
|
4
|
+
static usage: import("clipanion").Usage;
|
|
5
|
+
pkg: string;
|
|
6
|
+
execute(): Promise<number>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=install-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-command.d.ts","sourceRoot":"","sources":["../../src/cli/install-command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,qBAAa,cAAe,SAAQ,aAAa;IAC/C,MAAM,CAAC,KAAK,aAAiB;IAC7B,MAAM,CAAC,KAAK,4BAIT;IAEH,GAAG,SAAsC;IAEnC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAUjC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { installPlugin } from "@inhuman.tools/harness";
|
|
2
|
+
import { Command, Option } from "clipanion";
|
|
3
|
+
import { KernelCommand } from "./context.js";
|
|
4
|
+
export class InstallCommand extends KernelCommand {
|
|
5
|
+
static paths = [["install"]];
|
|
6
|
+
static usage = Command.Usage({
|
|
7
|
+
category: "Plugins",
|
|
8
|
+
description: "install a plugin into the kernel",
|
|
9
|
+
examples: [["npm package", "$0 install @inhuman.tools/plugin-goal"]],
|
|
10
|
+
});
|
|
11
|
+
pkg = Option.String({ name: "package" });
|
|
12
|
+
async execute() {
|
|
13
|
+
const blocked = this.rejectUnsupportedAgentFlags("inhuman install");
|
|
14
|
+
if (blocked !== undefined)
|
|
15
|
+
return blocked;
|
|
16
|
+
try {
|
|
17
|
+
return await installPlugin(this.context, this.kernelPath(), this.pkg);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
this.context.writeErr(error);
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=install-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-command.js","sourceRoot":"","sources":["../../src/cli/install-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC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* Transport lives in the sdk; spawning the daemon stays here.
|
|
3
|
+
*/
|
|
4
|
+
import { ensure } from "@inhuman.tools/harness";
|
|
5
|
+
import { step } from "@inhuman.tools/harness-diagnostics";
|
|
6
|
+
import { Client } from "@inhuman.tools/harness-sdk";
|
|
7
|
+
export async function openKernelRpc(kernelPath) {
|
|
8
|
+
await ensure(kernelPath);
|
|
9
|
+
step(`kernel rpc ${kernelPath}`);
|
|
10
|
+
return Client.kernel(kernelPath);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=kernel-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel-client.js","sourceRoot":"","sources":["../../src/cli/kernel-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAkB,MAAM,4BAA4B,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAkB;IACpD,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;IACzB,IAAI,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { KernelCommand } from "./context.js";
|
|
2
|
+
export declare class McpCommand extends KernelCommand {
|
|
3
|
+
static paths: string[][];
|
|
4
|
+
static usage: import("clipanion").Usage;
|
|
5
|
+
execute(): Promise<number>;
|
|
6
|
+
}
|
|
7
|
+
export declare class McpAddCommand extends KernelCommand {
|
|
8
|
+
static paths: string[][];
|
|
9
|
+
static usage: import("clipanion").Usage;
|
|
10
|
+
name: string;
|
|
11
|
+
url: string | undefined;
|
|
12
|
+
tokenEnv: string | undefined;
|
|
13
|
+
login: boolean;
|
|
14
|
+
rest: string[];
|
|
15
|
+
execute(): Promise<number>;
|
|
16
|
+
}
|
|
17
|
+
export declare class McpListCommand extends KernelCommand {
|
|
18
|
+
static paths: string[][];
|
|
19
|
+
static usage: import("clipanion").Usage;
|
|
20
|
+
json: boolean;
|
|
21
|
+
execute(): Promise<number>;
|
|
22
|
+
}
|
|
23
|
+
export declare class McpGetCommand extends KernelCommand {
|
|
24
|
+
static paths: string[][];
|
|
25
|
+
static usage: import("clipanion").Usage;
|
|
26
|
+
name: string;
|
|
27
|
+
json: boolean;
|
|
28
|
+
execute(): Promise<number>;
|
|
29
|
+
}
|
|
30
|
+
export declare class McpRemoveCommand extends KernelCommand {
|
|
31
|
+
static paths: string[][];
|
|
32
|
+
static usage: import("clipanion").Usage;
|
|
33
|
+
name: string;
|
|
34
|
+
execute(): Promise<number>;
|
|
35
|
+
}
|
|
36
|
+
export declare class McpLoginCommand extends KernelCommand {
|
|
37
|
+
static paths: string[][];
|
|
38
|
+
static usage: import("clipanion").Usage;
|
|
39
|
+
name: string;
|
|
40
|
+
browser: boolean;
|
|
41
|
+
execute(): Promise<number>;
|
|
42
|
+
}
|
|
43
|
+
export declare class McpLogoutCommand extends KernelCommand {
|
|
44
|
+
static paths: string[][];
|
|
45
|
+
static usage: import("clipanion").Usage;
|
|
46
|
+
name: string;
|
|
47
|
+
execute(): Promise<number>;
|
|
48
|
+
}
|
|
49
|
+
export declare class McpEnableCommand extends KernelCommand {
|
|
50
|
+
static paths: string[][];
|
|
51
|
+
static usage: import("clipanion").Usage;
|
|
52
|
+
name: string;
|
|
53
|
+
execute(): Promise<number>;
|
|
54
|
+
}
|
|
55
|
+
export declare class McpDisableCommand extends KernelCommand {
|
|
56
|
+
static paths: string[][];
|
|
57
|
+
static usage: import("clipanion").Usage;
|
|
58
|
+
name: string;
|
|
59
|
+
execute(): Promise<number>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=mcp-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-commands.d.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M,CAAC,KAAK,aAAuB;IACnC,MAAM,CAAC,KAAK,4BAGT;IAEH,IAAI,SAAmB;IAEjB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAGjC;AAED,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,MAAM,CAAC,KAAK,aAAuB;IACnC,MAAM,CAAC,KAAK,4BAGT;IAEH,IAAI,SAAmB;IAEjB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAGjC;AAED,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,MAAM,CAAC,KAAK,aAAwB;IACpC,MAAM,CAAC,KAAK,4BAGT;IAEH,IAAI,SAAmB;IAEjB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAGjC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Command, Option } from "clipanion";
|
|
2
|
+
import { KernelCommand } from "./context.js";
|
|
3
|
+
import { runMcp } from "./mcp.js";
|
|
4
|
+
export class McpCommand extends KernelCommand {
|
|
5
|
+
static paths = [["mcp"]];
|
|
6
|
+
static usage = Command.Usage({
|
|
7
|
+
category: "MCP",
|
|
8
|
+
description: "manage MCP connections",
|
|
9
|
+
});
|
|
10
|
+
async execute() {
|
|
11
|
+
const blocked = this.rejectUnsupportedAgentFlags("inhuman mcp");
|
|
12
|
+
if (blocked !== undefined)
|
|
13
|
+
return blocked;
|
|
14
|
+
this.context.stderr.write("Specify an mcp command: add, list, get, remove, login, logout, enable, disable\n");
|
|
15
|
+
return 2;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class McpAddCommand extends KernelCommand {
|
|
19
|
+
static paths = [["mcp", "add"]];
|
|
20
|
+
static usage = Command.Usage({
|
|
21
|
+
category: "MCP",
|
|
22
|
+
description: "adopt an MCP connection",
|
|
23
|
+
examples: [
|
|
24
|
+
["HTTP", "$0 mcp add sentry --url https://mcp.sentry.dev/mcp"],
|
|
25
|
+
["stdio", "$0 mcp add airtable -- npx -y airtable-mcp-server"],
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
name = Option.String();
|
|
29
|
+
url = Option.String("--url", { description: "HTTP MCP server URL" });
|
|
30
|
+
tokenEnv = Option.String("--token-env", { description: "env var copied into secrets.token" });
|
|
31
|
+
login = Option.Boolean("--login", false, {
|
|
32
|
+
description: "OAuth login after HTTP add (TTY)",
|
|
33
|
+
});
|
|
34
|
+
rest = Option.Rest({ name: "command" });
|
|
35
|
+
async execute() {
|
|
36
|
+
return mcp(this, "add", {
|
|
37
|
+
name: this.name,
|
|
38
|
+
url: this.url,
|
|
39
|
+
tokenEnv: this.tokenEnv,
|
|
40
|
+
login: this.login,
|
|
41
|
+
"--": this.rest,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class McpListCommand extends KernelCommand {
|
|
46
|
+
static paths = [["mcp", "list"]];
|
|
47
|
+
static usage = Command.Usage({
|
|
48
|
+
category: "MCP",
|
|
49
|
+
description: "list MCP connections",
|
|
50
|
+
});
|
|
51
|
+
json = Option.Boolean("--json", false, { description: "print JSON" });
|
|
52
|
+
async execute() {
|
|
53
|
+
return mcp(this, "list", { json: this.json });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export class McpGetCommand extends KernelCommand {
|
|
57
|
+
static paths = [["mcp", "get"]];
|
|
58
|
+
static usage = Command.Usage({
|
|
59
|
+
category: "MCP",
|
|
60
|
+
description: "show one MCP connection",
|
|
61
|
+
});
|
|
62
|
+
name = Option.String();
|
|
63
|
+
json = Option.Boolean("--json", false, { description: "print JSON" });
|
|
64
|
+
async execute() {
|
|
65
|
+
return mcp(this, "get", { name: this.name, json: this.json });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export class McpRemoveCommand extends KernelCommand {
|
|
69
|
+
static paths = [["mcp", "remove"]];
|
|
70
|
+
static usage = Command.Usage({
|
|
71
|
+
category: "MCP",
|
|
72
|
+
description: "drop an MCP connection (no prompt)",
|
|
73
|
+
});
|
|
74
|
+
name = Option.String();
|
|
75
|
+
async execute() {
|
|
76
|
+
return mcp(this, "remove", { name: this.name });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export class McpLoginCommand extends KernelCommand {
|
|
80
|
+
static paths = [["mcp", "login"]];
|
|
81
|
+
static usage = Command.Usage({
|
|
82
|
+
category: "MCP",
|
|
83
|
+
description: "authorize an MCP connection",
|
|
84
|
+
});
|
|
85
|
+
name = Option.String();
|
|
86
|
+
browser = Option.Boolean("--browser", true, { description: "open the authorize URL" });
|
|
87
|
+
async execute() {
|
|
88
|
+
return mcp(this, "login", {
|
|
89
|
+
name: this.name,
|
|
90
|
+
browser: this.browser,
|
|
91
|
+
noBrowser: this.browser === false,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export class McpLogoutCommand extends KernelCommand {
|
|
96
|
+
static paths = [["mcp", "logout"]];
|
|
97
|
+
static usage = Command.Usage({
|
|
98
|
+
category: "MCP",
|
|
99
|
+
description: "clear OAuth secrets",
|
|
100
|
+
});
|
|
101
|
+
name = Option.String();
|
|
102
|
+
async execute() {
|
|
103
|
+
return mcp(this, "logout", { name: this.name });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export class McpEnableCommand extends KernelCommand {
|
|
107
|
+
static paths = [["mcp", "enable"]];
|
|
108
|
+
static usage = Command.Usage({
|
|
109
|
+
category: "MCP",
|
|
110
|
+
description: "enable an MCP connection",
|
|
111
|
+
});
|
|
112
|
+
name = Option.String();
|
|
113
|
+
async execute() {
|
|
114
|
+
return mcp(this, "enable", { name: this.name });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export class McpDisableCommand extends KernelCommand {
|
|
118
|
+
static paths = [["mcp", "disable"]];
|
|
119
|
+
static usage = Command.Usage({
|
|
120
|
+
category: "MCP",
|
|
121
|
+
description: "disable an MCP connection",
|
|
122
|
+
});
|
|
123
|
+
name = Option.String();
|
|
124
|
+
async execute() {
|
|
125
|
+
return mcp(this, "disable", { name: this.name });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function mcp(cmd, verb, args) {
|
|
129
|
+
const blocked = cmd.rejectUnsupportedAgentFlags(`inhuman mcp ${verb}`);
|
|
130
|
+
if (blocked !== undefined)
|
|
131
|
+
return blocked;
|
|
132
|
+
const result = await runMcp({
|
|
133
|
+
kernel: cmd.kernelPath(),
|
|
134
|
+
mcpVerb: verb,
|
|
135
|
+
...args,
|
|
136
|
+
}, cmd.context);
|
|
137
|
+
return result.code;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=mcp-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-commands.js","sourceRoot":"","sources":["../../src/cli/mcp-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAA8B,MAAM,UAAU,CAAC;AAE9D,MAAM,OAAO,UAAW,SAAQ,aAAa;IAC3C,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzB,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,wBAAwB;KACtC,CAAC,CAAC;IAEH,KAAK,CAAC,OAAO;QACX,MAAM,OAAO,GAAG,IAAI,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;QAChE,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAC;QAC9G,OAAO,CAAC,CAAC;IACX,CAAC;;AAGH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK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| "get" | "remove" | "login" | "logout" | "enable" | "disable";
|
|
4
|
+
export type McpArgv = {
|
|
5
|
+
readonly kernel: string;
|
|
6
|
+
readonly mcpVerb: McpVerb;
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
readonly url?: string;
|
|
9
|
+
readonly tokenEnv?: string;
|
|
10
|
+
readonly login?: boolean;
|
|
11
|
+
readonly json?: boolean;
|
|
12
|
+
readonly browser?: boolean;
|
|
13
|
+
readonly noBrowser?: boolean;
|
|
14
|
+
readonly "--"?: ReadonlyArray<string | number>;
|
|
15
|
+
};
|
|
16
|
+
export type McpDeps = {
|
|
17
|
+
readonly rpc?: KernelRpc;
|
|
18
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
19
|
+
readonly openBrowser?: (url: string) => void;
|
|
20
|
+
readonly readLine?: (stdin: NodeJS.ReadStream) => Promise<string>;
|
|
21
|
+
};
|
|
22
|
+
export declare function runMcp(args: McpArgv, streams: ShellContext, deps?: McpDeps): Promise<{
|
|
23
|
+
code: number;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/cli/mcp.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,cAAc,CAAC;AAG/D,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpG,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC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