@inventarch/mcp-door 3.4.1 → 3.5.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/README.md +8 -5
- package/SPEC.md +2 -0
- package/assets/base/7b36e4b4959a7bead1c57906cd346b419f32570dac0ac764af805ad20cd63b16.ia.tgz +0 -0
- package/assets/base.json +6 -0
- package/dist/main.d.ts +3 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +14 -8
- package/dist/main.js.map +1 -1
- package/dist/method.d.ts +84 -0
- package/dist/method.d.ts.map +1 -0
- package/dist/method.js +228 -0
- package/dist/method.js.map +1 -0
- package/dist/protocol.d.ts +2 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +43 -6
- package/dist/protocol.js.map +1 -1
- package/dist/tools.d.ts +27 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +20 -7
- package/dist/tools.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@inventarch/mcp-door) [](https://github.com/inventarch/ia/actions/workflows/platform-quality.yml) [](LICENSE) [](package.json)
|
|
4
4
|
|
|
5
|
-
> `ia-mcp-door` is a local MCP server that gives an agent host
|
|
5
|
+
> `ia-mcp-door` is a local MCP server that gives an agent host access to IA workspaces over stdio. It serves twenty tools: eleven read-only Door operations from [`@inventarch/runtime`](../../packages/runtime/README.md), the same reads the `ia` CLI performs, `ia_vocabulary`, five scoped `ia_kb_*` knowledge readers, and three method tools, `ia_session`, `ia_catalogue` and `ia_method`, which carry a method kit's procedure to any host.
|
|
6
6
|
>
|
|
7
7
|
> `ia host claude` and `ia host codex` register it for you. Any other MCP client can launch it directly.
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ ia host claude
|
|
|
15
15
|
ia host claude --apply --yes
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Claude Code gets an `ia-workspace` server in `.mcp.json`; `ia host codex --apply --yes` adds `[mcp_servers."ia-workspace"]` to `.codex/config.toml`. Both entries start the copy of this server bundled in the host payload that `ia host` installs under `~/.ia/hosts/` (or `$IA_HOME/hosts/`), with your Node binary and the project's absolute path as `--root`. The files are machine-local; do not commit them. Claude Code asks for approval before it starts a project MCP server.
|
|
18
|
+
Claude Code gets an `ia-workspace` server in `.mcp.json`; `ia host codex --apply --yes` adds `[mcp_servers."ia-workspace"]` to `.codex/config.toml`. Both entries start the copy of this server bundled in the host payload that `ia host` installs under `~/.ia/hosts/` (or `$IA_HOME/hosts/`), with your Node binary and the project's absolute path as `--root`. The files are machine-local; do not commit them. To commit a door entry instead, run `ia host claude --commit` (or `codex` or `copilot`): it adds an `ia` server that runs `npx -y @inventarch/mcp-door@<version>` from the project folder, with no local path, beside an instruction block that names `ia_session`. Claude Code asks for approval before it starts a project MCP server.
|
|
19
19
|
|
|
20
20
|
**With any MCP client.** Install the package and point the server at a workspace:
|
|
21
21
|
|
|
@@ -24,7 +24,7 @@ npm install --global @inventarch/mcp-door
|
|
|
24
24
|
ia-mcp-door --root path/to/your-project
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Without `--root` it serves the current directory. It speaks MCP `2025-11-25` as UTF-8 JSON-RPC, one message per line on stdin and stdout. A client sends `initialize` and `notifications/initialized` before `tools/list` or `tools/call`. In the project from the [root quick start](../../README.md#-quick-start), this session reads the authored `@decision`:
|
|
27
|
+
Without `--root` it serves the current directory. `--kits <folder>` (or the `IA_KITS_DIR` environment variable) names a folder of method kits, such as the `ia` plugin's `config/kits`; the method tools also read the kits installed under `<IA home>/kits/<folder>/<version>/`. At a workspace whose `.ia/distributions.lock.json` installs kits from an npm package of kits (the `package` entry `ia install --package` writes), they read those kits from the workspace store, where the engine installed them as ordinary releases, and never from another copy. A fresh clone holds no store yet: `ia_session` says to run `ia restore`, which refetches them by digest. It speaks MCP `2025-11-25` as UTF-8 JSON-RPC, one message per line on stdin and stdout. A client sends `initialize` and `notifications/initialized` before `tools/list` or `tools/call`. In the project from the [root quick start](../../README.md#-quick-start), this session reads the authored `@decision`:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
30
|
printf '%s\n' \
|
|
@@ -56,6 +56,9 @@ The second response line carries the result as `structuredContent` (shortened he
|
|
|
56
56
|
| `ia_next` | One plan's delivery view, as `ia next` prints it: milestones and tasks in prerequisite order, each task's verdict, and `next`, the command for the first task with no declared blocker. |
|
|
57
57
|
| `ia_position` | `{body, digest, hostNote}` for a scope key: `seat` (an identity or `{path}`), `shape`, `phase`, `depth` (0 to 2), `budget` (0 to 64) and `word`, plus optional `primitive`. Omitted, primitive is derived from shape; explicit primitive also supplies the default phase. No key part means the repository's `@workspace` at context, orient, depth 0, budget 0. |
|
|
58
58
|
| `ia_vocabulary` | The public words and their schemas, from the catalogue shipped with the server. It reads no workspace and takes no scope token. |
|
|
59
|
+
| `ia_session` | `{sessionId, root, workspace, kits, lanes, pin?, restore?, briefing}`: the kits found (`bundled`, `installed` or `home`), `restore` with the kits the lock installs that the store lacks and a briefing line that says to run `ia restore`, the lanes `work`, `knowledge` and `delivery`, the task pin last written for the workspace, and a briefing of at most 2,500 characters. It appends a line to `<IA home>/sessions-v1/<sessionId>.jsonl`. `claim: {path, mode}` is recorded as advisory; nothing is fenced. |
|
|
60
|
+
| `ia_catalogue` | `{lane, items}` for `lane` (`work`, `knowledge` or `delivery`), optionally narrowed by `word` and `phase`. Each item has a `key` such as `work.brainstorm`, its `display` name (`ia-work:brainstorm`, or `ia-work` for `work.*`), its kit, version, capability and profile, a one-line description and its `state`, `bound` or `installed`. |
|
|
61
|
+
| `ia_method` | The method packet for one `key`, exactly as the `ia` plugin's `resolve.mjs` prints it, with the same digest; a refusal is `{error: {code, message, candidates?, key?}}`, such as `IA-CORE-NO-METHOD`. With `task`, it writes the task pin under `<IA home>/work-v1/<project>/<task>/`, `<project>` being the workspace folder's name as a slug. `subject` is kept only as its SHA-256. |
|
|
59
62
|
|
|
60
63
|
The first eight tools were introduced in machine-protocol version 1 and `ia_read`, `ia_next` and `ia_position` in version 2. The server uses the latest protocol, version 3, whose `ia_position` schema additionally accepts `primitive`. A runtime Door explicitly serving version 2 still refuses that parameter. The protocol's `report` operation has no tool; run `ia report` from the CLI.
|
|
61
64
|
|
|
@@ -69,8 +72,8 @@ The `ia_position` body is a pure function of the key and the admitted records. I
|
|
|
69
72
|
|
|
70
73
|
## ⚖️ What it does not do
|
|
71
74
|
|
|
72
|
-
- **It never writes.**
|
|
73
|
-
- **It checks no `@mandate
|
|
75
|
+
- **It never writes a workspace.** The read tools are annotated `readOnlyHint: true`, and the workspace files are unchanged after a session. The method tools write only outside it: the session log and the task pin under the IA home, retained method bytes under its `method-closures-v1`, and a kit's restored read copy under its `kit-roots-v1`. Authoring, validation and capture stay with the CLI (`ia preview`, `ia author`, `ia validate`, `ia capture`).
|
|
76
|
+
- **It checks mandates only for the method tools.** A method tool acts at the server's `--root` or at a root the IA home's `workspace-locations.json` lists, and only when that workspace's governing mandates admit Observation for its default actor. The read tools check no `@mandate`; the CLI's mandate-checked commands, the edit guard and `ia-runner` do. Mandates are cooperative restrictions, not authentication or a sandbox.
|
|
74
77
|
- **It grants nothing.** `ia_select` and `ia_context` choose and deliver records; they execute nothing. A read certifies nothing: the digest identifies bytes, not whether they are true.
|
|
75
78
|
- **Scope tokens are process-local.** A token from `ia_scope` lasts as long as the server process. Narrowing a token limits what later calls read through it.
|
|
76
79
|
- **Bounded transport.** Stdio only, with no network listener. A line over 4 MiB or invalid UTF-8 ends the session, and `tools/list` issues no pagination cursor.
|
package/SPEC.md
CHANGED
|
@@ -5,3 +5,5 @@ Knowledge membership budgets apply after intersecting the original Door membersh
|
|
|
5
5
|
Public language mechanism. The [language reference](LANGUAGE.md) defines vocabulary and evaluation limits. Package exports describe the installed API. Curated agent methods and hosted services are supplied independently.
|
|
6
6
|
|
|
7
7
|
Knowledge integration adds five tools: `ia_kb_check`, `ia_kb_search`, `ia_kb_read`, `ia_kb_resolve`, `ia_kb_traverse`. They use the public KB protocol DTOs. The original Door validates any scope token, supplies membership, and must agree with the KB native graph revision before bodies are read. Unknown/stale tokens, budget overflow and graph changes refuse without widening scope. Arguments cannot change root or select export paths. Local checks expose selected-record admission and closure; workspace compliance is explicitly not evaluated, and excluded records do not contribute diagnostics. The complete JSON-RPC KB tool-result envelope, including text plus structured content and request id, is bounded to 48 KiB. An oversized result returns a bounded refusal. If the request id itself prevents even that refusal from fitting, the server rejects the request before executing a KB operation with JSON-RPC error -32600 and echoes the original id. That protocol error can exceed 48 KiB; truncating or replacing the id would prevent the caller from matching its request. Existing twelve tools and protocol negotiation are preserved.
|
|
8
|
+
|
|
9
|
+
Method tools: `ia_session`, `ia_catalogue` and `ia_method` follow the kit foundation's door contract (C1). They take structured input only; `subject` reaches no position and is kept only as `sha256:<hex>`, the value the packet's `scope.subject` and the pin's `intent.subject` carry. Each takes an optional absolute `root`, which must be the launch root or a row of `<IA home>/workspace-locations.json` (any of its three formats, runtime `readRegistry`), and refuses `IA-CORE-ROOT-UNREGISTERED` otherwise; a root holding `.ia/src` must open and its governing mandates must admit the read mode for the default actor (runtime `checkRoot`). Kits are the bundled folder (`--kits`, else `IA_KITS_DIR`), then `<IA home>/kits/<folder>/<version>/` unless `IA_CORE_NO_HOME_KITS=1`. At a workspace whose lock installs kits through a `package` entry (contract C7b, `dec-133`, db lock engine 0.1.2), the door reads them from the workspace store through runtime `workspaceKits`, between the bundled kits and the home's, and never from the npm package or another copy; one the store lacks refuses `IA-CORE-KIT-RESTORE-REQUIRED`. `ia_session` at a workspace whose installation needs restoring (a fresh clone of a committed lock) opens with no workspace instead of refusing, and adds `restore` and a briefing line saying to run `ia restore`. `tests/kits-package.test.ts` packs the method fixture's ia-kb kit into the archive its `releases.json` names for 0.9.0, installs it through a package entry and reads it from the store. `ia_method` is runtime `resolveMethod`: the packet `resolve.mjs` prints, field for field and with the same digest, for the same consumer, bindings, kit bytes, carrier and task, with `envelope.host` `mcp-door` and `envelope.cliSource` `in-process`. A `task` pins under `<IA home>/work-v1/<projectOf(root)>/<task>/`: the plugin's `lib/pin.mjs` takes its project from the caller and derives none, and the lanes pass a task only, so the project is the workspace folder's name as a slug (runtime `projectOf`). When the bundled folder is a plugin's `config/kits`, that plugin's `scripts/` and support files are the carrier its implementation digest and retained bytes cover, so a pin written by either reader verifies in the other. A kit's read root is restored in process, under `<IA home>/kit-roots-v1/` and never in the shared temporary folder, from the language base this package carries in `assets/base/` (generated with the CLI's); a kit locked on another base refuses `IA-CORE-CLI-UNSUPPORTED`. `tests/method.test.ts` holds the packets and the pin to the goldens in `tests/fixtures/method`, whose `PROVENANCE.json` names the marketplace commit they were made from and `generate.mjs`, the script that makes them again from a `git archive` of that commit and a built CLI, byte for byte. The seventeen read tools, their schemas and their order are unchanged; the method tools follow them.
|
|
Binary file
|
package/assets/base.json
ADDED
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
export declare const MAX_LINE_BYTES: number;
|
|
3
|
-
export declare function serve(root: string
|
|
3
|
+
export declare function serve(root: string, options?: {
|
|
4
|
+
readonly kits?: string;
|
|
5
|
+
}): Promise<void>;
|
|
4
6
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,cAAc,QAAkB,CAAC;AAC9C,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,cAAc,QAAkB,CAAC;AAC9C,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CjG"}
|
package/dist/main.js
CHANGED
|
@@ -3,8 +3,8 @@ import { once } from 'node:events';
|
|
|
3
3
|
import { isEntry } from '@inventarch/runtime/entry';
|
|
4
4
|
import { Protocol, rpcError } from './protocol.js';
|
|
5
5
|
export const MAX_LINE_BYTES = 4 * 1024 * 1024;
|
|
6
|
-
export async function serve(root) {
|
|
7
|
-
const protocol = new Protocol(root), decoder = new TextDecoder('utf-8', { fatal: true });
|
|
6
|
+
export async function serve(root, options = {}) {
|
|
7
|
+
const protocol = new Protocol(root, options), decoder = new TextDecoder('utf-8', { fatal: true });
|
|
8
8
|
let pending = '';
|
|
9
9
|
const send = async (response) => {
|
|
10
10
|
if (response !== undefined && !process.stdout.write(JSON.stringify(response) + '\n'))
|
|
@@ -63,16 +63,22 @@ async function main() {
|
|
|
63
63
|
});
|
|
64
64
|
const args = process.argv.slice(2);
|
|
65
65
|
if (args.length === 1 && args[0] === '--help') {
|
|
66
|
-
process.stdout.write('Usage: ia-mcp-door [--root <workspace>]\nMCP2025-11-25 read tools over UTF-8 JSON-RPC lines on stdin/stdout.\n');
|
|
66
|
+
process.stdout.write('Usage: ia-mcp-door [--root <workspace>] [--kits <folder>]\nMCP2025-11-25 read tools and the method tools over UTF-8 JSON-RPC lines on stdin/stdout.\n');
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
const options = new Map();
|
|
70
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
71
|
+
const name = args[i], value = args[i + 1];
|
|
72
|
+
if ((name !== '--root' && name !== '--kits') || value === undefined || options.has(name)) {
|
|
73
|
+
process.stderr.write('Usage: ia-mcp-door [--root <workspace>] [--kits <folder>]\n');
|
|
74
|
+
process.exitCode = 2;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
options.set(name, value);
|
|
73
78
|
}
|
|
79
|
+
const kits = options.get('--kits');
|
|
74
80
|
try {
|
|
75
|
-
await serve(
|
|
81
|
+
await serve(options.get('--root') ?? process.cwd(), kits === undefined ? {} : { kits });
|
|
76
82
|
}
|
|
77
83
|
catch (error) {
|
|
78
84
|
if (!process.stdout.destroyed && error.code !== 'EPIPE') {
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAY;
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAY,EAAE,UAAsC,EAAE;IAChF,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,EAC1C,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,MAAM,IAAI,GAAG,KAAK,EAAE,QAA8B,EAAiB,EAAE;QACnE,IAAI,QAAQ,KAA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MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC;AACD,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IAAE,KAAK,IAAI,EAAE,CAAC"}
|
package/dist/method.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Kit } from '@inventarch/runtime/method';
|
|
2
|
+
/**
|
|
3
|
+
* The door's method tools: `ia_session`, `ia_catalogue` and `ia_method`. They take structured input only; `subject`
|
|
4
|
+
* is never read as a request and is stored only as its hash. Each acts at the door's launch root or at a root the
|
|
5
|
+
* IA home's workspace registry lists, and only after that workspace's mandates admit the read (Observation). Kits are
|
|
6
|
+
* read from the bundled folder (`--kits`, else `IA_KITS_DIR`) and then the IA home's `kits/`; at a workspace whose lock
|
|
7
|
+
* installs kits from an npm package of kits (contract C7b), from its store too, as ordinary installed releases. A
|
|
8
|
+
* session at a workspace whose store lacks them, a fresh clone, says to run `ia restore`. A kit's read root is restored
|
|
9
|
+
* in process with the language base this package carries; nothing spawns the CLI.
|
|
10
|
+
*/
|
|
11
|
+
export interface MethodHost {
|
|
12
|
+
/** The door's launch root. */
|
|
13
|
+
readonly root: string;
|
|
14
|
+
/** The bundled kit folder, `--kits` or `IA_KITS_DIR`. */
|
|
15
|
+
readonly kits?: string;
|
|
16
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
17
|
+
/** The parent of the per-user kit read-root cache; `<IA home>/kit-roots-v1` by default. */
|
|
18
|
+
readonly cache?: string;
|
|
19
|
+
}
|
|
20
|
+
export type MethodOperation = 'method:session' | 'method:catalogue' | 'method:method';
|
|
21
|
+
type Result = {
|
|
22
|
+
readonly ok: true;
|
|
23
|
+
readonly value: unknown;
|
|
24
|
+
} | {
|
|
25
|
+
readonly ok: false;
|
|
26
|
+
readonly value: unknown;
|
|
27
|
+
};
|
|
28
|
+
export declare const METHOD_TOOLS: readonly [{
|
|
29
|
+
readonly name: "ia_session";
|
|
30
|
+
readonly operation: "method:session";
|
|
31
|
+
readonly description: "Start an IA session: returns its id, the workspace, the kits found (bundled or home), the three lanes, the current task pin and a briefing of at most 2,500 characters, and appends a line to the public session log under the IA home. A claim is advisory and never fenced.";
|
|
32
|
+
readonly inputSchema: {
|
|
33
|
+
type: string;
|
|
34
|
+
properties: Record<string, unknown>;
|
|
35
|
+
required: readonly string[];
|
|
36
|
+
additionalProperties: boolean;
|
|
37
|
+
};
|
|
38
|
+
readonly annotations: {
|
|
39
|
+
readonly readOnlyHint: false;
|
|
40
|
+
readonly destructiveHint: false;
|
|
41
|
+
readonly idempotentHint: false;
|
|
42
|
+
readonly openWorldHint: false;
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "ia_catalogue";
|
|
46
|
+
readonly operation: "method:catalogue";
|
|
47
|
+
readonly description: "List one lane's activities: each item's key, display name, kit, version, capability, profile, one-line description and state (bound or installed). Map the request to one key and pass it to ia_method; no free text is read.";
|
|
48
|
+
readonly inputSchema: {
|
|
49
|
+
type: string;
|
|
50
|
+
properties: Record<string, unknown>;
|
|
51
|
+
required: readonly string[];
|
|
52
|
+
additionalProperties: boolean;
|
|
53
|
+
};
|
|
54
|
+
readonly annotations: {
|
|
55
|
+
readonly readOnlyHint: true;
|
|
56
|
+
readonly destructiveHint: false;
|
|
57
|
+
readonly openWorldHint: false;
|
|
58
|
+
};
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "ia_method";
|
|
61
|
+
readonly operation: "method:method";
|
|
62
|
+
readonly description: "Resolve one activity key (from ia_catalogue) to its method packet: the bound kit's capability, its instructions, references, role brief, required checks and digest, exactly as the ia plugin's resolver prints it. With task, the task pin is written under the IA home with the subject's hash, never its text.";
|
|
63
|
+
readonly inputSchema: {
|
|
64
|
+
type: string;
|
|
65
|
+
properties: Record<string, unknown>;
|
|
66
|
+
required: readonly string[];
|
|
67
|
+
additionalProperties: boolean;
|
|
68
|
+
};
|
|
69
|
+
readonly annotations: {
|
|
70
|
+
readonly readOnlyHint: false;
|
|
71
|
+
readonly destructiveHint: false;
|
|
72
|
+
readonly idempotentHint: false;
|
|
73
|
+
readonly openWorldHint: false;
|
|
74
|
+
};
|
|
75
|
+
}];
|
|
76
|
+
/** Restores a kit's read root in process: the language base this package carries, cached, planned and installed. */
|
|
77
|
+
export declare function restoreKit(root: string, kit: Kit): void;
|
|
78
|
+
export declare class MethodTools {
|
|
79
|
+
#private;
|
|
80
|
+
constructor(host: MethodHost);
|
|
81
|
+
call(operation: MethodOperation, input: unknown): Result;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../src/method.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,GAAG,EAAyB,MAAM,4BAA4B,CAAC;AAE7E;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,eAAe,CAAC;AACtF,KAAK,MAAM,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAkB/G,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDf,CAAC;AAOX,oHAAoH;AACpH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAkBvD;AAkBD,qBAAa,WAAW;;gBAEV,IAAI,EAAE,UAAU;IA+C5B,IAAI,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM;CAmFzD"}
|
package/dist/method.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { isAbsolute, join, resolve } from 'node:path';
|
|
4
|
+
import { applyInstallation, cacheArchive, planInstallation } from '@inventarch/distribution/install';
|
|
5
|
+
import { ENTRIES, MethodError, checkRoot, iaHome, laneCatalogue, workspaceKits, methodRefusal, openSession, projectOf, RESTORE_NEEDED, sessionRestore, readRegistry, resolveMethod, samePath, } from '@inventarch/runtime/method';
|
|
6
|
+
const BASE_URL = new URL('../assets/base.json', import.meta.url);
|
|
7
|
+
const SLUG = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
8
|
+
const KEY = /^([a-z]+)\.([a-z][a-z0-9-]*|\*)$/;
|
|
9
|
+
const text = { type: 'string' };
|
|
10
|
+
const schema = (properties, required = []) => ({
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties,
|
|
13
|
+
required,
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
});
|
|
16
|
+
const rootProperty = {
|
|
17
|
+
...text,
|
|
18
|
+
maxLength: 4096,
|
|
19
|
+
description: "An absolute workspace root: the door's launch root or one the IA home's workspace registry lists.",
|
|
20
|
+
};
|
|
21
|
+
export const METHOD_TOOLS = [
|
|
22
|
+
{
|
|
23
|
+
name: 'ia_session',
|
|
24
|
+
operation: 'method:session',
|
|
25
|
+
description: 'Start an IA session: returns its id, the workspace, the kits found (bundled or home), the three lanes, the current task pin and a briefing of at most 2,500 characters, and appends a line to the public session log under the IA home. A claim is advisory and never fenced.',
|
|
26
|
+
inputSchema: schema({
|
|
27
|
+
root: rootProperty,
|
|
28
|
+
parent: { ...text, maxLength: 128, description: 'The id of the session that started this one.' },
|
|
29
|
+
claim: schema({
|
|
30
|
+
path: { ...text, maxLength: 1024, description: 'A workspace-relative path the session means to work in.' },
|
|
31
|
+
mode: { enum: ['read', 'write'] },
|
|
32
|
+
}, ['path', 'mode']),
|
|
33
|
+
}),
|
|
34
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'ia_catalogue',
|
|
38
|
+
operation: 'method:catalogue',
|
|
39
|
+
description: "List one lane's activities: each item's key, display name, kit, version, capability, profile, one-line description and state (bound or installed). Map the request to one key and pass it to ia_method; no free text is read.",
|
|
40
|
+
inputSchema: schema({
|
|
41
|
+
lane: { enum: [...ENTRIES] },
|
|
42
|
+
word: { ...text, maxLength: 64, description: 'Keep only the activity of this name, such as decision.' },
|
|
43
|
+
phase: { enum: ['orient', 'plan', 'act', 'learn'] },
|
|
44
|
+
root: rootProperty,
|
|
45
|
+
}, ['lane']),
|
|
46
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'ia_method',
|
|
50
|
+
operation: 'method:method',
|
|
51
|
+
description: "Resolve one activity key (from ia_catalogue) to its method packet: the bound kit's capability, its instructions, references, role brief, required checks and digest, exactly as the ia plugin's resolver prints it. With task, the task pin is written under the IA home with the subject's hash, never its text.",
|
|
52
|
+
inputSchema: schema({
|
|
53
|
+
key: { ...text, maxLength: 96, description: '<lane>.<activity>, such as work.brainstorm.' },
|
|
54
|
+
root: rootProperty,
|
|
55
|
+
subject: {
|
|
56
|
+
...text,
|
|
57
|
+
maxLength: 4096,
|
|
58
|
+
description: 'What the task is about; stored and returned only as its sha256.',
|
|
59
|
+
},
|
|
60
|
+
task: { ...text, maxLength: 128, description: 'A task slug: pins the resolution under that task.' },
|
|
61
|
+
}, ['key']),
|
|
62
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
/** Restores a kit's read root in process: the language base this package carries, cached, planned and installed. */
|
|
66
|
+
export function restoreKit(root, kit) {
|
|
67
|
+
let pin;
|
|
68
|
+
try {
|
|
69
|
+
pin = JSON.parse(readFileSync(BASE_URL, 'utf8'));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
throw new MethodError('this door carries no language base; reinstall @inventarch/mcp-door', 'IA-CORE-CLI-MISSING');
|
|
73
|
+
}
|
|
74
|
+
const lock = JSON.parse(readFileSync(join(root, '.ia', 'distributions.lock.json'), 'utf8'));
|
|
75
|
+
const language = lock.packages?.find((pkg) => pkg.id === pin.id);
|
|
76
|
+
if (language?.archive !== pin.archive)
|
|
77
|
+
throw new MethodError(`kit ${kit.id} ${kit.latest?.version ?? kit.version} locks ${pin.id} ${language?.version ?? 'an unknown version'}, and this door carries ${pin.version}: use the @inventarch/mcp-door release that ships it`, 'IA-CORE-CLI-UNSUPPORTED');
|
|
78
|
+
cacheArchive(root, readFileSync(new URL(`../assets/base/${pin.archive}.ia.tgz`, import.meta.url)), pin.archive);
|
|
79
|
+
applyInstallation(planInstallation(root, lock, 'restore'));
|
|
80
|
+
}
|
|
81
|
+
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
82
|
+
function usage(message) {
|
|
83
|
+
throw new MethodError(message, 'IA-CORE-USAGE');
|
|
84
|
+
}
|
|
85
|
+
function optional(args, name, limit) {
|
|
86
|
+
const value = args[name];
|
|
87
|
+
if (value === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
if (typeof value !== 'string' || value.length === 0 || value.length > limit)
|
|
90
|
+
usage(`${name} must be a string of 1 to ${limit} characters`);
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
function only(args, allowed) {
|
|
94
|
+
for (const key of Object.keys(args))
|
|
95
|
+
if (!allowed.includes(key))
|
|
96
|
+
usage(`unknown argument ${key}`);
|
|
97
|
+
}
|
|
98
|
+
export class MethodTools {
|
|
99
|
+
#host;
|
|
100
|
+
constructor(host) {
|
|
101
|
+
this.#host = host;
|
|
102
|
+
}
|
|
103
|
+
get #env() {
|
|
104
|
+
return this.#host.env ?? process.env;
|
|
105
|
+
}
|
|
106
|
+
get #home() {
|
|
107
|
+
return iaHome(this.#env);
|
|
108
|
+
}
|
|
109
|
+
get #sources() {
|
|
110
|
+
const env = this.#env;
|
|
111
|
+
const bundled = this.#host.kits ?? env['IA_KITS_DIR'];
|
|
112
|
+
const home = env['IA_CORE_NO_HOME_KITS'] === '1' ? null : join(this.#home, 'kits');
|
|
113
|
+
return { ...(bundled ? { bundled: resolve(bundled) } : {}), home };
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The root a call names: the launch root, or a registered one, once its mandates admit the read. With `restorable`, a
|
|
117
|
+
* workspace whose installation needs restoring (a fresh clone of a committed lock) opens with no workspace and says so.
|
|
118
|
+
*/
|
|
119
|
+
#root(value, restorable = false) {
|
|
120
|
+
let root = resolve(this.#host.root);
|
|
121
|
+
if (value !== undefined) {
|
|
122
|
+
if (!isAbsolute(value))
|
|
123
|
+
usage(`root must be an absolute path: ${value}`);
|
|
124
|
+
const registered = readRegistry(this.#home).workspaces.find((row) => samePath(row.root, value));
|
|
125
|
+
if (!samePath(value, root) && registered === undefined)
|
|
126
|
+
throw new MethodError(`${value} is neither this door's root nor a workspace the IA home's registry lists`, 'IA-CORE-ROOT-UNREGISTERED');
|
|
127
|
+
root = resolve(value);
|
|
128
|
+
}
|
|
129
|
+
if (!existsSync(join(root, '.ia', 'src')))
|
|
130
|
+
return { root, workspace: null };
|
|
131
|
+
try {
|
|
132
|
+
return { root, workspace: checkRoot(root, 'read').workspace };
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
const reason = error?.reason;
|
|
136
|
+
if (!restorable || (reason !== 'restore-required' && reason !== 'lock-drift'))
|
|
137
|
+
throw error;
|
|
138
|
+
return { root, workspace: null, unrestored: error.message };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** The kits at a root: a workspace's include those its lock installs from a package, and those its store lacks. */
|
|
142
|
+
#kits(root) {
|
|
143
|
+
return workspaceKits(this.#sources, existsSync(join(root, '.ia', 'src')) ? root : null, this.#env);
|
|
144
|
+
}
|
|
145
|
+
call(operation, input) {
|
|
146
|
+
try {
|
|
147
|
+
const args = object(input);
|
|
148
|
+
if (operation === 'method:session')
|
|
149
|
+
return { ok: true, value: this.#session(args) };
|
|
150
|
+
if (operation === 'method:catalogue')
|
|
151
|
+
return { ok: true, value: this.#catalogue(args) };
|
|
152
|
+
return { ok: true, value: this.#method(args) };
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
return { ok: false, value: methodRefusal(error) };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
#session(args) {
|
|
159
|
+
only(args, ['root', 'parent', 'claim']);
|
|
160
|
+
const parent = optional(args, 'parent', 128);
|
|
161
|
+
const claim = args['claim'] === undefined ? undefined : object(args['claim']);
|
|
162
|
+
if (claim !== undefined) {
|
|
163
|
+
only(claim, ['path', 'mode']);
|
|
164
|
+
if (typeof claim['path'] !== 'string' || claim['path'].length === 0 || isAbsolute(claim['path']))
|
|
165
|
+
usage('claim.path must be a workspace-relative path');
|
|
166
|
+
if (claim['mode'] !== 'read' && claim['mode'] !== 'write')
|
|
167
|
+
usage('claim.mode is read or write');
|
|
168
|
+
}
|
|
169
|
+
const { root, workspace, unrestored } = this.#root(optional(args, 'root', 4096), true);
|
|
170
|
+
const { kits, missing } = this.#kits(root);
|
|
171
|
+
const restore = unrestored === undefined
|
|
172
|
+
? undefined
|
|
173
|
+
: (sessionRestore(missing) ?? {
|
|
174
|
+
kits: [],
|
|
175
|
+
message: `This workspace's installation is not restored (${unrestored}): ${RESTORE_NEEDED} in this workspace.`,
|
|
176
|
+
});
|
|
177
|
+
return openSession(this.#home, {
|
|
178
|
+
root,
|
|
179
|
+
workspace,
|
|
180
|
+
kits,
|
|
181
|
+
missing,
|
|
182
|
+
...(restore === undefined ? {} : { restore }),
|
|
183
|
+
...(parent === undefined ? {} : { parent }),
|
|
184
|
+
...(claim === undefined
|
|
185
|
+
? {}
|
|
186
|
+
: { claim: { path: claim['path'], mode: claim['mode'] } }),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
#catalogue(args) {
|
|
190
|
+
only(args, ['lane', 'word', 'phase', 'root']);
|
|
191
|
+
const lane = optional(args, 'lane', 16) ?? usage('lane is required');
|
|
192
|
+
const word = optional(args, 'word', 64);
|
|
193
|
+
const phase = optional(args, 'phase', 16);
|
|
194
|
+
if (word !== undefined && !/^[a-z][a-z0-9-]*$/.test(word))
|
|
195
|
+
usage('word must be a lowercase word');
|
|
196
|
+
if (phase !== undefined && !['orient', 'plan', 'act', 'learn'].includes(phase))
|
|
197
|
+
usage('phase must be orient, plan, act or learn');
|
|
198
|
+
const { root } = this.#root(optional(args, 'root', 4096));
|
|
199
|
+
return laneCatalogue({ lane, ...(word === undefined ? {} : { word }), ...(phase === undefined ? {} : { phase }) }, { root: existsSync(join(root, '.ia', 'src')) ? root : null, kits: this.#kits(root).kits });
|
|
200
|
+
}
|
|
201
|
+
#method(args) {
|
|
202
|
+
only(args, ['key', 'root', 'subject', 'task']);
|
|
203
|
+
const key = optional(args, 'key', 96) ?? usage('key is required');
|
|
204
|
+
const matched = KEY.exec(key) ?? usage(`key must be <lane>.<activity>: ${key}`);
|
|
205
|
+
const task = optional(args, 'task', 128);
|
|
206
|
+
if (task !== undefined && !SLUG.test(task))
|
|
207
|
+
usage(`task must be a slug: ${task}`);
|
|
208
|
+
const subject = optional(args, 'subject', 4096);
|
|
209
|
+
const { root } = this.#root(optional(args, 'root', 4096));
|
|
210
|
+
const project = projectOf(root);
|
|
211
|
+
return resolveMethod({
|
|
212
|
+
entry: matched[1],
|
|
213
|
+
activity: matched[2],
|
|
214
|
+
root,
|
|
215
|
+
host: 'mcp-door',
|
|
216
|
+
...(subject === undefined
|
|
217
|
+
? {}
|
|
218
|
+
: { subject: `sha256:${createHash('sha256').update(subject, 'utf8').digest('hex')}` }),
|
|
219
|
+
...(task === undefined ? {} : { project, task }),
|
|
220
|
+
}, {
|
|
221
|
+
kits: this.#sources,
|
|
222
|
+
restore: restoreKit,
|
|
223
|
+
env: this.#env,
|
|
224
|
+
...(this.#host.cache === undefined ? {} : { cache: this.#host.cache }),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.js","sourceRoot":"","sources":["../src/method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACrG,OAAO,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,MAAM,EACN,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,SAAS,EACT,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,GACT,MAAM,4BAA4B,CAAC;AAwBpC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjE,MAAM,IAAI,GAAG,oCAAoC,C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,CAAE;YAClB,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAE;YACrB,IAAI;YACJ,IAAI,EAAE,UAAU;YAChB,GAAG,CAAC,OAAO,KAAK,SAAS;gBACvB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;YACxF,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SACjD,EACD;YACE,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,OAAO,EAAE,UAAU;YACnB,GAAG,EAAE,IAAI,CAAC,IAAI;YACd,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;SACvE,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MethodHost } from './method.js';
|
|
1
2
|
export declare const PROTOCOL_VERSION = "2025-11-25";
|
|
2
3
|
type Id = string | number | null;
|
|
3
4
|
export interface Response {
|
|
@@ -12,7 +13,7 @@ export interface Response {
|
|
|
12
13
|
export declare const rpcError: (id: Id, code: number, message: string) => Response;
|
|
13
14
|
export declare class Protocol {
|
|
14
15
|
#private;
|
|
15
|
-
constructor(root: string);
|
|
16
|
+
constructor(root: string, options?: Omit<MethodHost, 'root'>);
|
|
16
17
|
line(line: string): Response | undefined;
|
|
17
18
|
request(message: unknown): Response | undefined;
|
|
18
19
|
close(): void;
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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QAAQ;;gBAOP,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAM;IAWhE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IASxC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS;IAoI/C,KAAK,IAAI,IAAI;CAId"}
|
package/dist/protocol.js
CHANGED
|
@@ -5,6 +5,7 @@ import { compactContext } from './presentation.js';
|
|
|
5
5
|
import { vocabulary } from './vocabulary.js';
|
|
6
6
|
import { knowledgeTool } from './kb.js';
|
|
7
7
|
import { LIMITS } from '@inventarch/kb';
|
|
8
|
+
import { MethodTools } from './method.js';
|
|
8
9
|
export const PROTOCOL_VERSION = '2025-11-25';
|
|
9
10
|
const PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
10
11
|
export const rpcError = (id, code, message) => ({
|
|
@@ -15,11 +16,22 @@ export const rpcError = (id, code, message) => ({
|
|
|
15
16
|
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
16
17
|
export class Protocol {
|
|
17
18
|
#root;
|
|
19
|
+
/** The workspace Door, or undefined when the workspace does not open yet (a fresh clone needs `ia restore`). */
|
|
18
20
|
#door;
|
|
21
|
+
#unopened;
|
|
22
|
+
#method;
|
|
19
23
|
#state = 'new';
|
|
20
|
-
constructor(root) {
|
|
24
|
+
constructor(root, options = {}) {
|
|
21
25
|
this.#root = root;
|
|
22
|
-
|
|
26
|
+
// A workspace whose installation needs restoring does not open, yet the method tools still serve it, so ia_session
|
|
27
|
+
// can say to run ia restore; the read tools answer that same refusal until it is restored.
|
|
28
|
+
try {
|
|
29
|
+
this.#door = new Door(root, { cache: false });
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
this.#unopened = error instanceof Error ? error : new Error(String(error));
|
|
33
|
+
}
|
|
34
|
+
this.#method = new MethodTools({ root, ...options });
|
|
23
35
|
}
|
|
24
36
|
line(line) {
|
|
25
37
|
let message;
|
|
@@ -67,7 +79,7 @@ export class Protocol {
|
|
|
67
79
|
protocolVersion: PROTOCOL_VERSION,
|
|
68
80
|
capabilities: { tools: {} },
|
|
69
81
|
serverInfo: { name: 'ia-mcp-door', version: PACKAGE_VERSION },
|
|
70
|
-
instructions: 'Declare phase and primitive for context/selection. Scope tokens live only in this server process. These tools read; selection grants no execution permission.',
|
|
82
|
+
instructions: 'Declare phase and primitive for context/selection. Scope tokens live only in this server process. These tools read; selection grants no execution permission. Start a session with ia_session, list a lane with ia_catalogue and resolve one key with ia_method; those three write only under the IA home.',
|
|
71
83
|
});
|
|
72
84
|
}
|
|
73
85
|
if (this.#state !== 'ready')
|
|
@@ -84,6 +96,31 @@ export class Protocol {
|
|
|
84
96
|
if (params['arguments'] !== undefined && !object(params['arguments']))
|
|
85
97
|
return rpcError(requestId, -32602, 'Tool arguments must be an object');
|
|
86
98
|
const args = { ...(params['arguments'] ?? {}) };
|
|
99
|
+
if (operation.startsWith('method:')) {
|
|
100
|
+
const answer = this.#method.call(operation, args);
|
|
101
|
+
return success({
|
|
102
|
+
content: [{ type: 'text', text: JSON.stringify(answer.value) }],
|
|
103
|
+
structuredContent: answer.value,
|
|
104
|
+
isError: !answer.ok,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (this.#door === undefined) {
|
|
108
|
+
const reason = this.#unopened;
|
|
109
|
+
const value = {
|
|
110
|
+
version: 1,
|
|
111
|
+
ok: false,
|
|
112
|
+
error: {
|
|
113
|
+
code: reason?.code ?? 'IA-DB-SOURCE-UNAVAILABLE',
|
|
114
|
+
message: reason?.message ?? 'workspace unavailable',
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
return success({
|
|
118
|
+
content: [{ type: 'text', text: JSON.stringify(value) }],
|
|
119
|
+
structuredContent: value,
|
|
120
|
+
isError: true,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const door = this.#door;
|
|
87
124
|
const format = operation === 'context' ? args['format'] : undefined;
|
|
88
125
|
if (format !== undefined && format !== 'full' && format !== 'compact')
|
|
89
126
|
return rpcError(requestId, -32602, 'context format must be full or compact');
|
|
@@ -107,10 +144,10 @@ export class Protocol {
|
|
|
107
144
|
if (knowledge && size(bounded) > LIMITS.responseBytes)
|
|
108
145
|
return rpcError(requestId, -32600, 'Knowledge request id exceeds response budget');
|
|
109
146
|
const raw = knowledge
|
|
110
|
-
? knowledgeTool(this.#root,
|
|
147
|
+
? knowledgeTool(this.#root, door, operation.slice(3), args)
|
|
111
148
|
: operation === 'vocabulary'
|
|
112
149
|
? vocabulary(args)
|
|
113
|
-
:
|
|
150
|
+
: door.request({ operation, params: args });
|
|
114
151
|
const result = format === 'compact' ? compactContext(raw) : raw;
|
|
115
152
|
const envelope = (value) => success({
|
|
116
153
|
content: [{ type: 'text', text: JSON.stringify(value) }],
|
|
@@ -136,7 +173,7 @@ export class Protocol {
|
|
|
136
173
|
}
|
|
137
174
|
close() {
|
|
138
175
|
this.#state = 'closed';
|
|
139
|
-
this.#door
|
|
176
|
+
this.#door?.close();
|
|
140
177
|
}
|
|
141
178
|
}
|
|
142
179
|
//# sourceMappingURL=protocol.js.map
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,gB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,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;oBACrF,CAAC;gBACH,CAAC;gBACD,OAAO,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjF,CAAC;YACD,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,mBAAmB,MAAM,GAAG,CAAC,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IACD,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** The read tools, then the three method tools, which are not read-only: a session log line and a task pin under the IA home. */
|
|
2
|
+
export declare const TOOLS: ({
|
|
2
3
|
name: string;
|
|
3
4
|
description: string;
|
|
4
5
|
inputSchema: Readonly<Record<string, unknown>> | {
|
|
@@ -72,6 +73,30 @@ export declare const TOOLS: {
|
|
|
72
73
|
destructiveHint: boolean;
|
|
73
74
|
openWorldHint: boolean;
|
|
74
75
|
};
|
|
75
|
-
}
|
|
76
|
+
} | {
|
|
77
|
+
name: "ia_session" | "ia_catalogue" | "ia_method";
|
|
78
|
+
description: "Start an IA session: returns its id, the workspace, the kits found (bundled or home), the three lanes, the current task pin and a briefing of at most 2,500 characters, and appends a line to the public session log under the IA home. A claim is advisory and never fenced." | "List one lane's activities: each item's key, display name, kit, version, capability, profile, one-line description and state (bound or installed). Map the request to one key and pass it to ia_method; no free text is read." | "Resolve one activity key (from ia_catalogue) to its method packet: the bound kit's capability, its instructions, references, role brief, required checks and digest, exactly as the ia plugin's resolver prints it. With task, the task pin is written under the IA home with the subject's hash, never its text.";
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: string;
|
|
81
|
+
properties: Record<string, unknown>;
|
|
82
|
+
required: readonly string[];
|
|
83
|
+
additionalProperties: boolean;
|
|
84
|
+
};
|
|
85
|
+
annotations: {
|
|
86
|
+
readonly readOnlyHint: false;
|
|
87
|
+
readonly destructiveHint: false;
|
|
88
|
+
readonly idempotentHint: false;
|
|
89
|
+
readonly openWorldHint: false;
|
|
90
|
+
} | {
|
|
91
|
+
readonly readOnlyHint: true;
|
|
92
|
+
readonly destructiveHint: false;
|
|
93
|
+
readonly openWorldHint: false;
|
|
94
|
+
} | {
|
|
95
|
+
readonly readOnlyHint: false;
|
|
96
|
+
readonly destructiveHint: false;
|
|
97
|
+
readonly idempotentHint: false;
|
|
98
|
+
readonly openWorldHint: false;
|
|
99
|
+
};
|
|
100
|
+
})[];
|
|
76
101
|
export declare const OPERATIONS: Map<string, string>;
|
|
77
102
|
//# sourceMappingURL=tools.d.ts.map
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAoFA,iIAAiI;AACjI,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAajB,CAAC;AACF,eAAO,MAAM,UAAU,qBAGrB,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MACHINE_PROTOCOL } from '@inventarch/runtime';
|
|
2
2
|
import { KB_OPERATIONS } from '@inventarch/kb/protocol';
|
|
3
3
|
import { LIMITS } from './vocabulary.js';
|
|
4
|
+
import { METHOD_TOOLS } from './method.js';
|
|
4
5
|
const text = { type: 'string' };
|
|
5
6
|
const object = (properties, required = []) => ({
|
|
6
7
|
type: 'object',
|
|
@@ -73,11 +74,23 @@ const definitions = [
|
|
|
73
74
|
inputSchema: row.inputSchema,
|
|
74
75
|
})),
|
|
75
76
|
];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
description,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
/** The read tools, then the three method tools, which are not read-only: a session log line and a task pin under the IA home. */
|
|
78
|
+
export const TOOLS = [
|
|
79
|
+
...definitions.map(({ name, description, inputSchema }) => ({
|
|
80
|
+
name,
|
|
81
|
+
description,
|
|
82
|
+
inputSchema,
|
|
83
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
84
|
+
})),
|
|
85
|
+
...METHOD_TOOLS.map(({ name, description, inputSchema, annotations }) => ({
|
|
86
|
+
name,
|
|
87
|
+
description,
|
|
88
|
+
inputSchema,
|
|
89
|
+
annotations,
|
|
90
|
+
})),
|
|
91
|
+
];
|
|
92
|
+
export const OPERATIONS = new Map([
|
|
93
|
+
...definitions.map(({ name, operation }) => [name, operation]),
|
|
94
|
+
...METHOD_TOOLS.map(({ name, operation }) => [name, operation]),
|
|
95
|
+
]);
|
|
83
96
|
//# sourceMappingURL=tools.js.map
|
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names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AACjI,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;QAC1D,IAAI;QACJ,WAAW;QACX,WAAW;QACX,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE;KAClF,CAAC,CAAC;IACH,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI;QACJ,WAAW;QACX,WAAW;QACX,WAAW;KACZ,CAAC,CAAC;CACJ,CAAC;AACF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAiB;IAChD,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAU,CAAC;IACvE,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAU,CAAC;CACzE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inventarch/mcp-door",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"types": "./dist/main.d.ts",
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
"LANGUAGE.md"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@inventarch/
|
|
18
|
-
"@inventarch/
|
|
17
|
+
"@inventarch/distribution": "3.5.0",
|
|
18
|
+
"@inventarch/kb": "3.5.0",
|
|
19
|
+
"@inventarch/runtime": "3.5.0"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"@types/node": "^22.19.0",
|