@awebai/oats 0.51.0 → 0.53.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 (166) hide show
  1. package/README.md +3 -1
  2. package/bin/oats.mjs +407 -123
  3. package/docs/capabilities.md +75 -6
  4. package/docs/configuration.md +200 -91
  5. package/docs/desktop-cli-api.md +1563 -113
  6. package/docs/desktop-instance-start.md +69 -0
  7. package/docs/desktop.md +10 -7
  8. package/docs/execution-targets.md +145 -58
  9. package/docs/first-team.md +3 -1
  10. package/docs/harness-trust.md +50 -2
  11. package/docs/implementation.md +238 -17
  12. package/docs/integrations.md +13 -9
  13. package/docs/knowledge-reference/acceptance.md +1 -0
  14. package/docs/knowledge-reference/harvester.md +5 -3
  15. package/docs/knowledge-reference/model.md +5 -3
  16. package/docs/knowledge-theory.md +1 -1
  17. package/docs/knowledge.md +25 -2
  18. package/docs/launch-prompt-completion.md +50 -48
  19. package/docs/macos-test-runs.md +246 -0
  20. package/docs/oats-local.schema.json +4 -3
  21. package/docs/official-catalog.md +5 -5
  22. package/docs/packages.md +14 -14
  23. package/docs/release-lane.md +225 -11
  24. package/docs/release-notes/v0.44.0.md +1 -1
  25. package/docs/release-notes/v0.52.0.md +933 -0
  26. package/docs/release-notes/v0.53.0.md +1274 -0
  27. package/docs/schedules.md +97 -4
  28. package/docs/souls-and-instances.md +332 -40
  29. package/docs/tui.md +584 -0
  30. package/docs/upgrading.md +298 -0
  31. package/docs/workspaces.md +3 -3
  32. package/lib/automations.mjs +22 -22
  33. package/lib/claim.mjs +278 -49
  34. package/lib/config-data.mjs +4 -1
  35. package/lib/core.mjs +1282 -289
  36. package/lib/errors.mjs +170 -0
  37. package/lib/harness-trust-write.mjs +68 -27
  38. package/lib/harness-trust.mjs +34 -16
  39. package/lib/instance-events.mjs +19 -1
  40. package/lib/instance-git.mjs +39 -3
  41. package/lib/instance-inspect.mjs +45 -17
  42. package/lib/instance-lifecycle.mjs +306 -57
  43. package/lib/instance-resolution.mjs +59 -6
  44. package/lib/launch-preference.mjs +236 -9
  45. package/lib/launch-prompt-completion.mjs +7 -43
  46. package/lib/launch-prompt-evidence.mjs +14 -7
  47. package/lib/launch-prompt-fixtures/README.md +86 -152
  48. package/lib/launch-prompt-fixtures/dev-channel-confirmation.json +50 -0
  49. package/lib/launch-prompt-fixtures.mjs +122 -109
  50. package/lib/launch-prompt-transport.mjs +2 -56
  51. package/lib/launch-prompts.mjs +102 -100
  52. package/lib/local-edit.mjs +118 -0
  53. package/lib/packages.mjs +13 -4
  54. package/lib/pi-bridge.mjs +308 -0
  55. package/lib/refused-text.mjs +11 -0
  56. package/lib/remote.mjs +190 -25
  57. package/lib/resolve.mjs +2 -1
  58. package/lib/retained-after-retire.mjs +2 -2
  59. package/lib/retire-output.mjs +12 -1
  60. package/lib/schedule-host.mjs +125 -22
  61. package/lib/schedule.mjs +73 -24
  62. package/lib/shell-word.mjs +13 -0
  63. package/lib/soul-launch-verbs.mjs +153 -0
  64. package/lib/stable-node.mjs +62 -0
  65. package/lib/system-tools.mjs +39 -0
  66. package/lib/teams-verbs.mjs +18 -46
  67. package/lib/tmux-server-scope.mjs +62 -0
  68. package/lib/triggers.mjs +4 -4
  69. package/lib/workspace.mjs +54 -30
  70. package/lib/worktree-hooks.mjs +98 -20
  71. package/lib/worktree.mjs +83 -24
  72. package/package-catalog.json +4 -4
  73. package/package.json +8 -2
  74. package/packages/client/attach-exit.mjs +25 -0
  75. package/packages/client/capability-show-contract.mjs +230 -0
  76. package/packages/client/capability-warnings-contract.mjs +57 -0
  77. package/packages/client/cli-adapter.mjs +561 -0
  78. package/packages/client/cli-environment.mjs +53 -0
  79. package/packages/client/cli-locator.mjs +253 -0
  80. package/packages/client/cli-probe-contract.mjs +47 -0
  81. package/packages/client/client-terms.mjs +60 -0
  82. package/packages/client/deployment-contract.mjs +72 -0
  83. package/packages/client/deployment-data.mjs +483 -0
  84. package/packages/client/deployment-facts.mjs +95 -0
  85. package/packages/client/deployment-label.mjs +76 -0
  86. package/packages/client/deployment-observer.mjs +89 -0
  87. package/packages/client/deployment-panel.mjs +180 -0
  88. package/packages/client/deployment-read-cli.mjs +57 -0
  89. package/packages/client/display-text.mjs +50 -0
  90. package/packages/client/harness-names.mjs +30 -0
  91. package/packages/client/inspect-contract.mjs +62 -0
  92. package/packages/client/instance-acts.mjs +90 -0
  93. package/packages/client/instance-admission.mjs +45 -0
  94. package/packages/client/instance-events-contract.mjs +76 -0
  95. package/packages/client/instance-git-contract.mjs +80 -0
  96. package/packages/client/instance-presentation.mjs +86 -0
  97. package/packages/client/instance-tree.mjs +462 -0
  98. package/packages/client/kernel-environment.mjs +11 -0
  99. package/packages/client/kernel-lines.mjs +31 -0
  100. package/packages/client/kernel-made.mjs +23 -0
  101. package/packages/client/launch-contract.mjs +51 -0
  102. package/packages/client/launch-prompt-outcome.mjs +200 -0
  103. package/packages/client/lifecycle-cli.mjs +61 -0
  104. package/packages/client/lifecycle-contract.mjs +413 -0
  105. package/packages/client/liveness-main.mjs +10 -0
  106. package/packages/client/liveness.mjs +48 -0
  107. package/packages/client/machine-contract.mjs +123 -0
  108. package/packages/client/own-codes.mjs +31 -0
  109. package/packages/client/own-environment.mjs +22 -0
  110. package/packages/client/panel-views.mjs +293 -0
  111. package/packages/client/readiness-contract.mjs +174 -0
  112. package/packages/client/refresh-loop.mjs +52 -0
  113. package/packages/client/remote-address.mjs +151 -0
  114. package/packages/client/remote-identity-memory.mjs +94 -0
  115. package/packages/client/remote-roster.mjs +153 -0
  116. package/packages/client/roster-sections.mjs +80 -0
  117. package/packages/client/session-attach.mjs +175 -0
  118. package/packages/client/spawn-apply-cli.mjs +104 -0
  119. package/packages/client/spawn-apply-contract.mjs +195 -0
  120. package/packages/client/spawn-decision.mjs +46 -0
  121. package/packages/client/spawn-messages.mjs +142 -0
  122. package/packages/client/spawn-preview-cli.mjs +38 -0
  123. package/packages/client/spawn-preview-contract.mjs +318 -0
  124. package/packages/client/team-members.mjs +41 -0
  125. package/packages/client/team-rows.mjs +45 -0
  126. package/packages/client/terminal-contract.mjs +57 -0
  127. package/packages/client/terminal-exec.mjs +21 -0
  128. package/packages/client/tmux-status.mjs +66 -0
  129. package/packages/client/waiting-on-you.mjs +88 -0
  130. package/packages/client/workspace-admission.mjs +45 -0
  131. package/packages/client/workspace-choices.mjs +95 -0
  132. package/packages/client/workspace-cli.mjs +142 -0
  133. package/packages/client/workspace-views.mjs +183 -0
  134. package/packages/record/README.md +21 -0
  135. package/packages/record/bin/setup.mjs +108 -15
  136. package/packages/tui/README.md +64 -0
  137. package/packages/tui/bin/tui.mjs +7 -0
  138. package/packages/tui/lib/actions.mjs +44 -0
  139. package/packages/tui/lib/client.mjs +35 -0
  140. package/packages/tui/lib/config.mjs +151 -0
  141. package/packages/tui/lib/main.mjs +176 -0
  142. package/packages/tui/lib/model.mjs +392 -0
  143. package/packages/tui/lib/read.mjs +473 -0
  144. package/packages/tui/lib/store.mjs +364 -0
  145. package/packages/tui/lib/term/keys.mjs +367 -0
  146. package/packages/tui/lib/term/screen.mjs +134 -0
  147. package/packages/tui/lib/term/style.mjs +43 -0
  148. package/packages/tui/lib/term/text.mjs +109 -0
  149. package/packages/tui/lib/term/tty.mjs +178 -0
  150. package/packages/tui/lib/term/width.mjs +124 -0
  151. package/packages/tui/lib/views/detail.mjs +46 -0
  152. package/packages/tui/lib/views/frame.mjs +256 -0
  153. package/packages/tui/lib/views/help.mjs +140 -0
  154. package/packages/tui/lib/views/instances.mjs +137 -0
  155. package/packages/tui/lib/views/scroll.mjs +19 -0
  156. package/packages/tui/lib/views/switcher.mjs +97 -0
  157. package/packages/tui/package.json +8 -0
  158. package/skills/oats-getting-started/SKILL.md +30 -23
  159. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-05-channel-seeded.txt +0 -35
  160. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-06-first-after-channel.txt +0 -35
  161. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-07-after-channel-200ms.txt +0 -35
  162. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-08-installed-after-channel-200ms.txt +0 -35
  163. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/manifest.json +0 -77
  164. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/max-bypass-source.json +0 -88
  165. package/lib/launch-prompt-fixtures/structural-completion.json +0 -205
  166. package/lib/launch-prompt-policy.mjs +0 -87
