@geohar/un-bien 0.7.0 → 0.9.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 (89) hide show
  1. package/README.md +237 -268
  2. package/dist/bin/launcher.js +38 -0
  3. package/dist/bin/launcher.js.map +1 -0
  4. package/dist/config.d.ts +41 -1
  5. package/dist/config.js.map +1 -1
  6. package/dist/daemon/install.d.ts +33 -35
  7. package/dist/daemon/install.js +43 -73
  8. package/dist/daemon/install.js.map +1 -1
  9. package/dist/enrich_tool_args.d.ts +9 -0
  10. package/dist/enrich_tool_args.js +171 -0
  11. package/dist/enrich_tool_args.js.map +1 -0
  12. package/dist/image_codec.d.ts +22 -0
  13. package/dist/image_codec.js +149 -0
  14. package/dist/image_codec.js.map +1 -0
  15. package/dist/index.d.ts +0 -26
  16. package/dist/index.js +235 -1237
  17. package/dist/index.js.map +1 -1
  18. package/dist/launch.d.ts +34 -0
  19. package/dist/launch.js +171 -0
  20. package/dist/launch.js.map +1 -0
  21. package/dist/launcher/launcher.d.ts +6 -0
  22. package/dist/launcher/launcher.js +188 -0
  23. package/dist/launcher/launcher.js.map +1 -0
  24. package/dist/pairing/crypto.d.ts +4 -0
  25. package/dist/pairing/crypto.js +10 -0
  26. package/dist/pairing/crypto.js.map +1 -1
  27. package/dist/pairing/peer_trust.d.ts +20 -0
  28. package/dist/pairing/peer_trust.js +82 -0
  29. package/dist/pairing/peer_trust.js.map +1 -0
  30. package/dist/pairing/storage.d.ts +51 -26
  31. package/dist/pairing/storage.js +346 -136
  32. package/dist/pairing/storage.js.map +1 -1
  33. package/dist/panel_bridge.d.ts +3 -1
  34. package/dist/panel_bridge.js +10 -10
  35. package/dist/panel_bridge.js.map +1 -1
  36. package/dist/rooms.d.ts +16 -0
  37. package/dist/rooms.js +22 -0
  38. package/dist/rooms.js.map +1 -1
  39. package/dist/session/debug_log.js +2 -2
  40. package/dist/session/debug_log.js.map +1 -1
  41. package/dist/session/local_config.js +2 -0
  42. package/dist/session/local_config.js.map +1 -1
  43. package/dist/session/rpc_envelope.d.ts +18 -0
  44. package/dist/session/rpc_envelope.js +1 -1
  45. package/dist/session/rpc_envelope.js.map +1 -1
  46. package/dist/session/rpc_inbound.d.ts +2 -2
  47. package/dist/session/rpc_inbound.js +1 -1
  48. package/dist/session/rpc_inbound.js.map +1 -1
  49. package/dist/subagent_rooms.d.ts +49 -0
  50. package/dist/subagent_rooms.js +787 -0
  51. package/dist/subagent_rooms.js.map +1 -0
  52. package/dist/transport/peer_channel.d.ts +7 -1
  53. package/dist/transport/peer_channel.js +8 -1
  54. package/dist/transport/peer_channel.js.map +1 -1
  55. package/dist/transport/relay_client.d.ts +19 -0
  56. package/dist/transport/relay_client.js.map +1 -1
  57. package/docs/daemon.md +65 -64
  58. package/package.json +13 -11
  59. package/service-templates/launchd.plist.template +5 -5
  60. package/service-templates/systemd.service.template +2 -2
  61. package/service-templates/task-launcher.vbs.template +5 -5
  62. package/service-templates/task-scheduler.xml.template +1 -1
  63. package/dist/bin/supervisord.js +0 -86
  64. package/dist/bin/supervisord.js.map +0 -1
  65. package/dist/daemon/client.d.ts +0 -20
  66. package/dist/daemon/client.js +0 -131
  67. package/dist/daemon/client.js.map +0 -1
  68. package/dist/daemon/control_protocol.d.ts +0 -176
  69. package/dist/daemon/control_protocol.js +0 -63
  70. package/dist/daemon/control_protocol.js.map +0 -1
  71. package/dist/daemon/cron_log.d.ts +0 -45
  72. package/dist/daemon/cron_log.js +0 -71
  73. package/dist/daemon/cron_log.js.map +0 -1
  74. package/dist/daemon/cron_registry.d.ts +0 -80
  75. package/dist/daemon/cron_registry.js +0 -198
  76. package/dist/daemon/cron_registry.js.map +0 -1
  77. package/dist/daemon/id.d.ts +0 -24
  78. package/dist/daemon/id.js +0 -36
  79. package/dist/daemon/id.js.map +0 -1
  80. package/dist/daemon/registry.d.ts +0 -63
  81. package/dist/daemon/registry.js +0 -153
  82. package/dist/daemon/registry.js.map +0 -1
  83. package/dist/daemon/rpc_child.d.ts +0 -194
  84. package/dist/daemon/rpc_child.js +0 -419
  85. package/dist/daemon/rpc_child.js.map +0 -1
  86. package/dist/daemon/supervisor.d.ts +0 -93
  87. package/dist/daemon/supervisor.js +0 -666
  88. package/dist/daemon/supervisor.js.map +0 -1
  89. /package/dist/bin/{supervisord.d.ts → launcher.d.ts} +0 -0
