@ainecto/cli 0.15.2 → 0.15.4

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.
@@ -5699,8 +5699,8 @@ function legacyRoleInput(flag, envVars = process.env) {
5699
5699
 
5700
5700
  // src/core/version.ts
5701
5701
  var UNBUNDLED_VERSION = "dev";
5702
- var CLI_VERSION = true ? "0.15.2" : UNBUNDLED_VERSION;
5703
- var CLI_BUILD = true ? "cdf776d" : void 0;
5702
+ var CLI_VERSION = true ? "0.15.4" : UNBUNDLED_VERSION;
5703
+ var CLI_BUILD = true ? "9f799ad" : void 0;
5704
5704
  function cliVersionLabel(version, build, release2) {
5705
5705
  return release2 || build === void 0 ? version : `${version}-dev+${build}`;
5706
5706
  }
@@ -10165,9 +10165,6 @@ function endedFromOutside(exitCode2, signal, platform = process.platform) {
10165
10165
  if (signal !== 0) return true;
10166
10166
  return platform === "win32" && exitCode2 !== 0;
10167
10167
  }
10168
- function controllingTerminal(platform = process.platform) {
10169
- return platform === "win32" ? { input: "\\\\.\\CONIN$", inputFlags: "r+", output: "\\\\.\\CONOUT$", outputFlags: "r+" } : { input: "/dev/tty", inputFlags: "r", output: "/dev/tty", outputFlags: "w" };
10170
- }
10171
10168
  function notifyTool(platform = process.platform) {
10172
10169
  if (platform === "darwin") {
10173
10170
  return {
@@ -11714,15 +11711,27 @@ function parseReadiness(line) {
11714
11711
  }
11715
11712
  return { status: "error", message: `unexpected readiness line: ${line}` };
11716
11713
  }
11717
- function daemonPid(paths) {
11714
+ function readDaemonInfo(paths) {
11718
11715
  try {
11719
11716
  const value = JSON.parse(readFileSync(paths.daemonInfo, "utf8"));
11720
11717
  const pid = value && typeof value === "object" && "pid" in value ? value.pid : void 0;
11721
- return typeof pid === "number" ? pid : void 0;
11718
+ const version = value && typeof value === "object" && "version" in value ? value.version : void 0;
11719
+ return typeof pid === "number" ? { pid, ...typeof version === "string" ? { version } : {} } : void 0;
11722
11720
  } catch {
11723
11721
  return void 0;
11724
11722
  }
11725
11723
  }
11724
+ function daemonPid(paths) {
11725
+ return readDaemonInfo(paths)?.pid;
11726
+ }
11727
+ async function waitForPidGone(pid, ms) {
11728
+ const until = Date.now() + ms;
11729
+ while (isAlive(pid)) {
11730
+ if (Date.now() >= until) return false;
11731
+ await new Promise((resolve4) => setTimeout(resolve4, 100));
11732
+ }
11733
+ return true;
11734
+ }
11726
11735
  function notListening(paths) {
11727
11736
  const pid = daemonPid(paths);
11728
11737
  const holder = pid !== void 0 && isAlive(pid) ? `Daemon pid ${pid} holds the lock but is not listening on ${paths.socket} \u2014 it may be stopped or hung. ${stuckProcessHint(pid)}` : "No running daemon answered.";
@@ -14842,19 +14851,16 @@ var subtle = webcrypto.subtle;
14842
14851
  var VERSION = "ainecto-e2e-v1";
14843
14852
  var PAIR_LABEL = "ainecto-pair-v1";
14844
14853
  var PAIR_DONE_LABEL = "ainecto-pair-v1/done";
14845
- var PAIR_CODE_INFO = { a: "ainecto-pair-code-A", b: "ainecto-pair-code-B" };
14846
14854
  var REGISTER_INFO = { browser: "ainecto-register-v1 browser", pc: "ainecto-register-v1 pc", account: "ainecto-register-v1 account" };
14847
14855
  var REGISTER_OFFER_LABEL = "ainecto-register-v1/offer";
14848
14856
  var REGISTER_REVEAL_LABEL = "ainecto-register-v1/reveal";
14849
14857
  var REGISTER_TAG_BYTES = 8;
14850
14858
  var KEY_INFO = { browserToPc: "ainecto-e2e-v1 b2p", pcToBrowser: "ainecto-e2e-v1 p2b", connId: "ainecto-e2e-v1 conn-id" };
14851
- var PAIR_CODE_LIMIT = 4294e6;
14852
14859
  var MAX_MESSAGES_PER_KEY = 2 ** 32;
14853
14860
  var PUBLIC_KEY_BYTES = 65;
14854
14861
  var NONCE_SEED_BYTES = 32;
14855
14862
  var SIGNATURE_BYTES = 64;
14856
14863
  var CONN_ID_BYTES = 16;
14857
- var PAIR_CODE_DIGITS = 6;
14858
14864
  var E2eError = class extends Error {
14859
14865
  constructor(code, message2) {
14860
14866
  super(message2);
@@ -14948,8 +14954,8 @@ function publicJwkFromRaw(raw) {
14948
14954
  return { kty: "EC", crv: "P-256", x: base64url(raw.subarray(1, 33)), y: base64url(raw.subarray(33, 65)) };
14949
14955
  }
14950
14956
  async function generateSigningJwk() {
14951
- const pair2 = await subtle.generateKey(ECDSA, true, ["sign", "verify"]);
14952
- const jwk = asPrivateJwk(await subtle.exportKey("jwk", pair2.privateKey));
14957
+ const pair = await subtle.generateKey(ECDSA, true, ["sign", "verify"]);
14958
+ const jwk = asPrivateJwk(await subtle.exportKey("jwk", pair.privateKey));
14953
14959
  if (!jwk) {
14954
14960
  throw new Error("WebCrypto returned an unexpected P-256 JWK.");
14955
14961
  }
@@ -14978,8 +14984,8 @@ async function verifyBytes(publicKey, signature, data) {
14978
14984
  }
14979
14985
  }
14980
14986
  async function generateEphemeral() {
14981
- const pair2 = await subtle.generateKey(ECDH, false, ["deriveBits"]);
14982
- return { privateKey: pair2.privateKey, publicRaw: new Uint8Array(await subtle.exportKey("raw", pair2.publicKey)) };
14987
+ const pair = await subtle.generateKey(ECDH, false, ["deriveBits"]);
14988
+ return { privateKey: pair.privateKey, publicRaw: new Uint8Array(await subtle.exportKey("raw", pair.publicKey)) };
14983
14989
  }
14984
14990
  var USER_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
14985
14991
  function transcriptUserId(raw) {
@@ -14996,11 +15002,6 @@ async function browserKeyIdOf(browserPublicRaw) {
14996
15002
  expectLength("browserPub", browserPublicRaw, PUBLIC_KEY_BYTES);
14997
15003
  return Buffer.from((await sha256(browserPublicRaw)).subarray(0, 16)).toString("hex");
14998
15004
  }
14999
- function pairCodeInput(raw) {
15000
- const trimmed = raw.trim();
15001
- if (trimmed === "") return { kind: "empty" };
15002
- return new RegExp(`^[0-9]{${PAIR_CODE_DIGITS}}$`).test(trimmed) ? { kind: "code", code: trimmed } : { kind: "invalid" };
15003
- }
15004
15005
  async function pairCommitment(pcPublicRaw, nP) {
15005
15006
  expectLength("pcPub", pcPublicRaw, PUBLIC_KEY_BYTES);
15006
15007
  expectLength("nP", nP, NONCE_SEED_BYTES);
@@ -15014,30 +15015,6 @@ async function pairTranscript(input) {
15014
15015
  expectLength("nB", input.nB, NONCE_SEED_BYTES);
15015
15016
  return await sha256(enc(PAIR_LABEL, input.userId, input.pcId, input.pcPublicRaw, input.browserPublicRaw, input.nP, input.nB));
15016
15017
  }
15017
- function pairCodeFromBlock(block) {
15018
- expectLength("code block", block, 32);
15019
- const view = new DataView(block.buffer, block.byteOffset, block.byteLength);
15020
- for (let offset = 0; offset < 32; offset += 4) {
15021
- const value = view.getUint32(offset, false);
15022
- if (value < PAIR_CODE_LIMIT) {
15023
- return String(value % 10 ** PAIR_CODE_DIGITS).padStart(PAIR_CODE_DIGITS, "0");
15024
- }
15025
- }
15026
- return void 0;
15027
- }
15028
- async function pairCodes(transcript) {
15029
- expectLength("transcript", transcript, 32);
15030
- const prk = await subtle.importKey("raw", transcript, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
15031
- const code = async (info) => {
15032
- const block = new Uint8Array(await subtle.sign("HMAC", prk, concatBytes(utf8(info), Uint8Array.of(1))));
15033
- const value = pairCodeFromBlock(block);
15034
- if (value === void 0) {
15035
- throw new E2eError("E2E_PAIR_CODE_UNAVAILABLE", "No usable registration code in this attempt \u2014 run `ainecto pair` again.");
15036
- }
15037
- return value;
15038
- };
15039
- return { a: await code(PAIR_CODE_INFO.a), b: await code(PAIR_CODE_INFO.b) };
15040
- }
15041
15018
  function pairDoneInput(transcript) {
15042
15019
  expectLength("transcript", transcript, 32);
15043
15020
  return enc(PAIR_DONE_LABEL, transcript);
@@ -15240,7 +15217,7 @@ async function loadPcKeys(path) {
15240
15217
  try {
15241
15218
  return normalizePcKeys(JSON.parse(raw));
15242
15219
  } catch (error) {
15243
- throw new Error(`${path} is not valid JSON (${error instanceof Error ? error.message : String(error)}). Delete it and register your browsers again with \`ainecto pair\`.`);
15220
+ throw new Error(`${path} is not valid JSON (${error instanceof Error ? error.message : String(error)}). Delete it and register your browsers again by running \`npx -y ainecto@latest\`.`);
15244
15221
  }
15245
15222
  }
15246
15223
  var PC_KEYS_LOCK = { waitMs: 5e3, pollMs: 50 };
@@ -16690,6 +16667,13 @@ function pcAction(running, cliVersion) {
16690
16667
  }
16691
16668
  return { kind: "replace", pcs: [...running] };
16692
16669
  }
16670
+ function daemonUpgrade(daemonVersion, cliVersion, sessions, insideTermSession) {
16671
+ if (daemonVersion === void 0 || daemonVersion === cliVersion || insideTermSession) {
16672
+ return { kind: "keep" };
16673
+ }
16674
+ const user = sessions.filter((session) => !isPcCommand(session.command)).map((session) => session.name);
16675
+ return user.length === 0 ? { kind: "restart" } : { kind: "ask", sessions: user };
16676
+ }
16693
16677
  function pcStopDeadlineMs() {
16694
16678
  return AGENT_STOP_WAIT_MS * 4 + Math.max(AGENT_CALL_TIMEOUT_MS, CALL_TIMEOUT_MS);
16695
16679
  }
@@ -16778,10 +16762,6 @@ async function runPairing(input) {
16778
16762
  const pcPublicRaw = publicRawFromJwk(input.pcKey);
16779
16763
  const nP = (input.random ?? (() => randomBytes3(NONCE_SEED_BYTES)))();
16780
16764
  const commit = await pairCommitment(pcPublicRaw, nP);
16781
- const { check } = input;
16782
- if (check.kind === "codes") {
16783
- check.prompt.show(`Waiting up to ${Math.round(input.waitMs / 6e4)} min for a browser \u2014 in AiNecto on the web, open Terminal, pick this PC and start the browser registration there.`);
16784
- }
16785
16765
  const offer = await relayed(() => input.transport.offer(commit, signal));
16786
16766
  if (offer === "timeout") return { kind: "timeout" };
16787
16767
  const publicJwk = publicJwkFromRaw(offer.publicRaw);
@@ -16791,42 +16771,28 @@ async function runPairing(input) {
16791
16771
  }
16792
16772
  const browser = { keyId: offer.keyId, publicJwk, name: browserNameOf(offer.name) };
16793
16773
  const transcript = () => pairTranscript({ userId: input.userId, pcId: input.pcId, pcPublicRaw, browserPublicRaw: offer.publicRaw, nP, nB: offer.nB });
16794
- if (check.kind === "secret") {
16795
- const keys = await registerKeys(check.secret);
16796
- const expected = await registerOfferMac(keys.browser, {
16797
- userId: input.userId,
16798
- pcId: input.pcId,
16799
- attemptId: offer.attemptId,
16800
- commit,
16801
- browserPublicRaw: offer.publicRaw,
16802
- keyId: offer.keyId,
16803
- nB: offer.nB,
16804
- name: offer.name
16805
- });
16806
- if (!offer.macB || !macEquals(offer.macB, expected)) return { kind: "code-mismatch" };
16807
- const t2 = await transcript();
16808
- await input.pin(browser);
16809
- const macP = await registerRevealMac(keys.pc, { transcript: t2, attemptId: offer.attemptId });
16810
- return await finish(browser, t2, () => input.transport.reveal(pcPublicRaw, nP, signal, macP));
16811
- }
16812
- if (await relayed(() => input.transport.reveal(pcPublicRaw, nP, signal)) === "timeout") return { kind: "timeout" };
16774
+ const keys = await registerKeys(input.secret);
16775
+ const expected = await registerOfferMac(keys.browser, {
16776
+ userId: input.userId,
16777
+ pcId: input.pcId,
16778
+ attemptId: offer.attemptId,
16779
+ commit,
16780
+ browserPublicRaw: offer.publicRaw,
16781
+ keyId: offer.keyId,
16782
+ nB: offer.nB,
16783
+ name: offer.name
16784
+ });
16785
+ if (!offer.macB || !macEquals(offer.macB, expected)) return { kind: "code-mismatch" };
16813
16786
  const t = await transcript();
16814
- const codes = await pairCodes(t);
16815
- check.prompt.show(`A browser asked to be registered: ${browser.name}`);
16816
- check.prompt.show(`Type this code in the browser: ${codes.a}`);
16817
- const answer = await check.prompt.ask("Then type the code the browser shows (one try): ", signal);
16818
- if (signal.aborted) return { kind: "timeout" };
16819
- const typed = pairCodeInput(answer);
16820
- if (typed.kind === "empty") return { kind: "cancelled" };
16821
- if (typed.kind !== "code" || typed.code !== codes.b) return { kind: "code-mismatch" };
16822
16787
  await input.pin(browser);
16823
- return await finish(browser, t);
16788
+ const macP = await registerRevealMac(keys.pc, { transcript: t, attemptId: offer.attemptId });
16789
+ return await finish(browser, t, () => input.transport.reveal(pcPublicRaw, nP, signal, macP));
16824
16790
  }
16825
16791
  async function finish(browser, transcript, before) {
16826
16792
  const signature = await signBytes(await importSigningKey(input.pcKey), pairDoneInput(transcript));
16827
16793
  let doneError;
16828
16794
  try {
16829
- await before?.();
16795
+ await before();
16830
16796
  await input.transport.done(signature, signal);
16831
16797
  } catch (error) {
16832
16798
  doneError = signal.aborted ? "timed out" : error instanceof Error ? error.message : String(error);
@@ -16840,174 +16806,8 @@ import { readFile as readFile13 } from "fs/promises";
16840
16806
 
16841
16807
  // src/adapters/cli/pairCommand.ts
16842
16808
  import { randomUUID as randomUUID7 } from "crypto";
16843
- import { closeSync as closeSync3, openSync as openSync3 } from "fs";
16844
- import { ReadStream, WriteStream } from "tty";
16845
-
16846
- // src/core/pc/pcPairRelay.ts
16847
- var PairRelayError = class extends Error {
16848
- constructor(code, message2) {
16849
- super(message2);
16850
- this.code = code;
16851
- }
16852
- code;
16853
- };
16854
- function createPairRelay(input) {
16855
- const http = createPcHttp({
16856
- endpoint: input.endpoint,
16857
- path: "term/pc",
16858
- tokenProvider: input.tokenProvider,
16859
- timeoutMs: CALL_TIMEOUT_MS,
16860
- sessionHeader: "X-Remote-Token",
16861
- fetchImpl: input.fetchImpl,
16862
- logging: {
16863
- log: input.log,
16864
- request: ({ callId, op, bytes }) => ({ event: "remote_call", callId, op, bytes }),
16865
- response: ({ callId, op, ms }, outcome) => ({
16866
- event: "remote_call_response",
16867
- callId,
16868
- op,
16869
- ...outcome.ok ? {
16870
- ok: true,
16871
- status: outcome.status,
16872
- ...Array.isArray(outcome.body.msgs) ? { commands: outcome.body.msgs.length } : {},
16873
- ...outcome.body.closed === true ? { state: "CLOSED" } : {}
16874
- } : outcome,
16875
- ms
16876
- })
16877
- }
16878
- });
16879
- let attemptId;
16880
- let finished = false;
16881
- const send = async (msg, signal) => {
16882
- if (!attemptId) throw new PairRelayError("PAIR_RELAY_BAD_RESPONSE", "The browser registration was not opened.");
16883
- await http.call("pair/send", { attemptId, msg }, signal ? { signal } : void 0);
16884
- };
16885
- return {
16886
- async offer(commit, signal) {
16887
- const opened = await http.call("pair/open", { pcId: input.pcId }, { signal });
16888
- if (typeof opened.attemptId !== "string" || opened.attemptId === "") {
16889
- throw new PairRelayError("PAIR_RELAY_BAD_RESPONSE", "AiNecto answered pair/open without an attemptId.");
16890
- }
16891
- attemptId = opened.attemptId;
16892
- await send({ type: "commit", commit: b64u2(commit) }, signal);
16893
- for (; ; ) {
16894
- const answer = await http.call("pair/poll", { attemptId }, { holdMs: input.holdMs, signal });
16895
- if (answer.closed === true) {
16896
- finished = true;
16897
- throw new PairRelayError("PAIR_CLOSED", "The browser registration ended on AiNecto (the browser cancelled it, or it expired).");
16898
- }
16899
- const offer = offerOf(Array.isArray(answer.msgs) ? answer.msgs : []);
16900
- if (offer === "abort") {
16901
- finished = true;
16902
- throw new PairRelayError("PAIR_CLOSED", "The browser cancelled the registration.");
16903
- }
16904
- if (offer) return { ...offer, attemptId };
16905
- }
16906
- },
16907
- async reveal(pcPublicRaw, nP, signal, macP) {
16908
- await send({ type: "reveal", publicKey: b64u2(pcPublicRaw), nP: b64u2(nP), ...macP ? { macP: b64u2(macP) } : {} }, signal);
16909
- },
16910
- async done(signature, signal) {
16911
- await send({ type: "done", signature: b64u2(signature) }, signal);
16912
- finished = true;
16913
- },
16914
- async abort(reason) {
16915
- if (!attemptId || finished) return;
16916
- finished = true;
16917
- try {
16918
- await send({ type: "abort", reason });
16919
- } catch {
16920
- }
16921
- }
16922
- };
16923
- }
16924
- function offerOf(msgs) {
16925
- if (msgs.length === 0) return void 0;
16926
- const items = msgs.map((msg) => msg && typeof msg === "object" ? msg : {});
16927
- if (items.some((item2) => item2.type === "abort")) return "abort";
16928
- if (items.length > 1) {
16929
- throw new PairRelayError("PAIR_DUPLICATE", "More than one browser registration request arrived \u2014 this try was ended. Run `ainecto pair` again.");
16930
- }
16931
- const [item] = items;
16932
- const publicRaw = fromB64u2(item?.publicKey, PUBLIC_KEY_BYTES);
16933
- const nB = fromB64u2(item?.nB, NONCE_SEED_BYTES);
16934
- const macB = item?.macB === void 0 ? void 0 : fromB64u2(
16935
- item.macB,
16936
- 32
16937
- /* HMAC-SHA256 */
16938
- );
16939
- if (item?.type !== "offer" || !publicRaw || !nB || typeof item.keyId !== "string" || typeof item.name !== "string" || item.macB !== void 0 && !macB) {
16940
- throw new PairRelayError("PAIR_BAD_MESSAGE", "AiNecto relayed a browser registration message this CLI does not understand \u2014 this try was ended.");
16941
- }
16942
- return { keyId: item.keyId, publicRaw, nB, name: item.name, ...macB ? { macB } : {} };
16943
- }
16944
- function b64u2(bytes) {
16945
- return Buffer.from(bytes).toString("base64url");
16946
- }
16947
- function fromB64u2(value, length) {
16948
- if (typeof value !== "string" || !/^[A-Za-z0-9_-]+$/.test(value)) return void 0;
16949
- const bytes = new Uint8Array(Buffer.from(value, "base64url"));
16950
- return bytes.length === length ? bytes : void 0;
16951
- }
16952
-
16953
- // src/adapters/cli/pcStartText.ts
16954
- var DOCTOR_ONLY = /* @__PURE__ */ new Set(["AiNecto job title"]);
16955
- var NOT_CONNECTED = "not connected to AiNecto";
16956
- var STOP = "To stop it, run `ainecto stop`.";
16957
- function preflightNotes(checks) {
16958
- const agentLabels = new Set(Object.values(AGENT_CLIENT_LABELS));
16959
- const missing = [];
16960
- const lines = [];
16961
- for (const check of checks) {
16962
- if (check.level === "ok" || DOCTOR_ONLY.has(check.item)) continue;
16963
- if (agentLabels.has(check.item) && check.level === "warn" && check.detail === NOT_CONNECTED) {
16964
- missing.push(check.item);
16965
- continue;
16966
- }
16967
- lines.push(`${check.level === "fail" ? "\u2717" : "!"} ${check.item}: ${check.detail}${check.fix ? ` \u2014 fix: ${check.fix}` : ""}`);
16968
- }
16969
- if (missing.length > 0) {
16970
- lines.unshift(`! To use AiNecto from ${listed(missing)} on this computer, run \`ainecto setup\` \u2014 ${missing.length === 1 ? "its" : "their"} settings here have no AiNecto entry yet (a connector you added in your claude.ai or ChatGPT account is not checked here).`);
16971
- }
16972
- return lines;
16973
- }
16974
- function pcResultText(result) {
16975
- if (result.kind === "connecting") {
16976
- return `Still connecting this PC to AiNecto \u2014 run \`ainecto status\` to see when it is up. Log: ${result.log}`;
16977
- }
16978
- if (result.kind === "already") {
16979
- return `This PC is already connected to AiNecto (folder ${result.folder}, version ${result.version}). ${STOP} Log: ${result.log}`;
16980
- }
16981
- const use = result.agentMissing ? "From AiNecto on the web you can open a terminal on this PC and run commands. No Claude Code or Codex was found, so AiNecto agent work cannot run here yet \u2014 install one, then run `ainecto` again." : "From AiNecto on the web you can open a terminal on this PC and run commands, and your AiNecto agent can run work here (Claude Code or Codex).";
16982
- return `This PC is now connected to AiNecto. ${use} It keeps running after you close this window. ${STOP} Log: ${result.log}`;
16983
- }
16984
- function pcNotApprovedText(hostName, then) {
16985
- return `This PC (${hostName}) is not connected to AiNecto yet. Run \`npx -y ainecto@latest\` in a terminal on this PC first and approve the connection${then ? `, then ${then}` : ""}.`;
16986
- }
16987
- function listed(labels) {
16988
- if (labels.length <= 2) return labels.join(" and ");
16989
- return `${labels.slice(0, -1).join(", ")} and ${labels[labels.length - 1]}`;
16990
- }
16991
-
16992
- // src/adapters/cli/pairCommand.ts
16993
16809
  var USAGE = "Usage: ainecto pair [--list | --remove <keyId|name>]";
16994
- function openDevTty() {
16995
- const terminal = controllingTerminal();
16996
- let inFd;
16997
- try {
16998
- inFd = openSync3(terminal.input, terminal.inputFlags);
16999
- const outFd = openSync3(terminal.output, terminal.outputFlags);
17000
- const stdin = new ReadStream(inFd);
17001
- const stderr = new WriteStream(outFd);
17002
- return { stdin, stderr, close: () => {
17003
- stdin.destroy();
17004
- stderr.destroy();
17005
- } };
17006
- } catch (error) {
17007
- if (inFd !== void 0) closeSync3(inFd);
17008
- throw new CliCommandError("PAIR_NO_TTY", `\`ainecto pair\` needs this PC's terminal (${terminal.input}): ${error instanceof Error ? error.message : String(error)}`);
17009
- }
17010
- }
16810
+ var PAIR_RETIRED = "Browser registration is automatic now \u2014 just run `npx -y ainecto@latest` in this PC's terminal.";
17011
16811
  async function executePair(deps, argv) {
17012
16812
  const [first, ...rest] = argv;
17013
16813
  if (first === "--list" && rest.length === 0) {
@@ -17019,75 +16819,7 @@ async function executePair(deps, argv) {
17019
16819
  if (first !== void 0) {
17020
16820
  throw new CliCommandError("USAGE", USAGE);
17021
16821
  }
17022
- return await pair(deps);
17023
- }
17024
- async function pair(deps) {
17025
- const interactive = deps.interactive && !deps.json;
17026
- if (interactive && deps.insideTermSession) {
17027
- throw new CliCommandError(
17028
- "PAIR_IN_TERM_SESSION",
17029
- "`ainecto pair` does not run inside an AiNecto terminal session (its screen can be shown on the web). Run it in a regular terminal on this PC."
17030
- );
17031
- }
17032
- let approved = await approvedAccount(deps, { strict: !interactive });
17033
- if (!approved && interactive) {
17034
- const code = await deps.connectPc();
17035
- if (code !== 0) return code;
17036
- approved = await approvedAccount(deps, { strict: false });
17037
- if (approved) deps.io.stderr.write("\nNext: register this browser with this PC.\n");
17038
- }
17039
- if (!approved) {
17040
- throw new CliCommandError("PC_NOT_APPROVED", pcNotApprovedText(deps.hostName, "run `npx -y ainecto@latest pair` to register this browser"));
17041
- }
17042
- if (!interactive) {
17043
- throw new CliCommandError(
17044
- "PAIR_INTERACTIVE_ONLY",
17045
- "`ainecto pair` shows a code and asks you to type the code the browser shows \u2014 run it yourself in a terminal (not with --json or a pipe)."
17046
- );
17047
- }
17048
- const { key, userId, settings } = approved;
17049
- const pcKey = (await loadPcKeys(deps.keysPath)).accounts[key]?.pcKey ?? await generateSigningJwk();
17050
- const transport = await deps.transport(settings.pcId);
17051
- const tty = deps.openTty();
17052
- let outcome;
17053
- try {
17054
- outcome = await relayErrors(() => runPairing({
17055
- userId: transcriptUserId(userId),
17056
- pcId: settings.pcId,
17057
- pcKey,
17058
- transport,
17059
- check: { kind: "codes", prompt: { show: (line) => {
17060
- tty.stderr.write(`${line}
17061
- `);
17062
- }, ask: (question, signal) => promptLine(tty, question, signal) } },
17063
- pin: (browser2) => pinBrowser({ keysPath: deps.keysPath, key, pcKey, browser: browser2, now: deps.now() }),
17064
- waitMs: deps.waitMs
17065
- }));
17066
- } finally {
17067
- tty.close();
17068
- }
17069
- if (outcome.kind === "timeout") {
17070
- throw new CliCommandError("PAIR_TIMEOUT", "Browser registration did not finish in time. Nothing was saved \u2014 run `ainecto pair` again.");
17071
- }
17072
- if (outcome.kind === "cancelled") {
17073
- throw new CliCommandError("PAIR_CANCELLED", "Browser registration cancelled. Nothing was saved \u2014 run `ainecto pair` again.");
17074
- }
17075
- if (outcome.kind === "code-mismatch") {
17076
- throw new CliCommandError(
17077
- "PAIR_CODE_MISMATCH",
17078
- "That code does not match. Nothing was saved \u2014 start again with `ainecto pair` (if you typed it right, someone may be in the middle)."
17079
- );
17080
- }
17081
- const { browser, doneError } = outcome;
17082
- if (doneError !== void 0) {
17083
- throw new CliCommandError("PAIR_DONE_FAILED", `Saved "${browser.name}" on this PC, but the browser did not get the confirmation (${doneError}), so it will not trust this PC yet. Remove it with \`ainecto pair --remove ${browser.keyId}\` and run \`ainecto pair\` again.`);
17084
- }
17085
- await deps.notifyPaired({ keyId: browser.keyId, name: browser.name });
17086
- const lines = [`Registered the browser "${browser.name}" with this PC. Remove it later with \`ainecto pair --remove ${browser.keyId}\`.`];
17087
- if (settings.accounts[key]?.remoteTerminal !== true) {
17088
- lines.push("Terminals from the web are blocked on this PC \u2014 `ainecto remote on` allows them.");
17089
- }
17090
- deps.io.stdout.write(`${lines.join("\n")}
16822
+ deps.io.stdout.write(`${PAIR_RETIRED}
17091
16823
  `);
17092
16824
  return 0;
17093
16825
  }
@@ -17096,10 +16828,10 @@ async function pinBrowser(input) {
17096
16828
  await updatePcKeys(input.keysPath, (latest) => {
17097
16829
  const stored = latest.accounts[key]?.pcKey;
17098
16830
  if (stored && stored.d !== pcKey.d) {
17099
- throw new CliCommandError("PAIR_CONFLICT", "This PC's key changed during browser registration (another `ainecto pair`?). Nothing was saved \u2014 run `ainecto pair` again.");
16831
+ throw new CliCommandError("PAIR_CONFLICT", "This PC's key changed during browser registration (another registration?). Nothing was saved \u2014 run `npx -y ainecto@latest` again.");
17100
16832
  }
17101
16833
  if (latest.accounts[key]?.pendingTurnOff?.removals.some((item) => item.keyId === browser.keyId)) {
17102
- throw new CliCommandError("PAIR_REMOVE_PENDING", `This browser's earlier removal has not finished. Nothing was saved \u2014 run \`ainecto pair --remove ${browser.keyId}\` first, then \`ainecto pair\` again.`);
16834
+ throw new CliCommandError("PAIR_REMOVE_PENDING", `This browser's earlier removal has not finished. Nothing was saved \u2014 run \`ainecto pair --remove ${browser.keyId}\` first, then \`npx -y ainecto@latest\` again.`);
17103
16835
  }
17104
16836
  return withBrowser(latest, key, pcKey, { ...browser, pairedAt: input.now.toISOString() });
17105
16837
  });
@@ -17107,7 +16839,7 @@ async function pinBrowser(input) {
17107
16839
  async function listBrowsers(deps) {
17108
16840
  const browsers = (await loadPcKeys(deps.keysPath)).accounts[(await account(deps)).key]?.browsers ?? [];
17109
16841
  const data = { browsers: browsers.map((item) => ({ keyId: item.keyId, name: item.name, pairedAt: item.pairedAt })) };
17110
- const human = browsers.length === 0 ? "No browsers are registered with this PC. Run `ainecto pair` to register one." : ["Browsers registered with this PC:", ...browsers.map((item) => ` ${item.keyId} ${item.name} (registered ${item.pairedAt})`)].join("\n");
16842
+ const human = browsers.length === 0 ? "No browsers are registered with this PC. Run `npx -y ainecto@latest` to register one." : ["Browsers registered with this PC:", ...browsers.map((item) => ` ${item.keyId} ${item.name} (registered ${item.pairedAt})`)].join("\n");
17111
16843
  deps.io.stdout.write(deps.json ? renderSuccess(data, { json: true }) : `${human}
17112
16844
  `);
17113
16845
  return 0;
@@ -17152,29 +16884,6 @@ async function removeBrowser(deps, keyIdOrName) {
17152
16884
  `);
17153
16885
  return 0;
17154
16886
  }
17155
- async function relayErrors(run) {
17156
- try {
17157
- return await run();
17158
- } catch (error) {
17159
- if (error instanceof PairRelayError) {
17160
- throw new CliCommandError(error.code, `${error.message} Nothing was saved \u2014 run \`ainecto pair\` again.`);
17161
- }
17162
- if (error instanceof PcCallError) {
17163
- throw new CliCommandError("PAIR_RELAY_FAILED", `Could not reach AiNecto for browser registration (${error.op}: ${error.status ?? "-"} ${error.code ?? ""} ` + `${error.message}`.replace(/\s+/g, " ").trim() + "). Nothing was saved \u2014 run `ainecto pair` again.");
17164
- }
17165
- throw error;
17166
- }
17167
- }
17168
- async function approvedAccount(deps, options) {
17169
- const userId = (await deps.account()).userId;
17170
- if (!userId) {
17171
- if (options.strict) throw accountUnknown();
17172
- return void 0;
17173
- }
17174
- const key = accountKey(deps.endpoint, userId);
17175
- const settings = await loadPcSettings(deps.settingsPath, deps.hostName);
17176
- return settings.accounts[key] ? { key, userId, settings } : void 0;
17177
- }
17178
16887
  async function account(deps) {
17179
16888
  const userId = (await deps.account()).userId;
17180
16889
  if (!userId) throw accountUnknown();
@@ -17184,6 +16893,45 @@ function accountUnknown() {
17184
16893
  return new CliCommandError("PC_ACCOUNT_UNKNOWN", "Could not read your AiNecto account \u2014 run `ainecto doctor` to see why.");
17185
16894
  }
17186
16895
 
16896
+ // src/adapters/cli/pcStartText.ts
16897
+ var DOCTOR_ONLY = /* @__PURE__ */ new Set(["AiNecto job title"]);
16898
+ var NOT_CONNECTED = "not connected to AiNecto";
16899
+ var STOP = "To stop it, run `ainecto stop`.";
16900
+ function preflightNotes(checks) {
16901
+ const agentLabels = new Set(Object.values(AGENT_CLIENT_LABELS));
16902
+ const missing = [];
16903
+ const lines = [];
16904
+ for (const check of checks) {
16905
+ if (check.level === "ok" || DOCTOR_ONLY.has(check.item)) continue;
16906
+ if (agentLabels.has(check.item) && check.level === "warn" && check.detail === NOT_CONNECTED) {
16907
+ missing.push(check.item);
16908
+ continue;
16909
+ }
16910
+ lines.push(`${check.level === "fail" ? "\u2717" : "!"} ${check.item}: ${check.detail}${check.fix ? ` \u2014 fix: ${check.fix}` : ""}`);
16911
+ }
16912
+ if (missing.length > 0) {
16913
+ lines.unshift(`! To use AiNecto from ${listed(missing)} on this computer, run \`ainecto setup\` \u2014 ${missing.length === 1 ? "its" : "their"} settings here have no AiNecto entry yet (a connector you added in your claude.ai or ChatGPT account is not checked here).`);
16914
+ }
16915
+ return lines;
16916
+ }
16917
+ function pcResultText(result) {
16918
+ if (result.kind === "connecting") {
16919
+ return `Still connecting this PC to AiNecto \u2014 run \`ainecto status\` to see when it is up. Log: ${result.log}`;
16920
+ }
16921
+ if (result.kind === "already") {
16922
+ return `This PC is already connected to AiNecto (folder ${result.folder}, version ${result.version}). ${STOP} Log: ${result.log}`;
16923
+ }
16924
+ const use = result.agentMissing ? "From AiNecto on the web you can open a terminal on this PC and run commands. No Claude Code or Codex was found, so AiNecto agent work cannot run here yet \u2014 install one, then run `ainecto` again." : "From AiNecto on the web you can open a terminal on this PC and run commands, and your AiNecto agent can run work here (Claude Code or Codex).";
16925
+ return `This PC is now connected to AiNecto. ${use} It keeps running after you close this window. ${STOP} Log: ${result.log}`;
16926
+ }
16927
+ function pcNotApprovedText(hostName, then) {
16928
+ return `This PC (${hostName}) is not connected to AiNecto yet. Run \`npx -y ainecto@latest\` in a terminal on this PC first and approve the connection${then ? `, then ${then}` : ""}.`;
16929
+ }
16930
+ function listed(labels) {
16931
+ if (labels.length <= 2) return labels.join(" and ");
16932
+ return `${labels.slice(0, -1).join(", ")} and ${labels[labels.length - 1]}`;
16933
+ }
16934
+
17187
16935
  // src/adapters/cli/pcCommand.ts
17188
16936
  async function executePcStart(deps) {
17189
16937
  assertTerm(deps);
@@ -17233,6 +16981,7 @@ async function executePcStart(deps) {
17233
16981
  settings = withConsent(settings, key, remote, /* @__PURE__ */ new Date());
17234
16982
  await savePcSettings(deps.settingsPath, settings);
17235
16983
  }
16984
+ await upgradeDaemon(deps, note);
17236
16985
  const action = pcAction(runningPcs(await listed2(deps)), deps.cliVersion);
17237
16986
  if (action.kind === "already") {
17238
16987
  if (!remoteOffByWeb(await screenLines2(deps, action.pc.session))) {
@@ -17255,26 +17004,46 @@ async function executePcStart(deps) {
17255
17004
  }
17256
17005
  return await withRegistration(deps, key, userId, withNotes(deps, later, await launchPc(deps)));
17257
17006
  }
17007
+ async function upgradeDaemon(deps, note) {
17008
+ const info = readDaemonInfo(deps.paths);
17009
+ if (!info) return;
17010
+ const plan = daemonUpgrade(info.version, deps.cliVersion, await listed2(deps), deps.register?.insideTermSession ?? false);
17011
+ if (plan.kind === "keep") return;
17012
+ if (plan.kind === "ask") {
17013
+ if (!deps.interactive) return;
17014
+ note(`This PC's terminal service is from an older AiNecto (${info.version}). Updating it to ${deps.cliVersion} closes ${plan.sessions.length} open terminal session(s): ${plan.sessions.join(", ")}.`);
17015
+ if (!yes(await promptLine(deps.io, "Update it now? [y/N]: "), false)) return;
17016
+ }
17017
+ note("Updating the AiNecto terminal service on this PC\u2026");
17018
+ await termRequest(deps.paths, { op: "kill-server" }, { start: false });
17019
+ if (!await waitForPidGone(info.pid, deps.stopDeadlineMs)) {
17020
+ throw new CliCommandError("PC_START_FAILED", `The old terminal service (pid ${info.pid}) did not stop. Restart this PC, then run \`npx -y ainecto@latest\` again.`);
17021
+ }
17022
+ }
17258
17023
  async function withRegistration(deps, key, userId, code) {
17259
- if (code === 0) await registerBrowserIfNone(deps, { key, userId });
17024
+ if (code === 0) await registerBrowserOnStart(deps, { key, userId });
17260
17025
  return code;
17261
17026
  }
17262
- async function registerBrowserIfNone(deps, account2) {
17027
+ async function registerBrowserOnStart(deps, account2) {
17263
17028
  const register = deps.register;
17264
17029
  if (!register || !deps.interactive || deps.json || register.insideTermSession) return;
17265
17030
  const settings = await loadPcSettings(deps.settingsPath, deps.hostName);
17266
17031
  if (settings.accounts[account2.key]?.remoteTerminal !== true) return;
17267
17032
  const stored = (await loadPcKeys(deps.keysPath)).accounts[account2.key];
17268
- if ((stored?.browsers.length ?? 0) > 0) return;
17033
+ const registered = stored?.browsers.length ?? 0;
17269
17034
  const note = (line) => {
17270
17035
  deps.io.stderr.write(`${line}
17271
17036
  `);
17272
17037
  };
17273
- const noBrowser = "This PC can't open a browser here. To register this browser, run `npx -y ainecto@latest pair` in this PC's terminal.";
17038
+ const noBrowser = "This PC can't open a browser here (for example over ssh). Run `npx -y ainecto@latest` in a terminal on this PC's own screen to register your browser.";
17274
17039
  if (register.overSsh) {
17275
- note(noBrowser);
17040
+ if (registered === 0) note(noBrowser);
17276
17041
  return;
17277
17042
  }
17043
+ if (registered > 0) {
17044
+ const question = `This PC already has ${registered} registered browser${registered === 1 ? "" : "s"}. Register the browser that opens now too? [y/N]: `;
17045
+ if (!yes(await promptLine(deps.io, question), false)) return;
17046
+ }
17278
17047
  const userId = transcriptUserId(account2.userId);
17279
17048
  const secret = randomBytes3(NONCE_SEED_BYTES);
17280
17049
  const interrupt = register.interrupt();
@@ -17296,7 +17065,7 @@ async function registerBrowserIfNone(deps, account2) {
17296
17065
  pcId: settings.pcId,
17297
17066
  pcKey,
17298
17067
  transport: await register.transport(settings.pcId),
17299
- check: { kind: "secret", secret },
17068
+ secret,
17300
17069
  pin: (browser2) => pinBrowser({ keysPath: deps.keysPath, key: account2.key, pcKey, browser: browser2, now: register.now() }),
17301
17070
  waitMs: register.waitMs,
17302
17071
  cancel: interrupt.signal
@@ -17323,10 +17092,10 @@ async function registerBrowserIfNone(deps, account2) {
17323
17092
  return;
17324
17093
  }
17325
17094
  await register.notifyPaired({ keyId: browser.keyId, name: browser.name });
17326
- deps.io.stdout.write(`Registered "${browser.name}" with this PC. Remove it later with \`ainecto pair --remove ${browser.keyId}\`.
17095
+ deps.io.stdout.write(`Registered "${browser.name}" with this PC.
17327
17096
  `);
17328
17097
  }
17329
- var REGISTER_AGAIN = "Try again: `npx -y ainecto@latest` \xB7 or register this browser with `npx -y ainecto@latest pair`.";
17098
+ var REGISTER_AGAIN = "Try again: `npx -y ainecto@latest`.";
17330
17099
  function withNotes(deps, notes, code) {
17331
17100
  for (const line of notes) deps.io.stderr.write(`${line}
17332
17101
  `);
@@ -17434,7 +17203,7 @@ async function executePcStop(deps, argv) {
17434
17203
  return removedKeys ? kept : void 0;
17435
17204
  });
17436
17205
  if (removedKeys) {
17437
- lines.push("Also removed this PC's terminal key and registered browsers for that server \u2014 register them again with `ainecto pair`.");
17206
+ lines.push("Also removed this PC's terminal key and registered browsers for that server \u2014 register them again by running `npx -y ainecto@latest`.");
17438
17207
  }
17439
17208
  }
17440
17209
  return print2(deps, { stopped: running.map((pc) => pc.session), forgot: forget }, lines.join("\n"));
@@ -17592,6 +17361,113 @@ function print2(deps, data, human) {
17592
17361
  return 0;
17593
17362
  }
17594
17363
 
17364
+ // src/core/pc/pcPairRelay.ts
17365
+ var PairRelayError = class extends Error {
17366
+ constructor(code, message2) {
17367
+ super(message2);
17368
+ this.code = code;
17369
+ }
17370
+ code;
17371
+ };
17372
+ function createPairRelay(input) {
17373
+ const http = createPcHttp({
17374
+ endpoint: input.endpoint,
17375
+ path: "term/pc",
17376
+ tokenProvider: input.tokenProvider,
17377
+ timeoutMs: CALL_TIMEOUT_MS,
17378
+ sessionHeader: "X-Remote-Token",
17379
+ fetchImpl: input.fetchImpl,
17380
+ logging: {
17381
+ log: input.log,
17382
+ request: ({ callId, op, bytes }) => ({ event: "remote_call", callId, op, bytes }),
17383
+ response: ({ callId, op, ms }, outcome) => ({
17384
+ event: "remote_call_response",
17385
+ callId,
17386
+ op,
17387
+ ...outcome.ok ? {
17388
+ ok: true,
17389
+ status: outcome.status,
17390
+ ...Array.isArray(outcome.body.msgs) ? { commands: outcome.body.msgs.length } : {},
17391
+ ...outcome.body.closed === true ? { state: "CLOSED" } : {}
17392
+ } : outcome,
17393
+ ms
17394
+ })
17395
+ }
17396
+ });
17397
+ let attemptId;
17398
+ let finished = false;
17399
+ const send = async (msg, signal) => {
17400
+ if (!attemptId) throw new PairRelayError("PAIR_RELAY_BAD_RESPONSE", "The browser registration was not opened.");
17401
+ await http.call("pair/send", { attemptId, msg }, signal ? { signal } : void 0);
17402
+ };
17403
+ return {
17404
+ async offer(commit, signal) {
17405
+ const opened = await http.call("pair/open", { pcId: input.pcId }, { signal });
17406
+ if (typeof opened.attemptId !== "string" || opened.attemptId === "") {
17407
+ throw new PairRelayError("PAIR_RELAY_BAD_RESPONSE", "AiNecto answered pair/open without an attemptId.");
17408
+ }
17409
+ attemptId = opened.attemptId;
17410
+ await send({ type: "commit", commit: b64u2(commit) }, signal);
17411
+ for (; ; ) {
17412
+ const answer = await http.call("pair/poll", { attemptId }, { holdMs: input.holdMs, signal });
17413
+ if (answer.closed === true) {
17414
+ finished = true;
17415
+ throw new PairRelayError("PAIR_CLOSED", "The browser registration ended on AiNecto (the browser cancelled it, or it expired).");
17416
+ }
17417
+ const offer = offerOf(Array.isArray(answer.msgs) ? answer.msgs : []);
17418
+ if (offer === "abort") {
17419
+ finished = true;
17420
+ throw new PairRelayError("PAIR_CLOSED", "The browser cancelled the registration.");
17421
+ }
17422
+ if (offer) return { ...offer, attemptId };
17423
+ }
17424
+ },
17425
+ async reveal(pcPublicRaw, nP, signal, macP) {
17426
+ await send({ type: "reveal", publicKey: b64u2(pcPublicRaw), nP: b64u2(nP), ...macP ? { macP: b64u2(macP) } : {} }, signal);
17427
+ },
17428
+ async done(signature, signal) {
17429
+ await send({ type: "done", signature: b64u2(signature) }, signal);
17430
+ finished = true;
17431
+ },
17432
+ async abort(reason) {
17433
+ if (!attemptId || finished) return;
17434
+ finished = true;
17435
+ try {
17436
+ await send({ type: "abort", reason });
17437
+ } catch {
17438
+ }
17439
+ }
17440
+ };
17441
+ }
17442
+ function offerOf(msgs) {
17443
+ if (msgs.length === 0) return void 0;
17444
+ const items = msgs.map((msg) => msg && typeof msg === "object" ? msg : {});
17445
+ if (items.some((item2) => item2.type === "abort")) return "abort";
17446
+ if (items.length > 1) {
17447
+ throw new PairRelayError("PAIR_DUPLICATE", "More than one browser registration request arrived \u2014 this try was ended. Run `npx -y ainecto@latest` again.");
17448
+ }
17449
+ const [item] = items;
17450
+ const publicRaw = fromB64u2(item?.publicKey, PUBLIC_KEY_BYTES);
17451
+ const nB = fromB64u2(item?.nB, NONCE_SEED_BYTES);
17452
+ const macB = item?.macB === void 0 ? void 0 : fromB64u2(
17453
+ item.macB,
17454
+ 32
17455
+ /* HMAC-SHA256 */
17456
+ );
17457
+ if (item?.type !== "offer" || !publicRaw || !nB || typeof item.keyId !== "string" || typeof item.name !== "string" || item.macB !== void 0 && !macB) {
17458
+ throw new PairRelayError("PAIR_BAD_MESSAGE", "AiNecto relayed a browser registration message this CLI does not understand \u2014 this try was ended.");
17459
+ }
17460
+ return { keyId: item.keyId, publicRaw, nB, name: item.name, ...macB ? { macB } : {} };
17461
+ }
17462
+ function b64u2(bytes) {
17463
+ return Buffer.from(bytes).toString("base64url");
17464
+ }
17465
+ function fromB64u2(value, length) {
17466
+ if (typeof value !== "string" || !/^[A-Za-z0-9_-]+$/.test(value)) return void 0;
17467
+ const bytes = new Uint8Array(Buffer.from(value, "base64url"));
17468
+ return bytes.length === length ? bytes : void 0;
17469
+ }
17470
+
17595
17471
  // src/core/pc/pcNotify.ts
17596
17472
  var NOTIFY_BATCH_MS = 6e4;
17597
17473
  var WHAT = {
@@ -19049,8 +18925,7 @@ var AGENT_HELP_LINES = [
19049
18925
  " ainecto in a terminal, with no arguments: check sign-in, ask once, then connect this PC in the background (same as ainecto start)",
19050
18926
  " ainecto start [--env prod|dev] connect this PC in the background \u2014 keeps running after you close the window (log: ~/.ainecto/agent/agent.log)",
19051
18927
  " ainecto stop [--forget] disconnect this PC now (--forget also removes your approval and registered browsers on this PC)",
19052
- " ainecto remote on|off allow or block terminals from AiNecto on the web on this PC",
19053
- " ainecto pair [--list | --remove <keyId|name>] register a web browser with this PC by typing codes shown on both (once per browser)"
18928
+ " ainecto remote on|off allow or block terminals from AiNecto on the web on this PC"
19054
18929
  ];
19055
18930
  function isPcRunCommand(domain, action) {
19056
18931
  return domain === "pc" && action === "run";
@@ -19334,21 +19209,13 @@ async function runAinectoCli(argv, io) {
19334
19209
  return await executePair({
19335
19210
  io,
19336
19211
  json: parsed.json,
19337
- interactive,
19338
- insideTermSession,
19339
- openTty: openDevTty,
19340
19212
  settingsPath: pcSettingsPath(),
19341
19213
  keysPath: pcKeysPath(),
19342
19214
  hostName: hostname4(),
19343
19215
  endpoint: resolved.endpoint,
19344
19216
  account: () => readAccount(connect2().client),
19345
- transport: pairTransport,
19346
- notifyPaired,
19347
19217
  findPcs: () => runningPcGroups(pcDeps()),
19348
19218
  turnOffPcs: (groups) => turnOffPcs(pcDeps(), groups),
19349
- // 연결 승인 전 대화형 — `ainecto`(인자 없음)와 같은 흐름 그대로(KAN-1348). 자동 등록은 빼고 이어서 코드로 등록한다.
19350
- connectPc: () => executePcStart({ ...pcDeps(), register: void 0 }),
19351
- waitMs: PAIR_WAIT_MS,
19352
19219
  now: () => /* @__PURE__ */ new Date()
19353
19220
  }, parsed.positionals.slice(1));
19354
19221
  }