robisie 0.2.2 → 0.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Historia zmian klienta / Client changelog
2
2
 
3
+ ## [0.3.0](https://github.com/chuppa12/robisie-app/compare/client-v0.2.2...client-v0.3.0) (2026-11-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * **client:** npx robisie login + poprawki 0.2.3 (NIE SCALAĆ przed migracją 0060) ([b384bfb](https://github.com/chuppa12/robisie-app/commit/b384bfb303bd35440bb2ee8d210ade4bd8cd9b30))
9
+ * **client:** wire login into init, doctor and launcher (E3b) ([1905ded](https://github.com/chuppa12/robisie-app/commit/1905ded276a9cc3bbf6cc3dcaab51ebe06507415))
10
+ * **login:** E3a — klient parowania kodem urządzenia (nowe pliki) ([906c6fb](https://github.com/chuppa12/robisie-app/commit/906c6fbddfcfd9df0d732338bd5643fb5653a971))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **client:** doctor i init nie chodza po przodkach katalogu stanu; smoke wydania inicjuje instalacje ([a77d7a2](https://github.com/chuppa12/robisie-app/commit/a77d7a203954d7ebf4396b621d9474546a6c90d9))
16
+ * **client:** keep uninstall without a manifest a no-op (existing contract) ([92e6cfc](https://github.com/chuppa12/robisie-app/commit/92e6cfccd80f322e8edea0937cca1c0d94620487))
17
+ * **client:** uninstall removes login files and keys; docs: retry/abandon via panel (E3b) ([0e82de2](https://github.com/chuppa12/robisie-app/commit/0e82de22fa5cec4797de97697b673b74c31dac7b))
18
+ * **receiver:** local receiver passes --reasoning-effort low (grok 1.0.13 rejects none) ([813f036](https://github.com/chuppa12/robisie-app/commit/813f03684bd75fd0deb8b7f002e8eee6407355fc))
19
+ * serialize device login with a persistent SQLite mutex ([b73aef8](https://github.com/chuppa12/robisie-app/commit/b73aef849326bb6c68ad6a981b6b12052571401a))
20
+
3
21
  ## [0.2.2](https://github.com/chuppa12/robisie-app/compare/client-v0.2.1...client-v0.2.2) (2026-11-10)
4
22
 
5
23
 
package/README.md CHANGED
@@ -6,6 +6,8 @@ Przewodniki: [PL — konto → odbiór → odinstalowanie](docs/README.md) · [E
6
6
 
7
7
  Konto i klucz są potrzebne do init i pracy ról. Osobne wejście to walidacja offline, gdy CLI jest dostępne: nie sprawdza instalacji, nie uruchamia dostawców i nie wymaga podawania UUID projektu. Osobno `npx robisie doctor --engine-config ./robisie.config.json` sprawdza offline strukturę konfiguracji i wejścia instalacji lokalnej: nie potwierdza UUID projektu, repo, modeli ani uruchomienia dostawców. Lokalne przewodniki są w `node_modules/robisie/docs/`.
8
8
 
9
+ Zamiast przepisywać klucze możesz uruchomić `npx robisie login`: polecenie wypisuje kod i link, Ty albo Twój agent zatwierdzacie parę kluczy A i B w przeglądarce zalogowanej do robisie.app, a klucze trafiają prosto do plików instalacji — w wersji dla testerów agent i właściciel na tym komputerze to jedna strefa zaufania (agent ma technicznie dostęp także do klucza B).
10
+
9
11
  ## Przed init — konto i pierwszy projekt
10
12
 
11
13
  Załóż konto i zaloguj się w https://robisie.app. Ekran „Zakładamy Twój projekt…” oznacza przygotowywanie projektu; poczekaj na „Twój projekt jest gotowy”. Ten ekran nie dowodzi dokładnie jednego projektu. Nie ma gwarantowanego czasu oczekiwania. Jeśli widzisz „To się przeciąga…”, wybierz „Sprawdź tablicę”: https://robisie.app/dashboard/plugins/planer.
package/dist/cli.d.ts CHANGED
@@ -14,6 +14,10 @@ export interface ParsedArgs {
14
14
  engineConfig: string | null;
15
15
  interval: number;
16
16
  once: boolean;
17
+ /** login: false = `--no-wait`. */
18
+ wait: boolean;
19
+ /** login: `--timeout` seconds; null = DEFAULT_LOGIN_TIMEOUT_SECONDS. */
20
+ timeout: number | null;
17
21
  }
18
22
  export declare function parseArgs(argv: readonly string[]): ParsedArgs;
19
23
  export declare function run(argv: readonly string[], ctx: Ctx): Promise<number>;
package/dist/cli.js CHANGED
@@ -6,13 +6,16 @@ import { AGENT_IDS, isAgentId } from "./agents.js";
6
6
  import { doctor, init, recoveryStep, uninstall } from "./commands.js";
7
7
  import { HELPER_SERVERS, PACKAGE_VERSION } from "./constants.js";
8
8
  import { RobisieError, errorMessage, nodeCtx } from "./context.js";
9
+ import { DEFAULT_LOGIN_TIMEOUT_SECONDS } from "./device-login.js";
9
10
  import { runFactory } from "./factory-run.js";
10
11
  import { checkInputs, inputDirectory, INPUTS_OK } from "./engine-inputs.js";
11
12
  import { isHelperServer, runHelper } from "./helpers.js";
13
+ import { closeInstallation, initNeedsLogin, login, openInstallation } from "./login.js";
12
14
  import { ROLE_IDS, ROLE_STEP } from "./manifest.js";
13
15
  import { doctorEngineConfig } from "./role-registry.js";
14
16
  const HELP = `robisie ${PACKAGE_VERSION} — łączy Twojego agenta z tablicą robisie
15
17
 
18
+ npx robisie login paruje instalację: kod i link zatwierdzasz w przeglądarce, klucze A i B trafiają prosto do plików
16
19
  npx robisie init klucze A (ROBISIE_KEY) i B (ROBISIE_REVIEW_KEY), osobne ukryte pytania + konfiguracja MCP + role klienta
17
20
  npx robisie doctor sprawdza A i B, wersję kontraktu i role; enforced: NIE SPRAWDZONO
18
21
  npx robisie uninstall usuwa wpisy robisie i role; zachowuje kopie zapasowe
@@ -42,6 +45,14 @@ Opcje init:
42
45
  --role=rola=dostawca ta sama składnia; np. --role=builder=codex zachowuje resztę mapy
43
46
  --no-shell nie dopisuj ROBISIE_KEY i ROBISIE_REVIEW_KEY do profilu powłoki
44
47
  --key-stdin weź tylko klucz A z wejścia standardowego (np. printenv KLUCZ | npx robisie init --key-stdin)
48
+ Bez kluczy, bez terminala i bez --key-stdin init najpierw uruchamia npx robisie login.
49
+
50
+ Opcje login:
51
+ --no-wait tylko wypisz kod i link (albo wznów czekające parowanie) i zakończ kodem 2
52
+ --timeout <sekundy> ile czekać na zatwierdzenie: 1–3600, domyślnie ${DEFAULT_LOGIN_TIMEOUT_SECONDS}; także --timeout=600
53
+ Kody wyjścia: 0 = zalogowano (para zapisana i potwierdzona), 2 = parowanie czeka na zatwierdzenie
54
+ (to jeszcze nie jest zalogowanie — wznów: npx robisie login), 1 = błąd z następnym krokiem.
55
+ Po zalogowaniu init, doctor i factory run biorą klucze z plików instalacji, nie ze starego ENV.
45
56
  `;
46
57
  export function parseArgs(argv) {
47
58
  const args = [...argv];
@@ -55,9 +66,11 @@ export function parseArgs(argv) {
55
66
  let interval = 120;
56
67
  let intervalSet = false;
57
68
  let once = false;
69
+ let wait = true;
70
+ let timeout = null;
58
71
  // Help wins over everything else, so `init --help` never starts an install.
59
72
  if (argv.includes("--help") || argv.includes("-h"))
60
- return { command, help: true, target, agents: null, roles, shell, keyStdin, engineConfig, interval, once };
73
+ return { command, help: true, target, agents: null, roles, shell, keyStdin, engineConfig, interval, once, wait, timeout };
61
74
  if (command === "factory") {
62
75
  target = args.shift() ?? null;
63
76
  if (target !== "run")
@@ -128,14 +141,24 @@ export function parseArgs(argv) {
128
141
  }
129
142
  else if (command === "mcp" && target === null && !arg.startsWith("-"))
130
143
  target = arg;
144
+ else if (command === "login" && arg === "--no-wait")
145
+ wait = false;
146
+ else if (command === "login" && (arg === "--timeout" || arg.startsWith("--timeout="))) {
147
+ const value = arg === "--timeout" ? args.shift() ?? "" : arg.slice("--timeout=".length);
148
+ if (timeout !== null || !/^\d+$/.test(value) || Number(value) < 1 || Number(value) > 3600) {
149
+ throw new RobisieError("Opcja --timeout wymaga jednej liczby całkowitej sekund 1–3600.", "Zobacz `npx robisie help`.");
150
+ }
151
+ timeout = Number(value);
152
+ }
131
153
  else
132
154
  throw new RobisieError("Nieznana opcja argumentów CLI.", "Zobacz `npx robisie help`.");
133
155
  }
134
156
  if (once && intervalSet)
135
157
  throw new RobisieError("Opcje --once i --interval wykluczają się.", "Zobacz `npx robisie help`.");
136
- return { command, help: false, target, agents: agents.length > 0 ? agents : null, roles, shell, keyStdin, engineConfig, interval, once };
158
+ return { command, help: false, target, agents: agents.length > 0 ? agents : null, roles, shell, keyStdin, engineConfig, interval, once, wait, timeout };
137
159
  }
138
160
  export async function run(argv, ctx) {
161
+ let release = null;
139
162
  try {
140
163
  if (Number(process.versions.node.split(".")[0]) < 24) {
141
164
  throw new RobisieError("Polecenia robisie wymagają Node.js >=24.", "Zainstaluj Node.js 24 lub nowszy i ponów polecenie.");
@@ -145,6 +168,26 @@ export async function run(argv, ctx) {
145
168
  ctx.out(HELP);
146
169
  return 0;
147
170
  }
171
+ if (args.command === "login")
172
+ return await login(ctx, { wait: args.wait, timeoutSeconds: args.timeout ?? undefined });
173
+ if (args.command === "init" && initNeedsLogin(ctx, args.keyStdin)) {
174
+ const code = await login(ctx, { wait: true });
175
+ if (code !== 0)
176
+ return code;
177
+ }
178
+ const held = args.command === "init" ? "init"
179
+ : args.command === "factory" ? "factory run"
180
+ : args.command === "doctor" && args.engineConfig === null ? "doctor" : null;
181
+ if (held) {
182
+ const opened = await openInstallation(ctx, held);
183
+ ctx = opened.ctx;
184
+ release = opened.release;
185
+ // factory run holds the lock only while it reads the pair, never while the engine runs.
186
+ if (held === "factory run" && release) {
187
+ closeInstallation(ctx, release);
188
+ release = null;
189
+ }
190
+ }
148
191
  switch (args.command) {
149
192
  case "init":
150
193
  await init(ctx, { agents: args.agents, roles: args.roles, shell: args.shell, keyStdin: args.keyStdin, ...(args.engineConfig === null ? {} : { engineConfig: args.engineConfig }) });
@@ -209,6 +252,10 @@ export async function run(argv, ctx) {
209
252
  }
210
253
  return 1;
211
254
  }
255
+ finally {
256
+ if (release)
257
+ closeInstallation(ctx, release);
258
+ }
212
259
  }
213
260
  function isEntry() {
214
261
  try {
package/dist/commands.js CHANGED
@@ -6,10 +6,11 @@ import { AGENT_IDS, AGENT_LABELS, SHELL_EXPORT, agentPaths, agentOnPath, detectA
6
6
  import { HELPER_SERVERS, KEY_ENV, KEY_PATTERN, PACKAGE_NAME, PACKAGE_VERSION } from "./constants.js";
7
7
  import { RobisieError, errorMessage } from "./context.js";
8
8
  import { assertCodexEnvironment } from "./codex-env.js";
9
+ import { loginFiles } from "./device-login.js";
9
10
  import { reportDoctorDisk } from "./disk-guard.js";
10
11
  import { applyOp, assertCodexChange, checkRecovery, preserveFileStep, capture, entryPresent, fingerprint, prepareBlock, refusePrivateSymlink, renderBlock, restore, undoEntry } from "./fsops.js";
11
12
  import { HELPER_TOOLS, probeHelper } from "./helpers.js";
12
- import { clientPaths, ensurePrivateDir, readKey, readManifest, writeKey, writeManifest, roleProviders, ROLE_IDS, ROLE_STEP } from "./manifest.js";
13
+ import { clientPaths, ensurePrivateDir, loginFields, readKey, readManifest, writeKey, writeManifest, roleProviders, ROLE_IDS, ROLE_STEP } from "./manifest.js";
13
14
  import { assertCompatible, checkConnection, fetchContractVersion } from "./mcp.js";
14
15
  import { loadRoles, MANAGED_LINE, rolesDir } from "./roles.js";
15
16
  import { checkInputs, createInputs, INPUTS_OK, preflightInputs, selectInputDirectory } from "./engine-inputs.js";
@@ -98,8 +99,10 @@ export async function init(ctx, options) {
98
99
  preflightInputs(inputs.directory, inputs.configPath);
99
100
  const paths = clientPaths(agentPaths(ctx).clientDir);
100
101
  const prior = readManifest(paths.manifest);
101
- const detected = options.agents ?? prior?.agents ?? detectAgents(ctx);
102
- const previousMap = prior ? roleProviders(prior) : roleProviders({ agents: detected });
102
+ // A manifest written only by `npx robisie login` records no agent choice yet.
103
+ const chosen = prior?.agents.length ? prior : null;
104
+ const detected = options.agents ?? chosen?.agents ?? detectAgents(ctx);
105
+ const previousMap = chosen ? roleProviders(chosen) : roleProviders({ agents: detected });
103
106
  let map = previousMap;
104
107
  if (options.roles && Object.keys(options.roles).length > 0) {
105
108
  const merged = { ...previousMap, ...options.roles };
@@ -145,7 +148,7 @@ export async function init(ctx, options) {
145
148
  const agents = [...new Set([...(prior?.agents ?? []), ...selected])];
146
149
  let changed = 0;
147
150
  // The record first, then the key and the changes: a disk that fills up cannot leave a key or a change uninstall does not know about.
148
- writeManifest(paths.dir, { agents, roleProviders: map, entries: [...done.values()] });
151
+ writeManifest(paths.dir, { ...loginFields(prior), agents, roleProviders: map, entries: [...done.values()] });
149
152
  writeKey(paths.dir, key);
150
153
  writeKey(paths.dir, reviewKey, "review-key");
151
154
  for (const { owner, op } of planned) {
@@ -156,7 +159,7 @@ export async function init(ctx, options) {
156
159
  done.set(id, { ...applied.entry, owner });
157
160
  try {
158
161
  // Recorded after every change (atomically), so even a killed init leaves uninstall a complete record.
159
- writeManifest(paths.dir, { agents, roleProviders: map, entries: [...done.values()] });
162
+ writeManifest(paths.dir, { ...loginFields(prior), agents, roleProviders: map, entries: [...done.values()] });
160
163
  }
161
164
  catch (error) {
162
165
  // The change is not on record, so uninstall could never undo it: take it back before failing.
@@ -593,6 +596,8 @@ export function uninstall(ctx) {
593
596
  for (const dir of [paths.codexRoles, paths.roles])
594
597
  if (!removeEmptyDir(dir))
595
598
  leftovers.push(dir);
599
+ for (const path of loginFiles(paths.dir))
600
+ rmSync(path, { force: true });
596
601
  // The ledger lives inside paths.dir, so only the final rmdir requires removing it first.
597
602
  try {
598
603
  rmSync(paths.manifest, { force: true });
@@ -1,6 +1,6 @@
1
1
  /** Package identity and the server contract it speaks. */
2
2
  export declare const PACKAGE_NAME = "robisie";
3
- export declare const PACKAGE_VERSION = "0.2.2";
3
+ export declare const PACKAGE_VERSION = "0.3.0";
4
4
  /**
5
5
  * MAJOR of the agent-API contract this package understands.
6
6
  * PARITY: src/lib/mcp/contract-version.ts (AGENT_API_CONTRACT_VERSION) on the server.
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /** Package identity and the server contract it speaks. */
2
2
  export const PACKAGE_NAME = "robisie";
3
- export const PACKAGE_VERSION = "0.2.2"; // x-release-please-version
3
+ export const PACKAGE_VERSION = "0.3.0"; // x-release-please-version
4
4
  /**
5
5
  * MAJOR of the agent-API contract this package understands.
6
6
  * PARITY: src/lib/mcp/contract-version.ts (AGENT_API_CONTRACT_VERSION) on the server.
@@ -0,0 +1,48 @@
1
+ import { type Ctx } from "./context.js";
2
+ export declare const DEFAULT_LOGIN_TIMEOUT_SECONDS = 540;
3
+ export interface LoginIo {
4
+ now: () => number;
5
+ sleep: (ms: number) => Promise<void>;
6
+ hostname: string;
7
+ /** Legacy injection kept for callers; PID liveness never controls the SQLite mutex. */
8
+ processAlive: (pid: number, startedAt: number) => boolean;
9
+ }
10
+ export interface NewPair {
11
+ key: string;
12
+ installationId: string;
13
+ pairId: string;
14
+ }
15
+ /**
16
+ * The other places holding A (J5: `~/.claude.json` header, manifest fields). `capture` must return
17
+ * JSON-serialisable state; `restore` must write it back exactly and throw when it cannot.
18
+ */
19
+ export interface PairCopies {
20
+ capture: () => unknown;
21
+ apply: (pair: NewPair) => void;
22
+ restore: (captured: unknown) => void;
23
+ }
24
+ export interface LoginOptions {
25
+ /** false = `--no-wait`: start (or resume) the pairing, print code and link, exit 2. */
26
+ wait: boolean;
27
+ timeoutSeconds?: number;
28
+ displayName?: string;
29
+ /** Claim only (§5.2): the server decides whether this installation exists for the approving account. */
30
+ installationHint?: string | null;
31
+ copies?: PairCopies;
32
+ io?: Partial<LoginIo>;
33
+ }
34
+ /** Owned login files for uninstall, derived from the same paths used by pairing. */
35
+ export declare function loginFiles(dir: string): string[];
36
+ /**
37
+ * A single persistent SQLite file identifies this installation's mutex. The open transaction owns it
38
+ * until close/process death; the file is never renamed or removed. JSON is only last-owner diagnostics.
39
+ */
40
+ export declare function acquireInstallationLock(dir: string, command: string, io?: Pick<LoginIo, "now" | "hostname" | "processAlive">): () => void;
41
+ /**
42
+ * Finishes (or rolls back) an interrupted pair write. Every command calls it under the installation lock
43
+ * before touching the key files; while it throws, the keys in the files must not be used.
44
+ * Returns true when a journal was found and the pair is now saved and confirmed.
45
+ */
46
+ export declare function resumePairJournal(ctx: Ctx, dir: string, copies?: PairCopies): Promise<boolean>;
47
+ /** Exit codes (F10): 0 = pair saved and confirmed, 2 = still waiting for approval, 1 = failure. */
48
+ export declare function deviceLogin(ctx: Ctx, options: LoginOptions): Promise<0 | 1 | 2>;