granttap-mcp 0.8.187 → 0.8.189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +93 -14
  2. package/SECURITY.md +8 -1
  3. package/apps/bridge/src/account-recovery/offer.ts +6 -6
  4. package/apps/bridge/src/bin/runtime/monitor.ts +21 -3
  5. package/apps/bridge/src/codex-hook-trust/README.md +2 -0
  6. package/apps/bridge/src/codex-hook-trust/projection.ts +8 -5
  7. package/apps/bridge/src/device-management/index.ts +17 -4
  8. package/apps/bridge/src/device-management/maintenance.ts +12 -2
  9. package/apps/bridge/src/helper-runs/README.md +4 -0
  10. package/apps/bridge/src/install/inspect.ts +5 -4
  11. package/apps/bridge/src/install/stable-node/README.md +14 -2
  12. package/apps/bridge/src/install/stable-node/index.ts +48 -2
  13. package/apps/bridge/src/machine-load/host/process-sampler.ts +3 -0
  14. package/apps/bridge/src/mesh/README.md +5 -0
  15. package/apps/bridge/src/mesh/catalog/README.md +9 -1
  16. package/apps/bridge/src/mesh/catalog/binding-state.ts +12 -1
  17. package/apps/bridge/src/mesh/catalog/index.ts +62 -7
  18. package/apps/bridge/src/mesh/identity/call-scope.ts +2 -1
  19. package/apps/bridge/src/mesh/local-remote/README.md +50 -0
  20. package/apps/bridge/src/mesh/local-remote/folder-meshes.ts +58 -0
  21. package/apps/bridge/src/mesh/repositories/edit.ts +5 -0
  22. package/apps/bridge/src/mesh/snapshot/merge.ts +3 -1
  23. package/apps/bridge/src/mesh/store/base.ts +3 -2
  24. package/apps/bridge/src/mesh/store/index.ts +8 -3
  25. package/apps/bridge/src/mesh/store/repositories/index.ts +24 -0
  26. package/apps/bridge/src/monitor/handlers/user-message.ts +18 -50
  27. package/apps/bridge/src/monitor/message-delivery/README.md +4 -1
  28. package/apps/bridge/src/monitor/message-delivery/acceptance.ts +20 -5
  29. package/apps/bridge/src/monitor/message-delivery/index.ts +3 -1
  30. package/apps/bridge/src/monitor/message-delivery/late-results.ts +87 -0
  31. package/apps/bridge/src/monitor/support/runtime.ts +31 -4
  32. package/apps/bridge/src/paired-phones/README.md +60 -0
  33. package/apps/bridge/src/paired-phones/admission.ts +53 -0
  34. package/apps/bridge/src/paired-phones/device-actions.ts +71 -0
  35. package/apps/bridge/src/paired-phones/index.ts +7 -0
  36. package/apps/bridge/src/paired-phones/removal.ts +48 -0
  37. package/apps/bridge/src/paired-phones/roster.ts +82 -0
  38. package/apps/bridge/src/pairing/controllers.ts +31 -7
  39. package/apps/bridge/src/pairing/index.ts +14 -9
  40. package/apps/bridge/src/pairing/presence.ts +24 -0
  41. package/apps/bridge/src/reply/README.md +4 -0
  42. package/apps/bridge/src/reply/grok-response/index.ts +5 -0
  43. package/apps/bridge/src/reply/in-flight.ts +54 -5
  44. package/apps/bridge/src/reply/index.ts +22 -39
  45. package/apps/bridge/src/reply/payload/claude-result.ts +33 -0
  46. package/apps/bridge/src/reply/payload/types.ts +9 -4
  47. package/apps/bridge/src/reply/process/codex-headless.ts +20 -2
  48. package/apps/bridge/src/reply/process/index.ts +116 -72
  49. package/apps/bridge/src/reply/process/provider-headless.ts +3 -1
  50. package/apps/bridge/src/reply/survival/README.md +73 -0
  51. package/apps/bridge/src/reply/survival/adoption.ts +115 -0
  52. package/apps/bridge/src/reply/survival/answers.ts +67 -0
  53. package/apps/bridge/src/reply/survival/files.ts +78 -0
  54. package/apps/bridge/src/reply/survival/index.ts +92 -0
  55. package/apps/bridge/src/reply/survival/records.ts +123 -0
  56. package/apps/bridge/src/reply/survival/run.ts +89 -0
  57. package/apps/bridge/src/runtime-updates/README.md +72 -30
  58. package/apps/bridge/src/runtime-updates/drain/index.ts +64 -5
  59. package/apps/bridge/src/runtime-updates/drain/state.ts +112 -0
  60. package/apps/bridge/src/runtime-updates/index.ts +17 -9
  61. package/apps/bridge/src/runtime-updates/readiness.ts +2 -0
  62. package/apps/bridge/src/runtime-updates/selection.d.mts +2 -1
  63. package/apps/bridge/src/runtime-updates/selection.mjs +13 -5
  64. package/apps/bridge/src/sessions/README.md +10 -1
  65. package/apps/bridge/src/sessions/catalog.ts +4 -2
  66. package/apps/bridge/src/sessions/scan/claude/parse.ts +31 -6
  67. package/apps/bridge/src/sessions/scan/claude/scan.ts +4 -1
  68. package/apps/bridge/src/sessions/scan/claude/shared.ts +2 -0
  69. package/apps/bridge/src/sessions/scan/codex/parse.ts +37 -7
  70. package/apps/bridge/src/sessions/scan/codex/scan.ts +2 -1
  71. package/apps/bridge/src/sessions/scan/codex/shared.ts +3 -0
  72. package/apps/bridge/src/sessions/scan/grok.ts +9 -2
  73. package/apps/bridge/src/sessions/support/common.ts +2 -0
  74. package/apps/bridge/src/started-by/README.md +94 -0
  75. package/apps/bridge/src/started-by/attach.ts +136 -0
  76. package/apps/bridge/src/started-by/capture.ts +186 -0
  77. package/apps/bridge/src/started-by/facts.ts +154 -0
  78. package/apps/bridge/src/started-by/headless.ts +146 -0
  79. package/apps/bridge/src/started-by/index.ts +7 -0
  80. package/apps/bridge/src/started-by/links.ts +175 -0
  81. package/apps/bridge/src/started-by/mesh/index.ts +106 -0
  82. package/apps/bridge/src/task-dispatch/README.md +11 -3
  83. package/apps/bridge/src/task-dispatch/worker/queue-depth.ts +19 -1
  84. package/apps/bridge/src/task-transfer/index.ts +8 -3
  85. package/apps/mcp/src/chat-identity/README.md +53 -0
  86. package/apps/mcp/src/chat-identity/index.ts +110 -0
  87. package/apps/mcp/src/chat-identity/processes.ts +135 -0
  88. package/apps/mcp/src/connection-center/README.md +4 -3
  89. package/apps/mcp/src/connection-center/state.ts +23 -7
  90. package/apps/mcp/src/http/create-server.ts +2 -0
  91. package/apps/mcp/src/mcp-tools/README.md +11 -1
  92. package/apps/mcp/src/mcp-tools/connect/index.ts +12 -10
  93. package/apps/mcp/src/mcp-tools/connect/relay.ts +1 -1
  94. package/apps/mcp/src/mcp-tools/mesh/current.ts +2 -2
  95. package/apps/mcp/src/mcp-tools/mesh/resource.ts +2 -1
  96. package/apps/mcp/src/mcp-tools/mesh/session-env.ts +7 -9
  97. package/apps/mcp/src/mcp-tools/phones/index.ts +63 -0
  98. package/apps/mcp/src/mcp-tools/phones/removal.ts +113 -0
  99. package/apps/mcp/src/oauth/session/connect-snapshot.ts +4 -3
  100. package/apps/mcp/src/status/chat-status.ts +38 -11
  101. package/apps/mcp/src/status/pairing-status.ts +50 -36
  102. package/cursor-plugin/README.md +1 -1
  103. package/cursor-plugin/mcp.json +1 -1
  104. package/cursor-plugin/stdio-bootstrap.cjs +1 -1
  105. package/docs/device-management.md +9 -2
  106. package/package.json +1 -1
  107. package/packages/core/relay-client.ts +3 -1
  108. package/packages/protocol/messages/README.md +11 -0
  109. package/packages/protocol/messages/device/management.ts +50 -0
  110. package/packages/protocol/messages/mesh/tasks.ts +5 -0
  111. package/packages/protocol/messages/sessions/index.ts +12 -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,15 +640,16 @@ trust.
