@ora-ai/cli 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -1
- package/README.md +569 -462
- package/dist/command-tree.d.ts +30 -0
- package/dist/command-tree.d.ts.map +1 -0
- package/dist/command-tree.js +144 -0
- package/dist/command-tree.js.map +1 -0
- package/dist/core/error-envelope.d.ts +13 -4
- package/dist/core/error-envelope.d.ts.map +1 -1
- package/dist/core/error-envelope.js +19 -4
- package/dist/core/error-envelope.js.map +1 -1
- package/dist/core/error-stories.d.ts +36 -0
- package/dist/core/error-stories.d.ts.map +1 -0
- package/dist/core/error-stories.js +155 -0
- package/dist/core/error-stories.js.map +1 -0
- package/dist/core/http.d.ts +14 -3
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +24 -6
- package/dist/core/http.js.map +1 -1
- package/dist/core/limit-story.d.ts +2 -0
- package/dist/core/limit-story.d.ts.map +1 -1
- package/dist/core/limit-story.js +9 -4
- package/dist/core/limit-story.js.map +1 -1
- package/dist/core/operation-command.d.ts +10 -0
- package/dist/core/operation-command.d.ts.map +1 -0
- package/dist/core/operation-command.js +15 -0
- package/dist/core/operation-command.js.map +1 -0
- package/dist/core/operation-meta.d.ts +62 -0
- package/dist/core/operation-meta.d.ts.map +1 -0
- package/dist/core/operation-meta.js +15 -0
- package/dist/core/operation-meta.js.map +1 -0
- package/dist/core/output.d.ts +7 -5
- package/dist/core/output.d.ts.map +1 -1
- package/dist/core/output.js +21 -80
- package/dist/core/output.js.map +1 -1
- package/dist/core/problem.d.ts +34 -0
- package/dist/core/problem.d.ts.map +1 -0
- package/dist/core/problem.js +44 -0
- package/dist/core/problem.js.map +1 -0
- package/dist/core/retry-after.d.ts +4 -3
- package/dist/core/retry-after.d.ts.map +1 -1
- package/dist/core/retry-after.js +4 -3
- package/dist/core/retry-after.js.map +1 -1
- package/dist/core/run-operation.d.ts +9 -4
- package/dist/core/run-operation.d.ts.map +1 -1
- package/dist/core/run-operation.js +17 -4
- package/dist/core/run-operation.js.map +1 -1
- package/dist/generated/operations.d.ts +37 -1
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +27562 -181
- package/dist/generated/operations.js.map +1 -1
- package/dist/generated/types.d.ts +1995 -135
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/generated/types.js +1 -1
- package/dist/interactive/derive-prompts.d.ts +13 -5
- package/dist/interactive/derive-prompts.d.ts.map +1 -1
- package/dist/interactive/derive-prompts.js +25 -1
- package/dist/interactive/derive-prompts.js.map +1 -1
- package/dist/interactive/session.d.ts +2 -2
- package/dist/interactive/session.d.ts.map +1 -1
- package/dist/interactive/session.js +31 -2
- package/dist/interactive/session.js.map +1 -1
- package/dist/mcp/defined-tools/defined-call.d.ts +18 -0
- package/dist/mcp/defined-tools/defined-call.d.ts.map +1 -0
- package/dist/mcp/defined-tools/defined-call.js +114 -0
- package/dist/mcp/defined-tools/defined-call.js.map +1 -0
- package/dist/mcp/defined-tools/defined-tool.d.ts +22 -0
- package/dist/mcp/defined-tools/defined-tool.d.ts.map +1 -0
- package/dist/mcp/defined-tools/defined-tool.js +35 -0
- package/dist/mcp/defined-tools/defined-tool.js.map +1 -0
- package/dist/mcp/defined-tools/json-conform.d.ts +28 -0
- package/dist/mcp/defined-tools/json-conform.d.ts.map +1 -0
- package/dist/mcp/defined-tools/json-conform.js +144 -0
- package/dist/mcp/defined-tools/json-conform.js.map +1 -0
- package/dist/mcp/defined-tools/problem-mapping.d.ts +39 -0
- package/dist/mcp/defined-tools/problem-mapping.d.ts.map +1 -0
- package/dist/mcp/defined-tools/problem-mapping.js +179 -0
- package/dist/mcp/defined-tools/problem-mapping.js.map +1 -0
- package/dist/mcp/defined-tools/request-split.d.ts +19 -0
- package/dist/mcp/defined-tools/request-split.d.ts.map +1 -0
- package/dist/mcp/defined-tools/request-split.js +25 -0
- package/dist/mcp/defined-tools/request-split.js.map +1 -0
- package/dist/mcp/defined-tools/tool-problem.d.ts +40 -0
- package/dist/mcp/defined-tools/tool-problem.d.ts.map +1 -0
- package/dist/mcp/defined-tools/tool-problem.js +42 -0
- package/dist/mcp/defined-tools/tool-problem.js.map +1 -0
- package/dist/mcp/defined-tools/tool-results.d.ts +12 -0
- package/dist/mcp/defined-tools/tool-results.d.ts.map +1 -0
- package/dist/mcp/defined-tools/tool-results.js +21 -0
- package/dist/mcp/defined-tools/tool-results.js.map +1 -0
- package/dist/mcp/local-tools/credential-minting.d.ts +24 -0
- package/dist/mcp/local-tools/credential-minting.d.ts.map +1 -0
- package/dist/mcp/local-tools/credential-minting.js +49 -0
- package/dist/mcp/local-tools/credential-minting.js.map +1 -0
- package/dist/mcp/local-tools/env-file.d.ts +30 -0
- package/dist/mcp/local-tools/env-file.d.ts.map +1 -0
- package/dist/mcp/local-tools/env-file.js +71 -0
- package/dist/mcp/local-tools/env-file.js.map +1 -0
- package/dist/mcp/local-tools/local-tools.d.ts +16 -0
- package/dist/mcp/local-tools/local-tools.d.ts.map +1 -0
- package/dist/mcp/local-tools/local-tools.js +16 -0
- package/dist/mcp/local-tools/local-tools.js.map +1 -0
- package/dist/mcp/local-tools/save-transmitter-credential.d.ts +21 -0
- package/dist/mcp/local-tools/save-transmitter-credential.d.ts.map +1 -0
- package/dist/mcp/local-tools/save-transmitter-credential.js +119 -0
- package/dist/mcp/local-tools/save-transmitter-credential.js.map +1 -0
- package/dist/mcp/mcp-call.d.ts +2 -2
- package/dist/mcp/mcp-call.d.ts.map +1 -1
- package/dist/mcp/mcp-call.js +8 -2
- package/dist/mcp/mcp-call.js.map +1 -1
- package/dist/mcp/mcp-command.d.ts +6 -2
- package/dist/mcp/mcp-command.d.ts.map +1 -1
- package/dist/mcp/mcp-command.js +36 -12
- package/dist/mcp/mcp-command.js.map +1 -1
- package/dist/mcp/mcp-install.d.ts +2 -0
- package/dist/mcp/mcp-install.d.ts.map +1 -1
- package/dist/mcp/mcp-install.js +7 -1
- package/dist/mcp/mcp-install.js.map +1 -1
- package/dist/mcp/mcp-protocol.d.ts +2 -0
- package/dist/mcp/mcp-protocol.d.ts.map +1 -1
- package/dist/mcp/mcp-protocol.js.map +1 -1
- package/dist/mcp/mcp-tools.d.ts +28 -25
- package/dist/mcp/mcp-tools.d.ts.map +1 -1
- package/dist/mcp/mcp-tools.js +39 -16
- package/dist/mcp/mcp-tools.js.map +1 -1
- package/dist/mcp/tool-binding.d.ts +35 -0
- package/dist/mcp/tool-binding.d.ts.map +1 -0
- package/dist/mcp/tool-binding.js +7 -0
- package/dist/mcp/tool-binding.js.map +1 -0
- package/dist/mcp/tool-bindings.d.ts +20 -0
- package/dist/mcp/tool-bindings.d.ts.map +1 -0
- package/dist/mcp/tool-bindings.js +31 -0
- package/dist/mcp/tool-bindings.js.map +1 -0
- package/dist/mcp/tool-filter.d.ts +26 -0
- package/dist/mcp/tool-filter.d.ts.map +1 -0
- package/dist/mcp/tool-filter.js +23 -0
- package/dist/mcp/tool-filter.js.map +1 -0
- package/dist/program.d.ts +9 -9
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +12 -83
- package/dist/program.js.map +1 -1
- package/dist/watch.d.ts +3 -3
- package/dist/watch.d.ts.map +1 -1
- package/dist/watch.js +10 -2
- package/dist/watch.js.map +1 -1
- package/package.json +6 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-install.js","sourceRoot":"","sources":["../../src/mcp/mcp-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-install.js","sourceRoot":"","sources":["../../src/mcp/mcp-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,S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AAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;AAC1E,CAAC"}
|
|
@@ -40,6 +40,8 @@ export interface McpToolResult {
|
|
|
40
40
|
type: "text";
|
|
41
41
|
text: string;
|
|
42
42
|
}[];
|
|
43
|
+
/** The answer as data (a tool that declares an output schema): the output, or a failed call's problem. */
|
|
44
|
+
structuredContent?: Record<string, unknown>;
|
|
43
45
|
isError?: boolean;
|
|
44
46
|
}
|
|
45
47
|
export interface McpServerInfo {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-protocol.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,qDAAsD,CAAC;AAEzF,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,SAAS,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,C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IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzD,OAAO,OAAO,CAAC,EAAE,EAAE,eAAe,CAAC,aAAa,EAAE,mDAAmD,CAAC,CAAC;QACzG,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAC3E,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,OAAO,CAAC,EAAE,EAAE,eAAe,CAAC,aAAa,EAAE,iBAAiB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACvG,OAAO,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
package/dist/mcp/mcp-tools.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A COMMAND TOOL IS THE CLI'S COMMAND — derived from the same generated
|
|
3
3
|
* manifest (`OPERATIONS`) at start, never written or generated a second time.
|
|
4
|
+
* Every operation the document defines no MCP tool for is one (an operation
|
|
5
|
+
* whose tool the document defines is served as that tool instead:
|
|
6
|
+
* defined-tools/defined-tool.ts; tool-bindings.ts chooses).
|
|
4
7
|
*
|
|
5
8
|
* One tool per non-streaming operation:
|
|
6
9
|
* - its NAME is the command path joined with `_` (`study_get`,
|
|
7
10
|
* `study_behaviors`): a reader who knows the command knows the tool;
|
|
8
11
|
* - its INPUT is the command's own: every path parameter a required string,
|
|
9
|
-
* every query parameter with its declared type,
|
|
10
|
-
*
|
|
12
|
+
* every query parameter with its declared type, every header flag a string
|
|
13
|
+
* named as the flag's option (`ifMatch` for `--if-match`), and `body` where
|
|
14
|
+
* the command takes one. The body fields a command also takes as plain
|
|
15
|
+
* arguments (`cliArguments`: `ora audit run example.com`) stay in `body`:
|
|
16
|
+
* they spare a person typing JSON, and an agent writes JSON anyway, so a
|
|
17
|
+
* second spelling of one field would only make it ambiguous;
|
|
11
18
|
* - its DESCRIPTION is the operation's summary and the command it mirrors.
|
|
12
19
|
*
|
|
13
20
|
* So a public operation added to the API is a new command AND a new tool with
|
|
@@ -16,7 +23,7 @@
|
|
|
16
23
|
* Streaming operations (server-sent events) are left out: a tool call answers
|
|
17
24
|
* once. Pure: no I/O, no clock.
|
|
18
25
|
*/
|
|
19
|
-
import type
|
|
26
|
+
import { type CommandOperation } from "../core/operation-meta.js";
|
|
20
27
|
export interface JsonSchema {
|
|
21
28
|
type?: string;
|
|
22
29
|
description?: string;
|
|
@@ -26,42 +33,38 @@ export interface JsonSchema {
|
|
|
26
33
|
additionalProperties?: boolean;
|
|
27
34
|
items?: JsonSchema;
|
|
28
35
|
}
|
|
36
|
+
/** A tool as `tools/list` lists it. A tool the document defines carries all of it (defined-tools/defined-tool.ts). */
|
|
29
37
|
export interface McpTool {
|
|
30
38
|
name: string;
|
|
39
|
+
title?: string;
|
|
31
40
|
description: string;
|
|
32
|
-
inputSchema: JsonSchema
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export interface ToolBinding {
|
|
36
|
-
readonly tool: McpTool;
|
|
37
|
-
readonly meta: OperationMeta;
|
|
41
|
+
inputSchema: JsonSchema | Record<string, unknown>;
|
|
42
|
+
outputSchema?: Record<string, unknown>;
|
|
43
|
+
annotations?: Readonly<Record<string, boolean>>;
|
|
38
44
|
}
|
|
39
|
-
/**
|
|
40
|
-
export interface
|
|
41
|
-
|
|
42
|
-
readonly products?: readonly string[];
|
|
43
|
-
/** Only reads. */
|
|
44
|
-
readonly readOnly?: boolean;
|
|
45
|
+
/** A command's tool as `tools/list` lists it: its name, its description and the command's input. */
|
|
46
|
+
export interface CommandTool extends McpTool {
|
|
47
|
+
inputSchema: JsonSchema;
|
|
45
48
|
}
|
|
46
49
|
/** The argument a tool takes its JSON body in. */
|
|
47
50
|
export declare const BODY_ARGUMENT = "body";
|
|
48
|
-
export declare const toolNameOf: (meta: Pick<
|
|
51
|
+
export declare const toolNameOf: (meta: Pick<CommandOperation, "commandPath">) => string;
|
|
49
52
|
/** The command a tool mirrors, as a person would type it: `ora study get <id>`. Built from the manifest, so it names every operation the same way. */
|
|
50
|
-
export declare
|
|
53
|
+
export declare const commandOf: (meta: Pick<CommandOperation, "commandPath" | "pathParams">) => string;
|
|
51
54
|
/**
|
|
52
55
|
* Is the operation a read? Its api-key scope says so where it has one (a read
|
|
53
56
|
* sent as a POST, like a query, is still a read); an operation with no scope
|
|
54
57
|
* is read by its method.
|
|
55
58
|
*/
|
|
56
|
-
export declare function isReadOperation(meta: Pick<
|
|
57
|
-
export declare function inputSchemaOf(meta:
|
|
58
|
-
export declare function toolOf(meta:
|
|
59
|
-
/**
|
|
60
|
-
export declare function toolBindingsOf(operations: readonly OperationMeta[], filter?: ToolFilter): ToolBinding[];
|
|
61
|
-
/** What a call's arguments become: the operation's positionals, query and body. */
|
|
59
|
+
export declare function isReadOperation(meta: Pick<CommandOperation, "scope" | "method">): boolean;
|
|
60
|
+
export declare function inputSchemaOf(meta: CommandOperation): JsonSchema;
|
|
61
|
+
export declare function toolOf(meta: CommandOperation): CommandTool;
|
|
62
|
+
/** What a call's arguments become: the operation's positionals, query, request headers and body. */
|
|
62
63
|
export interface ToolCallValues {
|
|
63
64
|
positionals: string[];
|
|
64
65
|
query: Record<string, string | number | boolean | undefined>;
|
|
66
|
+
/** By the header's own name (`If-Match`); absent when the call sends none. */
|
|
67
|
+
headers?: Record<string, string>;
|
|
65
68
|
body?: unknown;
|
|
66
69
|
}
|
|
67
70
|
export type ToolArguments = {
|
|
@@ -77,5 +80,5 @@ export type ToolArguments = {
|
|
|
77
80
|
* parameter would otherwise call another URL); everything else is the API's to
|
|
78
81
|
* validate, so a refusal reads the same from a tool as from the command.
|
|
79
82
|
*/
|
|
80
|
-
export declare function toolArgumentsOf(meta:
|
|
83
|
+
export declare function toolArgumentsOf(meta: CommandOperation, raw: unknown): ToolArguments;
|
|
81
84
|
//# sourceMappingURL=mcp-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElF,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,sHAAsH;AACtH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjD;AAED,oGAAoG;AACpG,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C,WAAW,EAAE,UAAU,CAAC;CACzB;AAED,kDAAkD;AAClD,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,KAAG,MAAuD,CAAC;AAEjI,sJAAsJ;AACtJ,eAAO,MAAM,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG,YAAY,CAAC,KAAK,MAAsB,CAAC;AAE/G;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG,OAAO,CAEzF;AAuBD,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,UAAU,CAwBhE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,WAAW,CAM1D;AAED,oGAAoG;AACpG,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC7D,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAKlG;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,GAAG,aAAa,CAiDnF"}
|
package/dist/mcp/mcp-tools.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A COMMAND TOOL IS THE CLI'S COMMAND — derived from the same generated
|
|
3
3
|
* manifest (`OPERATIONS`) at start, never written or generated a second time.
|
|
4
|
+
* Every operation the document defines no MCP tool for is one (an operation
|
|
5
|
+
* whose tool the document defines is served as that tool instead:
|
|
6
|
+
* defined-tools/defined-tool.ts; tool-bindings.ts chooses).
|
|
4
7
|
*
|
|
5
8
|
* One tool per non-streaming operation:
|
|
6
9
|
* - its NAME is the command path joined with `_` (`study_get`,
|
|
7
10
|
* `study_behaviors`): a reader who knows the command knows the tool;
|
|
8
11
|
* - its INPUT is the command's own: every path parameter a required string,
|
|
9
|
-
* every query parameter with its declared type,
|
|
10
|
-
*
|
|
12
|
+
* every query parameter with its declared type, every header flag a string
|
|
13
|
+
* named as the flag's option (`ifMatch` for `--if-match`), and `body` where
|
|
14
|
+
* the command takes one. The body fields a command also takes as plain
|
|
15
|
+
* arguments (`cliArguments`: `ora audit run example.com`) stay in `body`:
|
|
16
|
+
* they spare a person typing JSON, and an agent writes JSON anyway, so a
|
|
17
|
+
* second spelling of one field would only make it ambiguous;
|
|
11
18
|
* - its DESCRIPTION is the operation's summary and the command it mirrors.
|
|
12
19
|
*
|
|
13
20
|
* So a public operation added to the API is a new command AND a new tool with
|
|
@@ -16,13 +23,13 @@
|
|
|
16
23
|
* Streaming operations (server-sent events) are left out: a tool call answers
|
|
17
24
|
* once. Pure: no I/O, no clock.
|
|
18
25
|
*/
|
|
26
|
+
import { commandLineOf } from "../core/operation-command.js";
|
|
27
|
+
import { headerParamsOf } from "../core/operation-meta.js";
|
|
19
28
|
/** The argument a tool takes its JSON body in. */
|
|
20
29
|
export const BODY_ARGUMENT = "body";
|
|
21
30
|
export const toolNameOf = (meta) => meta.commandPath.join("_").replace(/-/g, "_");
|
|
22
31
|
/** The command a tool mirrors, as a person would type it: `ora study get <id>`. Built from the manifest, so it names every operation the same way. */
|
|
23
|
-
export
|
|
24
|
-
return [bin, ...meta.commandPath, ...meta.pathParams.map((param) => `<${param.name}>`)].join(" ");
|
|
25
|
-
}
|
|
32
|
+
export const commandOf = commandLineOf;
|
|
26
33
|
/**
|
|
27
34
|
* Is the operation a read? Its api-key scope says so where it has one (a read
|
|
28
35
|
* sent as a POST, like a query, is still a read); an operation with no scope
|
|
@@ -67,6 +74,11 @@ export function inputSchemaOf(meta) {
|
|
|
67
74
|
if (param.required)
|
|
68
75
|
required.push(param.name);
|
|
69
76
|
}
|
|
77
|
+
for (const header of headerParamsOf(meta)) {
|
|
78
|
+
properties[header.optionKey] = { type: "string", description: header.description ?? `The ${header.name} request header.` };
|
|
79
|
+
if (header.required)
|
|
80
|
+
required.push(header.optionKey);
|
|
81
|
+
}
|
|
70
82
|
if (meta.hasBody) {
|
|
71
83
|
properties[BODY_ARGUMENT] = bodySchemaOf(meta);
|
|
72
84
|
if (meta.bodyRequired)
|
|
@@ -81,15 +93,6 @@ export function toolOf(meta) {
|
|
|
81
93
|
inputSchema: inputSchemaOf(meta),
|
|
82
94
|
};
|
|
83
95
|
}
|
|
84
|
-
/** The tools a server offers, in manifest order. */
|
|
85
|
-
export function toolBindingsOf(operations, filter = {}) {
|
|
86
|
-
const products = filter.products ?? [];
|
|
87
|
-
return operations
|
|
88
|
-
.filter((meta) => !meta.isStream)
|
|
89
|
-
.filter((meta) => products.length === 0 || (meta.product !== null && products.includes(meta.product)))
|
|
90
|
-
.filter((meta) => filter.readOnly !== true || isReadOperation(meta))
|
|
91
|
-
.map((meta) => ({ tool: toolOf(meta), meta }));
|
|
92
|
-
}
|
|
93
96
|
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
94
97
|
/**
|
|
95
98
|
* A tool call's arguments as the operation's inputs, or the first thing wrong
|
|
@@ -122,6 +125,18 @@ export function toolArgumentsOf(meta, raw) {
|
|
|
122
125
|
}
|
|
123
126
|
query[param.name] = param.kind === "number" ? Number(value) : param.kind === "boolean" ? value === true || value === "true" : String(value);
|
|
124
127
|
}
|
|
128
|
+
const headers = {};
|
|
129
|
+
for (const header of headerParamsOf(meta)) {
|
|
130
|
+
const value = args[header.optionKey];
|
|
131
|
+
if (value === undefined || value === null || value === "") {
|
|
132
|
+
if (header.required)
|
|
133
|
+
return { ok: false, message: `Missing "${header.optionKey}" (the ${header.name} header).` };
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (typeof value !== "string" && typeof value !== "number")
|
|
137
|
+
return { ok: false, message: `"${header.optionKey}" must be a string.` };
|
|
138
|
+
headers[header.name] = String(value);
|
|
139
|
+
}
|
|
125
140
|
const body = args[BODY_ARGUMENT];
|
|
126
141
|
if (meta.hasBody && meta.bodyRequired && (body === undefined || body === null)) {
|
|
127
142
|
return { ok: false, message: `Missing "${BODY_ARGUMENT}": this tool takes the request's JSON body.` };
|
|
@@ -129,6 +144,14 @@ export function toolArgumentsOf(meta, raw) {
|
|
|
129
144
|
if (body !== undefined && body !== null && !meta.hasBody) {
|
|
130
145
|
return { ok: false, message: `This tool takes no "${BODY_ARGUMENT}".` };
|
|
131
146
|
}
|
|
132
|
-
return {
|
|
147
|
+
return {
|
|
148
|
+
ok: true,
|
|
149
|
+
values: {
|
|
150
|
+
positionals,
|
|
151
|
+
query,
|
|
152
|
+
...(Object.keys(headers).length > 0 ? { headers } : {}),
|
|
153
|
+
...(meta.hasBody && body !== undefined && body !== null ? { body } : {}),
|
|
154
|
+
},
|
|
155
|
+
};
|
|
133
156
|
}
|
|
134
157
|
//# sourceMappingURL=mcp-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-tools.js","sourceRoot":"","sources":["../../src/mcp/mcp-tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-tools.js","sourceRoot":"","sources":["../../src/mcp/mcp-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAyB,MAAM,2BAA2B,CAAC;AA2BlF,kDAAkD;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AAEpC,MAAM,CAAC,MAAM,UAAU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E,KAAK,EAAE,OAAO,EAAE,YAAY,aAAa,6CAA6C,EAAE,CAAC;IACxG,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACzD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,uBAAuB,aAAa,IAAI,EAAE,CAAC;IAC1E,CAAC;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE;YACN,WAAW;YACX,KAAK;YACL,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACzE;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ONE TOOL OF `ora mcp serve`, AS THE SERVER HOLDS IT — what `tools/list` shows, and how a call runs. Each kind of
|
|
3
|
+
* tool is a Strategy (tool-bindings.ts registers them): an operation's command, an operation's tool as the document
|
|
4
|
+
* defines it, or a local tool the CLI adds (local-tools/).
|
|
5
|
+
*/
|
|
6
|
+
import type { CommandOperation } from "../core/operation-meta.js";
|
|
7
|
+
import type { ToolCallClient } from "./mcp-call.js";
|
|
8
|
+
import type { McpToolResult } from "./mcp-protocol.js";
|
|
9
|
+
import type { McpTool } from "./mcp-tools.js";
|
|
10
|
+
/** What one call runs with. */
|
|
11
|
+
export interface ToolCallContext {
|
|
12
|
+
/** The CLI's client, signed in with its credential. */
|
|
13
|
+
readonly client: ToolCallClient;
|
|
14
|
+
/** The server's working directory: the project a local tool may write into. */
|
|
15
|
+
readonly cwd: string;
|
|
16
|
+
/** The manifest: a local tool finds the operation it calls here, at call time. */
|
|
17
|
+
readonly operations: readonly CommandOperation[];
|
|
18
|
+
/** A fresh unique id: each write's Idempotency-Key, each call's X-Request-Id. */
|
|
19
|
+
readonly newId: () => string;
|
|
20
|
+
}
|
|
21
|
+
export interface ToolBinding {
|
|
22
|
+
readonly tool: McpTool;
|
|
23
|
+
/** Never rejects for a failed call: that is a result with `isError`. */
|
|
24
|
+
call(args: unknown, ctx: ToolCallContext): Promise<McpToolResult>;
|
|
25
|
+
}
|
|
26
|
+
/** A tool that runs one operation of the manifest. */
|
|
27
|
+
export interface OperationToolBinding extends ToolBinding {
|
|
28
|
+
readonly meta: CommandOperation;
|
|
29
|
+
}
|
|
30
|
+
/** One way an operation is served (Strategy): whether it is this kind's, and its tool (null: it is never a tool). */
|
|
31
|
+
export interface ToolKind {
|
|
32
|
+
appliesTo(meta: CommandOperation): boolean;
|
|
33
|
+
bindingOf(meta: CommandOperation): OperationToolBinding | null;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=tool-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-binding.d.ts","sourceRoot":"","sources":["../../src/mcp/tool-binding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,+BAA+B;AAC/B,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,wEAAwE;IACxE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACnE;AAED,sDAAsD;AACtD,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACjC;AAED,qHAAqH;AACrH,MAAM,WAAW,QAAQ;IACvB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAC3C,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,IAAI,CAAC;CAChE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ONE TOOL OF `ora mcp serve`, AS THE SERVER HOLDS IT — what `tools/list` shows, and how a call runs. Each kind of
|
|
3
|
+
* tool is a Strategy (tool-bindings.ts registers them): an operation's command, an operation's tool as the document
|
|
4
|
+
* defines it, or a local tool the CLI adds (local-tools/).
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=tool-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-binding.js","sourceRoot":"","sources":["../../src/mcp/tool-binding.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TOOLS `ora mcp serve` OFFERS — every operation of the manifest the filters keep, each served the way its kind
|
|
3
|
+
* says (a Registry of Strategies, tried in order, the first that applies decides):
|
|
4
|
+
*
|
|
5
|
+
* 1. never a tool: a stream (a tool call answers once), or an operation the document marks `false`;
|
|
6
|
+
* 2. the tool the document defines for it, verbatim (defined-tools/defined-tool.ts): the Front API's tools, the
|
|
7
|
+
* very ones ora's remote MCP server serves apps;
|
|
8
|
+
* 3. its command (mcp-tools.ts): every other operation, as the server always served it.
|
|
9
|
+
*
|
|
10
|
+
* A new kind is a new entry here; nothing that lists or calls a tool changes.
|
|
11
|
+
*/
|
|
12
|
+
import type { CommandOperation } from "../core/operation-meta.js";
|
|
13
|
+
import type { OperationToolBinding, ToolKind } from "./tool-binding.js";
|
|
14
|
+
import { type ToolFilter } from "./tool-filter.js";
|
|
15
|
+
export declare const TOOL_KINDS: readonly ToolKind[];
|
|
16
|
+
/** The operation's tool, by the first kind that applies; null when it is never one. */
|
|
17
|
+
export declare function bindingOf(meta: CommandOperation, kinds?: readonly ToolKind[]): OperationToolBinding | null;
|
|
18
|
+
/** The tools a server offers for these operations, in manifest order. */
|
|
19
|
+
export declare function toolBindingsOf(operations: readonly CommandOperation[], filter?: ToolFilter): OperationToolBinding[];
|
|
20
|
+
//# sourceMappingURL=tool-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-bindings.d.ts","sourceRoot":"","sources":["../../src/mcp/tool-bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIlE,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQnE,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAA0C,CAAC;AAErF,uFAAuF;AACvF,wBAAgB,SAAS,CACvB,IAAI,EAAE,gBAAgB,EACtB,KAAK,GAAE,SAAS,QAAQ,EAAe,GACtC,oBAAoB,GAAG,IAAI,CAG7B;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,gBAAgB,EAAE,EACvC,MAAM,GAAE,UAAe,GACtB,oBAAoB,EAAE,CAExB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TOOLS `ora mcp serve` OFFERS — every operation of the manifest the filters keep, each served the way its kind
|
|
3
|
+
* says (a Registry of Strategies, tried in order, the first that applies decides):
|
|
4
|
+
*
|
|
5
|
+
* 1. never a tool: a stream (a tool call answers once), or an operation the document marks `false`;
|
|
6
|
+
* 2. the tool the document defines for it, verbatim (defined-tools/defined-tool.ts): the Front API's tools, the
|
|
7
|
+
* very ones ora's remote MCP server serves apps;
|
|
8
|
+
* 3. its command (mcp-tools.ts): every other operation, as the server always served it.
|
|
9
|
+
*
|
|
10
|
+
* A new kind is a new entry here; nothing that lists or calls a tool changes.
|
|
11
|
+
*/
|
|
12
|
+
import { DEFINED_TOOL, NO_TOOL } from "./defined-tools/defined-tool.js";
|
|
13
|
+
import { callOperationTool } from "./mcp-call.js";
|
|
14
|
+
import { toolOf } from "./mcp-tools.js";
|
|
15
|
+
import { keepsOperation } from "./tool-filter.js";
|
|
16
|
+
/** An operation served as its CLI command. */
|
|
17
|
+
const COMMAND_TOOL = {
|
|
18
|
+
appliesTo: () => true,
|
|
19
|
+
bindingOf: (meta) => ({ tool: toolOf(meta), meta, call: (args, ctx) => callOperationTool(meta, args, ctx.client) }),
|
|
20
|
+
};
|
|
21
|
+
export const TOOL_KINDS = [NO_TOOL, DEFINED_TOOL, COMMAND_TOOL];
|
|
22
|
+
/** The operation's tool, by the first kind that applies; null when it is never one. */
|
|
23
|
+
export function bindingOf(meta, kinds = TOOL_KINDS) {
|
|
24
|
+
const kind = kinds.find((candidate) => candidate.appliesTo(meta));
|
|
25
|
+
return kind ? kind.bindingOf(meta) : null;
|
|
26
|
+
}
|
|
27
|
+
/** The tools a server offers for these operations, in manifest order. */
|
|
28
|
+
export function toolBindingsOf(operations, filter = {}) {
|
|
29
|
+
return operations.filter((meta) => keepsOperation(filter, meta)).flatMap((meta) => bindingOf(me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O,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHICH TOOLS A SERVER OFFERS — `ora mcp serve`'s three flags, each a filter over what a tool runs, all of them
|
|
3
|
+
* applied together. The api key still decides what any call may do: a filter only narrows what an agent sees.
|
|
4
|
+
*/
|
|
5
|
+
import type { CommandOperation } from "../core/operation-meta.js";
|
|
6
|
+
/** Which of the CLI's commands a server offers. */
|
|
7
|
+
export interface ToolFilter {
|
|
8
|
+
/** Only these products' operations (the manifest's `product`). Empty or absent = every product. */
|
|
9
|
+
readonly products?: readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* Only the operations under these commands: `front` keeps every `ora front …` command, `front sites` every
|
|
12
|
+
* `ora front sites …` one. Empty or absent = every command.
|
|
13
|
+
*/
|
|
14
|
+
readonly commands?: readonly string[];
|
|
15
|
+
/** Only reads. */
|
|
16
|
+
readonly readOnly?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** What a filter reads of what a tool runs. */
|
|
19
|
+
export type FilteredOperation = Pick<CommandOperation, "commandPath" | "product" | "scope" | "method">;
|
|
20
|
+
/** `"front sites"` → `["front", "sites"]`: a command as a person types it. */
|
|
21
|
+
export declare const commandSegmentsOf: (command: string) => string[];
|
|
22
|
+
/** Does the command path start with this command? Whole segments only: `front` never keeps `frontier …`. */
|
|
23
|
+
export declare function isUnderCommand(commandPath: readonly string[], command: string): boolean;
|
|
24
|
+
/** Does the filter keep this operation's tool? */
|
|
25
|
+
export declare function keepsOperation(filter: ToolFilter, meta: FilteredOperation): boolean;
|
|
26
|
+
//# sourceMappingURL=tool-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-filter.d.ts","sourceRoot":"","sources":["../../src/mcp/tool-filter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,kBAAkB;IAClB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,+CAA+C;AAC/C,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC;AAEvG,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,MAAM,EAAiD,CAAC;AAE5G,4GAA4G;AAC5G,wBAAgB,cAAc,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGvF;AAED,kDAAkD;AAClD,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAMnF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHICH TOOLS A SERVER OFFERS — `ora mcp serve`'s three flags, each a filter over what a tool runs, all of them
|
|
3
|
+
* applied together. The api key still decides what any call may do: a filter only narrows what an agent sees.
|
|
4
|
+
*/
|
|
5
|
+
import { isReadOperation } from "./mcp-tools.js";
|
|
6
|
+
/** `"front sites"` → `["front", "sites"]`: a command as a person types it. */
|
|
7
|
+
export const commandSegmentsOf = (command) => command.trim().split(/\s+/).filter(Boolean);
|
|
8
|
+
/** Does the command path start with this command? Whole segments only: `front` never keeps `frontier …`. */
|
|
9
|
+
export function isUnderCommand(commandPath, command) {
|
|
10
|
+
const segments = commandSegmentsOf(command);
|
|
11
|
+
return segments.length > 0 && segments.every((segment, index) => commandPath[index] === segment);
|
|
12
|
+
}
|
|
13
|
+
/** Does the filter keep this operation's tool? */
|
|
14
|
+
export function keepsOperation(filter, meta) {
|
|
15
|
+
const products = filter.products ?? [];
|
|
16
|
+
const commands = filter.commands ?? [];
|
|
17
|
+
if (products.length > 0 && (meta.product === null || !products.includes(meta.product)))
|
|
18
|
+
return false;
|
|
19
|
+
if (commands.length > 0 && !commands.some((command) => isUnderCommand(meta.commandPath, command)))
|
|
20
|
+
return false;
|
|
21
|
+
return filter.readOnly !== true || isReadOperation(meta);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=tool-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-filter.js","sourceRoot":"","sources":["../../src/mcp/tool-filter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAkBjD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAY,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAE5G,4GAA4G;AAC5G,MAAM,UAAU,cAAc,CAAC,WAA8B,EAAE,OAAe;IAC5E,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,CAAC;AACnG,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,cAAc,CAAC,MAAkB,EAAE,IAAuB;IACxE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;IACvC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrG,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAChH,OAAO,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC"}
|
package/dist/program.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The commander program. ONE registrar walks the generated
|
|
3
|
-
* manifest and builds every command (a data Registry — adding a
|
|
4
|
-
* the platform changes the generated manifest, never this file),
|
|
5
|
-
* three handwritten auth commands: login (login/login-command.ts —
|
|
6
|
-
* sign-in or an api key) and logout / whoami (auth-commands.ts).
|
|
7
|
-
* The manifest-op execution core (credentials, path/query/body
|
|
8
|
-
* runOperation) lives in core/run-operation.ts — this file only
|
|
9
|
-
* commander around it.
|
|
2
|
+
* The commander program. ONE registrar (command-tree.ts) walks the generated
|
|
3
|
+
* OPERATIONS manifest and builds every command (a data Registry — adding a
|
|
4
|
+
* public op to the platform changes the generated manifest, never this file),
|
|
5
|
+
* plus the three handwritten auth commands: login (login/login-command.ts —
|
|
6
|
+
* browser sign-in or an api key) and logout / whoami (auth-commands.ts).
|
|
7
|
+
* The manifest-op execution core (credentials, path/query/header/body
|
|
8
|
+
* derivation, runOperation) lives in core/run-operation.ts — this file only
|
|
9
|
+
* wires commander around it.
|
|
10
10
|
*
|
|
11
11
|
* Every seam (client, auth, io, env, config dir) is injectable via
|
|
12
12
|
* ProgramDeps so tests drive the program through parseAsync — the same door a
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { Command } from "commander";
|
|
16
16
|
import type { CredentialAuth } from "./core/credentials/credential.js";
|
|
17
17
|
import type { HttpClient } from "./core/http.js";
|
|
18
|
-
import {
|
|
18
|
+
import type { CallerCredentials } from "./core/run-operation.js";
|
|
19
19
|
import { type LoginDeps } from "./login/login-deps.js";
|
|
20
20
|
export interface ProgramDeps {
|
|
21
21
|
/** An API client that signs with the caller's credential (an api key's traded token, a sign-in's access token). */
|
package/dist/program.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAKjE,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEtE,MAAM,WAAW,WAAW;IAC1B,mHAAmH;IACnH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC5E,oHAAoH;IACpH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,cAAc,CAAC;IACvD,GAAG,C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