@lumi.ai/runner 0.3.0 → 0.3.1

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/dist/cli.js +32 -23
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -532,7 +532,7 @@ function mcpUrl(config2) {
532
532
  }
533
533
 
534
534
  // src/version.ts
535
- var RUNNER_VERSION = true ? "0.3.0" : "0.0.0-dev";
535
+ var RUNNER_VERSION = true ? "0.3.1" : "0.0.0-dev";
536
536
 
537
537
  // src/auth.ts
538
538
  import { signInWithCustomToken } from "firebase/auth";
@@ -3001,6 +3001,26 @@ function report(checks) {
3001
3001
  import { spawn as spawn4 } from "node:child_process";
3002
3002
  import os5 from "node:os";
3003
3003
  import { signInWithCustomToken as signInWithCustomToken2 } from "firebase/auth";
3004
+ function buildLoginResult(approved, existing, fallbackProjectId, mcpUrl2) {
3005
+ const approvedShips = approved.approvedShips ?? Object.keys(approved.shipKeys ?? {});
3006
+ const selectedShips = approved.selectedShips ?? [];
3007
+ const config2 = {
3008
+ ...existing,
3009
+ apiKey: approved.apiKey || existing?.apiKey || "",
3010
+ projectId: approved.projectId || fallbackProjectId,
3011
+ runnerId: approved.runnerId || existing?.runnerId || "",
3012
+ shipKeys: { ...existing?.shipKeys ?? {}, ...approved.shipKeys ?? {} },
3013
+ ships: selectedShips.length > 0 ? selectedShips : existing?.ships ?? [],
3014
+ ...mcpUrl2 ? { mcpUrl: mcpUrl2 } : {}
3015
+ };
3016
+ return {
3017
+ config: config2,
3018
+ approvedShips,
3019
+ // Fall back to deriving it, so an older backend that omits the field reports accurately
3020
+ // rather than crashing or claiming nothing is pending.
3021
+ pendingShips: (approved.pendingShips ?? selectedShips.filter((id) => !approvedShips.includes(id))).filter((id) => config2.ships.includes(id))
3022
+ };
3023
+ }
3004
3024
  function openBrowser(url) {
3005
3025
  const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
3006
3026
  try {
@@ -3063,36 +3083,25 @@ Code: ${pc.bold(start.displayCode)}`,
3063
3083
  throw new CliError("The approval window expired. Run `lumi-runner login` again.");
3064
3084
  }
3065
3085
  progress.stop("Approved.");
3066
- const config2 = {
3067
- ...existingConfig,
3068
- apiKey: approved.apiKey || existingConfig?.apiKey || "",
3069
- projectId: approved.projectId || projectId,
3070
- runnerId: approved.runnerId,
3071
- // THE CREDENTIALS (PRD §8.1) — one Ship key per approved Ship, handed over on this one hop
3072
- // and nowhere else. Merged over any we already held so that approving a SECOND Ship does not
3073
- // silently revoke the first: this response only carries keys for what was just approved.
3074
- shipKeys: { ...existingConfig?.shipKeys ?? {}, ...approved.shipKeys },
3075
- // What the human PICKED on the approval page. Their choice replaces whatever this machine
3076
- // was serving — that page is where the decision is now made.
3077
- ships: approved.selectedShips.length > 0 ? approved.selectedShips : existingConfig?.ships ?? [],
3078
- ...options.mcpUrl ? { mcpUrl: options.mcpUrl } : {}
3079
- };
3086
+ const { config: config2, approvedShips, pendingShips } = buildLoginResult(
3087
+ approved,
3088
+ existingConfig,
3089
+ projectId,
3090
+ options.mcpUrl
3091
+ );
3092
+ if (!config2.runnerId) {
3093
+ throw new CliError("The approval did not name this machine. Run `lumi-runner login` again.");
3094
+ }
3080
3095
  if (!config2.apiKey) {
3081
3096
  throw new CliError(
3082
3097
  "The approval did not include a Firebase apiKey. Update the web app, or pass --api-key with --token."
3083
3098
  );
3084
3099
  }
3085
3100
  const fb = initFirebase(config2);
3086
- const first = approved.approvedShips[0];
3101
+ const first = approvedShips[0];
3087
3102
  const uid2 = first ? (await signInWithCustomToken2(fb.auth, (await exchange(config2, first)).customToken)).user.uid : "(no Ship approved yet)";
3088
3103
  saveConfig(config2);
3089
- return report2({
3090
- runnerId: config2.runnerId,
3091
- uid: uid2,
3092
- ships: config2.ships,
3093
- approvedShips: approved.approvedShips,
3094
- pendingShips: approved.pendingShips.filter((id) => config2.ships.includes(id))
3095
- });
3104
+ return report2({ runnerId: config2.runnerId, uid: uid2, ships: config2.ships, approvedShips, pendingShips });
3096
3105
  }
3097
3106
  async function exchange(config2, shipId) {
3098
3107
  return callPublicFunction(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumi.ai/runner",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Lumi Crew runner daemon — claims jobs from your Ships and executes them as headless Claude sessions on your own machine.",
6
6
  "//name": "The ONLY package in this monorepo published to the public registry, so it is the one that does not follow the internal @lumi/crew-* convention: `@lumi` is not a scope we own, `@lumi.ai` is (the npm org). The workspace DIRECTORY stays packages/crew/runner — renaming the package is not renaming the folder.",