602
640
 
603
641
  ## MCP contract
604
642
 
605
- `tools/list` returns exactly ten public tools:
643
+ `tools/list` returns exactly eleven public tools:
606
644
 
607
645
  | Tool | Contract |
608
646
  | --- | --- |
609
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 |
610
- | `connection_status` | Read-only: saved pairing and paired phones by when each last reached this computer, QR expiry, relay observations, provider readiness, a newer runtime waiting to take over and why, and for the calling Claude Code chat the phone messages queued behind its turn and its continuation after a subscription limit |
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 |
611
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 |
612
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 |
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 |
614
653
  | `notify` | Send a non-blocking status of at most 2,000 characters that nobody answers, and/or one task-scoped Mesh event |
615
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 |
616
655
  | `ask` | Ask an open question and wait about three minutes for typed or spoken text |
@@ -625,7 +664,8 @@ available to a model through prompt injection.
625
664
 
626
665
  A phone message delivered while more phone messages wait for the same chat carries one GrantTap
627
666
  line after the person's words, saying how many follow and that repository-wide checks, full test
628
- runs and publishing can wait for the last of them. The phone's transcript view does not show it.
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.
629
669
 
630
670
  `notify` may alternatively carry one bounded task-scoped Mesh event. This does
631
671
  not add another MCP tool or grant any global setup capability, and it publishes
