@agentorchestrationprotocol/cli-dev 0.1.13 → 0.1.15

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.
Files changed (2) hide show
  1. package/index.mjs +93 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -65,7 +65,7 @@ const ENGINES = {
65
65
  },
66
66
  };
67
67
 
68
- const DEFAULT_SCOPES = ["comment:create", "consensus:write", "claim:new"];
68
+ const DEFAULT_SCOPES = ["comment:create", "consensus:write", "claim:new", "slots:configure"];
69
69
  // DEV: points to the dev Convex deployment. Override via env vars.
70
70
  const DEFAULT_API_BASE_URL =
71
71
  process.env.AOP_API_BASE_URL ||
@@ -126,7 +126,7 @@ if (isRun) {
126
126
  overwriteOrchestrations,
127
127
  });
128
128
  } else {
129
- await runDeviceFlow({
129
+ await runSetup({
130
130
  apiBaseUrl,
131
131
  appUrl,
132
132
  scopes,
@@ -479,6 +479,97 @@ async function runOrchestrationsCommand({
479
479
  }
480
480
  }
481
481
 
482
+ async function runSetup({
483
+ apiBaseUrl,
484
+ appUrl,
485
+ scopes,
486
+ agentName,
487
+ agentModel,
488
+ tokenPathOverride,
489
+ orchestrationsPathOverride,
490
+ installOrchestrations,
491
+ overwriteOrchestrations,
492
+ }) {
493
+ const candidatePaths = tokenPathOverride
494
+ ? [tokenPathOverride]
495
+ : [HOME_TOKEN_PATH, CWD_TOKEN_PATH];
496
+
497
+ for (const p of candidatePaths) {
498
+ let existing;
499
+ try {
500
+ existing = JSON.parse(await readFile(p, "utf8"));
501
+ } catch {
502
+ continue;
503
+ }
504
+ if (!existing?.apiKey) continue;
505
+
506
+ const prefix = existing.apiKey.split("_").slice(0, 2).join("_");
507
+ console.log("");
508
+ console.log(` ${c.bold}${c.cyan}AOP [dev]${c.reset} ${c.dim}Agent Orchestration Protocol${c.reset}`);
509
+ console.log("");
510
+ console.log(` ${c.yellow}!${c.reset} Found existing credentials at ${c.bold}${p}${c.reset}`);
511
+ console.log(` ${c.dim}Key prefix: ${prefix}_...${c.reset}`);
512
+ console.log("");
513
+
514
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
515
+ let answer;
516
+ try {
517
+ answer = await new Promise((resolve) => {
518
+ rl.question(
519
+ ` Reuse this key? ${c.dim}[Y/n]${c.reset} `,
520
+ (a) => resolve(a.trim().toLowerCase()),
521
+ );
522
+ });
523
+ } finally {
524
+ rl.close();
525
+ }
526
+
527
+ if (answer === "" || answer === "y" || answer === "yes") {
528
+ if (installOrchestrations) {
529
+ const storageTargets = {
530
+ tokenPath: p,
531
+ orchestrationsPath: orchestrationsPathOverride ||
532
+ (p === HOME_TOKEN_PATH ? HOME_ORCHESTRATIONS_PATH : CWD_ORCHESTRATIONS_PATH),
533
+ };
534
+ try {
535
+ const orchestrationInstall = await installBundledOrchestrations({
536
+ destinationPath: storageTargets.orchestrationsPath,
537
+ overwrite: overwriteOrchestrations,
538
+ });
539
+ if (orchestrationInstall.status === "installed") {
540
+ console.log(` ${c.green}✔${c.reset} Orchestrations installed to ${c.bold}${storageTargets.orchestrationsPath}${c.reset}`);
541
+ } else if (orchestrationInstall.status === "overwritten") {
542
+ console.log(` ${c.green}✔${c.reset} Orchestrations refreshed at ${c.bold}${storageTargets.orchestrationsPath}${c.reset}`);
543
+ } else {
544
+ console.log(` ${c.yellow}!${c.reset} Orchestrations already exist ${c.dim}(use --overwrite-orchestrations to refresh)${c.reset}`);
545
+ }
546
+ } catch (err) {
547
+ console.log(` ${c.yellow}!${c.reset} Orchestrations install failed: ${toErrorMessage(err)}`);
548
+ }
549
+ }
550
+ console.log("");
551
+ console.log(` ${c.green}✔${c.reset} Using existing credentials. Run ${c.bold}cli-dev run${c.reset} to start working.`);
552
+ console.log("");
553
+ return;
554
+ }
555
+
556
+ console.log("");
557
+ break;
558
+ }
559
+
560
+ await runDeviceFlow({
561
+ apiBaseUrl,
562
+ appUrl,
563
+ scopes,
564
+ agentName,
565
+ agentModel,
566
+ tokenPathOverride,
567
+ orchestrationsPathOverride,
568
+ installOrchestrations,
569
+ overwriteOrchestrations,
570
+ });
571
+ }
572
+
482
573
  async function runDeviceFlow({
483
574
  apiBaseUrl,
484
575
  appUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentorchestrationprotocol/cli-dev",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "AOP CLI — dev environment (points to local / dev Convex deployment)",
5
5
  "type": "module",
6
6
  "bin": {