@@ -0,0 +1,140 @@
1
+ // The help view: the action table, the marks and what this version does not do, as rows of safe
2
+ // text. Pure: no IO, no clock, no escape byte. The keys are generated from the table the reducer
3
+ // acts on, so the help names every key that does something and no key that does not; the marks
4
+ // are the ones the list and the switcher draw (views/instances.mjs, views/switcher.mjs).
5
+ import { keyLabel } from "../actions.mjs";
6
+ import { lit } from "../term/text.mjs";
7
+ import { style } from "../term/style.mjs";
8
+ import { cutNote, marksOf, measured } from "./instances.mjs";
9
+ import { windowOf } from "./scroll.mjs";
10
+ import { OPEN_MARK } from "./switcher.mjs";
11
+
12
+ const TITLE = style({ bold: true });
13
+ const KEYS = style({ bold: true });
14
+ const HINT = style({ dim: true });
15
+ const INDENT = 2;
16
+ const GAP = 3;
17
+
18
+ /** The keys of an action as a person reads them: `q, Ctrl+C`. */
19
+ export const keysLabel = (action) => action.keys.map(keyLabel).join(", ");
20
+ /** A key's label for the screen: `{ text, width }`. A key is the user's once their tui.json names
21
+ * it, so its label is text the TUI did not write: it goes through shown(), and takes the cells
22
+ * its display takes (a key may be a wide character). */
23
+ export function keyText(label) {
24
+ return measured(label);
25
+ }
26
+
27
+ /** What this version does not do, each with the `oats` command that does it: an omission is
28
+ * stated where a user looks for it. test/tui-word.test.mjs holds every command here to the
29
+ * kernel's own usage, so the help cannot name a command that does not exist. A later version
30
+ * removes a line when it adds the act. */
31
+ export const NOT_YET = Object.freeze([
32
+ Object.freeze({ what: "open an agent's terminal", command: "oats session attach --home <home>" }),
33
+ Object.freeze({ what: "stop an agent", command: "oats instance stop <instance>" }),
34
+ Object.freeze({ what: "start or restart an agent", command: "oats session start --home <home>" }),
35
+ Object.freeze({ what: "retire an agent", command: "oats retire <instance>" }),
36
+ Object.freeze({ what: "add a machine to this workspace", command: "oats server connect <id> --ssh <alias>" }),
37
+ Object.freeze({ what: "check a machine", command: "oats server check <id>" }),
38
+ Object.freeze({ what: "remove a machine", command: "oats server remove <id>" }),
39
+ // The switcher lists the deployments opened in this run and those in ~/Agents, and no other.
40
+ Object.freeze({ what: "open a deployment outside ~/Agents", command: "oats tui --dir <path>" }),
41
+ ]);
42
+ /** What a user should know of the machines the list shows, each a sentence of the TUI's own: a
43
+ * limit that no command lifts is stated too. */
44
+ export const MACHINES = Object.freeze([
45
+ "A machine's rows are what it reported at the time on its heading (in a view of one machine, in the header).",
46
+ "Nothing is kept on disk: a machine not reached in this run is listed by its own name.",
47
+ "Souls and Capabilities, when they come, are this machine's.",
48
+ ]);
49
+ /** The views the frame names, and for the two that cannot be opened yet, what to run instead. */
50
+ export const VIEWS = Object.freeze([
51
+ Object.freeze({ name: "1 Instances", what: "the instances of the open workspace", commands: Object.freeze([]) }),
52
+ Object.freeze({ name: "2 Souls", what: "not in this version", commands: Object.freeze(["oats souls", "oats spawn <soul>"]) }),
53
+ Object.freeze({ name: "3 Capabilities", what: "not in this version", commands: Object.freeze(["oats capabilities"]) }),
54
+ ]);
55
+
56
+ const words = (text) => text.split(" ");
57
+ /** Pieces set on lines of at most `room` cells, a space between two; a piece is never broken. */
58
+ const flow = (pieces, room) => pieces.reduce((lines, piece) => {
59
+ const last = lines.at(-1);
60
+ if (last !== undefined && last.length + 1 + piece.length <= room) lines[lines.length - 1] = `${last} ${piece}`;
61
+ else lines.push(piece);
62
+ return lines;
63
+ }, []);
64
+ /** A table: a left column as wide as its widest entry, then what each entry means, given as
65
+ * pieces that are never broken (a word, or a whole command: a command cut in two cannot be
66
+ * typed). What does not fit `cols` goes on in the same column on the next row. A table with a
67
+ * piece wider than that column puts every meaning under its entry instead, so no row is cut at
68
+ * the smallest width the frame draws at. */
69
+ function table(pairs, cols, look) {
70
+ // An entry is the TUI's own word, or text made elsewhere with its width (a key's label).
71
+ pairs = pairs.map(([left, pieces]) => [typeof left === "string" ? { text: lit(left), width: left.length } : left, pieces]);
72
+ const entry = (left) => ({ col: INDENT, text: left.text, width: left.width, ...(look ? { style: look } : {}) });
73
+ const column = INDENT + Math.max(...pairs.map(([left]) => left.width)) + GAP;
74
+ const stacked = pairs.some(([, pieces]) => pieces.some((piece) => column + piece.length > cols));
75
+ const at = stacked ? INDENT + 2 : column;
76
+ return pairs.flatMap(([left, pieces]) => {
77
+ const lines = flow(pieces, cols - at).map((text) => ({ col: at, text: lit(text) }));
78
+ return stacked ? [[entry(left)], ...lines.map((line) => [line])] : lines.map((line, i) => (i === 0 ? [entry(left), line] : [line]));
79
+ });
80
+ }
81
+ const heading = (text) => [{ col: INDENT, text: lit(text), style: TITLE }];
82
+ /** Sentences, each from the left margin on as many rows as it needs, with that margin kept at
83
+ * the right too: its later rows are set in, so the next sentence is seen to start. */
84
+ const sentences = (list, cols) => list.flatMap((sentence) => {
85
+ const [first, ...rest] = flow(words(sentence), cols - 2 * INDENT);
86
+ return [first, ...flow(rest.flatMap(words), cols - 2 * INDENT - 2)].map((text, i) => [{ col: INDENT + (i ? 2 : 0), text: lit(text) }]);
87
+ });
88
+
89
+ /** Every row of the help for an area `cols` wide, before it is scrolled. Unbound actions are
90
+ * listed as such: the table can be changed by the user's tui.json, and the help says what is so
91
+ * now. */
92
+ export function helpRows(actions, ascii, cols = 100) {
93
+ const marks = marksOf(ascii);
94
+ const closing = keyText(["close", "help"].map((id) => actions.find((action) => action.id === id)).filter((action) => action?.keys.length).map((action) => keyLabel(action.keys[0])).join(" or "));
95
+ return [
96
+ heading("Keys"),
97
+ [],
98
+ ...table(actions.map((action) => [action.keys.length ? keyText(keysLabel(action)) : "(no key)", words(action.label)]), cols, KEYS),
99
+ [],
100
+ heading("Marks"),
101
+ [],
102
+ ...table([
103
+ [marks.running, "running"],
104
+ [marks.stopped, "stopped"],
105
+ [marks.shell, "stopped, with a shell left in its terminal"],
106
+ [marks.unknown, "state unknown"],
107
+ [marks.held, "held by a spawn or a retire that is not finished"],
108
+ [`${marks.open} ${marks.closed}`, "has instances below it: shown, folded away"],
109
+ [marks.waiting, "needs input"],
110
+ [`${marks.waiting}N`, "N instances folded away below it need input"],
111
+ [marks.selected, "the selected row, and the pane the movement keys act on"],
112
+ [OPEN_MARK, "among the workspaces: the one that is open"],
113
+ ].map(([mark, meaning]) => [mark, words(meaning)]), cols),
114
+ [],
115
+ heading("Views"),
116
+ [],
117
+ ...table(VIEWS.map((view) => [view.name, view.commands.length ? [...words(`${view.what}:`), ...view.commands.map((command, i) => (i < view.commands.length - 1 ? `${command},` : command))] : words(view.what)]), cols),
118
+ [],
119
+ heading("Machines"),
120
+ [],
121
+ ...sentences(MACHINES, cols),
122
+ [],
123
+ heading("Not in this version"),
124
+ [],
125
+ ...table(NOT_YET.map(({ what, command }) => [what, [command]]), cols),
126
+ ...(closing.width ? [[], [{ col: INDENT, text: closing.text, width: closing.width, style: HINT }, { col: INDENT + closing.width + 1, text: lit("closes this help"), style: HINT }]] : []),
127
+ ];
128
+ }
129
+
130
+ /** `{ rows, extent }`: `size.rows` rows for an area `size.cols` wide, scrolled to `top`, and how
131
+ * many rows the whole help has. The movement keys scroll it. */
132
+ export function help(actions, size, { top = 0, ascii = false } = {}) {
133
+ const all = helpRows(actions, ascii, size.cols);
134
+ const rows = Array.from({ length: size.rows }, () => []);
135
+ const win = windowOf({ top, count: all.length, height: size.rows });
136
+ all.slice(win.top, win.top + win.size).forEach((spans, i) => { rows[i] = spans; });
137
+ const note = cutNote(win.above, win.below);
138
+ if (note && size.rows > 0) rows[size.rows - 1] = [{ col: INDENT, text: lit(note), style: HINT }];
139
+ return { rows, extent: all.length };
140
+ }
@@ -0,0 +1,137 @@
1
+ // The list of instances: (model, pane) -> rows of spans. Pure: no IO, no clock, no escape byte.
2
+ // Every name, word and reason in it is text the TUI did not write and goes through shown(); the
3
+ // marks and the few words around them are the TUI's own. Nothing is told by colour alone: each
4
+ // state has a mark of its own shape, the selected row carries `>` as well as reverse video, and a
5
+ // waiting row carries `!`. In a view of two or more deployments the list also holds a heading per
6
+ // deployment and the sentences the model sets under one: a heading says in words what it is of.
7
+ import { lit, shown, shownEnd, textOf } from "../term/text.mjs";
8
+ import { style } from "../term/style.mjs";
9
+ import { textWidth } from "../term/width.mjs";
10
+
11
+ /** The marks, in UTF-8 and in ASCII (docs/tui.md lists them; the help view draws them from here).
12
+ * The state marks are keyed by the word the shared home gives a row's state, with `shell` and
13
+ * `held` beside them (lib/model.mjs says when). */
14
+ export const MARKS = Object.freeze({
15
+ utf8: Object.freeze({ running: "●", stopped: "○", shell: "◌", unknown: "?", held: "◆", open: "▾", closed: "▸", selected: ">", waiting: "!" }),
16
+ ascii: Object.freeze({ running: "*", stopped: "-", shell: "~", unknown: "?", held: "#", open: "v", closed: ">", selected: ">", waiting: "!" }),
17
+ });
18
+ export const marksOf = (ascii) => (ascii ? MARKS.ascii : MARKS.utf8);
19
+
20
+ /** Two cells of indent per level, and no deeper than this many levels: a deeper row sits at the last. */
21
+ const INDENT = 2, LEVELS = 6;
22
+ /** The cells kept at the right edge for the waiting mark: `!`, `!N`, `!NN`, `!99+`. */
23
+ const WAITING = 4;
24
+ /** A row's cells before its name: the selection mark, a gap, the disclosure mark, a gap, the
25
+ * state mark, a gap. */
26
+ const LEAD = 5;
27
+
28
+ /** A heading starts here: at the margin the header and the footer keep, not at a row's indent. */
29
+ const HEAD = 1;
30
+ /** The cells between two parts of a heading. */
31
+ const GAP = 2;
32
+ /** The fewest cells a heading's short reason or its path is drawn in when it is cut: under them
33
+ * it is left out, since a few cells of either say nothing. */
34
+ const PART_MIN = 8;
35
+ /** Where a sentence inside the list starts. The model wraps a sentence for a pane less this
36
+ * indent and one cell (lib/model.mjs SENTENCE_INDENT, which a view cannot import): the same value. */
37
+ const SENTENCE_INDENT = 3;
38
+
39
+ const PLAIN = style();
40
+ const BOLD = style({ bold: true });
41
+ const DIM = style({ dim: true });
42
+ const SELECTED = style({ reverse: true });
43
+ const LOOK = Object.freeze({ running: style({ fg: "green" }), stopped: DIM, shell: DIM, unknown: style({ fg: "yellow" }), held: style({ fg: "magenta" }) });
44
+ const WAITS = style({ fg: "yellow", bold: true });
45
+ const WAITS_SELECTED = style({ reverse: true, bold: true });
46
+
47
+ export const EMPTY_TEXT = Object.freeze({
48
+ reading: "Reading the deployment.",
49
+ none: "No instances in this deployment.",
50
+ nomatch: "No instance matches the filter.",
51
+ });
52
+
53
+ /** Text the TUI did not write, with the cells its display takes: `{ text, width }`. What stands
54
+ * after it on a row is placed by that width. */
55
+ export function measured(value) {
56
+ const text = shown(value);
57
+ return { text, width: textWidth(textOf(text)) };
58
+ }
59
+
60
+ const waitingText = (row) => (row.below > 99 ? "!99+" : row.below > 0 ? `!${row.below}` : row.waiting ? "!" : null);
61
+
62
+ /** One instance's row in a pane `cols` wide: the marks, the name cut to what is left, the state
63
+ * word in its column and the waiting mark at the edge. Every span has its width, so no text can
64
+ * pass its column whatever the terminal thinks a character takes. */
65
+ function instanceRow(row, cols, wordWidth, marks) {
66
+ const look = (own) => (row.selected ? SELECTED : own);
67
+ const at = Math.min(row.depth, LEVELS - 1) * INDENT;
68
+ const wordCol = Math.max(0, cols - WAITING - 1 - wordWidth);
69
+ const nameCol = LEAD + at;
70
+ const spans = [];
71
+ if (row.selected) spans.push({ col: 0, width: cols, style: SELECTED }, { col: 0, text: lit(marks.selected), style: SELECTED, width: 1 });
72
+ if (row.disclosure) spans.push({ col: 1 + at, text: lit(marks[row.disclosure]), style: look(PLAIN), width: 1 });
73
+ spans.push({ col: 3 + at, text: lit(marks[row.mark] ?? marks.unknown), style: look(LOOK[row.mark] ?? LOOK.unknown), width: 1 });
74
+ if (wordCol - 2 > nameCol) spans.push({ col: nameCol, text: shown(row.name), style: look(PLAIN), width: wordCol - 2 - nameCol });
75
+ if (wordWidth > 0) spans.push({ col: wordCol, text: shown(row.word), style: look(DIM), width: wordWidth });
76
+ const waits = waitingText(row);
77
+ if (waits) spans.push({ col: cols - waits.length, text: lit(waits), style: row.selected ? WAITS_SELECTED : WAITS, width: waits.length });
78
+ return spans;
79
+ }
80
+
81
+ /** A deployment's heading in a pane `cols` wide: its label in bold, its path, and, when it is not
82
+ * live, the shared word for its state and the short reason; at the right edge the time a machine
83
+ * reported its rows at. The state and the time always stand. When the row is too narrow for the
84
+ * rest, the path is given up first, then the short reason, and then the label is cut: the full
85
+ * reason is in the detail of each of its rows, and under the heading when it has none. */
86
+ function headingRow({ label, path, state, short, readAt }, cols, ascii) {
87
+ const spans = [], edge = cols - 1;
88
+ let limit = edge;
89
+ if (readAt) {
90
+ const read = `read ${readAt}`, col = Math.max(HEAD, edge - read.length);
91
+ spans.push({ col, text: lit(read), style: DIM, width: Math.max(0, Math.min(read.length, edge - col)) });
92
+ limit = col - GAP;
93
+ }
94
+ const name = measured(label), word = state ? measured(state) : null, why = state && short ? measured(short) : null, where = path ? measured(path) : null;
95
+ let room = limit - HEAD - (word ? GAP + word.width : 0);
96
+ const nameWidth = Math.max(0, Math.min(name.width, room));
97
+ room -= nameWidth;
98
+ /** The cells a part after the label gets: its own, or what is left when that is enough to read. */
99
+ const taken = (part) => (part && part.width > 0 && room - GAP >= Math.min(part.width, PART_MIN) ? Math.min(part.width, room - GAP) : 0);
100
+ const whyWidth = taken(why);
101
+ if (whyWidth) room -= GAP + whyWidth;
102
+ const whereWidth = taken(where);
103
+ let col = HEAD;
104
+ if (nameWidth) { spans.push({ col, text: name.text, style: BOLD, width: nameWidth }); col += nameWidth + GAP; }
105
+ // A path is read from its end: cut, it keeps its last cells.
106
+ if (whereWidth) { spans.push({ col, text: whereWidth < where.width ? shownEnd(path, whereWidth, { ascii }) : where.text, style: DIM, width: whereWidth }); col += whereWidth + GAP; }
107
+ if (word) { spans.push({ col, text: word.text, style: PLAIN, width: Math.max(0, Math.min(word.width, edge - col)) }); col += word.width + GAP; }
108
+ if (whyWidth) spans.push({ col, text: why.text, style: DIM, width: whyWidth });
109
+ return spans.filter((span) => span.width > 0);
110
+ }
111
+
112
+ /** How many rows are cut off, in the TUI's words: `12 more below`. */
113
+ export function cutNote(above, below) {
114
+ return [above > 0 ? `${above} more above` : null, below > 0 ? `${below} more below` : null].filter(Boolean).join(", ");
115
+ }
116
+
117
+ /** `size.rows` rows for a pane `size.cols` wide: the model's window of the list, one item per row,
118
+ * and on the last row what is cut off above and below. An item is an instance, a deployment's
119
+ * heading, one row of a sentence the model wrapped (safe text already, placed as it is), a line
120
+ * of the TUI's own, the one line that says why no instance is listed, or nothing (an empty row). */
121
+ export function instances(m, size) {
122
+ const rows = Array.from({ length: size.rows }, () => []);
123
+ if (size.rows < 1) return rows;
124
+ const marks = marksOf(m.ascii);
125
+ const aside = Math.max(0, size.cols - LEAD + 2), sentence = Math.max(0, size.cols - SENTENCE_INDENT - 1);
126
+ m.list.forEach((item, i) => {
127
+ if (!item || i >= size.rows) return;
128
+ if (item.heading) rows[i] = headingRow(item.heading, size.cols, m.ascii);
129
+ else if (item.line) rows[i] = [{ col: SENTENCE_INDENT, text: item.line, width: sentence }];
130
+ else if (item.own) rows[i] = [{ col: SENTENCE_INDENT, text: lit(item.own), style: DIM, width: sentence }];
131
+ else if (item.empty) rows[i] = [{ col: LEAD - 2, text: lit(EMPTY_TEXT[item.empty]), style: DIM, width: aside }];
132
+ else rows[i] = instanceRow(item, size.cols, m.wordWidth, marks);
133
+ });
134
+ const note = cutNote(m.above, m.below);
135
+ if (note) rows[size.rows - 1] = [{ col: LEAD - 2, text: lit(note), style: DIM, width: aside }];
136
+ return rows;
137
+ }
@@ -0,0 +1,19 @@
1
+ // The window of a scrolling pane: which of `count` rows a pane `height` rows tall shows. Pure
2
+ // arithmetic, shared by the store (which keeps `top`) and the views (which draw it), so the two
3
+ // can never disagree about what is on the screen.
4
+
5
+ /** `{ top, size, above, below }`: the first row shown, how many are shown, and how many are cut
6
+ * off on each side. When rows are cut off the pane's last row is given up to say so, hence
7
+ * `size` is one less than `height` then. `keep` is a row that must stay inside the window (the
8
+ * selection), or -1: `top` moves the least that keeps it there. */
9
+ export function windowOf({ top = 0, count, height, keep = -1 }) {
10
+ if (height < 1 || count < 1) return { top: 0, size: 0, above: 0, below: Math.max(0, count) };
11
+ if (count <= height) return { top: 0, size: count, above: 0, below: 0 };
12
+ const size = Math.max(1, height - 1);
13
+ let first = Math.min(Math.max(0, top), count - size);
14
+ if (keep >= 0 && keep < count) {
15
+ if (keep < first) first = keep;
16
+ else if (keep >= first + size) first = keep - size + 1;
17
+ }
18
+ return { top: first, size, above: first, below: count - first - size };
19
+ }
@@ -0,0 +1,97 @@
1
+ // The switcher of workspaces: (model, area) -> rows of spans. Pure: no IO, no clock, no escape
2
+ // byte. It takes the whole body of the frame. A workspace's name, its machines and how many of
3
+ // its deployments are not live are the shared home's words and go through shown(), as does a
4
+ // folder's name and path; the marks, the headings of its own and its few sentences are the TUI's.
5
+ // Nothing is told by colour alone: the selected row carries `>` as well as reverse video, and
6
+ // the workspace that is open carries `*`.
7
+ import { lit, shown } from "../term/text.mjs";
8
+ import { style } from "../term/style.mjs";
9
+ import { cutNote, measured } from "./instances.mjs";
10
+
11
+ /** The mark of the workspace that is open (the help view lists it from here). */
12
+ export const OPEN_MARK = "*";
13
+ /** The switcher's own sentences. `none`: its second sentence ends in a command, which is a piece
14
+ * of its own so that a narrow row moves it whole to the next one and never cuts it. */
15
+ export const SWITCHER_TEXT = Object.freeze({
16
+ none: Object.freeze(["No workspace to show.", "Start it in a deployment, or name one:", "oats tui --dir <path>"]),
17
+ nomatch: "No workspace matches the filter.",
18
+ gone: "That workspace is no longer listed.",
19
+ refused: "Not an OATS deployment any more.",
20
+ });
21
+
22
+ /** The columns of a choice: the selection mark in the first cell, the open mark, then the label.
23
+ * A heading and every line that is not a choice start two cells before the labels. */
24
+ const OPEN = 2, LABEL = 4, ASIDE = LABEL - 2;
25
+ /** One cell of margin at the right edge, as the header and the footer keep. */
26
+ const MARGIN = 1;
27
+ /** The cells between two columns. */
28
+ const GAP = 2;
29
+ /** The labels' column is a third of the width, within these bounds: a column of a fixed width
30
+ * does not move while the list scrolls, and at the smallest width the frame is drawn at it
31
+ * leaves the second column the cells of the longest line of the TUI's own that stands there. */
32
+ const LABEL_MIN = 20, LABEL_MAX = 40;
33
+
34
+ const PLAIN = style();
35
+ const DIM = style({ dim: true });
36
+ const SELECTED = style({ reverse: true });
37
+
38
+ /** One choice in an area `cols` wide: a workspace, or a folder that is not opened yet. What a
39
+ * workspace says of its deployments that are not live stands whole at the right edge; when the
40
+ * row is too narrow the place is cut first, then the label. */
41
+ function choiceRow(item, cols) {
42
+ const look = (own) => (item.selected ? SELECTED : own);
43
+ const edge = cols - MARGIN;
44
+ const labelCols = Math.min(Math.max(Math.floor(cols / 3), LABEL_MIN), LABEL_MAX), placeCol = LABEL + labelCols + GAP;
45
+ const spans = [];
46
+ if (item.selected) spans.push({ col: 0, width: cols, style: SELECTED }, { col: 0, text: lit(">"), style: SELECTED, width: 1 });
47
+ if (item.open) spans.push({ col: OPEN, text: lit(OPEN_MARK), style: look(PLAIN), width: 1 });
48
+ const live = measured(item.notLiveText);
49
+ const liveCol = Math.max(LABEL, edge - live.width);
50
+ // Where the label and the place end: at the edge, or two cells before what stands there.
51
+ const limit = live.width ? liveCol - GAP : edge;
52
+ // A folder that turned out not to be a deployment says so where its path stood.
53
+ const place = item.refused ? { text: lit(SWITCHER_TEXT.refused), width: SWITCHER_TEXT.refused.length } : measured(item.place);
54
+ // With no place to show, the label has the row.
55
+ const labelWidth = Math.max(0, Math.min(place.width ? labelCols : limit - LABEL, limit - LABEL));
56
+ if (labelWidth) spans.push({ col: LABEL, text: shown(item.label), style: look(PLAIN), width: labelWidth });
57
+ if (place.width && limit > placeCol) spans.push({ col: placeCol, text: place.text, style: look(item.refused ? PLAIN : DIM), width: limit - placeCol });
58
+ if (live.width) spans.push({ col: liveCol, text: live.text, style: look(PLAIN), width: Math.max(0, Math.min(live.width, edge - liveCol)) });
59
+ return spans.filter((span) => span.width > 0);
60
+ }
61
+
62
+ /** The lines above the choices, top to bottom, for an area `cols` wide: that the workspace which
63
+ * was open is no longer listed (something that happened, so not dim), and why no workspace is
64
+ * listed (dim, as the list's own empty line is). */
65
+ function leadLines(s, cols) {
66
+ const lines = [];
67
+ if (s.said === "gone") lines.push({ text: SWITCHER_TEXT.gone, style: PLAIN });
68
+ if (s.empty === "nomatch") lines.push({ text: SWITCHER_TEXT.nomatch, style: DIM });
69
+ if (s.empty === "none") {
70
+ const [first, second, command] = SWITCHER_TEXT.none, whole = `${second} ${command}`;
71
+ for (const text of [first, ...(ASIDE + whole.length <= cols - MARGIN ? [whole] : [second, command])]) lines.push({ text, style: DIM });
72
+ }
73
+ return lines;
74
+ }
75
+
76
+ /** `size.rows` rows for an area `size.cols` wide: the lines above, the model's window of the
77
+ * switcher's rows, one item per row, and on the last row what is cut off above and below.
78
+ * The model's window is as tall as the area, so a line above takes its row only while the rows
79
+ * given leave one: a choice is never hidden for it. */
80
+ export function switcher(m, size) {
81
+ const rows = Array.from({ length: size.rows }, () => []);
82
+ const s = m.switcher;
83
+ if (!s || size.rows < 1) return rows;
84
+ const { cols } = size, aside = Math.max(0, cols - ASIDE - MARGIN);
85
+ const note = cutNote(s.above, s.below);
86
+ const lead = leadLines(s, cols).slice(0, Math.max(0, size.rows - s.rows.length - (note ? 1 : 0)));
87
+ lead.forEach((line, i) => { rows[i] = [{ col: ASIDE, text: lit(line.text), style: line.style, width: aside }]; });
88
+ s.rows.forEach((item, i) => {
89
+ const at = lead.length + i;
90
+ if (at >= size.rows) return;
91
+ if (item.heading !== undefined) rows[at] = [{ col: ASIDE, text: item.shared ? shown(item.heading) : lit(item.heading), style: DIM, width: aside }];
92
+ else if (item.own !== undefined) rows[at] = [{ col: LABEL, text: lit(item.own), style: DIM, width: Math.max(0, cols - LABEL - MARGIN) }];
93
+ else rows[at] = choiceRow(item, cols);
94
+ });
95
+ if (note) rows[size.rows - 1] = [{ col: ASIDE, text: lit(note), style: DIM, width: aside }];
96
+ return rows;
97
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@awebai/oats-tui",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "description": "OATS TUI (preview): the terminal client behind `oats tui`. Shipped inside @awebai/oats, never published on its own.",
6
+ "type": "module",
7
+ "license": "MIT"
8
+ }
@@ -60,8 +60,8 @@ members:
60
60
  - git:github.com/acme/agents # the host is a member too