@@ -717,6 +757,34 @@ A shell call is fingerprinted for Project policy by the command it runs —
717
757
  instead of deciding about the shell as a whole; a line with no command word
718
758
  is still plain `Shell`.
719
759
 
760
+ ### Chats started by another chat
761
+
762
+ A chat that runs another provider headless from its shell — `codex exec "…"`,
763
+ `claude -p "…"`, `grok -p "…"` — starts a chat in its own right. Its session
764
+ record names the chat that started it:
765
+
766
+ ```ts
767
+ startedBy?: { agent: "claude" | "codex" | "grok" | "cursor"; sessionId: string }
768
+ ```
769
+
770
+ The field is strict on the wire (no other key; the id is 8–128 characters of
771
+ `A–Z a–z 0–9 . _ -`) and is published even when the parent is on another
772
+ computer or gone; the phone decides how to draw the tree. Short picture runs in
773
+ a folder made for them stay nested conversations in their chat's
774
+ `childThreads`, as before.
775
+
776
+ The link is read from the run's live process — Claude Code and Codex hand every
777
+ command a chat runs that chat's id, and the run inherits it; only that variable
778
+ is read, only for headless provider processes this monitor did not start
779
+ itself — and written to `started-by.json`. A run whose process was never seen is
780
+ matched after the fact from the parent's transcript: a command that starts the
781
+ child's provider, carries the opening of its first request, and was running
782
+ when it started, on the same computer; a child two chats could have started
783
+ stays unlinked. Interactive sessions are never children. A child working in a
784
+ temp folder, a plain folder or one of its parent's checkout is in its parent's
785
+ Mesh and registers no Mesh of its own; one in a checkout of its own keeps that
786
+ checkout's. Details: [`apps/bridge/src/started-by`](apps/bridge/src/started-by/README.md).
787
+
720
788
  ### One computer, whatever the network calls it
721
789
 
722
790
  The Mesh keys a computer by an identity written down once, on first use, in
@@ -745,11 +813,17 @@ question still unanswered — and names the MCP resource `granttap://mesh/map`,
745
813
  one page of markdown with the whole Project: Tasks, who edits which module,
746
814
  the other side of each repository, dependencies, and what just happened. That
