robisie 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Historia zmian klienta / Client changelog
2
2
 
3
+ ## [0.4.0](https://github.com/chuppa12/robisie-app/compare/client-v0.3.0...client-v0.4.0) (2026-11-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * **client:** doctor reads the project's review policy (enforced) ([7aa3501](https://github.com/chuppa12/robisie-app/commit/7aa35018a259ecbb126e0fde5542d524464eff17))
9
+ * **client:** doctor reads the project's review policy (enforced) from list_projects ([8f667b1](https://github.com/chuppa12/robisie-app/commit/8f667b12212330aedb39f0c989aa10da9c2d7b5e))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **client:** 0.3.1 local acceptance STOP isolation, review reason, Grok stderr, agent-install README, 10-min publish window ([076ad80](https://github.com/chuppa12/robisie-app/commit/076ad80f43392f107baad3d19fc3aada6bc0187f))
15
+ * **client:** doctor ignores a client.close() failure after a successful policy read ([c0ac19a](https://github.com/chuppa12/robisie-app/commit/c0ac19a460fa7be8ea0c7596c7a4c72ae2e627de))
16
+ * **client:** local acceptance HOLD applies only to a card still in_review ([8660384](https://github.com/chuppa12/robisie-app/commit/86603842269e88057eb80792fb73eb841c5fde9b))
17
+ * **client:** local acceptance STOP isolates the card, shows server reason and Grok stderr ([7e6cbd1](https://github.com/chuppa12/robisie-app/commit/7e6cbd181e04425ec913cc8fba047fc9bd43de2e))
18
+ * **client:** README agent-install block and 10-minute npm visibility window ([7c61223](https://github.com/chuppa12/robisie-app/commit/7c6122368e21113ff341cc414e1ee66a34096321))
19
+
3
20
  ## [0.3.0](https://github.com/chuppa12/robisie-app/compare/client-v0.2.2...client-v0.3.0) (2026-11-10)
4
21
 
5
22
 
package/dist/cli.js CHANGED
@@ -17,7 +17,7 @@ const HELP = `robisie ${PACKAGE_VERSION} — łączy Twojego agenta z tablicą r
17
17
 
18
18
  npx robisie login paruje instalację: kod i link zatwierdzasz w przeglądarce, klucze A i B trafiają prosto do plików
19
19
  npx robisie init klucze A (ROBISIE_KEY) i B (ROBISIE_REVIEW_KEY), osobne ukryte pytania + konfiguracja MCP + role klienta
20
- npx robisie doctor sprawdza A i B, wersję kontraktu i role; enforced: NIE SPRAWDZONO
20
+ npx robisie doctor sprawdza A i B, wersję kontraktu, role i politykę enforced projektu
21
21
  npx robisie uninstall usuwa wpisy robisie i role; zachowuje kopie zapasowe
22
22
  npx robisie factory run nadzoruje kolejne takty silnika (Linux, Node.js >=24)
23
23
  npx robisie mcp <${HELPER_SERVERS.join("|")}>
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 { PlanerClient } from "./planer-client.js";
17
18
  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ą).";
18
19
  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\`.`;
19
20
  const ENV_KEY_FORMAT_STEP = `W zsh/bash wykonaj \`unset ROBISIE_KEY\` — ENV ma pierwszeństwo przed pytaniem, stdin i plikiem. ${KEY_FORMAT_STEP}`;
@@ -325,7 +326,7 @@ function pairReadiness(ctx, fail) {
325
326
  }
326
327
  /** Returns the process exit code: 0 = all good, 1 = something needs one action. */
327
328
  export async function doctor(ctx) {
328
- ctx.out("! Polityka enforced: NIE SPRAWDZONO — klient nie ma API jej odczytu.");
329
+ let policyLine = "! Polityka enforced: NIE SPRAWDZONO — odczyt nieudany.";
329
330
  const problems = [];
330
331
  const fail = (line, nextStep) => {
331
332
  ctx.out(`✗ ${line}`);
@@ -387,10 +388,31 @@ export async function doctor(ctx) {
387
388
  if (connection.contractVersion)
388
389
  assertCompatible(connection.contractVersion);
389
390
  ctx.out(`✓ Połączenie działa: klucz otwiera tablicę (projektów: ${connection.projectCount}).`);
390
- if (connection.projectCount !== 1)
391
+ if (connection.projectCount !== 1) {
391
392
  fail(`CEO wymaga dokładnie 1 projektu (projektów: ${connection.projectCount}).`, ceoProjectStep(connection.projectCount));
393
+ policyLine = "! Polityka enforced: NIE SPRAWDZONO — brak jednoznacznego projektu.";
394
+ return;
395
+ }
396
+ try {
397
+ const client = new PlanerClient({ origin: ctx.origin, token: usableKey, fetch: ctx.fetch });
398
+ try {
399
+ await client.connect();
400
+ const projects = await client.listProjects();
401
+ const policy = projects.length === 1 ? projects[0]?.reviewPolicy : undefined;
402
+ policyLine = policy === "enforced" ? "✓ Polityka enforced: TAK"
403
+ : policy === "legacy" ? "! Polityka enforced: NIE (projekt ma politykę legacy) — odbiór B (accept_review) będzie odmawiany; poproś operatora Robisie o ustawienie enforced dla tego projektu"
404
+ : "! Polityka enforced: NIE SPRAWDZONO — serwer nie zwraca polityki.";
405
+ }
406
+ finally {
407
+ await client.close().catch(() => undefined);
408
+ }
409
+ }
410
+ catch {
411
+ policyLine = "! Polityka enforced: NIE SPRAWDZONO — odczyt nieudany.";
412
+ }
392
413
  });
393
414
  }
415
+ ctx.out(policyLine);
394
416
  await guard(async () => {
395
417
  if (!usableKey || !KEY_PATTERN.test(usableKey))
396
418
  return;
@@ -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.3.0";
3
+ export declare const PACKAGE_VERSION = "0.4.0";
4
4
  /**
5
5
  * MAJOR of the agent-API contract this package understands.
6
6
  * PARITY: src/lib/mcp/contract-version.ts (AGENT_API_CONTRACT_VERSION) on the server.
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /** Package identity and the server contract it speaks. */
2
2
  export const PACKAGE_NAME = "robisie";
3
- export const PACKAGE_VERSION = "0.3.0"; // x-release-please-version
3
+ export const PACKAGE_VERSION = "0.4.0"; // x-release-please-version
4
4
  /**
5
5
  * MAJOR of the agent-API contract this package understands.
6
6
  * PARITY: src/lib/mcp/contract-version.ts (AGENT_API_CONTRACT_VERSION) on the server.
@@ -1655,14 +1655,14 @@
1655
1655
  "staticOperations": {
1656
1656
  "beforePreflight": {
1657
1657
  "module": "maszynista/tick.ts",
1658
- "startLine": 9177,
1659
- "endLine": 9289,
1658
+ "startLine": 9186,
1659
+ "endLine": 9298,
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": 9578,
1665
- "endLine": 9630,
1664
+ "startLine": 9587,
1665
+ "endLine": 9639,
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": {
@@ -1688,6 +1688,6 @@
1688
1688
  "status": 0,
1689
1689
  "signal": null,
1690
1690
  "stdout": "v24.3.0\n",
1691
- "stderr": "(node:14004) 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:14182) 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
  }
@@ -36339,13 +36339,16 @@ async function withProjectTx(userId, fn) {
36339
36339
  throw new Error("Co\u015B posz\u0142o nie tak. Spr\xF3buj ponownie.");
36340
36340
  }
36341
36341
  function listProjects(userId, options2 = {}) {
36342
- return withAppUserTx(
36343
- userId,
36344
- (db) => db.select().from(plannerProjects).where(and(
36342
+ return withAppUserTx(userId, async (db) => {
36343
+ const projects = await db.select().from(plannerProjects).where(and(
36345
36344
  eq(plannerProjects.userId, userId),
36346
36345
  options2.includeArchived ? void 0 : isNull(plannerProjects.archivedAt)
36347
- )).orderBy(asc(plannerProjects.createdAt))
36348
- );
36346
+ )).orderBy(asc(plannerProjects.createdAt));
36347
+ if (projects.length === 0) return [];
36348
+ const policies = await db.select({ projectId: plannerReviewPolicies.projectId, mode: plannerReviewPolicies.mode }).from(plannerReviewPolicies).where(eq(plannerReviewPolicies.userId, userId));
36349
+ const byProject = new Map(policies.map((policy) => [policy.projectId, policy.mode]));
36350
+ return projects.map((project) => ({ ...project, reviewPolicy: byProject.get(project.id) ?? null }));
36351
+ });
36349
36352
  }
36350
36353
  async function createProject(userId, input) {
36351
36354
  const name3 = validProjectName(input.name);
@@ -37625,7 +37628,7 @@ var init_constants = __esm({
37625
37628
  "packages/client/src/constants.ts"() {
37626
37629
  "use strict";
37627
37630
  PACKAGE_NAME = "robisie";
37628
- PACKAGE_VERSION = "0.3.0";
37631
+ PACKAGE_VERSION = "0.4.0";
37629
37632
  SUPPORTED_CONTRACT_MAJOR = 1;
37630
37633
  DEFAULT_ORIGIN = "https://robisie.app";
37631
37634
  MCP_SERVER_NAME = "robisie";
@@ -74791,6 +74794,7 @@ var init_planer_client = __esm({
74791
74794
  this.operation = operation;
74792
74795
  this.uncertain = uncertain;
74793
74796
  this.name = "PlanerClientError";
74797
+ if (diagnostic?.gateReason !== void 0) this.gateReason = diagnostic.gateReason;
74794
74798
  if (diagnostic?.plannerCode !== void 0) this.plannerCode = diagnostic.plannerCode;
74795
74799
  if (diagnostic?.requestId !== void 0) this.requestId = diagnostic.requestId;
74796
74800
  if (diagnostic?.plannerMeta !== void 0) this.plannerMeta = diagnostic.plannerMeta;
@@ -74845,7 +74849,7 @@ var init_planer_client = __esm({
74845
74849
  freeText = external_exports.string().max(2e3);
74846
74850
  name2 = external_exports.string().min(1).max(500);
74847
74851
  date9 = external_exports.iso.datetime({ offset: true });
74848
- projectSchema = external_exports.object({ id: uuid8, name: external_exports.string(), slug: external_exports.string() });
74852
+ projectSchema = external_exports.object({ id: uuid8, name: external_exports.string(), slug: external_exports.string(), reviewPolicy: external_exports.enum(["legacy", "enforced"]).nullable().optional() });
74849
74853
  trackSchema = external_exports.object({ id: uuid8, projectId: uuid8, name: external_exports.string(), position: external_exports.number().int() });
74850
74854
  taskSchema = external_exports.object({
74851
74855
  id: uuid8,
@@ -75072,7 +75076,14 @@ var init_planer_client = __esm({
75072
75076
  if (result.content.length !== 1 || result.content[0]?.type !== "text") throw new Error("Invalid tool content");
75073
75077
  value = JSON.parse(result.content[0].text);
75074
75078
  } catch {
75075
- throw new PlanerClientError(result.isError ? "TOOL_ERROR" : "INVALID_RESPONSE", operation, mutation);
75079
+ const text9 = result.content.length === 1 && result.content[0]?.type === "text" ? result.content[0].text : "";
75080
+ const gateReason = result.isError && text9.startsWith("Brama recenzji: ") && text9.trim().length <= 200 && !/[\p{C}\p{Zl}\p{Zp}]/u.test(text9) ? text9.trim() : void 0;
75081
+ throw new PlanerClientError(
75082
+ result.isError ? "TOOL_ERROR" : "INVALID_RESPONSE",
75083
+ operation,
75084
+ mutation,
75085
+ gateReason === void 0 ? void 0 : { gateReason }
75086
+ );
75076
75087
  }
75077
75088
  return { value, isError: result.isError === true };
75078
75089
  }
@@ -76385,7 +76396,10 @@ function callLocalReceiver(input, dir) {
76385
76396
  "low"
76386
76397
  ];
76387
76398
  const result = (0, import_node_child_process7.spawnSync)("grok", args, { cwd: dir, env: localReceiverEnv(), encoding: "utf8", timeout: 18e4, maxBuffer: 256 * 1024 });
76388
- if (result.error || result.status !== 0) throw result.error ?? new Error(`Grok exit=${result.status}`);
76399
+ if (result.error || result.status !== 0) {
76400
+ const stderr = (result.stderr ?? "").replace(new RegExp("\\p{C}", "gu"), "").trim().slice(0, 200);
76401
+ throw result.error ?? new Error(`Grok exit=${result.status}${stderr ? `: ${stderr}` : ""}`);
76402
+ }
76389
76403
  const envelope = record8(JSON.parse(result.stdout)), models = Object.keys(record8(envelope.modelUsage));
76390
76404
  if (envelope.stopReason !== "end_turn" || models.length !== 1 || !/^grok-/.test(models[0])) throw new Error("Niepotwierdzony model/terminal Groka");
76391
76405
  return { output: envelope.structuredOutput ?? null, invocation: {
@@ -78018,6 +78032,7 @@ async function acceptLocalDelivery(api, cardId, receiver) {
78018
78032
  const intentFile = `${receiver.archive}.acceptance.json`;
78019
78033
  const intentValue = readJson4(intentFile, true);
78020
78034
  let intent = intentValue;
78035
+ let acceptError;
78021
78036
  let current = await read();
78022
78037
  const prepared = aligned(current);
78023
78038
  if (intent && (intent.packetHash !== receiver.packetHash || !intent.prepared || !intent.request || intent.request.id !== cardId || intent.request.cardId !== cardId || intent.request.projectId !== current.projectId || intent.request.providerDeclared !== provider || !prepared)) return stop("obcy zapis \u017C\u0105dania odbioru");
@@ -78067,12 +78082,16 @@ async function acceptLocalDelivery(api, cardId, receiver) {
78067
78082
  }
78068
78083
  try {
78069
78084
  await api.acceptReview(request2);
78070
- } catch {
78085
+ } catch (error48) {
78086
+ acceptError = error48;
78071
78087
  }
78072
78088
  current = await read();
78073
78089
  }
78074
78090
  const confirmed = (card) => {
78075
- if (!["delivered", "done"].includes(card.status)) return stop("niepotwierdzony odbi\xF3r; diagnoza bez ponowienia acceptReview");
78091
+ if (!["delivered", "done"].includes(card.status)) {
78092
+ const reason = acceptError instanceof PlanerClientError ? (acceptError.gateReason ?? acceptError.code).slice(0, 200) : void 0;
78093
+ return stop(`niepotwierdzony odbi\xF3r${reason ? `: ${reason}` : ""}; diagnoza bez ponowienia acceptReview`);
78094
+ }
78076
78095
  const receipt = storedReview(card);
78077
78096
  if (!receipt || !matchesSnapshot(receipt, intent.request) || receipt.providerDeclared !== provider) return stop("obcy receipt/submission/provider");
78078
78097
  const comparable = (task) => {
@@ -78109,6 +78128,7 @@ var init_local_acceptance = __esm({
78109
78128
  import_node_crypto16 = require("node:crypto");
78110
78129
  import_node_util7 = require("node:util");
78111
78130
  init_zod();
78131
+ init_planer_client();
78112
78132
  init_done_evidence();
78113
78133
  init_delivered_gate();
78114
78134
  init_local_receiver();
@@ -320444,11 +320464,19 @@ async function localAcceptancePhase(s, uid, dry, snapshot2, installation) {
320444
320464
  throw new Error("Nie mo\u017Cna odczyta\u0107 archiwum odbioru lokalnego", { cause });
320445
320465
  }
320446
320466
  if (!installation?.localAcceptance) throw new Error("Brak kontekstu localAcceptance");
320447
- const confirmed = await acceptLocalDelivery2(await installation.localAcceptance(), card.id, completion2);
320448
- snapshot2?.set(card.id, confirmed);
320449
- rememberProcessCards(s, [confirmed]);
320450
- s.done_auto++;
320451
- lastTick(s, "acceptance-local", "Chroniony odbi\xF3r lokalny \u2192 done", true, card.id);
320467
+ if ((0, import_node_fs47.existsSync)(`${ref}.acceptance.json`) && (0, import_node_fs47.existsSync)(`${ref}.acceptance-stop.json`) && card.status === "in_review") continue;
320468
+ try {
320469
+ const confirmed = await acceptLocalDelivery2(await installation.localAcceptance(), card.id, completion2);
320470
+ snapshot2?.set(card.id, confirmed);
320471
+ rememberProcessCards(s, [confirmed]);
320472
+ s.done_auto++;
320473
+ lastTick(s, "acceptance-local", "Chroniony odbi\xF3r lokalny \u2192 done", true, card.id);
320474
+ } catch (error48) {
320475
+ if (!(error48 instanceof Error) || !error48.message.startsWith("STOP odbioru lokalnego:")) throw error48;
320476
+ const reason = error48.message;
320477
+ (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 });
320478
+ log2(`HOLD odbioru lokalnego ${card.id}: ${reason}`);
320479
+ }
320452
320480
  }
320453
320481
  }
320454
320482
  async function testerPhase(s, uid, projectId2, dry = DRY2, runtime = loadedSha, snapshot2, installation = tickInstallation) {
@@ -13,7 +13,7 @@ export type PlanerClientConfig = ({
13
13
  };
14
14
  type Operation = "connect" | "close" | "list_projects" | "list_tracks" | "list_tasks" | "get_task" | "reserve_task" | "update_task" | "append_detail" | "close_decision_matter" | "get_review_snapshot" | "accept_review" | "create_track" | "create_task" | "move_task" | "write_decision_matter";
15
15
  type Failure = "INVALID_CONFIG" | "INVALID_ARGUMENT" | "NOT_CONNECTED" | "CLOSED" | "CONTRACT_VERSION" | "UNSUPPORTED_CONTRACT" | "INVALID_RESPONSE" | "DETAILS_READ_ERROR" | "TOOL_ERROR" | "UNAUTHORIZED" | "FORBIDDEN" | "RATE_LIMITED" | "HTTP_ERROR" | "RPC_ERROR" | "TRANSPORT_ERROR" | "TIMEOUT";
16
- /** Fixed reason only. In particular, never attach SDK message, cause, raw body or caller arguments. */
16
+ /** Only allowlisted diagnostics. Never attach SDK message, cause, raw body or caller arguments. */
17
17
  export declare class PlanerClientError extends Error {
18
18
  readonly code: Failure;
19
19
  readonly operation: Operation;
@@ -25,7 +25,9 @@ export declare class PlanerClientError extends Error {
25
25
  plannerCode?: string;
26
26
  requestId?: string;
27
27
  plannerMeta?: Record<string, unknown>;
28
+ gateReason?: string;
28
29
  });
30
+ readonly gateReason?: string;
29
31
  readonly plannerCode?: string;
30
32
  readonly requestId?: string;
31
33
  readonly plannerMeta?: Record<string, unknown>;
@@ -36,6 +38,10 @@ declare const projectSchema: z.ZodObject<{
36
38
  id: z.ZodUUID;
37
39
  name: z.ZodString;
38
40
  slug: z.ZodString;
41
+ reviewPolicy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
42
+ legacy: "legacy";
43
+ enforced: "enforced";
44
+ }>>>;
39
45
  }, z.core.$strip>;
40
46
  declare const trackSchema: z.ZodObject<{
41
47
  id: z.ZodUUID;
@@ -4,7 +4,7 @@ import { CallToolResultSchema, ErrorCode, McpError } from "@modelcontextprotocol
4
4
  import { z } from "zod";
5
5
  import { CONTRACT_VERSION_HEADER, KEY_PATTERN, PACKAGE_NAME, PACKAGE_VERSION, mcpUrl } from "./constants.js";
6
6
  import { assertCompatible } from "./mcp.js";
7
- /** Fixed reason only. In particular, never attach SDK message, cause, raw body or caller arguments. */
7
+ /** Only allowlisted diagnostics. Never attach SDK message, cause, raw body or caller arguments. */
8
8
  export class PlanerClientError extends Error {
9
9
  code;
10
10
  operation;
@@ -17,6 +17,8 @@ export class PlanerClientError extends Error {
17
17
  this.operation = operation;
18
18
  this.uncertain = uncertain;
19
19
  this.name = "PlanerClientError";
20
+ if (diagnostic?.gateReason !== undefined)
21
+ this.gateReason = diagnostic.gateReason;
20
22
  if (diagnostic?.plannerCode !== undefined)
21
23
  this.plannerCode = diagnostic.plannerCode;
22
24
  if (diagnostic?.requestId !== undefined)
@@ -49,7 +51,7 @@ const boundedObject = jsonObject.refine(value => new TextEncoder().encode(JSON.s
49
51
  const freeText = z.string().max(2000);
50
52
  const name = z.string().min(1).max(500);
51
53
  const date = z.iso.datetime({ offset: true });
52
- const projectSchema = z.object({ id: uuid, name: z.string(), slug: z.string() });
54
+ const projectSchema = z.object({ id: uuid, name: z.string(), slug: z.string(), reviewPolicy: z.enum(["legacy", "enforced"]).nullable().optional() });
53
55
  const trackSchema = z.object({ id: uuid, projectId: uuid, name: z.string(), position: z.number().int() });
54
56
  const taskSchema = z.object({ id: uuid, projectId: uuid, trackId: uuid, title: z.string(), status,
55
57
  assignee: z.string().nullable(), dependsOn: z.array(uuid), specRef: z.string().nullable(), createdAt: date, updatedAt: date,
@@ -278,7 +280,11 @@ export class PlanerClient {
278
280
  value = JSON.parse(result.content[0].text);
279
281
  }
280
282
  catch {
281
- throw new PlanerClientError(result.isError ? "TOOL_ERROR" : "INVALID_RESPONSE", operation, mutation);
283
+ const text = result.content.length === 1 && result.content[0]?.type === "text" ? result.content[0].text : "";
284
+ // Plain-text gate refusal is the sole exception to untrusted network-text suppression.
285
+ const gateReason = result.isError && text.startsWith("Brama recenzji: ") && text.trim().length <= 200
286
+ && !/[\p{C}\p{Zl}\p{Zp}]/u.test(text) ? text.trim() : undefined;
287
+ throw new PlanerClientError(result.isError ? "TOOL_ERROR" : "INVALID_RESPONSE", operation, mutation, gateReason === undefined ? undefined : { gateReason });
282
288
  }
283
289
  return { value, isError: result.isError === true };
284
290
  }
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.3.0 \u2014 plik zarz\u0105dzany przez `npx robisie`; `npx robisie uninstall` go usunie -->";
20
+ export declare const MANAGED_LINE = "<!-- robisie:managed 0.4.0 \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.3.0)
1
+ # robisie — from account to accepted card (package 0.4.0)
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
 
@@ -468,7 +468,7 @@ CLI messages remain in Polish. Match the message, then follow the English explan
468
468
  Generate a new worker key; in zsh/bash run `unset ROBISIE_KEY`, then init with the hidden prompt.
469
469
  - **brak-odczytu** — `Ten klucz nie ma uprawnień do odczytu tablicy (np. rola seeder).`
470
470
  Select worker in Connect; `unset ROBISIE_KEY`, then init with the hidden prompt.
471
- - **major** — `Wersja kontraktu serwera (2.0.0) nie pasuje do paczki robisie 0.3.0 (obsługuje 1.x).`
471
+ - **major** — `Wersja kontraktu serwera (2.0.0) nie pasuje do paczki robisie 0.4.0 (obsługuje 1.x).`
472
472
  Example of a MAJOR mismatch: install a release compatible with the server contract.
473
473
  - **brak-env** — `Zmienna ROBISIE_KEY nie jest ustawiona — role i agenci jej potrzebują.`
474
474
  Check profile support; with --no-shell/another shell load the key file into the session environment as shown in init, then doctor.
package/docs/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # robisie — od konta do odebranej karty (paczka 0.3.0)
1
+ # robisie — od konta do odebranej karty (paczka 0.4.0)
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
 
@@ -75,6 +75,8 @@ Trzy role instalatora używają jednego dostawcy: CEO (`ceo`), Builder (`builder
75
75
 
76
76
  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.
77
77
 
78
+ Agent bez terminala interaktywnego korzysta z [instalacji przez agenta](#instalacja-agenta).
79
+
78
80
  Po przygotowaniu konta i klucza człowiek otwiera terminal i wchodzi do wybranego pustego katalogu (zastąp przykładową ścieżkę poniżej). Poniższy krok Node.js tworzy lokalny `package.json` niezależnie od nazwy katalogu, także ze spacjami i polskimi znakami. Manifest ustala katalog instalacji także pod przodkiem z `node_modules`. Jeśli ścieżka `package.json` już istnieje (również jako link), krok odmawia zapisu; niczego nie nadpisuje. Błąd wejścia do katalogu lub utworzenia manifestu zatrzymuje dalszy blok. Następnie: instalacja, init z ukrytym pytaniem o klucz, doctor. W zsh/bash usuń stary ENV przed init i wczytaj zapisany klucz przed doctor — init nie ustawia środowiska rodzica:
79
81
 
80
82
  ```sh
@@ -156,6 +158,47 @@ npx robisie doctor
156
158
 
157
159
  Dla Codex lub OpenCode zastąp `claude` przez `codex` lub `opencode`. Przy wcześniejszej konfiguracji użyj pełnej mapy z następnej sekcji; samo `--agent` jej nie kasuje. Oczekiwany wynik doctor: exit 0. Awaryjny zgodny tgz przygotuj według sekcji Aktualizacja. Pomocniki `client-launch-context` i `ceo-client-launcher` są konfigurowane przez init dla wersji paczki; lokalne wywołanie to `npx robisie mcp <nazwa>` z cwd instalacji. Wpisy agenta zachowują transport generowany przez paczkę; ta instrukcja go nie zmienia. npx może pobrać paczkę z sieci, gdy nie znajdzie wymaganej wersji lokalnie.
158
160
 
161
+ <!-- agent-install:start -->
162
+ <a id="instalacja-agenta"></a>
163
+ ### Instalacja przez agenta (bez terminala interaktywnego)
164
+
165
+ 1. Zacznij od uzgodnionej zgody na przebieg, konta, jednego projektu i wymagań opisanych powyżej. W przygotowanym pustym katalogu utwórz manifest i zainstaluj paczkę:
166
+
167
+ ```sh
168
+ cd "/ścieżka/do/pustego katalogu" &&
169
+ node -e 'try {
170
+ require("node:fs").writeFileSync("package.json", "{\"private\":true}\n", { flag: "wx" });
171
+ } catch (error) {
172
+ console.error("Nie można utworzyć package.json: ścieżka już istnieje albo jest niedostępna. Następny krok: zachowaj ją i przejdź do instrukcji istniejącego projektu/reinstalacji poniżej; link/katalog lub błąd dostępu wyjaśnij lokalnie przed ponowieniem.");
173
+ process.exit(1);
174
+ }' &&
175
+ npm i robisie
176
+ ```
177
+
178
+ 2. Wybierz sposób przekazania kluczy przed init. Przy bezpiecznie przygotowanych ENV ustaw A jako `ROBISIE_KEY` (worker), a osobny B jako `ROBISIE_REVIEW_KEY` (owner_validator); zachowaj je w środowisku init, doctor i sesji agentów. Nie usuwaj tych zmiennych przed init i nie wykonuj bloku nowej instalacji dla człowieka, który je usuwa. Nie wypisuj kluczy ani nie wklejaj ich do rozmowy, karty, argumentów lub historii poleceń. Wyłącz śledzenie powłoki przed przekazaniem sekretów i wyeksportuj przygotowane zmienne:
179
+
180
+ ```sh
181
+ set +x
182
+ export ROBISIE_KEY ROBISIE_REVIEW_KEY
183
+ ```
184
+
185
+ Zamiast linii init w kroku 3 możesz użyć `--key-stdin`, które pobiera tylko A z wejścia standardowego: istniejący przykład to `printenv MY_KEY | npx robisie init --key-stdin`. B nadal przekaż przez `ROBISIE_REVIEW_KEY`; zachowaj pełne przypisanie dostawcy z kroku 3. Przy `--no-shell` również zachowaj oba ENV.
186
+
187
+ Jeśli nie masz bezpiecznie przygotowanych kluczy, uruchom w katalogu instalacji `npx robisie login`. Polecenie wypisze kod i link do https://robisie.app/dashboard/connect/device. Człowiek zalogowany na własne konto w przeglądarce porównuje kod, ponownie potwierdza logowanie i zatwierdza parę A+B. Dopiero exit 0 potwierdza zapis kluczy w plikach instalacji; exit 2 oznacza oczekiwanie — wznów to samo polecenie przed wygaśnięciem kodu (10 minut). Po tym logowaniu init i doctor używają plików instalacji.
188
+
189
+ 3. W tym samym katalogu wykonaj init i dopiero po jego sukcesie zwykły doctor. Wybierz jednego zainstalowanego dostawcę dla wszystkich trzech ról; dla Codex/OpenCode zastąp każde `claude` przez `codex`/`opencode`:
190
+
191
+ ```sh
192
+ npx robisie init --agent claude --role ceo=claude --role builder=claude --role quality=claude &&
193
+ npx robisie doctor
194
+ ```
195
+
196
+ Łańcuch `&&` zatrzymuje wykonanie po błędzie. Przy odmowie napraw wskazaną przyczynę przed ponowieniem; nie zastępuj zwykłego doctor walidacją `--engine-config`, która nie sprawdza kluczy.
197
+
198
+ 4. Dopiero po doctor z exit 0 przejdź do sekcji „Pierwsza karta i start Buildera”, zgodnie z uzgodnionym celem i zakresem zapisu.
199
+
200
+ <!-- agent-install:end -->
201
+
159
202
  <!-- sekcja: init -->
160
203
  ## Połączenie agenta
161
204
 
@@ -230,6 +273,8 @@ npx robisie doctor
230
273
 
231
274
  Doctor sprawdza kontrakt, odczyt projektów, konfigurację, role, start pomocników, `ROBISIE_KEY` oraz wolne miejsce na dysku instalacji. Przy dysku wypisuje HOLD poniżej 15 GiB i histerezę odblokowania od 18 GiB; poniżej 15 GiB kończy się exit 1. Pokazuje mapę: null lub mieszana mapa daje exit 1; wróć do pełnego przypisania jednego dostawcy w sekcji init. „Powyższe kontrole przeszły” oznacza powodzenie tych kontroli, nie pełnej pętli pracy. Linia „Gotowość wykonawców Codex–Grok” mówi osobno, czy sprawdzono logowanie Codex (`codex login status`) i Groka (`grok models`, więc tylko „prawdopodobnie zalogowany”).
232
275
 
276
+ Gdy klucz A widzi dokładnie jeden projekt, doctor odczytuje jego `reviewPolicy` przez `list_projects`. Dla `enforced` pokazuje „✓ Polityka enforced: TAK”. Dla `legacy` ostrzega, że odbiór B (`accept_review`) będzie odmawiany, i kieruje do operatora Robisie po ustawienie `enforced`. Starszy serwer bez pola, `null` lub błąd odczytu daje „NIE SPRAWDZONO” z powodem. Ta linia jest informacyjna i nie zmienia kodu wyjścia doctora. Klient tylko odczytuje politykę; ustawia ją wyłącznie operator.
277
+
233
278
  Doctor uruchamia plik pomocnika przez node, agent przez npx. `ROBISIE_PROJECT_CONTEXT` wybiera kontekst później i nie zmienia cwd szukania paczki. Uruchom agenta w katalogu instalacji i poproś o wyświetlenie dostępnych narzędzi OBU serwerów: `client-launch-context` (`get_launch_context`, `get_project_context`, `run_project_check`, `prepare_review`, `create_review_receipt`, `verify_stored_review`) oraz `ceo-client-launcher` (`spawn_builder`, `verify_review_receipt`). Wynik: oba serwery dostępne z kompletem tych narzędzi w sesji. Nie uruchamiaj spawn_builder tylko dla próby. Przy braku pomocnika wróć do cwd instalacji, sprawdź lokalną wersję i konfigurację, uruchom init/doctor, potem nową sesję agenta. Sam doctor nie potwierdza dostępności narzędzi u dostawcy.
234
279
 
235
280
  <!-- sekcja: pierwsza-karta -->
@@ -468,7 +513,7 @@ Komunikaty CLI pozostają po polsku. Dopasuj komunikat, a potem wykonaj wskazan
468
513
  Wygeneruj nowy klucz worker; w zsh/bash wykonaj `unset ROBISIE_KEY`, potem init z ukrytym pytaniem.
469
514
  - **brak-odczytu** — `Ten klucz nie ma uprawnień do odczytu tablicy (np. rola seeder).`
470
515
  Wybierz worker w Connect; `unset ROBISIE_KEY`, potem init z ukrytym pytaniem.
471
- - **major** — `Wersja kontraktu serwera (2.0.0) nie pasuje do paczki robisie 0.3.0 (obsługuje 1.x).`
516
+ - **major** — `Wersja kontraktu serwera (2.0.0) nie pasuje do paczki robisie 0.4.0 (obsługuje 1.x).`
472
517
  Przykład niezgodnego MAJOR: zainstaluj wydanie zgodne z kontraktem serwera.
473
518
  - **brak-env** — `Zmienna ROBISIE_KEY nie jest ustawiona — role i agenci jej potrzebują.`
474
519
  Sprawdź obsługę profilu; przy --no-shell/innej powłoce wczytaj plik klucza do środowiska sesji jak w init, potem doctor.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robisie",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
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",