61
61
  - git:github.com/acme/platform
62
62
  packages:
63
- oats.framework: v1.9.1 # bare versions resolve through the official catalog
64
- oats.okf: v4.1.1
63
+ oats.framework: v1.9.4 # bare versions resolve through the official catalog
64
+ oats.okf: v5.0.3
65
65
  defaults:
66
66
  capabilities: { oats.core: { from: package } }
67
67
  knowledge: { oats.okf: { from: package } }
@@ -171,12 +171,15 @@ oats spawn backend-expert --task "First concrete task"
171
171
  oats status
172
172
  ```
173
173
 
174
- Before configuring unattended development-channel confirmation, read
175
- `docs/configuration.md#exact-home-launch-prompt-consent`. The sole opt-in is
176
- `oats-local.yaml` `launchPromptAnswers.homes.<absolute-canonical-home>.awebDevelopmentChannel`;
177
- it defaults false and requires the owner's explicit authorization for that home.
178
- Never infer consent from provider development mode, harness trust settings or
179
- a request to spawn. `workspaceTrust` is unsupported; remove it and handle
174
+ OATS confirms Claude's development-channel prompt by itself whenever it
175
+ launches Claude with `--dangerously-load-development-channels
176
+ plugin:aweb-channel@awebai-marketplace` (the default `delivery: channel`,
177
+ `claudeChannelMode: development`); see
178
+ `docs/configuration.md#the-development-channel-confirmation`. There is no
179
+ consent setting. To keep the prompt for a person, set
180
+ `settings.oats.aweb.delivery: session` or `claudeChannelMode: approved` in
181
+ `oats-local.yaml`. An old `launchPromptAnswers` block is ignored with a warning
182
+ (remove it); one with `awebDevelopmentChannel: false` is refused. Handle
180
183
  folder trust explicitly with `oats harness trust --dir D --harness claude --plan`,
