granttap-mcp 0.8.186 → 0.8.188
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/README.md +74 -19
- package/SECURITY.md +8 -1
- package/apps/bridge/src/account-recovery/offer.ts +6 -6
- package/apps/bridge/src/bin/runtime/monitor.ts +21 -3
- package/apps/bridge/src/device-management/index.ts +17 -4
- package/apps/bridge/src/device-management/maintenance.ts +12 -2
- package/apps/bridge/src/engine/README.md +5 -3
- package/apps/bridge/src/engine/distribution/artifacts.ts +2 -2
- package/apps/bridge/src/engine/runtime/launch/index.ts +4 -1
- package/apps/bridge/src/limit-continuation/README.md +2 -1
- package/apps/bridge/src/limit-continuation/index.ts +11 -0
- package/apps/bridge/src/mesh/README.md +5 -0
- package/apps/bridge/src/mesh/catalog/README.md +4 -1
- package/apps/bridge/src/mesh/catalog/binding-state.ts +12 -1
- package/apps/bridge/src/mesh/catalog/index.ts +16 -2
- package/apps/bridge/src/mesh/identity/call-scope.ts +2 -1
- package/apps/bridge/src/mesh/local-remote/README.md +50 -0
- package/apps/bridge/src/mesh/local-remote/folder-meshes.ts +58 -0
- package/apps/bridge/src/mesh/repositories/edit.ts +5 -0
- package/apps/bridge/src/mesh/snapshot/merge.ts +3 -1
- package/apps/bridge/src/mesh/store/base.ts +3 -2
- package/apps/bridge/src/mesh/store/index.ts +3 -1
- package/apps/bridge/src/mesh/store/repositories/index.ts +24 -0
- package/apps/bridge/src/monitor/handlers/user-message.ts +25 -52
- package/apps/bridge/src/monitor/message-delivery/README.md +4 -1
- package/apps/bridge/src/monitor/message-delivery/acceptance.ts +20 -5
- package/apps/bridge/src/monitor/message-delivery/index.ts +3 -1
- package/apps/bridge/src/monitor/message-delivery/late-results.ts +87 -0
- package/apps/bridge/src/monitor/support/runtime.ts +31 -4
- package/apps/bridge/src/paired-phones/README.md +60 -0
- package/apps/bridge/src/paired-phones/admission.ts +53 -0
- package/apps/bridge/src/paired-phones/device-actions.ts +71 -0
- package/apps/bridge/src/paired-phones/index.ts +7 -0
- package/apps/bridge/src/paired-phones/removal.ts +48 -0
- package/apps/bridge/src/paired-phones/roster.ts +82 -0
- package/apps/bridge/src/pairing/controllers.ts +31 -7
- package/apps/bridge/src/pairing/index.ts +14 -9
- package/apps/bridge/src/pairing/presence.ts +24 -0
- package/apps/bridge/src/reply/README.md +4 -0
- package/apps/bridge/src/reply/grok-response/index.ts +5 -0
- package/apps/bridge/src/reply/in-flight.ts +54 -5
- package/apps/bridge/src/reply/index.ts +23 -39
- package/apps/bridge/src/reply/payload/claude-result.ts +33 -0
- package/apps/bridge/src/reply/payload/types.ts +11 -1
- package/apps/bridge/src/reply/process/codex-headless.ts +20 -2
- package/apps/bridge/src/reply/process/index.ts +116 -72
- package/apps/bridge/src/reply/process/provider-headless.ts +3 -1
- package/apps/bridge/src/reply/survival/README.md +73 -0
- package/apps/bridge/src/reply/survival/adoption.ts +115 -0
- package/apps/bridge/src/reply/survival/answers.ts +67 -0
- package/apps/bridge/src/reply/survival/files.ts +78 -0
- package/apps/bridge/src/reply/survival/index.ts +92 -0
- package/apps/bridge/src/reply/survival/records.ts +123 -0
- package/apps/bridge/src/reply/survival/run.ts +89 -0
- package/apps/bridge/src/runtime-updates/README.md +73 -26
- package/apps/bridge/src/runtime-updates/drain/index.ts +64 -5
- package/apps/bridge/src/runtime-updates/drain/state.ts +112 -0
- package/apps/bridge/src/runtime-updates/index.ts +35 -2
- package/apps/bridge/src/runtime-updates/readiness.ts +2 -0
- package/apps/bridge/src/sessions/README.md +4 -1
- package/apps/bridge/src/sessions/cursor/transcripts.ts +2 -1
- package/apps/bridge/src/sessions/support/activity-helpers.ts +3 -1
- package/apps/bridge/src/task-dispatch/README.md +30 -0
- package/apps/bridge/src/task-dispatch/inbox.ts +19 -0
- package/apps/bridge/src/task-dispatch/queue-note.ts +33 -0
- package/apps/bridge/src/task-dispatch/worker/index.ts +13 -4
- package/apps/bridge/src/task-dispatch/worker/monitor.ts +5 -6
- package/apps/bridge/src/task-dispatch/worker/queue-depth.ts +86 -0
- package/apps/bridge/src/task-transfer/index.ts +8 -3
- package/apps/mcp/src/chat-identity/README.md +53 -0
- package/apps/mcp/src/chat-identity/index.ts +110 -0
- package/apps/mcp/src/chat-identity/processes.ts +135 -0
- package/apps/mcp/src/connection-center/README.md +9 -0
- package/apps/mcp/src/connection-center/state.ts +40 -6
- package/apps/mcp/src/connection-center/update-controls.ts +3 -1
- package/apps/mcp/src/http/create-server.ts +2 -0
- package/apps/mcp/src/mcp-tools/README.md +11 -1
- package/apps/mcp/src/mcp-tools/connect/index.ts +32 -9
- package/apps/mcp/src/mcp-tools/connect/relay.ts +1 -1
- package/apps/mcp/src/mcp-tools/interaction/notify.ts +4 -1
- package/apps/mcp/src/mcp-tools/interaction/questions.ts +4 -2
- package/apps/mcp/src/mcp-tools/mesh/current.ts +2 -2
- package/apps/mcp/src/mcp-tools/mesh/resource.ts +4 -1
- package/apps/mcp/src/mcp-tools/mesh/session-env.ts +7 -9
- package/apps/mcp/src/mcp-tools/phones/index.ts +63 -0
- package/apps/mcp/src/mcp-tools/phones/removal.ts +113 -0
- package/apps/mcp/src/oauth/session/connect-snapshot.ts +4 -3
- package/apps/mcp/src/status/chat-status.ts +63 -0
- package/apps/mcp/src/status/pairing-status.ts +61 -31
- package/cursor-plugin/README.md +1 -1
- package/cursor-plugin/mcp.json +1 -1
- package/cursor-plugin/stdio-bootstrap.cjs +1 -1
- package/docs/device-management.md +9 -2
- package/package.json +1 -1
- package/packages/core/relay-client.ts +3 -1
- package/packages/protocol/messages/README.md +4 -0
- package/packages/protocol/messages/device/management.ts +50 -0
- package/packages/protocol/messages/mesh/tasks.ts +5 -0
package/README.md
CHANGED
|
@@ -144,6 +144,36 @@ The Mac app can join the Account Mesh before the helper is present and links it
|
|
|
144
144
|
when the installed helper becomes available. A one-time QR still provides direct
|
|
145
145
|
device pairing without a passkey account.
|
|
146
146
|
|
|
147
|
+
## Phones paired with a computer
|
|
148
|
+
|
|
149
|
+
Every phone or iPad that scanned a QR for a computer keeps a key there until someone removes it, so test and
|
|
150
|
+
debug installs pile up. In the app, **Devices → a computer → Phones** lists each phone with its name or label,
|
|
151
|
+
**This iPhone**, and when it last reached the computer, and removes one (swipe or context menu), several, or
|
|
152
|
+
every phone not seen for 30 days. Removing the phone in use is its own confirmed action, **Unpair this
|
|
153
|
+
phone**, and the last phone always stays. A removed phone stops receiving from the computer at once, in every
|
|
154
|
+
running GrantTap process, without a restart; it needs a new QR to pair again. Removing the first pairing hands
|
|
155
|
+
its place to the phone heard from most recently.
|
|
156
|
+
|
|
157
|
+
A computer accepts its first pairing plus 16 added phones. At the limit a new phone takes the place of the
|
|
158
|
+
added phone idle longest, provided that phone has not reached the computer, and was not added, for 30 days;
|
|
159
|
+
the first pairing, a phone used in the last 30 days and an open QR are never taken. When every place is in
|
|
160
|
+
use the new phone is refused with a pointer to the Phones screen.
|
|
161
|
+
|
|
162
|
+
The phone asks over the encrypted `device.manage` request it already uses for the computer's MCP and agent
|
|
163
|
+
controls, and the answer goes only to the phone that asked:
|
|
164
|
+
|
|
165
|
+
| Request | Fields | Answer |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| `status` | — | `snapshot.phones`: `id` (sha256 of the phone key, 64 hex), `label` (its first 6 hex), `name` when the phone reported one, `thisPhone`, `primary`, `addedAt` and `lastSeenAt` in ms (absent when unknown). Absent from MCP 0.8.187 and older. |
|
|
168
|
+
| `phones-remove` | `computerId`, `phoneIds` (1–32) | Removes those other phones; refused when the list holds the phone asking. |
|
|
169
|
+
| `phones-remove-stale` | `computerId`, `notSeenForDays` (1–3650) | Removes every other phone not seen, and not added, for that many days. |
|
|
170
|
+
| `phones-unpair-self` | `computerId` | Removes the phone asking, answered before its key goes; refused for the only phone. |
|
|
171
|
+
|
|
172
|
+
A removal answers `device.manage.result` with `phase: "completed"`, `removedPhoneIds` and the updated
|
|
173
|
+
`snapshot` (none after `phones-unpair-self`); a refusal answers `phase: "failed"` with the reason in
|
|
174
|
+
`message`. An agent uses `remove_phones` instead, confirmed by the person on a phone. See
|
|
175
|
+
[paired phones](apps/bridge/src/paired-phones/README.md).
|
|
176
|
+
|
|
147
177
|
## Mac, iPhone, iPad, and Apple Watch
|
|
148
178
|
|
|
149
179
|
<p align="center">
|
|
@@ -439,6 +469,14 @@ snapshots that still list it, do not bind it again until it is added back.
|
|
|
439
469
|
Only a controller paired with the computer is answered, and the answer goes
|
|
440
470
|
to that controller alone.
|
|
441
471
|
|
|
472
|
+
A Mesh made for a folder without Git never holds a repository that has its own
|
|
473
|
+
remote. A task begun in `~/dev` that works in `~/dev/app` keeps its history in
|
|
474
|
+
the folder's Mesh, while `app`'s chats, new ones at once, go to `app`'s own
|
|
475
|
+
Mesh. A folder Mesh whose folder has since become a clone of a repository with
|
|
476
|
+
a Mesh of its own is published with `project.supersededBy` naming that Mesh, so
|
|
477
|
+
the phone can leave it out of New Task and keep its tasks visible. See
|
|
478
|
+
[folder Meshes](apps/bridge/src/mesh/local-remote/README.md).
|
|
479
|
+
|
|
442
480
|
### Task reports
|
|
443
481
|
|
|
444
482
|
<p align="center">
|
|
@@ -602,18 +640,19 @@ trust.
|
|
|
602
640
|
|
|
603
641
|
## MCP contract
|
|
604
642
|
|
|
605
|
-
`tools/list` returns exactly
|
|
643
|
+
`tools/list` returns exactly eleven public tools:
|
|
606
644
|
|
|
607
645
|
| Tool | Contract |
|
|
608
646
|
| --- | --- |
|
|
609
|
-
| `set_runtime_auto_update` | When the user asks, turn automatic GrantTap runtime updates on this computer on or off; saves the preference without restarting services or changing pairing, tasks, or provider policy |
|
|
610
|
-
| `connection_status` |
|
|
611
|
-
| `connect_with_passkey` |
|
|
612
|
-
| `connect` |
|
|
647
|
+
| `set_runtime_auto_update` | When the user asks, turn automatic GrantTap runtime updates on this computer on or off; saves the preference without restarting services or changing pairing, tasks, or provider policy, and returns the connection state |
|
|
648
|
+
| `connection_status` | Read-only: saved pairing and every paired phone with its id and when it last reached this computer, QR expiry, relay observations, provider readiness, a newer runtime waiting to take over and why, and for the calling chat (Claude Code, Codex, Grok Build, Cursor) the phone messages queued behind its turn and its continuation after a subscription limit |
|
|
649
|
+
| `connect_with_passkey` | Link this computer to the user's GrantTap account so a signed-in phone can connect without a QR; returns a 15-minute granttap.com link, the passkey is entered only there, and existing QR pairings stay unchanged |
|
|
650
|
+
| `connect` | Show the existing pairing on the connection card, or on an unpaired computer create a one-time QR shown only on the card |
|
|
613
651
|
| `reconnect` | After explicit confirmation, show a one-time QR to reconnect or add an independent controller device while retaining the current room |
|
|
614
|
-
| `
|
|
615
|
-
| `
|
|
616
|
-
| `
|
|
652
|
+
| `remove_phones` | Ask the person to remove paired phones that are no longer used, by `notSeenForDays` and/or `phoneIds` from `connection_status`; nothing is removed without a yes on a phone, and the phone that answers, any phone heard from while the question is open, and the last phone stay |
|
|
653
|
+
| `notify` | Send a non-blocking status of at most 2,000 characters that nobody answers, and/or one task-scoped Mesh event |
|
|
654
|
+
| `ask_yes_no` | Ask a yes/no question and wait about three minutes for the explicit answer; a timeout is neither yes nor no |
|
|
655
|
+
| `ask` | Ask an open question and wait about three minutes for typed or spoken text |
|
|
617
656
|
| `request_sign_in` | Send an https sign-in page to the phone, wait for the person, and deliver the browser's loopback redirect once to the port the CLI listens on; returns `completed`, `cancelled` or `timed_out`, never the page or the redirect's contents |
|
|
618
657
|
| `offload_task` | Request moving the calling Task to a compatible computer in its Mesh, keeping provider, model, effort and visible conversation; requires Automatic computer transfers, and `action=status` or `action=cancel` acts only on the caller's own request |
|
|
619
658
|
|
|
@@ -623,6 +662,11 @@ existing pairing remains usable during a new enrollment attempt.
|
|
|
623
662
|
Setup is CLI-only because it changes provider configuration and must not be
|
|
624
663
|
available to a model through prompt injection.
|
|
625
664
|
|
|
665
|
+
A phone message delivered while more phone messages wait for the same chat carries one GrantTap
|
|
666
|
+
line after the person's words, saying how many follow and that repository-wide checks, full test
|
|
667
|
+
runs and publishing can wait for the last of them — whether it came through the durable queue or
|
|
668
|
+
directly, and in a moved Task's chat too. The phone's transcript view does not show it.
|
|
669
|
+
|
|
626
670
|
`notify` may alternatively carry one bounded task-scoped Mesh event. This does
|
|
627
671
|
not add another MCP tool or grant any global setup capability, and it publishes
|
|
628
672
|
only for the execution whose provider hook attributed the call.
|
|
@@ -741,11 +785,17 @@ question still unanswered — and names the MCP resource `granttap://mesh/map`,
|
|
|
741
785
|
one page of markdown with the whole Project: Tasks, who edits which module,
|
|
742
786
|
the other side of each repository, dependencies, and what just happened. That
|
|
743
787
|
resource is listed, because Claude Code reads only listed resources, and it is
|
|
744
|
-
scoped without a token:
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
788
|
+
scoped without a token: the host that starts an MCP server for one chat names
|
|
789
|
+
that chat, which nothing said over the connection can change — Claude Code in
|
|
790
|
+
`CLAUDE_CODE_SESSION_ID`, Grok Build in `GROK_SESSION_ID`, and a Codex CLI chat
|
|
791
|
+
by the one rollout its Codex process holds open (Codex gives its servers a bare
|
|
792
|
+
environment). Only the nearest host above the server counts, so a run a chat
|
|
793
|
+
started from its shell is not taken for that chat. `granttap://mesh/current`
|
|
794
|
+
serves the same chat's scoped state there. Cursor shares one server between a
|
|
795
|
+
window's chats; it and a Codex process with several chats open keep the
|
|
796
|
+
tokened `granttap://mesh/{capability}` and `…/map` forms from an attributed
|
|
797
|
+
`notify`, and `connection_status` names their chat from the provider hook's
|
|
798
|
+
record of that call. See [chat identity](apps/mcp/src/chat-identity/README.md). Background runs themselves
|
|
749
799
|
receive nothing from the hook; the journal is kept for the session a person
|
|
750
800
|
is in.
|
|
751
801
|
|
|
@@ -959,12 +1009,17 @@ Verified updates are staged separately and applied after active requests and pen
|
|
|
959
1009
|
decisions finish. Startup failures restore the previous version. Pairing and task
|
|
960
1010
|
policies are retained; source checkouts and running provider processes stay in place.
|
|
961
1011
|
|
|
962
|
-
A computer that always has a chat running is never idle on its own.
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1012
|
+
A computer that always has a chat running is never idle on its own. A chat's turn started
|
|
1013
|
+
from the phone therefore keeps running through the switch: its output goes to a private
|
|
1014
|
+
file instead of a pipe, the new version takes the run over by its process, and sends its
|
|
1015
|
+
answer when it ends. When an update is ready, the background monitor stops starting newly
|
|
1016
|
+
arrived phone messages while the work it cannot hand over ends — usually seconds, ten
|
|
1017
|
+
minutes at most — and then switches. Messages that arrive meanwhile are kept and
|
|
1018
|
+
delivered by the new version; none is refused or run twice. If such work outlasts the ten
|
|
1019
|
+
minutes, messages run again and the update follows when it has ended. `connection_status`
|
|
1020
|
+
and the phone's computer status say what a waiting update waits for, since when, and when
|
|
1021
|
+
it is tried again. See [runtime updates](apps/bridge/src/runtime-updates/README.md) and
|
|
1022
|
+
[runs that outlive their monitor](apps/bridge/src/reply/survival/README.md).
|
|
968
1023
|
|
|
969
1024
|
In the plugin's GrantTap connection card, use **Automatic updates: On / Off**.
|
|
970
1025
|
The choice is saved for this computer and takes effect without restarting the
|
package/SECURITY.md
CHANGED
|
@@ -102,9 +102,16 @@ report the observation as read-only instead of implying enforcement.
|
|
|
102
102
|
|
|
103
103
|
`setup` is CLI-only because it writes local provider configuration and installs
|
|
104
104
|
background services. The public MCP server can only connect an existing or new
|
|
105
|
-
phone pairing, notify, and ask bounded questions; it cannot reconfigure the
|
|
105
|
+
phone pairing, remove phones the person confirms, notify, and ask bounded questions; it cannot reconfigure the
|
|
106
106
|
machine or select a custom relay.
|
|
107
107
|
|
|
108
|
+
A phone key stays authorized until someone removes it. The phone app removes phones from **Devices → a
|
|
109
|
+
computer → Phones**; `remove_phones` lets an agent ask, and removes nothing until the person answers yes on a
|
|
110
|
+
phone, never the phone that answered, any phone heard from while the question was open, or the last phone.
|
|
111
|
+
Every relay link rereads the pairing file before each send and each received message, so a removed key gets
|
|
112
|
+
no new ciphertext at once. Ciphertext the relay already holds for it, such as a bounded read cache, is not
|
|
113
|
+
recalled. At the 17-phone limit only an added phone idle for 30 days gives its place to a new one.
|
|
114
|
+
|
|
108
115
|
`request_sign_in` sends an https page to the phone and may deliver one loopback
|
|
109
116
|
redirect back. That delivery is a single `GET` to `127.0.0.1` or `::1` on the
|
|
110
117
|
port the pending request declared, made once, only while the request waits, and
|
|
@@ -5,7 +5,9 @@ import { createPairing, DEFAULT_RELAY_URL, machineConfigPath, phonePairingPath,
|
|
|
5
5
|
import { applyNetworkRoute } from "../device-network/settings";
|
|
6
6
|
import { readNetworkSettings } from "../device-network/settings";
|
|
7
7
|
import { parkedPairingHalves } from "../pairing";
|
|
8
|
-
import { prunePendingControllers
|
|
8
|
+
import { prunePendingControllers } from "../pairing/controllers";
|
|
9
|
+
import { recordControllerAdded } from "../pairing/presence";
|
|
10
|
+
import { admitPhoneKey, evictionFor } from "../paired-phones";
|
|
9
11
|
|
|
10
12
|
export type RecoveryRequest = { id: string; phonePublicKey: string; expiresAt: number };
|
|
11
13
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -27,13 +29,11 @@ export function createRecoveryOffer(request: RecoveryRequest, machineId: string)
|
|
|
27
29
|
let { machineCfg, phoneCfg } = existing ?? createPairing(relayUrl);
|
|
28
30
|
if (existing) {
|
|
29
31
|
machineCfg = prunePendingControllers(machineCfg);
|
|
30
|
-
|
|
31
|
-
if (extra.length >= 16) throw new Error("This computer has reached its controller device limit.");
|
|
32
|
+
evictionFor(machineCfg);
|
|
32
33
|
const keys = generateKeyPair();
|
|
33
34
|
phoneCfg = { ...phoneCfg, peerPublicKey: machineCfg.myPublicKey,
|
|
34
35
|
senderId: randomId(8), myPublicKey: keys.publicKey,
|
|
35
36
|
mySecretKey: keys.secretKey };
|
|
36
|
-
machineCfg = { ...machineCfg, extraPeerPublicKeys: [...extra, keys.publicKey] };
|
|
37
37
|
}
|
|
38
38
|
const routedPhone = applyNetworkRoute(phoneCfg);
|
|
39
39
|
const ephemeral = generateKeyPair();
|
|
@@ -45,9 +45,9 @@ export function createRecoveryOffer(request: RecoveryRequest, machineId: string)
|
|
|
45
45
|
if (!existing) {
|
|
46
46
|
saveConfig(machineConfigPath(), machineCfg);
|
|
47
47
|
saveConfig(phonePairingPath(), phoneCfg);
|
|
48
|
+
recordControllerAdded(phoneCfg.myPublicKey);
|
|
48
49
|
} else {
|
|
49
|
-
|
|
50
|
-
saveConfig(machineConfigPath(), machineCfg);
|
|
50
|
+
admitPhoneKey(machineCfg.room, phoneCfg.myPublicKey, request.expiresAt);
|
|
51
51
|
}
|
|
52
52
|
return JSON.stringify({ senderPublicKey: ephemeral.publicKey, ...box });
|
|
53
53
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { startRuntimeUpdates } from "../../runtime-updates";
|
|
2
2
|
import { runtimeUpdateReadiness } from "../../runtime-updates/readiness";
|
|
3
|
-
import { UpdateDrain } from "../../runtime-updates/drain";
|
|
4
|
-
import {
|
|
3
|
+
import { UpdateDrain, writeHoldState } from "../../runtime-updates/drain";
|
|
4
|
+
import { oldestBlockingDeliveryStartedAt } from "../../reply/in-flight";
|
|
5
|
+
import { freezeSurvivingRuns, liveRunCounts, thawSurvivingRuns } from "../../reply/survival";
|
|
6
|
+
import { adoptSurvivingRuns } from "../../reply/survival/adoption";
|
|
7
|
+
import { registerLateResults } from "../../monitor/message-delivery/late-results";
|
|
5
8
|
/** Persistent, terminal-free task sync for the GrantTap phone app on macOS. */
|
|
6
9
|
import { join } from "node:path";
|
|
7
10
|
import { RelayClient } from "../../../../../packages/core/relay-client";
|
|
@@ -35,8 +38,16 @@ let stopEngineRecovery = () => {};
|
|
|
35
38
|
let stopRuntimeUpdates = () => {};
|
|
36
39
|
let stopUpdateReadiness = () => {};
|
|
37
40
|
const stopWatchdog = startRuntimeWatchdog();
|
|
41
|
+
let stopAdoption = () => {};
|
|
42
|
+
const updateDirectory = join(configDir(), "runtime-updates");
|
|
43
|
+
// What a waiting update waits for is told to status views in other processes; a monitor starts with none.
|
|
44
|
+
writeHoldState(updateDirectory, undefined);
|
|
38
45
|
// Messages keep arriving, so a newer runtime cannot wait for an idle moment: queued work is held for it instead.
|
|
39
|
-
|
|
46
|
+
// Chats' runs keep going through the switch and the new monitor takes them over (`reply/survival`).
|
|
47
|
+
const updateDrain = new UpdateDrain({ oldestRun: oldestBlockingDeliveryStartedAt,
|
|
48
|
+
blockers: () => monitor?.updateBlockers() ?? [], survivingRuns: () => liveRunCounts().survivable,
|
|
49
|
+
report: hold => writeHoldState(updateDirectory, hold),
|
|
50
|
+
onHandoff: freezeSurvivingRuns, onHandoffLapsed: thawSurvivingRuns,
|
|
40
51
|
log: line => process.stderr.write(`[monitor] ${line}\n`) });
|
|
41
52
|
|
|
42
53
|
publishStableNode();
|
|
@@ -50,6 +61,10 @@ try {
|
|
|
50
61
|
peerAllowed: controllerPeerGate(cfg),
|
|
51
62
|
});
|
|
52
63
|
monitor = startSessionMonitor(client, { primary: process.env.GRANTTAP_MONITOR_PRIMARY === "1", config: cfg });
|
|
64
|
+
// Runs the previous monitor left running hold their chats before any queued message is started.
|
|
65
|
+
registerLateResults(client);
|
|
66
|
+
stopAdoption = adoptSurvivingRuns({ connected: () => client.isConnected,
|
|
67
|
+
log: line => process.stderr.write(`[monitor] ${line}\n`) });
|
|
53
68
|
stopTaskDispatch = startTaskDispatchMonitor({ config: cfg, client,
|
|
54
69
|
isLeader: monitor.isLeader, peerAllowed: controllerPeerGate(cfg), publish: monitor.publish,
|
|
55
70
|
held: () => updateDrain.holding(), track: monitor.track });
|
|
@@ -68,6 +83,9 @@ try {
|
|
|
68
83
|
const stop = (exitCode = 0): void => {
|
|
69
84
|
if (stopping) return;
|
|
70
85
|
stopping = true;
|
|
86
|
+
// Whatever stops this monitor, a run that ends now leaves its answer for the next one.
|
|
87
|
+
freezeSurvivingRuns();
|
|
88
|
+
stopAdoption();
|
|
71
89
|
stopWatchdog();
|
|
72
90
|
stopRuntimeUpdates();
|
|
73
91
|
stopUpdateReadiness();
|
|
@@ -6,6 +6,7 @@ import { observedComputerId } from '../mesh/identity/computer';
|
|
|
6
6
|
import { clearComputerCache } from './cache';
|
|
7
7
|
import { providerLogins } from './login';
|
|
8
8
|
import { managementSnapshot, maintenanceIdle, prepareRestart, restartProvider, restartRuntime, runtimeRoot, updateRuntime, updateProvider } from './maintenance';
|
|
9
|
+
import { isPhoneAction, planPhoneChange } from '../paired-phones';
|
|
9
10
|
|
|
10
11
|
type Send = (result: DeviceManagementResult) => Promise<void>;
|
|
11
12
|
type Entry = { fingerprint: string; result?: DeviceManagementResult; pending?: Promise<void>; at: number; ttl: number };
|
|
@@ -42,14 +43,16 @@ export async function handleDeviceManagement(client: RelayClient, request: Devic
|
|
|
42
43
|
const entry: Entry = { fingerprint, at: Date.now(), ttl: request.action === 'status' ? 60_000 : 15 * 60_000 };
|
|
43
44
|
requests.set(key, entry);
|
|
44
45
|
const report: Send = async result => { entry.result = result; await send(result); };
|
|
45
|
-
entry.pending = execute(request, client.room
|
|
46
|
+
entry.pending = execute(request, { room: client.room, peer }, computerId, report)
|
|
46
47
|
.catch(async () => { /* disconnected phones recover with a new status request */ })
|
|
47
48
|
.finally(() => { entry.pending = undefined; });
|
|
48
49
|
// Commands run independently of message delivery; repeated taps reuse their operation.
|
|
49
50
|
return true;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
async function execute(request: DeviceManagementRequest,
|
|
53
|
+
async function execute(request: DeviceManagementRequest, origin: { room: string; peer: string }, computerId: string,
|
|
54
|
+
send: Send): Promise<void> {
|
|
55
|
+
const scope = origin.room + ':' + origin.peer;
|
|
53
56
|
const base = { type: 'device.manage.result' as const, requestId: request.requestId, computerId,
|
|
54
57
|
action: request.action, agent: request.agent };
|
|
55
58
|
const result = (phase: DeviceManagementResult['phase'], message: string): DeviceManagementResult =>
|
|
@@ -72,7 +75,16 @@ async function execute(request: DeviceManagementRequest, scope: string, computer
|
|
|
72
75
|
await send(result('running', request.action === 'status' ? 'Reading this computer…' : 'Working on this computer…'));
|
|
73
76
|
if (request.action === 'status') providerLogins.replay(scope);
|
|
74
77
|
let message = 'Computer status refreshed.';
|
|
75
|
-
|
|
78
|
+
let removedPhoneIds: string[] | undefined;
|
|
79
|
+
if (isPhoneAction(request.action)) {
|
|
80
|
+
const change = planPhoneChange(request, origin.peer, origin.room);
|
|
81
|
+
if (change.selfOutcome) {
|
|
82
|
+
// Once its key is gone this phone can no longer be answered, so it hears first and the key goes after.
|
|
83
|
+
await send({ ...result('completed', change.selfOutcome.message), removedPhoneIds: change.selfOutcome.removedPhoneIds });
|
|
84
|
+
change.commit(); return;
|
|
85
|
+
}
|
|
86
|
+
({ message, removedPhoneIds } = change.commit());
|
|
87
|
+
} else if (request.action === 'clear-cache') {
|
|
76
88
|
if (!maintenanceIdle()) throw Error('Finish active requests and sign-in before clearing computer caches.');
|
|
77
89
|
const bytes = await clearComputerCache(runtimeRoot);
|
|
78
90
|
message = `Cleared ${(bytes / 1024 / 1024).toFixed(1)} MB of disposable cache.`;
|
|
@@ -88,7 +100,8 @@ async function execute(request: DeviceManagementRequest, scope: string, computer
|
|
|
88
100
|
await send(result('waiting', 'Restart requested. Waiting for MCP to reconnect…'));
|
|
89
101
|
restartRuntime(); return;
|
|
90
102
|
}
|
|
91
|
-
await send({ ...result('completed', message), snapshot: await managementSnapshot()
|
|
103
|
+
await send({ ...result('completed', message), snapshot: await managementSnapshot(origin.peer),
|
|
104
|
+
...(removedPhoneIds ? { removedPhoneIds } : {}) });
|
|
92
105
|
} catch (error) {
|
|
93
106
|
await send(result('failed', error instanceof Error ? error.message.slice(0, 512) : 'This action failed on the computer.'));
|
|
94
107
|
} finally { if (exclusive) mutating = false; }
|
|
@@ -12,6 +12,7 @@ import { automaticUpdatesAllowed } from '../runtime-updates/preferences/storage.
|
|
|
12
12
|
import { newerVersion, readState, runtimeVersion } from '../runtime-updates/selection.mjs';
|
|
13
13
|
import { latestRelease, trustedRelease } from '../runtime-updates/registry';
|
|
14
14
|
import { checkForRuntimeUpdate } from '../runtime-updates';
|
|
15
|
+
import { holdSentence, readHoldState } from '../runtime-updates/drain/state';
|
|
15
16
|
import { binaryVersion } from '../tools/version';
|
|
16
17
|
import { providerCommand, providerAuthentication, installedProvider, providerEnvironment } from './provider-command';
|
|
17
18
|
import { computerCache } from './cache';
|
|
@@ -20,6 +21,7 @@ import { ownedProviderProcesses } from '../reply/process';
|
|
|
20
21
|
import { prepareRuntimeRestart, stopOwnedChildren } from './runtime-restart';
|
|
21
22
|
import { approvalsStatus } from '../approvals/state';
|
|
22
23
|
import { inspectTool, updateTool } from '../tools/updater';
|
|
24
|
+
import { phonesFor } from '../paired-phones';
|
|
23
25
|
|
|
24
26
|
export const runtimeRoot = fileURLToPath(new URL('../../../../', import.meta.url));
|
|
25
27
|
const runtimeEpoch = randomUUID();
|
|
@@ -57,7 +59,8 @@ async function availableRuntimeVersion(): Promise<string | undefined> {
|
|
|
57
59
|
return version && newerVersion(version, runtimeVersion(runtimeRoot)) ? version : undefined;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
/** `requester` is the phone asking; the phones it is shown mark it as "this phone". */
|
|
63
|
+
export async function managementSnapshot(requester?: string): Promise<DeviceManagementSnapshot> {
|
|
61
64
|
const observedAt = Date.now();
|
|
62
65
|
const directory = join(configDir(), 'runtime-updates');
|
|
63
66
|
const selected = readState(directory);
|
|
@@ -68,12 +71,19 @@ export async function managementSnapshot(): Promise<DeviceManagementSnapshot> {
|
|
|
68
71
|
updateSupported: installed && inspectTool(agent, providerEnvironment()).update != null,
|
|
69
72
|
activeRequests: ownedProviderProcesses(command).length };
|
|
70
73
|
}));
|
|
74
|
+
const hold = readHoldState(directory);
|
|
71
75
|
return { computerId: observedComputerId(), computerName: hostname(), observedAt,
|
|
72
76
|
runtimeVersion: runtimeVersion(runtimeRoot), runtimeEpoch, selectedRuntimeVersion: selected.version,
|
|
73
77
|
availableRuntimeVersion: await availableRuntimeVersion(),
|
|
78
|
+
...(hold ? { runtimeUpdateHold: { ...hold, summary: holdSentence(hold).slice(0, 1_000) } } : {}),
|
|
74
79
|
automaticUpdatesEnabled: automaticUpdatesAllowed(directory),
|
|
75
80
|
runtimeUpdateSupported: runtimeRoot.includes('/node_modules/'), runtimeRestartSupported: runtimeRestartSupported(),
|
|
76
|
-
cache: (await computerCache(runtimeRoot)).map(({ paths: _paths, ...category }) => category), providers
|
|
81
|
+
cache: (await computerCache(runtimeRoot)).map(({ paths: _paths, ...category }) => category), providers,
|
|
82
|
+
...(requester ? { phones: readPhones(requester) } : {}) };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function readPhones(requester: string): DeviceManagementSnapshot['phones'] {
|
|
86
|
+
try { return phonesFor(requester); } catch { return []; }
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
export async function updateRuntime(): Promise<string> {
|
|
@@ -29,9 +29,11 @@ Explicit Graph builds also invoke the Engine's `graph.analyze_project` for two
|
|
|
29
29
|
to eight admitted local repositories. The projection labels these shared static
|
|
30
30
|
contracts and keeps their runtime destination unverified. They do not become
|
|
31
31
|
verified Backbone dependencies or merge Project grants. The Apple Silicon
|
|
32
|
-
artifact pins Engine 0.1.
|
|
33
|
-
and per-file function extent reuse during metrics analysis; unsupported Engine
|
|
34
|
-
leave this analysis unavailable.
|
|
32
|
+
artifact pins Engine 0.1.8 with Weavatrix 2.17.17 and Cortex Loom 0.1.1, injective package
|
|
33
|
+
import identities and per-file function extent reuse during metrics analysis; unsupported Engine
|
|
34
|
+
operations leave this analysis unavailable. The Engine keeps a search index of the repositories it
|
|
35
|
+
searched in `weavatrix-search/` beside its socket, with the socket's owner-only permissions; the
|
|
36
|
+
launch never passes on a person's own `WEAVATRIX_SEARCH_HOME`. See `runtime/project-relationships/README.md`.
|
|
35
37
|
|
|
36
38
|
Claude, Codex, and Cursor hooks can evaluate the engine's local Project
|
|
37
39
|
Governance policy only when both `GRANTTAP_ENGINE_ENABLED` and
|
|
@@ -8,8 +8,8 @@ export type EngineArtifact = {
|
|
|
8
8
|
|
|
9
9
|
/** Release hashes are part of the reviewed MCP, never supplied by a remote manifest. */
|
|
10
10
|
export const ENGINE_ARTIFACTS: readonly EngineArtifact[] = [
|
|
11
|
-
{ version: "0.1.
|
|
12
|
-
sha256: "
|
|
11
|
+
{ version: "0.1.8", platform: "darwin", arch: "arm64",
|
|
12
|
+
sha256: "15cc6bd1d35ed19af06199603f4051ef28e8c03ebe40bff1c3febd1bb2a75279", bytes: 13059296 },
|
|
13
13
|
// The 0.1.2 Intel Mac and Linux x64 builds are no longer published. Without a
|
|
14
14
|
// pin, setup reports Graph as unavailable and the helper does not retry a 404;
|
|
15
15
|
// an Engine already installed and verified on such a computer keeps working.
|
|
@@ -9,8 +9,11 @@ export function engineLaunchEnvironment(
|
|
|
9
9
|
env: NodeJS.ProcessEnv, socketPath: string, platform: NodeJS.Platform = process.platform,
|
|
10
10
|
): NodeJS.ProcessEnv {
|
|
11
11
|
const requestedStack = Number(env.RUST_MIN_STACK);
|
|
12
|
+
// The Engine keeps its search index of repository text in its own state folder beside the socket;
|
|
13
|
+
// a person's own Weavatrix setting must not move it into their Weavatrix data.
|
|
14
|
+
const { WEAVATRIX_SEARCH_HOME: _personalSearchHome, ...inherited } = env;
|
|
12
15
|
return {
|
|
13
|
-
...
|
|
16
|
+
...inherited,
|
|
14
17
|
GRANTTAP_ENGINE_SOCKET: engineSocketEndpoint(socketPath),
|
|
15
18
|
// Rust's default worker stack aborts the daemon on ordinary long ASTs.
|
|
16
19
|
// Scope this reserve to the verified Engine child; keep larger explicit reserves.
|
|
@@ -22,6 +22,7 @@ Turning it off takes the queued copies back from the relay. A copy the relay sti
|
|
|
22
22
|
is refused at delivery. The same happens when the chat went on by itself first. A limit that reset
|
|
23
23
|
more than an hour ago is treated as abandoned and is never woken by an update.
|
|
24
24
|
|
|
25
|
-
State lives in `limit-continuation.json` in the private config directory.
|
|
25
|
+
State lives in `limit-continuation.json` in the private config directory. `limitContinuationFor`
|
|
26
|
+
reads one chat's setting and queued continuation for that chat's own MCP status. Tests live in `tests/`.
|
|
26
27
|
|
|
27
28
|
License: GrantTap Commercial Source License; see the repository LICENSE.
|
|
@@ -45,6 +45,17 @@ export function annotateLimitContinuations(sessions: SessionInfo[]): SessionInfo
|
|
|
45
45
|
? { ...session, usageLimit: { ...session.usageLimit, autoContinue: !off.has(session.sessionId) } } : session);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* For the chat itself: whether it goes on by itself after a subscription limit stopped it, and the
|
|
50
|
+
* continuation queued for it while it waits at one. `early` says a second one was queued to go at once
|
|
51
|
+
* because the account's readings showed room before the reset. Read only.
|
|
52
|
+
*/
|
|
53
|
+
export function limitContinuationFor(sessionId: string): { autoContinue: boolean; continuation?: { dueAt: number; early: boolean } } {
|
|
54
|
+
const state = readLimitContinuationState(), job = state.scheduled[sessionId];
|
|
55
|
+
return { autoContinue: !state.off.includes(sessionId),
|
|
56
|
+
...(job ? { continuation: { dueAt: Math.max(job.scheduledAt ?? 0, job.resetsAt + LIMIT_CONTINUE_GRACE_MS), early: !!job.early } } : {}) };
|
|
57
|
+
}
|
|
58
|
+
|
|
48
59
|
function wanted(session: SessionInfo, off: Set<string>, now: number): boolean {
|
|
49
60
|
const limit = session.usageLimit;
|
|
50
61
|
return !!limit && session.agent === 'claude' && session.state === 'idle' && !off.has(session.sessionId)
|
|
@@ -87,6 +87,11 @@ published: the catalog and snapshot merges skip a removed binding for this
|
|
|
87
87
|
computer until the person adds it back. Edits are answered once per request id,
|
|
88
88
|
and a repeated request is given the first answer.
|
|
89
89
|
|
|
90
|
+
A Mesh made for a folder without Git (canonical repository `local:<path>`)
|
|
91
|
+
never binds or routes a repository that has its own remote; see
|
|
92
|
+
[folder Meshes](local-remote/README.md), which also says when such a Mesh is
|
|
93
|
+
published as `project.supersededBy` another.
|
|
94
|
+
|
|
90
95
|
The Mesh brief guides an agent with Project scope, relevant restrictions,
|
|
91
96
|
repository topology, dependencies, and neighboring work. The local hook and
|
|
92
97
|
Engine enforce Governance decisions. GrantTap measures
|
|
@@ -6,7 +6,10 @@ sessions to stable Tasks, and records endpoint bindings and execution history.
|
|
|
6
6
|
An execution may discover a checkout after its Task started in a non-Git parent
|
|
7
7
|
workspace. The catalog retains the Task and Project identity and records the
|
|
8
8
|
observed repository on its execution. An observation does not grant Project
|
|
9
|
-
membership or prove a code dependency.
|
|
9
|
+
membership or prove a code dependency. A local repository without a remote is
|
|
10
|
+
bound to the parent folder's Mesh as before; one with its own remote is not
|
|
11
|
+
(`local-remote/folder-meshes.ts`), and a binding an older runtime made for it
|
|
12
|
+
there is taken out with a removal record. Apple clients partition workspace Tasks
|
|
10
13
|
using those observations without moving them between access scopes.
|
|
11
14
|
|
|
12
15
|
Git facts are shared only within one catalog batch. The next reading refreshes
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProjectBindingSummary,
|
|
3
|
+
type Project as ProjectValue,
|
|
3
4
|
type ProjectBindingSummary as BindingValue,
|
|
4
5
|
} from "../../../../../packages/protocol/schema";
|
|
5
6
|
import { bindingRemoved, type StoreState } from "../store/state";
|
|
7
|
+
import { folderMeshHoldsRemote } from "../local-remote/folder-meshes";
|
|
8
|
+
|
|
9
|
+
export { folderIdentity, folderMeshHoldsRemote } from "../local-remote/folder-meshes";
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* The binding this endpoint owns for this repository, and nothing else.
|
|
@@ -22,11 +26,18 @@ export function bindingForEndpoint(
|
|
|
22
26
|
item.endpointId === endpointId && item.repositoryId === repositoryId);
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/**
|
|
30
|
+
* The binding that routes a repository's chats. Given the Projects, a folder Mesh's binding of a
|
|
31
|
+
* repository with its own remote is passed over, so the repository's chats go to its own Mesh.
|
|
32
|
+
*/
|
|
25
33
|
export function bindingForRepository(
|
|
26
|
-
|
|
34
|
+
allBindings: BindingValue[],
|
|
27
35
|
repositoryId: string,
|
|
28
36
|
endpointId?: string,
|
|
37
|
+
knownProjects?: readonly ProjectValue[],
|
|
29
38
|
): BindingValue | undefined {
|
|
39
|
+
const bindings = knownProjects ? allBindings.filter((item) => !folderMeshHoldsRemote(
|
|
40
|
+
knownProjects.find((project) => project.projectId === item.projectId), item.repositoryId)) : allBindings;
|
|
30
41
|
const exact = endpointId == null
|
|
31
42
|
? undefined
|
|
32
43
|
: bindingForEndpoint(bindings, repositoryId, endpointId);
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { formerComputerNames } from "../identity/computer";
|
|
18
18
|
import { readIntegrationMap } from "../observed/integration-map";
|
|
19
19
|
import type { MeshStore } from "../store";
|
|
20
|
+
import { folderMeshHoldsRemote } from "../local-remote/folder-meshes";
|
|
20
21
|
import { queueProjectBindingSync } from "../../engine/runtime/engine-projects";
|
|
21
22
|
import { isCursorTaskCloneId } from "../../sessions/cursor/catalog";
|
|
22
23
|
import { localTaskTransfers } from '../../task-transfer';
|
|
@@ -235,13 +236,26 @@ function linkSession(input: {
|
|
|
235
236
|
/**
|
|
236
237
|
* Bind the chat's checkout to its Project on this computer. A repository the
|
|
237
238
|
* person took out of that Project here stays out, however many chats run in it.
|
|
239
|
+
*
|
|
240
|
+
* A repository with its own remote is never bound to a Mesh made for a folder
|
|
241
|
+
* without Git: a task begun in `~/dev` that works in `~/dev/app` stays in the
|
|
242
|
+
* folder Mesh with its history, and `app` keeps its own Mesh. A binding such a
|
|
243
|
+
* task made before this rule is taken out of the folder Mesh, so the
|
|
244
|
+
* repository's new chats, which already route past it, can bind it to its own.
|
|
238
245
|
*/
|
|
239
246
|
function bindSessionRepository(
|
|
240
247
|
store: MeshStore, project: Project, repository: RepositoryFacts, computerId: string, lastSeenAt: number,
|
|
241
248
|
): void {
|
|
242
249
|
const { projectId } = project;
|
|
243
|
-
|
|
244
|
-
|
|
250
|
+
const repositoryId = repository.canonicalRepositoryId;
|
|
251
|
+
if (folderMeshHoldsRemote(project, repositoryId)) {
|
|
252
|
+
store.releaseFromFolderMesh(computerId, repositoryId);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (store.bindingRemoved(projectId, computerId, repositoryId)) return;
|
|
256
|
+
let knownBinding = store.bindingForEndpoint(repositoryId, computerId);
|
|
257
|
+
if (knownBinding && knownBinding.projectId !== projectId
|
|
258
|
+
&& store.releaseFromFolderMesh(computerId, repositoryId)) knownBinding = undefined;
|
|
245
259
|
const binding = {
|
|
246
260
|
bindingId: knownBinding?.bindingId
|
|
247
261
|
?? projectBindingIdentity(projectId, computerId, repository.canonicalRepositoryId),
|
|
@@ -49,7 +49,8 @@ function canonical(value: unknown): unknown {
|
|
|
49
49
|
export function grantTapToolName(rawToolName: unknown): string | undefined {
|
|
50
50
|
const raw = String(rawToolName ?? "").trim();
|
|
51
51
|
const tool = raw.includes("__") ? raw.split("__").at(-1)! : raw;
|
|
52
|
-
return ["notify", "connect", "ask", "ask_yes_no", "offload_task", "request_sign_in"].includes(tool)
|
|
52
|
+
return ["notify", "connect", "ask", "ask_yes_no", "offload_task", "request_sign_in", "connection_status", "remove_phones"].includes(tool)
|
|
53
|
+
? tool : undefined;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
export function meshCallKey(tool: string, args: unknown): string {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Local store, remotes and folder Meshes
|
|
2
|
+
|
|
3
|
+
`local.ts` holds this computer's Mesh store. `remote.ts` is the one place a Git remote is touched:
|
|
4
|
+
a handoff's push and fetch (see the Mesh README).
|
|
5
|
+
|
|
6
|
+
## A folder Mesh never takes a repository with its own remote
|
|
7
|
+
|
|
8
|
+
A chat started in a folder without Git (`~/dev`) makes a Mesh named by the folder: its canonical
|
|
9
|
+
repository is `local:<path>`. When that chat goes on to work in `~/dev/app`, a clone with its own
|
|
10
|
+
remote, the Task stays in the folder Mesh with its history, and the execution records where it
|
|
11
|
+
worked. `folder-meshes.ts` keeps the repository out of that Mesh:
|
|
12
|
+
|
|
13
|
+
- The catalog does not bind a repository with a remote to a folder Mesh. A local repository without
|
|
14
|
+
a remote may still join its parent folder's Mesh, as before.
|
|
15
|
+
- Routing (`MeshStore.projectIdForRepository` and `bindingForRepository`, which also pick a phone
|
|
16
|
+
task's Mesh, a run's Project environment and Governance) passes over a folder Mesh's binding of such
|
|
17
|
+
a repository, on any computer, so the repository's new chats go to its own Mesh at once.
|
|
18
|
+
- A binding an older runtime made for it on this computer is taken out of the folder Mesh the next
|
|
19
|
+
time a chat in either is cataloged, with a `removedBindings` record, so a phone or another computer
|
|
20
|
+
that still lists it does not bind it again; the repository's next chat binds it to its own Mesh.
|
|
21
|
+
The Engine keeps its own copy of the old binding: it has no operation to remove one.
|
|
22
|
+
- The phone cannot add such a repository to a folder Mesh (`mesh.repository.edit` answers
|
|
23
|
+
`invalid` and says why).
|
|
24
|
+
|
|
25
|
+
Tasks that already ran in the folder Mesh are not moved.
|
|
26
|
+
|
|
27
|
+
## A folder Mesh superseded by its folder's repository
|
|
28
|
+
|
|
29
|
+
A folder Mesh made while `~/dev/inbox` was a plain folder is left behind when that folder later
|
|
30
|
+
becomes a clone of a repository with its own Mesh: new chats in the folder land in the repository's
|
|
31
|
+
Mesh. The snapshot this computer publishes for the old Mesh then carries
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
"project": { "projectId": "project-…", "name": "inbox", "canonicalRepositoryId": "local:/Users/…/inbox",
|
|
35
|
+
"supersededBy": "project-<the repository's Mesh>" }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`project.supersededBy` (optional, a Project id) means: this Mesh's folder is now a Git checkout at
|
|
39
|
+
the same path, and the most recent chat at its root runs in the named Mesh, whose repository has
|
|
40
|
+
its own remote. The old Mesh keeps its tasks and stays published, so they remain visible and
|
|
41
|
+
searchable; a controller should leave it out of New Task and may point to the named Mesh instead.
|
|
42
|
+
The field is absent for every other Mesh, and it disappears again if the folder stops being a
|
|
43
|
+
checkout. It is read from this computer's own folders at publication and never stored: a snapshot
|
|
44
|
+
that comes back with it is merged without it. Phones that do not know the field ignore it (it is
|
|
45
|
+
inside `project`); a computer on an older runtime rejects a snapshot that carries it, which only
|
|
46
|
+
the superseded Mesh's snapshot does.
|
|
47
|
+
|
|
48
|
+
Tests: `tests/folder-meshes.test.ts`, `../../../../../tests/agentic/codex-workspace-binding.test.ts`.
|
|
49
|
+
|
|
50
|
+
License: [GrantTap Commercial Source License](../../../../../LICENSE).
|