@intentius/chant 0.89.0 → 0.90.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/dist/cli/handlers/serve.d.ts.map +1 -1
- package/dist/cli/mcp/server.d.ts +10 -5
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/types.d.ts +13 -5
- package/dist/cli/mcp/types.d.ts.map +1 -1
- package/dist/cli/mcp/workspace-tools.d.ts +53 -0
- package/dist/cli/mcp/workspace-tools.d.ts.map +1 -0
- package/dist/op/op-verb-class.d.ts.map +1 -1
- package/dist/workspace/conformance/index.d.ts +42 -2
- package/dist/workspace/conformance/index.d.ts.map +1 -1
- package/dist/workspace/conformance/vitest.d.ts.map +1 -1
- package/dist/workspace/reason-codes.d.ts +3 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/records-write.d.ts +35 -3
- package/dist/workspace/records-write.d.ts.map +1 -1
- package/dist/workspace/records.d.ts +4 -1
- package/dist/workspace/records.d.ts.map +1 -1
- package/dist/workspace/source-block.d.ts +85 -0
- package/dist/workspace/source-block.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/cli/handlers/serve.ts +2 -1
- package/src/cli/mcp/docs-parity.test.ts +20 -2
- package/src/cli/mcp/server.ts +23 -6
- package/src/cli/mcp/types.ts +15 -2
- package/src/cli/mcp/workspace-tools.test.ts +198 -0
- package/src/cli/mcp/workspace-tools.ts +405 -0
- package/src/op/op-verb-class.ts +6 -0
- package/src/workspace/conformance/__fixture__/decisions/decision.kind.mjs +4 -0
- package/src/workspace/conformance/__fixture__/decisions/decision.schema.json +100 -6
- package/src/workspace/conformance/index.mjs +3 -0
- package/src/workspace/conformance/index.ts +185 -7
- package/src/workspace/conformance/vitest.ts +17 -8
- package/src/workspace/reason-codes.ts +3 -0
- package/src/workspace/records-amend.schema.json +2 -1
- package/src/workspace/records-close.schema.json +2 -1
- package/src/workspace/records-new.schema.json +4 -1
- package/src/workspace/records-review.schema.json +2 -1
- package/src/workspace/records-write.ts +85 -7
- package/src/workspace/records.schema.json +1 -0
- package/src/workspace/records.ts +28 -0
- package/src/workspace/source-block.test.ts +167 -0
- package/src/workspace/source-block.ts +129 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBtE;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAM1E"}
|
package/dist/cli/mcp/server.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LexiconPlugin } from "../../lexicon.js";
|
|
2
|
-
import type { McpRequest, McpResponse } from "./types.js";
|
|
2
|
+
import type { McpClientInfo, McpRequest, McpResponse } from "./types.js";
|
|
3
|
+
import { type WorkspaceToolsOptions } from "./workspace-tools.js";
|
|
3
4
|
/**
|
|
4
5
|
* Protocol versions this server understands, newest first. `initialize` and
|
|
5
6
|
* `server/discover` both negotiate against this list rather than assuming
|
|
@@ -26,10 +27,7 @@ export declare function negotiateProtocolVersion(requested: string | undefined):
|
|
|
26
27
|
*/
|
|
27
28
|
export declare function parseMeta(params: Record<string, unknown>): {
|
|
28
29
|
protocolVersion?: string;
|
|
29
|
-
clientInfo?:
|
|
30
|
-
name: string;
|
|
31
|
-
version?: string;
|
|
32
|
-
};
|
|
30
|
+
clientInfo?: McpClientInfo;
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* The name a lexicon's MCP tool is registered under: `<lexicon>:<verb>`,
|
|
@@ -55,14 +53,21 @@ export declare class McpServer {
|
|
|
55
53
|
private pluginResources;
|
|
56
54
|
private plugins;
|
|
57
55
|
private instructions;
|
|
56
|
+
/** The `clientInfo` the client gave on `initialize`, for a request that carries none in `_meta` (#2707). */
|
|
57
|
+
private clientInfo;
|
|
58
58
|
/**
|
|
59
59
|
* `options.instructions` is sent as the `initialize` result's
|
|
60
60
|
* `instructions`, the text a client may give its model about this server.
|
|
61
61
|
* Only a workspace root with no lexicon of its own sets it (#2700), to say
|
|
62
62
|
* which members' lexicons were loaded.
|
|
63
|
+
*
|
|
64
|
+
* `options.workspace` names the directory the server serves (#2707). When
|
|
65
|
+
* it is at or inside a declared workspace, the workspace read-contract and
|
|
66
|
+
* record-write tools are served too.
|
|
63
67
|
*/
|
|
64
68
|
constructor(plugins?: LexiconPlugin[], options?: {
|
|
65
69
|
instructions?: string;
|
|
70
|
+
workspace?: WorkspaceToolsOptions;
|
|
66
71
|
});
|
|
67
72
|
/**
|
|
68
73
|
* Register tools contributed by a plugin, namespaced as `lexicon:toolName`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAmE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/server.ts"],"names":[],"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gB/B;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;;;;;;OAOG;IACG,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAClF,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAwBrE;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;OAEG;YACW,QAAQ;IAmCtB;;OAEG;YACW,eAAe;IA2C7B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAsC7B;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAYpD"}
|
package/dist/cli/mcp/types.d.ts
CHANGED
|
@@ -30,10 +30,7 @@ export interface McpResponse {
|
|
|
30
30
|
*/
|
|
31
31
|
export interface McpRequestMeta {
|
|
32
32
|
protocolVersion?: string;
|
|
33
|
-
"io.modelcontextprotocol/clientInfo"?:
|
|
34
|
-
name: string;
|
|
35
|
-
version?: string;
|
|
36
|
-
};
|
|
33
|
+
"io.modelcontextprotocol/clientInfo"?: McpClientInfo;
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
36
|
* Tool definition for MCP
|
|
@@ -66,5 +63,16 @@ export interface ResourceDefinition {
|
|
|
66
63
|
description: string;
|
|
67
64
|
mimeType?: string;
|
|
68
65
|
}
|
|
69
|
-
|
|
66
|
+
/** The MCP client's `clientInfo`, as it gave it on `initialize` or in a request's `_meta`. */
|
|
67
|
+
export interface McpClientInfo {
|
|
68
|
+
name: string;
|
|
69
|
+
version?: string;
|
|
70
|
+
title?: string;
|
|
71
|
+
}
|
|
72
|
+
/** What a handler knows about the call beyond its arguments (#2707). */
|
|
73
|
+
export interface ToolContext {
|
|
74
|
+
/** The client that made the call, when it said. */
|
|
75
|
+
clientInfo?: McpClientInfo;
|
|
76
|
+
}
|
|
77
|
+
export type ToolHandler = (params: Record<string, unknown>, context?: ToolContext) => Promise<unknown>;
|
|
70
78
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAA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O,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #2707 — the workspace tools of `chant serve mcp`: the read contract and the
|
|
3
|
+
* record writes, for a harness that speaks MCP and has no shell.
|
|
4
|
+
*
|
|
5
|
+
* Served when the server starts at or inside a declared workspace. Each tool
|
|
6
|
+
* is a thin call into the code the CLI runs:
|
|
7
|
+
*
|
|
8
|
+
* - The reads (`workspace-ls`, `workspace-status`, `workspace-graph`,
|
|
9
|
+
* `workspace-records`) run `chant workspace <command> ... --json` with the
|
|
10
|
+
* chant this server runs as, in the server's directory, and return the
|
|
11
|
+
* document it printed, unchanged, with its reason codes (#2536). Running the
|
|
12
|
+
* command, rather than calling into it, keeps every rule it has, handing the
|
|
13
|
+
* read to the workspace root's pinned chant included (ws-021), and keeps
|
|
14
|
+
* anything a command prints away from the protocol on stdout.
|
|
15
|
+
* - The writes (`records-new`, `records-amend`, `records-review`,
|
|
16
|
+
* `records-close`) call the functions `chant workspace records new|amend|
|
|
17
|
+
* review|close` call, and return the same JSON result. They keep every rule
|
|
18
|
+
* the CLI keeps: the kind's schema, a closed record never changing, an
|
|
19
|
+
* approved one changing only as its approval rule allows, a dissent needing
|
|
20
|
+
* a note, and `sign` using this host's configured key or refusing with the
|
|
21
|
+
* CLI's remedy. Through MCP a new record also opens in the kind's first
|
|
22
|
+
* state, `proposed` for a decision, and its stored source block (#2708) says
|
|
23
|
+
* it came through MCP: `via: "mcp"` and `client`, the MCP client's
|
|
24
|
+
* `clientInfo`. Computed provenance, from git, is unchanged.
|
|
25
|
+
*
|
|
26
|
+
* Nothing here listens on a port or authenticates anyone (ws-052): the server
|
|
27
|
+
* speaks over stdio, and `by` is recorded as given, as `--by` is.
|
|
28
|
+
*/
|
|
29
|
+
import type { ToolDefinition, ToolHandler } from "./types.js";
|
|
30
|
+
/** How the reads run chant: a command and its leading arguments. */
|
|
31
|
+
export type ChantCommand = string[];
|
|
32
|
+
/**
|
|
33
|
+
* The chant this process runs as: node with the same flags (the tsx loader
|
|
34
|
+
* `bin/chant` registers) and the same entry script.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ownChantCommand(): ChantCommand;
|
|
37
|
+
export interface WorkspaceToolsOptions {
|
|
38
|
+
/** Where reads run and writes resolve kinds: the directory the server started in. */
|
|
39
|
+
cwd: string;
|
|
40
|
+
/** The chant the reads run. Defaults to {@link ownChantCommand}. */
|
|
41
|
+
chantCommand?: ChantCommand;
|
|
42
|
+
}
|
|
43
|
+
export declare const workspaceReadTools: ToolDefinition[];
|
|
44
|
+
export declare const workspaceWriteTools: ToolDefinition[];
|
|
45
|
+
/** The `chant` arguments each read tool runs, from its input. Exported for the conformance suite's MCP transport. */
|
|
46
|
+
export declare function readArgv(tool: string, params: Record<string, unknown>): string[];
|
|
47
|
+
export interface WorkspaceTool {
|
|
48
|
+
definition: ToolDefinition;
|
|
49
|
+
handler: ToolHandler;
|
|
50
|
+
}
|
|
51
|
+
/** The workspace tools, reads then writes, bound to the server's directory. */
|
|
52
|
+
export declare function createWorkspaceTools(options: WorkspaceToolsOptions): WorkspaceTool[];
|
|
53
|
+
//# sourceMappingURL=workspace-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-tools.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/workspace-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAAe,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExE,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAED,MAAM,WAAW,qBAAqB;IACpC,qFAAqF;IACrF,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAmBD,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAsD9C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAAc,EAsE/C,CAAC;AAsCF,qHAAqH;AACrH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAmChF;AA6CD,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,aAAa,EAAE,CAsFpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-verb-class.d.ts","sourceRoot":"","sources":["../../src/op/op-verb-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAsC,QAAQ,EAAkB,MAAM,SAAS,CAAC;AAE5F,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"op-verb-class.d.ts","sourceRoot":"","sources":["../../src/op/op-verb-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAsC,QAAQ,EAAkB,MAAM,SAAS,CAAC;AAE5F,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC;AAgDnE;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,WAAW,CA2B/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,OAAO,CAS/E"}
|
|
@@ -88,6 +88,14 @@ export interface WorkspaceReaderConformanceOptions {
|
|
|
88
88
|
chantCommand?: string[];
|
|
89
89
|
/** How long one chant run may take, in milliseconds. Default 120000. */
|
|
90
90
|
timeoutMs?: number;
|
|
91
|
+
/**
|
|
92
|
+
* How the reader's chant calls reach chant (#2707). `cli`, the default,
|
|
93
|
+
* runs the command. `mcp` answers each call with the matching tool of one
|
|
94
|
+
* `chant serve mcp` session started in the workspace, and also runs the
|
|
95
|
+
* command, so the suite holds the tool's document to the command's: they
|
|
96
|
+
* must be equal. `check` has no tool and is not applicable over MCP.
|
|
97
|
+
*/
|
|
98
|
+
over?: "cli" | "mcp";
|
|
91
99
|
}
|
|
92
100
|
export interface WorkspaceReaderConformanceConfig extends WorkspaceReaderConformanceOptions {
|
|
93
101
|
/** Short label, used in the suite name. */
|
|
@@ -149,10 +157,39 @@ export declare function readerCallProblems(command: ReadContractCommand, args: s
|
|
|
149
157
|
*/
|
|
150
158
|
export declare function checkReaderRead(command: ReadContractCommand, args: string[], calls: string[][], printed: ChantRun[], doc: unknown): string[];
|
|
151
159
|
/** The commands to exercise and the ones skipped, from `commands`. Throws on a name that is not a contract command. */
|
|
152
|
-
export declare function selectCommands(commands?: readonly ReadContractCommand[]): {
|
|
160
|
+
export declare function selectCommands(commands?: readonly ReadContractCommand[], over?: "cli" | "mcp"): {
|
|
153
161
|
checked: ReadContractCommand[];
|
|
154
162
|
skipped: ReadContractCommand[];
|
|
155
163
|
};
|
|
164
|
+
/** The `chant serve mcp` tool that answers each read-contract command. `check` has none. */
|
|
165
|
+
export declare const MCP_READ_TOOLS: Partial<Record<ReadContractCommand, string>>;
|
|
166
|
+
/**
|
|
167
|
+
* The tool call that answers `chant <argv>`, a read-contract command with its
|
|
168
|
+
* arguments and JSON flag, or undefined when no tool does. Flags map to the
|
|
169
|
+
* tool's arguments of the same meaning; the JSON flag is dropped, since a tool
|
|
170
|
+
* always returns the document.
|
|
171
|
+
*/
|
|
172
|
+
export declare function mcpToolCall(argv: readonly string[]): {
|
|
173
|
+
name: string;
|
|
174
|
+
arguments: Record<string, unknown>;
|
|
175
|
+
} | undefined;
|
|
176
|
+
/** One `chant serve mcp` session over stdio: JSON-RPC lines in, one response line per request out. */
|
|
177
|
+
export interface McpSession {
|
|
178
|
+
/** Call a tool and return its structured result, or reject with the error the server gave. */
|
|
179
|
+
call(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
180
|
+
close(): void;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Start `chant serve mcp` in `cwd` and initialize it as `clientInfo`. The
|
|
184
|
+
* server speaks over stdio only (ws-052): nothing here opens a port.
|
|
185
|
+
*/
|
|
186
|
+
export declare function startMcpSession(command: string[], cwd: string, options?: {
|
|
187
|
+
clientInfo?: {
|
|
188
|
+
name: string;
|
|
189
|
+
version?: string;
|
|
190
|
+
};
|
|
191
|
+
timeoutMs?: number;
|
|
192
|
+
}): Promise<McpSession>;
|
|
156
193
|
/** A workspace generated for a conformance run, and how to remove it. */
|
|
157
194
|
export interface ConformanceWorkspace {
|
|
158
195
|
dir: string;
|
|
@@ -182,11 +219,14 @@ export declare function conformanceTarget(options?: WorkspaceReaderConformanceOp
|
|
|
182
219
|
export declare function recordingTransport(target: () => {
|
|
183
220
|
workspaceDir: string;
|
|
184
221
|
chantCommand: string[];
|
|
185
|
-
}, timeoutMs?: number): {
|
|
222
|
+
}, timeoutMs?: number, over?: "cli" | "mcp"): {
|
|
186
223
|
transport: ChantTransport;
|
|
187
224
|
calls: string[][];
|
|
188
225
|
printed: ChantRun[];
|
|
226
|
+
problems: string[];
|
|
189
227
|
reset(): void;
|
|
228
|
+
/** Stop the MCP session, when one was started. */
|
|
229
|
+
close(): Promise<void>;
|
|
190
230
|
};
|
|
191
231
|
/** Make one read through a recording transport and check it. A reader that throws is a problem, not an error. */
|
|
192
232
|
export declare function readAndCheck(reader: WorkspaceReader, recorder: ReturnType<typeof recordingTransport>, command: ReadContractCommand): Promise<ReaderReadResult>;
|
|
@@ -1 +1 @@
|
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AM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,SAAS,SAAU,EAAE,IAAI,GAAE,KAAK,GAAG,KAAa;;;;;;IA+C/I,kDAAkD;;EAMrD;AAED,iHAAiH;AACjH,wBAAsB,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWpK;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,6BAA6B,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,GAAE,iCAAsC,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAiB9K"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../src/workspace/conformance/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../src/workspace/conformance/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAUL,KAAK,gCAAgC,EACtC,MAAM,SAAS,CAAC;AAEjB,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,gCAAgC,GAAG,IAAI,CA8CjG;AAED,cAAc,SAAS,CAAC"}
|
|
@@ -60,6 +60,7 @@ export declare const REASONS: {
|
|
|
60
60
|
readonly "record-supersedes-pending": "A supersedes link from a record whose state is weaker than the record it names, so the link has no effect yet.";
|
|
61
61
|
readonly "record-no-evidence": "The record's evidence list is empty: it cites nothing and pins no file. Information for a reviewer, never an error.";
|
|
62
62
|
readonly "review-undigested": "A verdict names no digest of the text it judged. It still counts, and an amendment does not stop it counting.";
|
|
63
|
+
readonly "source-transcript-drift": "The record's source block pins a transcript by hash, the file it names can be read here, and its bytes hash to something else: it is not the transcript the record means.";
|
|
63
64
|
readonly "work-needs-unknown": "A work record's needs list names a work id no record has, so the item stays blocked.";
|
|
64
65
|
readonly "work-implements-unknown": "A work record's implements list names a decision id no decision has.";
|
|
65
66
|
readonly "work-needs-cycle": "A work record needs itself through its needs links, so it can never be ready.";
|
|
@@ -95,6 +96,8 @@ export declare const REASONS: {
|
|
|
95
96
|
readonly "review-unsupported": "The kind's schema has no reviews field, so its records take no review.";
|
|
96
97
|
readonly "review-note-required": "A dissent was given with no note: a dissent needs a reason.";
|
|
97
98
|
readonly "review-sign-failed": "--sign was given and no seal could be made: the key can't be read or used, git names no ssh signing key, or ssh-keygen is not installed.";
|
|
99
|
+
readonly "record-state-not-initial": "A record written through chant serve mcp gives a state other than the kind's first: a new record opens proposed, and a person moves it on.";
|
|
100
|
+
readonly "source-harvest-not-proposed": "A harvested record (source.via harvest) was written in a state other than the kind's first: a harvest proposes, and a person decides.";
|
|
98
101
|
readonly "record-sign-failed": "--sign was given and no author seal could be made: the record names no author, the key can't be read or used, git names no ssh signing key, or ssh-keygen is not installed.";
|
|
99
102
|
readonly "session-unknown": "--session names no session of a session kind whose subjects are the record's kind.";
|
|
100
103
|
readonly "session-not-open": "--session names a session in a closed state, which takes no more verdicts.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reason-codes.d.ts","sourceRoot":"","sources":["../../src/workspace/reason-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,sHAAsH;AACtH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,uHAAuH;AACvH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,qFAAqF;AACrF,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"reason-codes.d.ts","sourceRoot":"","sources":["../../src/workspace/reason-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,sHAAsH;AACtH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,uHAAuH;AACvH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,qFAAqF;AACrF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIV,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,OAAO,CAAC;AAE9C,mDAAmD;AACnD,eAAO,MAAM,YAAY,EAA2B,UAAU,EAAE,CAAC;AAEjE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,MAAM,IAAI,MAAM,EAAE,CAAC;AAEtD,eAAO,MAAM,WAAW,QAAkD,CAAC;AAE3E,2HAA2H;AAC3H,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAI/E"}
|
|
@@ -33,7 +33,7 @@ export declare const RECORDS_REVIEW_SCHEMA_ID = "https://intentius.io/chant/sche
|
|
|
33
33
|
/** Loading the kind and reading its records, as `records` reads them. */
|
|
34
34
|
export declare const LOAD_ERROR_CODES: readonly ["kind-unreadable", "kind-invalid", "schema-unreadable", "schema-id-mismatch", "schema-invalid", "location-missing"];
|
|
35
35
|
/** Why `records new` wrote nothing. Closed: a reader may switch on it. */
|
|
36
|
-
export declare const NEW_ERROR_CODES: readonly ["kind-unreadable", "kind-invalid", "schema-unreadable", "schema-id-mismatch", "schema-invalid", "location-missing", "write-usage-invalid", "write-input-invalid", "record-id-taken", "record-id-unallocatable", "record-path-unmatched", "record-sign-failed", "record-unparseable", "record-schema-invalid", "record-id-duplicate", "record-supersedes-unknown", "record-supersedes-conflict", "session-seal-mismatch", "session-verdict-unknown-record"];
|
|
36
|
+
export declare const NEW_ERROR_CODES: readonly ["kind-unreadable", "kind-invalid", "schema-unreadable", "schema-id-mismatch", "schema-invalid", "location-missing", "write-usage-invalid", "write-input-invalid", "record-id-taken", "record-id-unallocatable", "record-path-unmatched", "record-sign-failed", "source-harvest-not-proposed", "record-state-not-initial", "record-unparseable", "record-schema-invalid", "record-id-duplicate", "record-supersedes-unknown", "record-supersedes-conflict", "session-seal-mismatch", "session-verdict-unknown-record"];
|
|
37
37
|
/** Why `records amend` wrote nothing. */
|
|
38
38
|
export declare const AMEND_ERROR_CODES: readonly ["kind-unreadable", "kind-invalid", "schema-unreadable", "schema-id-mismatch", "schema-invalid", "location-missing", "write-usage-invalid", "write-input-invalid", "record-not-found", "amend-id-immutable", "record-closed", "amend-supersede-instead", "record-sign-failed", "record-unparseable", "record-schema-invalid", "record-id-duplicate", "record-supersedes-unknown", "record-supersedes-conflict", "session-seal-mismatch", "session-verdict-unknown-record"];
|
|
39
39
|
/** Why `records review` wrote nothing. */
|
|
@@ -201,8 +201,28 @@ export interface NewRecordOptions {
|
|
|
201
201
|
*/
|
|
202
202
|
sign?: string | true;
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* A write made through a channel other than the command line (#2707), such
|
|
206
|
+
* as `chant serve mcp`. The CLI never sets one.
|
|
207
|
+
*/
|
|
208
|
+
export interface WriteChannel {
|
|
209
|
+
/**
|
|
210
|
+
* Laid over the kind's source block (#2708) when the kind declares one:
|
|
211
|
+
* `via` and `client`. A new record gets the block, made when the fields
|
|
212
|
+
* give none; an amendment only when its fields set the block.
|
|
213
|
+
*/
|
|
214
|
+
source: Record<string, unknown>;
|
|
215
|
+
/** A new record opens in the kind's first state: filled in when the fields give no state, and refused with record-state-not-initial when they give another. */
|
|
216
|
+
opensInitial?: boolean;
|
|
217
|
+
}
|
|
218
|
+
/** What a channel's write adds to the command line's: who the author is, and how it came. */
|
|
219
|
+
export interface ChannelOptions {
|
|
220
|
+
/** The record's author, written to the kind's `reviews.decider` field: the person or agent that decided. */
|
|
221
|
+
by?: string;
|
|
222
|
+
through?: WriteChannel;
|
|
223
|
+
}
|
|
204
224
|
/** `records new`: write one new record from validated fields, sealed by its author with `sign`. */
|
|
205
|
-
export declare function newRecord(opts: NewRecordOptions): Promise<NewDocument>;
|
|
225
|
+
export declare function newRecord(opts: NewRecordOptions & ChannelOptions): Promise<NewDocument>;
|
|
206
226
|
export interface AmendRecordOptions {
|
|
207
227
|
kind: string;
|
|
208
228
|
id: string;
|
|
@@ -227,7 +247,7 @@ export interface AmendRecordOptions {
|
|
|
227
247
|
* changes only the reviews leaves the digest, and the seal, as they were.
|
|
228
248
|
* `--sign` with nothing to change seals the record as it is.
|
|
229
249
|
*/
|
|
230
|
-
export declare function amendRecord(opts: AmendRecordOptions): Promise<AmendDocument>;
|
|
250
|
+
export declare function amendRecord(opts: AmendRecordOptions & ChannelOptions): Promise<AmendDocument>;
|
|
231
251
|
export interface ReviewRecordOptions {
|
|
232
252
|
kind: string;
|
|
233
253
|
id: string;
|
|
@@ -255,6 +275,13 @@ export interface ReviewRecordOptions {
|
|
|
255
275
|
*/
|
|
256
276
|
export declare function reviewRecord(opts: ReviewRecordOptions): Promise<ReviewDocument>;
|
|
257
277
|
export declare const WRITE_USAGE: string;
|
|
278
|
+
/**
|
|
279
|
+
* The kind a write goes through when none is named (#2680): the one record
|
|
280
|
+
* kind the declaration nearest above `cwd` names. None declared keeps the
|
|
281
|
+
* message the verb has always given; several are refused, since a write
|
|
282
|
+
* never guesses which kind it means.
|
|
283
|
+
*/
|
|
284
|
+
export declare function declaredWriteKind(schema: string, cwd: string, missing: string): string | WriteFailure<"write-usage-invalid">;
|
|
258
285
|
/**
|
|
259
286
|
* The kind file a write names: `arg` itself when it is a file, or else the
|
|
260
287
|
* declared record kind it names (#2683), by the name the declaration gives it
|
|
@@ -263,6 +290,11 @@ export declare const WRITE_USAGE: string;
|
|
|
263
290
|
* fails with kind-unreadable.
|
|
264
291
|
*/
|
|
265
292
|
export declare function resolveWriteKind(arg: string, cwd: string): string;
|
|
293
|
+
/**
|
|
294
|
+
* The session kind `records close` goes through when none is named (#2693):
|
|
295
|
+
* the one session kind the declaration names.
|
|
296
|
+
*/
|
|
297
|
+
export declare function declaredSessionKind(schema: string, cwd: string): Promise<string | WriteFailure<"write-usage-invalid">>;
|
|
266
298
|
/** `chant workspace records new|amend|review|close`. Prints one JSON document; exits 0 when it wrote, or would have with --dry-run. */
|
|
267
299
|
export declare function runRecordsWrite(ctx: CommandContext): Promise<number>;
|
|
268
300
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-write.d.ts","sourceRoot":"","sources":["../../src/workspace/records-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EASL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAQnB,4DAA4D;AAC5D,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD,eAAO,MAAM,qBAAqB,wFAAwF,CAAC;AAC3H,eAAO,MAAM,uBAAuB,4FAA4F,CAAC;AACjI,eAAO,MAAM,wBAAwB,8FAA8F,CAAC;AAEpI,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,+HAAgI,CAAC;AAE9J,0EAA0E;AAC1E,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"records-write.d.ts","sourceRoot":"","sources":["../../src/workspace/records-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EASL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,W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33,7 +33,7 @@ export type RecordReasonCode = (typeof RECORD_REASON_CODES)[number];
|
|
|
33
33
|
* Why a record carries a warning. Closed, like the reason codes. A warning
|
|
34
34
|
* never makes a record invalid, and `--current` still lists the record.
|
|
35
35
|
*/
|
|
36
|
-
export declare const RECORD_WARNING_CODES: readonly ["asset-drift", "asset-missing", "asset-stale", "record-supersedes-pending", "record-no-evidence", "review-undigested"];
|
|
36
|
+
export declare const RECORD_WARNING_CODES: readonly ["asset-drift", "asset-missing", "asset-stale", "record-supersedes-pending", "record-no-evidence", "review-undigested", "source-transcript-drift"];
|
|
37
37
|
export type RecordWarningCode = (typeof RECORD_WARNING_CODES)[number];
|
|
38
38
|
/**
|
|
39
39
|
* Why a verdict does not count toward a record's quorum (#2671). Closed, like
|
|
@@ -132,6 +132,9 @@ export declare const recordKindSchema: z.ZodObject<{
|
|
|
132
132
|
field: z.ZodString;
|
|
133
133
|
decider: z.ZodString;
|
|
134
134
|
}, z.core.$strict>>;
|
|
135
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
136
|
+
field: z.ZodString;
|
|
137
|
+
}, z.core.$strict>>;
|
|
135
138
|
session: z.ZodOptional<z.ZodObject<{
|
|
136
139
|
verdicts: z.ZodString;
|
|
137
140
|
seal: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/workspace/records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/workspace/records.ts"],"names":[],"mappings":"AAAA;;;;;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IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM,EAAE,CAQtH;AAWD,oEAAoE;AACpE,wBAAsB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqLnH"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A record's stored source block (#2708): where a proposal came from.
|
|
3
|
+
*
|
|
4
|
+
* chant's provenance (`trust/provenance.ts`) is computed from git: who
|
|
5
|
+
* committed a record, and with which key. It says nothing about the harness,
|
|
6
|
+
* model and session a decision was proposed in, or the conversation behind it.
|
|
7
|
+
* A record kind that declares `source: { field }` opts in to a stored block
|
|
8
|
+
* holding that, next to whatever else its source field says (a decision's
|
|
9
|
+
* issue row or workspace member, a work item's finding):
|
|
10
|
+
*
|
|
11
|
+
* - `via`: how the record reached the workspace, `cli`, `mcp` or `harvest`;
|
|
12
|
+
* - `client`: the MCP client's `clientInfo` (`name`, `version`), or the CLI;
|
|
13
|
+
* - `harness`: the harness's id, such as `claude-code` or `codex`;
|
|
14
|
+
* - `model`: the model id the harness reports;
|
|
15
|
+
* - `session`: the harness's session or conversation id, as a string, or as
|
|
16
|
+
* `{ id, record }` with the chant session record it was held in (#2697);
|
|
17
|
+
* - `turns`: the turn range the decision was made in, `{ from, to }`;
|
|
18
|
+
* - `transcript`: `{ path | uri, sha256 }`, pinning a transcript by hash and
|
|
19
|
+
* never copying it, the way evidence pins a file.
|
|
20
|
+
*
|
|
21
|
+
* Every field is optional, and the block is data about the proposal, not
|
|
22
|
+
* trust: nothing here raises or lowers a record's standing. The rules are
|
|
23
|
+
* three. The fields that are present must have these shapes
|
|
24
|
+
* (`record-schema-invalid` otherwise, beside the kind's own schema). A record
|
|
25
|
+
* written with `via: "harvest"` must open in the kind's first state, since a
|
|
26
|
+
* harvest proposes and a person decides (`source-harvest-not-proposed`, a
|
|
27
|
+
* write refusal). And `records` warns `source-transcript-drift` when the
|
|
28
|
+
* pinned transcript can be read here and its bytes hash to something else.
|
|
29
|
+
*/
|
|
30
|
+
import { z } from "zod";
|
|
31
|
+
/** How a record reached the workspace. Closed. */
|
|
32
|
+
export declare const SOURCE_VIAS: readonly ["cli", "mcp", "harvest"];
|
|
33
|
+
export type SourceVia = (typeof SOURCE_VIAS)[number];
|
|
34
|
+
/** The proposal fields of a source block. Other fields of the block are the kind's, and left to its schema. */
|
|
35
|
+
export declare const sourceBlockSchema: z.ZodObject<{
|
|
36
|
+
via: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
cli: "cli";
|
|
38
|
+
mcp: "mcp";
|
|
39
|
+
harvest: "harvest";
|
|
40
|
+
}>>;
|
|
41
|
+
client: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
version: z.ZodOptional<z.ZodString>;
|
|
44
|
+
title: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>>;
|
|
46
|
+
harness: z.ZodOptional<z.ZodString>;
|
|
47
|
+
model: z.ZodOptional<z.ZodString>;
|
|
48
|
+
session: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodObject<{
|
|
49
|
+
id: z.ZodOptional<z.ZodString>;
|
|
50
|
+
record: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strict>]>>;
|
|
52
|
+
turns: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
from: z.ZodNumber;
|
|
54
|
+
to: z.ZodNumber;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
transcript: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
57
|
+
path: z.ZodString;
|
|
58
|
+
sha256: z.ZodString;
|
|
59
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
+
uri: z.ZodString;
|
|
61
|
+
sha256: z.ZodString;
|
|
62
|
+
}, z.core.$strict>]>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type SourceBlock = z.infer<typeof sourceBlockSchema>;
|
|
65
|
+
/** The source block of `data`, when `field` holds an object. */
|
|
66
|
+
export declare function sourceBlock(data: Record<string, unknown> | null, field: string): Record<string, unknown> | undefined;
|
|
67
|
+
/** What is wrong with the proposal fields of `block`, as `<path> <message>` lines. Empty when nothing is. */
|
|
68
|
+
export declare function sourceBlockProblems(block: Record<string, unknown>, field: string): string[];
|
|
69
|
+
/**
|
|
70
|
+
* The file a transcript pin names, when it can be read here: a `path`
|
|
71
|
+
* (absolute, `~/` from the home directory, or else from the workspace root)
|
|
72
|
+
* or a `file:` URI. Any other URI is not fetched, so it is never reachable.
|
|
73
|
+
*/
|
|
74
|
+
export declare function transcriptFile(transcript: {
|
|
75
|
+
path?: string;
|
|
76
|
+
uri?: string;
|
|
77
|
+
}, workspaceDir: string): string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* The `source-transcript-drift` message for `block`, or undefined: when its
|
|
80
|
+
* transcript pin is well formed, the file it names can be read here, and its
|
|
81
|
+
* bytes hash to something other than the pin. A transcript that can't be
|
|
82
|
+
* read says nothing either way.
|
|
83
|
+
*/
|
|
84
|
+
export declare function transcriptDrift(block: Record<string, unknown>, field: string, workspaceDir: string): string | undefined;
|
|
85
|
+
//# sourceMappingURL=source-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-block.d.ts","sourceRoot":"","sources":["../../src/workspace/source-block.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,kDAAkD;AAClD,eAAO,MAAM,WAAW,oCAAqC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAKrD,+GAA+G;AAC/G,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAGpH;AAED,6GAA6G;AAC7G,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAI3F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAcpH;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBvH"}
|
package/package.json
CHANGED
|
@@ -20,7 +20,8 @@ export async function runServeMcp(ctx: CommandContext): Promise<number> {
|
|
|
20
20
|
const { loadWorkspacePlugins } = await import("../mcp/workspace-plugins");
|
|
21
21
|
({ plugins, instructions } = await loadWorkspacePlugins(process.cwd()));
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
// #2707 — at or inside a declared workspace, the workspace tools are served too.
|
|
24
|
+
const server = new McpServer(plugins, { instructions, workspace: { cwd: process.cwd() } });
|
|
24
25
|
await server.start();
|
|
25
26
|
await new Promise(() => {});
|
|
26
27
|
return 0; // unreachable
|
|
@@ -39,8 +39,9 @@ const guideDoc = readFileSync(join(repoRoot, GUIDE_DOC), "utf8");
|
|
|
39
39
|
const serverSrc = readFileSync(join(repoRoot, SERVER_SRC), "utf8");
|
|
40
40
|
|
|
41
41
|
/** What a client is told when it asks, built from a server with no plugins loaded. */
|
|
42
|
-
async function servedListing(method: "tools/list" | "resources/list"): Promise<string[]> {
|
|
43
|
-
const
|
|
42
|
+
async function servedListing(method: "tools/list" | "resources/list", inWorkspace = false): Promise<string[]> {
|
|
43
|
+
const server = inWorkspace ? new McpServer([], { workspace: { cwd: repoRoot } }) : new McpServer();
|
|
44
|
+
const response = await server.handleRequest({ jsonrpc: "2.0", id: 1, method });
|
|
44
45
|
const result = response.result as { tools?: ToolDefinition[]; resources?: ResourceDefinition[] };
|
|
45
46
|
const names = result.tools?.map((t) => t.name) ?? result.resources?.map((r) => r.uri);
|
|
46
47
|
if (!names || names.length === 0) {
|
|
@@ -82,6 +83,23 @@ describe("the MCP docs describe the server that ships (#2385)", () => {
|
|
|
82
83
|
).toEqual(sorted(registered));
|
|
83
84
|
});
|
|
84
85
|
|
|
86
|
+
test("cli/mcp.mdx's Workspace tools table lists exactly the tools a server inside a workspace adds (#2707)", async () => {
|
|
87
|
+
const core = await servedListing("tools/list");
|
|
88
|
+
// This repository declares a workspace, so a server started in it has them.
|
|
89
|
+
const registered = (await servedListing("tools/list", true)).filter((n) => !core.includes(n));
|
|
90
|
+
expect(registered.length).toBeGreaterThan(0);
|
|
91
|
+
const listed = firstColumnCells(section(mcpDoc, "## Workspace tools", MCP_DOC));
|
|
92
|
+
expect(sorted(listed), `${MCP_DOC}'s "Workspace tools" table and the workspace tools disagree`).toEqual(sorted(registered));
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("guide/agent-integration.mdx lists exactly the workspace tools (#2707)", async () => {
|
|
96
|
+
const core = await servedListing("tools/list");
|
|
97
|
+
const registered = (await servedListing("tools/list", true)).filter((n) => !core.includes(n));
|
|
98
|
+
expect(registered.length).toBeGreaterThan(0);
|
|
99
|
+
const listed = firstColumnCells(section(guideDoc, "### Workspace Tools", GUIDE_DOC));
|
|
100
|
+
expect(sorted(listed), `${GUIDE_DOC}'s "Workspace Tools" table and the workspace tools a server inside a workspace registers disagree`).toEqual(sorted(registered));
|
|
101
|
+
});
|
|
102
|
+
|
|
85
103
|
test("guide/agent-integration.mdx lists exactly the tools the server registers", async () => {
|
|
86
104
|
const registered = await servedListing("tools/list");
|
|
87
105
|
const listed = firstColumnCells(section(guideDoc, "### Available Tools", GUIDE_DOC));
|