@@ -1,93 +0,0 @@
1
- import { type CronResult } from "./cron_log.js";
2
- /** Thrown by `start()` when another live supervisor already holds the UDS.
3
- * Prevents a second supervisor from orphaning the first's children. */
4
- export declare class SupervisorAlreadyRunningError extends Error {
5
- readonly sockPath: string;
6
- constructor(sockPath: string);
7
- }
8
- export interface SupervisorOptions {
9
- /** Absolute path to un-bien's dist/index.js — passed as -e to each
10
- * spawned `pi`. Defaults to the location relative to where this file
11
- * is bundled (so the supervisor finds itself). */
12
- extensionPath: string;
13
- /** Override the `pi` binary path. Defaults to "pi" on PATH. */
14
- piBin?: string;
15
- }
16
- /** Pure decision for `fireJob` (plan/39) — picks the action from the daemon's
17
- * liveness/busy state + the job's flags. Tested in isolation for all 4 ramos. */
18
- export type FireAction = "send" | "wake_and_send" | "skip_down" | "skip_busy";
19
- export declare function decideFireAction(o: {
20
- running: boolean;
21
- busy: boolean;
22
- wake: boolean;
23
- skipIfBusy: boolean;
24
- }): FireAction;
25
- export declare class Supervisor {
26
- private readonly opts;
27
- private server;
28
- private readonly children;
29
- /** Live croner schedules, keyed by cron job id (plan/39). */
30
- private readonly cronJobs;
31
- private shuttingDown;
32
- constructor(opts: SupervisorOptions);
33
- /** Bind the control UDS + spawn all registered daemons. */
34
- start(): Promise<void>;
35
- /** Graceful shutdown: stop all children, close UDS. */
36
- stop(): Promise<void>;
37
- private _mkdirParent;
38
- private _bindUds;
39
- private _onConnection;
40
- private _handleRequest;
41
- private _listInfo;
42
- private _opStartAll;
43
- /** Spawn a single registered daemon by id. Idempotent: a daemon already
44
- * running returns `started: false`. Unknown id → ok:false. This is what
45
- * `/unbien create` calls so a freshly-registered folder boots its Pi
46
- * immediately instead of waiting for the next supervisor restart. */
47
- private _opStart;
48
- private _opStopAll;
49
- /** Stop a single registered daemon by id. Idempotent: a daemon that isn't
50
- * running returns `stopped: false`. Unknown id → ok:false. Mirrors the
51
- * per-id semantics of `_opStart`. Cancels any pending restart backoff so a
52
- * deliberate stop stays stopped. */
53
- private _opStop;
54
- /** Restart a single registered daemon by id (stop-if-running, then spawn).
55
- * Unknown id → ok:false. Resets the crash backoff. */
56
- private _opRestart;
57
- private _opRestartAll;
58
- private _opSend;
59
- private _opRegister;
60
- private _opUnregister;
61
- private _opCronAdd;
62
- private _opCronList;
63
- private _opCronRemove;
64
- private _opCronEnable;
65
- private _opCronRun;
66
- private _opCronLog;
67
- private _jobView;
68
- /** Rebuild all live `Cron` schedules from the registry (enabled jobs only).
69
- * Called on start; mutations reconcile incrementally via _scheduleCron/_stopCron. */
70
- private _reconcileCron;
71
- private _scheduleCron;
72
- private _stopCron;
73
- /** Detail 2: on start, run a catchup job once if its previous scheduled run
74
- * was missed while the supervisor was down. Opt-in (`catchup`), at most 1×. */
75
- private _runCatchup;
76
- /**
77
- * Fires a cron job: resolves the daemon, decides the action (decideFireAction),
78
- * acts, and records the outcome — ALWAYS one `last_status` update + one JSONL
79
- * line, for both fires and skips. Returns the result. `manual` bypasses the
80
- * disabled-skip (used by `cron run` + catchup).
81
- */
82
- fireJob(jobId: string, opts?: {
83
- manual?: boolean;
84
- }): Promise<CronResult | "missing">;
85
- private _spawnAllFromRegistry;
86
- private _spawnEntry;
87
- private _onChildExit;
88
- }
89
- /** Test helper: derive id from cwd without going through the registry. */
90
- export declare function _idForCwdForTest(cwd: string): string;
91
- /** Exported for the bin/supervisord entry + tests to know where the
92
- * supervisor will bind. */
93
- export declare function getSupervisorSockPath(): string;