aiterm-mcp 0.12.0 → 0.12.2

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.
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import process from "node:process";
3
+ import { RuntimeErrorStore, validateRuntimeObservation } from "./runtime-error-store.js";
4
+ function main() {
5
+ const [action, code, ...rest] = process.argv.slice(2);
6
+ if (rest.length > 0)
7
+ throw new Error("invalid args");
8
+ const store = new RuntimeErrorStore();
9
+ if (action === "record" && code) {
10
+ store.record(validateRuntimeObservation({ code }));
11
+ return;
12
+ }
13
+ if (action === "diagnostic" && code === undefined) {
14
+ process.stdout.write(`${JSON.stringify(store.diagnostic())}\n`);
15
+ return;
16
+ }
17
+ throw new Error("invalid action");
18
+ }
19
+ try {
20
+ main();
21
+ }
22
+ catch {
23
+ process.exitCode = 1;
24
+ }
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ import process from "node:process";
3
+ import { realpathSync } from "node:fs";
4
+ import { fileURLToPath } from "node:url";
5
+ import { RuntimeErrorStore } from "./runtime-error-store.js";
6
+ function parseArgs(argv) {
7
+ const [name, flag, value, ...rest] = argv;
8
+ if (rest.length > 0)
9
+ throw new Error("引数が多すぎます");
10
+ if (name === "snapshot" && flag === undefined)
11
+ return { name };
12
+ if (name === "ack" && flag === "--cursor" && value !== undefined && /^\d+$/.test(value)) {
13
+ const cursor = Number(value);
14
+ if (Number.isSafeInteger(cursor))
15
+ return { name, cursor };
16
+ }
17
+ if ((name === "resolve" || name === "reopen") && flag === "--fingerprint" && value !== undefined) {
18
+ if (/^[0-9a-f]{64}$/.test(value))
19
+ return { name, fingerprint: value };
20
+ }
21
+ throw new Error("使い方: aiterm-runtime-errors snapshot | ack --cursor N | resolve|reopen --fingerprint SHA256");
22
+ }
23
+ function emit(value) {
24
+ process.stdout.write(`${JSON.stringify(value)}\n`);
25
+ }
26
+ export function main(argv = process.argv.slice(2)) {
27
+ const command = parseArgs(argv);
28
+ const store = new RuntimeErrorStore();
29
+ if (command.name === "snapshot") {
30
+ emit({ ok: true, command: command.name, snapshot: store.snapshot() });
31
+ return;
32
+ }
33
+ if (command.name === "ack") {
34
+ emit({ ok: true, command: command.name, snapshot: store.acknowledge(command.cursor) });
35
+ return;
36
+ }
37
+ const changed = command.name === "resolve"
38
+ ? store.resolve(command.fingerprint)
39
+ : store.reopen(command.fingerprint);
40
+ emit({ ok: true, command: command.name, changed, snapshot: store.snapshot() });
41
+ }
42
+ function isDirectExecution() {
43
+ if (!process.argv[1])
44
+ return false;
45
+ try {
46
+ const invoked = realpathSync(process.argv[1]);
47
+ const modulePath = realpathSync(fileURLToPath(import.meta.url));
48
+ return process.platform === "win32"
49
+ ? invoked.toLowerCase() === modulePath.toLowerCase()
50
+ : invoked === modulePath;
51
+ }
52
+ catch {
53
+ return false;
54
+ }
55
+ }
56
+ if (isDirectExecution()) {
57
+ try {
58
+ main();
59
+ }
60
+ catch {
61
+ // CLI も privacy allowlist を守り、store/config の生例外や path を stdout/stderr に反射しない。
62
+ process.stderr.write("aiterm-runtime-errors: operation failed\n");
63
+ emit({ ok: false, code: "AITERM_RUNTIME_ERROR_STORE_OPERATION_FAILED" });
64
+ process.exitCode = 1;
65
+ }
66
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "mcpName": "io.github.kitepon-rgb/aiterm-mcp",
5
5
  "description": "AI-driven persistent terminal as a local stdio MCP server (tmux-backed). Holds one local PTY; SSH and containers are just commands you send into it. Also launches interactive Codex/Grok/Composer agent TUIs in a persistent terminal. Token-reducing reads.",
6
6
  "keywords": [
@@ -32,7 +32,8 @@
32
32
  "homepage": "https://github.com/kitepon-rgb/aiterm-mcp#readme",
33
33
  "type": "module",
34
34
  "bin": {
35
- "aiterm-mcp": "dist/index.js"
35
+ "aiterm-mcp": "dist/index.js",
36
+ "aiterm-runtime-errors": "dist/runtime-errors-cli.js"
36
37
  },
37
38
  "files": [
38
39
  "dist",