@skrr-ai/cli 0.1.190 → 0.1.192

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 (30) hide show
  1. package/dist/commands/convos/handover.js +8 -3
  2. package/dist/commands/duties/preflight.d.ts +1 -1
  3. package/dist/commands/duties/preflight.js +24 -10
  4. package/dist/commands/harnesses/evaluations/platform-h9-turn.js +13 -3
  5. package/dist/commands/tasks/interrupt.js +12 -1
  6. package/dist/lib/agent-activity.js +7 -2
  7. package/dist/lib/agentic-stream.d.ts +6 -3
  8. package/dist/lib/agentic-stream.js +25 -6
  9. package/dist/lib/balance.js +8 -16
  10. package/dist/lib/computer-files.js +4 -0
  11. package/dist/lib/h9-platform-stream.d.ts +2 -0
  12. package/dist/lib/h9-platform-stream.js +10 -3
  13. package/dist/lib/write-outcome.d.ts +1 -1
  14. package/dist/lib/write-outcome.js +3 -1
  15. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/systemdUserUnit.d.ts +49 -0
  16. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/systemdUserUnit.js +93 -0
  17. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/systemdUserUnit.d.ts +49 -0
  18. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/systemdUserUnit.js +108 -0
  19. package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
  20. package/dist/node_modules/@skrr-ai/data-provider/index.js +7281 -7259
  21. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +2 -2
  22. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +4 -0
  23. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +38 -0
  24. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +77 -12
  25. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +2 -2
  26. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +2 -2
  27. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +38 -0
  28. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +113 -13
  29. package/oclif.manifest.json +4 -4
  30. package/package.json +2 -2
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The [Service] lines that decide what a stop or restart of the local daemon takes with it, for
3
+ * every systemd USER unit that starts the daemon on a person's Linux machine.
4
+ *
5
+ * Two programs write such a unit, and both render these lines from here:
6
+ *
7
+ * - `skrrd install` / `skrrd setup`: `daemon/src/service/systemd.ts`
8
+ * (`~/.config/systemd/user/<profile unit>.service`);
9
+ * - the desktop app: `desktop/src/main/daemon/service/linux-systemd.ts`
10
+ * (`~/.config/systemd/user/oversky-daemon.service`).
11
+ *
12
+ * They were two copies, and they drifted. `skrrd install` has written `KillMode=process` since
13
+ * OSK-2059; the desktop unit never carried a `KillMode` at all, so it ran with systemd's default
14
+ * `control-group`, and a daemon self-restart (exit 75) or a `systemctl --user restart` killed every
15
+ * process in the unit's cgroup: each detached session wrapper and the harness it was running. That
16
+ * is the class of bug OSK-26592 fixed for the Dedicated Runtime unit and OSK-32266 for the SPACE
17
+ * staging unit. `daemon/src/wrapper/session-cgroup.test.ts` fails when a source file under
18
+ * daemon/src, desktop/src, cli/src or packages writes a unit with a `[Service]` section that does
19
+ * not render these lines, or sets one of their keys itself.
20
+ *
21
+ * What a USER unit deliberately does NOT copy from those two system units: `Delegate=yes`,
22
+ * `DelegateSubgroup=daemon` and the root `ExecStopPost=+` script. That contract works because a
23
+ * wrapper on a managed guest moves itself out of the daemon's delegated leaf
24
+ * (`daemon/src/wrapper/session-cgroup.ts`), which lets the stop-post script end the daemon's other
25
+ * children on every exit while sessions survive. On a person's machine the wrapper never moves
26
+ * (`joinSessionCgroup` returns `not-a-guest`), so a delegated leaf would only change where the
27
+ * daemon runs; `DelegateSubgroup=` needs systemd 254, an older manager ignores it with a warning;
28
+ * and nothing here installs a stop-post script. `KillMode=process` alone keeps a wrapper alive
29
+ * across a restart on every systemd that runs user units, with the reaping trade-off the lines
30
+ * themselves state.
31
+ *
32
+ * The restart policy (`Restart=`, `RestartPreventExitStatus=`, `StartLimit*`) is NOT here: it is
33
+ * each supervisor's own choice. `skrrd install` is the daemon's only supervisor and maps its exit
34
+ * codes (docs/daemon-supervisor-contract.md); the desktop app supervises its daemon as well and
35
+ * restarts it on any failure, as its launchd agent does on macOS.
36
+ *
37
+ * The text is rendered into the unit file verbatim, so it is systemd syntax: `#` comments and
38
+ * `Key=value` lines. Changing it changes every unit both writers render, and each rewrites its unit
39
+ * the next time it installs.
40
+ */
41
+ /** The directives the lines below set, by key. Each appears in them exactly once. */
42
+ export declare const SYSTEMD_USER_UNIT_PROCESS_DIRECTIVES: Readonly<Record<string, string>>;
43
+ /**
44
+ * Keys of the Dedicated Runtime system unit's lifetime contract that a user unit must not set (see
45
+ * above). A user unit that sets one has copied a contract whose other half does not run here.
46
+ */
47
+ export declare const SYSTEMD_USER_UNIT_WITHHELD_DIRECTIVES: readonly string[];
48
+ /** The lines, comments included, for a user unit's `[Service]` section. No trailing newline. */
49
+ export declare const SYSTEMD_USER_UNIT_PROCESS_LINES: string;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The [Service] lines that decide what a stop or restart of the local daemon takes with it, for
3
+ * every systemd USER unit that starts the daemon on a person's Linux machine.
4
+ *
5
+ * Two programs write such a unit, and both render these lines from here:
6
+ *
7
+ * - `skrrd install` / `skrrd setup`: `daemon/src/service/systemd.ts`
8
+ * (`~/.config/systemd/user/<profile unit>.service`);
9
+ * - the desktop app: `desktop/src/main/daemon/service/linux-systemd.ts`
10
+ * (`~/.config/systemd/user/oversky-daemon.service`).
11
+ *
12
+ * They were two copies, and they drifted. `skrrd install` has written `KillMode=process` since
13
+ * OSK-2059; the desktop unit never carried a `KillMode` at all, so it ran with systemd's default
14
+ * `control-group`, and a daemon self-restart (exit 75) or a `systemctl --user restart` killed every
15
+ * process in the unit's cgroup: each detached session wrapper and the harness it was running. That
16
+ * is the class of bug OSK-26592 fixed for the Dedicated Runtime unit and OSK-32266 for the SPACE
17
+ * staging unit. `daemon/src/wrapper/session-cgroup.test.ts` fails when a source file under
18
+ * daemon/src, desktop/src, cli/src or packages writes a unit with a `[Service]` section that does
19
+ * not render these lines, or sets one of their keys itself.
20
+ *
21
+ * What a USER unit deliberately does NOT copy from those two system units: `Delegate=yes`,
22
+ * `DelegateSubgroup=daemon` and the root `ExecStopPost=+` script. That contract works because a
23
+ * wrapper on a managed guest moves itself out of the daemon's delegated leaf
24
+ * (`daemon/src/wrapper/session-cgroup.ts`), which lets the stop-post script end the daemon's other
25
+ * children on every exit while sessions survive. On a person's machine the wrapper never moves
26
+ * (`joinSessionCgroup` returns `not-a-guest`), so a delegated leaf would only change where the
27
+ * daemon runs; `DelegateSubgroup=` needs systemd 254, an older manager ignores it with a warning;
28
+ * and nothing here installs a stop-post script. `KillMode=process` alone keeps a wrapper alive
29
+ * across a restart on every systemd that runs user units, with the reaping trade-off the lines
30
+ * themselves state.
31
+ *
32
+ * The restart policy (`Restart=`, `RestartPreventExitStatus=`, `StartLimit*`) is NOT here: it is
33
+ * each supervisor's own choice. `skrrd install` is the daemon's only supervisor and maps its exit
34
+ * codes (docs/daemon-supervisor-contract.md); the desktop app supervises its daemon as well and
35
+ * restarts it on any failure, as its launchd agent does on macOS.
36
+ *
37
+ * The text is rendered into the unit file verbatim, so it is systemd syntax: `#` comments and
38
+ * `Key=value` lines. Changing it changes every unit both writers render, and each rewrites its unit
39
+ * the next time it installs.
40
+ */
41
+ /** The directives the lines below set, by key. Each appears in them exactly once. */
42
+ export const SYSTEMD_USER_UNIT_PROCESS_DIRECTIVES = Object.freeze({
43
+ TimeoutStopSec: '30',
44
+ KillMode: 'process',
45
+ LimitNOFILE: '1048576',
46
+ });
47
+ /**
48
+ * Keys of the Dedicated Runtime system unit's lifetime contract that a user unit must not set (see
49
+ * above). A user unit that sets one has copied a contract whose other half does not run here.
50
+ */
51
+ export const SYSTEMD_USER_UNIT_WITHHELD_DIRECTIVES = Object.freeze([
52
+ 'Delegate',
53
+ 'DelegateSubgroup',
54
+ 'ExecStopPost',
55
+ ]);
56
+ /** The lines, comments included, for a user unit's `[Service]` section. No trailing newline. */
57
+ export const SYSTEMD_USER_UNIT_PROCESS_LINES = [
58
+ '# TimeoutStopSec: systemd default is 90 s. We set 30 s to match the',
59
+ '# 25 s disconnect deadline in index.ts (shutdown()) plus 5 s headroom,',
60
+ '# ensuring the daemon can flush the offline WAL before SIGKILL.',
61
+ 'TimeoutStopSec=30',
62
+ '# OSK-2059 — KillMode=process, NOT the default control-group.',
63
+ '#',
64
+ "# control-group tears down every process in the unit's cgroup when the main",
65
+ '# process exits, which killed the per-session WRAPPER CHILDREN the daemon',
66
+ '# spawns. Those children hold their own session-scoped token and POST envelopes',
67
+ '# straight to the API; wrapper-manifest.ts + wrapper-adoption.ts exist precisely',
68
+ '# so a restarted daemon can adopt them and harvest their response. Under',
69
+ '# control-group that machinery could never fire on Linux: a "systemctl restart",',
70
+ "# or the daemon's own exit-75 supervised restart (self-upgrade, reconnect storm,",
71
+ '# transport switch), took every in-flight agent session with it and the server',
72
+ '# finalized the task "failed" with no explanation.',
73
+ '#',
74
+ '# Detaching at the spawn site is not sufficient here — it escapes the POSIX',
75
+ '# process group but a cgroup kill reaches the child regardless. Only the unit',
76
+ '# can decide this.',
77
+ '#',
78
+ '# What we give up, stated plainly because the first version of this comment',
79
+ '# claimed a backstop that does not exist: the cgroup was the ONLY reaper of last',
80
+ "# resort for the daemon's other children (bash-tool children, which are spawned",
81
+ '# detached in their own process group, Engine Terminal PTYs, and the browser',
82
+ '# relay), and nothing replaces it on Linux.',
83
+ '#',
84
+ '# - Graceful exit is clean: connection.ts reaps all three explicitly',
85
+ '# (killActiveBashProcesses / killActiveSessions / terminalManager.killAll)',
86
+ '# before the process leaves.',
87
+ '# - Abnormal death is NOT covered. SIGKILL, an OOM kill, or a drain that',
88
+ '# overruns SHUTDOWN_DEADLINE_MS and gets SIGKILLed at TimeoutStopSec above',
89
+ '# leaks those children permanently. pid-tracker.ts does not see them: all',
90
+ '# seven trackPid() call sites are provider CLIs (tools/claude-session.ts and',
91
+ '# backends/{codex,copilot,cursor,acp,pi,openclaw}.ts), so its next-boot',
92
+ '# SIGTERM sweep has nothing to reap for bash, terminals, or the relay.',
93
+ '#',
94
+ '# Note also that wrapper children are NOT excluded from pid-tracker — each',
95
+ '# wrapper trackPid()s its own provider child, which is exactly why',
96
+ '# connection.ts::reapOrphansExcludingAdopted has to withhold adopted sessions',
97
+ '# from the boot reaper. Closing the gap means tracking the three untracked',
98
+ '# classes too, and that is not free: recoverOrphans() SIGTERMs every live entry',
99
+ '# on EVERY daemon:registered, so a naive trackPid() there would kill healthy',
100
+ '# in-flight children on an ordinary reconnect.',
101
+ 'KillMode=process',
102
+ '# OSK-1667 — raise the open-file-descriptor ceiling for the daemon and every',
103
+ '# wrapper child it spawns. A heavy provider session under concurrency exhausts',
104
+ "# the distro-default soft limit (often 1024) and an EMFILE from libuv's kqueue/",
105
+ '# epoll backend can hard-abort the wrapper. 1048576 matches the systemd',
106
+ '# hard-limit default and is inherited by all children.',
107
+ 'LimitNOFILE=1048576',
108
+ ].join('\n');
@@ -327,6 +327,16 @@
327
327
  "default": "./dist/cjs/restartArtifact.js"
328
328
  }
329
329
  },
330
+ "./systemd-user-unit": {
331
+ "import": {
332
+ "types": "./dist/esm/systemdUserUnit.d.ts",
333
+ "default": "./dist/esm/systemdUserUnit.js"
334
+ },
335
+ "require": {
336
+ "types": "./dist/cjs/systemdUserUnit.d.ts",
337
+ "default": "./dist/cjs/systemdUserUnit.js"
338
+ }
339
+ },
330
340
  "./master-kek-service": {
331
341
  "import": {
332
342
  "types": "./dist/esm/kek/masterKekService.d.ts",