@ainecto/mcp 0.14.0-next.10 → 0.14.0-next.11
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/bin/ainecto.js +135 -39
- package/dist/bin/ainecto.js.map +1 -1
- package/dist/bin/mcp.js +2 -2
- package/package.json +2 -2
package/dist/bin/ainecto.js
CHANGED
|
@@ -5686,8 +5686,8 @@ function legacyRoleInput(flag, envVars = process.env) {
|
|
|
5686
5686
|
|
|
5687
5687
|
// src/core/version.ts
|
|
5688
5688
|
var UNBUNDLED_VERSION = "dev";
|
|
5689
|
-
var CLI_VERSION = true ? "0.14.0-next.
|
|
5690
|
-
var CLI_BUILD = true ? "
|
|
5689
|
+
var CLI_VERSION = true ? "0.14.0-next.11" : UNBUNDLED_VERSION;
|
|
5690
|
+
var CLI_BUILD = true ? "a8ba747" : void 0;
|
|
5691
5691
|
function cliVersionLabel(version, build, release) {
|
|
5692
5692
|
return release || build === void 0 ? version : `${version}-dev+${build}`;
|
|
5693
5693
|
}
|
|
@@ -11110,15 +11110,26 @@ var CURSOR_KEYS = {
|
|
|
11110
11110
|
home: "H",
|
|
11111
11111
|
end: "F"
|
|
11112
11112
|
};
|
|
11113
|
+
var TILDE_KEYS = {
|
|
11114
|
+
delete: 3,
|
|
11115
|
+
pageup: 5,
|
|
11116
|
+
pagedown: 6
|
|
11117
|
+
};
|
|
11113
11118
|
var ALIASES = {
|
|
11114
11119
|
esc: "escape",
|
|
11115
11120
|
return: "enter",
|
|
11116
|
-
btab: "shift-tab"
|
|
11121
|
+
btab: "shift-tab",
|
|
11122
|
+
"/": "slash"
|
|
11117
11123
|
};
|
|
11124
|
+
var MODIFIERS = ["ctrl", "shift", "alt"];
|
|
11118
11125
|
var KEY_NAMES = [
|
|
11119
11126
|
...Object.keys(PLAIN_KEYS),
|
|
11120
11127
|
...Object.keys(CURSOR_KEYS),
|
|
11121
|
-
"ctrl-a \u2026 ctrl-z"
|
|
11128
|
+
"ctrl-a \u2026 ctrl-z",
|
|
11129
|
+
"ctrl-space",
|
|
11130
|
+
"ctrl-slash",
|
|
11131
|
+
"alt-<key>",
|
|
11132
|
+
"ctrl-/shift-/alt- + up/down/left/right/home/end/pageup/pagedown/delete"
|
|
11122
11133
|
];
|
|
11123
11134
|
function normalizeKeyName(raw) {
|
|
11124
11135
|
const lower = raw.trim().toLowerCase().replace(/\+/g, "-");
|
|
@@ -11134,11 +11145,39 @@ function keyBytes(raw, context) {
|
|
|
11134
11145
|
if (cursor !== void 0) {
|
|
11135
11146
|
return `${context.applicationCursorKeys ? "\x1BO" : "\x1B["}${cursor}`;
|
|
11136
11147
|
}
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11148
|
+
return comboBytes(name);
|
|
11149
|
+
}
|
|
11150
|
+
function comboBytes(name) {
|
|
11151
|
+
const parts = name.split("-");
|
|
11152
|
+
const last = parts.pop() ?? "";
|
|
11153
|
+
const base = ALIASES[last] ?? last;
|
|
11154
|
+
const mods = /* @__PURE__ */ new Set();
|
|
11155
|
+
for (const part of parts) {
|
|
11156
|
+
const mod = MODIFIERS.find((m2) => m2 === part);
|
|
11157
|
+
if (!mod || mods.has(mod)) return void 0;
|
|
11158
|
+
mods.add(mod);
|
|
11159
|
+
}
|
|
11160
|
+
if (mods.size === 0 || base === "") return void 0;
|
|
11161
|
+
const ctrl = mods.has("ctrl");
|
|
11162
|
+
const shift = mods.has("shift");
|
|
11163
|
+
const alt = mods.has("alt");
|
|
11164
|
+
const m = 1 + (shift ? 1 : 0) + (alt ? 2 : 0) + (ctrl ? 4 : 0);
|
|
11165
|
+
const cursor = CURSOR_KEYS[base];
|
|
11166
|
+
if (cursor !== void 0) return `\x1B[1;${m}${cursor}`;
|
|
11167
|
+
const tilde = TILDE_KEYS[base];
|
|
11168
|
+
if (tilde !== void 0) return `\x1B[${tilde};${m}~`;
|
|
11169
|
+
const single = singleByte(base, ctrl, shift);
|
|
11170
|
+
if (single === void 0) return void 0;
|
|
11171
|
+
return alt ? `\x1B${single}` : single;
|
|
11172
|
+
}
|
|
11173
|
+
function singleByte(base, ctrl, shift) {
|
|
11174
|
+
if (/^[a-z]$/.test(base)) {
|
|
11175
|
+
return ctrl ? String.fromCharCode(base.charCodeAt(0) - 96) : shift ? base.toUpperCase() : base;
|
|
11176
|
+
}
|
|
11177
|
+
if (base === "space") return ctrl && !shift ? "\0" : !ctrl && !shift ? " " : void 0;
|
|
11178
|
+
if (base === "slash") return ctrl && !shift ? "" : !ctrl && !shift ? "/" : void 0;
|
|
11179
|
+
const plain = PLAIN_KEYS[base];
|
|
11180
|
+
return !ctrl && !shift && plain !== void 0 && plain.length === 1 ? plain : void 0;
|
|
11142
11181
|
}
|
|
11143
11182
|
function pasteBytes(text2, bracketedPasteMode) {
|
|
11144
11183
|
return bracketedPasteMode ? `\x1B[200~${text2}\x1B[201~` : text2;
|
|
@@ -12076,7 +12115,10 @@ var TermDaemon = class {
|
|
|
12076
12115
|
*/
|
|
12077
12116
|
async startSession(entry, env, cols, rows) {
|
|
12078
12117
|
if (this.sessions.has(entry.name) || this.starting.has(entry.name)) {
|
|
12079
|
-
throw new TermError(
|
|
12118
|
+
throw new TermError(
|
|
12119
|
+
"TERM_SESSION_EXISTS",
|
|
12120
|
+
`A session named "${entry.name}" already exists. Open it with \`ainecto term attach ${entry.name}\`, or choose another name.`
|
|
12121
|
+
);
|
|
12080
12122
|
}
|
|
12081
12123
|
this.starting.add(entry.name);
|
|
12082
12124
|
try {
|
|
@@ -12261,7 +12303,16 @@ var DetachKeyScanner = class {
|
|
|
12261
12303
|
// src/core/term/paths.ts
|
|
12262
12304
|
import { createHash as createHash5 } from "crypto";
|
|
12263
12305
|
import { homedir as homedir2 } from "os";
|
|
12264
|
-
import { join as join6 } from "path";
|
|
12306
|
+
import { isAbsolute, join as join6, posix, win32 } from "path";
|
|
12307
|
+
function appHome(platform = process.platform, env = process.env, home = homedir2()) {
|
|
12308
|
+
if (platform === "darwin") return posix.join(home, "Library", "Application Support", "ainecto");
|
|
12309
|
+
if (platform === "win32") return win32.join(env.LOCALAPPDATA || win32.join(home, "AppData", "Local"), "ainecto");
|
|
12310
|
+
const xdg = env.XDG_DATA_HOME;
|
|
12311
|
+
return posix.join(xdg && isAbsolute(xdg) ? xdg : posix.join(home, ".local", "share"), "ainecto");
|
|
12312
|
+
}
|
|
12313
|
+
function webSessionsDir(app = appHome()) {
|
|
12314
|
+
return join6(app, "sessions");
|
|
12315
|
+
}
|
|
12265
12316
|
function termPaths(home = homedir2()) {
|
|
12266
12317
|
const dir = join6(home, ".ainecto", "term");
|
|
12267
12318
|
return {
|
|
@@ -14138,6 +14189,11 @@ var RemoteViewer = class {
|
|
|
14138
14189
|
}
|
|
14139
14190
|
};
|
|
14140
14191
|
|
|
14192
|
+
// src/core/term/remote.ts
|
|
14193
|
+
import { existsSync } from "fs";
|
|
14194
|
+
import { rmdir as rmdir2 } from "fs/promises";
|
|
14195
|
+
import { join as join8 } from "path";
|
|
14196
|
+
|
|
14141
14197
|
// src/core/pc/pcUpgrade.ts
|
|
14142
14198
|
var STABLE = /^\d+\.\d+\.\d+$/;
|
|
14143
14199
|
var NEXT = /^\d+\.\d+\.\d+-next\.\d+(\.\d+)*$/;
|
|
@@ -14501,6 +14557,33 @@ var CommandRunner = class {
|
|
|
14501
14557
|
remote;
|
|
14502
14558
|
/** 여러 바이트 글자가 poll 경계에서 갈려도 잇는다 — 세션마다(바이트는 그대로, 글자로 바꾸는 곳만 한 곳). */
|
|
14503
14559
|
decoders = /* @__PURE__ */ new Map();
|
|
14560
|
+
/**
|
|
14561
|
+
* 웹이 폴더를 비운 만들기 — `<sessionsDir>/<requestId>` 를 만든다. requestId 는 서버가 만들기마다 새로 뽑는 UUID 라
|
|
14562
|
+
* 세션마다 새 폴더가 되고, remote_command 로그 줄(같은 requestId)로 어느 만들기의 폴더인지 잇는다. UUID 모양만 받는다(경로 밖으로 못 나가게).
|
|
14563
|
+
*/
|
|
14564
|
+
async sessionFolder(requestId) {
|
|
14565
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(requestId)) {
|
|
14566
|
+
throw new TermError("TERM_BAD_REQUEST", `The create request id "${requestId}" is not a UUID, so no session folder was made.`);
|
|
14567
|
+
}
|
|
14568
|
+
const folder = join8(this.deps.sessionsDir, requestId);
|
|
14569
|
+
const made = !existsSync(folder);
|
|
14570
|
+
await ensurePrivateDir(folder);
|
|
14571
|
+
return { folder, made };
|
|
14572
|
+
}
|
|
14573
|
+
/** 거절된 만들기 — 방금 만든 세션 폴더를 비어 있을 때만 지운다(rmdir, 재귀 아님). 못 지우면 한 줄 남기고 넘어간다. */
|
|
14574
|
+
async dropSessionFolder(requestId, folder) {
|
|
14575
|
+
try {
|
|
14576
|
+
await rmdir2(folder);
|
|
14577
|
+
} catch (error) {
|
|
14578
|
+
this.deps.log.write({
|
|
14579
|
+
event: "remote_session_folder_kept",
|
|
14580
|
+
requestId,
|
|
14581
|
+
folder,
|
|
14582
|
+
code: error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : "UNKNOWN",
|
|
14583
|
+
message: error instanceof Error ? error.message : String(error)
|
|
14584
|
+
});
|
|
14585
|
+
}
|
|
14586
|
+
}
|
|
14504
14587
|
async run(commands, ctx) {
|
|
14505
14588
|
let listChanged = false;
|
|
14506
14589
|
for (const command of commands) {
|
|
@@ -14574,15 +14657,28 @@ var CommandRunner = class {
|
|
|
14574
14657
|
this.viewers.get(command.session)?.setSize(applied);
|
|
14575
14658
|
return true;
|
|
14576
14659
|
}
|
|
14577
|
-
case "create":
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
}
|
|
14660
|
+
case "create": {
|
|
14661
|
+
let cwd = command.cwd;
|
|
14662
|
+
let made;
|
|
14663
|
+
if (cwd === void 0) {
|
|
14664
|
+
const fresh = await this.sessionFolder(command.requestId);
|
|
14665
|
+
cwd = fresh.folder;
|
|
14666
|
+
if (fresh.made) made = fresh.folder;
|
|
14667
|
+
}
|
|
14668
|
+
try {
|
|
14669
|
+
await this.control.request({
|
|
14670
|
+
op: "new",
|
|
14671
|
+
name: command.name,
|
|
14672
|
+
cwd,
|
|
14673
|
+
command: command.command === void 0 ? null : shellLineCommand(command.command, this.deps.sessionEnv),
|
|
14674
|
+
env: this.deps.sessionEnv
|
|
14675
|
+
});
|
|
14676
|
+
} catch (error) {
|
|
14677
|
+
if (made) await this.dropSessionFolder(command.requestId, made);
|
|
14678
|
+
throw error;
|
|
14679
|
+
}
|
|
14585
14680
|
return true;
|
|
14681
|
+
}
|
|
14586
14682
|
case "kill":
|
|
14587
14683
|
await this.control.request({ op: "kill", name: command.session });
|
|
14588
14684
|
this.decoders.delete(command.session);
|
|
@@ -15050,7 +15146,7 @@ function print2(deps, data, human) {
|
|
|
15050
15146
|
// src/adapters/cli/pcSwap.ts
|
|
15051
15147
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
15052
15148
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
15053
|
-
import { join as
|
|
15149
|
+
import { join as join9 } from "path";
|
|
15054
15150
|
var Refused = class extends Error {
|
|
15055
15151
|
constructor(reason, detail) {
|
|
15056
15152
|
super(detail);
|
|
@@ -15124,7 +15220,7 @@ async function checkRuns(deps) {
|
|
|
15124
15220
|
async function checkProvenance(deps) {
|
|
15125
15221
|
const dir = await deps.makeTempDir();
|
|
15126
15222
|
try {
|
|
15127
|
-
await writeFile7(
|
|
15223
|
+
await writeFile7(join9(dir, "package.json"), `${JSON.stringify({ name: "ainecto-upgrade-check", private: true })}
|
|
15128
15224
|
`);
|
|
15129
15225
|
const run = deps.runner(dir);
|
|
15130
15226
|
const spec = `${deps.packageName}@${deps.to}`;
|
|
@@ -15245,7 +15341,7 @@ function swapArgsOf(argv) {
|
|
|
15245
15341
|
|
|
15246
15342
|
// src/adapters/cli/ainectoCli.ts
|
|
15247
15343
|
import { mkdtemp, rm as rm3 } from "fs/promises";
|
|
15248
|
-
import { join as
|
|
15344
|
+
import { join as join11 } from "path";
|
|
15249
15345
|
|
|
15250
15346
|
// src/adapters/cli/pcStatus.ts
|
|
15251
15347
|
import { readFile as readFile11 } from "fs/promises";
|
|
@@ -15253,16 +15349,16 @@ import { hostname } from "os";
|
|
|
15253
15349
|
|
|
15254
15350
|
// src/core/agent/paths.ts
|
|
15255
15351
|
import { homedir as homedir4 } from "os";
|
|
15256
|
-
import { join as
|
|
15352
|
+
import { join as join10 } from "path";
|
|
15257
15353
|
function agentPaths(home = homedir4()) {
|
|
15258
|
-
const dir =
|
|
15354
|
+
const dir = join10(home, ".ainecto", "agent");
|
|
15259
15355
|
return {
|
|
15260
15356
|
dir,
|
|
15261
|
-
work:
|
|
15262
|
-
sessions:
|
|
15263
|
-
runs:
|
|
15264
|
-
log:
|
|
15265
|
-
previousLog:
|
|
15357
|
+
work: join10(dir, "work"),
|
|
15358
|
+
sessions: join10(dir, "sessions.json"),
|
|
15359
|
+
runs: join10(dir, "runs.json"),
|
|
15360
|
+
log: join10(dir, "agent.log"),
|
|
15361
|
+
previousLog: join10(dir, "agent.log.1")
|
|
15266
15362
|
};
|
|
15267
15363
|
}
|
|
15268
15364
|
|
|
@@ -16265,7 +16361,7 @@ function entries(value) {
|
|
|
16265
16361
|
}
|
|
16266
16362
|
|
|
16267
16363
|
// src/adapters/cli/pcRemote.ts
|
|
16268
|
-
import {
|
|
16364
|
+
import { hostname as hostname2 } from "os";
|
|
16269
16365
|
async function runPcParts(agent, remote, signal) {
|
|
16270
16366
|
const stop = new AbortController();
|
|
16271
16367
|
const onStop = () => stop.abort();
|
|
@@ -16312,7 +16408,7 @@ async function pcRemoteSetup(input) {
|
|
|
16312
16408
|
pcId: settings.pcId,
|
|
16313
16409
|
hostName,
|
|
16314
16410
|
remoteEnabled: userId !== void 0 && settings.accounts[accountKey(input.endpoint, userId)]?.remoteTerminal === true,
|
|
16315
|
-
|
|
16411
|
+
sessionsDir: input.sessionsDir ?? webSessionsDir(),
|
|
16316
16412
|
env: input.env ?? stringEnv()
|
|
16317
16413
|
};
|
|
16318
16414
|
}
|
|
@@ -16339,7 +16435,7 @@ async function runPcRemote(setup, signal, onAnswer) {
|
|
|
16339
16435
|
remoteEnabled: setup.remoteEnabled,
|
|
16340
16436
|
exclude: [PC_SESSION_NAME],
|
|
16341
16437
|
sessionEnv: setup.env,
|
|
16342
|
-
|
|
16438
|
+
sessionsDir: setup.sessionsDir,
|
|
16343
16439
|
signal,
|
|
16344
16440
|
print: (line) => setup.io.stderr.write(`${line}
|
|
16345
16441
|
`),
|
|
@@ -16474,7 +16570,7 @@ async function executeAgentServe(input) {
|
|
|
16474
16570
|
}
|
|
16475
16571
|
|
|
16476
16572
|
// src/adapters/cli/ainectoCli.ts
|
|
16477
|
-
import { homedir as
|
|
16573
|
+
import { homedir as homedir5, hostname as hostname4, tmpdir } from "os";
|
|
16478
16574
|
async function runAinectoCli(argv, io) {
|
|
16479
16575
|
let parsed = { json: argv.includes("--json"), help: false, version: false, positionals: [] };
|
|
16480
16576
|
try {
|
|
@@ -16562,8 +16658,8 @@ async function runAinectoCli(argv, io) {
|
|
|
16562
16658
|
auth,
|
|
16563
16659
|
client: client2,
|
|
16564
16660
|
// ★외부 CLI 는 홈 폴더에서 돈다 — 지금 저장소의 local·project 범위 항목이 사용자 범위 판정에 끼지 않게.
|
|
16565
|
-
runner: systemCommandRunner({ cwd:
|
|
16566
|
-
home:
|
|
16661
|
+
runner: systemCommandRunner({ cwd: homedir5() }),
|
|
16662
|
+
home: homedir5(),
|
|
16567
16663
|
json: parsed.json,
|
|
16568
16664
|
io
|
|
16569
16665
|
});
|
|
@@ -16577,9 +16673,9 @@ async function runAinectoCli(argv, io) {
|
|
|
16577
16673
|
tokenStore,
|
|
16578
16674
|
auth,
|
|
16579
16675
|
client: client2,
|
|
16580
|
-
runner: systemCommandRunner({ cwd:
|
|
16676
|
+
runner: systemCommandRunner({ cwd: homedir5() }),
|
|
16581
16677
|
hereRunner: systemCommandRunner({ cwd: process.cwd() }),
|
|
16582
|
-
home:
|
|
16678
|
+
home: homedir5(),
|
|
16583
16679
|
cwd: process.cwd(),
|
|
16584
16680
|
envVars: process.env
|
|
16585
16681
|
};
|
|
@@ -16667,9 +16763,9 @@ async function runAinectoCli(argv, io) {
|
|
|
16667
16763
|
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
16668
16764
|
return await response.json();
|
|
16669
16765
|
},
|
|
16670
|
-
makeTempDir: () => mkdtemp(
|
|
16766
|
+
makeTempDir: () => mkdtemp(join11(tmpdir(), "ainecto-upgrade-")),
|
|
16671
16767
|
removeDir: (path) => rm3(path, { recursive: true, force: true }),
|
|
16672
|
-
home:
|
|
16768
|
+
home: homedir5(),
|
|
16673
16769
|
log: openAgentLog(swapPaths)
|
|
16674
16770
|
});
|
|
16675
16771
|
}
|