747
815
  resource is listed, because Claude Code reads only listed resources, and it is
748
- scoped without a token: Claude Code starts one MCP server per chat and hands
749
- it the chat's id in `CLAUDE_CODE_SESSION_ID`, which nothing said over the
750
- connection can change. `granttap://mesh/current` serves the same chat's scoped
751
- state there. Other providers keep the tokened `granttap://mesh/{capability}`
752
- and `…/map` forms from an attributed `notify`. Background runs themselves
816
+ scoped without a token: the host that starts an MCP server for one chat names
817
+ that chat, which nothing said over the connection can change — Claude Code in
818
+ `CLAUDE_CODE_SESSION_ID`, Grok Build in `GROK_SESSION_ID`, and a Codex CLI chat
819
+ by the one rollout its Codex process holds open (Codex gives its servers a bare
820
+ environment). Only the nearest host above the server counts, so a run a chat
821
+ started from its shell is not taken for that chat. `granttap://mesh/current`
822
+ serves the same chat's scoped state there. Cursor shares one server between a
823
+ window's chats; it and a Codex process with several chats open keep the
824
+ tokened `granttap://mesh/{capability}` and `…/map` forms from an attributed
825
+ `notify`, and `connection_status` names their chat from the provider hook's
826
+ record of that call. See [chat identity](apps/mcp/src/chat-identity/README.md). Background runs themselves
753
827
  receive nothing from the hook; the journal is kept for the session a person
754
828
  is in.
755
829
 
@@ -963,12 +1037,17 @@ Verified updates are staged separately and applied after active requests and pen
963
1037
  decisions finish. Startup failures restore the previous version. Pairing and task
964
1038
  policies are retained; source checkouts and running provider processes stay in place.
965
1039
 
966
- A computer that always has a chat running is never idle on its own. When an update is
967
- ready, the background monitor therefore stops starting newly arrived phone messages for
968
- up to ten minutes, lets the runs already going finish, and then switches. Messages that
969
- arrive meanwhile are kept and delivered by the new version; none is refused or run
970
- twice. If a run outlasts the ten minutes, messages run again and the update follows
971
- when that run has ended.
1040
+ A computer that always has a chat running is never idle on its own. A chat's turn started
1041
+ from the phone therefore keeps running through the switch: its output goes to a private
1042
+ file instead of a pipe, the new version takes the run over by its process, and sends its
1043
+ answer when it ends. When an update is ready, the background monitor stops starting newly
1044
+ arrived phone messages while the work it cannot hand over ends — usually seconds, ten
1045
+ minutes at most — and then switches. Messages that arrive meanwhile are kept and
1046
+ delivered by the new version; none is refused or run twice. If such work outlasts the ten
1047
+ minutes, messages run again and the update follows when it has ended. `connection_status`
1048
+ and the phone's computer status say what a waiting update waits for, since when, and when
1049
+ it is tried again. See [runtime updates](apps/bridge/src/runtime-updates/README.md) and
1050
+ [runs that outlive their monitor](apps/bridge/src/reply/survival/README.md).
972
1051
 
973
1052
  In the plugin's GrantTap connection card, use **Automatic updates: On / Off**.
