Repository navigation
Commit f7a1063
authored
✨ Run the packaged Plan in
`xmd repl` took a location and nothing else, so an Agent had no way to reach a
REPL entry and `<Plan>` had no way to run in one. It now reads the same five
Agent options `xmd run` reads, as a first-class Plugin command of its own —
selected Plugins are told `repl`, and the bundled Git Plugin declares for it,
because a REPL entry is a document run under the ordinary profile — one declaration, so the two commands cannot come
to mean different things by the same spelling — and settles them in a fixed
order: the line, then the Agent configuration, then one profile, then the
terminal. Everything a wrong invocation can be refused for is refused before a
per-user directory is formed, a history file exists or the terminal's modes are
touched.
What a REPL execution runs under is one immutable `ReplExecutionProfile`,
assembled once in the command's own scope: the selected Plugins, the Agent
identity components, the real packaged `<Plan>` declaration and the ordinary
evaluation ceiling, with the settled permission mode beside them. The program
takes that one value and nothing else, so what an entry may resolve, what ceiling
a generated fragment runs under and how a permission request is answered are
facts about the command a person invoked rather than about the entry they typed.
It carries data and installations and never authority: no stack, provider, Plan
writer, live request or scope reaches the model, the route or the Journal through
it. The REPL installs no readline permission handling, no foreground launcher and
no browser form — a question is answered in the drawer in front of the person,
and `<Session.Launch>` refuses through the established missing-launcher contract
because this command is using the terminal it would be given.
A returned Plan is a generated fragment, and a fragment that may write may now
also ask: canonical `<Elicit>` joins the ordinary write table at core's own
origin, key and revision, paired only, as a *pinned capability* rather than a
name the fragment resolves. Preflight selects it where it finds an occurrence
under a `write` selection, and the body it selects is core's own `<Elicit>`,
closed over before any document code runs — exactly as the body behind `<File>`
is. Nothing resolves the name: not before the root import, not at invocation,
and middleware answering a generated import with a body of its own is refused,
because only canonical execution answers one. So a same-name repository,
registered, declared, middleware or separately loaded `Elicit` receives no grant
and never runs, including the workflow host's own suspension replacement, which
goes on answering the *authored* element in a run exactly as it did. An
execution whose fragment never writes the element resolves nothing at all, which
is why admitting the entry cannot break a document that only writes a `<File>`.
`allow={["read"]}` still refuses it, because a read selection promises nobody
will be interrupted. What stays contextual is the interaction and only the
interaction: the pinned body asks through the Elicitation Api lexically in scope,
so the REPL drawer answers a generated question and an enclosing `<Answers>`
region answers it without anybody being asked. Its answer is retained by the
ordinary `elicit` operation, and replay restores it without asking anyone. The
`generated_xmd` record keeps the identity and the form and nothing about the
answer.
One defect the journey found is fixed here. The model owned nothing the
packaged Plan did: an
import's retained selection says where its scope's source came from, and for a
component the host *declared* that is the retained origin and the retained bytes
rather than a path, which the reader did not know. Every turn and question inside
`Plan.md` therefore belonged to nothing, so a live screen quietly kept its last
good model and a cold one refused the whole history. Both are read from the Journal — no declaration
lookup, no file read, no fallback owner — and a source this prefix never
admitted, or admitted twice, is still refused rather than attached to a guess.
The program a Plan returns has no file at all, so a position gains a second
source it can name. `SourcePosition` takes an optional `generatedSource`: the id
the fragment was admitted under, which whole-fragment preflight stamps on every
executable position in the candidate text it scans, before the fragment performs
anything. A position names one source — a path, that id, or neither for dynamic
text — and both together is malformed wherever a reader parses one. The member
travels by value through the scanner, expansion snapshots and element sites, the
durable source description, component-resolution copies and Workflow history.
That identity is what owns the work inside a fragment. The effect names its
fragment; journal order and coroutine ancestry only say whether the admission it
names could be its — one that happened afterwards, or on work the effect is not
part of, owns nothing however recently it ran, and ancestry is by coroutine
segment, so `root.1` encloses `root.1.0` and has nothing to do with `root.10`.
Two sequential fragments are sibling scopes even though their effects collide in
name, line and column; a fragment's spawned descendants belong to it; concurrent
siblings are independent of which settled first; and every way a history names no
one fragment — never admitted, admitted only afterwards, admitted twice, admitted
elsewhere, refused, unreadable, or naming no source at all — refuses whole, with
no partial model.
Evidence is `packages/cli/tests/repl-agent-journey.test.ts`, which drives
`runReplProgram()` over a real Journal, a mounted Freedom tree, the real renderer
and a terminal the suite writes bytes to. J1 walks the published Story: the real
packaged Plan, its review in the REPL's own drawer, a refused revision that
appends no answer and starts no turn, feedback resuming the same conversation,
and an approval that admits the returned source byte for byte — then the
generated program's two questions, the preview it showed, the one README it
wrote after confirmation and the decline path that writes nothing. J2 runs three
`<Spawn>` conversations and holds them complete, streaming and queued in one
frame. J3 reruns that whole journey and reopens it in a fresh command
scope — the Plan's scope, the program it returned, both retained turns, both
reviews, both of the program's own questions, the README result and the same
History positions — with zero provider calls and a byte-identical history, and
restores a failed and a cancelled turn with the text each had. C1 is the command line, and X1 is EOF, a
lost renderer, a lost terminal and a cancelled scope — each joining what it
owned, appending nothing after, and giving the modes back once.
One measured limit is reported rather than papered over: while a turn is still
queued it has no provider conversation key yet, so the Sessions surface offers
fewer selectors than there are children until it starts.xmd repl, under one immutable profile (#864)1 parent 4af3009 commit f7a1063
42 files changed
Lines changed: 4407 additions & 288 deletions
File tree
- packages
- cli
- src
- repl
- tests
- support
- core
- src
- components
- tests
- git
- src
- tests
- workflow
- src/lifecycle
- tests
- specs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5640 | 5640 | | |
5641 | 5641 | | |
5642 | 5642 | | |
| 5643 | + | |
| 5644 | + | |
| 5645 | + | |
| 5646 | + | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
| 5665 | + | |
| 5666 | + | |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
| 5680 | + | |
| 5681 | + | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
| 5686 | + | |
| 5687 | + | |
| 5688 | + | |
| 5689 | + | |
| 5690 | + | |
| 5691 | + | |
| 5692 | + | |
| 5693 | + | |
| 5694 | + | |
| 5695 | + | |
| 5696 | + | |
5643 | 5697 | | |
5644 | 5698 | | |
5645 | 5699 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
166 | 173 | | |
167 | | - | |
168 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
169 | 179 | | |
170 | 180 | | |
171 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
211 | 247 | | |
212 | 248 | | |
213 | 249 | | |
| |||
227 | 263 | | |
228 | 264 | | |
229 | 265 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
| 266 | + | |
238 | 267 | | |
239 | 268 | | |
240 | 269 | | |
| |||
247 | 276 | | |
248 | 277 | | |
249 | 278 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | 279 | | |
263 | 280 | | |
264 | 281 | | |
| |||
290 | 307 | | |
291 | 308 | | |
292 | 309 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
297 | 316 | | |
298 | 317 | | |
299 | 318 | | |
| |||
302 | 321 | | |
303 | 322 | | |
304 | 323 | | |
| 324 | + | |
305 | 325 | | |
306 | 326 | | |
307 | 327 | | |
| |||
588 | 608 | | |
589 | 609 | | |
590 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
591 | 617 | | |
592 | 618 | | |
593 | 619 | | |
594 | 620 | | |
595 | 621 | | |
596 | 622 | | |
597 | 623 | | |
598 | | - | |
599 | | - | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
600 | 659 | | |
601 | | - | |
602 | | - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
603 | 663 | | |
604 | 664 | | |
605 | | - | |
606 | 665 | | |
607 | 666 | | |
608 | 667 | | |
| |||
2835 | 2894 | | |
2836 | 2895 | | |
2837 | 2896 | | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
2838 | 2914 | | |
2839 | 2915 | | |
2840 | 2916 | | |
2841 | 2917 | | |
2842 | 2918 | | |
2843 | 2919 | | |
2844 | 2920 | | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
2845 | 2927 | | |
2846 | | - | |
2847 | | - | |
2848 | | - | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
2849 | 2932 | | |
2850 | 2933 | | |
2851 | 2934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| 48 | + | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
| |||
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
95 | | - | |
| 101 | + | |
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| |||
0 commit comments