181
184
  then the same command without `--plan` to apply. Run it on the target host with
182
185
  native configuration writers quiescent. Use `codex` or `all` for those selected
@@ -185,20 +188,24 @@ The command changes only deployment-root trust and records an audit under
185
188
  `D/.agents/harness-trust.jsonl`. A failure can retain an applied native change;
186
189
  inspect its per-file outcome and audit before retrying. Nested Git boundaries
187
190
  can prevent Claude inheritance. See [harness trust](../../docs/harness-trust.md). Folder-trust
188
- and API-key questions remain unexpected and blocked. Only the qualified Claude
189
- 2.1.289 executable digest, `darwin-arm64` platform and 110x35 geometry documented
190
- there can match the exact aweb development-channel frame. A reported version
191
- alone is insufficient. Preview reports policy without terminal input;
192
- `--no-launch` never answers. If launch returns `E_SPAWN_INCOMPLETE`, inspect the
193
- retained home/pane: do not respawn, repeat keys or treat `launched:false` as an
194
- absent process.
195
- Completion retains the exact empty-frame families and, only after the submitted
196
- channel Enter, can recognize the qualified bottom composer/effort-footer region.
197
- See [the bounded completion contract](../../docs/launch-prompt-completion.md).
198
- Known question markers block first; normal shortcut/interrupt hints do not.
199
- Unknown dialogs retaining that region may be misclassified completed. Completion
200
- closes input authority, not a readiness or idle-state promise. Missing effort or
201
- trailing notices still block. Required private evidence failure is incomplete.
191
+ and API-key questions remain unexpected and blocked. The confirmation is
192
+ answered with one Enter only when the screen equals an entry of the tolerance
193
+ list, on any pane width wide enough to wrap at word boundaries; a new Claude
194
+ wording blocks loudly until a reviewed change adds it. `--no-launch` never
195
+ answers. Where channels are unavailable for the Claude account, Claude ignores
196
+ the flag and shows no confirmation: the start succeeds with `launchPrompts.status:
197
+ "flag-ignored"`, no key, and a warning that the instance has no channel delivery,
198
+ so mail and chat will not wake it until delivery changes.
199
+ On a first spawn that notice can be hidden behind another one; the start then
200
+ blocks, and the error says to look at the pane and restart a running session.
201
+ If launch returns `E_SPAWN_INCOMPLETE`, inspect the retained home/pane:
202
+ do not respawn, repeat keys or treat `launched:false` as an absent process.
203
+ After the Enter, completion is reporting only: 2 s of consecutive clean captures
204
+ (no question marker, no confirmation; the screen may change) complete; a marker
205
+ or the confirmation coming back blocks; no such window by the 30 s bound is an
206
+ observation timeout after the one Enter. See [the completion contract](../../docs/launch-prompt-completion.md).
207
+ Unknown dialogs without a marker may be reported completed. Completion closes
208
+ input authority, not a readiness or idle-state promise.
202
209
 
