@agentconnect.md/daemon 1.0.0-rc.20 → 1.0.0-rc.22

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/index.js CHANGED
@@ -7281,7 +7281,7 @@ const ConfigSchema = object({
7281
7281
  controlPlane: object({
7282
7282
  enabled: boolean().default(true),
7283
7283
  url: string().optional(),
7284
- token: string().optional(),
7284
+ key: string().optional(),
7285
7285
  heartbeatMs: number().int().default(15e3)
7286
7286
  }).default({
7287
7287
  enabled: false,
@@ -7351,8 +7351,8 @@ function loadConfig(opts = {}) {
7351
7351
  if (o.logLevel) cfg.logging.level = o.logLevel;
7352
7352
  if (o.maxAgents !== void 0) cfg.limits.maxAgents = o.maxAgents;
7353
7353
  if (o.cpUrl) cfg.controlPlane.url = o.cpUrl;
7354
- if (o.cpToken) cfg.controlPlane.token = o.cpToken;
7355
- if (o.cpUrl || o.cpToken) cfg.controlPlane.enabled = true;
7354
+ if (o.cpKey) cfg.controlPlane.key = o.cpKey;
7355
+ if (o.cpUrl || o.cpKey) cfg.controlPlane.enabled = true;
7356
7356
  if (o.noCp) cfg.controlPlane.enabled = false;
7357
7357
  cfg.agentsDir = o.agentsDir ?? cfg.agentsDir ?? defaultAgentsDir(root);
7358
7358
  return cfg;
@@ -20522,7 +20522,7 @@ async function probeAuth(opts) {
20522
20522
  };
20523
20523
  }
20524
20524
  const authPayload = {
20525
- daemonToken: opts.token,
20525
+ apiKey: opts.token,
20526
20526
  agentVersion: opts.agentVersion ?? "probe"
20527
20527
  };
20528
20528
  if (opts.daemonId) authPayload.daemonId = opts.daemonId;
@@ -79782,7 +79782,7 @@ var CpClient = class {
79782
79782
  async handshake() {
79783
79783
  this.state = "AUTHENTICATING";
79784
79784
  const authPayload = {
79785
- daemonToken: this.deps.token,
79785
+ apiKey: this.deps.token,
79786
79786
  agentVersion: this.deps.agentVersion
79787
79787
  };
79788
79788
  if (this.deps.daemonId) authPayload.daemonId = this.deps.daemonId;
@@ -80071,8 +80071,8 @@ var Daemon = class {
80071
80071
  autoCreate: true
80072
80072
  });
80073
80073
  this.cfg = cfg;
80074
- const cpTokenOnboarding = !!(cfg.controlPlane?.enabled && cfg.controlPlane.token);
80075
- if (!cfg.daemonId && !cpTokenOnboarding) {
80074
+ const cpKeyOnboarding = !!(cfg.controlPlane?.enabled && cfg.controlPlane.key);
80075
+ if (!cfg.daemonId && !cpKeyOnboarding) {
80076
80076
  cfg.daemonId = randomUUID();
80077
80077
  persistDaemonId(root, cfg.daemonId);
80078
80078
  }
@@ -80391,7 +80391,7 @@ var Daemon = class {
80391
80391
  }
80392
80392
  startCpClient(root) {
80393
80393
  const cp = this.cfg.controlPlane;
80394
- if (!cp?.enabled || !cp.url || !cp.token) {
80394
+ if (!cp?.enabled || !cp.url || !cp.key) {
80395
80395
  this.log.info("cp: not connecting (disabled or missing url/token) — running local");
80396
80396
  return;
80397
80397
  }
@@ -80400,7 +80400,7 @@ var Daemon = class {
80400
80400
  const url = cp.url;
80401
80401
  this.cpClient = new CpClient({
80402
80402
  url,
80403
- token: cp.token,
80403
+ token: cp.key,
80404
80404
  ...echoDaemonId ? { daemonId: echoDaemonId } : {},
80405
80405
  onDaemonId: (id) => {
80406
80406
  this.cfg.daemonId = id;
@@ -80495,7 +80495,7 @@ function persistCredentials(opts) {
80495
80495
  raw.controlPlane = {
80496
80496
  ...raw.controlPlane ?? {},
80497
80497
  url: opts.cpUrl,
80498
- token: opts.cpToken,
80498
+ key: opts.cpKey,
80499
80499
  enabled: true
80500
80500
  };
80501
80501
  if (opts.daemonId) raw.daemonId = opts.daemonId;
@@ -80535,7 +80535,7 @@ function realDeps(opts) {
80535
80535
  root: opts.root,
80536
80536
  overrides: {
80537
80537
  cpUrl: opts.cpUrl,
80538
- cpToken: opts.cpToken,
80538
+ cpKey: opts.cpKey,
80539
80539
  daemonId: opts.daemonId
80540
80540
  }
80541
80541
  }),
@@ -80559,16 +80559,16 @@ async function runLogin(opts, partial = {}) {
80559
80559
  const { out } = deps;
80560
80560
  if (!deps.isTTY) {
80561
80561
  if (!opts.cpUrl) throw new Error("login requires --cp-url <url>");
80562
- if (!opts.cpToken) throw new Error("login requires --cp-token <token>");
80562
+ if (!opts.cpKey) throw new Error("login requires --cp-key <key>");
80563
80563
  const r = await deps.probe({
80564
80564
  url: opts.cpUrl,
80565
- token: opts.cpToken
80565
+ token: opts.cpKey
80566
80566
  });
80567
80567
  if (!r.ok) throw new Error(`authentication failed: ${r.reason}`);
80568
80568
  persistCredentials({
80569
80569
  ...opts,
80570
80570
  cpUrl: opts.cpUrl,
80571
- cpToken: opts.cpToken
80571
+ cpKey: opts.cpKey
80572
80572
  });
80573
80573
  out.write(`✓ authenticated${r.daemonId ? ` (daemon ${r.daemonId})` : ""} — credentials saved\n`);
80574
80574
  return;
@@ -80580,11 +80580,11 @@ async function runLogin(opts, partial = {}) {
80580
80580
  });
80581
80581
  const iter = rl[Symbol.asyncIterator]();
80582
80582
  let url = opts.cpUrl;
80583
- let token = opts.cpToken;
80583
+ let token = opts.cpKey;
80584
80584
  try {
80585
80585
  if (!url) url = await nextLine(iter, "Control Plane URL: ", out);
80586
80586
  for (let attempt = 0;; attempt++) {
80587
- if (!token) token = await nextLine(iter, "Daemon token: ", out);
80587
+ if (!token) token = await nextLine(iter, "Daemon API key: ", out);
80588
80588
  out.write(`Testing connection to ${url}…\n`);
80589
80589
  const r = await deps.probe({
80590
80590
  url,
@@ -80601,7 +80601,7 @@ async function runLogin(opts, partial = {}) {
80601
80601
  persistCredentials({
80602
80602
  ...opts,
80603
80603
  cpUrl: url,
80604
- cpToken: token
80604
+ cpKey: token
80605
80605
  });
80606
80606
  const ans = (await nextLine(iter, "Install AgentConnect as a background service? (y/N) ", out)).toLowerCase();
80607
80607
  if (ans === "y" || ans === "yes") {
@@ -80619,7 +80619,7 @@ async function runLogin(opts, partial = {}) {
80619
80619
  //#region src/index.ts
80620
80620
  const program = new Command();
80621
80621
  program.name("agentconnect").description("AgentConnect daemon — edge message + agent execution unit").version(DAEMON_VERSION);
80622
- program.option("--config <path>", "path to config.json (default ~/.agentconnect/config.json)").option("--root <dir>", "override ~/.agentconnect root directory").option("--cp-url <url>", "override controlPlane.url").option("--cp-token <token>", "override controlPlane.token").option("--no-cp", "run fully local, do not connect to the Control Plane").option("--daemon-id <id>", "override daemon identity").option("--log-level <level>", "trace|debug|info|warn|error").option("--agents-dir <dir>", "override agents directory").option("--max-agents <n>", "max agents this daemon advertises / enforces").option("--dry-run", "load + validate config and print the reconcile plan, then exit").option("--agent <name>", "select a single agent by id (run/chat)");
80622
+ program.option("--config <path>", "path to config.json (default ~/.agentconnect/config.json)").option("--root <dir>", "override ~/.agentconnect root directory").option("--cp-url <url>", "override controlPlane.url").option("--cp-key <key>", "override controlPlane.key (the CP API key)").option("--no-cp", "run fully local, do not connect to the Control Plane").option("--daemon-id <id>", "override daemon identity").option("--log-level <level>", "trace|debug|info|warn|error").option("--agents-dir <dir>", "override agents directory").option("--max-agents <n>", "max agents this daemon advertises / enforces").option("--dry-run", "load + validate config and print the reconcile plan, then exit").option("--agent <name>", "select a single agent by id (run/chat)");
80623
80623
  program.command("run").description("Run the daemon in the foreground").action(async () => {
80624
80624
  const opts = program.opts();
80625
80625
  try {
@@ -80628,7 +80628,7 @@ program.command("run").description("Run the daemon in the foreground").action(as
80628
80628
  agentName: opts.agent,
80629
80629
  overrides: {
80630
80630
  cpUrl: opts.cpUrl,
80631
- cpToken: opts.cpToken,
80631
+ cpKey: opts.cpKey,
80632
80632
  noCp: opts.cp === false,
80633
80633
  daemonId: opts.daemonId,
80634
80634
  logLevel: opts.logLevel,
@@ -80729,7 +80729,7 @@ program.command("login").description("Interactive onboarding: test the Control P
80729
80729
  try {
80730
80730
  await runLogin({
80731
80731
  cpUrl: opts.cpUrl,
80732
- cpToken: opts.cpToken,
80732
+ cpKey: opts.cpKey,
80733
80733
  daemonId: opts.daemonId,
80734
80734
  root: opts.root,
80735
80735
  configPath: opts.config,