robisie 0.5.0 → 0.5.2

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,26 @@
1
1
  # Historia zmian klienta / Client changelog
2
2
 
3
+ ## [0.5.2](https://github.com/chuppa12/robisie-app/compare/client-v0.5.1...client-v0.5.2) (2026-11-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **maszynista:** izoluj błędy danych kart w lokalnej fabryce ([1db33c1](https://github.com/chuppa12/robisie-app/commit/1db33c10ad37dc0a3ea12bcaf118924af5f9a71a))
9
+
10
+
11
+ ### Factory Cards
12
+
13
+ * praca workera task-mwc6f088-rsu4wm (auto-commit) ([058e12e](https://github.com/chuppa12/robisie-app/commit/058e12e9a33eaf81890ee7c05fab44417e53355c))
14
+ * praca workera task-mwc7n2hm-oilr8f (auto-commit) ([4f2f04f](https://github.com/chuppa12/robisie-app/commit/4f2f04f6c691e143038a9248fe47ce43363a71ac))
15
+
16
+ ## [0.5.1](https://github.com/chuppa12/robisie-app/compare/client-v0.5.0...client-v0.5.1) (2026-11-11)
17
+
18
+
19
+ ### Factory Cards
20
+
21
+ * praca workera task-mwbvh8b1-qxbwrg (auto-commit) ([b6750e8](https://github.com/chuppa12/robisie-app/commit/b6750e840e4b3335b6c1b453b978b47392c05992))
22
+ * praca workera task-mwbw8t6k-dvfd29 (auto-commit) ([a615158](https://github.com/chuppa12/robisie-app/commit/a61515869c37ebe20ed060c1117d4a5e2b069ed7))
23
+
3
24
  ## [0.5.0](https://github.com/chuppa12/robisie-app/compare/client-v0.4.7...client-v0.5.0) (2026-11-11)
4
25
 
5
26
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ Jeśli trasa przekierowała na /dashboard bez Planera, znajdź „Zacznij od pie
21
21
  <!-- agent-consent:start -->
22
22
  ### Instrukcja dla agenta — jedna zgoda na przebieg
23
23
 
24
- Na początku poproś raz o zgodę na nazwany przebieg i jego granice: własne konto, wygenerowanie klucza, bezpieczny lokalny zapis klucza, init oraz pierwszą uzgodnioną kartę (cel, katalog, zakres zapisu i kryteria wyniku). Przykład pierwszej karty poniżej obejmuje tylko `wynik.txt`; wybierz ją z właścicielem przed prośbą o zgodę.
24
+ Na początku poproś raz o zgodę na nazwany przebieg i jego granice: własne konto, wygenerowanie klucza, bezpieczny lokalny zapis klucza, init oraz pierwszą uzgodnioną kartę (cel, katalog, zakres zapisu i kryteria wyniku). Przed prośbą o zgodę wybierz z właścicielem lokalną kartę `greet.cjs` albo ręczną `wynik.txt`; granice muszą odpowiadać wybranemu przykładowi.
25
25
 
26
26
  Jeśli właściciel już udzielił zgody na ten przebieg, nie pytaj ponownie przy tych krokach; kontynuuj w ustalonych granicach. Brak zgody, null, pusta lub niejasna odpowiedź albo zmiana zakresu wymagają pytania przed zależnym krokiem; wykonuj dalej niezależne dozwolone czynności. Odmowę uszanuj: nie wykonuj odmówionych kroków. Zgoda nie omija chronionych potwierdzeń człowieka ani dostawcy; po takim potwierdzeniu kontynuuj. Klucz pozostaje poza rozmową, kartą, argumentami i historią poleceń; gdy bezpieczny zapis lub przekazanie nie jest dostępne, człowiek używa ukrytego pytania init. Cudza otwarta sesja nie daje dostępu do jej konta. Po pracy nadal obowiązują niezależna recenzja oraz osobny końcowy odbiór wyniku przez właściciela.
27
27
  <!-- agent-consent:end -->
@@ -30,9 +30,17 @@ Trzy role instalatora używają jednego dostawcy: CEO (`ceo`), Builder (`builder
30
30
 
31
31
  Ustawienia instalatora `ceo`/`builder`/`quality` (CEO/Builder/Quality Officer) są odrębne od rejestru wykonania `roleRegistry`: `worker-client`, `lead-client`, `reviewer-client`, `tester-client`. Nazwy projektu `coordinator`/`owner`/`planner`/`advisor` to jeszcze inne ustawienie. Nie ma automatycznej konwersji między nimi; rejestr nie włącza mieszanego wykonywania ról instalatora.
32
32
 
33
- Wymagane są dwa osobne klucze: A (`ROBISIE_KEY`, worker) i B (`ROBISIE_REVIEW_KEY`, owner_validator). W https://robisie.app/dashboard/connect wygeneruj NOWY klucz B z rolą `owner_validator` i etykietą inną niż A: powtórzenie etykiety A rotuje A. Etykieta nie ogranicza klucza do projektu. B podaj poza rozmową w osobnym ukrytym pytaniu init albo przez bezpiecznie przygotowane ENV; `--key-stdin` pobiera tylko A. ENV B ma pierwszeństwo przed zapisanym `review-key` i pytaniem; otaczające spacje są błędem. Reinstalacja używa zapisanego B, jeśli ENV jest puste. Niepusty wadliwy B wymaga naprawy, bez zastępowania innym źródłem.
33
+ Przy ręcznej instalacji z Connect wymagane są dwa osobne klucze: A (`ROBISIE_KEY`, worker) i B (`ROBISIE_REVIEW_KEY`, owner_validator). W https://robisie.app/dashboard/connect wygeneruj NOWY klucz B z rolą `owner_validator` i etykietą inną niż A: powtórzenie etykiety A rotuje A. Etykieta nie ogranicza klucza do projektu. B podaj poza rozmową w osobnym ukrytym pytaniu init albo przez bezpiecznie przygotowane ENV; `--key-stdin` pobiera tylko A. ENV B ma pierwszeństwo przed zapisanym `review-key` i pytaniem; otaczające spacje są błędem. Reinstalacja używa zapisanego B, jeśli ENV jest puste. Niepusty wadliwy B wymaga naprawy, bez zastępowania innym źródłem.
34
34
 
35
- A i B są zapisywane osobno w `${XDG_CONFIG_HOME:-$HOME/.config}/robisie/key` i `review-key` (pliki 0600, katalog 0700). B nie trafia do konfiguracji agentów/modeli, manifestu, argumentów, claimów ani komunikatów. Załaduj oba ENV także przy `--no-shell`. Przed pierwszym zadaniem uruchom zwykły `npx robisie doctor`: tryb `--engine-config` nie sprawdza kluczy. Przy brakującym lub niepoprawnym A doctor diagnozuje A; sprawdzanie B zaczyna dopiero, gdy A jest obecny i ma poprawny format. Brak B, B=A, zły format i nieudany odczyt B dają exit 1. B sprawdzane jest przez `initialize` + `list_projects`, bez mutacji danych biznesowych; liczniki auth mogą wzrosnąć. Odczyt nie potwierdza roli, wspólnego konta A/B ani polityki projektu.
35
+ A i B są zapisywane osobno w `${XDG_CONFIG_HOME:-$HOME/.config}/robisie/key` i `review-key` (pliki 0600, katalog 0700). B nie trafia do konfiguracji agentów/modeli, manifestu, argumentów, claimów ani komunikatów. Przy ręcznej instalacji załaduj oba ENV także przy `--no-shell`. Przed pierwszym zadaniem uruchom zwykły `npx robisie doctor`: tryb `--engine-config` nie sprawdza kluczy. Przy brakującym lub niepoprawnym A doctor diagnozuje A; sprawdzanie B zaczyna dopiero, gdy A jest obecny i ma poprawny format. Brak B, B=A, zły format i nieudany odczyt B dają exit 1. B sprawdzane jest przez `initialize` + `list_projects`, bez mutacji danych biznesowych; liczniki auth mogą wzrosnąć. Odczyt nie potwierdza roli, wspólnego konta A/B ani polityki projektu.
36
+
37
+ <!-- credential-sources:start -->
38
+ Po `login` polecenia `init`, `doctor` i `factory run` używają A/B z plików `key` i `review-key`. Różny niepusty stary ENV jest ignorowany z ostrzeżeniem bez ujawniania wartości; brak lub uszkodzenie plików wymaga naprawy, nie fallbacku do ENV. Dotyczy to poleceń robisie, a nie osobnych sesji agentów.
39
+
40
+ Instalacja ręczna z Connect (bez login) zachowuje ENV-first: poprawny ENV ma pierwszeństwo przed zapisanym kluczem. Dla A przy pustym ENV init używa zapisanego pliku, jeśli istnieje instalacja i nie wybrano `--key-stdin`, potem ukrytego pytania lub jawnego stdin; dla B używa zapisanego pliku istniejącej instalacji, potem ukrytego pytania. Niepusty wadliwy klucz, błąd odczytu lub dowiązanie wymagają naprawy, bez zastępowania innym źródłem. Ręczny doctor wymaga obu ENV, także przy `--no-shell`.
41
+
42
+ Osobni agenci: Claude Code używa nagłówka `Authorization` zapisanego przez init w prywatnej konfiguracji; Codex używa `bearer_token_env_var = "ROBISIE_KEY"`, a OpenCode referencji `{env:ROBISIE_KEY}`. Codex/OpenCode wymagają aktualnego A w środowisku sesji także po login; wczytaj je bez wydruku według przepisu init. B nie jest kluczem konfiguracji agentów. Po zmianie kluczy ponów init dla wybranego dostawcy i rozpocznij nową sesję.
43
+ <!-- credential-sources:end -->
36
44
 
37
45
  Gdy klucz A widzi dokładnie jeden projekt, doctor odczytuje jego `reviewPolicy` przez `list_projects`: `enforced` daje „✓ Polityka enforced: TAK”, `legacy` ostrzega, że `accept_review` będzie odmawiane i wymaga ustawienia enforced przez operatora. Starszy serwer bez pola lub `null` daje „NIE SPRAWDZONO — serwer nie zwraca polityki”, błąd odczytu — „NIE SPRAWDZONO — odczyt nieudany”. Linia jest informacyjna i nie zmienia exit. Odmowa kontekstu projektu następuje przed doctor i ma własną poradę. Klient tylko odczytuje politykę, nie aktywuje enforced; zmienia ją uprawniony operator.
38
46
 
@@ -163,9 +171,9 @@ npm i robisie@latest
163
171
 
164
172
  ### Aktualizacja po init
165
173
 
166
- Aktualizuj w katalogu instalacji po prywatnej kopii opisanej w przewodnikach, z tym samym XDG_CONFIG_HOME i CODEX_HOME. `npx robisie init` odświeża zapisanych agentów i mapę ról, używając poprawnego zapisanego klucza bez ponownego wpisywania. ROBISIE_KEY ma pierwszeństwo; jawny `--key-stdin` zachowuje tor pytania/stdin i umożliwia wymianę klucza. Bez zapisanej instalacji lub przy braku/pustym kluczu init korzysta z dotychczasowego pytania. Wadliwy niepusty klucz, błąd odczytu lub dowiązanie wymagają naprawy lokalnej, bez nadpisywania.
174
+ Aktualizuj w katalogu instalacji po prywatnej kopii opisanej w przewodnikach, z tym samym XDG_CONFIG_HOME i CODEX_HOME. `npx robisie init` odświeża zapisanych agentów i mapę ról, używając poprawnego zapisanego klucza bez ponownego wpisywania. W ręcznej instalacji bez login ROBISIE_KEY ma pierwszeństwo; jawny `--key-stdin` zachowuje tor pytania/stdin i umożliwia wymianę klucza. Bez zapisanej instalacji lub przy braku/pustym kluczu init korzysta z dotychczasowego pytania. Wadliwy niepusty klucz, błąd odczytu lub dowiązanie wymagają naprawy lokalnej, bez nadpisywania.
167
175
 
168
- Doctor podaje rzeczywiste wersje starych pomocników i markerów ról oraz wersję paczki; wskazane init aktualizuje je przez zwykły zapis z kopiami. Doctor i agenci nadal wymagają ROBISIE_KEY w środowisku. Poniższy przykład usuwa wcześniejszy ROBISIE_KEY z sesji, aby init użył zapisanego pliku; po init wczytuje ENV dla doctor i agentów, bez xtrace i bez wydruku:
176
+ Doctor podaje rzeczywiste wersje starych pomocników i markerów ról oraz wersję paczki; wskazane init aktualizuje je przez zwykły zapis z kopiami. Po login doctor używa plików A/B z ostrzeżeniem przy różnym starym ENV; ręczny doctor wymaga obu ENV, a osobni agenci używają źródeł zależnych od dostawcy opisanych wyżej. Poniższy przykład usuwa wcześniejszy ROBISIE_KEY z sesji, aby init użył zapisanego pliku; po init wczytuje ENV dla doctor i agentów, bez xtrace i bez wydruku:
169
177
 
170
178
  Kopia i odtworzenie obejmują oba pliki key i review-key z prywatnymi uprawnieniami; przed init/doctor wczytaj oba odtworzone klucze. Uninstall raportuje osobno stan obu plików i usuwa je z zachowaniem dotychczasowej ochrony ewidencji oraz konfiguracji. Nie unieważnia żadnego klucza na serwerze.
171
179
 
@@ -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.5.0";
3
+ export declare const PACKAGE_VERSION = "0.5.2";
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.5.0"; // x-release-please-version
3
+ export const PACKAGE_VERSION = "0.5.2"; // 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.
@@ -1 +1 @@
1
- {"schema":1,"sha":"395c4b700b58bd361010fb1029d1c9490d752541","dirty":false}
1
+ {"schema":1,"sha":"f3184643267f2e92e8006ac6224e8d237a776d19","dirty":false}
@@ -1655,20 +1655,20 @@
1655
1655
  "staticOperations": {
1656
1656
  "beforePreflight": {
1657
1657
  "module": "maszynista/tick.ts",
1658
- "startLine": 9188,
1659
- "endLine": 9300,
1658
+ "startLine": 9310,
1659
+ "endLine": 9422,
1660
1660
  "text": "export async function main(): Promise<number> {\n const start = standaloneStartCheck({ filename: __filename, env: process.env });\n if (start.standalone && !start.ok) {\n console.error(start.message);\n process.exitCode = 78;\n return 78;\n }\n let installation: EngineContext;\n try { installation = createEngineContext(currentEngine(), {\n loadEnvironment: loadEnvFiles, preflight, baseRef: engineBaseRef, refreshBase: fetchMain,\n disk: defaultDiskPressureDependencies, workerContext: loadNorthStar,\n controlEnv: hostEnv, workerEnv: executionEnv, prepareWorktree: prepareHostWorktree, workerArtifacts: createWorkerTmpdir,\n notify: async (card, reason) => { decisionForReksio(card, reason, \"Rozstrzygnij na karcie\", \"\", \"\"); return { outcome: \"recorded\", ref: DECISIONS_REKSIO }; },\n hostOperations: hostOperationsPhase,\n activation: { confirmLoaded, finishHostActivation, readActivationState, recoverTickTimeout, runEnabledAuto },\n }, git, log); }\n catch (error) {\n if (!engineClient()) throw error;\n console.error(`HOLD kontekst klienta: ${clientTickFailure(error)}`);\n process.exitCode = 78;\n return 78;\n }\n const previousInstallation = tickInstallation;\n const hostErrorText = errorText;\n const client = engineClient();\n const result: { outcome: \"ok\" | \"retry\" | \"stop\"; reason: string; cleanup: boolean } = { outcome: \"ok\", reason: \"\", cleanup: false };\n const stopClient = (reason = clientTickFailure()): void => {\n if (client && result.outcome !== \"stop\") { result.outcome = \"stop\"; result.reason = reason; }\n };\n let code = 2;\n try { code = await q.withPlannerQueries(installation.planner, async () => {\n tickInstallation = installation;\n const errorText = client ? clientTickFailure : hostErrorText;\n const loadEnvFiles = installation.loadEnvironment;\n const preflight = () => {\n const actor = installation.preflight();\n return { uid: actor.kind === \"db\" ? actor.uid : API_ACTOR };\n };\n const { confirmLoaded, finishHostActivation, readActivationState, recoverTickTimeout, runEnabledAuto } = installation.activation;\n const smokeOnly = DRY && process.env.MASZYNISTA_SMOKE === \"1\";\n if (!DRY) {\n const acquire = (): boolean => tryCreateTickLock(LOCK);\n if (!acquire()) {\n const raw = readFileSync(LOCK, \"utf8\"), pid = Number(raw);\n if (!Number.isSafeInteger(pid) || pid <= 0) { console.log(\"tick lock bez poprawnego PID — HOLD\"); return 0; }\n try { process.kill(pid, 0); console.log(`tick już trwa (pid ${pid})`); return 0; }\n catch (error) { if ((error as NodeJS.ErrnoException).code !== \"ESRCH\") throw error; }\n if (readFileSync(LOCK, \"utf8\") === raw) unlinkSync(LOCK);\n if (!acquire()) { console.log(\"tick już trwa\"); return 0; }\n }\n }\n skippedCardEvents.clear();\n let s = parseState(null).state;\n // Internal smoke handoff: the child cannot outlive the parent's reserved budget.\n const smokeLimit = DRY ? Number(process.env.MASZYNISTA_SMOKE_TIMEOUT_MS) : NaN;\n let stateLoaded = false;\n let tickStarted: string | undefined;\n let outcome: \"ok\" | \"failed\" = \"ok\";\n let runtimeFailed = false;\n let observedLoaded = \"UNKNOWN\";\n let tickPhase = \"startup\";\n const deadlineAlarm = armTickDeadline(() => s, Number.isSafeInteger(smokeLimit) && smokeLimit > 0\n ? Math.min(TICK_LIMIT_MS, smokeLimit) : TICK_LIMIT_MS, () => ({ phase: tickPhase, observedLoaded }));\n let hostReady = false;\n let hostBoard: { uid: string; projectId: string } | undefined;\n let activationCards: CardLike[] = [];\n let activationCardsKnown = false;\n let blockedBefore = 0;\n const clientStopped = (): boolean => {\n if (client && (outcome === \"failed\" || (!DRY && s.blocked > blockedBefore))) stopClient();\n if (client && result.outcome === \"stop\") outcome = \"failed\";\n return client && result.outcome === \"stop\";\n };\n let hostPhaseStarted = false;\n const hostPhase = async (): Promise<boolean> => {\n if (smokeOnly || !hostReady || hostPhaseStarted) return false;\n hostPhaseStarted = true;\n tickPhase = \"host\";\n if (hostBoard) {\n const { uid: boardUid, projectId: boardProject } = hostBoard;\n try {\n await runEnabledAuto({ state: s, loadedSha: observedLoaded, repo: REPO, logPath: LOG, tick: s.tick, stateDir: hostStateDir(),\n now: new Date().toISOString(), activation: readActivationState(hostStateDir()), dryRun: DRY }, {\n listCards: async () => scanTasks(boardUid, boardProject, { full: true, statuses: [\"delivered\"],\n detailsKeys: ENABLED_SCAN_DETAILS_KEYS }),\n getTask: id => q.getTask(boardUid, id),\n appendDetail: async (id, patch) => { await appendBoundedDetail(boardUid, id, patch); },\n saveState: writeState,\n alarm: hostActivationAlarm,\n log,\n });\n } catch (error) { runtimeFailed = true; outcome = \"failed\"; log(`FAIL ENABLED auto: ${errorText(error)}`); }\n } else log(\"ENABLED auto: UNKNOWN — brak odczytu projektu; dowód karty czeka na dostęp do tablicy\");\n try {\n const result = await engineRunHostActivation({ repo: REPO, stateDir: hostStateDir(), cards: activationCards, cardsKnown: activationCardsKnown, tick: s.tick, dryRun: DRY }, {\n git, remainingTickMs, alarm: hostActivationAlarm, infrastructureChecks, infrastructurePullRequest, log: line => log(`host-activation: ${line}`),\n });\n log(`host-activation: code=${result.code} target=${result.target ?? \"UNKNOWN\"}${result.detail ? ` reason=${result.detail}` : \"\"}`);\n if (result.code === \"activate\" && result.target) {\n lastTick(s, \"activation\", `aktywacja ${result.target}; ogon odroczony`, outcome === \"ok\");\n return true;\n }\n } catch (error) { runtimeFailed = true; outcome = \"failed\"; log(`FAIL aktywacja: ${errorText(error)}`); }\n return false;\n };\n try {\n observedLoaded = loadedSha = readLoadedSha(REPO);\n s = readState((await engineFjConfig()).enabled);\n stateLoaded = true; blockedBefore = s.blocked;\n s.tick++; tickStarted = new Date().toISOString(); s.lastTickAt = tickStarted;\n log(`tick_started tick=${s.tick} at=${tickStarted} duration=UNKNOWN loaded=${loadedSha}`);\n loadEnvFiles();\n const { uid } = preflight();"
1661
1661
  },
1662
1662
  "finalization": {
1663
1663
  "module": "maszynista/tick.ts",
1664
- "startLine": 9589,
1665
- "endLine": 9641,
1664
+ "startLine": 9711,
1665
+ "endLine": 9763,
1666
1666
  "text": " } finally {\n // A persisted terminal FAIL is a card result; every unexpected exception above\n // remains a runtime failure, including DB errors inside card handling.\n if (!DRY && s.blocked > blockedBefore) {\n outcome = \"failed\";\n try { log(`FAIL: licznik blocked wzrósł ${blockedBefore} → ${s.blocked}; outcome=failed`); }\n catch (error) { console.error(`zapis licznika blocked: ${errorText(error)}`); }\n }\n clientStopped();\n // Early board failure still reaches the same host phase, at most once per tick.\n await hostPhase();\n tickPhase = \"finalizing\";\n try { if (!DRY) await finishHostActivation({ stateDir: hostStateDir(), outcome, tick: s.tick, runtimeFailed, observedLoaded }, { alarm: hostActivationAlarm, log }); }\n catch (error) { runtimeFailed = true; outcome = \"failed\"; log(`FAIL breaker aktywacji: ${errorText(error)}`); }\n clientStopped();\n try { if (stateLoaded) writeState(s); }\n catch (error) { runtimeFailed = true; outcome = \"failed\"; if (!client) throw error; stopClient(); result.cleanup = true; }\n finally {\n if (!DRY) {\n try { if (readFileSync(LOCK, \"utf8\") === String(process.pid)) unlinkSync(LOCK); }\n catch (error) { if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") { if (!client) throw error; stopClient(); result.cleanup = true; } }\n }\n const at = new Date().toISOString();\n const duration = tickStarted ? `${(Date.parse(at) - Date.parse(tickStarted)) / 1000}s` : \"UNKNOWN\";\n try {\n const { total, ops } = drainEgressCounters();\n const sorted = Object.entries(ops).sort(([, a], [, b]) => b.bytes - a.bytes);\n const summary = sorted.filter(([op]) => !op.includes(\":\")).slice(0, 12)\n .map(([op, counter]) => `${op}:${counter.calls}:${counter.bytes}`).join(\",\");\n const variants = sorted.filter(([op]) => op.includes(\":\")).slice(0, 6)\n .map(([op, counter]) => `${op}:${counter.calls}:${counter.bytes}`).join(\",\");\n log(`egress tick=${s.tick} total=${total} ops=${summary} variants=${variants}`);\n } catch { /* Optional metrics must never interrupt tick cleanup. */ }\n try { refreshTickReport(observedLoaded); log(`tick_finished tick=${s.tick} at=${at} outcome=${client && result.outcome === \"retry\" ? \"retry\" : outcome} duration=${duration} loaded=${loadedSha}`); }\n finally { clearTimeout(deadlineAlarm); tickDeadline = Number.POSITIVE_INFINITY; }\n }\n }\n }); } catch (error) {\n if (!client) throw error;\n stopClient(); result.cleanup = true;\n } finally {\n tickInstallation = previousInstallation;\n try { await installation.close(); }\n catch (error) {\n if (client) { stopClient(); result.cleanup = true; }\n else safeLog(`Zamknięcie instalacji nieudane: ${String(error)}`);\n }\n }\n if (client && result.outcome !== \"ok\") console.error(`Fabryka ${result.outcome === \"stop\" ? \"zatrzymana\" : \"retry\"}: ${result.reason}${result.cleanup ? \"; finalizacja niepotwierdzona — sprawdź stan i blokadę\" : \"\"}`);\n return client && result.outcome === \"stop\" ? 2 : code;\n}\n\nif (require.main === module && process.argv[2] !== \"--opencode-runner\") {"
1667
1667
  },
1668
1668
  "refreshTickReport": {
1669
1669
  "module": "maszynista/tick.ts",
1670
- "startLine": 813,
1671
- "endLine": 824,
1670
+ "startLine": 814,
1671
+ "endLine": 825,
1672
1672
  "text": "export function refreshTickReport(observedLoaded = readLoadedSha(REPO)): void {\n loadedSha = observedLoaded;\n try { mainSha = git([\"rev-parse\", engineBranchRef()]); }\n catch (error) { mainSha = \"UNKNOWN\"; log(`Nie można odczytać main SHA: ${errorText(error)}`); }\n if (DRY) return;\n try {\n const content = readFileSync(LAST_TICK, \"utf8\");\n writeFileSync(LAST_TICK, `${content.replace(/^- (?:loaded|main):.*\\n?/gm, \"\")}- loaded: ${loadedSha}\\n- main: ${mainSha}\\n`);\n } catch (error) { if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error; }\n}\n\nfunction writeAtomic(file: string, content: string): void {"
1673
1673
  },
1674
1674
  "importTime": {
@@ -1688,6 +1688,6 @@
1688
1688
  "status": 0,
1689
1689
  "signal": null,
1690
1690
  "stdout": "v24.3.0\n",
1691
- "stderr": "(node:15512) ExperimentalWarning: SQLite is an experimental feature and might change at any time\n(Use `node --trace-warnings ...` to show where the warning was created)\n"
1691
+ "stderr": "(node:15696) ExperimentalWarning: SQLite is an experimental feature and might change at any time\n(Use `node --trace-warnings ...` to show where the warning was created)\n"
1692
1692
  }
1693
1693
  }
@@ -37628,7 +37628,7 @@ var init_constants = __esm({
37628
37628
  "packages/client/src/constants.ts"() {
37629
37629
  "use strict";
37630
37630
  PACKAGE_NAME = "robisie";
37631
- PACKAGE_VERSION = "0.5.0";
37631
+ PACKAGE_VERSION = "0.5.2";
37632
37632
  SUPPORTED_CONTRACT_MAJOR = 1;
37633
37633
  DEFAULT_ORIGIN = "https://robisie.app";
37634
37634
  MCP_SERVER_NAME = "robisie";
@@ -314601,7 +314601,7 @@ __export2(tick_exports, {
314601
314601
  });
314602
314602
  module.exports = __toCommonJS(tick_exports);
314603
314603
  async function scanTasks(uid, projectId2, opts) {
314604
- const rows = await listTasks2(uid, projectId2, { ...opts, ...SCAN_OPTIONS });
314604
+ const rows = await localDataList(uid, projectId2, { ...opts, ...SCAN_OPTIONS });
314605
314605
  return rows.filter((card) => {
314606
314606
  if (!card.detailsReadError) return true;
314607
314607
  log2(card.detailsReadError);
@@ -320429,6 +320429,87 @@ async function settleLocalTester(s, uid, completion2, snapshot2) {
320429
320429
  lastTick(s, "tester-local", `${test.verdict}: ${test.reason}; ${test.ref}`, status2 === "in_review", card.id);
320430
320430
  return true;
320431
320431
  }
320432
+ function localDataReadError(error48, operation) {
320433
+ return error48 instanceof PlanerClientError && error48.code === "DETAILS_READ_ERROR" && error48.operation === operation && !error48.uncertain;
320434
+ }
320435
+ async function localDataRead(uid, id2, keys2, opts) {
320436
+ try {
320437
+ return keys2 === void 0 ? await getTask2(uid, id2) : await getTask2(uid, id2, keys2, opts);
320438
+ } catch (error48) {
320439
+ if (!localDataReadError(error48, "get_task")) throw error48;
320440
+ return null;
320441
+ }
320442
+ }
320443
+ async function localDataList(uid, projectId2, opts) {
320444
+ try {
320445
+ return await listTasks2(uid, projectId2, opts);
320446
+ } catch (error48) {
320447
+ if (!localDataReadError(error48, "list_tasks")) throw error48;
320448
+ }
320449
+ const listed = await listTasks2(uid, projectId2, { ...opts, detailsKeys: [], detailsFields: void 0, briefDigest: void 0, decisionMarkers: void 0 });
320450
+ const rows = [];
320451
+ for (const row of listed) {
320452
+ const card = await localDataRead(uid, row.id, opts.detailsKeys, opts);
320453
+ rows.push(card ? { ...row, ...card } : { ...row, detailsReadError: `Nieczytelne details karty ${row.id}` });
320454
+ }
320455
+ return rows;
320456
+ }
320457
+ function localDataCard(card) {
320458
+ const marker = asRecord3(card.details?.local_data_hold);
320459
+ if (marker.owner !== "tick-local-data-v1") return card;
320460
+ const details2 = { ...card.details }, previous = asRecord3(marker.previous);
320461
+ if (previous.exists === true) details2.local_data_hold = previous.value;
320462
+ else delete details2.local_data_hold;
320463
+ return { ...card, details: details2 };
320464
+ }
320465
+ async function localDataWrite(uid, card, details2) {
320466
+ if (card.status !== "in_review" && card.status !== "delivered") throw new Error("Obcy status diagnozy lokalnej karty");
320467
+ let failure3;
320468
+ try {
320469
+ await updateTask2(uid, card.id, { expected: { status: card.status, details: card.details }, details: details2 });
320470
+ } catch (error48) {
320471
+ failure3 = error48;
320472
+ }
320473
+ const confirmed = await getTask2(uid, card.id);
320474
+ if (!sameLocalTesterCard(confirmed, card, card.status, details2))
320475
+ throw new Error(`Nierozliczony zapis diagnozy ${card.id}; CAS/read-back: ${failure3 ? clientTickFailure(failure3) : "brak stanu docelowego"}`);
320476
+ return confirmed;
320477
+ }
320478
+ function localDataEvent(cardId, phase, reason) {
320479
+ const file3 = import_node_path52.default.join(DIR, "installation-events.jsonl");
320480
+ let bytes;
320481
+ try {
320482
+ bytes = (0, import_node_fs47.readFileSync)(file3, "utf8");
320483
+ } catch (error48) {
320484
+ if (error48.code !== "ENOENT") throw error48;
320485
+ bytes = "";
320486
+ }
320487
+ const previous = bytes.split("\n").filter(Boolean).map((line2) => asRecord3(JSON.parse(line2))).filter((event) => event.type === "local-card-data" && event.cardId === cardId && event.phase === phase).at(-1);
320488
+ if ((previous?.reason ?? null) === reason) return;
320489
+ (0, import_node_fs47.appendFileSync)(file3, JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), type: "local-card-data", cardId, phase, reason }) + "\n", { mode: 384, flush: true });
320490
+ if (reason) log2(`HOLD ${phase} ${cardId}: ${reason}`);
320491
+ }
320492
+ async function localDataHold(uid, cardId, phase, reason, card) {
320493
+ if (card && !card.detailsReadError) {
320494
+ const existing = asRecord3(card.details?.local_data_hold), owned2 = existing.owner === "tick-local-data-v1";
320495
+ const reasons = owned2 ? asRecord3(existing.reasons) : {};
320496
+ if (reasons[phase] !== reason) await localDataWrite(uid, card, { ...card.details, local_data_hold: {
320497
+ owner: "tick-local-data-v1",
320498
+ previous: owned2 ? existing.previous : {
320499
+ exists: Object.hasOwn(card.details ?? {}, "local_data_hold"),
320500
+ ...Object.hasOwn(card.details ?? {}, "local_data_hold") ? { value: card.details?.local_data_hold } : {}
320501
+ },
320502
+ reasons: { ...reasons, [phase]: reason }
320503
+ } });
320504
+ }
320505
+ localDataEvent(cardId, phase, reason);
320506
+ }
320507
+ async function localDataResume(uid, card, phase) {
320508
+ const original = localDataCard(card);
320509
+ if (original !== card) card = await localDataWrite(uid, card, original.details);
320510
+ localDataEvent(card.id, phase, null);
320511
+ return card;
320512
+ }
320432
320513
  async function localTesterPhase(s, uid, projectId2, dry, runtime, snapshot2, installation) {
320433
320514
  if (dry) {
320434
320515
  log2("Tester lokalny dry-run: bez recovery, zapisu i startu");
@@ -320451,12 +320532,17 @@ async function localTesterPhase(s, uid, projectId2, dry, runtime, snapshot2, ins
320451
320532
  }
320452
320533
  if (localTesterClaimed()) throw new Error("Osierocone dowody lokalnego testera; zachowano pliki, bez startu");
320453
320534
  if (!installation?.localTester) throw new Error("Brak kontekstu localTester");
320454
- const rows = snapshot2 ? [...snapshot2.values()] : await listTasks2(uid, projectId2, { full: true, statuses: ["in_review"], detailsKeys: LOCAL_TESTER_LIST_DETAILS_KEYS });
320535
+ const rows = snapshot2 ? [...snapshot2.values()] : await localDataList(uid, projectId2, { full: true, statuses: ["in_review"], detailsKeys: LOCAL_TESTER_LIST_DETAILS_KEYS });
320455
320536
  for (const listed of rows) {
320456
320537
  if (listed.status !== "in_review") continue;
320457
- const card = await getTask2(uid, listed.id);
320458
- if (!card || card.status !== "in_review" || card.assignee !== ASSIGNEE) continue;
320459
- if (card.detailsReadError) throw new Error(card.detailsReadError);
320538
+ let card = await localDataRead(uid, listed.id);
320539
+ if (!card || card.detailsReadError) {
320540
+ await localDataHold(uid, listed.id, "tester", "Nie mo\u017Cna odczyta\u0107 pe\u0142nej karty testera");
320541
+ continue;
320542
+ }
320543
+ const full = card;
320544
+ card = localDataCard(card);
320545
+ if (card.status !== "in_review" || card.assignee !== ASSIGNEE) continue;
320460
320546
  const d = card.details, worker = asRecord3(d?.maszynista), review = asRecord3(d?.review), test = asRecord3(d?.test);
320461
320547
  if (worker.phase !== "landed" || d?.reksio_withheld === true || holdActive(d)) continue;
320462
320548
  if (["PASS", "PASS_NEEDS_VALIDATOR", "FAIL", "PREPARATION_ERROR"].includes(String(test.verdict)) && typeof test.worker_job_id === "string" && Number.isSafeInteger(test.worker_attempt) && typeof test.review_key === "string" && typeof test.review_receipt_sha256 === "string" && test.sha === asRecord3(d?.landed).sha && test.worker_job_id === worker.jobId && test.worker_attempt === worker.attempts && test.review_key === review.jobKey && test.review_receipt_sha256 === asRecord3(review.receipt).sha256) continue;
@@ -320464,16 +320550,13 @@ async function localTesterPhase(s, uid, projectId2, dry, runtime, snapshot2, ins
320464
320550
  try {
320465
320551
  local2 = localTesterInput(installation.localTester, card);
320466
320552
  } catch (error48) {
320467
- const confirmed = await writeLocalTesterCard(uid, card, "blocked", {
320468
- maszynista: { ...worker, hold_reason: `Tester lokalny: ${clientTickFailure(error48)}` }
320469
- });
320470
- snapshot2?.set(confirmed.id, confirmed);
320471
- rememberProcessCards(s, [confirmed]);
320472
- s.blocked++;
320473
- lastTick(s, "tester-local-stop", String(asRecord3(confirmed.details?.maszynista).hold_reason), false, card.id);
320474
- return true;
320553
+ if (error48 instanceof ClientPairHold || error48 instanceof TesterSafetyError) throw error48;
320554
+ await localDataHold(uid, card.id, "tester", `Niepoprawne dane testera: ${clientTickFailure(error48)}`, full);
320555
+ continue;
320475
320556
  }
320476
320557
  if (!processSlot(s)) return false;
320558
+ card = await localDataResume(uid, full, "tester");
320559
+ snapshot2?.set(card.id, card);
320477
320560
  return await startTesterJob(
320478
320561
  DIR,
320479
320562
  { card, runtime, local: local2 },
@@ -320540,29 +320623,55 @@ async function localReceiverPhase(s, uid, projectId2, dry, snapshot2, installati
320540
320623
  if (localReceiverClaimed()) throw new Error("Osierocone dowody receivera; zachowano pliki, bez startu");
320541
320624
  if (localTesterClaimed()) return false;
320542
320625
  if (!installation?.localReceiver) throw new Error("Brak kontekstu localReceiver");
320543
- const rows = snapshot2 ? [...snapshot2.values()] : await listTasks2(uid, projectId2, { full: true, statuses: ["in_review"], detailsKeys: LOCAL_TESTER_LIST_DETAILS_KEYS });
320626
+ const rows = snapshot2 ? [...snapshot2.values()] : await localDataList(uid, projectId2, { full: true, statuses: ["in_review"], detailsKeys: LOCAL_TESTER_LIST_DETAILS_KEYS });
320544
320627
  for (const listed of rows) {
320545
320628
  if (listed.status !== "in_review") continue;
320546
- const card = await getTask2(uid, listed.id);
320547
- if (!card || card.status !== "in_review" || card.assignee !== ASSIGNEE) continue;
320548
- if (card.detailsReadError) throw new Error(card.detailsReadError);
320629
+ let card = await localDataRead(uid, listed.id);
320630
+ if (!card || card.detailsReadError) {
320631
+ await localDataHold(uid, listed.id, "receiver", "Nie mo\u017Cna odczyta\u0107 pe\u0142nej karty receivera");
320632
+ continue;
320633
+ }
320634
+ const full = card;
320635
+ card = localDataCard(card);
320636
+ if (card.status !== "in_review" || card.assignee !== ASSIGNEE) continue;
320549
320637
  const d = card.details, worker = asRecord3(d?.maszynista), test = asRecord3(d?.test), previous = asRecord3(d?.local_receiver), review = asRecord3(d?.review);
320550
320638
  if (worker.phase !== "landed" || d?.reksio_withheld === true || holdActive(d) || !["PASS", "PASS_NEEDS_VALIDATOR"].includes(String(test.verdict))) continue;
320551
320639
  if (typeof test.worker_job_id !== "string" || !Number.isSafeInteger(test.worker_attempt) || typeof test.review_key !== "string" || typeof test.review_receipt_sha256 !== "string" || test.sha !== asRecord3(d?.landed).sha || test.worker_job_id !== worker.jobId || test.worker_attempt !== worker.attempts || test.review_key !== review.jobKey || test.review_receipt_sha256 !== asRecord3(review.receipt).sha256) continue;
320552
- if (previous.outcome === "PASS") {
320553
- const ref = previous.ref;
320554
- if (typeof ref !== "string" || import_node_path52.default.dirname(ref) !== dir || !/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}\.json$/.test(import_node_path52.default.basename(ref)))
320555
- throw new Error("Obce archiwum rozliczonego receivera");
320556
- const settled = JSON.parse((0, import_node_fs47.readFileSync)(ref, "utf8"));
320557
- if (settled.outcome !== "PASS" || !(0, import_node_util12.isDeepStrictEqual)(settled.patch.local_receiver, previous)) throw new Error("Zmienione archiwum rozliczonego receivera");
320558
- if (sameLocalTesterCard(card, settled.input.card, "in_review", { ...settled.input.card.details, ...settled.patch })) {
320559
- receiver.localReceiverPatch(settled, card);
320560
- continue;
320640
+ let settledPass = false;
320641
+ let unchangedWait = false;
320642
+ let input;
320643
+ try {
320644
+ if (previous.outcome === "PASS") {
320645
+ const ref = previous.ref;
320646
+ if (typeof ref !== "string" || import_node_path52.default.dirname(ref) !== dir || !/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}\.json$/.test(import_node_path52.default.basename(ref)))
320647
+ throw new Error("Obce archiwum rozliczonego receivera");
320648
+ const settled = JSON.parse((0, import_node_fs47.readFileSync)(ref, "utf8"));
320649
+ if (settled.outcome !== "PASS" || !(0, import_node_util12.isDeepStrictEqual)(settled.patch.local_receiver, previous)) throw new Error("Zmienione archiwum rozliczonego receivera");
320650
+ if (sameLocalTesterCard(card, settled.input.card, "in_review", { ...settled.input.card.details, ...settled.patch })) {
320651
+ receiver.localReceiverPatch(settled, card);
320652
+ settledPass = true;
320653
+ }
320654
+ }
320655
+ if (!settledPass) unchangedWait = receiver.localReceiverWaitUnchanged(installation.localReceiver, card);
320656
+ if (!settledPass && !unchangedWait) {
320657
+ localTesterInput(installation.localReceiver.tester, card);
320658
+ input = receiver.localReceiverInput(installation.localReceiver, card);
320659
+ if ("reason" in input) throw new Error("Niepoprawne wymagane dowody receivera");
320561
320660
  }
320661
+ } catch (error48) {
320662
+ if (error48 instanceof ClientPairHold || error48 instanceof TesterSafetyError) throw error48;
320663
+ await localDataHold(uid, card.id, "receiver", "Nie mo\u017Cna odczyta\u0107 lub zweryfikowa\u0107 dowod\xF3w receivera", full);
320664
+ continue;
320665
+ }
320666
+ if (settledPass) continue;
320667
+ if (unchangedWait) {
320668
+ card = await localDataResume(uid, full, "receiver");
320669
+ snapshot2?.set(card.id, card);
320670
+ continue;
320562
320671
  }
320563
- if (receiver.localReceiverWaitUnchanged(installation.localReceiver, card)) continue;
320564
- const input = receiver.localReceiverInput(installation.localReceiver, card);
320565
320672
  if (!processSlot(s)) return false;
320673
+ card = await localDataResume(uid, full, "receiver");
320674
+ snapshot2?.set(card.id, card);
320566
320675
  return await receiver.startLocalReceiverJob(dir, input);
320567
320676
  }
320568
320677
  return false;
@@ -320578,33 +320687,42 @@ async function localAcceptancePhase(s, uid, dry, snapshot2, installation) {
320578
320687
  const { acceptLocalDelivery: acceptLocalDelivery2 } = (init_local_acceptance(), __toCommonJS(local_acceptance_exports));
320579
320688
  for (const listed of snapshot2?.values() ?? []) {
320580
320689
  if (!["in_review", "delivered"].includes(String(listed.status))) continue;
320581
- const card = await getTask2(uid, listed.id);
320582
- if (!card || card.detailsReadError) throw new Error("Brak pe\u0142nej karty odbioru lokalnego");
320690
+ if (!installation?.localAcceptance) throw new Error("Brak kontekstu localAcceptance");
320691
+ let card = await localDataRead(uid, listed.id);
320692
+ if (!card || card.detailsReadError) {
320693
+ await localDataHold(uid, listed.id, "acceptance", "Brak pe\u0142nej karty odbioru lokalnego");
320694
+ continue;
320695
+ }
320696
+ const full = card;
320697
+ card = localDataCard(card);
320583
320698
  if (!["in_review", "delivered"].includes(String(card.status))) continue;
320584
320699
  const receiver = asRecord3(card.details?.local_receiver);
320585
320700
  if (receiver.outcome !== "PASS") continue;
320701
+ const api = await installation.localAcceptance();
320586
320702
  const ref = receiver.ref;
320587
- if (typeof ref !== "string" || import_node_path52.default.dirname(ref) !== dir || !/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}\.json$/.test(import_node_path52.default.basename(ref)))
320588
- throw new Error("Obce archiwum odbioru lokalnego");
320589
320703
  let completion2;
320590
320704
  try {
320705
+ if (typeof ref !== "string" || import_node_path52.default.dirname(ref) !== dir || !/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}\.json$/.test(import_node_path52.default.basename(ref)))
320706
+ throw new Error("Obce archiwum odbioru lokalnego");
320591
320707
  completion2 = JSON.parse((0, import_node_fs47.readFileSync)(ref, "utf8"));
320592
- } catch (cause) {
320593
- throw new Error("Nie mo\u017Cna odczyta\u0107 archiwum odbioru lokalnego", { cause });
320708
+ if (!completion2 || completion2.archive !== ref || completion2.input?.card?.id !== card.id || completion2.outcome !== "PASS" || !(0, import_node_util12.isDeepStrictEqual)(completion2.patch?.local_receiver, receiver))
320709
+ throw new Error("Niezgodne archiwum odbioru lokalnego");
320710
+ } catch {
320711
+ await localDataHold(uid, card.id, "acceptance", "Nie mo\u017Cna odczyta\u0107 lub zweryfikowa\u0107 archiwum odbioru lokalnego", full);
320712
+ continue;
320594
320713
  }
320595
- if (!installation?.localAcceptance) throw new Error("Brak kontekstu localAcceptance");
320714
+ card = await localDataResume(uid, full, "acceptance");
320715
+ snapshot2?.set(card.id, card);
320596
320716
  if ((0, import_node_fs47.existsSync)(`${ref}.acceptance.json`) && (0, import_node_fs47.existsSync)(`${ref}.acceptance-stop.json`) && card.status === "in_review") continue;
320597
320717
  try {
320598
- const confirmed = await acceptLocalDelivery2(await installation.localAcceptance(), card.id, completion2);
320718
+ const confirmed = await acceptLocalDelivery2(api, card.id, completion2);
320599
320719
  snapshot2?.set(card.id, confirmed);
320600
320720
  rememberProcessCards(s, [confirmed]);
320601
320721
  s.done_auto++;
320602
320722
  lastTick(s, "acceptance-local", "Chroniony odbi\xF3r lokalny \u2192 done", true, card.id);
320603
320723
  } catch (error48) {
320604
- if (!(error48 instanceof Error) || !error48.message.startsWith("STOP odbioru lokalnego:")) throw error48;
320605
- const reason = error48.message;
320606
- (0, import_node_fs47.appendFileSync)(import_node_path52.default.join(DIR, "installation-events.jsonl"), JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), cardId: card.id, reason }) + "\n", { mode: 384, flush: true });
320607
- log2(`HOLD odbioru lokalnego ${card.id}: ${reason}`);
320724
+ if (!(error48 instanceof Error) || !error48.message.startsWith("STOP odbioru lokalnego:") || error48.message.includes("nie uda\u0142o si\u0119 utrwali\u0107 diagnozy")) throw error48;
320725
+ localDataEvent(card.id, "acceptance-protocol", error48.message);
320608
320726
  }
320609
320727
  }
320610
320728
  }
@@ -323571,14 +323689,9 @@ function rememberProcessCards(s, cards) {
323571
323689
  function processWip(s, cards = /* @__PURE__ */ new Map()) {
323572
323690
  rememberProcessCards(s, cards.values());
323573
323691
  const known = processCards.get(s);
323692
+ const unreadableWorkerStatuses = /* @__PURE__ */ new Set(["in_progress", "in_review"]);
323574
323693
  const jobs2 = /* @__PURE__ */ new Set();
323575
323694
  let unknown4 = 0;
323576
- if ([...known.values()].some((card) => card.detailsReadError && card.assignee === ASSIGNEE && ["in_progress", "in_review"].includes(String(card.status)))) {
323577
- for (let index2 = 0; index2 < configuredWip(process.env.MASZYNISTA_WIP); index2++) {
323578
- jobs2.add(`unknown-worker-details:${index2}`);
323579
- unknown4++;
323580
- }
323581
- }
323582
323695
  for (const card of known.values()) if (asRecord3(card.details?.maszynista).processStart != null) {
323583
323696
  const start = asRecord3(asRecord3(card.details?.maszynista).processStart);
323584
323697
  const at3 = typeof start.at === "string" ? Date.parse(start.at) : NaN;
@@ -323643,14 +323756,15 @@ function processWip(s, cards = /* @__PURE__ */ new Map()) {
323643
323756
  for (let index2 = 0; index2 < configuredWip(process.env.MASZYNISTA_WIP); index2++) jobs2.add(`unknown-review:${index2}`);
323644
323757
  unknown4 += configuredWip(process.env.MASZYNISTA_WIP);
323645
323758
  }
323646
- try {
323647
- if (engineClient() ? localTesterClaimed() : readTesterJob(DIR).kind === "running") jobs2.add("tester");
323648
- } catch (error48) {
323649
- jobs2.add("tester");
323650
- unknown4++;
323651
- log2(`WIP tester UNKNOWN: ${errorText5(error48)}`);
323652
- }
323653
323759
  if (engineClient()) {
323760
+ unreadableWorkerStatuses.delete("in_review");
323761
+ try {
323762
+ if (localTesterClaimed()) jobs2.add("tester");
323763
+ } catch (error48) {
323764
+ jobs2.add("tester");
323765
+ unknown4++;
323766
+ log2(`WIP tester UNKNOWN: ${errorText5(error48)}`);
323767
+ }
323654
323768
  try {
323655
323769
  if (localReceiverClaimed()) jobs2.add("receiver");
323656
323770
  } catch (error48) {
@@ -323658,6 +323772,20 @@ function processWip(s, cards = /* @__PURE__ */ new Map()) {
323658
323772
  unknown4++;
323659
323773
  log2(`WIP receiver UNKNOWN: ${errorText5(error48)}`);
323660
323774
  }
323775
+ } else {
323776
+ try {
323777
+ if (readTesterJob(DIR).kind === "running") jobs2.add("tester");
323778
+ } catch (error48) {
323779
+ jobs2.add("tester");
323780
+ unknown4++;
323781
+ log2(`WIP tester UNKNOWN: ${errorText5(error48)}`);
323782
+ }
323783
+ }
323784
+ if ([...known.values()].some((card) => card.detailsReadError && card.assignee === ASSIGNEE && ["in_progress", "in_review"].includes(String(card.status)) && (unreadableWorkerStatuses.has(String(card.status)) || s.actives.some((active) => active.taskId === card.id)))) {
323785
+ for (let index2 = 0; index2 < configuredWip(process.env.MASZYNISTA_WIP); index2++) {
323786
+ jobs2.add(`unknown-worker-details:${index2}`);
323787
+ unknown4++;
323788
+ }
323661
323789
  }
323662
323790
  for (const identity of uncertainStarts.get(s) ?? []) if (!jobs2.has(identity)) {
323663
323791
  jobs2.add(identity);
@@ -324022,7 +324150,13 @@ function tryCreateTickLock(lock) {
324022
324150
  }
324023
324151
  }
324024
324152
  async function localCardStopped(uid, id2) {
324025
- const card = await getTask2(uid, id2);
324153
+ let card;
324154
+ try {
324155
+ card = await getTask2(uid, id2);
324156
+ } catch (error48) {
324157
+ if (!localDataReadError(error48, "get_task")) throw error48;
324158
+ return false;
324159
+ }
324026
324160
  if (!card || card.detailsReadError) throw new Error("Nie mo\u017Cna rozstrzygn\u0105\u0107 stanu aktywnej karty");
324027
324161
  const worker = asRecord3(card.details?.maszynista);
324028
324162
  return card.status === "blocked" || worker.outcome === "ACTIONABLE_BLOCKER";
@@ -324242,7 +324376,7 @@ async function main2() {
324242
324376
  tickPhase = "board";
324243
324377
  const projectId2 = await resolveProject(uid);
324244
324378
  hostBoard = { uid, projectId: projectId2 };
324245
- const boardCards2 = await listTasks2(uid, projectId2, {
324379
+ const boardCards2 = await localDataList(uid, projectId2, {
324246
324380
  full: true,
324247
324381
  statuses: ["in_progress", "in_review"],
324248
324382
  detailsKeys: RECOVERY_DETAILS_KEYS,
@@ -324707,6 +324841,7 @@ var init_tick = __esm({
324707
324841
  import_node_crypto31 = require("node:crypto");
324708
324842
  import_node_path52 = __toESM(require("node:path"));
324709
324843
  init_q_planner();
324844
+ init_planer_client();
324710
324845
  init_engine_context();
324711
324846
  init_local_delivery();
324712
324847
  init_engine_consumer();
package/dist/roles.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface Role {
17
17
  export declare function rolesDir(): string;
18
18
  export declare function parseRole(file: Role["file"], text: string): Role;
19
19
  export declare function loadRoles(dir?: string): Role[];
20
- export declare const MANAGED_LINE = "<!-- robisie:managed 0.5.0 \u2014 plik zarz\u0105dzany przez `npx robisie`; `npx robisie uninstall` go usunie -->";
20
+ export declare const MANAGED_LINE = "<!-- robisie:managed 0.5.2 \u2014 plik zarz\u0105dzany przez `npx robisie`; `npx robisie uninstall` go usunie -->";
21
21
  export type AgentFlavor = "claude" | "codex" | "opencode";
22
22
  /** How the operator starts the Builder for one card in its own session (the card id is not a secret). */
23
23
  export declare function builderStartCommand(flavor: AgentFlavor, codexRolePath?: string): string;
package/docs/README.en.md CHANGED
@@ -1,4 +1,4 @@
1
- # robisie — from account to accepted card (package 0.5.0) <!-- x-release-please-version -->
1
+ # robisie — from account to accepted card (package 0.5.2) <!-- x-release-please-version -->
2
2
 
3
3
  In the project directory with its engine configuration, run `npx robisie init`, then `npx robisie doctor`: init prepares the project goal and tester protection list, and doctor checks both inputs.
4
4
 
@@ -38,7 +38,7 @@ Project lookup is the authenticated read of active projects through `list_projec
38
38
  <!-- agent-consent:start -->
39
39
  ### Agent instructions — one authorization for the flow
40
40
 
41
- At the start, ask once for authorization for a named flow and its boundaries: your own account, permission to generate a key, secure local storage of the key, init and the first agreed card (goal, directory, write scope and result criteria). The first-card example below covers only `wynik.txt`; agree on it with the owner before asking for authorization.
41
+ At the start, ask once for authorization for a named flow and its boundaries: your own account, permission to generate a key, secure local storage of the key, init and the first agreed card (goal, directory, write scope and result criteria). Before asking for authorization, agree with the owner on the local `greet.cjs` card or the manual `wynik.txt` card; the boundaries must match the chosen example.
42
42
 
43
43
  If the owner has already authorized this flow, do not ask again at those steps; continue within the agreed boundaries. A missing authorization, null, empty or unclear answer or scope change requires a question before the dependent step; continue independent authorized work. Respect a refusal: do not perform the refused steps. Authorization does not bypass protected human or provider confirmations; continue after confirmation. Keep the key out of chat, cards, arguments and command history; if secure storage or transfer is unavailable, the human uses init's hidden prompt. Someone else's open session gives no access to their account. Independent review and separate final acceptance of the result by the owner are still required.
44
44
  <!-- agent-consent:end -->
@@ -49,9 +49,9 @@ At https://robisie.app/dashboard/connect the human selects `worker` and a recogn
49
49
 
50
50
  The package stores **one worker key for CEO, Builder and Quality Officer** as `ROBISIE_KEY`. Role names do not change permissions. Do not use full to bypass acceptance of `done`: the owner accepts in the dashboard without broadening the agent's key.
51
51
 
52
- Two distinct keys are required: A (`ROBISIE_KEY`, worker) and B (`ROBISIE_REVIEW_KEY`, owner_validator). At https://robisie.app/dashboard/connect generate a NEW B key, select `owner_validator` and use a label different from A: reusing A's label rotates A. A label does not restrict a key to one project. Supply B outside chat through init's separate hidden prompt or securely prepared ENV; `--key-stdin` reads only A. B ENV takes priority over the saved `review-key` and the prompt; surrounding spaces are invalid. Reinstall reuses saved B when ENV is empty. A nonempty invalid B must be repaired, without falling back to another source.
52
+ For manual installation from Connect, two distinct keys are required: A (`ROBISIE_KEY`, worker) and B (`ROBISIE_REVIEW_KEY`, owner_validator). At https://robisie.app/dashboard/connect generate a NEW B key, select `owner_validator` and use a label different from A: reusing A's label rotates A. A label does not restrict a key to one project. Supply B outside chat through init's separate hidden prompt or securely prepared ENV; `--key-stdin` reads only A. B ENV takes priority over the saved `review-key` and the prompt; surrounding spaces are invalid. Reinstall reuses saved B when ENV is empty. A nonempty invalid B must be repaired, without falling back to another source.
53
53
 
54
- A and B are stored separately in `${XDG_CONFIG_HOME:-$HOME/.config}/robisie/key` and `review-key` (0600 files, 0700 directory). B never enters agent/model configuration, the manifest, arguments, claims or output. Load both environment variables, including with `--no-shell`. Run ordinary `npx robisie doctor` before the first task: `--engine-config` does not check keys. If A is missing or malformed, doctor diagnoses A; B checks begin only when A is present and has a valid format. Missing B, B=A, invalid format or failed B reads produce exit 1. B uses only `initialize` + `list_projects`, with no business-data mutations; auth counters may increase. Successful reads do not confirm role, a shared A/B account or project policy.
54
+ A and B are stored separately in `${XDG_CONFIG_HOME:-$HOME/.config}/robisie/key` and `review-key` (0600 files, 0700 directory). B never enters agent/model configuration, the manifest, arguments, claims or output. For manual installation load both environment variables, including with `--no-shell`. Run ordinary `npx robisie doctor` before the first task: `--engine-config` does not check keys. If A is missing or malformed, doctor diagnoses A; B checks begin only when A is present and has a valid format. Missing B, B=A, invalid format or failed B reads produce exit 1. B uses only `initialize` + `list_projects`, with no business-data mutations; auth counters may increase. Successful reads do not confirm role, a shared A/B account or project policy.
55
55
 
56
56
  When key A sees exactly one project, doctor reads `reviewPolicy` via `list_projects`: `enforced` prints “✓ Polityka enforced: TAK”; `legacy` warns that `accept_review` will be refused and directs you to the operator. A missing/null server field prints “NIE SPRAWDZONO — serwer nie zwraca polityki”; a read failure prints “NIE SPRAWDZONO — odczyt nieudany”. This informational line does not change the exit code. Project-context refusal happens before doctor and has separate advice. The client only reads the policy; an authorized operator changes it.
57
57
 
@@ -67,6 +67,14 @@ After sign-in, init, doctor and `npx robisie factory run` take A and B from the
67
67
 
68
68
  The tester release is a single trust zone: on this computer the agent executing tasks technically also has access to the acceptance key (B). Run only agents you trust as yourself on it.
69
69
 
70
+ <!-- credential-sources:start -->
71
+ After `login`, `init`, `doctor` and `factory run` use A/B from the `key` and `review-key` files. A different nonempty stale ENV value is ignored with a warning without exposing its value; missing or damaged files need repair, not ENV fallback. This applies to robisie commands, not separate agent sessions.
72
+
73
+ Manual installation from Connect (without login) keeps ENV-first: valid ENV takes priority over saved keys. With empty A ENV, init uses the saved file for an existing installation unless `--key-stdin` was selected, then the hidden prompt or explicit stdin; for B it uses the existing installation's saved file, then the hidden prompt. A nonempty invalid key, read error or symlink needs repair without switching sources. Manual doctor requires both environment variables, including with `--no-shell`.
74
+
75
+ Separate agents: Claude Code uses the `Authorization` header saved by init in private configuration; Codex uses `bearer_token_env_var = "ROBISIE_KEY"`, and OpenCode uses `{env:ROBISIE_KEY}`. Codex/OpenCode need current A in the session environment even after login; load it without printing using the init recipe. B is not an agent configuration key. After changing keys, repeat init for the selected provider and start a new session.
76
+ <!-- credential-sources:end -->
77
+
70
78
  <!-- sekcja: instalacja -->
71
79
  <a id="instalacja"></a>
72
80
  ## Install from npm
@@ -161,7 +169,7 @@ For Codex or OpenCode replace `claude` with `codex` or `opencode`. With existing
161
169
 
162
170
  The human chooses one shared provider for all three roles. The commands below set a complete map for both a new install and an existing map. `--agent` alone does not clear a map. Without `--agent`, the installer includes all detected providers; several without assignments produce a null map.
163
171
 
164
- In zsh/bash remove stale ENV before init; it takes priority over the prompt and stdin:
172
+ For manual installation without login, in zsh/bash remove stale ENV before init; it takes priority over the prompt and stdin:
165
173
 
166
174
  ```sh
167
175
  unset ROBISIE_KEY
@@ -237,6 +245,73 @@ Doctor runs the helper file via node, the agent via npx. `ROBISIE_PROJECT_CONTEX
237
245
 
238
246
  ### Card for the local engine
239
247
 
248
+ After the npm installation above, prepare the repo in that same previously empty directory with this block. `Robisie Demo <demo@example.invalid>` is an explicit identity local to this exercise; use your own for a real project. Writes use `wx`: if a file exists or a write fails, preserve data, resolve the cause and stop subsequent steps. `.gitignore` excludes the local npm installation, configuration and usage input from this small repo; its product is `greet.cjs`.
249
+
250
+ <!-- local-repo-setup:start -->
251
+ ```sh
252
+ git init --initial-branch=main &&
253
+ git config --local user.name "Robisie Demo" &&
254
+ git config --local user.email "demo@example.invalid" &&
255
+ node <<'NODE' &&
256
+ try {
257
+ require("node:fs").writeFileSync("greet.cjs", String.raw`try {
258
+ const greeting = "Witaj";
259
+ const recipient = process.argv[2];
260
+ if (recipient === undefined) console.log(greeting);
261
+ else {
262
+ if (process.argv.length !== 3 || !["Ala", "Bartek", "Celina"].includes(recipient)) throw new Error("Nieznany odbiorca");
263
+ const message = greeting + ", " + recipient + "!\n";
264
+ require("node:fs").writeFileSync("greeting.txt", message, { flag: "wx" });
265
+ process.stdout.write(message);
266
+ }
267
+ } catch (error) { console.error(error); process.exitCode = 1; }
268
+ `, { flag: "wx" });
269
+ require("node:fs").writeFileSync(".gitignore", "node_modules/\npackage.json\npackage-lock.json\nrobisie.config.json\nusage.json\ngreeting.txt\n", { flag: "wx" });
270
+ } catch (error) { console.error(error); process.exitCode = 1; }
271
+ NODE
272
+ git add greet.cjs .gitignore &&
273
+ git commit -m "Przygotuj lokalne powitanie"
274
+ ```
275
+ <!-- local-repo-setup:end -->
276
+
277
+ Save the entire JSON below as `robisie.config.json` in the repo directory, without overwriting existing configuration. **Replace** fictitious `project` with the UUID from authenticated `list_projects`, and the `tracks` UUID and name with a real track from that project’s board. Replace `engine.repo` with the absolute current repo path and `stateDir` with a separate directory **outside the repo**. Complete all four `roleRegistry` entries. In the local flow, `worker-client` must use `provider: codex`, and `reviewer-client` must use `provider: grok`, `model: grok-cli`, `effort: none`. Another pair will stop at `HOLD clientPair`, even if it passes configuration validation. For Codex roles, choose a real model available on your account and supported effort; this example uses `gpt-6.1-sol` / `high`, not fixture models. The installed Grok CLI selects the reviewer model; keep `grok-cli` / `none`. The local flow needs available, signed-in `codex` and `grok` programs; the installer provider’s program alone is insufficient. Parsing and offline doctor do not prove model/provider availability. This execution registry is separate from the installer’s CEO/Builder/Quality Officer map.
278
+
279
+ <!-- local-engine-config:start -->
280
+ ```json
281
+ {
282
+ "project": "11111111-1111-4111-8111-111111111111",
283
+ "tracks": [{"id": "22222222-2222-4222-8222-222222222222", "name": "Zmiany"}],
284
+ "stateDir": "/sciezka/do/stanu",
285
+ "engine": {
286
+ "mode": "client", "delivery": "local",
287
+ "repo": "/sciezka/do/repo", "branch": "main", "requiredChecks": [],
288
+ "commands": {
289
+ "test": ["node", "greet.cjs"],
290
+ "lint": ["node", "--check", "greet.cjs"],
291
+ "build": ["node", "--check", "greet.cjs"]
292
+ }
293
+ },
294
+ "roleRegistry": {
295
+ "worker-client": {"name": "Worker", "provider": "codex", "model": "gpt-6.1-sol", "effort": "high"},
296
+ "lead-client": {"name": "Lead", "provider": "codex", "model": "gpt-6.1-sol", "effort": "high"},
297
+ "reviewer-client": {"name": "Reviewer", "provider": "grok", "model": "grok-cli", "effort": "none"},
298
+ "tester-client": {"name": "Tester", "provider": "codex", "model": "gpt-6.1-sol", "effort": "high"}
299
+ }
300
+ }
301
+ ```
302
+ <!-- local-engine-config:end -->
303
+
304
+ After replacing and saving configuration, prepare local engine inputs; init creates the project goal and tester safety list in `stateDir/inputs`. Continue only after ordinary doctor exits 0; offline validation alone does not check account or executor readiness.
305
+
306
+ ```sh
307
+ npx robisie init &&
308
+ npx robisie doctor
309
+ ```
310
+
311
+ Start the CEO in this directory: `claude --agent ceo-client`, or `codex` with the robisie CEO role and the full file referenced by AGENTS.md, or `opencode` selecting `ceo-client`. Give it this request:
312
+
313
+ > CEO, create a local card to change greet.cjs using the goal and literal details object below. Use the real project from list_projects and its board track. Change only greet.cjs, without dependencies, accounts or publication. Use my existing authorization if it covers this goal, directory, scope and acceptance; otherwise ask before dependent work. Supply actual authoring providers and a future deadline, then prepare the card as ready. After execution I need an independent tester and ACK, three uses for Ala/Bartek/Celina, and separate final acceptance.
314
+
240
315
  Choose a project with policy `enforced` and `engine.delivery: "local"` using the [engine configuration](ENGINE-CONFIG.md). The CEO creates a card through the board tools with the literal `details` object below; the dashboard cannot edit `details`. Goal: change the greeting in an existing tracked `greet.cjs`; without arguments print `Witaj z fabryki`, and with one argument Ala, Bartek or Celina create a new `greeting.txt` containing `Witaj z fabryki, <name>!` and a trailing newline. No dependencies, accounts or publication. The code write scope is only `greet.cjs`; `greeting.txt` is a usage artifact in a separate worktree.
241
316
 
242
317
  <!-- local-card-details:start -->
@@ -255,7 +330,7 @@ Choose a project with policy `enforced` and `engine.delivery: "local"` using the
255
330
 
256
331
  Before creating the card, replace the example `deadline` with a future ISO 8601 timestamp including a timezone and enough time for execution, the tester and three uses. In `seed_provenance.authoring_providers`, record the actual providers of the seed author (`by`), proposal author (`proposal_by`) and package author (`packager_by`); copying example providers does not establish independence. The engine supplies transport, delivery and tester results; do not manufacture these records.
257
332
 
258
- After authorization, the CEO prepares the card as `ready`. Run `npx robisie factory run --engine-config ./robisie.config.json --once` and observe the card until a real tester PASS on the landed SHA and settlement (ACK): no `.tester-job.lock`, `.tester-job.input.json` or `.tester-job.result.json` in `stateDir`. PASS without ACK is insufficient.
333
+ After authorization, the CEO prepares the card as `ready`. Run `npx robisie factory run --engine-config ./robisie.config.json --once` and observe the card until a real tester PASS on the landed SHA and settlement (ACK): no `.tester-job.lock`, `.tester-job.input.json` or `.tester-job.result.json` in `stateDir`. PASS without ACK is insufficient. A fresh `get_task({id, include:["test","landed","local_receiver"]})` (the created card’s id) must show `details.test.verdict=PASS` and `details.test.sha=details.landed.sha`; process transport alone is not tester PASS.
259
334
 
260
335
  Save the complete input below as `usage.json` in the current directory. Take `repo` from `engine.repo` and `stateDir` from engine configuration (resolve relative configuration paths against its directory; use absolute paths here). Copy `landed.sha` and `landed.at` from a fresh read of this card's `details.landed`; the values below are fictitious. Copy `source` and `deadline` from the JSON text in `details.effect_check`; `source` is relative to `stateDir/evidence`.
261
336
 
@@ -279,7 +354,7 @@ npx robisie usage --input ./usage.json
279
354
 
280
355
  Success prints one JSON `UsageEvent` with exit 0. Change `operation` to `powitanie:Bartek` and `program.args` to `["Bartek"]`, run the same command, then repeat with `powitanie:Celina` and `["Celina"]`. The equivalent `--input=./usage.json` form is supported. Three distinct operations and distinct artifact bytes are required; three identical operations do not count as three. Do not append events manually. The CLI executes the landed SHA in a separate worktree; it does not judge the result or set `done`.
281
356
 
282
- Refusal or IO failure returns exit 1 and a next step. An entry may already exist: inspect `stateDir/evidence/<source>` and the referenced artifacts before retrying, preserve evidence and resolve the cause. Never retry the program automatically. After three accepted uses, another `factory run --once` tick starts/settles independent acceptance; only a fresh card read confirms `local_receiver.outcome=PASS` and `status=done`. The package fixture does not prove actual customer use.
357
+ Refusal or IO failure returns exit 1 and a next step. An entry may already exist: inspect `stateDir/evidence/<source>` and the referenced artifacts before retrying, preserve evidence and resolve the cause. Never retry the program automatically. After three accepted uses, another `factory run --once` tick starts/settles independent acceptance; only a fresh `get_task({id, include:["test","landed","local_receiver"]})` confirms `details.local_receiver.outcome=PASS` and `status=done`. The package fixture does not prove actual customer use.
283
358
 
284
359
  ### Manual Builder card
285
360
 
@@ -419,7 +494,7 @@ cp -p -- "$backup/profile/selected" "$profile"
419
494
  cp -p -- "$backup/entries/$entry_id" "$entry_path"
420
495
  ```
421
496
 
422
- Once the tgz and selected copies are ready, update. Init reuses saved A and B for an existing installation; ENV takes priority. Explicit `--key-stdin` replaces only A. Doctor and the launcher still require both environment variables. Load the old key BEFORE init/doctor using the same XDG_CONFIG_HOME; separate assignment before export and `&&` retain read failures without printing the key:
497
+ Once the tgz and selected copies are ready, update. After login, init and doctor use A/B from the installation files and ignore different stale ENV with a warning. For manual installation without login, init reuses saved A/B with ENV-first; explicit `--key-stdin` selects input for A. Manual doctor requires both environment variables; agent credentials depend on the provider as described above. Load the old key BEFORE init/doctor using the same XDG_CONFIG_HOME; separate assignment before export and `&&` retain read failures without printing the key:
423
498
 
424
499
  <!-- update:start -->
425
500
  ```sh
@@ -506,7 +581,7 @@ Retained backups, including private update copies, may still contain the key aft
506
581
  <!-- sekcja: diagnoza -->
507
582
  ## Diagnosis
508
583
 
509
- Without an installation, begin with the account and Connect → init; repeating doctor does not create an account. With an existing installation, doctor reads the record and key first (ENV takes priority over the file), then checks the network. Resolve record/key-read problems first while preserving data; a network failure on an existing installation does not call for a new account. Check connectivity and server access.
584
+ Without an installation, begin with the account and Connect → init; repeating doctor does not create an account. With an existing installation, doctor reads the record and key first (after login: installation files; manual installation: ENV-first), then checks the network. Resolve record/key-read problems first while preserving data; a network failure on an existing installation does not call for a new account. Check connectivity and server access.
510
585
 
511
586
  CLI messages remain in Polish. Match the message, then follow the English explanation:
512
587
 
package/docs/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # robisie — od konta do odebranej karty (paczka 0.5.0) <!-- x-release-please-version -->
1
+ # robisie — od konta do odebranej karty (paczka 0.5.2) <!-- x-release-please-version -->
2
2
 
3
3
  W katalogu projektu z konfiguracją silnika uruchom `npx robisie init`, potem `npx robisie doctor`: init przygotuje cel projektu i listę ochrony testera, a doctor sprawdzi oba wejścia.
4
4
 
@@ -40,7 +40,7 @@ Odczyt projektów to uwierzytelniony odczyt aktywnych projektów przez `list_pro
40
40
  <!-- agent-consent:start -->
41
41
  ### Instrukcja dla agenta — jedna zgoda na przebieg
42
42
 
43
- Na początku poproś raz o zgodę na nazwany przebieg i jego granice: własne konto, wygenerowanie klucza, bezpieczny lokalny zapis klucza, init oraz pierwszą uzgodnioną kartę (cel, katalog, zakres zapisu i kryteria wyniku). Przykład pierwszej karty poniżej obejmuje tylko `wynik.txt`; wybierz ją z właścicielem przed prośbą o zgodę.
43
+ Na początku poproś raz o zgodę na nazwany przebieg i jego granice: własne konto, wygenerowanie klucza, bezpieczny lokalny zapis klucza, init oraz pierwszą uzgodnioną kartę (cel, katalog, zakres zapisu i kryteria wyniku). Przed prośbą o zgodę wybierz z właścicielem lokalną kartę `greet.cjs` albo ręczną `wynik.txt`; granice muszą odpowiadać wybranemu przykładowi.
44
44
 
45
45
  Jeśli właściciel już udzielił zgody na ten przebieg, nie pytaj ponownie przy tych krokach; kontynuuj w ustalonych granicach. Brak zgody, null, pusta lub niejasna odpowiedź albo zmiana zakresu wymagają pytania przed zależnym krokiem; wykonuj dalej niezależne dozwolone czynności. Odmowę uszanuj: nie wykonuj odmówionych kroków. Zgoda nie omija chronionych potwierdzeń człowieka ani dostawcy; po takim potwierdzeniu kontynuuj. Klucz pozostaje poza rozmową, kartą, argumentami i historią poleceń; gdy bezpieczny zapis lub przekazanie nie jest dostępne, człowiek używa ukrytego pytania init. Cudza otwarta sesja nie daje dostępu do jej konta. Po pracy nadal obowiązują niezależna recenzja oraz osobny końcowy odbiór wyniku przez właściciela.
46
46
  <!-- agent-consent:end -->
@@ -51,9 +51,17 @@ Człowiek w https://robisie.app/dashboard/connect wybiera `worker` i własną ro
51
51
 
52
52
  Paczka zapisuje **jeden klucz worker dla CEO, Buildera i Quality Officera** jako `ROBISIE_KEY`. Nazwa roli nie zmienia uprawnień. Nie używaj full jako obejścia odbioru `done`: właściciel odbiera wynik w panelu bez rozszerzania klucza agenta.
53
53
 
54
- Wymagane są dwa osobne klucze: A (`ROBISIE_KEY`, worker) i B (`ROBISIE_REVIEW_KEY`, owner_validator). W https://robisie.app/dashboard/connect wygeneruj NOWY klucz B z rolą `owner_validator` i etykietą inną niż A: powtórzenie etykiety A rotuje A. Etykieta nie ogranicza klucza do projektu. B podaj poza rozmową w osobnym ukrytym pytaniu init albo przez bezpiecznie przygotowane ENV; `--key-stdin` pobiera tylko A. ENV B ma pierwszeństwo przed zapisanym `review-key` i pytaniem; otaczające spacje są błędem. Reinstalacja używa zapisanego B, jeśli ENV jest puste. Niepusty wadliwy B wymaga naprawy, bez zastępowania innym źródłem.
54
+ Przy ręcznej instalacji z Connect wymagane są dwa osobne klucze: A (`ROBISIE_KEY`, worker) i B (`ROBISIE_REVIEW_KEY`, owner_validator). W https://robisie.app/dashboard/connect wygeneruj NOWY klucz B z rolą `owner_validator` i etykietą inną niż A: powtórzenie etykiety A rotuje A. Etykieta nie ogranicza klucza do projektu. B podaj poza rozmową w osobnym ukrytym pytaniu init albo przez bezpiecznie przygotowane ENV; `--key-stdin` pobiera tylko A. ENV B ma pierwszeństwo przed zapisanym `review-key` i pytaniem; otaczające spacje są błędem. Reinstalacja używa zapisanego B, jeśli ENV jest puste. Niepusty wadliwy B wymaga naprawy, bez zastępowania innym źródłem.
55
55
 
56
- A i B są zapisywane osobno w `${XDG_CONFIG_HOME:-$HOME/.config}/robisie/key` i `review-key` (pliki 0600, katalog 0700). B nie trafia do konfiguracji agentów/modeli, manifestu, argumentów, claimów ani komunikatów. Załaduj oba ENV także przy `--no-shell`. Przed pierwszym zadaniem uruchom zwykły `npx robisie doctor`: tryb `--engine-config` nie sprawdza kluczy. Przy brakującym lub niepoprawnym A doctor diagnozuje A; sprawdzanie B zaczyna dopiero, gdy A jest obecny i ma poprawny format. Brak B, B=A, zły format i nieudany odczyt B dają exit 1. B sprawdzane jest przez `initialize` + `list_projects`, bez mutacji danych biznesowych; liczniki auth mogą wzrosnąć. Odczyt nie potwierdza roli, wspólnego konta A/B ani polityki projektu.
56
+ A i B są zapisywane osobno w `${XDG_CONFIG_HOME:-$HOME/.config}/robisie/key` i `review-key` (pliki 0600, katalog 0700). B nie trafia do konfiguracji agentów/modeli, manifestu, argumentów, claimów ani komunikatów. Przy ręcznej instalacji załaduj oba ENV także przy `--no-shell`. Przed pierwszym zadaniem uruchom zwykły `npx robisie doctor`: tryb `--engine-config` nie sprawdza kluczy. Przy brakującym lub niepoprawnym A doctor diagnozuje A; sprawdzanie B zaczyna dopiero, gdy A jest obecny i ma poprawny format. Brak B, B=A, zły format i nieudany odczyt B dają exit 1. B sprawdzane jest przez `initialize` + `list_projects`, bez mutacji danych biznesowych; liczniki auth mogą wzrosnąć. Odczyt nie potwierdza roli, wspólnego konta A/B ani polityki projektu.
57
+
58
+ <!-- credential-sources:start -->
59
+ Po `login` polecenia `init`, `doctor` i `factory run` używają A/B z plików `key` i `review-key`. Różny niepusty stary ENV jest ignorowany z ostrzeżeniem bez ujawniania wartości; brak lub uszkodzenie plików wymaga naprawy, nie fallbacku do ENV. Dotyczy to poleceń robisie, a nie osobnych sesji agentów.
60
+
61
+ Instalacja ręczna z Connect (bez login) zachowuje ENV-first: poprawny ENV ma pierwszeństwo przed zapisanym kluczem. Dla A przy pustym ENV init używa zapisanego pliku, jeśli istnieje instalacja i nie wybrano `--key-stdin`, potem ukrytego pytania lub jawnego stdin; dla B używa zapisanego pliku istniejącej instalacji, potem ukrytego pytania. Niepusty wadliwy klucz, błąd odczytu lub dowiązanie wymagają naprawy, bez zastępowania innym źródłem. Ręczny doctor wymaga obu ENV, także przy `--no-shell`.
62
+
63
+ Osobni agenci: Claude Code używa nagłówka `Authorization` zapisanego przez init w prywatnej konfiguracji; Codex używa `bearer_token_env_var = "ROBISIE_KEY"`, a OpenCode referencji `{env:ROBISIE_KEY}`. Codex/OpenCode wymagają aktualnego A w środowisku sesji także po login; wczytaj je bez wydruku według przepisu init. B nie jest kluczem konfiguracji agentów. Po zmianie kluczy ponów init dla wybranego dostawcy i rozpocznij nową sesję.
64
+ <!-- credential-sources:end -->
57
65
 
58
66
  Gdy klucz A widzi dokładnie jeden projekt, doctor odczytuje jego `reviewPolicy` przez `list_projects`: `enforced` daje „✓ Polityka enforced: TAK”, `legacy` ostrzega, że `accept_review` będzie odmawiane i wymaga ustawienia enforced przez operatora. Starszy serwer bez pola lub `null` daje „NIE SPRAWDZONO — serwer nie zwraca polityki”, błąd odczytu — „NIE SPRAWDZONO — odczyt nieudany”. Linia jest informacyjna i nie zmienia exit. Odmowa kontekstu projektu następuje przed doctor i ma własną poradę. Klient tylko odczytuje politykę, nie aktywuje enforced; zmienia ją uprawniony operator.
59
67
 
@@ -204,7 +212,7 @@ npx robisie doctor
204
212
 
205
213
  Człowiek wybiera jednego wspólnego dostawcę dla trzech ról. Polecenia poniżej ustawiają pełną mapę zarówno przy nowej instalacji, jak i wcześniejszej mapie. Samo `--agent` nie kasuje mapy. Bez `--agent` instalator uwzględnia wszystkich wykrytych dostawców; kilku bez przypisań daje mapę null.
206
214
 
207
- W zsh/bash przed init usuń stary ENV, który ma pierwszeństwo przed pytaniem i stdin:
215
+ Przy ręcznej instalacji bez login w zsh/bash przed init usuń stary ENV, który ma pierwszeństwo przed pytaniem i stdin:
208
216
 
209
217
  ```sh
210
218
  unset ROBISIE_KEY
@@ -282,6 +290,73 @@ Doctor uruchamia plik pomocnika przez node, agent przez npx. `ROBISIE_PROJECT_CO
282
290
 
283
291
  ### Karta dla lokalnego silnika
284
292
 
293
+ Po instalacji npm z sekcji powyżej, w tym samym pustym dotąd katalogu przygotuj repo poniższym blokiem. Tożsamość `Robisie Demo <demo@example.invalid>` jest jawna i lokalna dla tego ćwiczenia; dla własnego projektu ustaw własną. Zapis używa `wx`: przy istniejącym pliku lub błędzie zachowaj dane, wyjaśnij przyczynę i nie wykonuj dalszych kroków. `.gitignore` wyłącza lokalną instalację npm, konfigurację i input użycia z tego małego repo; produktem jest `greet.cjs`.
294
+
295
+ <!-- local-repo-setup:start -->
296
+ ```sh
297
+ git init --initial-branch=main &&
298
+ git config --local user.name "Robisie Demo" &&
299
+ git config --local user.email "demo@example.invalid" &&
300
+ node <<'NODE' &&
301
+ try {
302
+ require("node:fs").writeFileSync("greet.cjs", String.raw`try {
303
+ const greeting = "Witaj";
304
+ const recipient = process.argv[2];
305
+ if (recipient === undefined) console.log(greeting);
306
+ else {
307
+ if (process.argv.length !== 3 || !["Ala", "Bartek", "Celina"].includes(recipient)) throw new Error("Nieznany odbiorca");
308
+ const message = greeting + ", " + recipient + "!\n";
309
+ require("node:fs").writeFileSync("greeting.txt", message, { flag: "wx" });
310
+ process.stdout.write(message);
311
+ }
312
+ } catch (error) { console.error(error); process.exitCode = 1; }
313
+ `, { flag: "wx" });
314
+ require("node:fs").writeFileSync(".gitignore", "node_modules/\npackage.json\npackage-lock.json\nrobisie.config.json\nusage.json\ngreeting.txt\n", { flag: "wx" });
315
+ } catch (error) { console.error(error); process.exitCode = 1; }
316
+ NODE
317
+ git add greet.cjs .gitignore &&
318
+ git commit -m "Przygotuj lokalne powitanie"
319
+ ```
320
+ <!-- local-repo-setup:end -->
321
+
322
+ Zapisz cały poniższy JSON jako `robisie.config.json` w katalogu repo, bez nadpisywania istniejącej konfiguracji. **Podmień** fikcyjne `project` na UUID z uwierzytelnionego `list_projects`, a UUID i nazwę `tracks` na rzeczywisty tor z tablicy tego projektu. Podmień `engine.repo` na absolutną ścieżkę bieżącego repo, a `stateDir` na osobny katalog **poza repo**. Uzupełnij wszystkie cztery wpisy `roleRegistry`. W lokalnym przebiegu `worker-client` musi używać `provider: codex`, a `reviewer-client` musi używać `provider: grok`, `model: grok-cli`, `effort: none`. Inna para zostanie zatrzymana przez `HOLD clientPair`, nawet jeśli przejdzie walidację konfiguracji. Dla ról Codex wybierz rzeczywisty model dostępny na swoim koncie i obsługiwany effort; przykład używa `gpt-6.1-sol` / `high`, nie modeli fixture. Model recenzenta wybiera zainstalowany Grok CLI; zachowaj `grok-cli` / `none`. Lokalny przebieg wymaga dostępnych i zalogowanych programów `codex` i `grok`; sam program dostawcy instalatora nie wystarcza. Same parsowanie i doctor offline nie dowodzą dostępności modeli ani dostawców. Rejestr wykonania jest odrębny od mapy instalatora CEO/Builder/Quality Officer.
323
+
324
+ <!-- local-engine-config:start -->
325
+ ```json
326
+ {
327
+ "project": "11111111-1111-4111-8111-111111111111",
328
+ "tracks": [{"id": "22222222-2222-4222-8222-222222222222", "name": "Zmiany"}],
329
+ "stateDir": "/sciezka/do/stanu",
330
+ "engine": {
331
+ "mode": "client", "delivery": "local",
332
+ "repo": "/sciezka/do/repo", "branch": "main", "requiredChecks": [],
333
+ "commands": {
334
+ "test": ["node", "greet.cjs"],
335
+ "lint": ["node", "--check", "greet.cjs"],
336
+ "build": ["node", "--check", "greet.cjs"]
337
+ }
338
+ },
339
+ "roleRegistry": {
340
+ "worker-client": {"name": "Worker", "provider": "codex", "model": "gpt-6.1-sol", "effort": "high"},
341
+ "lead-client": {"name": "Lead", "provider": "codex", "model": "gpt-6.1-sol", "effort": "high"},
342
+ "reviewer-client": {"name": "Reviewer", "provider": "grok", "model": "grok-cli", "effort": "none"},
343
+ "tester-client": {"name": "Tester", "provider": "codex", "model": "gpt-6.1-sol", "effort": "high"}
344
+ }
345
+ }
346
+ ```
347
+ <!-- local-engine-config:end -->
348
+
349
+ Po podmianie i zapisaniu konfiguracji przygotuj wejścia lokalnego silnika; init utworzy cel projektu i listę ochrony testera w `stateDir/inputs`. Kontynuuj dopiero po zwykłym doctor z exit 0; sama walidacja offline nie sprawdza konta ani gotowości wykonawców.
350
+
351
+ ```sh
352
+ npx robisie init &&
353
+ npx robisie doctor
354
+ ```
355
+
356
+ Uruchom CEO w tym katalogu: `claude --agent ceo-client`, albo `codex` z rolą robisie CEO i pełnym odczytem pliku wskazanego w AGENTS.md, albo `opencode` z wyborem `ceo-client`. Przekaż mu gotową prośbę:
357
+
358
+ > CEO, utwórz lokalną kartę zmiany greet.cjs według celu i literalnego obiektu details poniżej. Użyj rzeczywistego projektu z list_projects i toru z tablicy. Zmień wyłącznie greet.cjs, bez zależności, kont i publikacji. Korzystaj z wcześniejszej zgody, jeśli obejmuje ten cel, katalog, zakres i odbiór; inaczej zapytaj przed zależnym krokiem. Wstaw prawdziwych dostawców autorstwa i przyszły deadline, przygotuj kartę do ready. Po pracy potrzebuję niezależnego testera i ACK, trzech użyć Ala/Bartek/Celina oraz osobnego końcowego odbioru.
359
+
285
360
  Wybierz projekt z polityką `enforced` i konfiguracją `engine.delivery: "local"` według [konfiguracji silnika](ENGINE-CONFIG.md). CEO tworzy kartę przez narzędzia tablicy, z poniższym literalnym obiektem `details`. Panel nie edytuje `details`. Cel: zmień powitanie w istniejącym, śledzonym `greet.cjs`; bez argumentu wypisz `Witaj z fabryki`, a dla jednego argumentu Ala, Bartek lub Celina zapisz nowe `greeting.txt` z `Witaj z fabryki, <imię>!` i końcowym znakiem nowej linii. Bez zależności, kont i publikacji. Zakres zapisu kodu obejmuje tylko `greet.cjs`; `greeting.txt` jest artefaktem użycia w osobnym worktree.
286
361
 
287
362
  <!-- local-card-details:start -->
@@ -300,7 +375,7 @@ Wybierz projekt z polityką `enforced` i konfiguracją `engine.delivery: "local"
300
375
 
301
376
  Przed utworzeniem karty zastąp przykładowy `deadline` przyszłym terminem ISO 8601 ze strefą czasową, obejmującym wykonanie, testera i trzy użycia. W `seed_provenance.authoring_providers` wpisz prawdziwych dostawców autorów: `by` autora zasiewu, `proposal_by` autora propozycji, `packager_by` autora pakietu; nie kopiuj przykładowych nazw dla pozorowania niezależności. Silnik dopisuje transport, dostawę i wynik testera — nie twórz tych dowodów ręcznie.
302
377
 
303
- Po autoryzacji CEO przygotowuje kartę do `ready`. Uruchamiaj `npx robisie factory run --engine-config ./robisie.config.json --once` i obserwuj kartę aż do rzeczywistego PASS testera na landed SHA oraz jego rozliczenia (ACK): brak `.tester-job.lock`, `.tester-job.input.json` i `.tester-job.result.json` w `stateDir`. Sam PASS bez ACK nie wystarcza.
378
+ Po autoryzacji CEO przygotowuje kartę do `ready`. Uruchamiaj `npx robisie factory run --engine-config ./robisie.config.json --once` i obserwuj kartę aż do rzeczywistego PASS testera na landed SHA oraz jego rozliczenia (ACK): brak `.tester-job.lock`, `.tester-job.input.json` i `.tester-job.result.json` w `stateDir`. Sam PASS bez ACK nie wystarcza. Świeży odczyt `get_task({id, include:["test","landed","local_receiver"]})` (id utworzonej karty) musi pokazać `details.test.verdict=PASS` oraz `details.test.sha=details.landed.sha`; sam transport procesu nie jest PASS testera.
304
379
 
305
380
  Zapisz poniższy pełny input jako `usage.json` w bieżącym katalogu. `repo` weź z `engine.repo`, a `stateDir` z konfiguracji silnika (ścieżki względne konfiguracji rozwiąż względem jej katalogu; tu użyj absolutnych). `landed.sha` i `landed.at` przepisz ze świeżego odczytu `details.landed` tej karty — poniższe wartości są fikcyjne. `source` i `deadline` przepisz z JSON w `details.effect_check`; `source` jest względem `stateDir/evidence`.
306
381
 
@@ -324,7 +399,7 @@ npx robisie usage --input ./usage.json
324
399
 
325
400
  Po sukcesie otrzymasz jeden `UsageEvent` JSON i exit 0. Zmień `operation` na `powitanie:Bartek` oraz `program.args` na `["Bartek"]` i wykonaj to samo polecenie, potem analogicznie `powitanie:Celina` i `["Celina"]`. Możesz użyć równoważnego `--input=./usage.json`. Potrzebne są trzy różne operacje i różne bajty artefaktów; trzy identyczne operacje nie liczą się jako trzy. Nie dopisuj zdarzeń ręcznie. CLI wykonuje program na landed SHA w osobnym worktree, nie ocenia wyniku i nie ustawia `done`.
326
401
 
327
- Przy odmowie lub błędzie IO polecenie zwraca exit 1 z następnym krokiem. Wpis może już istnieć: przed ponowieniem sprawdź `stateDir/evidence/<source>` oraz wskazane artefakty, zachowaj dowody i wyjaśnij przyczynę. Nie ponawiaj programu automatycznie. Po trzech przyjętych użyciach kolejny takt `factory run --once` uruchamia/rozlicza niezależny odbiór; dopiero świeży odczyt karty potwierdza `local_receiver.outcome=PASS` i `status=done`. Lokalny przykład w testach paczki nie dowodzi użycia u klienta.
402
+ Przy odmowie lub błędzie IO polecenie zwraca exit 1 z następnym krokiem. Wpis może już istnieć: przed ponowieniem sprawdź `stateDir/evidence/<source>` oraz wskazane artefakty, zachowaj dowody i wyjaśnij przyczynę. Nie ponawiaj programu automatycznie. Po trzech przyjętych użyciach kolejny takt `factory run --once` uruchamia/rozlicza niezależny odbiór; dopiero świeży `get_task({id, include:["test","landed","local_receiver"]})` potwierdza `details.local_receiver.outcome=PASS` i `status=done`. Lokalny przykład w testach paczki nie dowodzi użycia u klienta.
328
403
 
329
404
  ### Ręczna karta Buildera
330
405
 
@@ -464,7 +539,7 @@ cp -p -- "$backup/profile/selected" "$profile"
464
539
  cp -p -- "$backup/entries/$entry_id" "$entry_path"
465
540
  ```
466
541
 
467
- Gdy tgz i wszystkie wybrane kopie są gotowe, aktualizuj. Init istniejącej instalacji używa zapisanych A i B; ENV ma pierwszeństwo. Jawny `--key-stdin` wymienia tylko A. Doctor i launcher nadal wymagają obu zmiennych środowiska. Wczytaj stary klucz PRZED init/doctor z tego samego XDG_CONFIG_HOME; osobne przypisanie przed export i `&&` zachowują błąd odczytu bez wydruku klucza:
542
+ Gdy tgz i wszystkie wybrane kopie są gotowe, aktualizuj. Po login init i doctor używają A/B z plików instalacji, ignorując różny stary ENV z ostrzeżeniem. Przy ręcznej instalacji bez login init używa zapisanych A/B z ENV-first; jawny `--key-stdin` wybiera wejście dla A. Ręczny doctor wymaga obu ENV; źródła kluczy agentów zależą od dostawcy jak opisano wyżej. Wczytaj stary klucz PRZED init/doctor z tego samego XDG_CONFIG_HOME; osobne przypisanie przed export i `&&` zachowują błąd odczytu bez wydruku klucza:
468
543
 
469
544
  Kopia i odtworzenie obejmują oba pliki key i review-key z prywatnymi uprawnieniami; przed init/doctor wczytaj oba odtworzone klucze. Uninstall raportuje osobno stan obu plików i usuwa je z zachowaniem dotychczasowej ochrony ewidencji oraz konfiguracji. Nie unieważnia żadnego klucza na serwerze.
470
545
 
@@ -551,7 +626,7 @@ Zachowane backupy, także prywatne kopie aktualizacji, mogą nadal zawierać klu
551
626
  <!-- sekcja: diagnoza -->
552
627
  ## Diagnoza
553
628
 
554
- Bez instalacji zacznij od konta i Connect → init; samo ponawianie doctor nie zakłada konta. Przy istniejącej instalacji doctor najpierw odczytuje ewidencję i klucz (ENV ma pierwszeństwo przed plikiem), a potem sprawdza sieć. Najpierw rozwiąż wskazany problem ewidencji/odczytu klucza, zachowując dane; błąd sieci przy istniejącej instalacji nie oznacza potrzeby nowego konta. Sprawdź połączenie i dostęp do serwera.
629
+ Bez instalacji zacznij od konta i Connect → init; samo ponawianie doctor nie zakłada konta. Przy istniejącej instalacji doctor najpierw odczytuje ewidencję i klucz (po login: pliki instalacji; ręcznie: ENV-first), a potem sprawdza sieć. Najpierw rozwiąż wskazany problem ewidencji/odczytu klucza, zachowując dane; błąd sieci przy istniejącej instalacji nie oznacza potrzeby nowego konta. Sprawdź połączenie i dostęp do serwera.
555
630
 
556
631
  Komunikaty CLI pozostają po polsku. Dopasuj komunikat, a potem wykonaj wskazaną czynność:
557
632
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robisie",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Instalator klienta robisie: łączy agenta (Claude Code, Codex CLI, OpenCode) z tablicą robisie i instaluje role klienta.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",