toolroll 0.9.108 → 0.9.110

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 (187) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/advanced-view.js +0 -1
  3. package/dist/agent-detect.js +244 -0
  4. package/dist/agent-fence.js +47 -5
  5. package/dist/agent-state.js +5 -2
  6. package/dist/agentconfig.js +2 -2
  7. package/dist/approval-summary.js +344 -0
  8. package/dist/assignment-ui.js +5 -5
  9. package/dist/assignment.js +5 -2
  10. package/dist/attest.js +2 -2
  11. package/dist/browser/terminal.js +1 -1
  12. package/dist/browser/workspace.css +2 -2
  13. package/dist/browser/workspace.js +37 -34
  14. package/dist/browser-crew.js +4 -4
  15. package/dist/browser-workspace.js +4 -11
  16. package/dist/builder.js +45 -3
  17. package/dist/chat-actions.js +24 -17
  18. package/dist/chat-controls.js +6 -5
  19. package/dist/chat-core.js +3 -1
  20. package/dist/chat-decide.js +102 -47
  21. package/dist/chat-delivery-state.js +2 -0
  22. package/dist/chat-delivery.js +3 -2
  23. package/dist/chat-live.js +2 -1
  24. package/dist/chat-quiet.js +3 -3
  25. package/dist/chat-task-actions.js +6 -0
  26. package/dist/chat-voice.js +2 -2
  27. package/dist/check-report.js +1 -1
  28. package/dist/cli-help.js +12 -13
  29. package/dist/cli.js +6 -3
  30. package/dist/console-chrome.js +10 -3
  31. package/dist/console-instance.js +10 -1
  32. package/dist/contracts/console-api.js +14 -8
  33. package/dist/contracts/engine-api.js +271 -0
  34. package/dist/contracts/handoff.js +4 -0
  35. package/dist/coordinator.js +2 -2
  36. package/dist/decision.js +17 -0
  37. package/dist/demo-chat.js +1 -1
  38. package/dist/demo.js +6 -0
  39. package/dist/design/kit.js +4 -3
  40. package/dist/discord-api.js +4 -3
  41. package/dist/discord-chat.js +3 -1
  42. package/dist/dispatch.js +3 -8
  43. package/dist/easy-start-args.js +7 -3
  44. package/dist/easy-start.js +25 -0
  45. package/dist/egress.js +72 -10
  46. package/dist/engine-handoff.js +34 -0
  47. package/dist/engine-reads.js +261 -0
  48. package/dist/eval-world.js +3 -2
  49. package/dist/evidence.js +2 -0
  50. package/dist/fast-start.js +55 -14
  51. package/dist/fast-terms.js +2 -2
  52. package/dist/first-run.js +10 -2
  53. package/dist/flexible-agents.js +234 -0
  54. package/dist/flexible-answers-schema.js +61 -0
  55. package/dist/flexible-answers.js +889 -0
  56. package/dist/flexible-available.js +1 -0
  57. package/dist/flexible-custody.js +494 -0
  58. package/dist/flexible-import.js +782 -0
  59. package/dist/flexible-launch-schema.js +72 -0
  60. package/dist/flexible-launch.js +331 -0
  61. package/dist/flexible-launcher.js +88 -0
  62. package/dist/flexible-levels.js +34 -0
  63. package/dist/flexible-merge-guard.js +47 -0
  64. package/dist/flexible-refs.js +47 -0
  65. package/dist/flexible-relay-cancel.js +19 -0
  66. package/dist/flexible-relay-schema.js +55 -0
  67. package/dist/flexible-relay-upstreams.js +36 -0
  68. package/dist/flexible-relay.js +1032 -0
  69. package/dist/flexible-schema.js +32 -0
  70. package/dist/flexible-session.js +732 -0
  71. package/dist/flexible-ship-schema.js +81 -0
  72. package/dist/flexible-ship.js +694 -0
  73. package/dist/flexible-start.js +80 -0
  74. package/dist/flexible-thread-schema.js +30 -0
  75. package/dist/flexible-thread.js +676 -0
  76. package/dist/flexible-turns-schema.js +69 -0
  77. package/dist/flexible-turns.js +490 -0
  78. package/dist/flexible-ui.js +44 -0
  79. package/dist/flexible.js +368 -0
  80. package/dist/flow-actions.js +6 -4
  81. package/dist/flow-steps.js +1 -1
  82. package/dist/flows-cli.js +2 -1
  83. package/dist/git-views.js +44 -41
  84. package/dist/guides.js +11 -10
  85. package/dist/install-mode.js +225 -0
  86. package/dist/keymap.js +1 -1
  87. package/dist/lead-context.js +1 -1
  88. package/dist/lead-doors.js +7 -1
  89. package/dist/limits-ui.js +8 -1
  90. package/dist/live-bus.js +70 -13
  91. package/dist/live-reply.js +6 -0
  92. package/dist/live-terminal.js +425 -29
  93. package/dist/local-owner.js +6 -0
  94. package/dist/model-choices.js +12 -6
  95. package/dist/needs-you.js +3 -3
  96. package/dist/nightly-github.js +2 -2
  97. package/dist/notification-delivery.js +11 -0
  98. package/dist/operate.js +185 -33
  99. package/dist/outbound-privacy.js +204 -0
  100. package/dist/passwordless.js +2 -1
  101. package/dist/project-delete-ui.js +2 -1
  102. package/dist/project-delete.js +15 -0
  103. package/dist/provider-auth.js +1 -1
  104. package/dist/provider-connection.js +5 -3
  105. package/dist/publish.js +5 -0
  106. package/dist/pull-request-flow.js +26 -7
  107. package/dist/push.js +5 -1
  108. package/dist/release-card.js +11 -3
  109. package/dist/release.js +11 -1
  110. package/dist/result-actions.js +3 -0
  111. package/dist/result-evidence-readers.js +8 -2
  112. package/dist/result-review.js +20 -9
  113. package/dist/route-store.js +2 -2
  114. package/dist/sandbox-launch.js +32 -8
  115. package/dist/sandbox-runtime.js +16 -7
  116. package/dist/sandbox-tools.js +176 -0
  117. package/dist/scope.js +12 -36
  118. package/dist/scout-net.js +7 -2
  119. package/dist/serve.js +90 -40
  120. package/dist/server/chat.js +9 -9
  121. package/dist/server/chrome.js +19 -17
  122. package/dist/server/console.css +33 -6
  123. package/dist/server/engine-api.js +378 -0
  124. package/dist/server/flows.js +2 -2
  125. package/dist/server/guards.js +10 -4
  126. package/dist/server/home.js +37 -5
  127. package/dist/server/http.js +11 -2
  128. package/dist/server/in-place.js +5 -4
  129. package/dist/server/kit.js +2 -2
  130. package/dist/server/link-redemption.js +52 -0
  131. package/dist/server/live.js +100 -10
  132. package/dist/server/mutation-key.js +21 -7
  133. package/dist/server/pages.js +129 -74
  134. package/dist/server/people-tokens.js +17 -41
  135. package/dist/server/render-chat.js +2 -1
  136. package/dist/server/render-history.js +18 -4
  137. package/dist/server/render-new-task.js +4 -4
  138. package/dist/server/render-pages.js +21 -39
  139. package/dist/server/render-people.js +2 -2
  140. package/dist/server/render-projects.js +5 -5
  141. package/dist/server/render-results.js +30 -14
  142. package/dist/server/render-tasks.js +155 -155
  143. package/dist/server/retired-routes.js +37 -4
  144. package/dist/server/route-policy.js +8 -0
  145. package/dist/server/route-table.js +43 -5
  146. package/dist/server/settings-computers.js +140 -0
  147. package/dist/server/settings-scripts.js +15 -0
  148. package/dist/server/settings-section-table.js +59 -0
  149. package/dist/server/settings-sections.js +291 -0
  150. package/dist/server/settings.js +247 -28
  151. package/dist/server/task-views.js +55 -15
  152. package/dist/server/tasks.js +168 -98
  153. package/dist/server/terminals.js +181 -28
  154. package/dist/server/welcome.js +40 -14
  155. package/dist/settings-groups-ui.js +26 -107
  156. package/dist/settings-proofs.js +18 -11
  157. package/dist/slack-api.js +4 -3
  158. package/dist/slack-chat.js +5 -3
  159. package/dist/spend.js +46 -12
  160. package/dist/sqlite-telemetry.js +70 -21
  161. package/dist/status-probe.js +343 -0
  162. package/dist/store.js +206 -10
  163. package/dist/task-link.js +64 -0
  164. package/dist/teams-api.js +4 -3
  165. package/dist/teams-chat.js +4 -2
  166. package/dist/telegram-lead.js +2 -1
  167. package/dist/telegram-live.js +2 -1
  168. package/dist/telegram-team.js +2 -1
  169. package/dist/telegram.js +17 -5
  170. package/dist/trusted-path.js +162 -0
  171. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  172. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  173. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  174. package/dist/tui/linux-x64/toolroll-tui +0 -0
  175. package/dist/tui-launch.js +282 -0
  176. package/dist/tui-source.js +5 -3
  177. package/dist/tui.js +2 -2
  178. package/dist/typed-words-schema.js +18 -0
  179. package/dist/webhooks.js +8 -4
  180. package/dist/welcome-facts.js +25 -17
  181. package/dist/work-index.js +126 -29
  182. package/dist/work-reads.js +279 -0
  183. package/dist/workspace-ui.js +5 -0
  184. package/package.json +4 -2
  185. package/scripts/crash-canary.mjs +1 -1
  186. package/scripts/pilot.mjs +1 -1
  187. package/scripts/provider-canary.mjs +5 -3
