robisie 0.6.10 → 0.6.11

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,18 @@
1
1
  # Historia zmian klienta / Client changelog
2
2
 
3
+ ## [0.6.11](https://github.com/chuppa12/robisie-app/compare/client-v0.6.10...client-v0.6.11) (2026-11-19)
4
+
5
+
6
+ ### Factory Cards
7
+
8
+ * Klient na Linuksie bez systemctl aktualizuje instalację jednorazowo przez `robisie update` i dalej uruchamia fabrykę ręcznie ([84fa44c](https://github.com/chuppa12/robisie-app/commit/84fa44c74b7f4198813b9524ecb76d80e06c629f))
9
+ * praca workera task-mwnkmpbe-vgff3z (auto-commit) ([64acb51](https://github.com/chuppa12/robisie-app/commit/64acb51168ef5e34d1e2266e457a97f4ecaefef4))
10
+ * praca workera task-mwnl0nrj-6c33av (auto-commit) ([fc8d2df](https://github.com/chuppa12/robisie-app/commit/fc8d2df7de817e670e66e395791eb6e6213b8cc7))
11
+ * praca workera task-mwnlkxo7-bo6dvn (auto-commit) ([672d3f2](https://github.com/chuppa12/robisie-app/commit/672d3f27e2ead975a7b425d86f8314444abe9492))
12
+ * praca workera task-mwnn6snb-12goms (auto-commit) ([aa552be](https://github.com/chuppa12/robisie-app/commit/aa552beb813d614a7365f89c3955ad6574fa2d22))
13
+ * praca workera task-mwnnu82u-7166xh (auto-commit) ([a94afca](https://github.com/chuppa12/robisie-app/commit/a94afcad469c3348d1632ad47bcfefa7878a649f))
14
+ * przygotowanie konfliktu z main ([3f8cac0](https://github.com/chuppa12/robisie-app/commit/3f8cac0c8a32c3984f02985fdcc5697713afb056))
15
+
3
16
  ## [0.6.10](https://github.com/chuppa12/robisie-app/compare/client-v0.6.9...client-v0.6.10) (2026-11-19)
4
17
 
5
18
 
@@ -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.6.10";
3
+ export declare const PACKAGE_VERSION = "0.6.11";
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.6.10"; // x-release-please-version
3
+ export const PACKAGE_VERSION = "0.6.11"; // 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":"0075ce4467d7cac22d6ef154d3922ee98b3174b2","dirty":false}
1
+ {"schema":1,"sha":"48ff19bb2f02c711fbbc22a40ffebd6cf3084eec","dirty":false}
@@ -1725,6 +1725,6 @@
1725
1725
  "status": 0,
1726
1726
  "signal": null,
1727
1727
  "stdout": "v24.3.0\n",
1728
- "stderr": "(node:24368) 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"
1728
+ "stderr": "(node:24454) 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"
1729
1729
  }
1730
1730
  }
@@ -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.6.10";
37655
+ PACKAGE_VERSION = "0.6.11";
37656
37656
  SUPPORTED_CONTRACT_MAJOR = 1;
37657
37657
  DEFAULT_ORIGIN = "https://robisie.app";
37658
37658
  MCP_SERVER_NAME = "robisie";
@@ -11,6 +11,7 @@ export interface UpdateRuntime {
11
11
  signal: string | null;
12
12
  stdout: string;
13
13
  stderr: string;
14
+ errorCode?: string;
14
15
  };
15
16
  kill: typeof process.kill;
16
17
  now: () => number;
@@ -6,7 +6,7 @@ import { createInterface } from 'node:readline/promises';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { isDeepStrictEqual } from 'node:util';
8
8
  import { agentPaths } from './agents.js';
9
- import { RobisieError } from './context.js';
9
+ import { RobisieError, shellQuote } from './context.js';
10
10
  import { CONFIG_FILE, parseEngineConfig } from './engine-config.js';
11
11
  import { readKey } from './manifest.js';
12
12
  import { PlanerClient } from './planer-client.js';
@@ -54,7 +54,9 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
54
54
  const runtime = {
55
55
  fs, exec: (command, args, cwd, env) => {
56
56
  const result = spawnSync(command, args, { cwd, env, encoding: 'utf8', shell: false, timeout: 120_000, maxBuffer: 4 * 1024 * 1024 });
57
- return { status: result.status, signal: result.signal, stdout: result.stdout, stderr: result.stderr };
57
+ const errorCode = code(result.error);
58
+ return { status: result.status, signal: result.signal, stdout: result.stdout, stderr: result.stderr,
59
+ errorCode: typeof errorCode === 'string' ? errorCode : undefined };
58
60
  }, kill: process.kill, now: Date.now, sleep: ms => new Promise(done => setTimeout(done, ms)),
59
61
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
60
62
  ask: async (question) => {
@@ -75,9 +77,10 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
75
77
  const digest = (bytes) => createHash('sha256').update(bytes).digest('hex');
76
78
  let result = 2;
77
79
  let completed = false;
80
+ let oneShot = false;
81
+ let manualStart;
78
82
  const env = { ...ctx.env };
79
- const command = (name, args, cwd = ctx.cwd) => {
80
- const outcome = runtime.exec(name, args, cwd, env);
83
+ const command = (name, args, cwd = ctx.cwd, outcome = runtime.exec(name, args, cwd, env)) => {
81
84
  if (outcome.status !== 0 || outcome.signal !== null) {
82
85
  const tail = (outcome.stderr ?? '').split(/\r\n|\n|\r/).filter(line => !/TOKEN|KEY|SECRET|PASSWORD/i.test(line))
83
86
  .join(' ').replace(/\s+/g, ' ').trim().slice(-300);
@@ -256,10 +259,21 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
256
259
  }
257
260
  const manager = ctx.platform === 'linux' ? 'systemctl' : 'launchctl';
258
261
  const domain = `gui/${typeof process.getuid === 'function' ? process.getuid() : 0}`;
262
+ const probeArgs = ctx.platform === 'linux' ? ['--user', 'show-environment'] : ['print', domain];
263
+ const linuxClient = !host && ctx.platform === 'linux';
264
+ const probeClient = () => {
265
+ const outcome = runtime.exec(manager, probeArgs, ctx.cwd, env);
266
+ oneShot = outcome.errorCode === 'ENOENT' && outcome.status === null && outcome.signal === null;
267
+ return outcome;
268
+ };
269
+ const clientProbe = linuxClient && !config.update?.enabled ? probeClient() : undefined;
259
270
  let managerProbed = false;
260
271
  const probeManager = () => {
272
+ const outcome = clientProbe ?? (linuxClient ? probeClient() : undefined);
273
+ if (oneShot)
274
+ return;
261
275
  try {
262
- command(manager, ctx.platform === 'linux' ? ['--user', 'show-environment'] : ['print', domain]);
276
+ command(manager, probeArgs, ctx.cwd, outcome);
263
277
  }
264
278
  catch (error) {
265
279
  if (ctx.platform === 'linux' && error instanceof RobisieError)
@@ -268,7 +282,7 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
268
282
  }
269
283
  managerProbed = true;
270
284
  };
271
- if (!config.update?.enabled) {
285
+ if (!oneShot && !config.update?.enabled) {
272
286
  if (!runtime.interactive || config.update?.enabled === false) {
273
287
  ctx.out('Aktualizacja pominięta: brak włączonej zgody w konfiguracji.');
274
288
  return 0;
@@ -332,7 +346,7 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
332
346
  refuse('Żywy wskaźnik zmienił się podczas aktualizacji.');
333
347
  };
334
348
  // Probe manager before any pointer, service, or card mutation.
335
- if (!managerProbed)
349
+ if (!oneShot && !managerProbed)
336
350
  probeManager();
337
351
  if (!host)
338
352
  board = await runtime.board(ctx, config);
@@ -643,7 +657,32 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
643
657
  || typeof metadata.gitHead !== 'string' || !/^[a-f0-9]{40}$/.test(metadata.gitHead))
644
658
  refuse('Niepoprawne metadane npm: wymagane gitHead i integralność.');
645
659
  const latest = metadata.version;
646
- if (!newer(latest, oldPackage.version) && (latest !== oldPackage.version || stat(pointer))) {
660
+ const hasNewerRelease = newer(latest, oldPackage.version);
661
+ const unitDir = ctx.platform === 'linux' ? join(dirname(agentPaths(ctx).clientDir), 'systemd/user') : join(ctx.home, 'Library/LaunchAgents');
662
+ const systemdUnits = ['robisie-factory', 'robisie-update'];
663
+ const quotedWorkingDirectory = /^WorkingDirectory="[^\r\n]*"(?=\r?$)/m;
664
+ let repairUnits = false;
665
+ if (!oneShot && ctx.platform === 'linux' && latest === oldPackage.version && pointerSnapshot.target && oldSha === metadata.gitHead) {
666
+ // After rollback, current can already point to the package replaced by a manual npm install.
667
+ repairUnits = systemdUnits.some(name => {
668
+ const path = join(unitDir, `${name}.service`);
669
+ if (!stat(path)?.isFile())
670
+ return false;
671
+ const contents = regular(path).toString('utf8');
672
+ return contents.includes('robisie:update-managed') && quotedWorkingDirectory.test(contents);
673
+ });
674
+ if (!repairUnits && stat(auditPath)) {
675
+ // A failed reload can leave corrected files on disk before systemd accepts them.
676
+ const lastRepair = regular(auditPath).toString('utf8').split('\n').reverse().find(line => {
677
+ if (!line.includes('"event":"unit-repair"'))
678
+ return false;
679
+ const entry = json(Buffer.from(line));
680
+ return entry.sha === oldSha && entry.version === latest;
681
+ });
682
+ repairUnits = lastRepair !== undefined && json(Buffer.from(lastRepair)).confirmed === false;
683
+ }
684
+ }
685
+ if (!hasNewerRelease && !repairUnits && (latest !== oldPackage.version || pointerSnapshot.target)) {
647
686
  ctx.out('Zainstalowana wersja robisie jest aktualna; brak downgrade.');
648
687
  return 0;
649
688
  }
@@ -655,7 +694,7 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
655
694
  refuse('Ta wersja była już próbowana przez starego agenta; wyjaśnij wpis auto-update.state.');
656
695
  }
657
696
  const attempts = join(update, 'attempts.jsonl');
658
- const attemptBytes = stat(attempts) ? regular(attempts) : null;
697
+ const attemptBytes = !repairUnits && stat(attempts) ? regular(attempts) : null;
659
698
  if (attemptBytes)
660
699
  for (const line of attemptBytes.toString('utf8').split('\n').filter(Boolean)) {
661
700
  const entry = JSON.parse(line);
@@ -671,6 +710,8 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
671
710
  const second = await preflight();
672
711
  if (second.busy)
673
712
  return defer(second.busy);
713
+ if (repairUnits && second.own.length)
714
+ return defer('karta maszynisty in_progress');
674
715
  for (const card of second.own) {
675
716
  check();
676
717
  const activity = await preflight();
@@ -696,28 +737,31 @@ export async function runInstallationUpdate(ctx, options, overrides = {}) {
696
737
  audit('card-blocked', { id: card.id, before: card, after, echo, echoDetail });
697
738
  }
698
739
  check();
699
- if (attemptBytes ? !regular(attempts).equals(attemptBytes) : stat(attempts) !== null)
700
- refuse('Rejestr prób zmienił się podczas aktualizacji.');
701
- if (host) {
702
- const before = stat(legacyState) ? regular(legacyState) : null;
703
- io.appendFileSync(legacyState, `${latest} ATTEMPT ${new Date(runtime.now()).toISOString()}\n`, { mode: 0o600, flush: true });
704
- legacyAttempt = { before, saved: regular(legacyState) };
740
+ let next = previous, sha = oldSha;
741
+ if (!repairUnits) {
742
+ if (attemptBytes ? !regular(attempts).equals(attemptBytes) : stat(attempts) !== null)
743
+ refuse('Rejestr prób zmienił się podczas aktualizacji.');
744
+ if (host) {
745
+ const before = stat(legacyState) ? regular(legacyState) : null;
746
+ io.appendFileSync(legacyState, `${latest} ATTEMPT ${new Date(runtime.now()).toISOString()}\n`, { mode: 0o600, flush: true });
747
+ legacyAttempt = { before, saved: regular(legacyState) };
748
+ }
749
+ append(attempts, { version: latest, at: new Date(runtime.now()).toISOString() });
750
+ attempt = { path: attempts, before: attemptBytes, saved: regular(attempts) };
751
+ audit('attempt', { version: latest, previous: oldSha });
752
+ const releases = join(update, 'releases');
753
+ privateDir(releases);
754
+ const release = io.mkdtempSync(join(releases, `robisie-${latest}-`));
755
+ io.writeFileSync(join(release, 'package.json'), JSON.stringify({ private: true }) + '\n', { flag: 'wx', mode: 0o600, flush: true });
756
+ command(npm, ['install', `robisie@${latest}`, '--ignore-scripts', '--no-audit', '--no-fund', '--save-exact'], release);
757
+ next = join(release, 'node_modules/robisie');
758
+ sha = validBuild(json(regular(join(next, 'dist/engine/build-id.json'))));
759
+ const lock = json(regular(join(release, 'package-lock.json')));
760
+ const installed = object(lock.packages) ? lock.packages['node_modules/robisie'] : null;
761
+ if (sha !== metadata.gitHead || !object(installed) || installed.integrity !== metadata.dist.integrity
762
+ || json(regular(join(next, 'package.json'))).version !== latest)
763
+ refuse('Weryfikacja wydania npm nie powiodła się.');
705
764
  }
706
- append(attempts, { version: latest, at: new Date(runtime.now()).toISOString() });
707
- attempt = { path: attempts, before: attemptBytes, saved: regular(attempts) };
708
- audit('attempt', { version: latest, previous: oldSha });
709
- const releases = join(update, 'releases');
710
- privateDir(releases);
711
- const release = io.mkdtempSync(join(releases, `robisie-${latest}-`));
712
- io.writeFileSync(join(release, 'package.json'), JSON.stringify({ private: true }) + '\n', { flag: 'wx', mode: 0o600, flush: true });
713
- command(npm, ['install', `robisie@${latest}`, '--ignore-scripts', '--no-audit', '--no-fund', '--save-exact'], release);
714
- const next = join(release, 'node_modules/robisie');
715
- const build = json(regular(join(next, 'dist/engine/build-id.json'))), sha = validBuild(build);
716
- const lock = json(regular(join(release, 'package-lock.json')));
717
- const installed = object(lock.packages) ? lock.packages['node_modules/robisie'] : null;
718
- if (sha !== metadata.gitHead || !object(installed) || installed.integrity !== metadata.dist.integrity
719
- || json(regular(join(next, 'package.json'))).version !== latest)
720
- refuse('Weryfikacja wydania npm nie powiodła się.');
721
765
  regular(join(next, 'dist/cli.js'));
722
766
  regular(join(next, 'dist/engine/tick.cjs'));
723
767
  const prepared = await preflight();
@@ -740,23 +784,38 @@ try {
740
784
  env.ROBISIE_KEY=readKey(dir);
741
785
  env.ROBISIE_REVIEW_KEY=readKey(dir,'review-key');
742
786
  if(!env.ROBISIE_KEY||!env.ROBISIE_REVIEW_KEY) throw new Error('Brak plików kluczy instalacji');
743
- }
787
+ }${oneShot ? `
788
+ if(process.argv[2]==='factory' && process.argv[3]==='run') {
789
+ // Keep the launcher PID so TERM reaches the supervisor directly.
790
+ process.chdir(${JSON.stringify(ctx.cwd)});
791
+ process.execve(${JSON.stringify(runtime.node)},[${JSON.stringify(runtime.node)},join(root,'dist/cli.js'),...process.argv.slice(2)],env);
792
+ throw new Error('Polecenie robisie nie powiodło się');
793
+ }` : ''}
744
794
  const r=spawnSync(${JSON.stringify(runtime.node)},[join(root,'dist/cli.js'),...process.argv.slice(2)],{cwd:${JSON.stringify(ctx.cwd)},env,stdio:'inherit',shell:false});
745
795
  if(r.status!==0||r.signal!==null) throw new Error('Polecenie robisie nie powiodło się');
746
796
  process.exitCode=0;
747
797
  } catch { process.stderr.write('Błąd uruchomienia robisie; sprawdź prywatny audyt aktualizacji.\\n'); process.exitCode=2; }
748
798
  `;
749
- const writeManaged = (path, content) => {
750
- if (stat(path) && !regular(path).toString('utf8').includes('robisie:update-managed'))
799
+ const readManaged = (path) => {
800
+ const contents = stat(path) ? regular(path) : null;
801
+ if (contents !== null && !contents.includes('robisie:update-managed'))
751
802
  refuse('Obcy plik jednostki lub launchera; odmowa nadpisania.');
803
+ return contents;
804
+ };
805
+ const writeManaged = (path, content) => {
806
+ readManaged(path);
752
807
  io.writeFileSync(path, content, { mode: 0o600, flush: true });
753
808
  };
754
- const unitDir = ctx.platform === 'linux' ? join(dirname(agentPaths(ctx).clientDir), 'systemd/user') : join(ctx.home, 'Library/LaunchAgents');
755
- io.mkdirSync(unitDir, { recursive: true, mode: 0o700 });
809
+ if (!oneShot && ctx.platform === 'linux' && (!isAbsolute(ctx.cwd) || /[\n\r]/.test(ctx.cwd)))
810
+ refuse('WorkingDirectory wymaga absolutnej ścieżki bez LF i CR.');
811
+ if (!oneShot)
812
+ io.mkdirSync(unitDir, { recursive: true, mode: 0o700 });
756
813
  const factoryArgs = ['factory', 'run', '--once', '--engine-config', configPath];
757
814
  const updateArgs = ['update', '--engine-config', configPath];
758
815
  const factoryName = ctx.platform === 'linux' ? 'robisie-factory' : host ? 'com.robisie.maszynista' : 'com.robisie.factory';
759
816
  const ensureOwned = () => {
817
+ if (oneShot)
818
+ return;
760
819
  if (hostService && hostPlist) {
761
820
  if (!regular(hostPlist).equals(hostService.current))
762
821
  refuse('Hostowy plist zmienił się podczas aktualizacji.');
@@ -785,7 +844,16 @@ try {
785
844
  }
786
845
  };
787
846
  ensureOwned();
788
- writeManaged(launcher, launcherText);
847
+ if (repairUnits) {
848
+ readManaged(launcher);
849
+ for (const name of systemdUnits) {
850
+ readManaged(join(unitDir, `${name}.service`));
851
+ readManaged(join(unitDir, `${name}.timer`));
852
+ }
853
+ audit('unit-repair', { sha, version: latest, confirmed: false });
854
+ }
855
+ else
856
+ writeManaged(launcher, launcherText);
789
857
  if (hostService && hostPlist) {
790
858
  const service = json(Buffer.from(command('plutil', ['-convert', 'json', '-o', '-', hostPlist])));
791
859
  const args = service.ProgramArguments;
@@ -805,14 +873,38 @@ try {
805
873
  const unitEnv = Object.entries({ ...(host ? Object.fromEntries(Object.entries(env).filter(([key]) => /^HU_(?:HOME|MODE|LASTTICK|SK|REPO|APP|PLIST|CHECKOUT|LOG|STATE|NPM|ALARM)$/.test(key))) : {}), HOME: ctx.home, PATH: ctx.env.PATH, CODEX_HOME: ctx.env.CODEX_HOME, XDG_CONFIG_HOME: ctx.env.XDG_CONFIG_HOME })
806
874
  .filter((entry) => entry[1] !== undefined);
807
875
  let hostUpdateUnit;
808
- if (ctx.platform === 'linux' && (!isAbsolute(ctx.cwd) || /[\n\r]/.test(ctx.cwd)))
809
- refuse('WorkingDirectory wymaga absolutnej ścieżki bez LF i CR.');
810
876
  for (const [name, args] of [['factory', factoryArgs], ['update', updateArgs]]) {
877
+ if (oneShot)
878
+ break;
811
879
  if (host && name === 'factory')
812
880
  continue;
813
881
  if (ctx.platform === 'linux') {
882
+ const service = join(unitDir, `robisie-${name}.service`);
883
+ const workingDirectory = `WorkingDirectory=${ctx.cwd.replace(/%/g, '%%')}`;
884
+ if (repairUnits) {
885
+ const before = readManaged(service);
886
+ if (!before)
887
+ continue;
888
+ // A one-byte encoding keeps every byte outside the replaced line intact.
889
+ const contents = before.toString('latin1');
890
+ const repaired = contents.replace(quotedWorkingDirectory, () => Buffer.from(workingDirectory).toString('latin1'));
891
+ if (repaired === contents)
892
+ continue;
893
+ const staging = io.mkdtempSync(join(unitDir, '.robisie-repair-'));
894
+ try {
895
+ const temporary = join(staging, `${name}.service`);
896
+ io.writeFileSync(temporary, Buffer.from(repaired, 'latin1'), { flag: 'wx', mode: 0o600, flush: true });
897
+ if (!readManaged(service)?.equals(before))
898
+ refuse('Usługa systemd zmieniła się podczas naprawy.');
899
+ io.renameSync(temporary, service);
900
+ }
901
+ finally {
902
+ io.rmSync(staging, { recursive: true, force: true });
903
+ }
904
+ continue;
905
+ }
814
906
  // Tick and update own their deadlines, including the separate rollback health window.
815
- writeManaged(join(unitDir, `robisie-${name}.service`), `# robisie:update-managed\n[Unit]\nDescription=robisie ${name}\n[Service]\nType=oneshot\nTimeoutStartSec=infinity\n${unitEnv.map(([key, value]) => `Environment=${systemArg(`${key}=${value}`)}\n`).join('')}WorkingDirectory=${ctx.cwd.replace(/%/g, '%%')}\nExecStart=${[runtime.node, launcher, ...args].map(arg => systemArg(arg, true)).join(' ')}\n`);
907
+ writeManaged(service, `# robisie:update-managed\n[Unit]\nDescription=robisie ${name}\n[Service]\nType=oneshot\nTimeoutStartSec=infinity\n${unitEnv.map(([key, value]) => `Environment=${systemArg(`${key}=${value}`)}\n`).join('')}${workingDirectory}\nExecStart=${[runtime.node, launcher, ...args].map(arg => systemArg(arg, true)).join(' ')}\n`);
816
908
  writeManaged(join(unitDir, `robisie-${name}.timer`), `# robisie:update-managed\n[Unit]\nDescription=robisie ${name}\n[Timer]\nOnBootSec=120s\nOnUnitInactiveSec=120s\nUnit=robisie-${name}.service\n[Install]\nWantedBy=timers.target\n`);
817
909
  }
818
910
  else {
@@ -983,7 +1075,7 @@ try {
983
1075
  }
984
1076
  return false;
985
1077
  };
986
- if (modeBytes) {
1078
+ if (modeBytes && !repairUnits) {
987
1079
  mode = { path: modePath, bytes: modeBytes, expected: modeBytes, sha: digest(modeBytes) };
988
1080
  const backup = join(update, 'HOST-ACTIVATION.mode.backup');
989
1081
  if (stat(backup) && !stat(backup)?.isFile())
@@ -1049,12 +1141,20 @@ try {
1049
1141
  const locked = await preflight();
1050
1142
  if (locked.busy || locked.own.length)
1051
1143
  refuse('Alarm: nowa praca pod blokadą uniemożliwia powrót.');
1052
- ensureOwned();
1053
- rememberTick();
1144
+ if (oneShot)
1145
+ check();
1146
+ else {
1147
+ ensureOwned();
1148
+ rememberTick();
1149
+ }
1054
1150
  replaceHostService(true);
1055
1151
  const restoredAt = runtime.now();
1056
1152
  switchPointer(previous);
1057
1153
  rollbackAudit('restored', { sha: oldSha, failed: sha });
1154
+ if (oneShot) {
1155
+ refresh(previous);
1156
+ return;
1157
+ }
1058
1158
  const restarted = activate(previous, oldSha, 'rollback-start-failed');
1059
1159
  const confirmed = restarted && await health(oldSha, restoredAt, 'old-tick', 'rollback-start-failed');
1060
1160
  rollbackAudit(confirmed ? 'rollback-confirmed' : 'rollback-unconfirmed', { sha: oldSha, failed: sha });
@@ -1072,21 +1172,39 @@ try {
1072
1172
  rollback = undefined;
1073
1173
  return defer(activating.busy ?? 'karta maszynisty in_progress');
1074
1174
  }
1075
- rememberTick();
1175
+ if (oneShot)
1176
+ check();
1177
+ else
1178
+ rememberTick();
1076
1179
  const switchedAt = runtime.now();
1180
+ if (repairUnits) {
1181
+ const started = activate(next, sha, 'unit-repair-start-failed');
1182
+ if (!started || !await health(sha, switchedAt, 'unit-repair-tick', 'unit-repair-start-failed'))
1183
+ refuse('Nie potwierdzono naprawy jednostek systemd dwoma świeżymi taktami OK.');
1184
+ audit('unit-repair', { sha, version: latest, confirmed: true });
1185
+ if (stat(join(update, 'deferred.json')))
1186
+ io.unlinkSync(join(update, 'deferred.json'));
1187
+ completed = true;
1188
+ return 0;
1189
+ }
1077
1190
  rollback = restorePrevious;
1078
1191
  if (hostUpdateUnit)
1079
1192
  writeManaged(hostUpdateUnit.path, hostUpdateUnit.content);
1080
1193
  replaceHostService(false);
1081
1194
  switchPointer(next);
1082
1195
  audit('switched', { sha, previous: oldSha });
1083
- const started = activate(next, sha, 'start-failed');
1084
- if (started && await health(sha, switchedAt, 'new-tick', 'start-failed')) {
1196
+ if (oneShot) {
1197
+ refresh(next);
1198
+ check();
1199
+ }
1200
+ if (oneShot || (activate(next, sha, 'start-failed') && await health(sha, switchedAt, 'new-tick', 'start-failed'))) {
1085
1201
  audit('updated', { sha });
1086
1202
  if (stat(join(update, 'deferred.json')))
1087
1203
  io.unlinkSync(join(update, 'deferred.json'));
1088
1204
  completed = true;
1089
1205
  result = 0;
1206
+ if (oneShot)
1207
+ manualStart = `${shellQuote(runtime.node)} ${shellQuote(launcher)} factory run --engine-config ${shellQuote(configPath)}`;
1090
1208
  if (host)
1091
1209
  afterCleanup = async () => {
1092
1210
  const checkout = env.HU_CHECKOUT || repo, deadline = runtime.now() + 480_000;
@@ -1163,7 +1281,11 @@ try {
1163
1281
  catch {
1164
1282
  ctx.err('Alarm: błąd dostawy lub audytu alarmu hosta.');
1165
1283
  }
1166
- if (completed && result === 0)
1167
- ctx.out('Aktualizacja potwierdzona dwoma świeżymi taktami OK.');
1284
+ if (completed && result === 0) {
1285
+ if (manualStart)
1286
+ ctx.out(`Aktualizacja zakończona. Teraz uruchom fabrykę ręcznie jak dotąd.\n${manualStart}`);
1287
+ else
1288
+ ctx.out('Aktualizacja potwierdzona dwoma świeżymi taktami OK.');
1289
+ }
1168
1290
  return result;
1169
1291
  }
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.6.10 \u2014 plik zarz\u0105dzany przez `npx robisie`; `npx robisie uninstall` go usunie -->";
20
+ export declare const MANAGED_LINE = "<!-- robisie:managed 0.6.11 \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.6.10) <!-- x-release-please-version -->
1
+ # robisie — from account to accepted card (package 0.6.11) <!-- 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
 
@@ -607,6 +607,7 @@ For the first upgrade from robisie ≤0.5.48, or on Linux with systemd also from
607
607
  The update needs Node.js 24 or newer on the PATH of the shell that runs the command and of the service; check `node -v` and `command -v node`, because an older Node on the PATH ends the command with a version message.
608
608
 
609
609
  On Linux the update command needs a working `systemd --user` session; check `systemctl --user show-environment`, and if there is none, the human enables linger with `loginctl enable-linger $USER` and sets `XDG_RUNTIME_DIR=/run/user/$(id -u)`.
610
+ In a Linux container without `systemctl`, a one-time `npx robisie update` requires no consent for automatic updates, and afterward you start the factory manually from the new release with the command printed by the updater (`node "<stateDir>/update/launch.mjs" factory run --engine-config "<absolute config path>"`).
610
611
 
611
612
  The human gives consent to updates. An agent without a terminal does not write it on its own; only after the human's explicit instruction does it add exactly `"update":{"consentedAt":"<ISO time with offset>","enabled":true}` to `robisie.config.json`; without that entry the background command exits with code 0 and changes nothing.
612
613
 
package/docs/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # robisie — od konta do odebranej karty (paczka 0.6.10) <!-- x-release-please-version -->
1
+ # robisie — od konta do odebranej karty (paczka 0.6.11) <!-- 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
 
@@ -655,6 +655,7 @@ Pierwsze przejście z robisie ≤0.5.48, a na Linuxie z systemd także z robisie
655
655
  Aktualizacja wymaga Node.js 24 lub nowszego na PATH powłoki, w której uruchamiasz komendę, i usługi; sprawdź `node -v` i `command -v node`, bo starszy Node na PATH kończy komendę komunikatem o wersji.
656
656
 
657
657
  Na Linuxie komenda update wymaga działającej sesji `systemd --user`; sprawdź `systemctl --user show-environment`, a gdy sesji nie ma, człowiek włącza linger poleceniem `loginctl enable-linger $USER` i ustawia `XDG_RUNTIME_DIR=/run/user/$(id -u)`.
658
+ W kontenerze linuksowym bez `systemctl` jednorazowe `npx robisie update` nie wymaga zgody na automatyczne aktualizacje, a po aktualizacji uruchom fabrykę ręcznie z nowego wydania poleceniem wypisanym przez aktualizator (`node "<stateDir>/update/launch.mjs" factory run --engine-config "<absolutna ścieżka konfiguracji>"`).
658
659
 
659
660
  Zgodę na aktualizacje wyraża człowiek. Agent bez terminala nie wpisuje jej sam; dopiero po wyraźnym poleceniu człowieka dopisuje do `robisie.config.json` dosłownie `"update":{"consentedAt":"<czas ISO z przesunięciem strefy>","enabled":true}`; bez takiego wpisu komenda w tle kończy się kodem 0 bez zmian.
660
661
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robisie",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
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",