@onklave/agent-cli 0.1.43 → 0.1.45

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/main.js +33 -7
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -285,6 +285,20 @@ async function loginCommand(args) {
285
285
  process.exitCode = 1;
286
286
  return;
287
287
  }
288
+ const linkingTokenPrefixes = ["ok_link_", "ok_worker_", "ok_device_"];
289
+ if (linkingTokenPrefixes.some((prefix) => token.startsWith(prefix))) {
290
+ console.error(
291
+ "That looks like a worker/device linking token, not a login credential.\n"
292
+ );
293
+ console.error(
294
+ "Linking tokens register a machine \u2014 use: onklave register --token <token>"
295
+ );
296
+ console.error(
297
+ "To log in, generate a CLI token in the Portal under Settings > API Tokens."
298
+ );
299
+ process.exitCode = 1;
300
+ return;
301
+ }
288
302
  const metadata = {};
289
303
  if (typeof platformUrl === "string") {
290
304
  metadata.platformUrl = platformUrl;
@@ -577,10 +591,19 @@ var PlatformClient = class {
577
591
  * Create a new agent session on the platform.
578
592
  */
579
593
  async spawnSession(config) {
594
+ const body = {
595
+ task: config.task,
596
+ context: config.context,
597
+ model: config.model,
598
+ timeout: config.timeout
599
+ };
600
+ if (config.persona) body.personaName = config.persona;
601
+ if (config.workflow) body.workflowName = config.workflow;
602
+ if (config.machineId) body.machineId = config.machineId;
580
603
  return this.request(
581
604
  "POST",
582
605
  "/api/v1/agent/spawn",
583
- config
606
+ body
584
607
  );
585
608
  }
586
609
  /*
@@ -659,7 +682,7 @@ var PlatformClient = class {
659
682
  async registerMachine(linkingToken, metadata) {
660
683
  return this.request("POST", "/api/v1/runner/register", {
661
684
  linkingToken,
662
- metadata
685
+ ...metadata
663
686
  });
664
687
  }
665
688
  /*
@@ -695,10 +718,13 @@ var PlatformClient = class {
695
718
  );
696
719
  }
697
720
  /*
698
- * Unregister this machine.
721
+ * Unregister this machine. The backend exposes this as DELETE on the
722
+ * register route and identifies the machine via the `x-machine-id` header.
699
723
  */
700
- async unregisterMachine() {
701
- await this.request("POST", "/api/v1/runner/unregister");
724
+ async unregisterMachine(machineId) {
725
+ await this.request("DELETE", "/api/v1/runner/register", void 0, {
726
+ "x-machine-id": machineId
727
+ });
702
728
  }
703
729
  /*
704
730
  * Update an already-registered machine's configuration. Used by
@@ -2879,8 +2905,8 @@ async function registerCommand(args) {
2879
2905
  console.log(" onklave register --refresh # re-detect capabilities");
2880
2906
  console.log("\nTo obtain a linking token:");
2881
2907
  console.log(" 1. Log in to the Onklave Portal");
2882
- console.log(" 2. Navigate to Settings > Machines");
2883
- console.log(' 3. Click "Register Machine" to generate a linking token');
2908
+ console.log(" 2. Navigate to Worker Nodes");
2909
+ console.log(' 3. Click "Add Worker Node" to generate a linking token');
2884
2910
  process.exitCode = 1;
2885
2911
  return;
2886
2912
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onklave/agent-cli",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "Onklave Agent CLI — local agent runner with cloud orchestration",
5
5
  "bin": {
6
6
  "onklave": "./main.js"