@@ -49,8 +49,14 @@ export const CONSOLE_FORMS = {
49
49
  sweep: formContract("POST /sweeps/<sweep>/cancel-rest", ["confirm", "snapshot"]),
50
50
  passwordless: formContract("POST /settings/passwordless", ["action", "password"]),
51
51
  localModeOff: formContract("POST /settings/local-mode/off", ["password"]),
52
+ justMe: formContract("POST /settings/install-mode/solo", ["password"]),
52
53
  releaseApproval: formContract("POST /settings/release-approval", ["repo", "action", "password"]),
53
- term: formContract("POST /term/start, /term/<terminal>/close, /term/<terminal>/remove", ["repo", "program", "password"]),
54
+ projectFlexible: formContract("POST /settings/project/flexible", ["repo", "action", "max", "digest", "password"]),
55
+ threadAnswer: formContract("POST /agents/live/thread/<id>/answer", ["request", "card", "decision", "question", "answer"]),
56
+ threadStart: formContract("POST /agents/live/thread", ["repo", "message", "model", "terms", "password"]),
57
+ term: formContract("POST /term/start, /term/<terminal>/close, /term/<terminal>/remove", ["repo", "program", "password", "task", "run"]),
58
+ termAgent: formContract("POST /term/agent/sign-in, /term/agent/install", ["agent", "password", "confirm"]),
59
+ agentsCheck: formContract("POST /engine/agents/check", []),
54
60
  skillsRevise: formContract("POST /settings/skills/revise", ["run", "repo", "feedback", "nonce"]),
55
61
  skillsChange: formContract("POST /settings/skills/import, /settings/skills/change", ["repo", "identity", "revision", "method", "content", "files", "url", "action", "sha", "sample", "nonce", "restore"]),
56
62
  kit: formContract("POST /kits/<kit>/<act>", ["repo", "password"]),
@@ -111,10 +117,10 @@ export const CONSOLE_FORMS = {
111
117
  pullRequestsCheck: formContract("POST /settings/pull-requests/check", ["repo"]),
112
118
  connectionCheck: formContract("POST /settings/connection/check", ["provider", "auth-mode", "value", "return"]),
113
119
  modelsRefresh: formContract("POST /control/models-refresh", ["repo", "nonce", "fingerprint", "token", "provider", "model", "command", "seconds", "task"]),
114
- providerKey: formContract("POST /settings/provider-key, /settings/provider-key-clear", ["provider", "auth-mode", "value"]),
115
- telegramToken: formContract("POST /settings/telegram-token", ["token"]),
116
- email: formContract("POST /settings/email, /settings/email-test, /settings/email-read-test", ["host", "port", "secure", "user", "from", "password", "imapHost", "imapPort"]),
117
- google: formContract("POST /settings/google, /settings/google/disconnect", ["clientId", "clientSecret"]),
120
+ providerKey: formContract("POST /settings/provider-key, /settings/provider-key-clear", ["provider", "auth-mode", "value", "password"]),
121
+ telegramToken: formContract("POST /settings/telegram-token", ["token", "password"]),
122
+ email: formContract("POST /settings/email, /settings/email-test, /settings/email-read-test", ["host", "port", "secure", "user", "from", "password", "imapHost", "imapPort", "token"]),
123
+ google: formContract("POST /settings/google, /settings/google/disconnect", ["clientId", "clientSecret", "password"]),
118
124
  projectsSelect: formContract("POST /projects/select", ["path", "return"]),
119
125
  projectsRemove: formContract("POST /projects/remove", ["repo"]),
120
126
  projectsOpen: formContract("POST /projects/open", ["path", "return", "via", "password"]),
@@ -126,7 +132,7 @@ export const CONSOLE_FORMS = {
126
132
  releaseGoOn: formContract("POST /t/<id>/release/go-on", ["password"]),
127
133
  tasksAdd: formContract("POST /tasks/add", ["projectRevision", "plain", "from", "from-head", "from-read", "id", "title", "repo", "goal", "not", "touches", "scout", "permission-mode", "quality-mode", "after", "acceptance", "planning-policy", "plan-first"]),
128
134
  queue: formContract("POST /queue/move, /queue/note", ["runner", "note", "from", "projectRevision", "respond", "task", "column", "before", "queueRevision"]),
129
- runnerRegister: formContract("POST /fleet/runner/register", ["token", "name", "capacity"]),
135
+ runnerRegister: formContract("POST /fleet/runner/register", ["token", "name", "capacity", "nonce"]),
130
136
  mode: formContract("POST /mode/confirm, /mode/sign", ["name", "days", "auto-approve", "plan-auto", "chat-approve", "publication", "expiry", "nonce", "digest", "token", "review-auto", "review-retry-auto", "repair-auto"]),
131
137
  peopleProjects: formContract("POST /people/projects", ["token", "name", "access", "projects"]),
132
138
  peopleInvite: formContract("POST /people/invite", ["token", "role", "access", "projects"]),
@@ -163,7 +169,7 @@ export const CONSOLE_FORMS = {
163
169
  chatAck: formContract("POST /chat/ack/<id>", ["token", "nonce"]),
164
170
  recipes: formContract("POST /recipes/prepare, /recipes/preview, /recipes/import, /recipes/launch, /recipes/save", ["repo", "projectRevision", "recipe", "recipeRevision", "document", "purpose", "source", "sourceRevision", "preview", "next"]),
165
171
  runNote: formContract("POST /r/<run>/note", ["note"]),
166
- diffComment: formContract("POST /r/<run>/comment", ["return", "tab", "intent", "batch", "source", "note", "path", "line", "request", "image", "comment"]),
172
+ diffComment: formContract("POST /r/<run>/comment", ["return", "tab", "intent", "batch", "source", "context", "note", "path", "line", "request", "image", "comment"]),
167
173
  editorLinks: formContract("POST /session/editor-links", ["on", "return"]),
168
174
  revise: formContract("POST /r/<run>/revise", ["return", "batch", "source"]),
169
175
  followUp: formContract("POST /r/<run>/checks|add-tests", ["return", "level"]),
@@ -178,7 +184,7 @@ export const CONSOLE_FORMS = {
178
184
  taskRepairDependency: formContract("POST /t/<task>/repair-dependency", ["blocker", "operation", "replacement"]),
179
185
  taskNext: formContract("POST /t/<task>/next", ["undo"]),
180
186
  taskReopen: formContract("POST /t/<task>/reopen", ["token"]),
181
- taskRequeue: formContract("POST /t/<task>/requeue", ["note", "return", "run", "digest"]),
187
+ taskRequeue: formContract("POST /t/<task>/requeue", ["context", "note", "return", "run", "digest"]),
182
188
  taskPlan: formContract("POST /t/<task>/plan", ["source"]),
183
189
  taskFollowUp: formContract("POST /t/<task>/follow-up", ["index"]),
184
190
  taskPlanEdit: formContract("POST /t/<task>/plan-edit", ["saw-plan", "plan-document"]),
@@ -0,0 +1,271 @@
1
+ import { createHash } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { parseContract } from "./contract.js";
4
+ export const ENGINE_API_VERSION = 1;
5
+ const version = z.literal(ENGINE_API_VERSION);
6
+ const iso = z.string();
7
+ const liveRecordSchema = z.union([
8
+ z.object({ k: z.literal("open"), at: iso, detail: z.enum(["base", "commands"]), s: z.number().int().optional() }),
9
+ z.object({ k: z.literal("start"), at: iso, s: z.number().int().optional() }),
10
+ z.object({ k: z.literal("say"), at: iso, t: z.array(z.string()), s: z.number().int().optional() }),
11
+ z.object({ k: z.literal("step"), at: iso, id: z.string(), kind: z.string(), target: z.string().optional(), once: z.literal(true).optional(), s: z.number().int().optional() }),
12
+ z.object({ k: z.literal("done"), at: iso, id: z.string(), ok: z.boolean().nullable(), out: z.array(z.string()).optional(), s: z.number().int().optional() }),
13
+ z.object({ k: z.literal("cut"), at: iso, s: z.number().int().optional() }),
14
+ z.object({ k: z.literal("cap"), at: iso.optional(), s: z.number().int().optional() }),
15
+ z.object({ k: z.literal("child"), s: z.number().int(), at: iso.optional(), parent: z.string().nullable(), via: z.number().int().optional(), desc: z.string().optional() }),
16
+ z.object({ k: z.literal("end"), s: z.number().int(), at: iso.optional(), ok: z.boolean().nullable() }),
17
+ z.object({ k: z.literal("over") }),
18
+ ]);
19
+ export const liveSessionRefSchema = z.discriminatedUnion("kind", [
20
+ z.object({ kind: z.literal("run"), id: z.number().int().positive(), task: z.string().nullable() }),
21
+ z.object({ kind: z.literal("thread"), id: z.string().regex(/^[0-9a-f]{32}$/), task: z.null() }),
22
+ ]);
23
+ const hex32 = z.string().regex(/^[0-9a-f]{32}$/);
24
+ const flexibleLevelSchema = z.enum(["supervised", "auto", "full"]);
25
+ const answerStateSchema = z.enum(["pending", "decided", "sending", "sent", "delivered", "not-sent", "uncertain", "withdrawn"]);
26
+ const threadQuestionSchema = z.object({
27
+ request: hex32,
28
+ kind: z.enum(["permission", "question"]),
29
+ title: z.string(),
30
+ detail: z.string().nullable(),
31
+ tool: z.string().nullable(),
32
+ complete: z.boolean(),
33
+ digest: z.string().regex(/^[0-9a-f]{64}$/),
34
+ state: answerStateSchema,
35
+ answerable: z.boolean(),
36
+ parts: z.array(z.object({ id: z.string(), question: z.string(), options: z.array(z.string()) })),
37
+ });
38
+ export const threadFactsSchema = z.object({
39
+ version: z.string().regex(/^[0-9a-f]{16}$/),
40
+ title: z.string(),
41
+ project: z.string().nullable(),
42
+ level: flexibleLevelSchema.nullable(),
43
+ agent: z.object({ provider: z.string(), model: z.string() }).nullable(),
44
+ turn: z.object({ seq: z.number().int(), status: z.string(), costUsd: z.number().nullable(), costBasis: z.enum(["measured", "estimated", "unknown"]).nullable() }).nullable(),
45
+ questions: z.array(threadQuestionSchema),
46
+ });
47
+ export const liveSessionWindowSchema = z.object({
48
+ version,
49
+ session: liveSessionRefSchema,
50
+ room: z.string(),
51
+ live: z.boolean(),
52
+ file: z.enum(["main", "sub"]),
53
+ window: z.discriminatedUnion("ok", [
54
+ z.object({ ok: z.literal(true), records: z.array(liveRecordSchema), cursor: z.string(), restarted: z.boolean(), earlier: z.boolean(),
55
+ quarantined: z.number().int(), skipped: z.number().int(), more: z.boolean() }),
56
+ z.object({ ok: z.literal(false), reason: z.enum(["missing", "unavailable", "off"]) }),
57
+ ]),
58
+ thread: threadFactsSchema.optional(),
59
+ });
60
+ export const liveThreadsSchema = z.object({
61
+ version,
62
+ threads: z.array(z.object({ id: hex32, title: z.string(), project: z.string().nullable(), level: flexibleLevelSchema.nullable(), live: z.boolean(), waiting: z.number().int(),
63
+ costUsd: z.number().nullable() })),
64
+ });
65
+ const workAskSchema = z.enum(["release", "approve", "answer", "flow", "wrong", "review", "setup", "other"]);
66
+ const needRowSchema = z.object({
67
+ id: z.string(), title: z.string(), href: z.string(), project: z.string().nullable(), age: z.string(),
68
+ state: z.enum(["needs", "running", "queued", "done"]),
69
+ ask: workAskSchema.nullable(),
70
+ group: z.enum(["decide", "review", "unblock"]).optional(),
71
+ reason: z.string().nullable(), line: z.string().nullable(),
72
+ action: z.object({ label: z.string(), href: z.string() }).nullable(),
73
+ question: z.object({ id: z.number().int(), text: z.string(), recap: z.string(),
74
+ options: z.array(z.object({ id: z.string(), label: z.string(), consequence: z.string(), recommended: z.boolean() })) }).nullable(),
75
+ });
76
+ const workRowSchema = z.object({
77
+ id: z.string(), title: z.string(), href: z.string(), project: z.string().nullable(), age: z.string(),
78
+ status: z.object({ label: z.string(), tone: z.string(), token: z.string() }),
79
+ word: z.object({ word: z.string(), tone: z.string() }),
80
+ ask: z.string().nullable(),
81
+ chip: z.string().nullable(),
82
+ group: z.string(),
83
+ rank: z.number().int(),
84
+ detail: z.string().nullable(),
85
+ problem: z.string().nullable(),
86
+ need: needRowSchema.nullable(),
87
+ });
88
+ export const workRowsSchema = z.object({
89
+ version,
90
+ project: z.string().nullable(),
91
+ projectName: z.string(),
92
+ needsCount: z.number().int(),
93
+ groups: z.array(z.object({ key: z.string(), label: z.string(), count: z.number().int() })).nullable(),
94
+ rows: z.array(workRowSchema),
95
+ needs: z.array(z.object({ key: z.enum(["decide", "review", "unblock"]), label: z.string(), count: z.number().int(), rows: z.array(needRowSchema) })),
96
+ next: z.string().nullable(),
97
+ room: z.literal("workspace"),
98
+ spend: z.object({ todayUsd: z.number(), planPercent: z.number().int().nullable() }).nullable(),
99
+ });
100
+ export const stepCardSchema = z.object({
101
+ key: z.enum(["plan", "approve", "build", "checks", "review", "ready"]),
102
+ label: z.string(),
103
+ state: z.enum(["done", "current", "stuck", "skipped", "todo"]),
104
+ mark: z.enum(["done", "needs", "live", "wait", "stuck", "skipped", "todo"]),
105
+ sentence: z.string(),
106
+ at: iso.nullable(),
107
+ needsYou: z.boolean(),
108
+ inChain: z.boolean(),
109
+ agent: z.object({ provider: z.string(), model: z.string().nullable() }).nullable(),
110
+ startedAt: iso.nullable(),
111
+ finishedAt: iso.nullable(),
112
+ costUsd: z.number().nullable(),
113
+ runs: z.array(z.number().int()),
114
+ terms: z.object({
115
+ key: z.string(),
116
+ revision: z.string().nullable(),
117
+ rows: z.array(z.object({ label: z.string(), words: z.string(), lines: z.array(z.string()) })),
118
+ warnings: z.array(z.string()),
119
+ usualLabel: z.string(),
120
+ usual: z.array(z.object({ label: z.string(), words: z.string() })),
121
+ }).optional(),
122
+ });
123
+ export const stepCardsSchema = z.object({
124
+ version,
125
+ task: z.object({ id: z.string(), root: z.string(), title: z.string(), state: z.string(), project: z.string().nullable() }),
126
+ chain: z.enum(["plan-first", "just-code"]),
127
+ headline: z.string().nullable(),
128
+ liveRun: z.number().int().nullable(),
129
+ cards: z.array(stepCardSchema).nullable(),
130
+ review: z.object({ run: z.number().int(), receipt: z.string().regex(/^[0-9a-f]{64}$/), source: z.string(),
131
+ accept: z.object({ owed: z.enum(["person-check", "exception"]).nullable(), blockers: z.array(z.string()), needs: z.string().nullable() }),
132
+ }).nullable(),
133
+ room: z.string(),
134
+ });
135
+ const diffProblemSchema = z.string().nullable();
136
+ export const resultDiffSchema = z.object({
137
+ version,
138
+ task: z.string(),
139
+ run: z.number().int().nullable(),
140
+ totals: z.object({ files: z.number().int(), additions: z.number().int(), deletions: z.number().int(), binary: z.number().int(), filesTruncated: z.boolean() }).nullable(),
141
+ files: z.array(z.object({ file: z.number().int(), path: z.string(), oldPath: z.string().nullable(), additions: z.number().int(), deletions: z.number().int(), binary: z.boolean(),
142
+ hunks: z.number().int() })),
143
+ patchTruncated: z.boolean(),
144
+ problem: diffProblemSchema,
145
+ });
146
+ const diffLineSchema = z.object({ kind: z.enum(["context", "addition", "deletion", "meta"]), text: z.string(), oldLine: z.number().int().nullable(), newLine: z.number().int().nullable() });
147
+ export const resultDiffFileSchema = z.object({
148
+ version,
149
+ task: z.string(),
150
+ run: z.number().int(),
151
+ file: z.object({ file: z.number().int(), path: z.string(), oldPath: z.string().nullable(), meta: z.array(z.string()),
152
+ hunks: z.array(z.object({ header: z.string(), lines: z.array(diffLineSchema) })) }),
153
+ linesTruncated: z.boolean(),
154
+ });
155
+ export const DIFF_CONTEXT_MAX = 100;
156
+ export const resultDiffContextSchema = z.object({
157
+ version,
158
+ task: z.string(),
159
+ run: z.number().int(),
160
+ file: z.number().int(),
161
+ from: z.number().int(),
162
+ lines: z.array(z.object({ newLine: z.number().int(), text: z.string() })),
163
+ lineCount: z.number().int().nullable(),
164
+ problem: z.string().nullable(),
165
+ });
166
+ export const agentsReadSchema = z.object({
167
+ version,
168
+ checkedAt: iso.nullable(),
169
+ agents: z.array(z.object({
170
+ id: z.string(),
171
+ name: z.string(),
172
+ state: z.enum(["signed-in", "signed-out", "unknown", "not-installed"]),
173
+ how: z.string().nullable(),
174
+ signIn: z.string().nullable(),
175
+ ready: z.boolean(),
176
+ next: z.string().nullable(),
177
+ setup: z.object({
178
+ install: z.string().nullable(),
179
+ canInstall: z.boolean(),
180
+ signIn: z.string().nullable(),
181
+ canSignIn: z.boolean(),
182
+ key: z.string().nullable(),
183
+ check: z.string().nullable(),
184
+ note: z.string().nullable(),
185
+ registry: z.string().nullable(),
186
+ registryUnsure: z.boolean(),
187
+ }),
188
+ })),
189
+ firstTask: z.object({ id: z.string(), name: z.string() }).nullable(),
190
+ lines: z.array(z.string()),
191
+ });
192
+ export const modelsReadSchema = z.object({
193
+ version,
194
+ canChange: z.boolean(),
195
+ digest: z.string(),
196
+ problem: z.string().nullable(),
197
+ roles: z.array(z.object({
198
+ key: z.enum(["plan", "build", "review"]),
199
+ label: z.string(),
200
+ current: z.string(),
201
+ words: z.string(),
202
+ choices: z.array(z.object({ provider: z.string(), label: z.string(), models: z.array(z.object({ value: z.string(), label: z.string() })) })),
203
+ })),
204
+ defaultAgent: z.string().nullable(),
205
+ presets: z.array(z.object({ agent: z.string(), name: z.string(), words: z.string(),
206
+ fields: z.record(z.string(), z.string()) })),
207
+ });
208
+ export const termStateSchema = z.object({
209
+ available: z.boolean(),
210
+ problem: z.string().nullable(),
211
+ programs: z.array(z.enum(["claude", "codex", "shell"])),
212
+ projects: z.array(z.object({ path: z.string(), name: z.string() })),
213
+ sessions: z.array(z.object({
214
+ id: z.string().regex(/^[0-9a-f]{32}$/), repo: z.string(), project: z.string(), program: z.enum(["claude", "codex", "shell"]), branch: z.string(),
215
+ startedAt: iso, endedAt: iso.nullable(), exit: z.object({ code: z.number().int().nullable(), signal: z.number().int().nullable() }).nullable(),
216
+ cleanup: z.enum(["clean", "uncertain"]).nullable(), task: z.string().nullable(), run: z.number().int().nullable(),
217
+ })),
218
+ });
219
+ export const termStartedSchema = z.discriminatedUnion("ok", [
220
+ z.object({ ok: z.literal(true), id: z.string().regex(/^[0-9a-f]{32}$/) }),
221
+ z.object({ ok: z.literal(false), error: z.string() }),
222
+ ]);
223
+ export const linkRedemptionSchema = z.object({
224
+ version,
225
+ account: z.string(),
226
+ cookie: z.object({ name: z.string(), value: z.string().regex(/^[0-9a-f]{64}$/) }),
227
+ csrf: z.string().regex(/^[0-9a-f]{64}$/),
228
+ key: z.string().regex(/^[0-9a-f]{64}$/),
229
+ epoch: z.string(),
230
+ });
231
+ export const linkRedemptionRequestSchema = z.strictObject({ code: z.string().regex(/^[A-Za-z0-9_-]{43}$/) });
232
+ export const ENGINE_REQUESTS = {
233
+ linkRedemption: { route: "POST /login/once", schema: linkRedemptionRequestSchema },
234
+ };
235
+ export const engineRefusalSchema = z.object({ error: z.string() });
236
+ export const helloSchema = z.object({ version, toolroll: z.string(), contract: z.string().regex(/^[0-9a-f]{64}$/), responses: z.array(z.string()),
237
+ mode: z.enum(["solo", "team"]), defaultChain: z.enum(["just-code", "plan-first"]) });
238
+ export const ENGINE_RESPONSES = {
239
+ liveSessionWindow: { route: "GET /agents/live/<kind>/<id>", schema: liveSessionWindowSchema },
240
+ liveThreads: { route: "GET /agents/live/threads", schema: liveThreadsSchema },
241
+ workRows: { route: "GET /work/rows", schema: workRowsSchema },
242
+ stepCards: { route: "GET /t/<task>/steps", schema: stepCardsSchema },
243
+ resultDiff: { route: "GET /t/<task>/diff", schema: resultDiffSchema },
244
+ resultDiffFile: { route: "GET /t/<task>/diff?run=&file=", schema: resultDiffFileSchema },
245
+ resultDiffContext: { route: "GET /t/<task>/diff?run=&file=&from=&count=", schema: resultDiffContextSchema },
246
+ linkRedemption: { route: "POST /login/once", schema: linkRedemptionSchema },
247
+ refusal: { route: "every engine route's refusal", schema: engineRefusalSchema },
248
+ hello: { route: "GET /engine/hello", schema: helloSchema },
249
+ agents: { route: "GET /engine/agents", schema: agentsReadSchema },
250
+ models: { route: "GET /engine/models", schema: modelsReadSchema },
251
+ termState: { route: "GET /term/state", schema: termStateSchema },
252
+ termStarted: { route: "POST /term/start, /term/agent/sign-in, /term/agent/install", schema: termStartedSchema },
253
+ };
254
+ const toStderr = (route, issues) => process.stderr.write(`engine api: ${route} disagrees with its contract: ${issues.slice(0, 5).map(one => `${one.path} ${one.kind}`).join("; ")}\n`);
255
+ export function checkEngineResponse(name, payload, report = toStderr) {
256
+ const { route, schema } = ENGINE_RESPONSES[name];
257
+ const parsed = parseContract(schema, payload);
258
+ if (!parsed.ok)
259
+ report(route, parsed.issues);
260
+ return payload;
261
+ }
262
+ export function engineJsonSchemas() {
263
+ const json = (schema) => { const { $schema: _dialect, ...rest } = z.toJSONSchema(schema, { target: "draft-2020-12", unrepresentable: "throw" }); return rest; };
264
+ return {
265
+ responses: Object.fromEntries(Object.entries(ENGINE_RESPONSES).map(([name, one]) => [name, json(one.schema)])),
266
+ requests: Object.fromEntries(Object.entries(ENGINE_REQUESTS).map(([name, one]) => [name, json(one.schema)])),
267
+ };
268
+ }
269
+ export function engineContractDigest() {
270
+ return createHash("sha256").update(JSON.stringify({ version: ENGINE_API_VERSION, ...engineJsonSchemas() })).digest("hex");
271
+ }
@@ -28,6 +28,10 @@ export const handoffSchema = versioned(HANDOFF_VERSION, {
28
28
  changes: z.array(z.string()).optional(),
29
29
  verification: z.array(z.string()).optional(),
30
30
  followUps: z.array(z.string()).optional(),
31
+ decisions: z.array(z.string()).optional(),
32
+ assumptions: z.array(z.string()).optional(),
33
+ notDone: z.array(z.string()).optional(),
34
+ risks: z.array(z.string()).optional(),
31
35
  freshness: z.strictObject({
32
36
  stampedAt: z.string(),
33
37
  currentAsOf: z.string(),
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { hashSecret, mintCredential } from "./api-tokens.js";
3
3
  import { canonicalRepos } from "./runner.js";
4
4
  import { fileTaskProposal } from "./proposal.js";
5
- import { describeScope } from "./scope.js";
5
+ import { describeScope, summaryContextOf } from "./approval-summary.js";
6
6
  import { reportSummaryFor } from "./lead-tools.js";
7
7
  import { claimedNowSql, markedRunningSql } from "./task-moves.js";
8
8
  import { taskWorkSummaryOf } from "./work-summary.js";
@@ -358,7 +358,7 @@ export function taskDetailFor(store, who, taskId, evidenceRoot, now = new Date()
358
358
  scope: {
359
359
  sealed: store.scopeSealed(taskId),
360
360
  goal: scope?.goal ?? null,
361
- words: scope === null ? [] : describeScope(scope),
361
+ words: scope === null ? [] : describeScope(scope, undefined, null, summaryContextOf(store, taskId, scope, now)),
362
362
  },
363
363
  waits,
364
364
  attempts,
package/dist/decision.js CHANGED
@@ -154,6 +154,8 @@ export const HANDOFF_CONCLUSION_CAP = 600;
154
154
  export const HANDOFF_PAYLOAD_CAP = 16 * 1024;
155
155
  export const HANDOFF_LIST_CAP = 8;
156
156
  export const HANDOFF_ITEM_CAP = 240;
157
+ export const HANDOFF_REPORT_CAP = 5;
158
+ export const HANDOFF_REPORT_FIELDS = ["decisions", "assumptions", "notDone", "risks"];
157
159
  function compactHandoffText(value, cap) {
158
160
  const clean = value.replace(/\s+/g, " ").trim();
159
161
  if (clean.length <= cap)
@@ -173,6 +175,17 @@ function handoffList(value) {
173
175
  .slice(0, HANDOFF_LIST_CAP)
174
176
  .map(one => compactHandoffText(one, HANDOFF_ITEM_CAP));
175
177
  }
178
+ export function handoffReportList(value) {
179
+ if (!Array.isArray(value))
180
+ return [];
181
+ return value
182
+ .filter((one) => typeof one === "string" && one.trim() !== "" && !hasDisguisedText(one))
183
+ .slice(0, HANDOFF_REPORT_CAP)
184
+ .map(one => compactHandoffText(one, HANDOFF_ITEM_CAP));
185
+ }
186
+ export function handoffReportOf(handoff) {
187
+ return Object.fromEntries(HANDOFF_REPORT_FIELDS.filter(field => handoff[field].length > 0).map(field => [field, [...handoff[field]]]));
188
+ }
176
189
  export function parseHandoff(raw) {
177
190
  if (Buffer.byteLength(raw, "utf8") > HANDOFF_PAYLOAD_CAP) {
178
191
  return { ok: false, problems: [{ reason: "too-large", message: `the handoff is over ${HANDOFF_PAYLOAD_CAP} bytes` }] };
@@ -226,6 +239,10 @@ export function parseHandoff(raw) {
226
239
  changes: handoffList(body["changes"]),
227
240
  verification: handoffList(body["verification"]),
228
241
  followUps: handoffList(body["followUps"]),
242
+ decisions: handoffReportList(body["decisions"]),
243
+ assumptions: handoffReportList(body["assumptions"]),
244
+ notDone: handoffReportList(body["notDone"]),
245
+ risks: handoffReportList(body["risks"]),
229
246
  },
230
247
  };
231
248
  }
package/dist/demo-chat.js CHANGED
@@ -39,7 +39,7 @@ function resultCard(exchange, result) {
39
39
  const summary = html `${result.files} file${result.files === 1 ? "" : "s"} changed · +${result.additions} −${result.deletions} · <span class="${passed ? "demo-pass" : "demo-fail"}">${result.checks.detail}</span>`;
40
40
  const actions = exchange.state === "ready"
41
41
  ? html `<div class="demo-actions">${postForm(`/chat/demo/${exchange.id}/complete`, html `<button type="submit" class="demo-primary">Complete</button>`)}<details class="demo-more"><summary>Request changes</summary>${postForm(`/chat/demo/${exchange.id}/revise`, html `<label for="demo-revise-${exchange.id}">What should change?</label><textarea id="demo-revise-${exchange.id}" name="note" rows="2" maxlength="500" required></textarea><button type="submit">Send back</button>`)}</details></div>`
42
- : html `<p class="meta"><a href="${result.taskHref}">Open in Tasks</a></p>`;
42
+ : html `<p class="meta"><a href="${result.taskHref}">Open the task</a></p>`;
43
43
  return html `<section class="card demo-result" id="demo-${exchange.id}-work" aria-label="Result"><p class="demo-state">${status}<span class="meta">${exchange.plan.project}</span></p><h2>${exchange.plan.title}</h2><p>${exchange.plan.conclusion}</p><p class="meta">${summary}</p>${actions}${result.diff === null ? "" : html `<details class="demo-evidence"${exchange.state === "ready" ? html ` open` : ""}><summary>Changes</summary><pre class="demo-diff">${diffHtml(result.diff)}</pre></details>`}${result.checkLog === null ? "" : html `<details class="demo-evidence"><summary>Check log</summary><pre class="demo-log">${result.checkLog}</pre></details>`}${result.screenshot === null ? "" : html `<details class="demo-evidence"><summary>Screenshot</summary><figure><img src="${result.screenshot.href}" alt="${result.screenshot.caption}" width="960" height="600"><figcaption class="meta">${result.screenshot.caption}</figcaption></figure></details>`}</section>`;
44
44
  }
45
45
  export function demoThreadHtml(exchanges, resultOf) {
package/dist/demo.js CHANGED
@@ -74,6 +74,9 @@ const DEMO_HANDOFF = {
74
74
  ],
75
75
  verification: ["All 214 tests pass, including the new rounding boundary cases."],
76
76
  followUps: [],
77
+ decisions: ["Rounded each line at cent precision in settle(), not when the total is displayed."],
78
+ assumptions: ["The ledger fixtures cover every currency payouts are made in."],
79
+ risks: ["Totals for settlements already paid at the old precision are not recalculated."],
77
80
  decisionsIncorporated: [],
78
81
  };
79
82
  const DEMO_FAILED_PATCH = `diff --git a/src/payout.ts b/src/payout.ts
@@ -169,6 +172,9 @@ const DEMO_COPY_HANDOFF = {
169
172
  changes: ["Replaced the empty-state body copy in src/inbox-copy.ts."],
170
173
  verification: ["Opened the inbox pane with zero items and read the new copy."],
171
174
  followUps: [],
175
+ decisions: ["Kept the copy to one sentence and a link to filters, with no illustration."],
176
+ assumptions: ["An empty inbox usually means a filter is on, not that there is no mail."],
177
+ notDone: ["The copy is English only; the other locales still show the old line."],
172
178
  decisionsIncorporated: [],
173
179
  };
174
180
  const DEMO_COPY_PROOF = {
@@ -130,23 +130,24 @@ export const KIT_ICONS = {
130
130
  list: [path("M8 6h13"), path("M8 12h13"), path("M8 18h13"), path("M3 6h.01"), path("M3 12h.01"), path("M3 18h.01")],
131
131
  board: [["rect", { x: 3, y: 3, width: 18, height: 18, rx: 2 }], path("M9 3v18"), path("M15 3v18")],
132
132
  panel: [["rect", { x: 3, y: 3, width: 18, height: 18, rx: 2 }], path("M15 3v18")],
133
+ server: [["rect", { x: 2, y: 2, width: 20, height: 8, rx: 2 }], ["rect", { x: 2, y: 14, width: 20, height: 8, rx: 2 }], path("M6 6h.01"), path("M6 18h.01")],
133
134
  };
134
135
  export const SETTINGS_GROUPS = [
135
136
  ["General", "general", "/settings/general"],
136
137
  ["Agents and models", "agents", "/settings/agents"],
138
+ ["Computers", "computers", "/settings/computers"],
137
139
  ["Chat apps and alerts", "alerts", "/settings/alerts"],
138
140
  ["Approvals and safety", "approval", "/settings/approval"],
139
141
  ["Projects", "projects", "/settings/projects"],
140
142
  ["People and sign-in", "access", "/settings/access"],
141
143
  ["Spend", "spend", "/spend"],
142
144
  ["System", "system", "/settings/system"],
143
- ["Advanced", "advanced", "/settings/advanced"],
144
145
  ];
145
146
  export const SETTINGS_GROUP_ICONS = {
146
- general: "sun", agents: "cpu", alerts: "bell", approval: "shield", projects: "folder", access: "people", spend: "coin", system: "monitor", advanced: "settings",
147
+ general: "sun", agents: "cpu", computers: "server", alerts: "bell", approval: "shield", projects: "folder", access: "people", spend: "coin", system: "monitor",
147
148
  };
148
149
  export const needsWords = (n) => n === 1 ? "1 item needs you" : `${n} items need you`;
149
150
  export const NOT_FOUND = {
150
151
  title: (path) => `There’s no page at ${path}.`,
151
- text: "It may have moved. Home has what needs you; Tasks has every task.",
152
+ text: "It may have moved. Work has every task and what needs you.",
152
153
  };
@@ -1,7 +1,8 @@
1
1
  import { chmodSync, readFileSync, renameSync, rmSync, writeFileSync, } from "node:fs";
2
2
  import { join } from "node:path";
3
+ import { guardDiscord } from "./outbound-privacy.js";
3
4
  import { randomBytes } from "node:crypto";
4
- import { ChatDeliveryError, chatHash, } from "./chat-delivery-state.js";
5
+ import { ChatDeliveryError, chatHash, withheldPart, } from "./chat-delivery-state.js";
5
6
  import { chatObject as object } from "./chat-delivery.js";
6
7
  export { object };
7
8
  export const discordId = (v) => typeof v === "string" && /^[1-9][0-9]{16,19}$/.test(v);
@@ -10,7 +11,7 @@ export class DiscordError extends ChatDeliveryError {
10
11
  export const DISCORD_REFUSED = "Discord refused access. Check the app and direct-message permissions.";
11
12
  export const DISCORD_GONE = "The Discord message or conversation is unavailable. Open the saved chat.";
12
13
  export function discordApi(token, fetcher = fetch) {
13
- return async (method, path, body, file) => {
14
+ return guardDiscord(async (method, path, body, file) => {
14
15
  if (!/^\/(?:users\/@me|users\/[0-9]+|oauth2\/applications\/@me|channels\/[0-9]+(?:\/typing|\/messages\/[0-9]+\/reactions\/%F0%9F%91%80\/@me|\/messages(?:\/[0-9]+)?(?:\?limit=100)?)?|interactions\/[0-9]+\/[A-Za-z0-9._-]+\/callback)$/.test(path))
15
16
  throw new DiscordError("Invalid Discord request");
16
17
  if (method === "DELETE" && !/^\/channels\/[0-9]+\/messages\/[0-9]+\/reactions\/%F0%9F%91%80\/@me$/.test(path))
@@ -67,7 +68,7 @@ export function discordApi(token, fetcher = fetch) {
67
68
  throw new DiscordError(message, response.status >= 500 ? 15_000 : 60_000, response.status >= 500);
68
69
  }
69
70
  return Array.isArray(raw) ? { items: raw } : data;
70
- };
71
+ }, withheldPart);
71
72
  }
72
73
  export const discordCredentialFile = (dir) => join(dir, "discord-connection.json");
73
74
  export function loadDiscordCredentials(dir) {
@@ -6,7 +6,8 @@ import { cardWithin } from "./chat-card.js";
6
6
  import { chatFlowButtons } from "./chat-flow.js";
7
7
  import { refuseResultShots, resultShotsPruned, shotWaitsUntil } from "./result-shots.js";
8
8
  import { admitChatEvent } from "./chat-admission.js";
9
- import { ChatState, ChatDeliveryError, chatHash, chatRetryAt, partContent, } from "./chat-delivery-state.js";
9
+ import { guardDiscord, taskSubject } from "./outbound-privacy.js";
10
+ import { ChatState, ChatDeliveryError, chatHash, chatRetryAt, partContent, withheldPart, } from "./chat-delivery-state.js";
10
11
  import { readChatPart } from "./contracts/chat-content.js";
11
12
  import { readDiscordButtonToken, readDiscordComponentInteraction } from "./contracts/discord-callback.js";
12
13
  import { processChatEvent, planChatNotifications, channelAccess, chatObject as object, planRoomMessages, heldForWatch, } from "./chat-delivery.js";
@@ -183,6 +184,7 @@ export async function deliverDiscordPart(options) {
183
184
  if (event.kind === "notice" && options.canNotify?.() === false)
184
185
  return false;
185
186
  const content = partContent(row.payload);
187
+ options = { ...options, api: guardDiscord(options.api, withheldPart, taskSubject(store, content.task ?? content.image?.taskId)) };
186
188
  const destination = content.channel ?? binding.channel;
187
189
  if (content.task &&
188
190
  !repos.includes(store.lookupRef(content.task)?.repo ?? ""))
package/dist/dispatch.js CHANGED
@@ -253,7 +253,7 @@ export function diagnoseTaskDispatch(store, taskId, now, readableRepos = null) {
253
253
  const role = dispatchRoleFor(store, ref.id, now);
254
254
  const scope = store.getScope(taskId);
255
255
  if (ref.repo === null)
256
- return answer("needs-project", "waiting", "Needs a project", "Choose a project for this task so a builder can start it.", { action: "place-task", role });
256
+ return answer("needs-project", "waiting", "Needs a project", "Choose a project for this task so it can start.", { action: "place-task", role });
257
257
  if (role !== "planner") {
258
258
  if (scope === null)
259
259
  return answer("needs-scope", "waiting", "Needs a plan", "Write the plan, or ask the planner to draft it.", { action: "write-scope", role });
@@ -321,7 +321,7 @@ export function withDispatchDiagnoses(store, snapshot, now) {
321
321
  tasks: snapshot.tasks.map(one => ({ ...one, dispatch: diagnoseTaskDispatch(store, one.id, now) })),
322
322
  };
323
323
  }
324
- export function retryWhenWords(until, now) {
324
+ export function retryWhenWords(until, now, zone = viewerZone()) {
325
325
  const ms = Date.parse(until) - now.getTime();
326
326
  if (Number.isNaN(ms))
327
327
  return "soon";
@@ -330,12 +330,7 @@ export function retryWhenWords(until, now) {
330
330
  const minutes = Math.ceil(ms / 60_000);
331
331
  if (minutes < 60)
332
332
  return `in ${minutes} minutes`;
333
- const at = shortWhen(until, now, "UTC", true);
334
- if (/^\d/.test(at))
335
- return `at ${at} UTC`;
336
- if (at.startsWith("Tomorrow "))
337
- return `tomorrow at ${at.slice("Tomorrow ".length)} UTC`;
338
- return `on ${at} UTC`;
333
+ return resetWhenWords(until, now, zone);
339
334
  }
340
335
  export const NO_AGENT_TITLE = "No coding agent is signed in";
341
336
  export const noAgentWords = (command, modelsCleared = false) => modelsCleared
@@ -1,17 +1,21 @@
1
1
  export function easyStartArgs(argv) {
2
- let web = false, verbose = false, projectRoot = null, port = null;
2
+ let web = false, verbose = false, screenReader = false, projectRoot = null, port = null, tuiBinary = null;
3
3
  for (let index = 0; index < argv.length; index += 1) {
4
4
  const one = argv[index];
5
5
  if (one === "--web" && !web)
6
6
  web = true;
7
7
  else if (one === "--verbose" && !verbose)
8
8
  verbose = true;
9
- else if ((one === "--project-root" && projectRoot === null) || (one === "--port" && port === null)) {
9
+ else if (one === "--screen-reader" && !screenReader)
10
+ screenReader = true;
11
+ else if ((one === "--project-root" && projectRoot === null) || (one === "--port" && port === null) || (one === "--tui-binary" && tuiBinary === null)) {
10
12
  const value = argv[index + 1];
11
13
  if (value === undefined || value === "" || value.startsWith("-"))
12
14
  return null;
13
15
  if (one === "--port")
14
16
  port = value;
17
+ else if (one === "--tui-binary")
18
+ tuiBinary = value;
15
19
  else
16
20
  projectRoot = value;
17
21
  index += 1;
@@ -19,7 +23,7 @@ export function easyStartArgs(argv) {
19
23
  else
20
24
  return null;
21
25
  }
22
- return { web, projectRoot, port, ...(verbose ? { verbose } : {}) };
26
+ return { web, projectRoot, port, ...(verbose ? { verbose } : {}), ...(screenReader ? { screenReader } : {}), ...(tuiBinary === null ? {} : { tuiBinary }) };
23
27
  }
24
28
  export function easyStartApplies(argv, facts) {
25
29
  return facts.stdin && facts.stdout && !facts.agent && easyStartArgs(argv) !== null;
@@ -289,6 +289,31 @@ export function defaultEasyStartSeams(options) {
289
289
  openBrowser: async (url) => { (await import("./operate.js")).openBrowser(url); },
290
290
  openSignedIn: () => openLocalSignIn(file, options.build),
291
291
  openTui: async (session) => {
292
+ const { chooseTuiBinary, runTuiBinary } = await import("./tui-launch.js");
293
+ const { engineContractDigest } = await import("./contracts/engine-api.js");
294
+ const choice = chooseTuiBinary({ env: process.env, screenReader: options.screenReader === true, platform: process.platform, arch: process.arch, contract: engineContractDigest(), devBinary: options.tuiBinary ?? null });
295
+ if (choice.notice !== undefined)
296
+ options.write(`${choice.notice}.`);
297
+ let why = choice.ok ? null : choice.why;
298
+ if (choice.ok) {
299
+ const reader = openStoreReadOnly(file);
300
+ const link = reader === null ? { ok: false, message: "Toolroll's database can't be read" }
301
+ : await requestLocalLink(file, reader, options.build).finally(() => reader.close());
302
+ if (!link.ok)
303
+ why = `the terminal workbench couldn't sign in (${link.message})`;
304
+ else {
305
+ const { checkoutTop } = await import("./teardown-git.js");
306
+ const end = await runTuiBinary({ binary: choice.binary, identity: choice.identity, link: link.url, session, project: checkoutTop(cwd), cwd });
307
+ if (end === "changed")
308
+ why = "the terminal workbench changed after it was checked";
309
+ else if (end !== "classic")
310
+ return end;
311
+ else
312
+ why = null;
313
+ }
314
+ }
315
+ if (why !== null)
316
+ options.write(`Opening the classic screen: ${why}.`);
292
317
  const { createTuiSource } = await import("./tui-source.js");
293
318
  const { runAsLocalOwner } = await import("./local-owner.js");
294
319
  const source = createTuiSource({ databaseFile: file, ...(options.operate === undefined ? {} : { operate: options.operate }) });