203
210
  Create and spawn only when asked. After the first spawn, the `oats.setup`
204
211
  skills carry the rest of the deployment (messaging, more souls, rebuilds); the
@@ -208,6 +215,6 @@ model in full is `docs/workspaces.md` in the OATS repository.
208
215
  For a retained launch-prompt block after a submitted answer, inspect the existing
209
216
  launch event and private frame receipt as described in
210
217
  `docs/execution-targets.md#private-unmatched-launch-evidence`. Do not transmit raw
211
- screen text or treat a saved frame as a new accepted signature. A structurally completed frame is also saved privately. A saved artifact alone
218
+ screen text or treat a saved frame as a new accepted signature. A completed frame is also saved privately. A saved artifact alone
212
219
  does not establish completion: verify the final checked launch outcome. Missing
213
220
  effort or unsupported footer shapes can block while the pane is active.
@@ -1,35 +0,0 @@
1
-
2
- ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
3
- WARNING: Loading development channels
4
-
5
- --dangerously-load-development-channels is for local channel development only. Do not use this option to
6
- run channels you have downloaded off the internet.
7
-
8
- Please use --channels to run a list of approved channels.
9
-
10
- Channels: plugin:aweb-channel@awebai-marketplace
11
-
12
- ❯ 1. I am using this for local development
13
- 2. Exit
14
-
15
- Enter to confirm · Esc to cancel
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
@@ -1,35 +0,0 @@
1
- ▐▛███▛█ Claude Code v2.1.289
2
- ▝▜██████▀ Opus 5.5 · API Usage Billing
3
- ▝▝ ▝▝ ~/…/instances/oats-kernel-expert-wake-lifecycle/work/708-fixtures/private-run/target
4
-
5
- ▎ Channels (experimental) messages from plugin:aweb-channel@awebai-marketplace inject directly in this session
6
- ▎ · restart without --dangerously-load-development-channels to stop
7
- ▎ plugin:aweb-channel@awebai-marketplace · plugin not installed
8
-
9
- ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
10
- ❯ 
11
- ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
12
- ⏵⏵ auto mode on (shift+tab to cycle) · ← for agents ◐ medium · /effort
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
@@ -1,35 +0,0 @@
1
- ▐▛███▛█ Claude Code v2.1.289
2
- ▝▜██████▀ Opus 5.5 · API Usage Billing
3
- ▝▝ ▝▝ ~/…/instances/oats-kernel-expert-wake-lifecycle/work/708-fixtures/installed-run/target
4
-
5
- ▎ Channels (experimental) messages from plugin:aweb-channel@awebai-marketplace inject directly in this session
6
- ▎ · restart without --dangerously-load-development-channels to stop
7
-
8
- ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
9
- ❯ 
10
- ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
11
- ⏵⏵ auto mode on (shift+tab to cycle) · ← for agents ◐ medium · /effort
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-