@rarog/server 1.0.1 → 1.1.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.
Files changed (140) hide show
  1. package/README.md +18 -5
  2. package/node_modules/@rarog/shared/package.json +1 -1
  3. package/node_modules/@rarog/shared/src/decode.js +64 -3
  4. package/node_modules/@rarog/shared/src/protocol/files.js +33 -0
  5. package/node_modules/@rarog/shared/src/protocol/folders.js +27 -0
  6. package/node_modules/@rarog/shared/src/protocol/herdr.js +23 -0
  7. package/node_modules/@rarog/shared/src/protocol/inbox.js +38 -0
  8. package/node_modules/@rarog/shared/src/protocol/notes.js +7 -1
  9. package/node_modules/@rarog/shared/src/protocol.js +20 -47
  10. package/node_modules/@rarog/shared/src/rest.js +106 -12
  11. package/node_modules/@rarog/shared/src/sentences/herdr.js +0 -4
  12. package/node_modules/@rarog/shared/src/sentences/index.js +7 -1
  13. package/node_modules/@rarog/shared/src/sentences/rest.js +21 -0
  14. package/package.json +3 -3
  15. package/server/src/auth/admin.js +3 -1
  16. package/server/src/bootstrap/consent.js +99 -2
  17. package/server/src/bootstrap/folder-gate.js +55 -0
  18. package/server/src/bootstrap/http.js +3 -2
  19. package/server/src/bootstrap/inbox.js +29 -4
  20. package/server/src/bootstrap/sse.js +2 -1
  21. package/server/src/cli/doctor-no-hook.js +162 -0
  22. package/server/src/cli/doctor.js +2 -0
  23. package/server/src/cli/service-log.js +27 -0
  24. package/server/src/cli/service.js +5 -2
  25. package/server/src/cli/templates/launchd.plist +1 -1
  26. package/server/src/cli/templates/rarog.service +1 -1
  27. package/server/src/cli/update-channel.js +100 -0
  28. package/server/src/cli/update-provenance.js +37 -19
  29. package/server/src/cli/update-registry.js +160 -62
  30. package/server/src/cli/update.js +13 -3
  31. package/server/src/companion/turns-settle.js +4 -1
  32. package/server/src/companion/turns.js +36 -5
  33. package/server/src/config/files.js +32 -0
  34. package/server/src/config/flags.js +10 -1
  35. package/server/src/config/protected-dirs.js +2 -0
  36. package/server/src/config/roots.js +13 -8
  37. package/server/src/config/work-area.js +36 -12
  38. package/server/src/config-env.js +33 -0
  39. package/server/src/config.js +22 -2
  40. package/server/src/demo/control.js +9 -1
  41. package/server/src/demo/files.js +49 -0
  42. package/server/src/demo/inbox.js +73 -0
  43. package/server/src/demo/review-routes.js +6 -1
  44. package/server/src/device-effects.js +3 -1
  45. package/server/src/drivers/herdr/consent-no-hook-io.js +89 -0
  46. package/server/src/drivers/herdr/consent-no-hook.js +411 -0
  47. package/server/src/drivers/herdr/refusals.js +226 -0
  48. package/server/src/drivers/herdr/returned-prompt.js +172 -0
  49. package/server/src/drivers/herdr/screen-fallback.js +246 -0
  50. package/server/src/drivers/herdr-driver.js +193 -295
  51. package/server/src/files/file-index.js +248 -0
  52. package/server/src/files/ignored.js +119 -0
  53. package/server/src/files/listing.js +82 -0
  54. package/server/src/files/path-rule.js +199 -0
  55. package/server/src/files/refusals.js +50 -0
  56. package/server/src/files/send-file.js +115 -0
  57. package/server/src/files/session-download.js +51 -0
  58. package/server/src/files/session-files.js +38 -0
  59. package/server/src/files/session-gate.js +53 -0
  60. package/server/src/folder-gate/client.js +314 -0
  61. package/server/src/folder-gate/disk.js +455 -0
  62. package/server/src/folder-gate/folders.js +23 -0
  63. package/server/src/folder-gate/gate.js +220 -0
  64. package/server/src/folder-gate/helper.js +118 -0
  65. package/server/src/folder-gate/install.js +27 -0
  66. package/server/src/folder-gate/relay-worker.js +147 -0
  67. package/server/src/folder-gate/types.js +115 -0
  68. package/server/src/folder-gate/wire.js +170 -0
  69. package/server/src/fs-browse.js +55 -23
  70. package/server/src/fs-mkdir.js +3 -1
  71. package/server/src/git-status.js +16 -7
  72. package/server/src/git-watch.js +130 -19
  73. package/server/src/git-work-tree.js +3 -3
  74. package/server/src/herdr/audit.js +1 -1
  75. package/server/src/herdr/client.js +2 -2
  76. package/server/src/herdr/commands/discover.js +21 -9
  77. package/server/src/herdr/dialogs/consent-gate.js +28 -8
  78. package/server/src/herdr/dialogs/decide/sources.js +5 -2
  79. package/server/src/herdr/dialogs/hook/contract.js +16 -9
  80. package/server/src/herdr/dialogs/index.js +12 -2
  81. package/server/src/herdr/dialogs/layer1/cycle.js +43 -7
  82. package/server/src/herdr/dialogs/layer1/hook-list/hook-list.js +166 -86
  83. package/server/src/herdr/dialogs/layer1/hook-list/session-facts.js +135 -0
  84. package/server/src/herdr/dialogs/layer1/screen-key.js +52 -0
  85. package/server/src/herdr/dialogs/layer1/version-gate.js +13 -5
  86. package/server/src/herdr/dialogs/no-hook.js +63 -0
  87. package/server/src/herdr/dialogs/router.js +21 -6
  88. package/server/src/herdr/dialogs/screen/block.js +10 -0
  89. package/server/src/herdr/dialogs/screen/parse.js +33 -3
  90. package/server/src/herdr/dialogs/screen/resolve.js +9 -7
  91. package/server/src/herdr/dialogs/screen-fallback.js +55 -0
  92. package/server/src/herdr/dialogs/shadow/alive.js +9 -8
  93. package/server/src/herdr/jsonl-follow.js +55 -14
  94. package/server/src/herdr/jsonl-pending.js +25 -1
  95. package/server/src/herdr/provenance.js +3 -3
  96. package/server/src/herdr/socket.js +25 -28
  97. package/server/src/herdr/supervisor.js +13 -10
  98. package/server/src/herdr/transcript-path.js +36 -0
  99. package/server/src/herdr/trust.js +11 -8
  100. package/server/src/herdr/uploads-registry.js +3 -2
  101. package/server/src/herdr/uploads.js +170 -47
  102. package/server/src/inbox/card.js +18 -9
  103. package/server/src/inbox/dialogs.js +40 -12
  104. package/server/src/inbox/heads.js +55 -0
  105. package/server/src/inbox/inbox.js +24 -2
  106. package/server/src/inbox/index.js +3 -1
  107. package/server/src/index.js +44 -21
  108. package/server/src/install/repair.js +8 -0
  109. package/server/src/iroh/listener.js +3 -0
  110. package/server/src/iroh/log-budget.js +1 -0
  111. package/server/src/iroh/socket.js +2 -1
  112. package/server/src/log-timestamps.js +9 -4
  113. package/server/src/notes/store.js +3 -2
  114. package/server/src/router.js +20 -2
  115. package/server/src/routes/devices.js +2 -2
  116. package/server/src/routes/inbox.js +91 -0
  117. package/server/src/routes/projects.js +5 -1
  118. package/server/src/routes/sessions.js +145 -18
  119. package/server/src/routes/system.js +9 -4
  120. package/server/src/safe-read.js +86 -1
  121. package/server/src/sessions/companion-scope.js +16 -7
  122. package/server/src/sessions/demo-modules.js +16 -0
  123. package/server/src/sessions/diff-measure.js +30 -0
  124. package/server/src/sessions/done-retention.js +57 -0
  125. package/server/src/sessions/launch-gate.js +2 -2
  126. package/server/src/sessions/manager.js +78 -190
  127. package/server/src/sessions/project-scan.js +9 -3
  128. package/server/src/sessions/ring-buffer.js +5 -3
  129. package/server/src/sessions/seen-marks.js +9 -6
  130. package/server/src/sessions/session-git.js +31 -2
  131. package/server/src/sessions/session-scope.js +30 -0
  132. package/server/src/sessions/session.js +19 -0
  133. package/server/src/sessions/state-sentences.js +1 -1
  134. package/server/src/sessions/waiting-line.js +72 -0
  135. package/server/src/sse.js +143 -10
  136. package/server/src/term/herdr-backend.js +2 -2
  137. package/server/src/term/index.js +2 -15
  138. package/server/src/term/registry.js +4 -3
  139. package/server/src/term/ws.js +9 -1
  140. package/server/src/version.js +30 -0
