vantage-peers-mcp 5.0.0 → 5.0.1
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 +10 -0
- package/README.md +9 -1
- package/dist/src/tools.d.ts +14 -0
- package/dist/src/tools.js +144 -66
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.0.1] — 2026-11-24
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Cloud and Self-host: `reorder_queue` now names only the callers MCP admits: the assignee agent and a queue coordinator its organisation lists. A person bearer is refused; a person sets a queue from a signed-in session. The 5.0.0 description also named an organisation admin, which MCP never admitted. ([Tool inputs and outputs](README.md#tool-inputs-and-outputs))
|
|
12
|
+
- Cloud and Self-host: a backend reply that breaks its contract (null, a shapeless object, or an envelope without its array) now fails with `BACKEND_SHAPE_MISMATCH`, naming the tool and the backend door, and the outcome is reported as unknown. Before, it was read as an empty list or a default. This covers `reorder_queue` and `next_task`, `list_tasks` (every sort), and 23 other list and read tools: `list_peers`, `list_messages`, `search_messages_by_keyword`, `search_tasks_by_keyword`, `list_tasks_by_mission`, `list_missions`, `list_briefing_notes`, `search_briefing_notes_by_keyword`, `list_recurring_tasks`, `list_mandates`, `list_issues`, `search_fix_patterns`, `list_fix_patterns`, `list_errors`, `get_tool_usage`, `get_owner_tool_usage`, `list_blocked_on_me`, `list_episodes`, `list_memories`, `list_diaries`, `list_bus`, `list_repo_mappings` and `get_github_owner_bindings`. A well-formed empty reply still returns an empty list, and a backend refusal is still reported as a refusal. `check_messages` keeps its documented tolerance of an older backend. ([Tool inputs and outputs](README.md#tool-inputs-and-outputs))
|
|
13
|
+
- Self-host: no backend change. The required backend contract stays 29 with 153 called functions, so a 5.0.0 backend serves 5.0.1 as is. ([Backend compatibility check](README.md#backend-compatibility-check))
|
|
14
|
+
|
|
5
15
|
## [5.0.0] — 2026-11-24
|
|
6
16
|
|
|
7
17
|
Customer-facing summary of every `mcp-server/` change since 4.1.0. Each entry says which product it concerns (VantagePeers Cloud, the hosted service; VantagePeers Self-host, the separate product) and links the README section that documents it. This is a major release because tool inputs and output shapes changed (see the package's [Versioning](README.md#versioning) rules).
|
package/README.md
CHANGED
|
@@ -343,7 +343,7 @@ _Applies to: Cloud and Self-host._
|
|
|
343
343
|
- **Dependencies append.** `add_task_dependency` and `block_task` (`blockedBy`) add to a task's existing dependencies, deduplicated, and answer the resulting list; they no longer replace it. `update_task` `dependsOn` stays the explicit replace. `link_commit_to_issue` skips a commit SHA already recorded.
|
|
344
344
|
- **Tool usage.** `get_tool_usage` lists which MCP tools a caller has called, with first call, last call and call count; `get_owner_tool_usage` sums that across the agents a person owns.
|
|
345
345
|
- **Refusal codes.** A refused `send_message` carries `RBAC_DENIED` or `INVALID_RECIPIENTS`, and a missing message `MESSAGE_NOT_FOUND`, instead of a bare server error.
|
|
346
|
-
- **Task queue.** `reorder_queue` sets one agent's queue (`assignedToAgentId`, `taskIds`): listed tasks get ranks 1 to N, the agent's other open tasks lose their rank, `[]` clears it.
|
|
346
|
+
- **Task queue.** `reorder_queue` sets one agent's queue (`assignedToAgentId`, `taskIds`): listed tasks get ranks 1 to N, the agent's other open tasks lose their rank, `[]` clears it. Over MCP it is open to the assignee agent itself and to a listed queue coordinator; a person bearer is refused (a person sets a queue from a signed-in session, not through this tool). `next_task` returns the first task of that queue the agent can take (rank, then priority, then age, dependencies done) or `found: false`. `list_tasks` with `sort: "queue"` lists in that order; without `sort` it is unchanged.
|
|
347
347
|
- **Project is required.** `create_task` refuses a missing, empty or blank `project`; `update_task` refuses setting it to empty. `billing_summary_by_project` keeps `unattributedTaskCount` and adds `noProjectCount` and `noDurationCount`; `listNoDuration: true` also returns up to 200 tasks with a project and no measured duration (`noDurationTasks`, `noDurationTasksTruncated`).
|
|
348
348
|
- **Task windows.** `list_tasks` with `updatedSince` pages a window of any size, newest-updated first, with an opaque cursor. A combination the indexes cannot serve is refused with the remedy in the message, never answered with a partial page.
|
|
349
349
|
- **Erase.** `erase_row` deletes one row of the eleven covered tables, `erase_fix_pattern` one fix pattern, `erase_memory` the matching text of a memory. An organisation admin may erase any row of the organisation; an author the rows it wrote (a person by verified identity, an agent by its agent ID); any other caller is refused `RBAC_DENIED`. Erasing a memory covers every version of it.
|
|
@@ -407,6 +407,14 @@ So upgrade in this order: deploy the backend of the same release first, then upg
|
|
|
407
407
|
|
|
408
408
|
## Release notes
|
|
409
409
|
|
|
410
|
+
### 5.0.1
|
|
411
|
+
|
|
412
|
+
_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.
|
|
413
|
+
|
|
414
|
+
- Cloud and Self-host: `reorder_queue` names only the callers MCP admits (the assignee, or a listed queue coordinator); a person bearer is refused (see [Tool inputs and outputs](#tool-inputs-and-outputs)).
|
|
415
|
+
- Cloud and Self-host: a backend reply that breaks its contract fails with `BACKEND_SHAPE_MISMATCH` instead of reading as an empty list. This applies to `reorder_queue`, `next_task`, `list_tasks` and 23 other list and read tools; `check_messages` keeps its documented tolerance (see [Tool inputs and outputs](#tool-inputs-and-outputs)).
|
|
416
|
+
- Self-host: no backend change; contract 29, 153 called functions (see [Backend compatibility check](#backend-compatibility-check)).
|
|
417
|
+
|
|
410
418
|
### 5.0.0
|
|
411
419
|
|
|
412
420
|
_Applies to: Cloud and Self-host._ Each item names the product it concerns. A major release: tool inputs and output shapes changed.
|
package/dist/src/tools.d.ts
CHANGED
|
@@ -285,6 +285,20 @@ export declare function mcpRefused(tool: string, door: string): {
|
|
|
285
285
|
}>;
|
|
286
286
|
isError: true;
|
|
287
287
|
};
|
|
288
|
+
export declare function mcpBackendShapeMismatch(tool: string, door: string, expected: string): {
|
|
289
|
+
content: Array<{
|
|
290
|
+
type: "text";
|
|
291
|
+
text: string;
|
|
292
|
+
}>;
|
|
293
|
+
isError: true;
|
|
294
|
+
};
|
|
295
|
+
/** Thrown by `requireRows`; every tool's catch turns it into the named refusal. */
|
|
296
|
+
export declare class BackendShapeMismatchError extends Error {
|
|
297
|
+
readonly tool: string;
|
|
298
|
+
readonly door: string;
|
|
299
|
+
readonly expected: string;
|
|
300
|
+
constructor(tool: string, door: string, expected: string);
|
|
301
|
+
}
|
|
288
302
|
export interface ParsedConvexError {
|
|
289
303
|
code: string;
|
|
290
304
|
message: string;
|
package/dist/src/tools.js
CHANGED
|
@@ -861,6 +861,60 @@ export function mcpRefused(tool, door) {
|
|
|
861
861
|
isError: true,
|
|
862
862
|
};
|
|
863
863
|
}
|
|
864
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
865
|
+
// Helper: a backend reply that breaks its `returns:` contract is refused
|
|
866
|
+
//
|
|
867
|
+
// A tool that substitutes a default for a reply it could not read (a count taken
|
|
868
|
+
// from the request, an empty queue) turns a contract break into a success. The
|
|
869
|
+
// named refusal below states what the tool expected and which door answered, and
|
|
870
|
+
// says the call's outcome is unknown.
|
|
871
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
872
|
+
export function mcpBackendShapeMismatch(tool, door, expected) {
|
|
873
|
+
return mcpError(`BACKEND_SHAPE_MISMATCH: ${tool} got a reply from the backend door "${door}" that does not match its contract (expected ${expected}). ` +
|
|
874
|
+
`The outcome of this call is unknown: do not read it as success or as an empty result; report it as a backend contract break.`);
|
|
875
|
+
}
|
|
876
|
+
function isPlainObject(v) {
|
|
877
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* The rows of a backend list reply, or null when the reply is not an array.
|
|
881
|
+
* A caller that gets null refuses with `mcpBackendShapeMismatch`: a reply that
|
|
882
|
+
* breaks the door's `returns:` contract is never read as an empty list.
|
|
883
|
+
*/
|
|
884
|
+
function asRows(reply) {
|
|
885
|
+
return Array.isArray(reply) ? reply : null;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* The rows of a list door documented as "an array, or an envelope `{ items: array }`".
|
|
889
|
+
* Anything else (null, a string, an envelope whose `items` is not an array) is a
|
|
890
|
+
* contract break, never an empty list.
|
|
891
|
+
*/
|
|
892
|
+
function requireItems(reply, tool, door) {
|
|
893
|
+
if (Array.isArray(reply))
|
|
894
|
+
return reply;
|
|
895
|
+
if (isPlainObject(reply) && Array.isArray(reply.items))
|
|
896
|
+
return reply.items;
|
|
897
|
+
throw new BackendShapeMismatchError(tool, door, "an array, or { items: array, ... }");
|
|
898
|
+
}
|
|
899
|
+
/** Thrown by `requireRows`; every tool's catch turns it into the named refusal. */
|
|
900
|
+
export class BackendShapeMismatchError extends Error {
|
|
901
|
+
tool;
|
|
902
|
+
door;
|
|
903
|
+
expected;
|
|
904
|
+
constructor(tool, door, expected) {
|
|
905
|
+
super(`BACKEND_SHAPE_MISMATCH: ${tool} ${door} ${expected}`);
|
|
906
|
+
this.tool = tool;
|
|
907
|
+
this.door = door;
|
|
908
|
+
this.expected = expected;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
/** The rows of a backend list reply; a non-array reply is a contract break, never []. */
|
|
912
|
+
function requireRows(reply, tool, door, expected) {
|
|
913
|
+
const rows = asRows(reply);
|
|
914
|
+
if (rows === null)
|
|
915
|
+
throw new BackendShapeMismatchError(tool, door, expected);
|
|
916
|
+
return rows;
|
|
917
|
+
}
|
|
864
918
|
/**
|
|
865
919
|
* Parse a Convex error message string into a structured object.
|
|
866
920
|
*
|
|
@@ -934,6 +988,9 @@ export function parseConvexError(rawMessage) {
|
|
|
934
988
|
* used by `mcpError`.
|
|
935
989
|
*/
|
|
936
990
|
export function mcpConvexError(error) {
|
|
991
|
+
if (error instanceof BackendShapeMismatchError) {
|
|
992
|
+
return mcpBackendShapeMismatch(error.tool, error.door, error.expected);
|
|
993
|
+
}
|
|
937
994
|
// Empirical probe (Day 127, 2026-07-10 — Sigma): Convex redacts
|
|
938
995
|
// `error.message` to a bare "[Request ID: ...] Server Error" string for
|
|
939
996
|
// ConvexError throws, but the ACTUAL actionable payload passed to
|
|
@@ -1844,7 +1901,10 @@ async function listPeersFromOrgRoster(convex, oauthCtx) {
|
|
|
1844
1901
|
// and each keeps its own ID. An entry with no ID is keyed by its
|
|
1845
1902
|
// normalised name. Bounded.
|
|
1846
1903
|
const seen = new Map();
|
|
1847
|
-
|
|
1904
|
+
if (!Array.isArray(roster)) {
|
|
1905
|
+
return mcpBackendShapeMismatch(LIST_PEERS, directoryDoors.directory, "an array of agent directory entries");
|
|
1906
|
+
}
|
|
1907
|
+
for (const entry of roster) {
|
|
1848
1908
|
let name = null;
|
|
1849
1909
|
let agentId = null;
|
|
1850
1910
|
if (typeof entry === "string") {
|
|
@@ -2849,9 +2909,10 @@ options) {
|
|
|
2849
2909
|
const memories = await convex.query("memories:listMemories", queryArgs);
|
|
2850
2910
|
// S3.3 B8 — extract from Convex paginationOpts shape {value, continueCursor, isDone}
|
|
2851
2911
|
// Pre-fix bug: handler read memories?.page (undefined) → rawList = [] always.
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2912
|
+
if (!Array.isArray(memories?.value)) {
|
|
2913
|
+
return mcpBackendShapeMismatch("list_episodes", "memories:listMemories", "a page { value: array, continueCursor, isDone }");
|
|
2914
|
+
}
|
|
2915
|
+
const rawList = memories.value;
|
|
2855
2916
|
const filteredList = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, rawList);
|
|
2856
2917
|
// Encode continueCursor → opaque nextCursor token for the MCP caller.
|
|
2857
2918
|
const backendNextCursor = memories?.continueCursor ?? null;
|
|
@@ -3192,9 +3253,10 @@ options) {
|
|
|
3192
3253
|
const memories = await convex.query("memories:listMemories", queryArgs);
|
|
3193
3254
|
// S3.3 B8 — extract from Convex paginationOpts shape {value, continueCursor, isDone}
|
|
3194
3255
|
// Pre-fix bug: handler read memories?.page (undefined) → rawList = [] always.
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3256
|
+
if (!Array.isArray(memories?.value)) {
|
|
3257
|
+
return mcpBackendShapeMismatch("list_memories", "memories:listMemories", "a page { value: array, continueCursor, isDone }");
|
|
3258
|
+
}
|
|
3259
|
+
const rawList = memories.value;
|
|
3198
3260
|
// S3.1.A Wave A — row-level scope filter on the post-query list.
|
|
3199
3261
|
// Master + legacy bearer pass through unchanged. Non-master clients
|
|
3200
3262
|
// see only rows whose createdBy ∈ fromAllowList OR whose namespace
|
|
@@ -3681,8 +3743,11 @@ options) {
|
|
|
3681
3743
|
"tasks:listBlockedOnMe", {
|
|
3682
3744
|
...(tenantId !== undefined ? { tenantId } : {}),
|
|
3683
3745
|
});
|
|
3684
|
-
|
|
3685
|
-
|
|
3746
|
+
if (!isPlainObject(result) || !Array.isArray(result.entries)) {
|
|
3747
|
+
return mcpBackendShapeMismatch("list_blocked_on_me", "tasks:listBlockedOnMe", "{ entries: array, ... }");
|
|
3748
|
+
}
|
|
3749
|
+
const waiters = result;
|
|
3750
|
+
const entries = waiters.entries;
|
|
3686
3751
|
const shown = entries.slice(0, limit ?? 50);
|
|
3687
3752
|
// The same object is the text (unchanged) and the structuredContent the
|
|
3688
3753
|
// outputSchema validates (task k1793xkjhzh1xm23gmmwjgwfyx8htbv0).
|
|
@@ -3927,7 +3992,8 @@ options) {
|
|
|
3927
3992
|
// remap orchestratorId->createdBy before scopeFilterList, then
|
|
3928
3993
|
// strip the synthetic field back out (the output projection below
|
|
3929
3994
|
// never reads `createdBy`, so no explicit strip is needed).
|
|
3930
|
-
const
|
|
3995
|
+
const profileRows = requireRows(profiles, "list_peers", "profiles:listProfiles", "an array of profiles");
|
|
3996
|
+
const filteredProfiles = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, profileRows.map((p) => ({
|
|
3931
3997
|
...p,
|
|
3932
3998
|
createdBy: p.orchestratorId,
|
|
3933
3999
|
})));
|
|
@@ -3946,7 +4012,7 @@ options) {
|
|
|
3946
4012
|
// S3.3 B8 follow-up — emit nextCursor when page is full.
|
|
3947
4013
|
// Measured on the RAW page, before the scope filter narrowed it.
|
|
3948
4014
|
const requestedLimit = effectiveLimit ?? 20;
|
|
3949
|
-
const { nextCursor, scopeFiltered } = scopedPageContinuation(
|
|
4015
|
+
const { nextCursor, scopeFiltered } = scopedPageContinuation(profileRows, requestedLimit, filteredProfiles.length, { reportRemoved: oauthCtx?.clerkOrgSlug !== undefined });
|
|
3950
4016
|
const peersWithCursor = nextCursor !== null || scopeFiltered > 0
|
|
3951
4017
|
? {
|
|
3952
4018
|
items: peers,
|
|
@@ -4043,7 +4109,8 @@ options) {
|
|
|
4043
4109
|
// sender included. Same remedy as search_messages_by_keyword
|
|
4044
4110
|
// (tools.ts ~3399-3423): remap `from`->`createdBy` before
|
|
4045
4111
|
// scopeFilterList, then strip the synthetic field back out.
|
|
4046
|
-
const
|
|
4112
|
+
const messageRows = requireRows(messages, "list_messages", "messages:listMessages", "an array of messages");
|
|
4113
|
+
const filteredMessages = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, messageRows.map((m) => ({
|
|
4047
4114
|
...m,
|
|
4048
4115
|
createdBy: m.from,
|
|
4049
4116
|
}))).map(({ createdBy: _createdBy, ...rest }) => rest);
|
|
@@ -4053,9 +4120,7 @@ options) {
|
|
|
4053
4120
|
// full page whose rows the roster filter then dropped is still a
|
|
4054
4121
|
// page with more behind it.
|
|
4055
4122
|
const requestedLimit = effectiveLimit ?? 20;
|
|
4056
|
-
const messagesPage =
|
|
4057
|
-
? messages
|
|
4058
|
-
: [];
|
|
4123
|
+
const messagesPage = messageRows;
|
|
4059
4124
|
let nextCursor = null;
|
|
4060
4125
|
if (messagesPage.length >= requestedLimit && messagesPage.length > 0) {
|
|
4061
4126
|
const last = messagesPage[messagesPage.length - 1];
|
|
@@ -4175,9 +4240,8 @@ options) {
|
|
|
4175
4240
|
// which established the sanctioned remedy: remap the tool's real
|
|
4176
4241
|
// ownership field onto `createdBy` BEFORE calling scopeFilterList,
|
|
4177
4242
|
// then strip the synthetic field back out of the response.
|
|
4178
|
-
const
|
|
4179
|
-
|
|
4180
|
-
: []).map((m) => ({ ...m, createdBy: m.from }))).map(({ createdBy: _createdBy, ...rest }) => rest);
|
|
4243
|
+
const resultRows = requireRows(results, "search_messages_by_keyword", "messages:searchMessagesByKeyword", "an array of messages");
|
|
4244
|
+
const filteredResults = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, resultRows.map((m) => ({ ...m, createdBy: m.from }))).map(({ createdBy: _createdBy, ...rest }) => rest);
|
|
4181
4245
|
const capped = capPage(filteredResults, "search_messages_by_keyword", "array");
|
|
4182
4246
|
return {
|
|
4183
4247
|
content: [
|
|
@@ -4499,9 +4563,8 @@ options) {
|
|
|
4499
4563
|
// assignee must still see their own task in the list.
|
|
4500
4564
|
// TENANT GATE, collection surface — applied BEFORE the roster/owner
|
|
4501
4565
|
// filter, with the same predicate get_task applies to its one row.
|
|
4502
|
-
const
|
|
4503
|
-
|
|
4504
|
-
: []), ["assignedTo"]);
|
|
4566
|
+
const taskRows = requireRows(rawTasks, "list_tasks", "tasks:list", "an array of tasks");
|
|
4567
|
+
const scopedTasks = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, filterRowsToActorTenant(oauthCtx, taskRows), ["assignedTo"]);
|
|
4505
4568
|
const tasks = wantsFull
|
|
4506
4569
|
? scopedTasks
|
|
4507
4570
|
: scopedTasks.map((t) => ({
|
|
@@ -4524,10 +4587,8 @@ options) {
|
|
|
4524
4587
|
// narrowing filters above: a full page whose rows the roster filter
|
|
4525
4588
|
// then dropped still has more behind it.
|
|
4526
4589
|
const requestedLimit = effectiveLimit ?? 20;
|
|
4527
|
-
const tasksArr =
|
|
4528
|
-
const tasksPage =
|
|
4529
|
-
? rawTasks
|
|
4530
|
-
: [];
|
|
4590
|
+
const tasksArr = tasks;
|
|
4591
|
+
const tasksPage = taskRows;
|
|
4531
4592
|
let nextCursor = null;
|
|
4532
4593
|
// A queue-ordered page is not in creation order: a createdBefore cursor
|
|
4533
4594
|
// would skip rows, so none is minted.
|
|
@@ -4771,9 +4832,8 @@ options) {
|
|
|
4771
4832
|
// createdBy===caller || assignedTo===caller), so a non-creator
|
|
4772
4833
|
// assignee must still see their own task in search results.
|
|
4773
4834
|
// TENANT GATE, collection surface (same predicate as get_task).
|
|
4774
|
-
const
|
|
4775
|
-
|
|
4776
|
-
: []), ["assignedTo"]);
|
|
4835
|
+
const resultRows = requireRows(results, "search_tasks_by_keyword", "tasks:searchTasksByKeyword", "an array of tasks");
|
|
4836
|
+
const filteredFull = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, filterRowsToActorTenant(oauthCtx, resultRows), ["assignedTo"]);
|
|
4777
4837
|
const projected = wantsFull
|
|
4778
4838
|
? filteredFull
|
|
4779
4839
|
: filteredFull.map((t) => ({
|
|
@@ -5508,11 +5568,11 @@ options) {
|
|
|
5508
5568
|
// ── reorder_queue ───────────────────────────────────────────────────────────
|
|
5509
5569
|
defineTool(server, authCtx, {
|
|
5510
5570
|
kind: "filtered",
|
|
5511
|
-
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
|
|
5571
|
+
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)",
|
|
5512
5572
|
}, "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. " +
|
|
5513
5573
|
"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. " +
|
|
5514
5574
|
"Each task must be an open task (todo, in_progress, review or blocked) assigned to that agent, listed once, at most 100 per call; one refused task changes nothing. " +
|
|
5515
|
-
"Who may call: the agent itself, a queue coordinator its organisation lists,
|
|
5575
|
+
"Who may call over MCP: the agent itself (the assignee), or a queue coordinator its organisation lists; anyone else is refused, including a person bearer (a person sets a queue from a signed-in session, not through this tool). " +
|
|
5516
5576
|
"Returns { ranked, cleared }: how many tasks now hold a rank and how many others lost theirs. A refusal (QUEUE_TASK_NOT_ASSIGNED, QUEUE_TASK_NOT_OPEN, QUEUE_TASK_DUPLICATE, QUEUE_TOO_LONG, RBAC_DENIED) is an error naming its cause, never a partial write. " +
|
|
5517
5577
|
"WHEN: to put an agent's backlog in the order it must be worked, or to clear that order. " +
|
|
5518
5578
|
"EXAMPLE: reorder_queue assignedToAgentId='r57bexrjnt2229qzchhj5bs3yh8j5ta1' taskIds=['k178d3ns...', 'k17bbbbb...']. " +
|
|
@@ -5545,9 +5605,16 @@ options) {
|
|
|
5545
5605
|
assignedToAgentId,
|
|
5546
5606
|
taskIds: taskIds.map((id) => id),
|
|
5547
5607
|
}));
|
|
5608
|
+
// The door's `returns:` is { ranked: number, cleared: number }: a reply
|
|
5609
|
+
// that is not that is refused, never completed with a default.
|
|
5610
|
+
if (!isPlainObject(result) ||
|
|
5611
|
+
typeof result.ranked !== "number" ||
|
|
5612
|
+
typeof result.cleared !== "number") {
|
|
5613
|
+
return mcpBackendShapeMismatch("reorder_queue", "tasks:reorderQueue", "{ ranked: number, cleared: number }");
|
|
5614
|
+
}
|
|
5548
5615
|
const structured = {
|
|
5549
|
-
ranked: result
|
|
5550
|
-
cleared: result
|
|
5616
|
+
ranked: result.ranked,
|
|
5617
|
+
cleared: result.cleared,
|
|
5551
5618
|
};
|
|
5552
5619
|
return {
|
|
5553
5620
|
content: [
|
|
@@ -5605,7 +5672,14 @@ options) {
|
|
|
5605
5672
|
...(assignedToAgentId !== undefined ? { assignedToAgentId } : {}),
|
|
5606
5673
|
...doorScopeArgs("tasks:nextForAssignee", undefined),
|
|
5607
5674
|
}));
|
|
5608
|
-
|
|
5675
|
+
// The door answers { found: true, task } or { found: false }; anything
|
|
5676
|
+
// else is a contract break, not an empty queue.
|
|
5677
|
+
if (!isPlainObject(result) ||
|
|
5678
|
+
typeof result.found !== "boolean" ||
|
|
5679
|
+
(result.found === true && !isPlainObject(result.task))) {
|
|
5680
|
+
return mcpBackendShapeMismatch("next_task", "tasks:nextForAssignee", "{ found: true, task } or { found: false }");
|
|
5681
|
+
}
|
|
5682
|
+
const structured = result.found === true
|
|
5609
5683
|
? { found: true, task: result.task }
|
|
5610
5684
|
: {
|
|
5611
5685
|
found: false,
|
|
@@ -5694,9 +5768,8 @@ options) {
|
|
|
5694
5768
|
// `tenantRows` is the page after the tenant gate: only these rows are
|
|
5695
5769
|
// attributable to the caller's own organisation, so only their
|
|
5696
5770
|
// removals by the allow-list below are counted as `scopeFiltered`.
|
|
5697
|
-
const
|
|
5698
|
-
|
|
5699
|
-
: []);
|
|
5771
|
+
const missionTaskRows = requireRows(tasks, "list_tasks_by_mission", "tasks:listByMission", "an array of tasks");
|
|
5772
|
+
const tenantRows = filterRowsToActorTenant(oauthCtx, missionTaskRows);
|
|
5700
5773
|
const scopedRows = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, tenantRows, ["assignedTo"]);
|
|
5701
5774
|
// The gate needs `orgId`, which the lite projection strips, so a
|
|
5702
5775
|
// gated caller is served full rows internally and reprojected to the
|
|
@@ -5717,7 +5790,7 @@ options) {
|
|
|
5717
5790
|
// S3.3 B8 follow-up — emit nextCursor when page is full.
|
|
5718
5791
|
// Measured on the RAW page, before the scope filter narrowed it.
|
|
5719
5792
|
const requestedLimit = effectiveLimit ?? 20;
|
|
5720
|
-
const { nextCursor, scopeFiltered } = scopedPageContinuation(
|
|
5793
|
+
const { nextCursor, scopeFiltered } = scopedPageContinuation(missionTaskRows, requestedLimit, filteredTasks.length, {
|
|
5721
5794
|
inTenantCount: tenantRows.length,
|
|
5722
5795
|
reportRemoved: oauthCtx?.clerkOrgSlug !== undefined,
|
|
5723
5796
|
});
|
|
@@ -5883,7 +5956,7 @@ options) {
|
|
|
5883
5956
|
});
|
|
5884
5957
|
// S3.3 B8 follow-up — emit nextCursor when page is full.
|
|
5885
5958
|
const requestedLimit = effectiveLimit ?? 20;
|
|
5886
|
-
const missionsArr =
|
|
5959
|
+
const missionsArr = requireRows(missions, "list_missions", "missions:list", "an array of missions");
|
|
5887
5960
|
let nextCursor = null;
|
|
5888
5961
|
if (missionsArr.length >= requestedLimit && missionsArr.length > 0) {
|
|
5889
5962
|
const last = missionsArr[missionsArr.length - 1];
|
|
@@ -6303,10 +6376,8 @@ options) {
|
|
|
6303
6376
|
? entries
|
|
6304
6377
|
: null;
|
|
6305
6378
|
const entriesArr = partial
|
|
6306
|
-
? partial
|
|
6307
|
-
:
|
|
6308
|
-
? entries
|
|
6309
|
-
: [];
|
|
6379
|
+
? requireItems(partial, "list_diaries", "diary:list")
|
|
6380
|
+
: requireRows(entries, "list_diaries", "diary:list", "an array of diary entries, or a partial page { items: array, nextCreatedBefore }");
|
|
6310
6381
|
let nextCursor = null;
|
|
6311
6382
|
if (partial) {
|
|
6312
6383
|
nextCursor = encodeCursor({ createdBefore: partial.nextCreatedBefore });
|
|
@@ -6625,7 +6696,7 @@ options) {
|
|
|
6625
6696
|
if (isRefusedEnvelope(notes)) {
|
|
6626
6697
|
return mcpRefused("list_briefing_notes", "briefingNotes:list");
|
|
6627
6698
|
}
|
|
6628
|
-
const rawNotes =
|
|
6699
|
+
const rawNotes = requireRows(notes, "list_briefing_notes", "briefingNotes:list", "an array of notes");
|
|
6629
6700
|
const scopeFiltered = new Set(scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, rawNotes));
|
|
6630
6701
|
const filteredNotes = rawNotes.filter((n) => scopeFiltered.has(n) ||
|
|
6631
6702
|
passesBriefingNoteParticipantScope(oauthCtx, n));
|
|
@@ -6761,7 +6832,7 @@ options) {
|
|
|
6761
6832
|
// on lite results too, see convex/briefingNotes.ts) instead of
|
|
6762
6833
|
// trusting Convex's decision blindly — real defense-in-depth,
|
|
6763
6834
|
// same posture Day 141 relied on for tenant isolation here.
|
|
6764
|
-
const rawResults =
|
|
6835
|
+
const rawResults = requireRows(results, "search_briefing_notes_by_keyword", "briefingNotes:searchBriefingNotesByKeyword", "an array of notes");
|
|
6765
6836
|
const scopeFiltered = new Set(scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, rawResults));
|
|
6766
6837
|
const filteredResults = rawResults.filter((r) => scopeFiltered.has(r) ||
|
|
6767
6838
|
passesBriefingNoteParticipantScope(oauthCtx, r));
|
|
@@ -6895,11 +6966,12 @@ options) {
|
|
|
6895
6966
|
fields: "lite",
|
|
6896
6967
|
createdBefore,
|
|
6897
6968
|
});
|
|
6898
|
-
const
|
|
6969
|
+
const recurringRows = requireRows(tasks, "list_recurring_tasks", "recurringTasks:list", "an array of recurring tasks");
|
|
6970
|
+
const filteredTasks = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, recurringRows);
|
|
6899
6971
|
// S3.3 B8 follow-up — emit nextCursor when page is full.
|
|
6900
6972
|
// Measured on the RAW page, before the scope filter narrowed it.
|
|
6901
6973
|
const requestedLimit = effectiveLimit ?? 20;
|
|
6902
|
-
const { nextCursor, scopeFiltered } = scopedPageContinuation(
|
|
6974
|
+
const { nextCursor, scopeFiltered } = scopedPageContinuation(recurringRows, requestedLimit, filteredTasks.length, { reportRemoved: oauthCtx?.clerkOrgSlug !== undefined });
|
|
6903
6975
|
const tasksWithCursor = nextCursor !== null || scopeFiltered > 0
|
|
6904
6976
|
? {
|
|
6905
6977
|
items: filteredTasks,
|
|
@@ -7501,7 +7573,7 @@ options) {
|
|
|
7501
7573
|
// 0.5.0's `grantFields` declares both as per-row grants directly —
|
|
7502
7574
|
// no createdBy-remap + union-by-_id workaround needed: either
|
|
7503
7575
|
// party to the mandate is a named grantee, consulted in one pass.
|
|
7504
|
-
const mandateRows =
|
|
7576
|
+
const mandateRows = requireRows(mandates, "list_mandates", "mandates:list", "an array of mandates");
|
|
7505
7577
|
const filteredMandates = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, mandateRows, ["requestedBy", "fulfilledBy"]);
|
|
7506
7578
|
// S3.3 B8 follow-up — emit nextCursor when page is full.
|
|
7507
7579
|
// Measured on the RAW page, before the scope filter narrowed it.
|
|
@@ -7797,11 +7869,7 @@ options) {
|
|
|
7797
7869
|
createdBefore,
|
|
7798
7870
|
...doorScopeArgs("businessUnits:list", undefined),
|
|
7799
7871
|
});
|
|
7800
|
-
const rawItems = (envelope
|
|
7801
|
-
? envelope.items
|
|
7802
|
-
: Array.isArray(envelope)
|
|
7803
|
-
? envelope
|
|
7804
|
-
: []);
|
|
7872
|
+
const rawItems = requireItems(envelope, "list_bus", "businessUnits:list");
|
|
7805
7873
|
const backendNextCursor = envelope && typeof envelope === "object" && "nextCursor" in envelope
|
|
7806
7874
|
? envelope.nextCursor
|
|
7807
7875
|
: null;
|
|
@@ -8028,11 +8096,7 @@ options) {
|
|
|
8028
8096
|
createdBefore,
|
|
8029
8097
|
...doorScopeArgs("githubRepoMapping:list", undefined),
|
|
8030
8098
|
});
|
|
8031
|
-
const rawItems = (envelope
|
|
8032
|
-
? envelope.items
|
|
8033
|
-
: Array.isArray(envelope)
|
|
8034
|
-
? envelope
|
|
8035
|
-
: []);
|
|
8099
|
+
const rawItems = requireItems(envelope, "list_repo_mappings", "githubRepoMapping:list");
|
|
8036
8100
|
const backendNextCursor = envelope && typeof envelope === "object" && "nextCursor" in envelope
|
|
8037
8101
|
? envelope.nextCursor
|
|
8038
8102
|
: null;
|
|
@@ -8201,10 +8265,14 @@ options) {
|
|
|
8201
8265
|
: undefined;
|
|
8202
8266
|
// The same object is the text (unchanged) and the structuredContent the
|
|
8203
8267
|
// outputSchema validates (task k1793xkjhzh1xm23gmmwjgwfyx8htbv0).
|
|
8268
|
+
const bindingItems = requireItems(isPlainObject(bindingsPage) ? bindingsPage : null, "get_github_owner_bindings", "githubOwnerBinding:listBindings");
|
|
8269
|
+
const unprovenItems = unprovenPage === undefined
|
|
8270
|
+
? undefined
|
|
8271
|
+
: requireItems(isPlainObject(unprovenPage) ? unprovenPage : null, "get_github_owner_bindings", "githubOwnerBinding:listUnprovenMappings");
|
|
8204
8272
|
const structured = {
|
|
8205
|
-
bindings:
|
|
8273
|
+
bindings: bindingItems,
|
|
8206
8274
|
nextCursor: opaque(bindingsPage.nextCursor),
|
|
8207
|
-
unprovenMappings:
|
|
8275
|
+
unprovenMappings: unprovenItems,
|
|
8208
8276
|
unprovenNextCursor: opaque(unprovenPage?.nextCursor),
|
|
8209
8277
|
};
|
|
8210
8278
|
return {
|
|
@@ -8330,7 +8398,8 @@ options) {
|
|
|
8330
8398
|
createdBefore,
|
|
8331
8399
|
});
|
|
8332
8400
|
}
|
|
8333
|
-
const
|
|
8401
|
+
const issueRows = requireRows(results, "list_issues", "issues:listBy*", "an array of issues");
|
|
8402
|
+
const filteredIssues = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, issueRows);
|
|
8334
8403
|
// S3.3 B8 follow-up — emit nextCursor when page is full.
|
|
8335
8404
|
let nextCursor = null;
|
|
8336
8405
|
if (filteredIssues.length >= requestedLimit &&
|
|
@@ -8754,7 +8823,8 @@ options) {
|
|
|
8754
8823
|
limit: limit ?? 20,
|
|
8755
8824
|
fields: fields ?? "lite",
|
|
8756
8825
|
});
|
|
8757
|
-
const
|
|
8826
|
+
const patternRows = requireRows(results, "search_fix_patterns", "search:searchFixPatterns", "an array of fix patterns");
|
|
8827
|
+
const filteredResults = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, patternRows);
|
|
8758
8828
|
const capped = capPage(filteredResults, "search_fix_patterns", "array");
|
|
8759
8829
|
return {
|
|
8760
8830
|
content: [
|
|
@@ -8838,7 +8908,8 @@ options) {
|
|
|
8838
8908
|
fields: "lite",
|
|
8839
8909
|
createdBefore,
|
|
8840
8910
|
});
|
|
8841
|
-
const
|
|
8911
|
+
const projectRows = requireRows(results, "list_fix_patterns", "fixPatterns:listByProject", "an array of fix patterns");
|
|
8912
|
+
const filteredResults = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, projectRows);
|
|
8842
8913
|
const payload = buildPayload(filteredResults);
|
|
8843
8914
|
const capped = capPage(payload, "list_fix_patterns");
|
|
8844
8915
|
return {
|
|
@@ -8851,7 +8922,8 @@ options) {
|
|
|
8851
8922
|
fields: "lite",
|
|
8852
8923
|
createdBefore,
|
|
8853
8924
|
});
|
|
8854
|
-
const
|
|
8925
|
+
const allRows = requireRows(allResults, "list_fix_patterns", "fixPatterns:listAll", "an array of fix patterns");
|
|
8926
|
+
const filteredAll = scopeFilterList(oauthCtx ?? DENIED_SCOPE_CTX, allRows);
|
|
8855
8927
|
const payload = buildPayload(filteredAll);
|
|
8856
8928
|
const capped = capPage(payload, "list_fix_patterns");
|
|
8857
8929
|
return {
|
|
@@ -9299,7 +9371,7 @@ options) {
|
|
|
9299
9371
|
fields: fields ?? "lite",
|
|
9300
9372
|
createdBefore,
|
|
9301
9373
|
});
|
|
9302
|
-
const filteredErrors =
|
|
9374
|
+
const filteredErrors = requireRows(errors, "list_errors", "errorMonitor:listErrors", "an array of errors");
|
|
9303
9375
|
// S3.3 B8 follow-up — emit nextCursor when page is full.
|
|
9304
9376
|
const requestedLimit = effectiveLimit ?? 20;
|
|
9305
9377
|
let nextCursor = null;
|
|
@@ -9407,7 +9479,10 @@ options) {
|
|
|
9407
9479
|
...(caller !== undefined ? { caller } : {}),
|
|
9408
9480
|
...reader.args,
|
|
9409
9481
|
});
|
|
9410
|
-
|
|
9482
|
+
if (!Array.isArray(rows)) {
|
|
9483
|
+
return mcpBackendShapeMismatch("get_tool_usage", "toolUsage:getToolUsage", "an array of usage rows");
|
|
9484
|
+
}
|
|
9485
|
+
const capped = capPage(rows, "get_tool_usage", "array");
|
|
9411
9486
|
return {
|
|
9412
9487
|
content: [
|
|
9413
9488
|
{ type: "text", text: capped.text },
|
|
@@ -9456,7 +9531,10 @@ options) {
|
|
|
9456
9531
|
const rows = await convex.query(
|
|
9457
9532
|
// biome-ignore lint/suspicious/noExplicitAny: Convex string API
|
|
9458
9533
|
"toolUsage:usageByOwner", { ownerUserId, ...reader.args });
|
|
9459
|
-
|
|
9534
|
+
if (!Array.isArray(rows)) {
|
|
9535
|
+
return mcpBackendShapeMismatch("get_owner_tool_usage", "toolUsage:usageByOwner", "an array of usage rows");
|
|
9536
|
+
}
|
|
9537
|
+
const capped = capPageMirrored(rows, "get_owner_tool_usage", "array");
|
|
9460
9538
|
return {
|
|
9461
9539
|
// The text is the structuredContent as JSON (capPageMirrored).
|
|
9462
9540
|
content: [{ type: "text", text: capped.text }],
|
package/package.json
CHANGED