robisie 0.5.25 → 0.5.27

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,24 @@
1
1
  # Historia zmian klienta / Client changelog
2
2
 
3
+ ## [0.5.27](https://github.com/chuppa12/robisie-app/compare/client-v0.5.26...client-v0.5.27) (2026-11-14)
4
+
5
+
6
+ ### Factory Cards
7
+
8
+ * praca workera task-mwfyliua-tek9cp (auto-commit) ([007b581](https://github.com/chuppa12/robisie-app/commit/007b5817caa02586400d300ff800c2b629e1e749))
9
+ * praca workera task-mwg09qgw-cfk5u1 (auto-commit) ([e94b6a7](https://github.com/chuppa12/robisie-app/commit/e94b6a729c0460b7140af749670f1049302797b0))
10
+ * S1-1 41938e2e — rebase operatora + rozwiązanie konfliktu z D (porada 010 §5) ([c9df2c9](https://github.com/chuppa12/robisie-app/commit/c9df2c9105fe86c595ebce1e1c7247cc62028d13))
11
+ * S1-1 41938e2e — usunięcie raportu dowodowego Workera z drzewa (Z-S1-1-DOWOD-POZA-REPO) ([ac58411](https://github.com/chuppa12/robisie-app/commit/ac58411d35116563de11514b936a3ef1bba3aad5))
12
+
13
+ ## [0.5.26](https://github.com/chuppa12/robisie-app/compare/client-v0.5.25...client-v0.5.26) (2026-11-14)
14
+
15
+
16
+ ### Factory Cards
17
+
18
+ * praca workera task-mwfpfybq-p6wflo (auto-commit) ([757b4a0](https://github.com/chuppa12/robisie-app/commit/757b4a0deeadecef47003574af7e031a539d4b13))
19
+ * praca workera task-mwfsifur-jph5gs (auto-commit) ([42e4674](https://github.com/chuppa12/robisie-app/commit/42e467461118c94831984b0e1bca062a64742a6e))
20
+ * praca workera task-mwfty55x-3fqdnw (auto-commit) ([b52dfd6](https://github.com/chuppa12/robisie-app/commit/b52dfd66d28bbd296469d7227067d5325fd76b34))
21
+
3
22
  ## [0.5.25](https://github.com/chuppa12/robisie-app/compare/client-v0.5.24...client-v0.5.25) (2026-11-14)
4
23
 
5
24
 
package/dist/cli.js CHANGED
@@ -1,19 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import { lstatSync, realpathSync } from "node:fs";
2
+ import { lstatSync, readFileSync, realpathSync } from "node:fs";
3
3
  import { resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { z } from "zod";
6
6
  import { AGENT_IDS, isAgentId } from "./agents.js";
7
- import { doctor, init, recoveryStep, uninstall } from "./commands.js";
7
+ import { doctor, doctorClientPair, init, recoveryStep, uninstall } from "./commands.js";
8
8
  import { HELPER_SERVERS, PACKAGE_VERSION } from "./constants.js";
9
9
  import { RobisieError, errorMessage, nodeCtx } from "./context.js";
10
10
  import { DEFAULT_LOGIN_TIMEOUT_SECONDS } from "./device-login.js";
11
11
  import { runFactory } from "./factory-run.js";
12
- import { checkInputs, inputDirectory, INPUTS_OK } from "./engine-inputs.js";
12
+ import { CONFIG_FILE, loadEngineConfig } from "./engine-config.js";
13
+ import { checkInputs, inputDirectory, INPUTS_OK, selectInputDirectory } from "./engine-inputs.js";
13
14
  import { isHelperServer, runHelper } from "./helpers.js";
14
15
  import { closeInstallation, initNeedsLogin, login, openInstallation } from "./login.js";
15
16
  import { ROLE_IDS, ROLE_STEP } from "./manifest.js";
16
- import { doctorEngineConfig } from "./role-registry.js";
17
+ import { doctorEngineConfig, loadRoleRegistryConfig, validateClientRoles } from "./role-registry.js";
17
18
  import { bounded, runLocalUsage } from "./local-usage.js";
18
19
  const usageText = z.string().trim().min(1);
19
20
  const usageAt = z.iso.datetime({ offset: true });
@@ -198,6 +199,28 @@ export async function run(argv, ctx) {
198
199
  }
199
200
  if (args.command === "login")
200
201
  return await login(ctx, { wait: args.wait, timeoutSeconds: args.timeout ?? undefined });
202
+ if (args.command === "init") {
203
+ selectInputDirectory(ctx, args.engineConfig);
204
+ let selected = args.engineConfig ?? (ctx.env.ROBISIE_ENGINE_CONFIG?.trim() ? ctx.env.ROBISIE_ENGINE_CONFIG : null);
205
+ if (selected === null) {
206
+ try {
207
+ const raw = JSON.parse(readFileSync(resolve(ctx.cwd, CONFIG_FILE), "utf8").replace(/^\uFEFF/, ""));
208
+ if (raw && typeof raw === "object" && Object.hasOwn(raw, "engine"))
209
+ selected = CONFIG_FILE;
210
+ }
211
+ catch (error) {
212
+ if (error?.code !== "ENOENT")
213
+ throw new RobisieError("Nie mogę odczytać konfiguracji silnika.", `Popraw plik ${CONFIG_FILE} i ponów init.`);
214
+ }
215
+ }
216
+ if (selected !== null) {
217
+ const configPath = resolve(ctx.cwd, selected);
218
+ if (loadEngineConfig(configPath).engine.mode !== "host") {
219
+ const { roleRegistry } = loadRoleRegistryConfig(configPath);
220
+ validateClientRoles(roleRegistry["worker-client"], roleRegistry["reviewer-client"]);
221
+ }
222
+ }
223
+ }
201
224
  if (args.command === "init" && initNeedsLogin(ctx, args.keyStdin)) {
202
225
  const code = await login(ctx, { wait: true });
203
226
  if (code !== 0)
@@ -234,11 +257,13 @@ export async function run(argv, ctx) {
234
257
  case "doctor":
235
258
  if (args.engineConfig !== null) {
236
259
  const configPath = resolve(ctx.cwd, args.engineConfig);
237
- return doctorEngineConfig(ctx, args.engineConfig, config => {
260
+ return doctorEngineConfig(ctx, args.engineConfig, (config, registry) => {
238
261
  if (config.engine.delivery === "local") {
239
262
  checkInputs(inputDirectory(config), configPath);
240
263
  ctx.out(INPUTS_OK);
241
264
  }
265
+ if (config.engine.mode !== "host")
266
+ doctorClientPair(ctx, registry);
242
267
  });
243
268
  }
244
269
  if (ctx.env.ROBISIE_KEY) {
@@ -1,6 +1,7 @@
1
1
  import { type AgentId } from "./agents.js";
2
2
  import { type Ctx } from "./context.js";
3
3
  import { type RoleProviders } from "./manifest.js";
4
+ import { type EngineRoleRegistry } from "./role-registry.js";
4
5
  export interface InitOptions {
5
6
  agents: AgentId[] | null;
6
7
  roles?: Partial<RoleProviders>;
@@ -21,6 +22,8 @@ export declare const loginIo: {
21
22
  status: number | null;
22
23
  };
23
24
  };
25
+ /** Uses the registry already read by doctorEngineConfig, without reopening configuration. */
26
+ export declare function doctorClientPair(ctx: Ctx, registry: EngineRoleRegistry): void;
24
27
  /** Returns the process exit code: 0 = all good, 1 = something needs one action. */
25
28
  export declare function doctor(ctx: Ctx): Promise<number>;
26
29
  export declare function uninstall(ctx: Ctx): number;
package/dist/commands.js CHANGED
@@ -14,6 +14,7 @@ import { clientPaths, ensurePrivateDir, loginFields, readKey, readManifest, writ
14
14
  import { assertCompatible, checkConnection, fetchContractVersion } from "./mcp.js";
15
15
  import { loadRoles, MANAGED_LINE, rolesDir } from "./roles.js";
16
16
  import { checkInputs, createInputs, INPUTS_OK, preflightInputs, selectInputDirectory } from "./engine-inputs.js";
17
+ import { validateClientRoles } from "./role-registry.js";
17
18
  import { PlanerClient } from "./planer-client.js";
18
19
  const NO_KEY_STEP = "Wygeneruj klucz worker na https://robisie.app/dashboard/connect; w zsh/bash wykonaj `unset ROBISIE_KEY`, potem lokalne `npx robisie init` i wklej klucz w ukrytym pytaniu (poza rozmową).";
19
20
  const KEY_FORMAT_STEP = `Skopiuj klucz jeszcze raz z https://robisie.app/dashboard/connect; ustaw poprawny ROBISIE_KEY w środowisku lokalnego init (poza rozmową i historią poleceń) albo przekaż klucz przez stdin z jawną flagą: \`npx robisie init --key-stdin\` (poza rozmową i historią poleceń). Następnie wczytaj zapisany klucz do bieżącej sesji POSIX z tym samym XDG_CONFIG_HOME: \`${SHELL_EXPORT}\`, potem uruchom \`npx robisie doctor\`.`;
@@ -286,21 +287,21 @@ function findProgram(cwd, path, name) {
286
287
  return null;
287
288
  }
288
289
  /** Login of the client execution pair (Codex worker, Grok reviewer) as the engine starts them. */
289
- function pairReadiness(ctx, fail) {
290
+ function pairReadiness(ctx, fail, registry) {
290
291
  const home = ctx.env.HOME || ctx.home;
291
292
  const env = {};
292
293
  for (const name of PAIR_ENV)
293
294
  if (ctx.env[name] !== undefined)
294
295
  env[name] = ctx.env[name];
295
296
  env.HOME = home;
296
- const grokEnv = { ...env, PATH: `${join(home, ".local/bin")}${delimiter}${env.PATH ?? ""}` };
297
+ const reviewEnv = { ...env, PATH: `${join(home, ".local/bin")}${delimiter}${env.PATH ?? ""}` };
297
298
  const retry = "Potem ponów `npx robisie doctor`.";
298
299
  let unchecked = false;
299
300
  let failed = false;
300
301
  const codex = findProgram(ctx.cwd, env.PATH ?? "", "codex");
301
302
  if (!codex) {
302
303
  unchecked = true;
303
- ctx.out("! Codex: brak programu codex w PATH — logowania NIE SPRAWDZONO.");
304
+ fail("Codex: brak programu codex w PATH — logowania NIE SPRAWDZONO.", "Zainstaluj Codex CLI i ponów doctor.");
304
305
  }
305
306
  else if (loginIo.run(codex, ["login", "status"], env, ctx.cwd).status === 0) {
306
307
  ctx.out(`✓ Codex zalogowany (\`codex login status\`, HOME=${home}).`);
@@ -310,20 +311,45 @@ function pairReadiness(ctx, fail) {
310
311
  fail(`Codex nie jest zalogowany w środowisku silnika (HOME=${home}).`, `Zaloguj Codex: \`codex login --device-auth\`. ${retry}`);
311
312
  }
312
313
  // Grok CLI has no login-status command; `grok models` lists models without a paid model call.
313
- const grok = findProgram(ctx.cwd, grokEnv.PATH, "grok");
314
+ const grok = findProgram(ctx.cwd, reviewEnv.PATH, "grok");
314
315
  if (!grok) {
315
316
  unchecked = true;
316
- ctx.out("! Grok: brak programu grok w PATH — logowania NIE SPRAWDZONO.");
317
+ fail("Grok: brak programu grok w PATH — logowania NIE SPRAWDZONO.", "Zainstaluj Grok CLI i ponów doctor.");
317
318
  }
318
- else if (loginIo.run(grok, ["models"], grokEnv, ctx.cwd).status === 0) {
319
+ else if (loginIo.run(grok, ["models"], reviewEnv, ctx.cwd).status === 0) {
319
320
  ctx.out(`✓ Grok prawdopodobnie zalogowany (\`grok models\` działa; Grok CLI nie ma polecenia statusu logowania; HOME=${home}).`);
320
321
  }
321
322
  else {
322
323
  failed = true;
323
324
  fail(`Grok: nie potwierdzono zalogowania w środowisku silnika (HOME=${home}; \`grok models\` zakończył się błędem).`, `Zaloguj Grok: \`grok login --device-auth\`. ${retry}`);
324
325
  }
326
+ if (registry?.["reviewer-client"].provider === "claude") {
327
+ const claude = findProgram(ctx.cwd, reviewEnv.PATH, "claude");
328
+ if (!claude) {
329
+ unchecked = true;
330
+ fail("Claude: brak programu claude w PATH — logowania NIE SPRAWDZONO.", "Zainstaluj Claude CLI i ponów doctor.");
331
+ }
332
+ else if (loginIo.run(claude, ["auth", "status"], reviewEnv, ctx.cwd).status === 0) {
333
+ ctx.out(`✓ Claude zalogowany (\`claude auth status\`, HOME=${home}).`);
334
+ }
335
+ else {
336
+ failed = true;
337
+ fail("Claude: nie potwierdzono zalogowania w środowisku silnika.", "Zaloguj Claude: `claude auth login`. " + retry);
338
+ }
339
+ }
325
340
  return failed ? "niegotowa" : unchecked ? "NIE SPRAWDZONO" : "sprawdzona (Grok: prawdopodobnie zalogowany)";
326
341
  }
342
+ /** Uses the registry already read by doctorEngineConfig, without reopening configuration. */
343
+ export function doctorClientPair(ctx, registry) {
344
+ validateClientRoles(registry["worker-client"], registry["reviewer-client"]);
345
+ const reviewer = registry["reviewer-client"];
346
+ ctx.out(`Recenzent: ${reviewer.provider}/${reviewer.model}; niezależność: ${reviewer.requireIndependentProvider === false ? "częściowa: bez niezależnego sprawdzenia" : "wymagana"}.`);
347
+ const problems = [];
348
+ const readiness = pairReadiness(ctx, (line, next) => { ctx.out(`✗ ${line}`); problems.push(next); }, registry);
349
+ ctx.out(`Gotowość wykonawców: ${readiness}.`);
350
+ if (problems.length)
351
+ throw new RobisieError("Wykonawcy klienta niegotowi.", problems[0]);
352
+ }
327
353
  /** Returns the process exit code: 0 = all good, 1 = something needs one action. */
328
354
  export async function doctor(ctx) {
329
355
  let policyLine = "! Polityka enforced: NIE SPRAWDZONO — odczyt nieudany.";
@@ -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.25";
3
+ export declare const PACKAGE_VERSION = "0.5.27";
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.25"; // x-release-please-version
3
+ export const PACKAGE_VERSION = "0.5.27"; // 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":"1a5af8475a0ba57d216493b558309bcdbb93dbb4","dirty":false}
1
+ {"schema":1,"sha":"6579bcc0996608231044a9b18c93699fc44e5b51","dirty":false}
@@ -1237,6 +1237,24 @@
1237
1237
  "kind": "import-statement",
1238
1238
  "category": "builtin"
1239
1239
  },
1240
+ {
1241
+ "module": "maszynista/review-source-reader.ts",
1242
+ "path": "node:child_process",
1243
+ "kind": "import-statement",
1244
+ "category": "builtin"
1245
+ },
1246
+ {
1247
+ "module": "maszynista/review-source-reader.ts",
1248
+ "path": "node:crypto",
1249
+ "kind": "import-statement",
1250
+ "category": "builtin"
1251
+ },
1252
+ {
1253
+ "module": "maszynista/review-source-reader.ts",
1254
+ "path": "node:util",
1255
+ "kind": "import-statement",
1256
+ "category": "builtin"
1257
+ },
1240
1258
  {
1241
1259
  "module": "maszynista/review-source-packet.ts",
1242
1260
  "path": "node:crypto",
@@ -1655,14 +1673,14 @@
1655
1673
  "staticOperations": {
1656
1674
  "beforePreflight": {
1657
1675
  "module": "maszynista/tick.ts",
1658
- "startLine": 9619,
1659
- "endLine": 9732,
1676
+ "startLine": 9625,
1677
+ "endLine": 9738,
1660
1678
  "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 seedGateSettings = installationSeedGateSettings();\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
1679
  },
1662
1680
  "finalization": {
1663
1681
  "module": "maszynista/tick.ts",
1664
- "startLine": 10021,
1665
- "endLine": 10073,
1682
+ "startLine": 10027,
1683
+ "endLine": 10079,
1666
1684
  "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 && !([\"--opencode-runner\", \"--grok-runner\"].includes(process.argv[2] ?? \"\"))) {"
1667
1685
  },
1668
1686
  "refreshTickReport": {
@@ -1688,6 +1706,6 @@
1688
1706
  "status": 0,
1689
1707
  "signal": null,
1690
1708
  "stdout": "v24.3.0\n",
1691
- "stderr": "(node:16242) 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"
1709
+ "stderr": "(node:17970) 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
1710
  }
1693
1711
  }