viewable-one 0.12.1 → 0.12.3
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.
- package/CHANGELOG.md +71 -1
- package/README.md +31 -48
- package/SPAWN.md +136 -79
- package/glytch.mjs +41 -10
- package/lib/acp.mjs +152 -150
- package/lib/admission.mjs +25 -5
- package/lib/agent-selection.mjs +5 -4
- package/lib/agents.mjs +68 -24
- package/lib/answerTag.mjs +47 -0
- package/lib/atomic.mjs +1 -16
- package/lib/auth.mjs +172 -52
- package/lib/authenticatedHttp.mjs +10 -3
- package/lib/boardside.mjs +28 -12
- package/lib/child.mjs +129 -116
- package/lib/claudeModels.mjs +168 -0
- package/lib/codex-rpc.mjs +2 -2
- package/lib/codex.mjs +50 -50
- package/lib/codexApps.mjs +17 -3
- package/lib/codexToolInputs.mjs +98 -22
- package/lib/codingChecks.mjs +8 -4
- package/lib/conversationRules.mjs +47 -7
- package/lib/detect.mjs +39 -24
- package/lib/devserver.mjs +30 -19
- package/lib/doctor.mjs +10 -8
- package/lib/folderReads.mjs +96 -0
- package/lib/followUps.mjs +170 -0
- package/lib/hosted.mjs +13 -4
- package/lib/init-connect.mjs +29 -10
- package/lib/lateResume.mjs +135 -0
- package/lib/logindaemon.mjs +129 -49
- package/lib/logs.mjs +2 -2
- package/lib/mcpjson.mjs +35 -2
- package/lib/memberPreview.mjs +22 -14
- package/lib/multiwatch.mjs +28 -41
- package/lib/pagePictures.mjs +15 -12
- package/lib/pageRoutes.mjs +5 -2
- package/lib/paths.mjs +3 -3
- package/lib/permissionAsk.mjs +344 -61
- package/lib/previewGateway.mjs +4 -3
- package/lib/procs.mjs +73 -2
- package/lib/refusal.mjs +0 -2
- package/lib/registry.mjs +7 -7
- package/lib/repomap.mjs +4 -3
- package/lib/restartPass.mjs +39 -11
- package/lib/rowsAnswers.mjs +52 -69
- package/lib/rowsEvents.mjs +20 -2
- package/lib/runner-health.mjs +29 -5
- package/lib/runner.mjs +161 -1347
- package/lib/runnerAdmission.mjs +6 -12
- package/lib/runnerApi.mjs +20 -11
- package/lib/runnerBeat.mjs +384 -0
- package/lib/runnerCompletion.mjs +5 -2
- package/lib/runnerExecute.mjs +227 -0
- package/lib/runnerGates.mjs +338 -0
- package/lib/runnerLaunch.mjs +351 -0
- package/lib/runnerLease.mjs +31 -9
- package/lib/runnerOps.mjs +217 -0
- package/lib/runnerPace.mjs +10 -6
- package/lib/runnerRecovery.mjs +457 -0
- package/lib/runnerRegister.mjs +29 -8
- package/lib/runnerSettlement.mjs +43 -16
- package/lib/runnerWorkspace.mjs +19 -4
- package/lib/spawn.mjs +0 -5
- package/lib/sync.mjs +28 -16
- package/lib/uninstall-project.mjs +12 -11
- package/lib/uninstall.mjs +32 -25
- package/lib/update.mjs +4 -4
- package/lib/{glytchFolder.mjs → viewableFolder.mjs} +22 -16
- package/lib/worktree.mjs +83 -26
- package/lib/writePolicy.mjs +90 -10
- package/package.json +2 -2
package/SPAWN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This is the runner's contract, written for whoever maintains it: every row it
|
|
4
4
|
reads and writes, every bound it respects, and what happens at each edge. It
|
|
5
|
-
is not a guide to using
|
|
5
|
+
is not a guide to using Viewable - [README.md](./README.md) is that.
|
|
6
6
|
|
|
7
7
|
The rows contract below is what runs today.
|
|
8
8
|
|
|
@@ -59,7 +59,7 @@ changed, so no pictures.
|
|
|
59
59
|
|
|
60
60
|
- The browser is one already installed: Chrome, then Edge, then Chromium, in
|
|
61
61
|
the usual install places (PATH on Linux). Nothing is downloaded.
|
|
62
|
-
`GLYTCH_BROWSER` names one, or `none` turns pictures off. It runs headless
|
|
62
|
+
`VIEWABLE_BROWSER` (or its `GLYTCH_BROWSER` fallback) names one, or `none` turns pictures off. It runs headless
|
|
63
63
|
over its DevTools pipe with a fresh profile that is deleted afterwards, and
|
|
64
64
|
without the runner's secrets.
|
|
65
65
|
- The app is the folder's `dev` script, else `start`, through npm without a
|
|
@@ -67,7 +67,7 @@ changed, so no pictures.
|
|
|
67
67
|
`BROWSER=none`. Its address is read from its output, else that port. It must
|
|
68
68
|
answer within 60 s. Its whole process group stops after each picture. One
|
|
69
69
|
app runs at a time: the copy, then the folder.
|
|
70
|
-
- The page is the one the session names in `.
|
|
70
|
+
- The page is the one the session names in `.viewable-page.json` at the copy's
|
|
71
71
|
root (`{"path":"/settings","name":"settings page"}`, never committed), else
|
|
72
72
|
the file route of a changed page file (Next, SvelteKit, Astro, Remix), else
|
|
73
73
|
`/`. Its name comes from the record, else from its address.
|
|
@@ -109,7 +109,9 @@ to rows did not change.
|
|
|
109
109
|
the same way every other hosted call in this package resolves one, POST to
|
|
110
110
|
`supabase/functions/board-runner/`.
|
|
111
111
|
|
|
112
|
-
`bridge/lib/runner.mjs`
|
|
112
|
+
`bridge/lib/runner.mjs` (with the pieces it was split into in #4668:
|
|
113
|
+
`runnerGates.mjs`, `runnerExecute.mjs`, `runnerLaunch.mjs`, `runnerOps.mjs`,
|
|
114
|
+
`runnerBeat.mjs`) reads and writes rows, not files, for every request
|
|
113
115
|
kind, chat turns included. What replaces each piece that used to be a file
|
|
114
116
|
under `.glytch/inbox/spawn/`:
|
|
115
117
|
|
|
@@ -119,13 +121,13 @@ under `.glytch/inbox/spawn/`:
|
|
|
119
121
|
| `<id>.result.txt` | `update {runId, patch:{status, result, finished_at}}` - `result` still write-once |
|
|
120
122
|
| `<id>.log`, streamed | `events {runId, events:[{seq,kind,text}]}` - chunks every `PM_LOG_FLUSH_MS` (default 3000ms), `seq` monotonic; see rowsEvents.mjs for how the head/cut/tail cap is honoured at settle time |
|
|
121
123
|
| `<id>.session.json` | `sidecar` on the run row, written by `update` - for EVERY request kind, chat turns included (a first chat message is not `isPersistent` and mints no worktree either, so without this exception it would write no sidecar at all - see `runnerCompletion.mjs`) |
|
|
122
|
-
| `.runner.json` | `register`+`heartbeat`, on start and every beat (`RUNNER_BEAT_MS`). `
|
|
124
|
+
| `.runner.json` | `register`+`heartbeat`, on start and every beat (`RUNNER_BEAT_MS`). `viewable doctor`'s liveness row used to read the file and froze at whatever the last file-based daemon wrote; it asks the board directly now, through the read-only `presence` op |
|
|
123
125
|
| `<id>.stop` | `heartbeat`'s `stops` array |
|
|
124
|
-
| `<id>.merge` / `<id>.delete` / `<id>.relaunch` | `heartbeat`'s `ops`, `opTake`, `opResult` - relaunch's record is the run row's own `server` column (or the worktree's live `.
|
|
126
|
+
| `<id>.merge` / `<id>.delete` / `<id>.relaunch` | `heartbeat`'s `ops`, `opTake`, `opResult` - relaunch's record is the run row's own `server` column (or the worktree's live `.viewable-server.json` when the row has none yet), never a `.server` mailbox file |
|
|
125
127
|
| the shared-preview request/receipt pair (`.glytch/inbox/preview/`) | a `run_ops` row of `kind:"preview"` - claimed once (`opTake`), its proofs read from the claimed run row (`runnerApi.runs`) and from `get_node` over `hosted.callTool`, never from `canvas/`; `opResult` ticks through starting/ready/offline/error on the SAME op row, since preview (unlike merge/delete/relaunch) is not one-shot - `bridge/lib/sharedPreview.mjs`'s `createSharedPreviewService` tracks it across beats |
|
|
126
128
|
| `<id>.reply-*.json` promoted to a new request | the `resume` op - one call, no file, no `createdBy:"runner"` request to write. Carries `images` (a late message's own, same shape a reply file's `images` array used) when the message had any - `runnerApi.mjs`'s own header says why the OP does not declare the field yet on its side |
|
|
127
129
|
| the `startSession`/`endSession` ops files, and the wait for their receipt | nothing - `claim` moving a row to `status:'running'` IS the start; there is no more window to guard |
|
|
128
|
-
| a chat-turn's request FILE, `<id>.stop`, its per-room lock (`activeChatTurnForRoom`, disk-scanned) | the same row contract as an ordinary session, plus `activeChatTurnForRoomRows` (`
|
|
130
|
+
| a chat-turn's request FILE, `<id>.stop`, its per-room lock (`activeChatTurnForRoom`, disk-scanned) | the same row contract as an ordinary session, plus `activeChatTurnForRoomRows` (`runnerGates.mjs`) in place of the per-idea lock - a chat turn has no idea behind it, so its lock is per `roomId` instead |
|
|
129
131
|
|
|
130
132
|
**Admission, leases and completion recovery (2026-09-26).** Admission refuses
|
|
131
133
|
unavailable concurrency or spending reads. Each claim carries an instance UUID
|
|
@@ -136,7 +138,7 @@ result is still unwritten. The one exception is the restart pass (see "The
|
|
|
136
138
|
conversation on an idea"): it continues a session a person asked for, in its
|
|
137
139
|
own worktree, once.
|
|
138
140
|
|
|
139
|
-
Terminal patches are saved under `
|
|
141
|
+
Terminal patches are saved under `VIEWABLE_HOME/run-completions` before delivery.
|
|
140
142
|
The runner retries exact receipts after restart and blocks new admission while
|
|
141
143
|
any receipt remains undelivered. A failed disk write retains the patch in memory
|
|
142
144
|
and attempts delivery; simultaneous disk/network failure cannot survive process
|
|
@@ -668,7 +670,10 @@ on, and a runner that reports no platform means the POSIX row.
|
|
|
668
670
|
|
|
669
671
|
**The record.** The SESSION writes `<worktree>/.glytch-server.json`,
|
|
670
672
|
`{pid, port, cmd, startedAt}`, in the root of its working directory: the only
|
|
671
|
-
thing that knows what it started.
|
|
673
|
+
thing that knows what it started. App instructions keep this legacy name for
|
|
674
|
+
older installed runners, whose version the app cannot identify. Updated runners
|
|
675
|
+
read either server-record name and write `.viewable-server.json` on relaunch.
|
|
676
|
+
Keep excludes both filenames from Git. When the child ends, the runner copies that
|
|
672
677
|
record plus `worktreePath` onto the run row's own `server` column
|
|
673
678
|
(`bridge/lib/runnerCompletion.mjs`), so it outlives a tree that is merged,
|
|
674
679
|
deleted or cleaned. Nothing is written beside the request; the row is the
|
|
@@ -747,7 +752,7 @@ sequences.
|
|
|
747
752
|
is the end-to-end on a real machine and nothing here has met one yet.*
|
|
748
753
|
|
|
749
754
|
**What is Windows and what is not.** Ruling 6C: native Windows and WSL both
|
|
750
|
-
count, and `
|
|
755
|
+
count, and `viewable doctor` names which one it is running in. WSL is Linux for
|
|
751
756
|
everything in this file - it has `setsid`, it has real npm shims, it gets the
|
|
752
757
|
POSIX spelling of every command below - so the runner reports it as its own
|
|
753
758
|
name, `wsl`, rather than as either `linux` or `win32`
|
|
@@ -766,7 +771,7 @@ a browser that need not be on the machine the session runs on.
|
|
|
766
771
|
Windows writes `{"command":"cmd","args":["/c","glytch","mcp"]}`, and every
|
|
767
772
|
other platform keeps `{"command":"glytch","args":["mcp"]}`. npm installs the
|
|
768
773
|
bin as `glytch.cmd` there, and an MCP client spawning `glytch` with no shell
|
|
769
|
-
hits the refusal Node has enforced since 18.20.2 / 20.12.2. `bridge/lib/mcpjson.mjs` branches on `process.platform`, because `
|
|
774
|
+
hits the refusal Node has enforced since 18.20.2 / 20.12.2. `bridge/lib/mcpjson.mjs` branches on `process.platform`, because `viewable init`
|
|
770
775
|
IS the machine, and `bridge/test/fixtures/mcp-json-cases.json` carries the
|
|
771
776
|
Windows cases. (The app's second writer went with the old Help, #494.) **A file
|
|
772
777
|
that already carries EITHER shape is left exactly as it is**, which is the same
|
|
@@ -781,7 +786,7 @@ resolve DNS). `killTree` (`bridge/lib/kill.mjs`) is `taskkill /pid <pid> /t`
|
|
|
781
786
|
then `/t /f`, behind the same verification guard. See the two sections above.
|
|
782
787
|
|
|
783
788
|
**Git for Windows is a warning, not a refusal** (ruling 8B). Without it there
|
|
784
|
-
is no worktree isolation and no Bash tool, so `
|
|
789
|
+
is no worktree isolation and no Bash tool, so `viewable init` and `viewable doctor`
|
|
785
790
|
say so in a row that is a WARNING - and a session then runs unisolated in the
|
|
786
791
|
linked folder, which is what `makeWorktreeImpl` already does anywhere git is
|
|
787
792
|
missing. Option A, a FAIL row and `exit 1`, was rejected: an unisolated session
|
|
@@ -866,11 +871,11 @@ is a caller of them and defines none of it. What they do, as of brief 26:
|
|
|
866
871
|
`startedAt`, `openedBy`, replacing any earlier record that idea carried.
|
|
867
872
|
It lands live, not as a proposal. With no `fromId`, or one that no longer
|
|
868
873
|
names an idea, the op returns **OK with no id** - the run happens and its
|
|
869
|
-
report reaches him through the
|
|
874
|
+
report reaches him through the Board Agent when `report` is called, and
|
|
870
875
|
nothing is drawn. Refusing would mean a stale idea id costs a session,
|
|
871
876
|
which is the worse trade.
|
|
872
877
|
- The `key` is the same key `report()` takes. That is the whole trick: the
|
|
873
|
-
session's report reaches the
|
|
878
|
+
session's report reaches the Board Agent, which places it beside the
|
|
874
879
|
ideas it is about, and its questions land as question notes on the idea
|
|
875
880
|
that asked. Nothing is wired. No nesting logic anywhere in this runner.
|
|
876
881
|
- `endSession` flips `status` to `done`, stamps `endedAt`, and **proposes
|
|
@@ -886,7 +891,7 @@ This is item 2's tail: "as soon as I finish answering questions or commenting,
|
|
|
886
891
|
to be able to send those to agent directly from this board."
|
|
887
892
|
|
|
888
893
|
A runner-spawned child reaches the board through the HOSTED endpoint, under
|
|
889
|
-
its own run key (`X-
|
|
894
|
+
its own run key (`X-Viewable-Session`, `session.key` - the same key `report()`'s
|
|
890
895
|
`PM_SESSION_KEY` already uses). The runner reaches for `collect_session`,
|
|
891
896
|
exactly the tool a session would call by hand - `bridge/lib/rowsAnswers.mjs`
|
|
892
897
|
is the whole of it. Only a runner-spawned session ever has an idea behind it
|
|
@@ -894,7 +899,7 @@ at all - a CLI request or a conversational session has nothing to collect, and
|
|
|
894
899
|
`collect_session` says so plainly rather than erroring.
|
|
895
900
|
|
|
896
901
|
- **While the child runs**, the runner polls `collect_session` through
|
|
897
|
-
`hosted.callTool`, passing the child's OWN run key as `X-
|
|
902
|
+
`hosted.callTool`, passing the child's OWN run key as `X-Viewable-Session`
|
|
898
903
|
and a `since` watermark it advances from each reply's `next_since`. A
|
|
899
904
|
matching reply hint on the runner topic wakes collection immediately. While
|
|
900
905
|
joined, a one-minute safety read catches missed hints; without push,
|
|
@@ -912,39 +917,68 @@ at all - a CLI request or a conversational session has nothing to collect, and
|
|
|
912
917
|
row becomes a stdin message through the exact door a typed reply already
|
|
913
918
|
uses (`sendToChild` in `child.mjs`'s `runStreamingChild`) - a message as
|
|
914
919
|
`[message from <from>] <text>`, matching a reply file's own attribution.
|
|
915
|
-
Wired only when the run has a bearer to send at all (`
|
|
916
|
-
`
|
|
920
|
+
Wired only when the run has a bearer to send at all (`viewable login` or
|
|
921
|
+
`VIEWABLE_BOARD_TOKEN`); with neither, there is nothing on the hosted
|
|
917
922
|
endpoint for the child to have asked in the first place.
|
|
918
|
-
- **After the child exits**,
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
`
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
- **
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
923
|
+
- **After the child exits**, `promoteLateRows` sends the last delivery
|
|
924
|
+
acknowledgements. Messages stay undelivered until the finished run's
|
|
925
|
+
continuation is allowed or declined. The heartbeat's `resumeLateMessages`
|
|
926
|
+
asks the existing `runs` maintenance operation for app runs that ended
|
|
927
|
+
`done`, `error` or `stopped` (the statuses `resume` accepts) with
|
|
928
|
+
undelivered session messages. Active work on the same idea or chat room
|
|
929
|
+
takes priority. The server finds them from the sessions that hold an
|
|
930
|
+
uncollected message, not by reading every run of the folder. Reply events
|
|
931
|
+
for a run this process is not running, and reconnects, wake collection
|
|
932
|
+
at once; otherwise it checks once a minute while a message waits and once
|
|
933
|
+
every five minutes while none does (#5106).
|
|
934
|
+
- **Ask before continuing.** A late review decision (or another session
|
|
935
|
+
message) files the existing permission question on the idea: Allow,
|
|
936
|
+
Not this, Always allow in <folder>. No spend dialog or second confirmation.
|
|
937
|
+
The normal question UI records the answer; only the runner consumes a
|
|
938
|
+
permission answer, even after the original session finished. Chat turns
|
|
939
|
+
use the same board ask without a source idea; their continuation stays a
|
|
940
|
+
chat turn in the original room. (#5103) The app parks a row on that new
|
|
941
|
+
chat turn (`request.continues` names the turn it carries on), so its
|
|
942
|
+
reply shows in the chat or DM like any other; a carried-on turn that
|
|
943
|
+
ended over an hour before the app saw it stays in its log (#5106).
|
|
944
|
+
- **One question per message.** The ask carries the promotion id as
|
|
945
|
+
`ask_key`; `ask_user` returns the question already filed under that key
|
|
946
|
+
in that session, so an ask whose reply was lost, or whose saved receipt
|
|
947
|
+
failed to write, never files a second question. An Always allow given on
|
|
948
|
+
another ask releases a still-open one on the next beat; an answer given on
|
|
949
|
+
the ask itself wins (#5106).
|
|
950
|
+
- **Always allow** uses `permissionAsk.mjs`'s folder memory, with a separate
|
|
951
|
+
continuation key scoped to the account and project. It does not grant any
|
|
952
|
+
tool permission. Pending question ids and decisions survive watcher
|
|
953
|
+
restarts in `VIEWABLE_HOME/resume-asks`; unreadable receipts fail closed.
|
|
954
|
+
A declined or dismissed ask marks its message as not delivered (the run's
|
|
955
|
+
`sidecar.undelivered`, which the app shows with Try again) and then
|
|
956
|
+
acknowledges it without starting work.
|
|
957
|
+
- **Allow** uses `runnerApi.resume`, preserving the session, worktree and
|
|
958
|
+
message images. A message-id-derived `lateRowRequestId` travels as
|
|
959
|
+
`promotionId`; a retry returns the same child, including after an insert
|
|
960
|
+
acknowledgement was lost. Only then is the message acknowledged. An ask or
|
|
961
|
+
resume that could not reach the endpoint, or a resume refused while other
|
|
962
|
+
work on the idea runs, leaves it waiting. A failure on the server's side
|
|
963
|
+
(a crash, or a board write that lost a race) comes back marked as a fault,
|
|
964
|
+
not a refusal, so it waits too instead of declining the message. A stopped
|
|
965
|
+
run whose child was already filed returns that child (#5106).
|
|
966
|
+
- **Never left unread (#5101).** A message that cannot be continued is
|
|
967
|
+
declined the same visible way, with no question: a run whose Stop was asked
|
|
968
|
+
for, an unapproved run, a run with no conversation to resume, an ask the
|
|
969
|
+
endpoint refused, or a resume the server refused. The mark is written before
|
|
970
|
+
the acknowledgement, so a failed mark leaves the message for the next beat. Older messages without ids use their
|
|
971
|
+
content hash. The runner still requires `PM_SPAWN_RUNNER=on`, approval,
|
|
972
|
+
available concurrency and its normal wall clock. Tests use fake agents.
|
|
973
|
+
|
|
974
|
+
A session collects with `collect_session`, passing its own `since` watermark.
|
|
975
|
+
Live delivery remains unchanged. Finished app sessions continue only after
|
|
976
|
+
Allow or a previously saved Always allow choice; external sessions without
|
|
977
|
+
an app run are not started by this pass. A run the person stopped stays
|
|
978
|
+
stopped. The heartbeat's own calls under a finished run's key do not refresh
|
|
979
|
+
that session's `last_seen_at` (`rowStore.touchSession`), so a finished run
|
|
980
|
+
never looks alive to `list_sessions` or `send_message`.
|
|
981
|
+
Installed bridges must be released through the existing release workflow.
|
|
948
982
|
|
|
949
983
|
**Images travel the same doors.** A message's `images` travel into `resume`
|
|
950
984
|
alongside `message` when the poll has any (`rowsAnswers.mjs`'s
|
|
@@ -1124,11 +1158,11 @@ on its own.
|
|
|
1124
1158
|
## Signal files - stop, merge, delete, relaunch
|
|
1125
1159
|
|
|
1126
1160
|
`stop`, `merge`, `delete` and `relaunch` are all rows - `heartbeat`'s `stops`
|
|
1127
|
-
array and its `ops` + `opTake`/`opResult` (`bridge/lib/
|
|
1161
|
+
array and its `ops` + `opTake`/`opResult` (`bridge/lib/runnerOps.mjs`'s
|
|
1128
1162
|
`serviceRowOps`) - for every request kind, chat turns included. `relaunch`'s
|
|
1129
1163
|
record is the claimed run row's own `server` column (mirrored there by
|
|
1130
1164
|
`runnerCompletion.mjs` when the child exits), falling back to the op's
|
|
1131
|
-
`worktreePath` hint plus the worktree's own live `.
|
|
1165
|
+
`worktreePath` hint plus the worktree's own live `.viewable-server.json` when
|
|
1132
1166
|
the row has none yet. The pure decision core, `relaunchServer`
|
|
1133
1167
|
(`bridge/lib/devserver.mjs`), decides exactly what is below - only where the
|
|
1134
1168
|
record comes from and where the answer goes is rows rather than files.
|
|
@@ -1158,7 +1192,7 @@ for what it refuses and why.
|
|
|
1158
1192
|
|
|
1159
1193
|
**Keep safety (#483).** `mergeWorktree` in `bridge/lib/worktree.mjs` first
|
|
1160
1194
|
commits what the agent left uncommitted in the copy, as the person or as
|
|
1161
|
-
|
|
1195
|
+
Viewable when git has no name, never its `node_modules` link (#482), then tries
|
|
1162
1196
|
the merge with `git merge-tree --write-tree`, which touches no file. A clash,
|
|
1163
1197
|
including one with the person's uncommitted changes or a file of theirs git
|
|
1164
1198
|
does not track or ignores where the merge adds, renames or copies a file
|
|
@@ -1176,7 +1210,7 @@ put. Then the copy and its branch are deleted. Nothing is pushed.
|
|
|
1176
1210
|
Added 2026-08-30. The ruling on `q-mtf2x89x`: "Only one session per idea,
|
|
1177
1211
|
unless the old session lost its worktree."
|
|
1178
1212
|
|
|
1179
|
-
`activeWorktreeForPromptRows` in `bridge/lib/
|
|
1213
|
+
`activeWorktreeForPromptRows` in `bridge/lib/runnerGates.mjs` reads this project's
|
|
1180
1214
|
run rows through `runnerApi.runs`, then checks whether a worktree for the
|
|
1181
1215
|
given idea still exists on disk AND its branch has not been merged into
|
|
1182
1216
|
main. Both halves matter: without the merged check, a finished session
|
|
@@ -1213,7 +1247,7 @@ talked to it.
|
|
|
1213
1247
|
earlier) shipped the ordinary session path over rows and refused a
|
|
1214
1248
|
chat-turn row outright, naming the per-room lock and the chat worktree mint
|
|
1215
1249
|
as file-shaped work not migrated in that pass. Both are rows now: the
|
|
1216
|
-
per-room lock is `activeChatTurnForRoomRows` (`bridge/lib/
|
|
1250
|
+
per-room lock is `activeChatTurnForRoomRows` (`bridge/lib/runnerGates.mjs`,
|
|
1217
1251
|
`runnerApi.runs({..., status:'running'})` filtered to `isChatTurn(request)`
|
|
1218
1252
|
and a matching `roomId`) in place of a disk scan for an unreceipted claim;
|
|
1219
1253
|
the chat worktree mint (`makeChatWorktree`/`resolveChatCwd`,
|
|
@@ -1221,7 +1255,7 @@ the chat worktree mint (`makeChatWorktree`/`resolveChatCwd`,
|
|
|
1221
1255
|
called from the file-based runner, and is called from the rows one now the
|
|
1222
1256
|
same way. Every difference below is unchanged in what it means; only the
|
|
1223
1257
|
DOOR each one reaches through moved (a run row and `runnerApi` calls, not a
|
|
1224
|
-
signal file) - marked `chat turn:` at each site in `
|
|
1258
|
+
signal file) - marked `chat turn:` at each site in `runnerGates.mjs` and `runnerExecute.mjs` exactly as
|
|
1225
1259
|
they are marked here.
|
|
1226
1260
|
|
|
1227
1261
|
**The request is the same shape, riding a row's `request` column, with one
|
|
@@ -1250,7 +1284,7 @@ new field.**
|
|
|
1250
1284
|
| `roomId` | for a chat turn | Which DM this turn belongs to. It is what the per-room lock locks. |
|
|
1251
1285
|
| `cwd` | for a chat turn | The directory the conversation lives in. **RELATIVE to the folder root when the app writes it** (a browser directory handle has a name, not a path), absolute when the CLI does, and absolute again from the second turn on because the app hands the runner's own `worktreePath` back. All three are resolved by `resolveChatCwd` (`lib/worktree.mjs`); anything that escapes the watched folder - `..`, an absolute path outside it - is refused. Claude Code keys conversations to a working directory, so the directory is which conversation this is. |
|
|
1252
1286
|
| `mintIfMissing` | no | `true` asks the runner to CUT the chat worktree if `cwd` is not there. The app cannot make a worktree, and ruling 1's directory has to exist before the first message can run in it. Absent (or `false`) and a missing `cwd` is refused, unchanged. Anything but a boolean is refused rather than read as true. |
|
|
1253
|
-
| `boardFolder` | no | One folder name (2026-09-30). The turn runs in that subfolder of the chat worktree, made if missing, so each board has its own place in the
|
|
1287
|
+
| `boardFolder` | no | One folder name (2026-09-30). The turn runs in that subfolder of the chat worktree, made if missing, so each board has its own place in the Viewable folder. The app sends it when the chat's folder is the Viewable folder (`~/Viewable`, made and registered by the runner when it starts watching; `GLYTCH_FOLDER=off` turns it off, a scratch `GLYTCH_HOME` makes none, and a `GLYTCH_FOLDER` path is for tests: the app knows the Viewable folder only in a home folder). Refused: separators, a leading dot, a trailing dot or space, Windows device names. The sidecar's `worktreePath` is then the subfolder, and a later turn whose `cwd` is that subfolder stays in it whatever `boardFolder` says, so a renamed board's chat keeps its files. |
|
|
1254
1288
|
| `agent` | no | Must name a coding CLI this bridge has (`isCodingCli`, `lib/agents.mjs`). A SESSION falls back to the default on an unknown name; a chat turn refuses, because answering as `claude` would tell him he is talking to the agent he named when he is not. |
|
|
1255
1289
|
| `resumeSessionId` | no | Absent on the first message of a conversation, present on every one after it. |
|
|
1256
1290
|
| `worktreePath` | no | What the sidecar recorded, handed back. For a chat turn it equals `cwd`. |
|
|
@@ -1276,7 +1310,7 @@ new field.**
|
|
|
1276
1310
|
chat turn does not have. What a chat turn is told is the app's to compose:
|
|
1277
1311
|
persona, the room's context blocks, his message.
|
|
1278
1312
|
4. **A per-ROOM lock instead of the per-prompt one.** OVER ROWS (brief 30
|
|
1279
|
-
Move 2b): `activeChatTurnForRoomRows` (`lib/
|
|
1313
|
+
Move 2b): `activeChatTurnForRoomRows` (`lib/runnerGates.mjs`) asks
|
|
1280
1314
|
`runnerApi.runs({..., status:'running'})` and filters to
|
|
1281
1315
|
`isChatTurn(request)` with a matching `roomId`, so two runners sharing a
|
|
1282
1316
|
project share one answer the same way the file version's disk scan did.
|
|
@@ -1550,13 +1584,21 @@ pictures with `images` (up to 6, data URLs) and to choose between looks with
|
|
|
1550
1584
|
`ask_user` and `images`. It also tells the session not to file a closing reply
|
|
1551
1585
|
of its own, because the runner files one.
|
|
1552
1586
|
|
|
1587
|
+
The hosted board enforces it (#4153): a run's second reply in its idea's
|
|
1588
|
+
conversation, with no person's note after its first, is refused and names
|
|
1589
|
+
`editComment`, which changes that one reply in place. The closing reply is
|
|
1590
|
+
told apart by its `propose` label, `Session <key> outcome`
|
|
1591
|
+
(`commentOnAnchor`), so renaming that label breaks the rule. It is never
|
|
1592
|
+
refused; it folds into the run's earlier reply. Questions and ideas are not
|
|
1593
|
+
limited.
|
|
1594
|
+
|
|
1553
1595
|
**One reply at the end, for a session that finished.** When a session
|
|
1554
1596
|
finishes (the verdict is `finished`, or a Codex run exits 0),
|
|
1555
1597
|
`reportOutcomeOnBoard` posts exactly one `addComment` on the idea, with
|
|
1556
1598
|
`agentId`, `runId` (the session's own key), `summary` (first sentence of the
|
|
1557
1599
|
closing text, at most 200 characters), `images` (at most 6), and
|
|
1558
1600
|
`branch`, `files`, `preview`, `report` for the links. Its text is the closing
|
|
1559
|
-
text of the session (the
|
|
1601
|
+
text of the session (preserved in full; the hosted writer splits overflow into linked ideas), then a single figures
|
|
1560
1602
|
line led by "Finished": "Finished; 12 turns, 4m, branch x, 3 files". It
|
|
1561
1603
|
never carries a cost (#281). A stop, an error, a stall, a timeout and a binary that would not start
|
|
1562
1604
|
write NO comment from the bridge: the app writes those endings itself from the
|
|
@@ -1686,6 +1728,7 @@ unscoped, so the session may write any path the process can reach.
|
|
|
1686
1728
|
| --- | --- | --- |
|
|
1687
1729
|
| tools | anything not on `CLAUDE_TOOLS` | everything on it |
|
|
1688
1730
|
| interactive prompts | `EnterPlanMode`, `AskUserQuestion` | - |
|
|
1731
|
+
| clicking or typing in other apps (#4204) | Claude Code: `osascript`, `screencapture`, `cliclick` as a command's first word (`CLAUDE_CLICK_AND_SCREEN_TOOLS`); then on every Claude ask and Codex escalation, any command with one of them as a word, whatever "Allow for this run" or a saved rule says (`drivesAnotherApp`, permissionAsk.mjs); both agents are told in words | the same program started from `node -e` or a script, and a Codex command that runs without asking inside its sandbox |
|
|
1689
1732
|
| arbitrary code | - | `node -e`, `npx <anything>` |
|
|
1690
1733
|
| writes | the checkout you are looking at (the **worktree** does this, not the list) | any other path the process can reach |
|
|
1691
1734
|
| money | wall clock, no retry | - |
|
|
@@ -1720,18 +1763,30 @@ silently. `lib/permissionAsk.mjs` owns it; `child.mjs` answers Claude's
|
|
|
1720
1763
|
`control_request` and `codex.mjs` answers Codex's approval requests with it.
|
|
1721
1764
|
|
|
1722
1765
|
- One `ask_user` question on the run's idea: "Can I run pip install requests
|
|
1723
|
-
in my-app?", with Allow (recommended), Not this and Always allow
|
|
1724
|
-
|
|
1766
|
+
in my-app?", with Allow (recommended), Not this and Always allow, and a line
|
|
1767
|
+
on what it is for. Always covers a family only for a short safe list of
|
|
1768
|
+
read-only or test commands (`ls`, `cat`, `pwd`, `head`, `tail`, `wc`,
|
|
1769
|
+
`git status`, `git diff`, `git log`, `git show`, `npm test`,
|
|
1770
|
+
`npx vitest run`), and its button names the family ("Always allow git status
|
|
1771
|
+
in my-app"). Every other command, and a safe-list one with anything the list
|
|
1772
|
+
cannot vouch for (a redirect, a chain, a substitution, a quote or backslash, a
|
|
1773
|
+
glob, braces, a tilde, a hidden character, a NAME=value prefix, `=rm`, a
|
|
1774
|
+
flag on a test command, git's `--output`, `git diff --no-index`, and for a read
|
|
1775
|
+
command a word that starts with `/`, has a `..` step or leads out of the folder through a link, or a Codex working folder outside the folder, #3737 #3759), offers "Always allow this command
|
|
1776
|
+
in <folder>" and saves exactly that command line, byte for byte (#3726).
|
|
1725
1777
|
- The asker claims its question on the answer poll and reads the answer with
|
|
1726
1778
|
`check_answer` itself: an answer resolves the pending request, it is never
|
|
1727
1779
|
typed into the conversation.
|
|
1728
1780
|
- No answer means keep waiting. Stop and the wall clock still end the run;
|
|
1729
1781
|
the stall watchdog does not count time spent waiting for a person.
|
|
1730
1782
|
- Always allow is remembered per folder in
|
|
1731
|
-
`<glytch home>/permissions/<sha256 of the folder path>.json`: a
|
|
1732
|
-
command by its
|
|
1733
|
-
|
|
1734
|
-
|
|
1783
|
+
`<glytch home>/permissions/<sha256 of the folder path>.json`: a safe-list
|
|
1784
|
+
command by its family (`Bash(git status:*)`), any other shell command by the
|
|
1785
|
+
sha256 of the whole line as typed (`Bash(exact:...)`), anything else by its
|
|
1786
|
+
tool name. A remembered rule is answered without asking; a pipe between
|
|
1787
|
+
safe-list commands is covered when every part's family is saved. Word rules
|
|
1788
|
+
saved before #3726 for `ls`, `cat`, `pwd`, `head`, `tail` and `wc` still match
|
|
1789
|
+
their family; any other (`Bash(npm:*)`) matches nothing any more.
|
|
1735
1790
|
- A plan draft is read-only and is never given the asker.
|
|
1736
1791
|
|
|
1737
1792
|
## What a spawned session inherits
|
|
@@ -1845,7 +1900,8 @@ completes, both commits land in main).
|
|
|
1845
1900
|
## The ACP engine
|
|
1846
1901
|
|
|
1847
1902
|
Added 2026-09-02 (brief 15 decision 8, on the amendment written by the spike
|
|
1848
|
-
in `spikes/acp-2026-09-02
|
|
1903
|
+
in `spikes/acp-2026-09-02/`, removed 2026-11-02 and kept in Git history at
|
|
1904
|
+
`e39d057c5`). Checked against the code in this commit.
|
|
1849
1905
|
|
|
1850
1906
|
`acp-claude` is a third engine in `bridge/lib/agents.mjs`, labelled "Claude
|
|
1851
1907
|
Code via ACP". It runs `@agentclientprotocol/claude-agent-acp` 0.73.0 over
|
|
@@ -1896,14 +1952,14 @@ frame draws it.
|
|
|
1896
1952
|
|
|
1897
1953
|
- **Board tools.** Every engine reaches the board over the HOSTED endpoint
|
|
1898
1954
|
(`supabase/functions/board-mcp`), authenticated by `lib/auth.mjs`'s
|
|
1899
|
-
`hostedToken()`/`hostedConfig()` (a `
|
|
1900
|
-
`
|
|
1955
|
+
`hostedToken()`/`hostedConfig()` (a `viewable login` credential, or
|
|
1956
|
+
`VIEWABLE_BOARD_TOKEN` for a script), resolved ONCE per request in
|
|
1901
1957
|
`runRequest` so a token refresh mid-request cannot leave one engine's
|
|
1902
1958
|
wiring disagreeing with another's. `acpServersFor` still builds what
|
|
1903
1959
|
`session/new`'s `mcpServers` carries, inline rather than through a file -
|
|
1904
1960
|
that half is unchanged - but the entry is now `{type: "http", name:
|
|
1905
1961
|
"glytch", url, headers: [{name: "Authorization", value: "Bearer
|
|
1906
|
-
<token>"}, {name: "X-
|
|
1962
|
+
<token>"}, {name: "X-Viewable-Session", value: "<session.key>"}]}` (RENAMED
|
|
1907
1963
|
2026-09-12, brief 31, Move 3b: the key was `"board"` until then), the
|
|
1908
1964
|
`McpServer::Http` shape checked against `@agentclientprotocol/sdk@1.4.0`'s
|
|
1909
1965
|
own schema. `claude` gets the same URL and headers through
|
|
@@ -1913,7 +1969,7 @@ frame draws it.
|
|
|
1913
1969
|
committed `.mcp.json` naming a different server is ignored outright, not
|
|
1914
1970
|
merely superseded. `codex` gets a `-c mcp_servers.board={url
|
|
1915
1971
|
= ..., bearer_token_env_var = "PM_BOARD_TOKEN", http_headers =
|
|
1916
|
-
{"X-
|
|
1972
|
+
{"X-Viewable-Session" = ...}}` override (`codexBoardArgs`, `lib/codex.mjs`) -
|
|
1917
1973
|
the bearer is a NAME, never a literal, on that one engine's command line,
|
|
1918
1974
|
because `codex mcp add --help` and the installed binary's own strings both
|
|
1919
1975
|
say a literal `bearer_token` is refused. `opencode` gets
|
|
@@ -1924,12 +1980,12 @@ frame draws it.
|
|
|
1924
1980
|
kept worktree lives. The bearer token's own lifetime is the one thing that
|
|
1925
1981
|
needed a NEW decision rather than a rewiring: see `ACCESS_TTL_MS` /
|
|
1926
1982
|
`RUNNER_ACCESS_TTL_MS` in `supabase/functions/board-oauth/oauth.mjs`.
|
|
1927
|
-
The **X-
|
|
1983
|
+
The **X-Viewable-Session** header is new on the endpoint side too
|
|
1928
1984
|
(`supabase/functions/board-mcp/sessionKeyHeader.mjs`): it lets many
|
|
1929
1985
|
children spawned under ONE hosted OAuth token each keep their own
|
|
1930
1986
|
identity for `list_sessions`/`send_message`, and land their `report()`
|
|
1931
1987
|
under the exact run key their receipt already carries.
|
|
1932
|
-
**X-
|
|
1988
|
+
**X-Viewable-Board** rides beside it (2026-09-21, board reporting fix): the
|
|
1933
1989
|
claimed run row always carries `board_id` (`src/runs/api.ts`'s
|
|
1934
1990
|
`RunRequestRow`), `runRequest` reads it off `run.board_id` and passes it
|
|
1935
1991
|
through every engine's board wiring the same way `sessionKey` travels -
|
|
@@ -1940,21 +1996,22 @@ frame draws it.
|
|
|
1940
1996
|
until the session's first `get_board` - so a session whose first call is
|
|
1941
1997
|
`report` used to land on the account's most recently touched board, not
|
|
1942
1998
|
the one the prompt actually lived on. `index.ts` reads the header the same
|
|
1943
|
-
way it reads `X-
|
|
1999
|
+
way it reads `X-Viewable-Session` (`boardHeader.mjs`) and seeds
|
|
1944
2000
|
`lastBoardId` with it before any tool runs. `run.board_id` is the board's
|
|
1945
2001
|
LOCAL id ("default", "bd-mua2gtcm"), not the `<account uuid>:<local id>`
|
|
1946
2002
|
row id every board is actually keyed by, so the header value may be that
|
|
1947
2003
|
local id alone - `tools.mjs`'s `readBoardById` prefixes it with the
|
|
1948
2004
|
token's own account before matching a row, falling back to the bare value
|
|
1949
2005
|
when that prefixed id is not this account's.
|
|
1950
|
-
- **Permissions.** `
|
|
1951
|
-
`
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
2006
|
+
- **Permissions.** `CLAUDE_TOOLS` goes to the adapter's Claude Code as
|
|
2007
|
+
`allowedTools` (`_meta.claudeCode.options` at `session/new` and
|
|
2008
|
+
`session/load`), the same list `--allowedTools` gets, matched by Claude Code
|
|
2009
|
+
itself. A call off the list arrives as `session/request_permission` and goes
|
|
2010
|
+
to the runner's shared asker (`permissionAsk.mjs`), the one Claude and
|
|
2011
|
+
Codex use: it refuses a command that drives another app and otherwise asks
|
|
2012
|
+
the person in the idea (#4615). With no board to ask on the answer is
|
|
2013
|
+
`reject_once`. **Never `allow_always`**: "always" lives in the asker, per
|
|
2014
|
+
folder. Each decision is written into the log as a
|
|
1958
2015
|
`{"type":"system","subtype":"permission"}` line.
|
|
1959
2016
|
- **`CLAUDE_DISALLOWED_TOOLS` has no equivalent and needs none.** Plan mode is
|
|
1960
2017
|
a session *mode* on this engine, and `acp.mjs` selects `acceptEdits` and
|
package/glytch.mjs
CHANGED
|
@@ -49,7 +49,7 @@ import { watchRegistered } from "./lib/multiwatch.mjs";
|
|
|
49
49
|
import { readRegistry, registryPath, removeFolder, touchRegistry } from "./lib/registry.mjs";
|
|
50
50
|
import { settingsFromEnv, newRunnerId, registerAndFindProject } from "./lib/runner.mjs";
|
|
51
51
|
import { syncFolder, syncRegistry } from "./lib/sync.mjs";
|
|
52
|
-
import { waitForRunnerHealth, writeRunnerHealth } from "./lib/runner-health.mjs";
|
|
52
|
+
import { SETUP_HEALTH_SLOW_MS, SETUP_HEALTH_WAIT_MS, hasFreshBeat, waitForRunnerHealth, writeRunnerHealth } from "./lib/runner-health.mjs";
|
|
53
53
|
import { initServiceScript, packageVersion, runUpdate } from "./lib/update.mjs";
|
|
54
54
|
import { initOptions, chooseAgents, readAgentSelection, saveAgentSelection } from "./lib/agent-selection.mjs";
|
|
55
55
|
import { projectMcpServerKey } from "./lib/project-mcp.mjs";
|
|
@@ -186,6 +186,8 @@ async function init() {
|
|
|
186
186
|
const root = resolve(process.cwd());
|
|
187
187
|
const checkStartedAt = Date.now();
|
|
188
188
|
const disabled = noDaemonInstall(process.env);
|
|
189
|
+
// The copied prompt's attempt id. The app's card waits for it (#4206).
|
|
190
|
+
const setupId = process.env.VIEWABLE_SETUP_ID ?? process.env.GLYTCH_SETUP_ID ?? "manual";
|
|
189
191
|
// The service runs the script verification proved, not this process's own
|
|
190
192
|
// file, which may be a same-version copy about to be deleted (#600). No log:
|
|
191
193
|
// the PATH diagnostic is noise as init's first line.
|
|
@@ -215,8 +217,8 @@ async function init() {
|
|
|
215
217
|
say(`Board connections: ${selected.length ? selected.join(", ") : "none"}`);
|
|
216
218
|
if (selected.includes("claude") && agents.claude?.found && agents.claude.loggedIn === false) {
|
|
217
219
|
say("");
|
|
218
|
-
say("Claude Code is installed but not
|
|
219
|
-
say("or a session will fail the moment it spawns.");
|
|
220
|
+
say("Claude Code is installed but not signed in. Run `claude auth login` yourself,");
|
|
221
|
+
say("which opens a browser sign-in page, or a session will fail the moment it spawns.");
|
|
220
222
|
}
|
|
221
223
|
|
|
222
224
|
say("");
|
|
@@ -242,10 +244,17 @@ async function init() {
|
|
|
242
244
|
const token = await personalBoardToken({ env: process.env });
|
|
243
245
|
// Restore deliberately before publishing a new local registry entry. A
|
|
244
246
|
// watcher must not see the folder while the server still wants it removed.
|
|
247
|
+
// The attempt id rides this register too, so the card knows this computer
|
|
248
|
+
// answered before the last check ends (#4206).
|
|
249
|
+
const registerSetup = (extra = {}) => registerAndFindProject(root, {
|
|
250
|
+
...settingsFromEnv(), runnerId: newRunnerId(), markExtra: () => ({ version: packageVersion(), setupId, ...extra }),
|
|
251
|
+
}, { readd: true });
|
|
252
|
+
let setupRegistered = false;
|
|
253
|
+
let setupRunnerId = null;
|
|
245
254
|
if (machine?.status === "ok" || token) {
|
|
246
|
-
const registered = await
|
|
247
|
-
|
|
248
|
-
|
|
255
|
+
const registered = await registerSetup();
|
|
256
|
+
setupRegistered = registered.ok;
|
|
257
|
+
setupRunnerId = registered.runnerId ?? null;
|
|
249
258
|
if (!registered.ok) {
|
|
250
259
|
say(registered.error);
|
|
251
260
|
// Keep ordinary setup usable offline, as before. Only a known removal
|
|
@@ -315,16 +324,38 @@ async function init() {
|
|
|
315
324
|
// a watching runner, and neither is a computer the board cannot reach.
|
|
316
325
|
let healthy = false;
|
|
317
326
|
if (allOk && signedIn && !disabled) {
|
|
327
|
+
// THE PROOF BEFORE THE BEAT (#4206). The service puts this file's attempt
|
|
328
|
+
// id on its heartbeat, and the card turns Online on that. Written after
|
|
329
|
+
// the wait, it missed the beat init asked for and waited for the next
|
|
330
|
+
// one, 5 minutes away while push is joined. Written first, the beat that
|
|
331
|
+
// ends this wait carries it, and a computer slower than this wait still
|
|
332
|
+
// turns Online on its own first beat.
|
|
333
|
+
await writeRunnerHealth({ version: packageVersion(), setupId }, process.env, "cli");
|
|
318
334
|
// A daemon already watching this folder beats on a registry rewrite.
|
|
319
335
|
await touchRegistry().catch(() => {});
|
|
320
336
|
const result = await waitForRunnerHealth({
|
|
321
337
|
version: packageVersion(), after: checkStartedAt, root, requireStartedAfter: false,
|
|
338
|
+
timeoutMs: SETUP_HEALTH_WAIT_MS, slowMs: SETUP_HEALTH_SLOW_MS,
|
|
339
|
+
onSlow: () => say("Your computer is still starting. Waiting a little longer…"),
|
|
322
340
|
});
|
|
323
341
|
healthy = result.ok;
|
|
324
|
-
if (healthy)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
342
|
+
if (healthy) say(RUNNER_WATCHING_LINE);
|
|
343
|
+
else say(result.error);
|
|
344
|
+
}
|
|
345
|
+
// A SETUP THAT REALLY FAILED SAYS SO ON THE CARD (#4206). The card cannot
|
|
346
|
+
// see this terminal, so after sign-in a failed end registers once more with
|
|
347
|
+
// the failure on it; a later good beat from the service replaces it.
|
|
348
|
+
// A fresh beat can settle a health-wait timeout only after setup checks
|
|
349
|
+
// passed (#5047). A running daemon cannot prove invalid config was fixed.
|
|
350
|
+
// The failure goes out as a plain register for this folder only, never the
|
|
351
|
+
// re-add one, so a folder the person removed in the meantime stays removed
|
|
352
|
+
// and the other folders' rows keep their agents.
|
|
353
|
+
if (setupRegistered && signedIn && !disabled && !(allOk && healthy) &&
|
|
354
|
+
!(allOk && hasFreshBeat({ version: packageVersion(), root, after: checkStartedAt }))) {
|
|
355
|
+
await registerAndFindProject(root, {
|
|
356
|
+
...settingsFromEnv(), runnerId: setupRunnerId ?? newRunnerId(),
|
|
357
|
+
markExtra: () => ({ version: packageVersion(), setupId, setupFailed: true }),
|
|
358
|
+
}, { onlyRoot: true }).catch(() => {});
|
|
328
359
|
}
|
|
329
360
|
// FIX 1B, THE FALLBACK SENTENCE: an agent step 4 could not connect over
|
|
330
361
|
// the hosted endpoint (no terminal, and 1a either did not apply to it or
|