@@ -56,6 +56,14 @@ export const REST_SENTENCES = {
56
56
  'rest.companion-throttled': { en: 'Too soon. Wait a moment and start the conversation again.' },
57
57
  'rest.companion-timeout': { en: 'Checking the session took too long. Try again.' },
58
58
  'rest.cwd-empty': { en: 'Enter the path to a project directory.' },
59
+ 'rest.cwd-folder-denied': {
60
+ en: "macOS doesn't let Rarog into this folder. Change it in System Settings on the Mac "
61
+ + '(Privacy & Security → Files & Folders).',
62
+ },
63
+ 'rest.cwd-folder-unchecked': { en: "Rarog can't check access to this folder. The server log has the details." },
64
+ 'rest.cwd-folder-waiting': {
65
+ en: "Rarog can't open this folder: macOS is probably waiting for someone to click Allow on the Mac.",
66
+ },
59
67
  'rest.cwd-hidden': { en: "Hidden directories (those starting with a dot) aren't allowed." },
60
68
  'rest.cwd-not-absolute': { en: 'Enter the full directory path, starting with “/” or “~/”.' },
61
69
  'rest.cwd-not-found': { en: "That directory doesn't exist." },
@@ -85,7 +93,20 @@ export const REST_SENTENCES = {
85
93
  'rest.diff-file-not-found': { en: "That file isn't in the list of changes. The list may have changed." },
86
94
  'rest.diff-git-failed': { en: "Git didn't respond. Try again." },
87
95
  'rest.endpoint-not-found': { en: "That endpoint doesn't exist." },
96
+ 'rest.file-too-large': {
97
+ en: 'This file has {size} MB. The server sends files up to {limit} MB (RAROG_FILES_MAX_MB).',
98
+ args: ['size:int', 'limit:int'],
99
+ },
100
+ 'rest.files-codex': { en: "Rarog only observes the Codex pane, so it doesn't show the files in its directory." },
101
+ 'rest.files-no-pane': { en: "This session has no herdr pane, so Rarog doesn't show the files in its directory." },
102
+ 'rest.files-not-found': { en: "That file or directory isn't there, or Rarog doesn't show it." },
103
+ 'rest.files-out-of-scope': {
104
+ en: 'The pane is outside RAROG_HERDR_ROOTS. Rarog shows its state but not the files in its directory.',
105
+ },
88
106
  'rest.image-not-found': { en: "That photo doesn't exist." },
107
+ 'rest.inbox-card-changed': { en: 'This Inbox card changed in the meantime, so nothing happened.' },
108
+ 'rest.inbox-disabled': { en: 'The Inbox is turned off on the server (RAROG_INBOX).' },
109
+ 'rest.inbox-save-failed': { en: "Couldn't save the change to the Inbox." },
89
110
  'rest.login-retired': { en: 'Token sign-in no longer exists. Pair the device (rarog pair).' },
90
111
  'rest.method-not-allowed': { en: 'Method not allowed.' },
91
112
  'rest.mkdir-busy': { en: 'Another directory is being created. Try again in a moment.' },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rarog/server",
3
- "version": "1.0.1",
4
- "description": "Server for Rarog, the iPhone and iPad app for Claude Code sessions running in herdr",
3
+ "version": "1.1.0",
4
+ "description": "Rarog is a free, open-source (MIT) iPhone and iPad app, plus a server on your Mac or Linux machine, that shows the Claude Code sessions running in Herdr TUI and lets you drive them.",
5
5
  "keywords": [
6
6
  "claude-code",
7
7
  "herdr",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@number0/iroh": "1.2.0",
37
- "@rarog/shared": "1.0.1",
37
+ "@rarog/shared": "1.1.0",
38
38
  "qrcode": "1.5.4",
39
39
  "ws": "8.21.3",
40
40
  "zod": "4.4.3"
@@ -68,9 +68,11 @@ function deviceRow(record) {
68
68
  creator: record.creator, build: sanitizeBuild(record.build),
69
69
  };
70
70
  }
71
+ /** Tombstone on the list and in the revoke replies; the label goes through the pairing rules like {@link deviceRow}. */
71
72
  function tombRow(tomb) {
72
73
  return {
73
- id: tomb.id, label: tomb.label, createdAt: tomb.createdAt, revokedAt: tomb.revokedAt, revokedBy: tomb.revokedBy,
74
+ id: tomb.id, label: sanitizeLabel(tomb.label), createdAt: tomb.createdAt, revokedAt: tomb.revokedAt,
75
+ revokedBy: tomb.revokedBy,
74
76
  };
75
77
  }
76
78
  /** HTTP handler of the admin socket. Port 8930 does NOT have these routes (the router returns 404). */
@@ -5,13 +5,16 @@
5
5
  * itself starts there, after `listen`.
6
6
  */
7
7
  import { stat } from 'node:fs/promises';
8
- import { basename, dirname } from 'node:path';
8
+ import { basename, dirname, join } from 'node:path';
9
9
  import { createConsentHandler, redact, startConsentSocket } from '../auth/index.js';
10
10
  import { defaultStoreRoot } from '../cli-store.js';
11
+ import { inWorkAreaOnDisk } from '../config/work-area.js';
12
+ import { hookChildRunning, statuslineFreshness } from '../drivers/herdr/consent-no-hook-io.js';
11
13
  import { createConsentEvidenceReview, createConsentEvidenceScanner } from '../herdr/consent-evidence.js';
12
14
  import { consentStep } from '../herdr/consent-step.js';
13
15
  import { consentChannelOpen } from '../herdr/dialogs/hook/contract.js';
14
- import { CONSENT_HOLDING_STATES } from '../herdr/dialogs/layer1/contract.js';
16
+ import { createSessionFacts } from '../herdr/dialogs/layer1/hook-list/session-facts.js';
17
+ import { CONSENT_HOLDING_STATES, CONSENT_POOL_MAX } from '../herdr/dialogs/layer1/contract.js';
15
18
  import { createConsentCycle } from '../herdr/dialogs/layer1/cycle.js';
16
19
  // Osobny import: strażnik wspólnej obserwacji (`layer1-obserwacja`) czyta linię importu `observeConsentSession`.
17
20
  import { observeConsentSession } from '../herdr/dialogs/layer1/observe.js';
@@ -20,7 +23,10 @@ import { recoverThenSweepConsent } from '../herdr/dialogs/layer1/records.js';
20
23
  import { retireRunningAfterRecover } from '../herdr/dialogs/layer1/frames.js';
21
24
  import { consentRegistrationWanted, consentRegistryScopeOf, createConsentRegistry, } from '../herdr/dialogs/layer1/registry.js';
22
25
  import { createRefusalDumper } from '../herdr/dialogs/refusals.js';
26
+ import { scanCallDumps, scanMarkers } from '../herdr/dialogs/shadow/files.js';
23
27
  import { psLiveness } from '../herdr/dialogs/shadow/liveness.js';
28
+ import { HOOK_INSTALLED_SCRIPT_REL, hookCommand } from '../herdr/hook-commands.js';
29
+ import { defaultStatuslineRoot } from '../herdr/statusline.js';
24
30
  import { TRANSCRIPT_EXT, locateTranscript } from '../herdr/transcript-path.js';
25
31
  /**
26
32
  * Chwila przyjęcia najnowszej żywej rejestracji sesji, której klucz nie ma jeszcze karty kanału (w żadnym stanie), albo
@@ -72,6 +78,88 @@ export async function observeConsent(link, dataDir, liveness, request, subagents
72
78
  ...(subagents === null || hidden === null ? {} : { hidden }),
73
79
  }));
74
80
  }
81
+ /**
82
+ * The session process of an engine session for the session hook list: the one live entry of the CLI registry (pid and
83
+ * start); `null` without a registry read, with an unreadable pid, an unlisted session or more than one entry.
84
+ */
85
+ export function consentSessionEntry(cliVersionReader) {
86
+ return async (engineSessionId) => {
87
+ const read = await cliVersionReader({ registryOnly: true });
88
+ if (read.registry === null || (read.unreadablePids ?? 0) > 0)
89
+ return null;
90
+ if (read.unlistedSessions?.has(engineSessionId) === true)
91
+ return null;
92
+ const entries = read.registry.get(engineSessionId);
93
+ const entry = entries?.length === 1 ? entries[0] : undefined;
94
+ return entry === undefined ? null
95
+ : { pid: entry.pid, ...(entry.startedAt === undefined ? {} : { startedAt: entry.startedAt }) };
96
+ };
97
+ }
98
+ /** Record states of a request the hook still waits on: anything later is answered or settled. */
99
+ const CONSENT_UNSETTLED_STATES = new Set(['pending', 'deciding', 'sent']);
100
+ /**
101
+ * Whether a trace of Rarog's `PermissionRequest` hook stands for the session (the consent-without-hook detector,
102
+ * `drivers/herdr/consent-no-hook.ts`): a live registration accepted at or after `since` (ms of the epoch, the end of
103
+ * the previous dialog episode), a channel card holding a dialog, a request of the channel pool (dump or request
104
+ * marker) without an exit whose record is not settled, a pool past its cap, a per-call dump on disk whose record is
105
+ * not settled (the hook deletes it on every exit, so it stands while the hook lives), or a request marker on disk the
106
+ * pool has not taken whose record is not settled; an incomplete read of the dumps or markers counts too. Settled
107
+ * records, and dumps and requests under them, are no trace. Throws on a read error of the dump or marker directory.
108
+ */
109
+ export function consentHookTrace(link, dataDir, sessionId, since) {
110
+ const { cycle, registry } = link;
111
+ if (registry?.entries().some((entry) => entry.sessionId === sessionId && entry.acceptedAt >= since) === true) {
112
+ return true;
113
+ }
114
+ // Without the cycle there is no record to settle a request: every request counts.
115
+ const open = (key) => {
116
+ const record = cycle?.record(sessionId, key) ?? null;
117
+ return record === null || CONSENT_UNSETTLED_STATES.has(record.state);
118
+ };
119
+ if (cycle !== null) {
120
+ if (cycle.cards(sessionId).some((card) => CONSENT_HOLDING_STATES.includes(card.state))) {
121
+ return true;
122
+ }
123
+ const pool = cycle.pool(sessionId);
124
+ if (pool.overflow)
125
+ return true;
126
+ if (pool.candidates.some((candidate) => candidate.exitAt === null && open(candidate.dump.key)))
127
+ return true;
128
+ }
129
+ const dumps = scanCallDumps(dataDir, sessionId);
130
+ if (!dumps.complete || dumps.dumps.some((dump) => open(dump.key)))
131
+ return true;
132
+ // Request markers the pool has not taken yet (written after the last channel observation). A marker under a dump
133
+ // key or a name the pool knows is decided above; a marker without a call key has no record that settles it.
134
+ const dumpKeys = new Set(dumps.dumps.map((dump) => dump.key));
135
+ const markers = scanMarkers(dataDir, sessionId, (name) => dumpKeys.has(name) || cycle?.poolKnows(sessionId, name) === true, CONSENT_POOL_MAX);
136
+ return !markers.complete || markers.markers.some((marker) => marker.key === null || open(marker.key));
137
+ }
138
+ /** The sources of the consent-without-hook detector, shared by every driver of the process. */
139
+ export function consentNoHookSources(options) {
140
+ const script = join(options.home, HOOK_INSTALLED_SCRIPT_REL);
141
+ const statuslineRoot = defaultStatuslineRoot();
142
+ // One instance per process, with the cache of its own; it reads like the session hook list and logs nothing.
143
+ const facts = createSessionFacts({ home: options.home, accepted: [hookCommand(options.home)], entry: options.entry });
144
+ return {
145
+ hookTrace: (sessionId, since) => {
146
+ try {
147
+ return consentHookTrace(options.link, options.dataDir, sessionId, since);
148
+ }
149
+ catch {
150
+ return null;
151
+ }
152
+ },
153
+ facts,
154
+ hookRunning: (pid) => hookChildRunning(pid, script),
155
+ // The hook's rule (`scripts/hooks/work-area.mjs`): the text, then the path resolved one segment at a time.
156
+ outsideWorkArea: (cwd) => !inWorkAreaOnDisk(cwd, options.roots, options.home),
157
+ statusline: (sessionId) => statuslineFreshness(statuslineRoot, sessionId, Date.now()),
158
+ proofRules: (sessionId) => options.proofGate.current(sessionId),
159
+ restarting: () => Date.now() < options.startedAt + options.restartGraceMs,
160
+ screenKey: (sessionId, key) => { options.link.cycle?.screenKey(sessionId, key); },
161
+ };
162
+ }
75
163
  /**
76
164
  * Wpisy rejestru sekretów, których proces hooka nie żyje według `ps` (pid i czas startu z rejestracji), idą do cyklu
77
165
  * sygnałem `dead`: karta klucza (jeśli jest) przechodzi jak przy martwym hooku, a wpis znika z rejestru. Dotyczy też
@@ -337,6 +425,15 @@ export function consentManagerCards(consentCycle, engineSessionId) {
337
425
  return { ...card, decision: record.decision, ...(record.retired === undefined ? {} : { retired: true }) };
338
426
  });
339
427
  }
428
+ /**
429
+ * Receiver of a forgotten conversation for the manager: the cycle drops the session's entries
430
+ * (`ConsentCycle.forgetSession`). A failure leaves one log line instead of an unhandled rejection.
431
+ */
432
+ export function consentForgottenPort(consentCycle, log) {
433
+ return (engineSessionId) => {
434
+ void consentStep('forget session', (line) => { log.error(line); }, () => consentCycle.forgetSession(engineSessionId));
435
+ };
436
+ }
340
437
  /** The consent port of the manager over the channel cycle. */
341
438
  export function consentManagerPort(consentCycle, consentMode, log) {
342
439
  return {
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Server start: the folder gate. With the gate on, it makes the relay client and the gate of the process, routes the
3
+ * work-area disk port through them and starts the helper of each guarded folder that holds a root, so the first real
4
+ * call there does not pay for the start. With the gate off (the kill switch, Linux, the demo) it makes nothing and
5
+ * every disk call stays in the server process. It touches no guarded folder: a helper starts on a call on `/`.
6
+ */
7
+ import path from 'node:path';
8
+ import { pathToFileURL } from 'node:url';
9
+ import { FOLDER_SYNC_BOUND_MS, RelayFolderClient } from '../folder-gate/client.js';
10
+ import { routeWorkAreaDisk } from '../folder-gate/disk.js';
11
+ import { MacFolderGate } from '../folder-gate/gate.js';
12
+ import { folderHelperCommand } from '../folder-gate/helper.js';
13
+ import { installFolderGate } from '../folder-gate/install.js';
14
+ import { INSTALL_MODE, INSTALL_ROOT } from '../install/mode.js';
15
+ /** The module of the relay thread for the install at `root`: TypeScript in a clone, JavaScript in the package. */
16
+ export function folderRelayUrl(root = INSTALL_ROOT, mode = INSTALL_MODE) {
17
+ const file = mode === 'package' ? 'relay-worker.js' : 'relay-worker.ts';
18
+ return pathToFileURL(path.join(root, 'server', 'src', 'folder-gate', file));
19
+ }
20
+ /** Installs the gate when `enabled`; `null` when off, and then nothing was made. */
21
+ export function startFolderGate(options) {
22
+ if (!options.enabled) {
23
+ options.log('folder gate: off, disk calls in guarded folders run in the server process');
24
+ return null;
25
+ }
26
+ const client = new RelayFolderClient({ relay: folderRelayUrl(), helper: folderHelperCommand() });
27
+ const gate = new MacFolderGate({ home: options.home, client, boundMs: FOLDER_SYNC_BOUND_MS, log: options.log });
28
+ const uninstall = installFolderGate(gate);
29
+ const unroute = routeWorkAreaDisk({ gate, client, home: options.home });
30
+ options.log('folder gate: on, disk calls in guarded folders run in a helper process per folder');
31
+ const folders = new Set();
32
+ for (const root of options.roots) {
33
+ const folder = gate.stateOf(root)?.folder;
34
+ if (folder !== undefined)
35
+ folders.add(folder);
36
+ }
37
+ for (const folder of [...folders].sort()) {
38
+ // A call on `/`, not in the folder: the helper starts, and macOS has nothing to ask about.
39
+ void client.call(folder, 'lstat', { path: '/' });
40
+ options.log(`folder gate: started the helper of ${path.basename(folder)}, a root lies in it`);
41
+ }
42
+ let disposed = false;
43
+ return {
44
+ gate,
45
+ dispose: () => {
46
+ if (disposed)
47
+ return;
48
+ disposed = true;
49
+ unroute();
50
+ uninstall();
51
+ gate.dispose();
52
+ client.dispose();
53
+ },
54
+ };
55
+ }
@@ -9,7 +9,7 @@ import { devicePairedNotifier } from '../device-effects.js';
9
9
  import { createRouter } from '../router.js';
10
10
  import { tailnetReader } from '../tailnet.js';
11
11
  export function buildRouter(assembly) {
12
- const { config, manager, hub, serverStartId, startedAtMs, log, health, system, macStats, demoUsage, demoVoice, demoNotes, term, companion, notifier, presence, apns, loginLimiter, irohPair, devices, pairing, reviewConstants, demoHost, } = assembly;
12
+ const { config, manager, hub, serverStartId, startedAtMs, log, health, system, macStats, demoUsage, demoVoice, demoNotes, term, companion, notifier, presence, apns, loginLimiter, irohPair, devices, pairing, reviewConstants, demoHost, inbox, fileDownloads, } = assembly;
13
13
  /*
14
14
  * Nazwa tailnetu dla nagłówka AGENCI. Czytana LENIWIE i z terminem
15
15
  * ważności — `tailnetReader` spawnuje `tailscale status` najwyżej raz na minutę i nigdy
@@ -22,7 +22,7 @@ export function buildRouter(assembly) {
22
22
  const tailnet = reviewConstants !== null ? undefined
23
23
  : demoHost !== null ? () => Promise.resolve(demoHost.tailnet) : tailnetReader();
24
24
  return createRouter({
25
- config, manager, hub, serverStartId, startedAtMs, logger: log, health, system,
25
+ config, manager, hub, serverStartId, startedAtMs, logger: log, health, system, fileDownloads,
26
26
  ...(tailnet === undefined ? {} : { tailnet }),
27
27
  mac: () => macStats.current(),
28
28
  ...(demoUsage === undefined ? {} : { usage: demoUsage }),
@@ -35,6 +35,7 @@ export function buildRouter(assembly) {
35
35
  // APNs) — bez kanału nie ma czego bramkować, a beacon staje się no-opem (patrz `RouterDeps`).
36
36
  ...(notifier !== null ? { presence } : {}),
37
37
  ...(apns !== undefined ? { apns } : {}),
38
+ ...(inbox === null || inbox === undefined ? {} : { inbox }),
38
39
  loginLimiter,
39
40
  iroh: irohPair,
40
41
  devices: {
@@ -1,18 +1,21 @@
1
1
  /**
2
2
  * Server start: the Inbox (`server/src/inbox/`). It joins the session manager's event stream and conversation
3
- * changes to the card tracker and reads every session's card once after the manager is ready. It works without push
4
- * notifications; `main()` in `server/src/index.ts` calls it after creating the manager and before `ready` settles.
3
+ * changes to the card tracker, reads every session's card once after the manager is ready, and puts the heads
4
+ * publisher for the stream on the tracker. In demo mode the segments come from the demo sessions' events
5
+ * (`demo/inbox.ts`) and the removals go to `inbox.json` of the demo data directory. It works without push
6
+ * notifications; `main()` in `server/src/index.ts` calls {@link assembleInbox} after creating the manager and before
7
+ * `ready` settles.
5
8
  */
6
9
  import { defaultStoreRoot } from '../cli-store.js';
7
10
  import { HERDR_HISTORY_MESSAGES } from '../config.js';
8
11
  import { HISTORY_MAX_BYTES } from '../herdr/jsonl-follow.js';
9
12
  import { locateTranscript } from '../herdr/transcript-path.js';
10
- import { Inbox, createSegmentReader } from '../inbox/index.js';
13
+ import { Inbox, InboxHeads, createSegmentReader } from '../inbox/index.js';
11
14
  export function startInbox(deps) {
12
15
  const { manager } = deps;
13
16
  const inbox = new Inbox({
14
17
  dataDir: deps.dataDir,
15
- readSegments: createSegmentReader({
18
+ readSegments: deps.readSegments ?? createSegmentReader({
16
19
  locate: deps.locate ?? ((cwd, agentSessionId) => locateTranscript(defaultStoreRoot(), cwd, agentSessionId)),
17
20
  promptBlock: deps.promptBlock,
18
21
  limit: HERDR_HISTORY_MESSAGES,
@@ -27,3 +30,25 @@ export function startInbox(deps) {
27
30
  void deps.ready.then(() => { inbox.refreshAll(); }, () => undefined);
28
31
  return inbox;
29
32
  }
33
+ /**
34
+ * The Inbox of this start: `null` with `RAROG_INBOX=0` (no tracker, no heads, the routes answer 503, `inbox.json`
35
+ * untouched). The heads publisher subscribes to the tracker at once, before the first card read, so it holds every
36
+ * visible card when the first stream opens.
37
+ */
38
+ export async function assembleInbox(deps) {
39
+ const { config, manager } = deps;
40
+ if (!config.inboxEnabled)
41
+ return null;
42
+ const demo = config.demo ? await import('../demo/inbox.js') : null;
43
+ const port = demo === null ? manager : demo.demoInboxManager(manager);
44
+ const inbox = startInbox({
45
+ manager: port, ready: deps.ready, dataDir: config.dataDir, promptBlock: config.promptBlock, log: deps.log,
46
+ ...(demo === null ? {} : { readSegments: demo.createDemoSegmentReader(port) }),
47
+ ...(deps.locate === undefined ? {} : { locate: deps.locate }),
48
+ ...(deps.debounceMs === undefined ? {} : { debounceMs: deps.debounceMs }),
49
+ });
50
+ const heads = new InboxHeads(inbox);
51
+ if (demo !== null)
52
+ void deps.ready.then(() => { demo.replayDemoDialogs(port, inbox); }, () => undefined);
53
+ return { inbox, heads };
54
+ }
@@ -6,7 +6,7 @@ import { projectsWithNotes } from '../notes/store.js';
6
6
  import { SseHub } from '../sse.js';
7
7
  /** The hub, not started yet: `main()` calls `start()`. */
8
8
  export function createSseHub(deps) {
9
- const { config, manager, serverStartId, log, demoNotes, onClientCount } = deps;
9
+ const { config, manager, serverStartId, log, demoNotes, onClientCount, inbox } = deps;
10
10
  return new SseHub({
11
11
  manager, serverStartId, protocolVersion: PROTOCOL_VERSION,
12
12
  // Linia `sse: powtórka … → snapshot` — koszt bajtów zamiany powtórki na snapshot.
@@ -14,6 +14,7 @@ export function createSseHub(deps) {
14
14
  // Stream compression with gzip, only for a client with `Accept-Encoding: gzip`; on unless `RAROG_SSE_GZIP=0`.
15
15
  gzip: config.sseGzip,
16
16
  ...(onClientCount === undefined ? {} : { onClientCount }),
17
+ ...(inbox === undefined ? {} : { inbox }),
17
18
  // Próg builda apki natywnej; brak w configu = brak pola w `hello`.
18
19
  ...(config.minClientBuild === undefined ? {} : { minClientBuild: config.minClientBuild }),
19
20
  /*
@@ -0,0 +1,162 @@
1
+ /**
2
+ * `rarog doctor`: consents without a hook. Reads the `consent: no hook — …` lines (`docs/dialogs.md`, "Refusal
3
+ * diagnostics") from the end of `<dataDir>/server.log`, keeps those of the last 7 days and prints one line per cause:
4
+ * `hooks-disabled`, `outside-work-area` and `not-in-session-hooks` are `warn` with a fix, `hook-running`,
5
+ * `unexplained` and a cause it does not know are `info`; none is one `info` line. No data directory or an unreadable
6
+ * log is `unknown`. Reads only; values reach the screen only from a closed character class.
7
+ */
8
+ import path from 'node:path';
9
+ import { HERDR_ROOTS_ENV } from '../config-env.js';
10
+ import { rarogCli } from '../install/repair.js';
11
+ import { LOG_TIME_PREFIX } from '../log-timestamps.js';
12
+ import { openRegularFile } from '../safe-read.js';
13
+ export const NO_HOOK_WINDOW_MS = 7 * 24 * 60 * 60 * 1000;
14
+ /** The end of `server.log` that doctor reads; under the service the log only grows. */
15
+ export const NO_HOOK_READ_BYTES = 32 * 1024 * 1024;
16
+ const SERVER_LOG_FILENAME = 'server.log';
17
+ const TITLE = 'consent without a hook';
18
+ const LINE_HEAD = 'consent: no hook — ';
19
+ const LOG_TIME = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z) /u;
20
+ /** A value doctor prints: anything else (terminal escapes, spaces) becomes `?`. */
21
+ const SAFE_VALUE = /^[A-Za-z0-9_.:@+-]{1,80}$/u;
22
+ const safe = (value) => (value !== undefined && SAFE_VALUE.test(value) ? value : '?');
23
+ /**
24
+ * The `no hook` lines of `text`; a line without the server's time prefix has no age, so it does not count, and
25
+ * neither does a continuation line of another log call (time, then `LOG_CONTINUATION_MARK`).
26
+ */
27
+ export function parseNoHookLog(text) {
28
+ const entries = [];
29
+ for (const raw of text.split('\n')) {
30
+ const time = LOG_TIME.exec(raw);
31
+ if (time === null)
32
+ continue;
33
+ const rest = raw.replace(LOG_TIME_PREFIX, '').trimEnd();
34
+ if (!rest.startsWith(LINE_HEAD))
35
+ continue;
36
+ const fields = new Map();
37
+ for (const part of rest.slice(LINE_HEAD.length).split(', ')) {
38
+ const space = part.indexOf(' ');
39
+ if (space > 0 && !fields.has(part.slice(0, space)))
40
+ fields.set(part.slice(0, space), part.slice(space + 1));
41
+ }
42
+ entries.push({
43
+ at: Date.parse(time[1] ?? ''), session: safe(fields.get('session')), cause: safe(fields.get('cause')),
44
+ tool: safe(fields.get('tool')), cli: safe(fields.get('cli')), thread: safe(fields.get('thread')),
45
+ });
46
+ }
47
+ return entries;
48
+ }
49
+ /** The causes in the order the detector checks them. */
50
+ const CAUSES = new Map([
51
+ ['hook-running', { verdict: 'info', why: 'the hook process ran without registering' }],
52
+ ['outside-work-area', {
53
+ verdict: 'warn', why: 'the session works in a directory outside Rarog\'s work area, where the hook does not write',
54
+ repair: () => `start the session in a directory under a root of the work area, or add its root to`
55
+ + ` ${HERDR_ROOTS_ENV} in config.json and run ${rarogCli('restart')}`,
56
+ }],
57
+ ['hooks-disabled', {
58
+ verdict: 'warn', why: 'the session\'s Claude Code settings turn hooks off (disableAllHooks)',
59
+ repair: () => 'remove "disableAllHooks": true from the settings the session reads (~/.claude/settings.json, the'
60
+ + ' project\'s .claude/settings.json or .claude/settings.local.json), or allowManagedHooksOnly from the managed'
61
+ + ' settings',
62
+ }],
63
+ ['not-in-session-hooks', {
64
+ verdict: 'warn', why: 'the settings the session reads have no Rarog hook entry',
65
+ repair: () => `${rarogCli('hooks doctor')} shows the entry in ~/.claude/settings.json and ${rarogCli('setup')}`
66
+ + ' installs it; with the entry in place, restart the Claude Code session',
67
+ }],
68
+ ['unexplained', { verdict: 'info', why: 'the hook did not register and the server sees no reason' }],
69
+ ]);
70
+ const UNKNOWN_CAUSE = { verdict: 'info', why: 'a cause this doctor does not know' };
71
+ /** `a (2), b (1)`: values by count, then by name. */
72
+ function counted(values) {
73
+ const counts = new Map();
74
+ for (const value of values)
75
+ counts.set(value, (counts.get(value) ?? 0) + 1);
76
+ return [...counts].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
77
+ .map(([value, count]) => `${value} (${String(count)})`).join(', ');
78
+ }
79
+ /** The doctor lines for a read of the log at `now`. */
80
+ export function noHookLinesOf(read, now) {
81
+ if (read === null) {
82
+ return [{ verdict: 'unknown', text: `${TITLE}: data directory in conflict — server.log location unknown` }];
83
+ }
84
+ if ('failure' in read)
85
+ return [{ verdict: 'unknown', text: `${TITLE}: ${read.file} unreadable (${read.failure})` }];
86
+ const from = now - NO_HOOK_WINDOW_MS;
87
+ const entries = parseNoHookLog(read.text).filter((entry) => entry.at >= from);
88
+ const firstTime = LOG_TIME.exec(read.text.split('\n').find((raw) => LOG_TIME.test(raw)) ?? '')?.[1];
89
+ const shortened = read.truncated && firstTime !== undefined && Date.parse(firstTime) > from
90
+ ? [`only the end of ${read.file} was read, from ${firstTime}`] : [];
91
+ if (entries.length === 0) {
92
+ return [{
93
+ verdict: 'info', text: `${TITLE}: none in the last 7 days (${read.file})`,
94
+ ...(shortened.length > 0 ? { details: shortened } : {}),
95
+ }];
96
+ }
97
+ const causes = [...new Set(entries.map((entry) => entry.cause))].sort((a, b) => {
98
+ const order = [...CAUSES.keys()];
99
+ const rank = (cause) => (order.includes(cause) ? order.indexOf(cause) : order.length);
100
+ return rank(a) - rank(b) || a.localeCompare(b);
101
+ });
102
+ return causes.map((cause) => {
103
+ const mine = entries.filter((entry) => entry.cause === cause);
104
+ const text = CAUSES.get(cause) ?? UNKNOWN_CAUSE;
105
+ const versions = [...new Set(mine.map((entry) => entry.cli))].sort().join(', ');
106
+ const sessions = new Set(mine.map((entry) => entry.session)).size;
107
+ return {
108
+ verdict: text.verdict,
109
+ text: `${TITLE}: ${String(mine.length)} in the last 7 days, cause ${cause} — ${text.why}`,
110
+ details: [
111
+ `Claude Code ${versions}; tools ${counted(mine.map((entry) => entry.tool))}; sessions ${String(sessions)}`,
112
+ ...shortened,
113
+ ],
114
+ ...(text.repair !== undefined ? { repair: text.repair() } : {}),
115
+ };
116
+ });
117
+ }
118
+ const errnoCode = (failure) => {
119
+ const code = failure !== null && typeof failure === 'object' ? failure.code : undefined;
120
+ return typeof code === 'string' && code !== '' ? code : String(failure);
121
+ };
122
+ /**
123
+ * The end of `<dataDir>/server.log`, at most `maxBytes`, starting at a whole line. The byte before the cut is read
124
+ * too, so a cut that falls on a line start keeps that line.
125
+ */
126
+ async function readLogEnd(file, maxBytes) {
127
+ try {
128
+ const opened = await openRegularFile(file, { followSymlink: true });
129
+ if (opened === null)
130
+ return { file, failure: 'not a regular file' };
131
+ try {
132
+ const size = Number(opened.stats.size);
133
+ const start = Math.max(0, size - maxBytes - 1);
134
+ const buffer = Buffer.alloc(size - start);
135
+ let filled = 0;
136
+ while (filled < buffer.length) {
137
+ const { bytesRead } = await opened.handle.read(buffer, filled, buffer.length - filled, start + filled);
138
+ if (bytesRead === 0)
139
+ break;
140
+ filled += bytesRead;
141
+ }
142
+ let text = buffer.subarray(0, filled).toString('utf8');
143
+ if (start > 0) {
144
+ const cut = text.indexOf('\n');
145
+ text = cut === -1 ? '' : text.slice(cut + 1);
146
+ }
147
+ return { file, text, truncated: start > 0 };
148
+ }
149
+ finally {
150
+ await opened.handle.close();
151
+ }
152
+ }
153
+ catch (failure) {
154
+ return { file, failure: errnoCode(failure) };
155
+ }
156
+ }
157
+ /** The lines for the data directory `doctor` resolved (`null` = directories in conflict). */
158
+ export async function noHookLines(dataDir, now, opts = {}) {
159
+ const read = dataDir === null
160
+ ? null : await readLogEnd(path.join(dataDir, SERVER_LOG_FILENAME), opts.maxBytes ?? NO_HOOK_READ_BYTES);
161
+ return noHookLinesOf(read, now);
162
+ }
@@ -50,6 +50,7 @@ import { RAROG_BIN } from '../install/service-target.js';
50
50
  import { IROH_PACKAGE, irohModuleInfo, irohPlatform } from '../iroh/adapter.js';
51
51
  import { readRegularFileSync } from '../safe-read.js';
52
52
  import { RAROG_VERSION } from '../version.js';
53
+ import { noHookLines } from './doctor-no-hook.js';
53
54
  import { prStatusLine } from './doctor-pr-status.js';
54
55
  import { writeBlockLine } from './doctor-write-block.js';
55
56
  import { HOOK_CHECKOUT_REASON, HOOK_REPAIR_COPY, HOOK_REPAIR_ENTRY, seenByFileLines, } from './hooks.js';
@@ -1510,6 +1511,7 @@ export async function doctorCommand(argv, io) {
1510
1511
  hookLine(home, health, dataDir),
1511
1512
  consentLineOf(health, thresholdOf(built?.env ?? null)),
1512
1513
  channelSettingsLine(home, dataDir),
1514
+ ...await noHookLines(dataDir, Date.now()),
1513
1515
  writeBlockLine(io, home, platform, manager, flags.dataDir),
1514
1516
  statusLineLine(home, Date.now()),
1515
1517
  // A loaded herdr agent starts herdr with `launchctl kickstart` (`setup-herdr-agent.ts`).
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The server log of the service (`<dataDir>/server.log`) before launchd or systemd opens it: `rarog service install`
3
+ * creates the file with mode 0600 and sets an existing one to 0600. Both supervisors open the log for appending and
4
+ * keep its mode, so the server process umask stays as it is (directories the server creates keep their modes).
5
+ * A path that is not a regular file (a symlink, a FIFO) is left alone, and an error is one line, not a failure: the
6
+ * install has already stopped the server, and the service starts with the log as it was.
7
+ */
8
+ import { chmodSync, lstatSync, writeFileSync } from 'node:fs';
9
+ import { out } from './io.js';
10
+ const LOG_MODE = 0o600;
11
+ /** Creates the log with mode 0600 or sets a regular file to 0600, and prints one line about it. */
12
+ export function prepareServiceLog(io, file) {
13
+ try {
14
+ const found = lstatSync(file, { throwIfNoEntry: false });
15
+ if (found !== undefined && !found.isFile()) {
16
+ out(io, ` server log ${file}: not a regular file, mode left as it is`);
17
+ return;
18
+ }
19
+ writeFileSync(file, '', { flag: 'a', mode: LOG_MODE });
20
+ chmodSync(file, LOG_MODE);
21
+ out(io, ` server log ${file} (mode 0600)`);
22
+ }
23
+ catch (failure) {
24
+ const code = failure.code ?? String(failure);
25
+ out(io, ` server log ${file}: mode 0600 not set (${code}), the service appends to it as it is`);
26
+ }
27
+ }
@@ -20,7 +20,7 @@
20
20
  * (`loadState` z `restart.ts`), a „nie wiem” (`launchctl print` z kodem innym niż 0 i 113) to odmowa przed
21
21
  * `bootout`.
22
22
  * - **faza 1:** `bootout` `ai.rarog.server`, jeśli jest załadowana, z czekaniem (do 30 s), aż launchd zdejmie
23
- * etykietę ({@link waitUntilAbsent}); katalog danych 0700 (launchd zakłada plik logu, ale nie katalog); zapis
23
+ * etykietę ({@link waitUntilAbsent}); katalog danych 0700, przed `bootstrap` plik logu 0600 (`service-log.ts`); zapis
24
24
  * plistu; `bootstrap`; `scripts/restart.sh` z etykietą, portem i logiem (ubija resztki na porcie, `kickstart`,
25
25
  * health), wołany wprost, bo blokadę trzyma już `install`; na końcu dowiązanie `~/.local/bin/rarog` (tylko klon
26
26
  * repo; w paczce polecenie `rarog` daje menedżer paczek).
@@ -48,7 +48,7 @@
48
48
  * `~/.config/systemd/user`; jednostka bez drop-inów; węzeł; `curl`, `ps`, `pgrep`; `serve --check` na środowisku
49
49
  * menedżera; gniazdo ≤ 103 B i żaden serwer tych danych na innym porcie; wrapper; jednostka z szablonu w pliku
50
50
  * tymczasowym i `systemd-analyze verify` (tryb systemowy, działa bez menedżera; brak narzędzia = linia „nie
51
- * sprawdzone”); pełne `--check` przez wrapper (ten sam katalog danych i port co bez niego); stan jednostki. Faza 1: zapis atomowy, `daemon-reload`, `enable`, katalog danych 0700, `restart.sh`
51
+ * sprawdzone”); pełne `--check` przez wrapper (ten sam katalog danych i port co bez niego); stan jednostki. Faza 1: zapis atomowy, `daemon-reload`, `enable`, katalog danych 0700, plik logu 0600, `restart.sh`
52
52
  * z `RAROG_RESTART_UNIT`, linia o lingerze, dowiązanie; porażka wypisuje komendy powrotu. `uninstall` = `disable
53
53
  * --now`, unit file removal, `daemon-reload`, this clone's symlink as on macOS. Inna platforma = odmowa.
54
54
  */
@@ -69,6 +69,7 @@ import { SETTINGS_BACKUP_DIRNAME, copyRemovalCheck, entriesDiff, entriesQuestion
69
69
  import { EXIT_OK, EXIT_REFUSED, Refusal, Usage, err, homeOf, isYes, out, platformOf, terminalOf } from './io.js';
70
70
  import { childExitText } from './child-output.js';
71
71
  import { acquireLock } from './lock.js';
72
+ import { prepareServiceLog } from './service-log.js';
72
73
  import { LAUNCHD_PATH, LINUX_RESTART_TOOLS, NOTHING_STOPPED, SERVICE_LABEL, accepts, decidedLoadState, installedServiceDataDir, launchdDomain, launchdEnv, launchdTarget, loadState, nodeRequirement, onPath, refuseLaunchdDataDirEnv, runRestartScript, scriptEnv, serviceNodeVersionOk, servicePackageFromClone, servicePackageText, servicePlistArgv, servicePlistPath, unitArgv, } from './restart.js';
73
74
  import { confirm as confirmForm } from './screen/ask.js';
74
75
  import { layoutOf } from './screen/style.js';
@@ -605,6 +606,7 @@ async function switchOver(io, prepared, fail, wait, output) {
605
606
  const plistFile = servicePlistPath(home);
606
607
  try {
607
608
  mkdirSync(dataDir, { recursive: true, mode: 0o700 });
609
+ prepareServiceLog(io, path.join(dataDir, 'server.log'));
608
610
  mkdirSync(path.dirname(plistFile), { recursive: true });
609
611
  writeAtomic(plistFile, plist);
610
612
  out(io, ` plist ${plistFile}`);
@@ -971,6 +973,7 @@ async function applyUnit(io, prepared, output) {
971
973
  out(io, ` systemctl --user ${args.join(' ')}`);
972
974
  }
973
975
  mkdirSync(dataDir, { recursive: true, mode: 0o700 });
976
+ prepareServiceLog(io, path.join(dataDir, 'server.log'));
974
977
  out(io, ` restart.sh with unit ${UNIT_NAME}, port ${String(port)}:`);
975
978
  const result = await runRestartScript(scriptEnv(io, {
976
979
  RAROG_RESTART_UNIT: UNIT_NAME,
@@ -26,7 +26,7 @@
26
26
  <!-- `Interactive`, not `Background`: the server serves a person in real time. -->
27
27
  <key>ProcessType</key>
28
28
  <string>Interactive</string>
29
- <!-- Server log in the data directory; launchd APPENDS to it (it creates the file, the installation the directory). -->
29
+ <!-- Server log in the data directory, mode 0600: the installation creates it, launchd APPENDS to it. -->
30
30
  <key>StandardOutPath</key>
31
31
  <string>{{LOG}}</string>
32
32
  <key>StandardErrorPath</key>
@@ -17,7 +17,7 @@ WorkingDirectory={{WORKING_DIRECTORY}}
17
17
  ExecStart={{EXEC_START}}
18
18
  Restart=always
19
19
  RestartSec=2
20
- # Server log in the data directory, appended; the installation creates the directory.
20
+ # Server log in the data directory, mode 0600: the installation creates the directory and the file, systemd appends.
21
21
  StandardOutput=append:{{LOG}}
22
22
  StandardError=append:{{LOG}}
23
23