974
1053
  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, rememberPendingController } from "../pairing/controllers";
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
- const extra = machineCfg.extraPeerPublicKeys ?? [];
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
- rememberPendingController(machineCfg.room, phoneCfg.myPublicKey, request.expiresAt);
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 { oldestDeliveryStartedAt } from "../../reply";
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
- const updateDrain = new UpdateDrain({ oldestRun: oldestDeliveryStartedAt,
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();
@@ -8,6 +8,8 @@ installed by this runtime (`PreToolUse` and `PermissionRequest`) can be reviewed
8
8
  A hook an earlier runtime wrote through its launcher in the private version cache
9
9
  still counts as this runtime's, because that launcher hands off to the selected
10
10
  version; setup keeps it, so an automatic update does not void its Codex trust.
11
+ The hook's absolute Node may be another existing `node` than the one reading it
12
+ ([stable Node](../install/stable-node/README.md)).
11
13
  Project, plugin, managed, ambiguous, or unrelated commands are never approved.
12
14
  Unsupported native APIs report unknown; configured hooks alone do not establish
13
15
  readiness or computer enforcement.
@@ -2,8 +2,8 @@ import { dirname, join } from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { ProviderHook, type ProviderHook as Hook } from "../../../../packages/protocol/messages/provider-hooks";
4
4
  import { configDir } from "../config/runtime/paths";
5
- import { cachedHookLauncher, runtimeVersion } from "../runtime-updates/selection.mjs";
6
- import { hookNodeCommand } from "../install/stable-node";
5
+ import { runtimeVersion } from "../runtime-updates/selection.mjs";
6
+ import { hookLaunchesRuntime, hookNodeCommand } from "../install/stable-node";
7
7
 
8
8
  const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "..", "..");
9
9
 
@@ -12,10 +12,13 @@ export function ownedHookCommands() {
12
12
  return { policy: `${base} codex-policy`, permission: `${base} codex` };
13
13
  }
14
14
 
15
- /** This runtime's command, or an earlier runtime's cached launcher that hands off to it. */
15
+ /**
16
+ * This runtime's command, or an earlier runtime's cached launcher that hands off to it, run by any
17
+ * existing Node the setup named: which Node reads the hook does not decide whether it is installed.
18
+ */
16
19
  export function ownedHookCommand(command: unknown, kind: "policy" | "permission"): boolean {
17
- return command === ownedHookCommands()[kind] || cachedHookLauncher(command,
18
- kind === "policy" ? "codex-policy" : "codex", join(configDir(), "runtime-updates"), runtimeVersion(root), hookNodeCommand("codex"));
20
+ return command === ownedHookCommands()[kind] || hookLaunchesRuntime(command,
21
+ kind === "policy" ? "codex-policy" : "codex", root, runtimeVersion(root), join(configDir(), "runtime-updates"));
19
22
  }
20
23
 
21
24
  /** Only the two exact user-config hooks installed by this runtime are reviewable. */
@@ -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 + ':' + peer, computerId, report)
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, scope: string, computerId: string, send: Send): Promise<void> {
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
- if (request.action === 'clear-cache') {
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
- export async function managementSnapshot(): Promise<DeviceManagementSnapshot> {
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> {
@@ -54,6 +54,10 @@ in place of the path line that names them. A phone reads one with
54
54
  picture's content, never a path, and only the chat that started the run is
55
55
  answered.
56
56
 
57
+ A headless run that is a chat in its own right, such as `codex exec` in a folder
58
+ several runs share, is not a helper run: it stays a chat and names the chat that
59
+ started it in `startedBy` ([chats started by another chat](../started-by/README.md)).
60
+
57
61
  **Meshes.** A run is not passed to the Mesh, and a generator's folder never
58
62
  registers one. A Mesh without a remote whose folder is a generator's, is
59
63
  gone from the temp directory, or lies inside a Git checkout without being a
@@ -43,8 +43,8 @@ import { monitorPlistLooksInstalled } from "./monitor-helper";
43
43
  import { inspectLinuxService } from "./linux-service";
44
44
  import { codexHooksExplicitlyDisabled } from "./hooks";
45
45
  import { cachedCodexHooks, codexHookSet } from "../codex-hook-trust";
46
- import { cachedHookLauncher, runtimeVersion } from "../runtime-updates/selection.mjs";
47
- import { hookNodeCommand } from "./stable-node";
46
+ import { runtimeVersion } from "../runtime-updates/selection.mjs";
47
+ import { hookLaunchesRuntime, hookNodeCommand } from "./stable-node";
48
48
  import type { ProviderHook } from "../../../../packages/protocol/messages/provider-hooks";
49
49
  export { codexHookSet } from "../codex-hook-trust";
50
50
 
@@ -76,11 +76,12 @@ export function commandHasRoute(command: unknown, route: HookRoute): boolean {
76
76
  /**
77
77
  * This runtime's command, or an earlier runtime's launcher in the version cache,
78
78
  * which hands off to this one. Keeping that command after an automatic update
79
- * also keeps the trust Codex records for it.
79
+ * also keeps the trust Codex records for it. A Codex hook may name another
80
+ * existing Node than the one reading it (`hookNodeAccepted`).
80
81
  */
81
82
  export function hookCommandIsCurrent(command: unknown, route: HookRoute): boolean {
82
83
  return typeof command === "string" && (command.trim() === hookCommand(route)
83
- || cachedHookLauncher(command, route, join(configDir(), "runtime-updates"), runtimeVersion(repoRoot), hookNodeCommand(route)));
84
+ || hookLaunchesRuntime(command, route, repoRoot, runtimeVersion(repoRoot), join(configDir(), "runtime-updates")));
84
85
  }
85
86
 
86
87
  export type InstallResult = { status: "installed" | "already" | "manual"; detail: string };
@@ -12,9 +12,21 @@ that require `node` on PATH; the changed definitions require native hook review.
12
12
  The launcher path can still survive runtime updates when the Node command is
13
13
  unchanged. Other providers keep their existing hook definitions.
14
14
 
15
- Public entries: `publishStableNode` and `hookNodeCommand`. Windows gets no link.
15
+ Which Node reads a Codex hook does not decide whether it is installed: the
16
+ monitor and the MCP server a chat starts can run on different Node versions, and
17
+ the hook names the one setup ran on. `hookNodeAccepted` takes any existing
18
+ executable named `node` (`node.exe` on Windows) given by an absolute, quoted
19
+ path, the stable link included; a path that is gone or names another program is
20
+ not accepted. Every other check stands: the route, the exact shape setup writes,
21
+ and a launcher that is this runtime or a valid cached one not newer than it
22
+ (`hookLaunchesRuntime`). Setup leaves such a command as written, so the trust
23
+ Codex keeps for that exact command is not voided.
24
+
25
+ Public entries: `publishStableNode`, `hookNodeCommand`, `hookNodeAccepted` and
26
+ `hookLaunchesRuntime`. Windows gets no link.
16
27
  A storage failure never stops the monitor from starting. Tests run the published
17
- link and cover replacement, Windows, and an unwritable folder.
28
+ link and cover replacement, Windows, and an unwritable folder;
29
+ `tests/install/codex-hook-node.test.ts` reads a hook set up under another Node.
18
30
 
19
31
  License: this module is distributed under the GrantTap Commercial Source License
20
32
  in the repository-root `LICENSE` file.
@@ -1,6 +1,7 @@
1
- import { mkdirSync, readlinkSync, renameSync, rmSync, symlinkSync } from "node:fs";
2
- import { join } from "node:path";
1
+ import { accessSync, constants, mkdirSync, readlinkSync, renameSync, rmSync, statSync, symlinkSync } from "node:fs";
2
+ import { basename, join, resolve, win32 } from "node:path";
3
3
  import { configDir } from "../../config";
4
+ import { cachedHookLauncher, hookLauncherParts } from "../../runtime-updates/selection.mjs";
4
5
 
5
6
  /** User Codex hooks run outside the plugin PATH, including apps started from the Dock. */
6
7
  export function hookNodeCommand(route: string, nodePath = process.execPath,
@@ -11,6 +12,51 @@ export function hookNodeCommand(route: string, nodePath = process.execPath,
11
12
  return `"${escaped}"`;
12
13
  }
13
14
 
15
+ /** The path a quoted Node token names, undone the way `hookNodeCommand` escaped it. */
16
+ function quotedPath(token: string, platform: NodeJS.Platform): string | undefined {
17
+ if (token.length < 3 || !token.startsWith('"') || !token.endsWith('"')) return undefined;
18
+ const inner = token.slice(1, -1);
19
+ return platform === "win32" ? inner.replaceAll('""', '"') : inner.replace(/\\(["\\$`])/g, "$1");
20
+ }
21
+
22
+ /**
23
+ * Whether a hook's Node token is one its route may run with. Other providers keep plain `node`. A
24
+ * Codex hook names a Node by absolute path, and which one was the setup's: the monitor and the MCP
25
+ * server a chat starts can run on different Node versions, and one of them reading the hook must
26
+ * not call the other's hook missing. Any existing executable named `node` by an absolute, quoted
27
+ * path qualifies, the stable link in the configuration folder included; a path that is gone does not.
28
+ */
29
+ export function hookNodeAccepted(route: string, token: string, nodePath = process.execPath,
30
+ platform: NodeJS.Platform = process.platform): boolean {
31
+ if (route !== "codex" && route !== "codex-policy") return token === "node";
32
+ if (token === hookNodeCommand(route, nodePath, platform)) return true;
33
+ const path = quotedPath(token, platform);
34
+ if (!path) return false;
35
+ const windows = platform === "win32";
36
+ const absolute = windows ? win32.isAbsolute(path) && /^[A-Za-z]:[\\/]/.test(path) : path.startsWith("/");
37
+ const name = windows ? win32.basename(path).toLowerCase() : basename(path);
38
+ if (!absolute || name !== (windows ? "node.exe" : "node")) return false;
39
+ try {
40
+ if (!statSync(path).isFile()) return false;
41
+ if (!windows) accessSync(path, constants.X_OK);
42
+ return true;
43
+ } catch {
44
+ return false;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * A hook command for `route` that launches the runtime in `root`, or an earlier cached launcher that
50
+ * hands off to it (`current` is that runtime's version), with a Node the route accepts.
51
+ */
52
+ export function hookLaunchesRuntime(command: unknown, route: string, root: string, current: string,
53
+ cache = join(configDir(), "runtime-updates")): boolean {
54
+ const node = (token: string) => hookNodeAccepted(route, token);
55
+ const parts = hookLauncherParts(command);
56
+ if (parts && parts.route === route && node(parts.node) && resolve(parts.root) === resolve(root)) return true;
57
+ return cachedHookLauncher(command, route, cache, current, node);
58
+ }
59
+
14
60
  function currentTarget(link: string): string | undefined {
15
61
  try { return readlinkSync(link); } catch { return undefined; }
16
62
  }
@@ -2,6 +2,7 @@ import { execFile } from "node:child_process";
2
2
  import { promisify } from "node:util";
3
3
  import { recordCommandProcessSample } from "../command-process/history";
4
4
  import { captureHelperRuns, helperRunProcesses } from "../../helper-runs/capture";
5
+ import { captureStartedRuns, startedRunProcesses } from "../../started-by/capture";
5
6
  import { sampleProcessRows } from "./ps-reader";
6
7
  import { attributeByAncestry, processDetail, processGroupName } from "./process-ownership";
7
8
  export { executableOf, processGroupName, processDetail } from "./process-ownership";
@@ -227,6 +228,8 @@ export async function sampleAgentProcesses(): Promise<Record<string, AgentProces
227
228
  const ownership = attributeByAncestry(rows);
228
229
  // A helper run lives for half a minute; this sample may be the only one that sees its process.
229
230
  await captureHelperRuns(helperRunProcesses(rows, ownership, sessions));
231
+ // So is a chat another chat runs headless: only its live process names the chat that started it.
232
+ await captureStartedRuns(startedRunProcesses(rows, ownership, sessions, sampledAt));
230
233
  recordCommandProcessSample(rows.flatMap((row) => {
231
234
  const agent = ownership.agents.get(row.pid);
232
235
  if (!agent) return [];
@@ -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,9 +6,17 @@ 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. Apple clients partition workspace Tasks
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
 
15
+ A chat another chat started (`startedBy`) whose folder is no checkout of its
16
+ own is placed in its parent's Mesh and binds nothing for its folder; parents are
17
+ linked first within a batch
18
+ ([chats started by another chat](../../started-by/README.md)).
19
+
12
20
  Git facts are shared only within one catalog batch. The next reading refreshes
13
21
  the root, origin, worktree, and revision, including a workspace which becomes an
14
22
  empty Git repository before its first commit or later gains an origin. Neither
@@ -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
- bindings: BindingValue[],
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);