toolroll 0.9.89 → 0.9.90

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 (136) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +16 -10
  3. package/THIRD_PARTY_NOTICES.md +37 -0
  4. package/dist/agent-board.d.ts +9 -0
  5. package/dist/agent-board.js +20 -0
  6. package/dist/agent-fence.js +20 -2
  7. package/dist/approval-authority.d.ts +7 -0
  8. package/dist/approval-authority.js +13 -2
  9. package/dist/browser/THIRD_PARTY_NOTICES.txt +692 -28
  10. package/dist/browser/terminal.js +42 -42
  11. package/dist/browser/workspace.css +1 -1
  12. package/dist/browser/workspace.js +32 -32
  13. package/dist/browser-workspace.d.ts +13 -0
  14. package/dist/builder.js +5 -2
  15. package/dist/chat-actions.d.ts +5 -0
  16. package/dist/chat-actions.js +7 -1
  17. package/dist/chat-delivery.js +2 -0
  18. package/dist/chat-task-actions.d.ts +1 -0
  19. package/dist/check-access.d.ts +3 -0
  20. package/dist/check-access.js +4 -1
  21. package/dist/cli-help.d.ts +1 -1
  22. package/dist/cli-help.js +6 -2
  23. package/dist/cli.d.ts +6 -0
  24. package/dist/cli.js +23 -0
  25. package/dist/coding-ui.js +4 -2
  26. package/dist/connect-cli.js +2 -1
  27. package/dist/console-instance.d.ts +34 -1
  28. package/dist/console-instance.js +124 -15
  29. package/dist/contracts/cli.d.ts +72 -0
  30. package/dist/contracts/cli.js +13 -0
  31. package/dist/contracts/console-api.d.ts +9 -2
  32. package/dist/contracts/console-api.js +9 -2
  33. package/dist/desktop-host.js +8 -3
  34. package/dist/desktop-update.js +2 -1
  35. package/dist/dispatch.d.ts +3 -0
  36. package/dist/dispatch.js +22 -2
  37. package/dist/easy-start-args.d.ts +13 -0
  38. package/dist/easy-start-args.js +24 -0
  39. package/dist/easy-start.d.ts +77 -0
  40. package/dist/easy-start.js +321 -0
  41. package/dist/first-run.d.ts +77 -0
  42. package/dist/first-run.js +45 -0
  43. package/dist/guides.js +1 -1
  44. package/dist/invoke.js +11 -6
  45. package/dist/laptop-background.d.ts +171 -0
  46. package/dist/laptop-background.js +550 -0
  47. package/dist/laptop-service.d.ts +111 -0
  48. package/dist/laptop-service.js +268 -0
  49. package/dist/lead-cli.js +2 -1
  50. package/dist/lead-doors.d.ts +6 -0
  51. package/dist/lead-doors.js +20 -2
  52. package/dist/live-records.d.ts +1 -1
  53. package/dist/live-records.js +3 -12
  54. package/dist/local-owner.d.ts +124 -0
  55. package/dist/local-owner.js +212 -0
  56. package/dist/login-secrets.d.ts +60 -0
  57. package/dist/login-secrets.js +195 -0
  58. package/dist/mcp-oauth.d.ts +4 -0
  59. package/dist/mcp-oauth.js +13 -7
  60. package/dist/model-choices.d.ts +43 -0
  61. package/dist/model-choices.js +80 -0
  62. package/dist/operate.d.ts +46 -1
  63. package/dist/operate.js +461 -40
  64. package/dist/person-proof.js +3 -0
  65. package/dist/project-knowledge.d.ts +7 -7
  66. package/dist/quick-start.d.ts +3 -1
  67. package/dist/quick-start.js +6 -1
  68. package/dist/release-cli.js +2 -1
  69. package/dist/runner-process.d.ts +9 -0
  70. package/dist/runner-process.js +18 -0
  71. package/dist/sample-project.d.ts +31 -0
  72. package/dist/sample-project.js +141 -0
  73. package/dist/scope.d.ts +24 -2
  74. package/dist/scope.js +74 -3
  75. package/dist/serve.js +129 -22
  76. package/dist/server/chat.js +10 -3
  77. package/dist/server/chrome.d.ts +10 -2
  78. package/dist/server/chrome.js +7 -5
  79. package/dist/server/console.css +10 -0
  80. package/dist/server/guards.d.ts +3 -0
  81. package/dist/server/guards.js +22 -2
  82. package/dist/server/http.d.ts +22 -0
  83. package/dist/server/http.js +58 -0
  84. package/dist/server/live.js +4 -14
  85. package/dist/server/mutation-key.d.ts +70 -0
  86. package/dist/server/mutation-key.js +142 -0
  87. package/dist/server/pages.js +10 -7
  88. package/dist/server/people-tokens.js +240 -20
  89. package/dist/server/remote.d.ts +2 -0
  90. package/dist/server/remote.js +19 -4
  91. package/dist/server/render-new-task.js +5 -1
  92. package/dist/server/render-pages.d.ts +2 -1
  93. package/dist/server/render-pages.js +1 -1
  94. package/dist/server/render-people.d.ts +36 -0
  95. package/dist/server/render-people.js +65 -1
  96. package/dist/server/render-projects.js +4 -2
  97. package/dist/server/render-tasks.d.ts +12 -0
  98. package/dist/server/render-tasks.js +12 -4
  99. package/dist/server/request-context.d.ts +6 -0
  100. package/dist/server/route-table.d.ts +16 -0
  101. package/dist/server/route-table.js +121 -0
  102. package/dist/server/runtime.d.ts +6 -4
  103. package/dist/server/session.d.ts +31 -1
  104. package/dist/server/session.js +12 -2
  105. package/dist/server/settings.js +63 -8
  106. package/dist/server/task-views.js +10 -1
  107. package/dist/server/tasks.d.ts +10 -0
  108. package/dist/server/tasks.js +59 -9
  109. package/dist/server/terminals.js +15 -2
  110. package/dist/server/welcome.d.ts +22 -16
  111. package/dist/server/welcome.js +150 -52
  112. package/dist/settings-groups-ui.d.ts +7 -1
  113. package/dist/settings-groups-ui.js +23 -2
  114. package/dist/settings-proofs.js +1 -0
  115. package/dist/setup-guide.d.ts +2 -2
  116. package/dist/store.d.ts +124 -1
  117. package/dist/store.js +245 -12
  118. package/dist/surface.d.ts +10 -0
  119. package/dist/surface.js +40 -1
  120. package/dist/task-text.d.ts +6 -0
  121. package/dist/task-text.js +17 -0
  122. package/dist/telegram-lead.js +2 -0
  123. package/dist/terminal-text.d.ts +11 -0
  124. package/dist/terminal-text.js +26 -0
  125. package/dist/toolroll-update.d.ts +8 -1
  126. package/dist/toolroll-update.js +151 -4
  127. package/dist/tui-contract.d.ts +118 -0
  128. package/dist/tui-contract.js +9 -0
  129. package/dist/tui-source.d.ts +14 -0
  130. package/dist/tui-source.js +182 -0
  131. package/dist/tui.js +129 -0
  132. package/dist/up-processes.d.ts +13 -1
  133. package/dist/up-processes.js +13 -3
  134. package/dist/welcome-facts.d.ts +18 -0
  135. package/dist/welcome-facts.js +79 -0
  136. package/package.json +4 -2
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Keeping Toolroll running in the background on a laptop (easy-start plan D): `toolroll background on|off|show`,
3
+ * `toolroll stop`, and the `laptop` part of `toolroll status`.
4
+ *
5
+ * The login item itself is laptop-service.ts's definition (com.toolroll.up / toolroll-up.service). This module is
6
+ * the handoff around it:
7
+ *
8
+ * - **on** writes and validates the unit without loading it, stops the foreground `up` this invoker owns (if one runs
9
+ * for this database) by SIGTERM to its controller and waits until that controller's whole process record is proved
10
+ * gone by start identity and the port is free, then loads the unit and proves the console live within 30 s. Any
11
+ * failure boots the unit out, removes it (or puts back the one that was there), starts the foreground `up` again if
12
+ * it was stopped, and says what failed. An identical unit already loaded is left alone.
13
+ * - **off** stops and removes only our own label.
14
+ * - **stop**: with the service loaded, the supervisor stops it (it comes back at login); otherwise the controller of
15
+ * the proven console, found through its signed process record, gets SIGTERM — never the console child, which the
16
+ * controller would only start again.
17
+ *
18
+ * Every outside effect goes through LaptopSeams: tests give a temporary HOME, a scripted launchctl/systemctl, and their
19
+ * own child processes. Without a supervisor seam, a test run (VITEST) refuses to reach the real launchctl or systemctl.
20
+ * Other services (the desktop app's com.toolroll.browser, a watch on this database) are reported, never touched.
21
+ */
22
+ import { type AttachProof } from "./console-instance.js";
23
+ import { type SupervisorRunner } from "./daemon.js";
24
+ import { type LaptopConflict } from "./laptop-service.js";
25
+ import { type ProcessProbe } from "./runner-process.js";
26
+ import type { Runner } from "./runner.js";
27
+ import { type Store } from "./store.js";
28
+ /** Everything outside this process that the background handoff touches. Tests replace all of it. */
29
+ export type LaptopSeams = {
30
+ platform?: NodeJS.Platform;
31
+ home?: string;
32
+ /** launchctl, systemctl, plutil and systemd-analyze. */
33
+ supervisor?: SupervisorRunner;
34
+ /** The absolute Node binary and package `dist` folder the unit pins (default: this process's). */
35
+ node?: string;
36
+ dist?: string;
37
+ pathEnv?: string;
38
+ /** A person at a terminal (stdin and stdout a TTY, no --json, not under a coding agent): only they may confirm. */
39
+ terminal?: boolean;
40
+ /** Run by a coding agent (prompt.ts underAgent): a login item is a person's own choice, so `on` refuses. */
41
+ agent?: boolean;
42
+ confirm?: (question: string) => Promise<boolean>;
43
+ /** Prove this database's console live (default: proveLiveConsole at this package's version). */
44
+ proveConsole?: (databaseFile: string, store: Store) => Promise<AttachProof>;
45
+ probe?: ProcessProbe;
46
+ /** A process's parent, or null when it can't be read. */
47
+ parentOf?: (pid: number) => number | null;
48
+ signal?: (pid: number, signal: NodeJS.Signals) => void;
49
+ portFree?: (port: number) => Promise<boolean>;
50
+ sleep?: (ms: number) => Promise<void>;
51
+ host?: string;
52
+ healthTimeoutMs?: number;
53
+ exitTimeoutMs?: number;
54
+ /** The foreground `up` this invoker started (the terminal UI's child): its controller's pid, and how to start it again. */
55
+ foreground?: {
56
+ controllerPid: number;
57
+ restart: () => Promise<void>;
58
+ };
59
+ };
60
+ export type BackgroundState = "on" | "off" | "other-service";
61
+ type Resolved = Required<Omit<LaptopSeams, "foreground" | "node" | "dist" | "pathEnv">> & Pick<LaptopSeams, "foreground" | "pathEnv"> & {
62
+ node: string;
63
+ dist: string;
64
+ };
65
+ export type ControllerProof = {
66
+ /** The `up` process that started the console: the one to stop. */
67
+ pid: number;
68
+ started: string;
69
+ consolePid: number;
70
+ port: number;
71
+ url: string;
72
+ runner: string;
73
+ /** The registration whose signed record names both, captured now: the exit proof uses exactly it. */
74
+ holder: {
75
+ runner: Runner;
76
+ credentialHash: string;
77
+ };
78
+ };
79
+ /**
80
+ * The controller of this database's live console, proved from the plane's own records: a live runner on this host
81
+ * whose signed process record names the proven console (pid and start time) and exactly one live `up` process, that
82
+ * `up` still the process the record names (same start time), and the console's parent that `up`. Anything else —
83
+ * no record, a reused pid, a console whose parent is someone else — proves nothing and is refused.
84
+ */
85
+ export declare function findController(store: Store, databaseFile: string, console_: {
86
+ pid: number;
87
+ port: number;
88
+ url: string;
89
+ }, s: Pick<Resolved, "probe" | "parentOf" | "host">): ControllerProof | {
90
+ why: string;
91
+ };
92
+ export type BackgroundShow = {
93
+ platform: NodeJS.Platform;
94
+ label: string | null;
95
+ unit: string | null;
96
+ installed: "same" | "different" | "absent";
97
+ loaded: boolean;
98
+ running: {
99
+ url: string;
100
+ pid: number;
101
+ } | null;
102
+ conflicts: LaptopConflict[];
103
+ port: number;
104
+ };
105
+ export declare function backgroundShow(store: Store, databaseFile: string, requestedPort: number | null, seams?: LaptopSeams): Promise<{
106
+ ok: true;
107
+ show: BackgroundShow;
108
+ } | {
109
+ ok: false;
110
+ reason: string;
111
+ message: string;
112
+ }>;
113
+ export type BackgroundOn = {
114
+ ok: true;
115
+ action: "unchanged" | "installed" | "replaced";
116
+ label: string;
117
+ unit: string;
118
+ url: string;
119
+ pid: number;
120
+ stoppedForeground: boolean;
121
+ } | {
122
+ ok: false;
123
+ reason: string;
124
+ message: string;
125
+ rolledBack?: string[];
126
+ };
127
+ /** `requestedPort`: --port, else the running console's, else the port this laptop install saved, else `up`'s default. */
128
+ export declare function backgroundOn(store: Store, databaseFile: string, requestedPort: number | null, seams?: LaptopSeams): Promise<BackgroundOn>;
129
+ export type BackgroundOff = {
130
+ ok: true;
131
+ action: "removed" | "already-off";
132
+ label: string;
133
+ unit: string;
134
+ } | {
135
+ ok: false;
136
+ reason: string;
137
+ message: string;
138
+ };
139
+ export declare function backgroundOff(store: Store, databaseFile: string, seams?: LaptopSeams): Promise<BackgroundOff>;
140
+ export type LaptopStop = {
141
+ ok: true;
142
+ action: "service-stopped" | "stopped" | "not-running";
143
+ pid: number | null;
144
+ startsAtLogin: boolean;
145
+ } | {
146
+ ok: false;
147
+ reason: string;
148
+ message: string;
149
+ };
150
+ export declare function laptopStop(store: Store, databaseFile: string, seams?: LaptopSeams): Promise<LaptopStop>;
151
+ export type LaptopStatus = {
152
+ running: boolean;
153
+ url: string | null;
154
+ pid: number | null;
155
+ background: BackgroundState;
156
+ };
157
+ /**
158
+ * The `laptop` key of `toolroll status`: whether this database's console is proven live (its address and the console
159
+ * process), and whether a background service runs it — ours ("on"), another service on this database or the desktop
160
+ * app's ("other-service"), or none ("off"). Reads files only; never asks the supervisor.
161
+ */
162
+ export declare function laptopStatus(store: Store, databaseFile: string, seams?: LaptopSeams): Promise<LaptopStatus>;
163
+ /** Whether Toolroll's own login item is installed here (its unit file exists). Reads one path; asks no supervisor. */
164
+ export declare function backgroundInstalled(seams?: LaptopSeams): boolean;
165
+ /**
166
+ * Bare `toolroll` and `toolroll open` with the background service installed but this database's console not running
167
+ * (stopped with `toolroll stop`, or not yet started at this login): start it through its supervisor — never a second
168
+ * `up` beside it — and prove the console it runs live. Our own label only.
169
+ */
170
+ export declare function startInstalledService(store: Store, databaseFile: string, seams?: LaptopSeams): Promise<AttachProof>;
171
+ export {};