robisie 0.5.38 → 0.5.40

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,20 @@
1
1
  # Historia zmian klienta / Client changelog
2
2
 
3
+ ## [0.5.40](https://github.com/chuppa12/robisie-app/compare/client-v0.5.39...client-v0.5.40) (2026-11-15)
4
+
5
+
6
+ ### Factory Cards
7
+
8
+ * praca workera task-mwhrg8jd-umbq0d (auto-commit) ([ce1df32](https://github.com/chuppa12/robisie-app/commit/ce1df32cedebebada287bca0a4ec3bba70eafef0))
9
+
10
+ ## [0.5.39](https://github.com/chuppa12/robisie-app/compare/client-v0.5.38...client-v0.5.39) (2026-11-15)
11
+
12
+
13
+ ### Factory Cards
14
+
15
+ * praca workera task-mwhl3hrm-uhenco (auto-commit) ([549c54f](https://github.com/chuppa12/robisie-app/commit/549c54f5e0d5273c6af3c5effab3a8686ea79a41))
16
+ * praca workera task-mwhongzp-22e1yi (auto-commit) ([978d630](https://github.com/chuppa12/robisie-app/commit/978d63080167c60871f9e1cab0b5ec9f49b0fdb4))
17
+
3
18
  ## [0.5.38](https://github.com/chuppa12/robisie-app/compare/client-v0.5.37...client-v0.5.38) (2026-11-15)
4
19
 
5
20
 
@@ -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.38";
3
+ export declare const PACKAGE_VERSION = "0.5.40";
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.38"; // x-release-please-version
3
+ export const PACKAGE_VERSION = "0.5.40"; // 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":"80ccd037630760e8e83f387e5af1a2062b3cd17e","dirty":false}
1
+ {"schema":1,"sha":"ab77f3f7094c91381c2be537874f910781bf1252","dirty":false}
@@ -1680,14 +1680,14 @@
1680
1680
  "staticOperations": {
1681
1681
  "beforePreflight": {
1682
1682
  "module": "maszynista/tick.ts",
1683
- "startLine": 9875,
1684
- "endLine": 9988,
1683
+ "startLine": 10003,
1684
+ "endLine": 10116,
1685
1685
  "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();"
1686
1686
  },
1687
1687
  "finalization": {
1688
1688
  "module": "maszynista/tick.ts",
1689
- "startLine": 10279,
1690
- "endLine": 10331,
1689
+ "startLine": 10407,
1690
+ "endLine": 10459,
1691
1691
  "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] ?? \"\"))) {"
1692
1692
  },
1693
1693
  "refreshTickReport": {
@@ -1713,6 +1713,6 @@
1713
1713
  "status": 0,
1714
1714
  "signal": null,
1715
1715
  "stdout": "v24.3.0\n",
1716
- "stderr": "(node:20045) 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"
1716
+ "stderr": "(node:21025) 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"
1717
1717
  }
1718
1718
  }
@@ -37652,7 +37652,7 @@ var init_constants = __esm({
37652
37652
  "packages/client/src/constants.ts"() {
37653
37653
  "use strict";
37654
37654
  PACKAGE_NAME = "robisie";
37655
- PACKAGE_VERSION = "0.5.38";
37655
+ PACKAGE_VERSION = "0.5.40";
37656
37656
  SUPPORTED_CONTRACT_MAJOR = 1;
37657
37657
  DEFAULT_ORIGIN = "https://robisie.app";
37658
37658
  MCP_SERVER_NAME = "robisie";
@@ -317384,6 +317384,66 @@ function git(args, cwd = TASK_REPO, timeoutMs = 6e4, createsCommit = false) {
317384
317384
  });
317385
317385
  return args.includes("-z") ? output : output.trim();
317386
317386
  }
317387
+ function addedConflictMarkers(worktree, baseRef, tree) {
317388
+ const base2 = git(["merge-base", baseRef, "HEAD"], worktree);
317389
+ if (!git(["log", "--format=%s", `${base2}..HEAD`], worktree).split("\n").includes(CONFLICT_PREPARATION_SUBJECT)) return [];
317390
+ const target = tree === "HEAD" ? ["HEAD"] : [];
317391
+ const files2 = git(["diff", "--no-ext-diff", "--no-textconv", "--name-only", "-z", base2, ...target, "--"], worktree).split("\0").filter(Boolean);
317392
+ return files2.filter((file3) => git(["diff", "--no-ext-diff", "--no-textconv", "--unified=0", base2, ...target, "--", `:(literal)${file3}`], worktree).split("\n").some((line2) => line2.startsWith("+") && !line2.startsWith("+++") && /^(?:<{7}|>{7})(?: |$)/.test(line2.slice(1))));
317393
+ }
317394
+ function prepareConflictWorktree(worktree, branch, base2, candidate, snapshot2) {
317395
+ if (candidate.diff || candidate.staged) return null;
317396
+ const untracked = () => git(["ls-files", "--others", "-z"], worktree).split("\0").filter(Boolean).map((file3) => {
317397
+ const absolute2 = import_node_path52.default.join(worktree, file3);
317398
+ const stat = (0, import_node_fs47.lstatSync)(absolute2);
317399
+ if (!stat.isSymbolicLink() && !stat.isFile()) throw new Error(`nie\u015Bledzony plik UNKNOWN: ${file3}`);
317400
+ return [file3, stat.isSymbolicLink() ? "link:" + (0, import_node_fs47.readlinkSync)(absolute2) : "bytes:" + (0, import_node_fs47.readFileSync)(absolute2).toString("base64")];
317401
+ });
317402
+ const operations = ["MERGE_HEAD", "SQUASH_MSG", "CHERRY_PICK_HEAD", "REVERT_HEAD", "rebase-merge", "rebase-apply", "sequencer"];
317403
+ const operationPaths = operations.map((operation) => import_node_path52.default.resolve(worktree, git(["rev-parse", "--git-path", operation], worktree)));
317404
+ if (operationPaths.some((file3) => (0, import_node_fs47.existsSync)(file3))) return null;
317405
+ const before = untracked();
317406
+ const ref = `refs/robisie/konflikt/${branch}-${candidate.head.slice(0, 8)}`;
317407
+ const mutate = (args, commit = false) => git(["-c", "core.hooksPath=/dev/null", ...args], worktree, 12e4, commit);
317408
+ const rollback = () => {
317409
+ mutate(["checkout", "-f", "-B", branch, ref]);
317410
+ const squash = operationPaths[1];
317411
+ if ((0, import_node_fs47.existsSync)(squash)) (0, import_node_fs47.unlinkSync)(squash);
317412
+ if (!(0, import_node_util14.isDeepStrictEqual)(snapshot2(), candidate) || !(0, import_node_util14.isDeepStrictEqual)(untracked(), before) || git(["symbolic-ref", "--short", "HEAD"], worktree) !== branch || git(["diff", "--name-only", "--diff-filter=U", "-z"], worktree) || operationPaths.some((file3) => (0, import_node_fs47.existsSync)(file3))) throw new Error("rollback: kandydat lub pliki nie\u015Bledzone/operacja UNKNOWN");
317413
+ };
317414
+ let checkoutStarted = false;
317415
+ try {
317416
+ mutate(["update-ref", ref, candidate.head]);
317417
+ checkoutStarted = true;
317418
+ mutate(["checkout", "--no-overwrite-ignore", "-B", branch, base2]);
317419
+ let mergeError;
317420
+ try {
317421
+ mutate(["merge", "--squash", candidate.head]);
317422
+ } catch (error48) {
317423
+ mergeError = error48;
317424
+ }
317425
+ const files2 = git(["diff", "--name-only", "--diff-filter=U", "-z"], worktree).split("\0").filter(Boolean);
317426
+ if (!files2.length || mergeError && gitExitStatus(mergeError) !== 1) throw new Error(`squash bez potwierdzonego konfliktu: ${errorText5(mergeError)}`);
317427
+ for (const file3 of files2) {
317428
+ const contents = (0, import_node_fs47.readFileSync)(import_node_path52.default.join(worktree, file3), "utf8");
317429
+ if (!/^<{7}(?: |$)/m.test(contents) || !/^>{7}(?: |$)/m.test(contents)) throw new Error(`konflikt bez marker\xF3w: ${file3}`);
317430
+ }
317431
+ mutate(["add", "--", ...files2.map((file3) => `:(literal)${file3}`)]);
317432
+ mutate(["commit", "-m", CONFLICT_PREPARATION_SUBJECT], true);
317433
+ const head = git(["rev-parse", "--verify", "HEAD^{commit}"], worktree);
317434
+ if (!/^[a-f0-9]{40}$/.test(head) || git(["symbolic-ref", "--short", "HEAD"], worktree) !== branch || git(["rev-list", "--parents", "-n", "1", "HEAD"], worktree) !== `${head} ${base2}` || git(["rev-list", "--count", `${base2}..HEAD`], worktree) !== "1" || git(["rev-parse", "--verify", ref], worktree) !== candidate.head || git(["diff", "--name-only", "--diff-filter=U", "-z"], worktree) || snapshot2().diff || snapshot2().staged || !(0, import_node_util14.isDeepStrictEqual)(untracked(), before) || operationPaths.some((file3) => (0, import_node_fs47.existsSync)(file3))) throw new Error("kontrola przygotowania konfliktu UNKNOWN");
317435
+ return { ref, head, files: files2, rollback };
317436
+ } catch (error48) {
317437
+ try {
317438
+ if (checkoutStarted) rollback();
317439
+ else if (!(0, import_node_util14.isDeepStrictEqual)(snapshot2(), candidate) || !(0, import_node_util14.isDeepStrictEqual)(untracked(), before)) throw new Error("odmowa refa: kandydat UNKNOWN");
317440
+ } catch (rollbackError) {
317441
+ throw new DispatchHold(`HOLD konflikt: ${errorText5(error48)}; rollback: ${errorText5(rollbackError)}`, false);
317442
+ }
317443
+ log2(`konflikt: odmowa przygotowania, kandydat zachowany: ${errorText5(error48)}`);
317444
+ return null;
317445
+ }
317446
+ }
317387
317447
  function autoCommitWorker(a) {
317388
317448
  if (!git(["status", "--porcelain", "--", ".", REVIEW_JOB_EXCLUDE], a.worktree)) return;
317389
317449
  git(["add", "-A", "--", ".", REVIEW_JOB_EXCLUDE], a.worktree);
@@ -321132,10 +321192,12 @@ function reviewFreshness(details2) {
321132
321192
  rulings
321133
321193
  });
321134
321194
  }
321135
- function reviewResultDiagnostic(s, cardId, phase, reason) {
321195
+ function reviewResultDiagnostic(s, cardId, phase, reason, historical = false) {
321136
321196
  if (engineClient()) {
321137
- s.blocked++;
321138
- if (reason !== "Brak kontekstu localDelivery klienta; pomijam dostaw\u0119" && !(phase === "local-delivery-hold" && /^(?:Error: )?(?:not-fast-forward|target-moved|target-checked-out|target-is-symbolic-ref|error): /.test(reason))) reason = clientTickFailure();
321197
+ if (!historical) {
321198
+ s.blocked++;
321199
+ if (reason !== "Brak kontekstu localDelivery klienta; pomijam dostaw\u0119" && !(phase === "local-delivery-hold" && /^(?:Error: )?(?:not-fast-forward|target-moved|target-checked-out|target-is-symbolic-ref|error): /.test(reason))) reason = clientTickFailure();
321200
+ }
321139
321201
  }
321140
321202
  try {
321141
321203
  log2(`${phase} cardId=${cardId} ${reason}`);
@@ -321724,7 +321786,10 @@ async function reviewActive(s, uid, card, a, landing, installation = tickInstall
321724
321786
  })) && (claim.sha !== head || !(0, import_node_util14.isDeepStrictEqual)(snapshot2, currentFreshness))) {
321725
321787
  staleClaim = true;
321726
321788
  staleClaims.push({ claim, file: file4 });
321727
- reviewResultDiagnostic(s, card.id, "stale-review-result", `key=${String(claim.key)}: snapshot or HEAD changed; retained as history`);
321789
+ const worker = asRecord3(snapshot2.worker), current = asRecord3(currentFreshness.worker);
321790
+ const fields = ["jobId", "attempts", "worktree", "branch"];
321791
+ const historical = [worker, current].every((owner) => fields.every((field) => field === "attempts" ? Number.isSafeInteger(owner[field]) && Number(owner[field]) > 0 : typeof owner[field] === "string" && owner[field].trim().length > 0)) && fields.every((field) => current[field] === a[field]) && fields.some((field) => worker[field] !== a[field]) && worker.worktree === claim.worktree && /^[a-f0-9]{40}$/.test(String(claim.sha)) && Number.isSafeInteger(claim.round) && Number(claim.round) >= 0 && typeof claim.key === "string" && claim.key.startsWith(`${card.id}:${claim.sha}:${claim.round}`) && import_node_path52.default.basename(file4) === `${(0, import_node_crypto32.createHash)("sha256").update(claim.key).digest("hex")}.json`;
321792
+ reviewResultDiagnostic(s, card.id, "stale-review-result", `key=${String(claim.key)}: snapshot or HEAD changed; retained as history`, historical);
321728
321793
  return false;
321729
321794
  }
321730
321795
  return true;
@@ -321798,6 +321863,16 @@ async function reviewActive(s, uid, card, a, landing, installation = tickInstall
321798
321863
  await fetchMain(a.worktree, installation);
321799
321864
  } else await fetchMain(a.worktree);
321800
321865
  autoCommitWorker(a);
321866
+ let markers2 = [];
321867
+ try {
321868
+ markers2 = addedConflictMarkers(a.worktree, installation?.baseRef() ?? engineBaseRef(), "HEAD");
321869
+ } catch (error48) {
321870
+ log2(`review ${card.id}: odczyt marker\xF3w: ${errorText5(error48)}`);
321871
+ }
321872
+ if (markers2.length) {
321873
+ await holdReviewJob(s, uid, card, `pozosta\u0142e markery konfliktu: ${markers2.join(", ")}`);
321874
+ return;
321875
+ }
321801
321876
  const ahead = git(["rev-list", "--count", `${engineBaseRef()}..HEAD`], a.worktree);
321802
321877
  if (!/^\d+$/.test(ahead)) throw new Error("Nie mo\u017Cna policzy\u0107 commit\xF3w workera");
321803
321878
  if (Number(ahead) === 0) {
@@ -322565,6 +322640,18 @@ async function consumeActive(s, uid, a = s.actives[0], landing = { available: tr
322565
322640
  } catch (error48) {
322566
322641
  log2(`worker report ${card.id}: odczyt HEAD: ${errorText5(error48)}`);
322567
322642
  }
322643
+ if (outcome.status === "WORKER_FINISHED" || outcome.status === "ALREADY_DONE") {
322644
+ try {
322645
+ const markers2 = addedConflictMarkers(a.worktree, installation?.baseRef() ?? engineBaseRef(), "HEAD");
322646
+ if (markers2.length) {
322647
+ const reason = `Pozosta\u0142e markery konfliktu: ${markers2.join(", ")}`;
322648
+ log2(`worker report ${card.id}: FAILED ${reason}`);
322649
+ outcome = { status: "FAILED", report: reason };
322650
+ }
322651
+ } catch (error48) {
322652
+ log2(`worker report ${card.id}: odczyt marker\xF3w: ${errorText5(error48)}`);
322653
+ }
322654
+ }
322568
322655
  let workerReportReceipt = null;
322569
322656
  if (output && (!openCodeJob || openCodeResult?.status === "completed")) {
322570
322657
  try {
@@ -324490,6 +324577,7 @@ async function dispatchCard(s, uid, projectId2, c, selection, installation, clie
324490
324577
  let unchangedInputHold = false;
324491
324578
  let recreatedPreparing = false;
324492
324579
  let rebaseConflict = "";
324580
+ let dispatchMarkers;
324493
324581
  let finalAdmissionSnapshot;
324494
324582
  let stamp2;
324495
324583
  const previousStreak = asRecord3(reserved2.details?.maszynista).dispatch_failure_streak;
@@ -324541,6 +324629,8 @@ async function dispatchCard(s, uid, projectId2, c, selection, installation, clie
324541
324629
  }
324542
324630
  if (!worktreeMissing || recreated) {
324543
324631
  let preparedBase;
324632
+ let preparedConflict = null;
324633
+ const previousBase = c.details?.base_sha;
324544
324634
  if (recreated) {
324545
324635
  try {
324546
324636
  preparedBase = git(["rev-parse", "--verify", `${installation?.baseRef() ?? engineBaseRef()}^{commit}`], TASK_REPO);
@@ -324588,19 +324678,52 @@ async function dispatchCard(s, uid, projectId2, c, selection, installation, clie
324588
324678
  ## Potwierdzony konflikt R${reviewRound}
324589
324679
  Rebase zosta\u0142 przerwany przez udany abort; HEAD, diff i indeks s\u0105 zachowane. Pliki konfliktu: ${conflictFiles.replace(/\n/g, ", ")}. Zachowaj t\u0119 ga\u0142\u0105\u017A i WIP. Rozwi\u0105\u017C konflikt z ${installation?.baseRef() ?? engineBaseRef()} zgodnie z zasadami pracy briefu; je\u015Bli wymaga zmiany pliku produkcyjnego poza zakresem lub decyzji, zachowaj prac\u0119 i zg\u0142o\u015B ACTIONABLE_BLOCKER z PYTANIE: do CR przez istniej\u0105cy raport terminalny. Nie zaczynaj od \u015Bwie\u017Cej bazy i nie wykonuj reset --hard.
324590
324680
  `;
324681
+ try {
324682
+ const base2 = preparedBase ?? git(["rev-parse", "--verify", `${installation?.baseRef() ?? engineBaseRef()}^{commit}`], TASK_REPO);
324683
+ if (!/^[a-f0-9]{40}$/.test(base2)) throw new Error("\u015Bwie\u017Ca baza UNKNOWN");
324684
+ preparedConflict = prepareConflictWorktree(worktree, branch, base2, candidate, snapshot2);
324685
+ if (preparedConflict) {
324686
+ preparedBase = base2;
324687
+ log2(`konflikt karta=${c.id} stary=${candidate.head} nowy=${preparedConflict.head} ref=${preparedConflict.ref} pliki=${preparedConflict.files.join(", ")}`);
324688
+ }
324689
+ } catch (error48) {
324690
+ throw new DispatchHold(`HOLD repair R${reviewRound}: przygotowanie konfliktu: ${errorText5(error48)}`, false);
324691
+ }
324591
324692
  }
324592
324693
  try {
324593
- if (preparedBase && !rebaseConflict) {
324694
+ if (preparedBase && (!rebaseConflict || preparedConflict)) {
324594
324695
  snapshot2();
324595
324696
  git(["merge-base", "--is-ancestor", preparedBase, "HEAD"], worktree);
324596
324697
  }
324597
324698
  sparseDirectories = configureSparseCheckout(worktree, c.details?.scope);
324598
- if (preparedBase && !rebaseConflict) await stampDispatchBase(uid, c, branch, preparedBase, false, installation);
324699
+ if (preparedConflict) dispatchMarkers = addedConflictMarkers(worktree, installation?.baseRef() ?? engineBaseRef(), "working");
324700
+ if (preparedBase && (!rebaseConflict || preparedConflict)) await stampDispatchBase(uid, c, branch, preparedBase, false, installation);
324599
324701
  } catch (error48) {
324702
+ if (preparedConflict) {
324703
+ try {
324704
+ preparedConflict.rollback();
324705
+ await appendBoundedDetail(uid, c.id, { base_sha: previousBase });
324706
+ c.details = { ...c.details, base_sha: previousBase };
324707
+ const restored = await getTask2(uid, c.id);
324708
+ if (restored?.details?.base_sha !== previousBase) throw new Error("odtworzenie bazy UNKNOWN");
324709
+ } catch (rollbackError) {
324710
+ throw new DispatchHold(`HOLD konflikt: ${errorText5(error48)}; rollback/baza: ${errorText5(rollbackError)}`, false);
324711
+ }
324712
+ throw new DispatchHold(`HOLD konflikt: przygotowanie/zapis bazy: ${errorText5(error48)}`, false);
324713
+ }
324600
324714
  if (recreated) throw new DispatchHold(`HOLD recreated: przygotowanie/zapis bazy po rebase: ${errorText5(error48)}`, false);
324601
324715
  throw error48;
324602
324716
  }
324603
324717
  }
324718
+ try {
324719
+ const markers2 = dispatchMarkers ?? addedConflictMarkers(worktree, installation?.baseRef() ?? engineBaseRef(), "working");
324720
+ if (markers2.length) rebaseConflict = `
324721
+ ## Potwierdzony konflikt R${counter(asRecord3(c.details?.review).round)}
324722
+ Pliki konfliktu: ${markers2.join(", ")}. usu\u0144 markery zachowuj\u0105c obie zmiany; pliki wyliczane odtw\xF3rz ich generatorem, bez r\u0119cznego scalania. Nie wykonuj git zmieniaj\u0105cego histori\u0119; commit zrobi silnik. Respektuj dotychczasowy write-set; poza zakresem lub decyzja \u2192 ACTIONABLE_BLOCKER z PYTANIE: do CR.
324723
+ `;
324724
+ } catch (error48) {
324725
+ throw new DispatchHold(`HOLD dispatch: odczyt marker\xF3w UNKNOWN: ${errorText5(error48)}`, false);
324726
+ }
324604
324727
  (installation?.prepareWorktree ?? prepareHostWorktree)(worktree);
324605
324728
  const sparseGuard = [
324606
324729
  "",
@@ -327428,7 +327551,7 @@ async function main2() {
327428
327551
  if (client && result.outcome !== "ok") console.error(`Fabryka ${result.outcome === "stop" ? "zatrzymana" : "retry"}: ${result.reason}${result.cleanup ? "; finalizacja niepotwierdzona \u2014 sprawd\u017A stan i blokad\u0119" : ""}`);
327429
327552
  return client && result.outcome === "stop" ? 2 : code;
327430
327553
  }
327431
- var import_node_fs47, import_gray_matter2, import_node_child_process20, import_node_os14, import_node_sqlite4, import_node_util14, import_node_crypto32, import_node_path52, TASK_REPO, ASSIGNEE, CODEX_HELPER, WORKER_TIMEOUT_MIN, WORKER_MODELS_CONFIG, OPENCODE_LEDGER, MAX_ATTEMPTS, REVIEW_JOB_EXCLUDE, TESTER_DETAILS_KEYS, TESTER_RECOVERY_DETAILS_KEYS, LOCAL_TESTER_LIST_DETAILS_KEYS, CARD_OWNER_DETAILS_KEYS, LANDING_RECOVERY_DETAILS_KEYS, ACTIONABLE_BLOCKER_DETAILS_KEYS, REVIEW_RECOVERY_IDENTITY_KEYS, REVIEW_RECOVERY_DETAILS_KEYS, REVIEW_RECOVERY_FIELDS, REVIEW_SCAN_FIELDS, DECISION_QUEUE_SCAN_FIELDS, DECISION_REFRESH_DETAILS_KEYS, BLOCKED_WORKER_DETAILS_KEYS, ENABLED_SCAN_DETAILS_KEYS, RESERVATION_DETAILS_KEYS, RESERVATION_SCAN_DETAILS_KEYS, OBLIGATION_DETAILS_KEYS, READY_DETAILS_KEYS, RECOVERY_DETAILS_KEYS, PROMOTION_BOARD_DETAILS_KEYS, PROMOTION_DRAFT_DETAILS_KEYS, DRAFT_SUPPLY_DETAILS_KEYS, SCAN_OPTIONS, PROMOTION_BOARD_STATUSES, NORTH_STAR, AUTHORITY, RUNTIME_FILES, STATE2, REVIEW_LAST, HOST_MIN_FREE_GIB, HOST_UNBLOCK_FREE_GIB, DISK_ARTIFACT_MIN_AGE_MS, hostOperationsWakeDb, responseGuardReadErrorLogged, crLivenessIdentityLogged, crBlockerIdentityLogged, tickInstallation, CODEX_LIFECYCLE_HOOK, REQUIRED_CHECKS2, CI_QUEUE_CEILING_MS, reviewText, LAST_TICK, DECISIONS, DECISIONS_REKSIO, BLOCKED_TECH, TEST_LAST, FOR_HERMES, LOCK2, LOG2, configuredTickLimitMs, TICK_LIMIT_MS, START_BUDGET_MS, LAND_BUDGET_MS, TESTER_COMMAND_CEILING_MS, TESTER_FLAKE_RERUN_MS, tickDeadline, DRY2, loadedSha, mainSha, hostStateDir, loadEnvFiles2, SshAuthExhausted, DispatchHold, CODEX_PLUGIN_DATA, EXECUTION_ENV_ALLOWLIST, northStarDeps, skippedCardEvents, LEAD_CLASSES, LEAD_AGENT_WAITING, LEAD_OWNER_WAKE_LIMIT, leadWakeDbMissingLogged, rulingSha, FLAKE_REPAIR_DETAILS_KEYS, flakeKey, ClientReviewBaseChanged, testerRetestRepo, TESTER_RETEST_BACKOFF_BASE_MS, TESTER_RETEST_BACKOFF_MAX_MS, TESTER_RETEST_MAX_ERRORS, TESTER_IDENTITY_RECOVERY_LIMIT, selectorUnavailableTicks, crBlockerIssueLogged, uncertainStarts, processCards;
327554
+ var import_node_fs47, import_gray_matter2, import_node_child_process20, import_node_os14, import_node_sqlite4, import_node_util14, import_node_crypto32, import_node_path52, TASK_REPO, ASSIGNEE, CODEX_HELPER, WORKER_TIMEOUT_MIN, WORKER_MODELS_CONFIG, OPENCODE_LEDGER, MAX_ATTEMPTS, REVIEW_JOB_EXCLUDE, TESTER_DETAILS_KEYS, TESTER_RECOVERY_DETAILS_KEYS, LOCAL_TESTER_LIST_DETAILS_KEYS, CARD_OWNER_DETAILS_KEYS, LANDING_RECOVERY_DETAILS_KEYS, ACTIONABLE_BLOCKER_DETAILS_KEYS, REVIEW_RECOVERY_IDENTITY_KEYS, REVIEW_RECOVERY_DETAILS_KEYS, REVIEW_RECOVERY_FIELDS, REVIEW_SCAN_FIELDS, DECISION_QUEUE_SCAN_FIELDS, DECISION_REFRESH_DETAILS_KEYS, BLOCKED_WORKER_DETAILS_KEYS, ENABLED_SCAN_DETAILS_KEYS, RESERVATION_DETAILS_KEYS, RESERVATION_SCAN_DETAILS_KEYS, OBLIGATION_DETAILS_KEYS, READY_DETAILS_KEYS, RECOVERY_DETAILS_KEYS, PROMOTION_BOARD_DETAILS_KEYS, PROMOTION_DRAFT_DETAILS_KEYS, DRAFT_SUPPLY_DETAILS_KEYS, SCAN_OPTIONS, PROMOTION_BOARD_STATUSES, NORTH_STAR, AUTHORITY, RUNTIME_FILES, STATE2, REVIEW_LAST, HOST_MIN_FREE_GIB, HOST_UNBLOCK_FREE_GIB, DISK_ARTIFACT_MIN_AGE_MS, hostOperationsWakeDb, responseGuardReadErrorLogged, crLivenessIdentityLogged, crBlockerIdentityLogged, tickInstallation, CODEX_LIFECYCLE_HOOK, REQUIRED_CHECKS2, CI_QUEUE_CEILING_MS, reviewText, LAST_TICK, DECISIONS, DECISIONS_REKSIO, BLOCKED_TECH, TEST_LAST, FOR_HERMES, LOCK2, LOG2, configuredTickLimitMs, TICK_LIMIT_MS, START_BUDGET_MS, LAND_BUDGET_MS, TESTER_COMMAND_CEILING_MS, TESTER_FLAKE_RERUN_MS, tickDeadline, DRY2, loadedSha, mainSha, hostStateDir, loadEnvFiles2, CONFLICT_PREPARATION_SUBJECT, SshAuthExhausted, DispatchHold, CODEX_PLUGIN_DATA, EXECUTION_ENV_ALLOWLIST, northStarDeps, skippedCardEvents, LEAD_CLASSES, LEAD_AGENT_WAITING, LEAD_OWNER_WAKE_LIMIT, leadWakeDbMissingLogged, rulingSha, FLAKE_REPAIR_DETAILS_KEYS, flakeKey, ClientReviewBaseChanged, testerRetestRepo, TESTER_RETEST_BACKOFF_BASE_MS, TESTER_RETEST_BACKOFF_MAX_MS, TESTER_RETEST_MAX_ERRORS, TESTER_IDENTITY_RECOVERY_LIMIT, selectorUnavailableTicks, crBlockerIssueLogged, uncertainStarts, processCards;
327432
327555
  var init_tick = __esm({
327433
327556
  "maszynista/tick.ts"() {
327434
327557
  import_node_fs47 = require("node:fs");
@@ -327584,6 +327707,7 @@ var init_tick = __esm({
327584
327707
  mainSha = "UNKNOWN";
327585
327708
  hostStateDir = () => engineHostStateDir();
327586
327709
  loadEnvFiles2 = loadEnvFiles;
327710
+ CONFLICT_PREPARATION_SUBJECT = "maszynista: przygotowanie konfliktu z main";
327587
327711
  SshAuthExhausted = class extends Error {
327588
327712
  };
327589
327713
  DispatchHold = class extends Error {
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.38 \u2014 plik zarz\u0105dzany przez `npx robisie`; `npx robisie uninstall` go usunie -->";
20
+ export declare const MANAGED_LINE = "<!-- robisie:managed 0.5.40 \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.38) <!-- x-release-please-version -->
1
+ # robisie — from account to accepted card (package 0.5.40) <!-- 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
 
package/docs/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # robisie — od konta do odebranej karty (paczka 0.5.38) <!-- x-release-please-version -->
1
+ # robisie — od konta do odebranej karty (paczka 0.5.40) <!-- 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robisie",
3
- "version": "0.5.38",
3
+ "version": "0.5.40",
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",
@@ -64,6 +64,18 @@ async function readCompleteCard(cardRef) {
64
64
 
65
65
  Use the complete second result as the card. The index response is never evidence of complete details. Both indexes must be arrays of strings: [] to [] passes the key check; a missing or null second index fails it. If keys are unreadable or change, report the read failure through the existing failure path; do not continue with partial content.
66
66
 
67
+ ## Facts before diagnosis and questions (P2)
68
+
69
+ Before delegating investigation, seeking diagnostic help, or asking about a fact, first measure at the source: `get_board`, the relevant complete two-call `get_task` read above, and available evidence. Reuse already required reads; spend at most five minutes and stop earlier once the fact is resolved. Use no clock or schedule; never wait for the limit. If the source answers the question, do not ask it. If unresolved, name the exact remaining fact and request help only for that gap. Keep questions about intent, scope, and taste; never guess the operator's answer.
70
+
71
+ Perform preparatory measurement before entering a strict sequence; inside it, reuse only its required reads, with no new calls, reordering, or repetition. For an unreadable or changed key index, follow Complete card reads and its existing read-failure path, never partial content. Measuring state and evidence availability is not judging result quality: never replace or skip required independent review, and add no five-minute wait to that review.
72
+
73
+ ## Learn from repeated evidence (P1)
74
+
75
+ When evidence establishes a second occurrence of the same problem or lesson, compare both occurrences and propose one concrete change to instructions or procedure to the operator. Another note, a blind retry, or a repeated request alone do not resolve the recurrence. Describe the proposal's effect and way of working without tool, stage, or role names. This is a proposal, with no authority to change your role or scope yourself or bypass a refusal.
76
+
77
+ With missing, null, empty, or unreadable evidence, never invent a recurrence or cause: perform the allowed bounded measurement under P2, then name the specific missing evidence. Use readable historical evidence on the same terms as current evidence. Add no schema, counter, data repair, or global HOLD. Preserve all blocked-card mutation limits and the sole local receiver return exception below.
78
+
67
79
  ## Discover the operator's intent
68
80
 
69
81
  Ask at most four focused questions, one question at a time. Skip any answer the operator has already supplied:
@@ -183,7 +195,7 @@ After one card advances, read the board again and intentionally release the next
183
195
  ## Fail closed
184
196
 
185
197
  - If a board read or write fails, stop that transition, re-read when possible, and tell the operator which outcome did not happen.
186
- - Leave the card in `ready` when the launcher fails, say that work did not start, and offer a safe retry of the same idempotent command.
198
+ - Leave the card in `ready` when the launcher fails, say that work did not start, and offer a safe retry of the same idempotent command only after its named cause has been resolved, never blindly; apply P2 before diagnosis and P1 to documented recurrence.
187
199
  - Leave the card in `in_review` when the runtime-specific independent reviewer is unavailable, its direct receipt is missing or malformed, or mechanical verification fails.
188
200
  - If a tool response is ambiguous, verify with `get_task`; absence of evidence is not success.
189
201
  - Never ask the operator to paste a credential into chat or a card. Ask them to restore secure environment configuration outside the conversation.
@@ -196,6 +208,8 @@ After a restart, interruption, or shortened context, repeat authenticated `list_
196
208
 
197
209
  Rebuild the operator update from the live statuses, card details, recorded evidence, and unresolved decisions. Do not trust a conversation summary as the source of state, do not repeat completed discovery questions, and do not launch or advance anything until the board confirms where the work stands.
198
210
 
211
+ Apply P1 and P2 to recovered evidence too: a second documented occurrence requires one proposal; measure unresolved facts before diagnostic help or questions using the same bounded reads and limits.
212
+
199
213
  ## Mandatory visible-message self-check
200
214
 
201
215
  Immediately before emitting text during a dispatch, apply this final protocol: