vantage-peers-mcp 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.1.0] — 2026-11-25
6
+
7
+ A minor release: two new read tools. No existing tool input or output changes. Each entry names the product it concerns.
8
+
9
+ ### Added
10
+
11
+ - Cloud and Self-host: `get_repo_route` reads who owns and who reviews one GitHub repository in your organisation: `routed` (owner and reviewer), `unreviewed` (owner, no reviewer) or `absent` (no row), always a typed state, never an empty reply. Another organisation's row answers `absent`. ([Tool inputs and outputs](README.md#tool-inputs-and-outputs))
12
+ - Cloud and Self-host: `check_repo_routing` takes your organisation's real repository list and returns which repos are `routed`, `unreviewed`, `missing` (no row) and `stale` (a row for a repo not in your list), with `complete` true only when the last three are empty. It reads every page of your routing table. ([Tool inputs and outputs](README.md#tool-inputs-and-outputs))
13
+
14
+ ### Changed
15
+
16
+ - Self-host: the server calls one more backend function, `githubRepoMapping:getRoute` (154 called functions, 5.0.3: 153); the required backend contract stays 30. A backend that lacks `getRoute` is refused at start, naming it. Deploy the backend of this release first, then upgrade this package. ([Backend compatibility check](README.md#backend-compatibility-check))
17
+
18
+ ## [5.0.3] — 2026-11-25
19
+
20
+ A patch release. Tool inputs and outputs are unchanged. Each entry names the product it concerns.
21
+
22
+ ### Fixed
23
+
24
+ - Cloud and Self-host: `get_tool_usage` and `get_owner_tool_usage` serve a master-scope caller that has a verified agent ID. Such a caller got `RBAC_DENIED` (`claimless-service-account`) because it resolves no organisation; it now sends its agent as the claim, never beside an organisation claim. Organisation seats, person sessions and a master with no agent ID are unchanged. ([Tool inputs and outputs](README.md#tool-inputs-and-outputs))
25
+
26
+ ### Changed
27
+
28
+ - Self-host: the server requires backend contract version 30 (5.0.2: 29); the 153 called functions are unchanged. A backend of contract 29 is refused at start. Deploy the backend of this release first, then upgrade this package. ([Backend compatibility check](README.md#backend-compatibility-check))
29
+
30
+ ## [5.0.2] — 2026-11-24
31
+
32
+ A patch release. Tool inputs and outputs are unchanged. Each entry names the product it concerns.
33
+
34
+ ### Fixed
35
+
36
+ - Cloud and Self-host: `next_task` works for a master-scope caller. Such a caller got `RBAC_DENIED` (`claimless-service-account`) because it resolves no organisation and sent no claim. A master caller with a verified agent ID now sends that agent (`verifiedActor`), and the backend judges it as an agent of the operator organisation. An organisation seat still sends its organisation only and is still refused for another organisation's assignee. A Clerk session sends no claim. A master caller with no agent ID is still refused. `get_tool_usage` and `get_owner_tool_usage` are unchanged here: their backend doors do not yet accept an agent claim. ([Tool inputs and outputs](README.md#tool-inputs-and-outputs))
37
+ - Self-host: no backend change. The required backend contract stays 29 with 153 called functions. ([Backend compatibility check](README.md#backend-compatibility-check))
38
+
5
39
  ## [5.0.1] — 2026-11-24
6
40
 
7
41
  A patch release. Tool inputs are unchanged, and so are the outputs for a backend that answers its contract. Each entry names the product it concerns.
package/README.md CHANGED
@@ -182,7 +182,7 @@ An agent is identified by its **agent ID** (the `agentId` that `list_peers` retu
182
182
  _Applies to: Cloud and Self-host._
183
183
 
184
184
  <!-- tools:start -->
185
- 95 tools are advertised to clients. This reference is generated from the server's own `tools/list` by `scripts/print-tools.mjs`; do not edit it by hand.
185
+ 97 tools are advertised to clients. This reference is generated from the server's own `tools/list` by `scripts/print-tools.mjs`; do not edit it by hand.
186
186
 
187
187
  ### Memory and search (10)
188
188
 
@@ -230,11 +230,9 @@ _Applies to: Cloud and Self-host._
230
230
  - `resume_recurring_task` (write) — Resume a paused recurring task template and recalculate its next scheduled run time.
231
231
  - `update_recurring_task` (write) — Update a recurring task template's fields; cronExpression change auto-recalculates nextRunAt.
232
232
 
233
- ### Tasks (18)
233
+ ### Tasks (17)
234
234
 
235
235
  - `add_task_dependency` (write) — Add dependency task IDs to a task so it cannot start until all listed tasks complete.
236
- - `next_task` (read) — Get the one task an agent should take next: its first todo task in queue order whose dependencies are all done, or an explicit `found: false`.
237
- - `reorder_queue` (write) — Set the explicit work queue of one agent: the listed tasks get ranks 1..N, every other open task of that agent loses its rank, and an empty list clears the queue.
238
236
  - `block_task` (write, destructive) — Mark a task as blocked with an optional reason and blocking task IDs, setting status to blocked.
239
237
  - `bulk_complete_tasks` (write) — Bulk-close the open tasks matching a filter, in one atomic mutation.
240
238
  - `checkout_task` (write) — Atomically claim a todo task, preventing race conditions when multiple orchestrators compete.
@@ -244,7 +242,8 @@ _Applies to: Cloud and Self-host._
244
242
  - `delete_task` (write, destructive) — Permanently delete a task; only the creator or system role may delete.
245
243
  - `fail_task` (write) — Mark a task as failed (a terminal state distinct from done/cancelled) with a mandatory failureNote describing how the work ended.
246
244
  - `get_task` (read) — Fetch one task by its taskId.
247
- - `list_tasks` (read) — List tasks with optional filters by assignee, status, project, or creator, newest first; `sort: "queue"` orders by the assignee's explicit queue.
245
+ - `list_tasks` (read) — List tasks with optional filters by assignee, status, project, or creator, newest first.
246
+ - `next_task` (read) — Get the one task an agent should take next: among its todo tasks you may see, the first in queue order (ranked tasks by rank, then unranked by priority and age) whose dependencies are all done.
248
247
  - `pause_task` (write) — Close the task's open work segment and stop the duration clock, without ending the task.
249
248
  - `resume_task` (write) — Open a new work segment on a paused task and set it back to in_progress.
250
249
  - `search_tasks_by_keyword` (read) — BM25 full-text keyword search over task titles, ranked by relevance.
@@ -300,9 +299,10 @@ _Applies to: Cloud and Self-host._
300
299
  - `export_okf_bundle` (write) — Export a VantagePeers namespace as an OKF v0.1 bundle (tarball).
301
300
  - `import_okf_bundle` (write) — Import an OKF v0.1 bundle (memories + briefing-notes + tasks) into a target VantagePeers namespace.
302
301
 
303
- ### Other (15)
302
+ ### Other (18)
304
303
 
305
304
  - `add_repo_mapping` (write) — Register or update a GitHub repo to orchestrator mapping for webhook event routing.
305
+ - `check_repo_routing` (read) — Check that a list of repos is fully routed in your organisation, against the org's whole routing table.
306
306
  - `claim_upload` (write) — Claim an uploaded blob for your organisation with the single-use ticket generate_upload_url returned.
307
307
  - `debate_get_room` (read) — Read a debate room: its subject, frozen template, pointer and the full transcript.
308
308
  - `debate_post_turn` (write) — Post your answer to the debate-room turn you were asked for; the only way a turn enters a room.
@@ -311,11 +311,13 @@ _Applies to: Cloud and Self-host._
311
311
  - `get_bulk_complete_run` (read) — Read the status of one live bulk_complete_tasks run by the `bulkRunId` its first call returned.
312
312
  - `get_github_owner_bindings` (read) — List the GitHub owners bound to your organisation (master: all), and for master the org-owned repo mappings that have no proof.
313
313
  - `get_owner_tool_usage` (read) — List which MCP tools a person has used across all the agents it owns (one per AI client) and its own direct calls, summed per tool with the earliest first call and the latest last call.
314
+ - `get_repo_route` (read) — Get the review route of one GitHub repo in your organisation: routed, unreviewed or absent.
314
315
  - `get_tool_usage` (read) — List which MCP tools a caller has called, with the first call time, the last call time and the call count of each.
315
316
  - `improvisation_digest` (read) — Audit a rolling window of recent closed-task notes, messages and memories for claims about fleet state (a commit SHA, a PR number, a VantagePeers ID, or a decisive verb such as merged, deployed or approved) that carry no source citation line (a 'recall("<query>")→[ids]' or 'none-needed: <reason>' marker).
316
317
  - `list_blocked_on_me` (read) — List the tasks that other peers have BLOCKED on one of YOUR live tasks (blockedOnTaskId), oldest wait first, with the age of each wait.
317
318
  - `list_repo_mappings` (read) — List all GitHub repo to orchestrator webhook mappings, newest first with cursor paging support.
318
319
  - `remove_repo_mapping` (write, destructive) — Delete a GitHub repo mapping by repo name, stopping webhook event routing for that repo.
320
+ - `reorder_queue` (write) — Set the explicit work queue of one agent: the listed tasks get ranks 1..N in the order given (1 = next), and every other open task of that agent loses its rank.
319
321
  - `whoami` (read) — Report who this connection acts as and what it may read and write, read from its own credential only.
320
322
 
321
323
  The tools below are present in the server code but disabled in this release: a client can neither list nor call them. They are named so this reference matches the code exactly.
@@ -399,14 +401,35 @@ _Applies to: Self-host._
399
401
  Before it serves anything, the server asks your backend for its contract manifest (`meta:backendContract`) and refuses to start, with a log line beginning `BACKEND INCOMPATIBLE (<reason>)`, when:
400
402
 
401
403
  - the backend has no manifest (it predates this check);
402
- - the backend's contract version is below **29**, the version this release requires;
403
- - any of the **153** backend functions this release calls is missing (they are named in the log);
404
+ - the backend's contract version is below **30**, the version this release requires;
405
+ - any of the **154** backend functions this release calls is missing (they are named in the log);
404
406
  - the server cannot present its service identity, or the backend refuses it.
405
407
 
406
408
  So upgrade in this order: deploy the backend of the same release first, then upgrade this package. The check sees a missing function, not a changed argument; the contract version covers that.
407
409
 
408
410
  ## Release notes
409
411
 
412
+ ### 5.1.0
413
+
414
+ _Applies to: Cloud and Self-host._ A minor release: two new read tools; existing tools are unchanged.
415
+
416
+ - Cloud and Self-host: `get_repo_route` reads the review route of one repository (routed, unreviewed or absent) and `check_repo_routing` checks a repository list against your organisation's routing table (routed, unreviewed, missing, stale) (see [Tool inputs and outputs](#tool-inputs-and-outputs)).
417
+ - Self-host: one more called backend function (`githubRepoMapping:getRoute`, 154 in all), contract still 30; deploy the backend first (see [Backend compatibility check](#backend-compatibility-check)).
418
+
419
+ ### 5.0.3
420
+
421
+ _Applies to: Cloud and Self-host._ A patch release: tool inputs and outputs are unchanged.
422
+
423
+ - Cloud and Self-host: `get_tool_usage` and `get_owner_tool_usage` serve a master-scope caller that has a verified agent ID, which now sends the agent as its claim; organisation seats are unchanged (see [Tool inputs and outputs](#tool-inputs-and-outputs)).
424
+ - Self-host: the backend contract required moves from 29 to 30, with the same 153 called functions; deploy the backend first (see [Backend compatibility check](#backend-compatibility-check)).
425
+
426
+ ### 5.0.2
427
+
428
+ _Applies to: Cloud and Self-host._ A patch release: tool inputs and outputs are unchanged.
429
+
430
+ - Cloud and Self-host: `next_task` serves a master-scope caller that has a verified agent ID. That caller now sends the agent as its claim; organisation seats are unchanged (see [Tool inputs and outputs](#tool-inputs-and-outputs)).
431
+ - Self-host: no backend change; contract 29, 153 called functions (see [Backend compatibility check](#backend-compatibility-check)).
432
+
410
433
  ### 5.0.1
411
434
 
412
435
  _Applies to: Cloud and Self-host._ A patch release: tool inputs are unchanged, and so are the outputs for a backend that answers its contract.
@@ -528,7 +551,7 @@ Full history: [CHANGELOG.md](https://github.com/vantageos-agency/vantage-peers/b
528
551
 
529
552
  _Applies to: Self-host._
530
553
 
531
- Node.js 26.12.1 (the October 2026 security release), for the Self-host stdio server and the `vantage-peers-mcp/api` exports: `engines.node` names that exact version. A backend of the same release (contract version 29, see [Backend compatibility check](#backend-compatibility-check)). VantagePeers Cloud clients need nothing installed.
554
+ Node.js 26.12.1 (the October 2026 security release), for the Self-host stdio server and the `vantage-peers-mcp/api` exports: `engines.node` names that exact version. A backend of the same release (contract version 30, see [Backend compatibility check](#backend-compatibility-check)). VantagePeers Cloud clients need nothing installed.
532
555
 
533
556
  ## License
534
557
 
package/dist/src/auth.js CHANGED
@@ -421,7 +421,9 @@ export function resolveSeatOrg(ctx) {
421
421
  // (`oauth:getAccessTokenByHash`), never from an argument. Forwarded so the
422
422
  // Convex door keys the seat by ID, not by the reusable label. Only the token
423
423
  // path carries it; an agent-credential-only seat forwards the label alone.
424
- const orgClerkId = fromToken !== undefined && ctx.orgClerkId !== undefined && ctx.orgClerkId !== ""
424
+ const orgClerkId = fromToken !== undefined &&
425
+ ctx.orgClerkId !== undefined &&
426
+ ctx.orgClerkId !== ""
425
427
  ? ctx.orgClerkId
426
428
  : undefined;
427
429
  return {
@@ -39,7 +39,7 @@
39
39
  * to it -- write the literal.
40
40
  */
41
41
  /** Contract version this MCP build requires from the backend. */
42
- export declare const REQUIRED_CONTRACT_VERSION = 29;
42
+ export declare const REQUIRED_CONTRACT_VERSION = 30;
43
43
  /** Every public Convex function this MCP build calls (`module:function`). */
44
44
  export declare const MCP_CALLED_FUNCTIONS: readonly string[];
45
45
  export type BackendCompatFailure = "no-manifest" | "refused" | "cannot-authenticate" | "version-too-old" | "malformed" | "missing-functions" | "unreachable";
@@ -39,7 +39,7 @@
39
39
  * to it -- write the literal.
40
40
  */
41
41
  /** Contract version this MCP build requires from the backend. */
42
- export const REQUIRED_CONTRACT_VERSION = 29;
42
+ export const REQUIRED_CONTRACT_VERSION = 30;
43
43
  /** Every public Convex function this MCP build calls (`module:function`). */
44
44
  export const MCP_CALLED_FUNCTIONS = [
45
45
  "agentCredentials:resolveAgentCredential",
@@ -78,6 +78,7 @@ export const MCP_CALLED_FUNCTIONS = [
78
78
  "githubOwnerBinding:listUnprovenMappings",
79
79
  "githubRepoMapping:add",
80
80
  "githubRepoMapping:getByRepo",
81
+ "githubRepoMapping:getRoute",
81
82
  "githubRepoMapping:list",
82
83
  "githubRepoMapping:remove",
83
84
  "improvisationDigest:scanWindow",
@@ -70,6 +70,7 @@ export const DOOR_SCOPE = {
70
70
  "businessUnits:remove": { verifiedOrg: "always" },
71
71
  // GitHub repo mappings
72
72
  "githubRepoMapping:list": { verifiedOrg: "always" },
73
+ "githubRepoMapping:getRoute": { verifiedOrg: "always" },
73
74
  "githubRepoMapping:add": { verifiedOrg: "always" },
74
75
  "githubRepoMapping:remove": { verifiedOrg: "always" },
75
76
  // knowledge base: a seat reaches these as the service account, so the org it
@@ -277,7 +277,9 @@ async function checkPrClaims(text, deps, warn) {
277
277
  const matches = [];
278
278
  for (const line of text.split("\n")) {
279
279
  const explicit = [...line.matchAll(PR_CLAIM_RE)];
280
- matches.push(...(explicit.length > 0 ? explicit : [...line.matchAll(GH_PR_CMD_CLAIM_RE)]));
280
+ matches.push(...(explicit.length > 0
281
+ ? explicit
282
+ : [...line.matchAll(GH_PR_CMD_CLAIM_RE)]));
281
283
  }
282
284
  for (const m of matches) {
283
285
  const [, number, repoInClaim, typedStateRaw] = m;
@@ -436,13 +438,15 @@ export async function guardFreshState(content, deps) {
436
438
  return;
437
439
  if (OVERRIDE_RE.test(content))
438
440
  return;
439
- const warn = deps.warn ?? ((message) => console.warn(`[fresh-state-guard] ${message}`));
441
+ const warn = deps.warn ??
442
+ ((message) => console.warn(`[fresh-state-guard] ${message}`));
440
443
  const scope = evidenceScope(content);
441
444
  if (!scope.trim())
442
445
  return;
443
446
  // Bare-literal check, before any network call: a refusal that needs no
444
447
  // live read cannot be turned into a pass by an unreachable registry.
445
- const log = deps.log ?? ((message) => console.error(`[fresh-state-guard] ${message}`));
448
+ const log = deps.log ??
449
+ ((message) => console.error(`[fresh-state-guard] ${message}`));
446
450
  const lines = scope.split("\n");
447
451
  let firstBare;
448
452
  let any = false;
@@ -515,6 +515,26 @@ export declare const removeRepoMappingServedOutputSchema: z.ZodObject<{
515
515
  repo: z.ZodString;
516
516
  deleted: z.ZodBoolean;
517
517
  }, z.core.$loose>;
518
+ /** get_repo_route: the typed route state of one repo (routed | unreviewed | absent). */
519
+ export declare const getRepoRouteServedOutputSchema: z.ZodObject<{
520
+ state: z.ZodEnum<{
521
+ routed: "routed";
522
+ unreviewed: "unreviewed";
523
+ absent: "absent";
524
+ }>;
525
+ repo: z.ZodString;
526
+ owner: z.ZodOptional<z.ZodString>;
527
+ reviewer: z.ZodOptional<z.ZodString>;
528
+ fallbackReviewer: z.ZodOptional<z.ZodString>;
529
+ }, z.core.$loose>;
530
+ /** check_repo_routing: the completeness verdict of a repo list against the org's routing table. */
531
+ export declare const checkRepoRoutingServedOutputSchema: z.ZodObject<{
532
+ routed: z.ZodArray<z.ZodString>;
533
+ unreviewed: z.ZodArray<z.ZodString>;
534
+ missing: z.ZodArray<z.ZodString>;
535
+ stale: z.ZodArray<z.ZodString>;
536
+ complete: z.ZodBoolean;
537
+ }, z.core.$loose>;
518
538
  /** validate_fix. */
519
539
  export declare const validateFixServedOutputSchema: z.ZodObject<{
520
540
  patternId: z.ZodString;
@@ -889,6 +889,43 @@ export const removeRepoMappingServedOutputSchema = z.looseObject({
889
889
  .boolean()
890
890
  .describe("True when a mapping was removed; false when none existed for that repo."),
891
891
  });
892
+ /** get_repo_route: the typed route state of one repo (routed | unreviewed | absent). */
893
+ export const getRepoRouteServedOutputSchema = z.looseObject({
894
+ state: z
895
+ .enum(["routed", "unreviewed", "absent"])
896
+ .describe("routed: an owner and a reviewer are named; unreviewed: an owner is named and no reviewer; absent: your organisation has no mapping for this repo."),
897
+ repo: z.string().describe("The repo the call was for, as 'owner/name'."),
898
+ owner: z
899
+ .string()
900
+ .optional()
901
+ .describe("The orchestrator that receives the repo's events; absent when the state is absent."),
902
+ reviewer: z
903
+ .string()
904
+ .optional()
905
+ .describe("Who reviews the repo's pull requests; present only when the state is routed."),
906
+ fallbackReviewer: z
907
+ .string()
908
+ .optional()
909
+ .describe("Who reviews when the reviewer is stopped; present only when one was set."),
910
+ });
911
+ /** check_repo_routing: the completeness verdict of a repo list against the org's routing table. */
912
+ export const checkRepoRoutingServedOutputSchema = z.looseObject({
913
+ routed: z
914
+ .array(z.string())
915
+ .describe("Repos of your list that have an owner and a reviewer."),
916
+ unreviewed: z
917
+ .array(z.string())
918
+ .describe("Repos of your list that have an owner and no reviewer."),
919
+ missing: z
920
+ .array(z.string())
921
+ .describe("Repos of your list that your organisation has no mapping for."),
922
+ stale: z
923
+ .array(z.string())
924
+ .describe("Repos mapped by your organisation that are not in your list."),
925
+ complete: z
926
+ .boolean()
927
+ .describe("True only when missing, unreviewed and stale are all empty."),
928
+ });
892
929
  /** validate_fix. */
893
930
  export const validateFixServedOutputSchema = z.looseObject({
894
931
  patternId: rowId("The fix pattern that was validated."),
@@ -254,12 +254,12 @@ export declare const updateTaskStatusSchema: z.ZodEnum<{
254
254
  cancelled: "cancelled";
255
255
  }>;
256
256
  export declare const missionStatusSchema: z.ZodEnum<{
257
+ complete: "complete";
257
258
  cancelled: "cancelled";
258
259
  brainstorm: "brainstorm";
259
260
  plan: "plan";
260
261
  execute: "execute";
261
262
  validate: "validate";
262
- complete: "complete";
263
263
  }>;
264
264
  export declare const taskStatusFilterSchema: z.ZodPreprocess<z.ZodPipe<z.ZodArray<z.ZodEnum<{
265
265
  [x: string]: string;
@@ -595,11 +595,11 @@ export declare const createMissionOutputSchema: z.ZodObject<{
595
595
  project: z.ZodString;
596
596
  pilot: z.ZodString;
597
597
  status: z.ZodEnum<{
598
+ complete: "complete";
598
599
  brainstorm: "brainstorm";
599
600
  plan: "plan";
600
601
  execute: "execute";
601
602
  validate: "validate";
602
- complete: "complete";
603
603
  }>;
604
604
  }, z.core.$strip>;
605
605
  export declare const listMissionsOutputSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>, z.ZodObject<{
@@ -615,11 +615,11 @@ export declare const updateMissionOutputSchema: z.ZodObject<{
615
615
  export declare const updateMissionStatusOutputSchema: z.ZodObject<{
616
616
  missionId: z.ZodString;
617
617
  status: z.ZodEnum<{
618
+ complete: "complete";
618
619
  brainstorm: "brainstorm";
619
620
  plan: "plan";
620
621
  execute: "execute";
621
622
  validate: "validate";
622
- complete: "complete";
623
623
  }>;
624
624
  }, z.core.$strip>;
625
625
  export declare const writeDiaryOutputSchema: z.ZodObject<{
@@ -726,6 +726,8 @@ export declare const listRepoMappingsOutputSchema: z.ZodUnion<readonly [z.ZodArr
726
726
  nextCursor: z.ZodNullable<z.ZodString>;
727
727
  }, z.core.$strip>]>;
728
728
  export declare const removeRepoMappingOutputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
729
+ export declare const getRepoRouteOutputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
730
+ export declare const checkRepoRoutingOutputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
729
731
  export declare const listIssuesOutputSchema: z.ZodObject<{
730
732
  count: z.ZodNumber;
731
733
  issues: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
package/dist/src/tools.js CHANGED
@@ -20,7 +20,7 @@ import { listTasksGate } from "./list-tasks-gate.js";
20
20
  import { listContract } from "./listContract.js";
21
21
  import { refuseUnissuedListCursors } from "./listCursor.js";
22
22
  import { memberAuthorLabel } from "./memberAuthor.js";
23
- import { addFixAttemptServedOutputSchema, addRepoMappingServedOutputSchema, addTaskDependencyServedOutputSchema, billingSummaryByProjectServedOutputSchema, blockTaskServedOutputSchema, briefingNoteUpdatedServedOutputSchema, bulkCompleteTasksServedOutputSchema, checkMessagesServedOutputSchema, checkoutTaskServedOutputSchema, correctTaskSegmentServedOutputSchema, createBriefingNoteServedOutputSchema, createFixPatternServedOutputSchema, createMissionServedOutputSchema, createRecurringTaskServedOutputSchema, createTaskServedOutputSchema, debateGetRoomServedOutputSchema, debatePostTurnServedOutputSchema, deleteMessageServedOutputSchema, deletedServedOutputSchema, eraseMemoryServedOutputSchema, eraseFixPatternServedOutputSchema, eraseRowServedOutputSchema, getBriefingNoteServedOutputSchema, getBulkCompleteRunServedOutputSchema, getDiaryServedOutputSchema, getEpisodeServedOutputSchema, getFixPatternServedOutputSchema, getGithubOwnerBindingsServedOutputSchema, getMemoryServedOutputSchema, getMessageServedOutputSchema, getMissionServedOutputSchema, getMissionTemplateServedOutputSchema, getOwnerToolUsageServedOutputSchema, getProfileServedOutputSchema, getRecurringTaskServedOutputSchema, getTaskServedOutputSchema, getToolUsageServedOutputSchema, hybridSearchServedOutputSchema, improvisationDigestServedOutputSchema, instantiateTemplateIntoMissionServedOutputSchema, linkIssueToPatternServedOutputSchema, listBlockedOnMeServedOutputSchema, nextTaskServedOutputSchema, reorderQueueServedOutputSchema, listBriefingNotesServedOutputSchema, listBroadcastStatusServedOutputSchema, listDiariesServedOutputSchema, listEpisodesServedOutputSchema, listFixPatternsServedOutputSchema, listMemoriesServedOutputSchema, listMessagesServedOutputSchema, listMissionsServedOutputSchema, listPeersServedOutputSchema, listRecurringTasksServedOutputSchema, listRepoMappingsServedOutputSchema, listTasksByMissionServedOutputSchema, listTasksServedOutputSchema, markAsReadServedOutputSchema, missionStatusServedOutputSchema, missionUpdatedServedOutputSchema, pauseRecurringTaskServedOutputSchema, recallServedOutputSchema, removeRepoMappingServedOutputSchema, resumeRecurringTaskServedOutputSchema, searchBriefingNotesByKeywordServedOutputSchema, searchEpisodesByKeywordServedOutputSchema, searchEpisodesBySemanticServedOutputSchema, searchFixPatternsServedOutputSchema, searchMessagesByKeywordServedOutputSchema, searchTasksByKeywordServedOutputSchema, sendMessageServedOutputSchema, setSummaryServedOutputSchema, softDeleteMemoryServedOutputSchema, storeEpisodeServedOutputSchema, storeMemoryServedOutputSchema, taskClosedServedOutputSchema, taskStatusServedOutputSchema, taskUpdatedServedOutputSchema, textSearchServedOutputSchema, updateMissionTemplateServedOutputSchema, updateProfileServedOutputSchema, updateRecurringTaskServedOutputSchema, validateFixServedOutputSchema, writeDiaryServedOutputSchema, } from "./outputSchemas.js";
23
+ import { addFixAttemptServedOutputSchema, addRepoMappingServedOutputSchema, addTaskDependencyServedOutputSchema, billingSummaryByProjectServedOutputSchema, blockTaskServedOutputSchema, briefingNoteUpdatedServedOutputSchema, bulkCompleteTasksServedOutputSchema, checkMessagesServedOutputSchema, checkoutTaskServedOutputSchema, correctTaskSegmentServedOutputSchema, createBriefingNoteServedOutputSchema, createFixPatternServedOutputSchema, createMissionServedOutputSchema, createRecurringTaskServedOutputSchema, createTaskServedOutputSchema, debateGetRoomServedOutputSchema, debatePostTurnServedOutputSchema, deleteMessageServedOutputSchema, deletedServedOutputSchema, eraseMemoryServedOutputSchema, eraseFixPatternServedOutputSchema, eraseRowServedOutputSchema, getBriefingNoteServedOutputSchema, getBulkCompleteRunServedOutputSchema, getDiaryServedOutputSchema, getEpisodeServedOutputSchema, getFixPatternServedOutputSchema, getGithubOwnerBindingsServedOutputSchema, getMemoryServedOutputSchema, getMessageServedOutputSchema, getMissionServedOutputSchema, getMissionTemplateServedOutputSchema, getOwnerToolUsageServedOutputSchema, getProfileServedOutputSchema, getRecurringTaskServedOutputSchema, getTaskServedOutputSchema, getToolUsageServedOutputSchema, hybridSearchServedOutputSchema, improvisationDigestServedOutputSchema, instantiateTemplateIntoMissionServedOutputSchema, linkIssueToPatternServedOutputSchema, listBlockedOnMeServedOutputSchema, nextTaskServedOutputSchema, reorderQueueServedOutputSchema, listBriefingNotesServedOutputSchema, listBroadcastStatusServedOutputSchema, listDiariesServedOutputSchema, listEpisodesServedOutputSchema, listFixPatternsServedOutputSchema, listMemoriesServedOutputSchema, listMessagesServedOutputSchema, listMissionsServedOutputSchema, listPeersServedOutputSchema, listRecurringTasksServedOutputSchema, listRepoMappingsServedOutputSchema, listTasksByMissionServedOutputSchema, listTasksServedOutputSchema, markAsReadServedOutputSchema, missionStatusServedOutputSchema, missionUpdatedServedOutputSchema, pauseRecurringTaskServedOutputSchema, recallServedOutputSchema, removeRepoMappingServedOutputSchema, getRepoRouteServedOutputSchema, checkRepoRoutingServedOutputSchema, resumeRecurringTaskServedOutputSchema, searchBriefingNotesByKeywordServedOutputSchema, searchEpisodesByKeywordServedOutputSchema, searchEpisodesBySemanticServedOutputSchema, searchFixPatternsServedOutputSchema, searchMessagesByKeywordServedOutputSchema, searchTasksByKeywordServedOutputSchema, sendMessageServedOutputSchema, setSummaryServedOutputSchema, softDeleteMemoryServedOutputSchema, storeEpisodeServedOutputSchema, storeMemoryServedOutputSchema, taskClosedServedOutputSchema, taskStatusServedOutputSchema, taskUpdatedServedOutputSchema, textSearchServedOutputSchema, updateMissionTemplateServedOutputSchema, updateProfileServedOutputSchema, updateRecurringTaskServedOutputSchema, validateFixServedOutputSchema, writeDiaryServedOutputSchema, } from "./outputSchemas.js";
24
24
  import { normalizeOrchestratorId } from "./normalizeOrchestratorId.js";
25
25
  import { clampLimit, decodeCursor, encodeCursor, invalidCursorResult, scopedPageContinuation, } from "./paging.js";
26
26
  import { isRefusedEnvelope } from "./refusal.js";
@@ -1623,6 +1623,10 @@ export const listRepoMappingsOutputSchema = z.union([
1623
1623
  ]);
1624
1624
  // remove_repo_mapping
1625
1625
  export const removeRepoMappingOutputSchema = z.record(z.string(), z.unknown());
1626
+ // get_repo_route
1627
+ export const getRepoRouteOutputSchema = z.record(z.string(), z.unknown());
1628
+ // check_repo_routing
1629
+ export const checkRepoRoutingOutputSchema = z.record(z.string(), z.unknown());
1626
1630
  // list_issues
1627
1631
  export const listIssuesOutputSchema = z.object({
1628
1632
  count: z.number(),
@@ -5567,7 +5571,7 @@ options) {
5567
5571
  });
5568
5572
  // ── reorder_queue ───────────────────────────────────────────────────────────
5569
5573
  defineTool(server, authCtx, {
5570
- kind: "filtered",
5574
+ kind: "public",
5571
5575
  reason: "unresolvedOrgDenial() refuses a bearer whose organisation cannot be resolved before any call; the caller gate itself is decided by its Convex door tasks:reorderQueue on the verified principal (a seat's verifiedActor, forwarded by the wrapped client): over MCP the callers that succeed are the assignee agent itself and a listed queue coordinator, in the assignee's own organisation; a person bearer carries no verifiedActor over MCP (withVerifiedActor returns the client unchanged when no agent ID resolves), so the door resolves the service-account session and refuses it, and an organisation admin acts from a signed-in session, not through this tool; the tool takes no acting name and relays the door's refusal unchanged (tasks k176p84j83gac7reyycweacyb58jvtxg, k17c5xftwzvtts05ban1dhxazs8jv4h6)",
5572
5576
  }, "reorder_queue", "Set the explicit work queue of one agent: the listed tasks get ranks 1..N in the order given (1 = next), and every other open task of that agent loses its rank. " +
5573
5577
  "A FULL REPLACEMENT: an empty taskIds clears the whole queue. The order is set without dependencies: a task listed before the task it depends on is still not handed out by next_task until its dependencies are done. " +
@@ -5629,8 +5633,8 @@ options) {
5629
5633
  });
5630
5634
  // ── next_task ───────────────────────────────────────────────────────────────
5631
5635
  defineTool(server, authCtx, {
5632
- kind: "filtered",
5633
- reason: "tenant applied INSIDE the Convex read: doorScopeArgs() forwards verifiedOrg on every call to tasks:nextForAssignee and unresolvedOrgDenial() refuses a bearer with none; tasks:nextForAssignee receives verifiedOrg (always) and no verifiedActor (the door admits an actor only from the operator organisation), resolves the assignee in that organisation only and serves the caller's visible tasks; a bearer whose organisation cannot be resolved is refused before any read (task k176p84j83gac7reyycweacyb58jvtxg)",
5636
+ kind: "public",
5637
+ reason: "decided by its Convex door tasks:nextForAssignee, which refuses an unresolved caller (requireResolvedCaller) and applies the tenant INSIDE the read: doorScopeArgs() forwards verifiedOrg on every call to tasks:nextForAssignee for a bearer that resolves an organisation, and unresolvedOrgDenial() refuses a non-master bearer with none; the fleet master, which resolves no organisation, is admitted by its verified agent ID instead: withVerifiedActor forwards verifiedActor (MASTER_ACTOR_CLAIM_DOORS) only for a master scope and only when no verifiedOrg rides the call, so the door judges it as an operator-organisation agent, and a master with no agent ID forwards no claim and is refused by the door (claimless-service-account); a client-organisation seat is never sent an actor; the door resolves the assignee in the claimed organisation only and serves the caller's visible tasks (tasks k176p84j83gac7reyycweacyb58jvtxg, k178q6x954qeh4mxh0b4x6sss98jtarn)",
5634
5638
  }, "next_task", "Get the one task an agent should take next: among its todo tasks you may see, the first in queue order (ranked tasks by rank, then unranked by priority and age) whose dependencies are all done. " +
5635
5639
  "Name the agent by assignedToAgentId (its agentId, as list_peers returns it) or by assignedTo (its name); one of the two is required. " +
5636
5640
  "Returns { found, task?{ _id, _creationTime, title, description?, status, priority, assignedTo, missionId?, queueRank? }, message? }: found is true with the task, or false with a message saying no task is pickable (an empty answer is stated, never silent). " +
@@ -5660,8 +5664,10 @@ options) {
5660
5664
  return mcpError("QUEUE_ASSIGNEE_REQUIRED: name the assignee: assignedTo (a name) or assignedToAgentId (an agent ID)");
5661
5665
  }
5662
5666
  // The organisation is forwarded on EVERY call (doorScopeArgs, verifiedOrg
5663
- // always): without it the backend would resolve the caller as the fleet
5664
- // master. A bearer with no resolvable organisation is refused here.
5667
+ // always for a bearer that resolves one): without it the backend would resolve
5668
+ // the caller as the fleet master. A non-master bearer with no resolvable
5669
+ // organisation is refused here; the master is claimed by its verified agent ID
5670
+ // (withVerifiedActor, MASTER_ACTOR_CLAIM_DOORS), never by a verifiedOrg.
5665
5671
  const orgDenied = unresolvedOrgDenial("next_task");
5666
5672
  if (orgDenied)
5667
5673
  return orgDenied;
@@ -8176,6 +8182,131 @@ options) {
8176
8182
  return mcpConvexError(error);
8177
8183
  }
8178
8184
  });
8185
+ // ── get_repo_route ──────────────────────────────────────────────────────────
8186
+ defineTool(server, authCtx, {
8187
+ kind: "public",
8188
+ reason: "decided by its Convex door githubRepoMapping:getRoute, which refuses an unresolved caller (requireResolvedCaller, alsoRefusePreOrg) and reads inside the caller's verified org: doorScopeArgs() forwards verifiedOrg, unresolvedOrgDenial() refuses a non-master bearer with none, another org's row answers absent",
8189
+ }, "get_repo_route", "Get the review route of one GitHub repo in your organisation: routed, unreviewed or absent. " +
8190
+ "Returns { state, repo, owner?, reviewer?, fallbackReviewer? }; absent is a typed state, never an empty reply. " +
8191
+ "WHEN: use to know who owns and who reviews a repo before opening a pull request, or why none is routed. " +
8192
+ "EXAMPLE: get_repo_route repo='vantageos-agency/vantage-peers'. " +
8193
+ "FR: Lire la route de revue d'un dépôt GitHub de votre organisation : routé, sans relecteur ou absent.", {
8194
+ repo: z
8195
+ .string()
8196
+ .min(1)
8197
+ .describe("The GitHub repository, as owner/name, e.g. 'vantageos-agency/vantage-peers'."),
8198
+ }, {
8199
+ outputSchema: getRepoRouteServedOutputSchema,
8200
+ readOnlyHint: true,
8201
+ idempotentHint: true,
8202
+ openWorldHint: false,
8203
+ destructiveHint: false,
8204
+ title: "Get repo route",
8205
+ }, async ({ repo }) => {
8206
+ try {
8207
+ const orgDenied = unresolvedOrgDenial("get_repo_route");
8208
+ if (orgDenied)
8209
+ return orgDenied;
8210
+ const route = (await convex.query("githubRepoMapping:getRoute", {
8211
+ repo,
8212
+ ...doorScopeArgs("githubRepoMapping:getRoute", undefined),
8213
+ }));
8214
+ if (route === null || typeof route !== "object" || typeof route.state !== "string") {
8215
+ return mcpError(`githubRepoMapping:getRoute returned no route state for ${repo}; refusing to report an empty success`);
8216
+ }
8217
+ const structured = { ...route, repo };
8218
+ return {
8219
+ content: [{ type: "text", text: JSON.stringify(structured, null, 2) }],
8220
+ structuredContent: structured,
8221
+ };
8222
+ }
8223
+ catch (error) {
8224
+ return mcpConvexError(error);
8225
+ }
8226
+ });
8227
+ // ── check_repo_routing ──────────────────────────────────────────────────────
8228
+ defineTool(server, authCtx, {
8229
+ kind: "public",
8230
+ reason: "decided by its Convex doors githubRepoMapping:getRoute and githubRepoMapping:list, which both refuse an unresolved caller (requireResolvedCaller) and read inside the caller's verified org: doorScopeArgs() forwards verifiedOrg on every call, unresolvedOrgDenial() refuses a non-master bearer with none",
8231
+ }, "check_repo_routing", "Check that a list of repos is fully routed in your organisation, against the org's whole routing table. " +
8232
+ "Returns { routed, unreviewed, missing, stale, complete }, each of the four a list of repos; stale are mapped repos not in your list, complete is true only when missing, unreviewed and stale are all empty. " +
8233
+ "WHEN: use after listing your real GitHub repos, to find repos with no owner, no reviewer, or a mapping for a repo that is gone. " +
8234
+ "EXAMPLE: check_repo_routing repos=['vantageos-agency/vantage-peers','vantageos-agency/vantage-registry']. " +
8235
+ "FR: Vérifier qu'une liste de dépôts est entièrement routée dans votre organisation.", {
8236
+ repos: z
8237
+ .array(z.string().min(1))
8238
+ .min(1)
8239
+ .max(500)
8240
+ .describe("The organisation's real repository list, each as owner/name. Duplicates are counted once."),
8241
+ }, {
8242
+ outputSchema: checkRepoRoutingServedOutputSchema,
8243
+ readOnlyHint: true,
8244
+ idempotentHint: true,
8245
+ openWorldHint: false,
8246
+ destructiveHint: false,
8247
+ title: "Check repo routing",
8248
+ }, async ({ repos }) => {
8249
+ try {
8250
+ const orgDenied = unresolvedOrgDenial("check_repo_routing");
8251
+ if (orgDenied)
8252
+ return orgDenied;
8253
+ const wanted = [...new Set(repos)];
8254
+ const routed = [];
8255
+ const unreviewed = [];
8256
+ const missing = [];
8257
+ const BATCH = 20;
8258
+ for (let i = 0; i < wanted.length; i += BATCH) {
8259
+ const batch = wanted.slice(i, i + BATCH);
8260
+ const answers = await Promise.all(batch.map((repo) => convex.query("githubRepoMapping:getRoute", {
8261
+ repo,
8262
+ ...doorScopeArgs("githubRepoMapping:getRoute", undefined),
8263
+ })));
8264
+ for (let j = 0; j < batch.length; j++) {
8265
+ const state = answers[j]?.state;
8266
+ if (state === "routed")
8267
+ routed.push(batch[j]);
8268
+ else if (state === "unreviewed")
8269
+ unreviewed.push(batch[j]);
8270
+ else if (state === "absent")
8271
+ missing.push(batch[j]);
8272
+ else {
8273
+ return mcpError(`githubRepoMapping:getRoute returned no route state for ${batch[j]}; refusing to report an incomplete check`);
8274
+ }
8275
+ }
8276
+ }
8277
+ // Every page of the org's table, until the door's cursor is exhausted.
8278
+ const known = new Set(wanted);
8279
+ const stale = [];
8280
+ let cursor;
8281
+ do {
8282
+ const page = (await convex.query("githubRepoMapping:list", {
8283
+ limit: 200,
8284
+ fields: "lite",
8285
+ cursor,
8286
+ ...doorScopeArgs("githubRepoMapping:list", undefined),
8287
+ }));
8288
+ const items = requireItems(page, "check_repo_routing", "githubRepoMapping:list");
8289
+ for (const row of items)
8290
+ if (!known.has(row.repo))
8291
+ stale.push(row.repo);
8292
+ cursor = typeof page.nextCursor === "string" ? page.nextCursor : undefined;
8293
+ } while (cursor !== undefined);
8294
+ const structured = {
8295
+ routed,
8296
+ unreviewed,
8297
+ missing,
8298
+ stale,
8299
+ complete: missing.length === 0 && unreviewed.length === 0 && stale.length === 0,
8300
+ };
8301
+ return {
8302
+ content: [{ type: "text", text: JSON.stringify(structured, null, 2) }],
8303
+ structuredContent: structured,
8304
+ };
8305
+ }
8306
+ catch (error) {
8307
+ return mcpConvexError(error);
8308
+ }
8309
+ });
8179
8310
  // ── get_github_owner_bindings ──────────────────────────────────────────────
8180
8311
  // oracle-disposition: CONSERVER — githubOwnerBindings is the proof an owner belongs to an org, the only basis on which a repo routes to it
8181
8312
  // oracle-justified: githubOwnerBindings rows carry the owning `orgId`. The tenant is resolved at the Convex
@@ -17,13 +17,28 @@
17
17
  // Pattern: Estimated: N or Estimated N ... // allow-time-estimate: pattern-definition-file
18
18
  const ESTIMATE_PATTERNS = [
19
19
  { re: /estimated?\s*:?\s*[~\d]/i, idx: 0 }, // allow-time-estimate: pattern-definition-file
20
- { re: /\b\d+\s*[-à]\s*\d+\s*(jour|jours|heure|heures|h|min|mn|mins|minutes|heures?|hours?)\b/i, idx: 1 }, // allow-time-estimate: pattern-definition-file
21
- { re: /~\s*\d+\s*\.?\d*\s*(min|mn|mins|minute|minutes|h|hour|hours|jour|jours|heure|heures|day|days)\b/i, idx: 2 }, // allow-time-estimate: pattern-definition-file
22
- { re: /\b\d+\s*\.?\d*\s*(min|mn|h|jour|jours|heure|heures|hour|hours|day|days)\s+(max|env|environ|approx|approximately)\b/i, idx: 3 }, // allow-time-estimate: pattern-definition-file
20
+ {
21
+ re: /\b\d+\s*[-à]\s*\d+\s*(jour|jours|heure|heures|h|min|mn|mins|minutes|heures?|hours?)\b/i,
22
+ idx: 1,
23
+ }, // allow-time-estimate: pattern-definition-file
24
+ {
25
+ re: /~\s*\d+\s*\.?\d*\s*(min|mn|mins|minute|minutes|h|hour|hours|jour|jours|heure|heures|day|days)\b/i,
26
+ idx: 2,
27
+ }, // allow-time-estimate: pattern-definition-file
28
+ {
29
+ re: /\b\d+\s*\.?\d*\s*(min|mn|h|jour|jours|heure|heures|hour|hours|day|days)\s+(max|env|environ|approx|approximately)\b/i,
30
+ idx: 3,
31
+ }, // allow-time-estimate: pattern-definition-file
23
32
  { re: /\bETA\s*:?\s*\d/, idx: 4 }, // allow-time-estimate: pattern-definition-file (case-sensitive — Eta proper noun exempted)
24
- { re: /\b\d+\s*\.?\d*\s*(?:min|mn|h|jour|jours|heure|heures|hour|hours|day|days)\s+de\s+(dev|revue|review|test|debug|coding|recherche|research|investigation|setup|implem|impl|implementation)/i, idx: 5 }, // allow-time-estimate: pattern-definition-file
33
+ {
34
+ re: /\b\d+\s*\.?\d*\s*(?:min|mn|h|jour|jours|heure|heures|hour|hours|day|days)\s+de\s+(dev|revue|review|test|debug|coding|recherche|research|investigation|setup|implem|impl|implementation)/i,
35
+ idx: 5,
36
+ }, // allow-time-estimate: pattern-definition-file
25
37
  { re: /^#+\s*estimated?\s*$/im, idx: 6 }, // allow-time-estimate: pattern-definition-file
26
- { re: /\b(?:effort|temps|time|durée|duration)\s*(?:estimé?|estimated?|prévu?|expected?)\s*:?\s*[~\d]/i, idx: 7 }, // allow-time-estimate: pattern-definition-file
38
+ {
39
+ re: /\b(?:effort|temps|time|durée|duration)\s*(?:estimé?|estimated?|prévu?|expected?)\s*:?\s*[~\d]/i,
40
+ idx: 7,
41
+ }, // allow-time-estimate: pattern-definition-file
27
42
  ];
28
43
  // Backward-context exemption for range pattern (idx=1)
29
44
  const RANGE_BACKWARD_CONTEXT_RE = /\b(?:créneau|creneau|window|shift|meeting|réunion|reunion|call|appel|slot|interval|range|history|past|hier|aujourd'hui|today|yesterday|il\s+y\s+a|duré|a\s+pris|took|lasted|spent)\b/i;
@@ -80,7 +80,11 @@ function checkVerificationTests(description, acc) {
80
80
  // ─────────────────────────────────────────────────────────────────────────────
81
81
  // Axis: delegation triplet (hard-block when partial)
82
82
  // ─────────────────────────────────────────────────────────────────────────────
83
- const DELEGATION_KEYS = ["subagent_type", "run_in_background", "model"];
83
+ const DELEGATION_KEYS = [
84
+ "subagent_type",
85
+ "run_in_background",
86
+ "model",
87
+ ];
84
88
  function checkDelegationTriplet(description, acc) {
85
89
  // Skip if [META] tag present (orchestrator meta-tasks exempt from delegation rules)
86
90
  if (/\[META\]/i.test(description))
@@ -302,7 +306,8 @@ function dispatchCompleteTask(payload, acc) {
302
306
  if (noteOk) {
303
307
  checkFriction(note, acc);
304
308
  }
305
- else if (note.trim().length >= 40 && !acc.errors.some((e) => e.field === "completionNote.evidence")) {
309
+ else if (note.trim().length >= 40 &&
310
+ !acc.errors.some((e) => e.field === "completionNote.evidence")) {
306
311
  checkFriction(note, acc);
307
312
  }
308
313
  }
@@ -15,6 +15,19 @@ export declare const VERIFIED_ACTOR_DOORS: ReadonlySet<string>;
15
15
  * its own rows (task k17a388w6d0cxmyw8gfk5tryp18hvw2k).
16
16
  */
17
17
  export declare const MASTER_UNNARROWED_DOORS: ReadonlySet<string>;
18
+ /**
19
+ * Doors that admit a `verifiedActor` ONLY from the operator organisation
20
+ * (requireFleetAgentActor behind requireClaimedCaller) and take the organisation of
21
+ * every other caller as `verifiedOrg` (doorScope). The actor is the claim of the
22
+ * caller that has NO `verifiedOrg`: the fleet master, whose bearer resolves no
23
+ * organisation, so the door would otherwise refuse it as a claimless service account
24
+ * (RBAC_DENIED claimless-service-account). It is forwarded for a master scope only,
25
+ * and only when no `verifiedOrg` rides the call, so a client-organisation seat (served
26
+ * by verifiedOrg) is never sent an actor the door would refuse, and the two claims
27
+ * never travel together. Every door here is pinned in test/next-task-claim.test.ts or
28
+ * test/tool-usage-claim.test.ts.
29
+ */
30
+ export declare const MASTER_ACTOR_CLAIM_DOORS: ReadonlySet<string>;
18
31
  export type VerifiedActorArg = {
19
32
  agentId: string;
20
33
  orgSlug: string;
@@ -37,10 +37,7 @@ export const VERIFIED_ACTOR_DOORS = new Set([
37
37
  "tasks:checkout",
38
38
  "tasks:deleteTask",
39
39
  "tasks:blockTask",
40
- // The queue write door: the caller is judged by its verified agent ID. tasks:nextForAssignee is
41
- // deliberately NOT here: it admits a verifiedActor only as an agent of the operator
42
- // organisation (requireFleetAgentActor), so a client-organisation seat is served by
43
- // verifiedOrg alone (doorScope), never refused for carrying an actor.
40
+ // The queue write door: the caller is judged by its verified agent ID.
44
41
  "tasks:reorderQueue",
45
42
  "tasks:bulkComplete",
46
43
  // The briefing-note doors (module M10c): the author of a note, and the editor
@@ -127,6 +124,25 @@ export const VERIFIED_ACTOR_DOORS = new Set([
127
124
  export const MASTER_UNNARROWED_DOORS = new Set([
128
125
  "fixPatterns:get",
129
126
  ]);
127
+ /**
128
+ * Doors that admit a `verifiedActor` ONLY from the operator organisation
129
+ * (requireFleetAgentActor behind requireClaimedCaller) and take the organisation of
130
+ * every other caller as `verifiedOrg` (doorScope). The actor is the claim of the
131
+ * caller that has NO `verifiedOrg`: the fleet master, whose bearer resolves no
132
+ * organisation, so the door would otherwise refuse it as a claimless service account
133
+ * (RBAC_DENIED claimless-service-account). It is forwarded for a master scope only,
134
+ * and only when no `verifiedOrg` rides the call, so a client-organisation seat (served
135
+ * by verifiedOrg) is never sent an actor the door would refuse, and the two claims
136
+ * never travel together. Every door here is pinned in test/next-task-claim.test.ts or
137
+ * test/tool-usage-claim.test.ts.
138
+ */
139
+ export const MASTER_ACTOR_CLAIM_DOORS = new Set([
140
+ "tasks:nextForAssignee",
141
+ // Contract 30 (PR #1764): both tool-usage reads admit an operator-org verifiedActor.
142
+ // Pinned in test/tool-usage-claim.test.ts.
143
+ "toolUsage:getToolUsage",
144
+ "toolUsage:usageByOwner",
145
+ ]);
130
146
  /**
131
147
  * The acting agent's ID and org for this request, or undefined.
132
148
  *
@@ -163,7 +179,13 @@ export function withVerifiedActor(convex, ctx) {
163
179
  return convex;
164
180
  const master = isMasterScope(ctx);
165
181
  const forward = (name, args) => {
166
- if (!VERIFIED_ACTOR_DOORS.has(name) ||
182
+ const masterActorClaim = MASTER_ACTOR_CLAIM_DOORS.has(name);
183
+ if ((!VERIFIED_ACTOR_DOORS.has(name) && !masterActorClaim) ||
184
+ (masterActorClaim &&
185
+ (!master ||
186
+ typeof args !== "object" ||
187
+ args === null ||
188
+ args.verifiedOrg !== undefined)) ||
167
189
  (master && MASTER_UNNARROWED_DOORS.has(name)) ||
168
190
  typeof args !== "object" ||
169
191
  args === null) {
@@ -71,7 +71,11 @@ export function deriveOpaqueCallerId(ctx, env) {
71
71
  */
72
72
  export function resolveActingAgent(ctx, verified) {
73
73
  if (!ctx) {
74
- return { actor: null, agent_id: null, agent_unresolved_reason: "no-context" };
74
+ return {
75
+ actor: null,
76
+ agent_id: null,
77
+ agent_unresolved_reason: "no-context",
78
+ };
75
79
  }
76
80
  const seat = !ctx.actor && verified !== undefined
77
81
  ? {
@@ -117,7 +121,12 @@ export function resolveActingAgent(ctx, verified) {
117
121
  }
118
122
  export function resolveWhoamiIdentity(ctx, env) {
119
123
  if (!ctx) {
120
- return { caller_id: null, org_slug: null, role: "legacy", acting_name: null };
124
+ return {
125
+ caller_id: null,
126
+ org_slug: null,
127
+ role: "legacy",
128
+ acting_name: null,
129
+ };
121
130
  }
122
131
  let role;
123
132
  if (isMasterScope(ctx))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vantage-peers-mcp",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "description": "MCP server for multi-agent teams: persistent memory, agent messaging, time-tracked tasks, missions",
5
5
  "type": "module",
6
6
  "main": "./dist/server.js",
@@ -7,6 +7,7 @@
7
7
  "block_task",
8
8
  "bulk_complete_tasks",
9
9
  "check_messages",
10
+ "check_repo_routing",
10
11
  "checkout_task",
11
12
  "claim_upload",
12
13
  "complete_task",
@@ -40,6 +41,7 @@
40
41
  "get_owner_tool_usage",
41
42
  "get_profile",
42
43
  "get_recurring_task",
44
+ "get_repo_route",
43
45
  "get_task",
44
46
  "get_tool_usage",
45
47
  "hybrid_search",