@ora-ai/cli 0.24.0 → 0.26.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 +51 -0
- 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/cli-arguments.d.ts +21 -0
- package/dist/core/cli-arguments.d.ts.map +1 -0
- package/dist/core/cli-arguments.js +53 -0
- package/dist/core/cli-arguments.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 +13 -0
- package/dist/core/limit-story.d.ts.map +1 -0
- package/dist/core/limit-story.js +21 -0
- package/dist/core/limit-story.js.map +1 -0
- 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 -84
- 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 +12 -5
- package/dist/core/run-operation.d.ts.map +1 -1
- package/dist/core/run-operation.js +32 -11
- package/dist/core/run-operation.js.map +1 -1
- package/dist/generated/operations.d.ts +38 -1
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +27547 -171
- package/dist/generated/operations.js.map +1 -1
- package/dist/generated/types.d.ts +2113 -2
- 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 +35 -4
- 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 +11 -65
- 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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MINTING A TRANSMITTER CREDENTIAL, ITS SECRET KEPT FROM THE MODEL — the mint operation called exactly as a tool the
|
|
3
|
+
* document defines is called (defined-tools/defined-call.ts: its headers, its fresh Idempotency-Key, its deadline and
|
|
4
|
+
* its problems), with one difference: what it answers is never an answer. The secret goes back to the caller, in
|
|
5
|
+
* memory; a failure goes back as words only (a problem's summary), and never with the body.
|
|
6
|
+
*/
|
|
7
|
+
import { callDefinedTool } from "../defined-tools/defined-call.js";
|
|
8
|
+
import { textError } from "../defined-tools/tool-results.js";
|
|
9
|
+
const STRING = { type: "string", minLength: 1 };
|
|
10
|
+
/** The mint call as a definition: its path parameters from the manifest, the answer's three members it needs. */
|
|
11
|
+
function mintDefinition(mint) {
|
|
12
|
+
const params = mint.pathParams.map((param) => param.name);
|
|
13
|
+
return {
|
|
14
|
+
name: "mint_transmitter_credential",
|
|
15
|
+
title: mint.summary,
|
|
16
|
+
description: mint.summary,
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: Object.fromEntries(params.map((name) => [name, STRING])),
|
|
20
|
+
required: params,
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
},
|
|
23
|
+
outputSchema: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: { id: STRING, fingerprint: STRING, secret: STRING },
|
|
26
|
+
required: ["id", "fingerprint", "secret"],
|
|
27
|
+
},
|
|
28
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
29
|
+
request: { params },
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** The words of a failed call, without its structured content. */
|
|
33
|
+
const wordsOf = (result) => textError(result.content.map((part) => part.text).join(" "));
|
|
34
|
+
/** Mint a credential for `site`: the credential, or the failure in words. */
|
|
35
|
+
export async function mintCredential(mint, site, ctx) {
|
|
36
|
+
const result = await callDefinedTool(mint, mintDefinition(mint), { site }, ctx);
|
|
37
|
+
const answer = result.structuredContent;
|
|
38
|
+
if (result.isError === true || answer === undefined)
|
|
39
|
+
return { ok: false, result: wordsOf(result) };
|
|
40
|
+
const { id, fingerprint, secret } = answer;
|
|
41
|
+
if (typeof id !== "string" || typeof fingerprint !== "string" || typeof secret !== "string") {
|
|
42
|
+
return {
|
|
43
|
+
ok: false,
|
|
44
|
+
result: textError("The credential the API answered is not one this tool recognizes. Nothing was written."),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return { ok: true, credential: { id, fingerprint, secret } };
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=credential-minting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-minting.js","sourceRoot":"","sources":["../../../src/mcp/local-tools/credential-minting.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAa7D,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAW,CAAC;AAEzD,iHAAiH;AACjH,SAAS,cAAc,CAAC,IAAsB;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,KAAK,EAAE,IAAI,CAAC,OAAO;QACnB,WAAW,EAAE,IAAI,CAAC,OAAO;QACzB,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YACpE,QAAQ,EAAE,MAAM;YAChB,oBAAoB,EAAE,KAAK;SAC5B;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;YAC/D,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,CAAC;SAC1C;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAA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E — where a local tool writes a secret so it never enters a model's
|
|
3
|
+
* context.
|
|
4
|
+
*
|
|
5
|
+
* ONLY INSIDE THE PROJECT: the file must resolve, symlinks followed, inside the server's working directory, and its
|
|
6
|
+
* directory must already exist. Anything else is refused before anything is minted or written.
|
|
7
|
+
*
|
|
8
|
+
* EVERY OTHER LINE IS KEPT: each `NAME=` line (also `export NAME=`) is replaced in place; with none, one is
|
|
9
|
+
* appended. A new file is created readable by its owner only.
|
|
10
|
+
*/
|
|
11
|
+
export interface EnvFileTarget {
|
|
12
|
+
/** Where the file is, symlinks resolved. */
|
|
13
|
+
readonly absolute: string;
|
|
14
|
+
/** The file as the caller named it, relative to the project. */
|
|
15
|
+
readonly relative: string;
|
|
16
|
+
}
|
|
17
|
+
export type EnvFileResolution = {
|
|
18
|
+
readonly ok: true;
|
|
19
|
+
readonly target: EnvFileTarget;
|
|
20
|
+
} | {
|
|
21
|
+
readonly ok: false;
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
};
|
|
24
|
+
/** The env file `envFile` names, if it may be written: inside the project at `cwd`, in a directory that exists. */
|
|
25
|
+
export declare function resolveEnvFile(cwd: string, envFile: string): EnvFileResolution;
|
|
26
|
+
/** `content` with `name` set to `value`: every line that sets it replaced, or one line appended. Pure. */
|
|
27
|
+
export declare function withEnvVariable(content: string, name: string, value: string): string;
|
|
28
|
+
/** Set `name` in the env file: created owner-only when absent, every other line kept when present. */
|
|
29
|
+
export declare function writeEnvVariable(target: EnvFileTarget, name: string, value: string): void;
|
|
30
|
+
//# sourceMappingURL=env-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../../../src/mcp/local-tools/env-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,iBAAiB,GAC3B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ1G,mHAAmH;AACnH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAiB9E;AASD,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAcpF;AAED,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMzF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AN ENV FILE OF THE PROJECT, GIVEN ONE VARIABLE — where a local tool writes a secret so it never enters a model's
|
|
3
|
+
* context.
|
|
4
|
+
*
|
|
5
|
+
* ONLY INSIDE THE PROJECT: the file must resolve, symlinks followed, inside the server's working directory, and its
|
|
6
|
+
* directory must already exist. Anything else is refused before anything is minted or written.
|
|
7
|
+
*
|
|
8
|
+
* EVERY OTHER LINE IS KEPT: each `NAME=` line (also `export NAME=`) is replaced in place; with none, one is
|
|
9
|
+
* appended. A new file is created readable by its owner only.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, lstatSync, readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
13
|
+
/** Is `path` inside `root` (never `root` itself)? */
|
|
14
|
+
function isInside(root, path) {
|
|
15
|
+
const rel = relative(root, path);
|
|
16
|
+
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
17
|
+
}
|
|
18
|
+
/** The env file `envFile` names, if it may be written: inside the project at `cwd`, in a directory that exists. */
|
|
19
|
+
export function resolveEnvFile(cwd, envFile) {
|
|
20
|
+
const root = realpathSync(cwd);
|
|
21
|
+
const named = resolve(root, envFile);
|
|
22
|
+
if (!isInside(root, named))
|
|
23
|
+
return { ok: false, reason: `${envFile} is outside this project's directory (${root})` };
|
|
24
|
+
const directory = dirname(named);
|
|
25
|
+
if (!existsSync(directory) || !statSync(directory).isDirectory())
|
|
26
|
+
return { ok: false, reason: `the directory of ${envFile} does not exist` };
|
|
27
|
+
const realDirectory = realpathSync(directory);
|
|
28
|
+
if (realDirectory !== root && !isInside(root, realDirectory)) {
|
|
29
|
+
return { ok: false, reason: `${envFile} is outside this project's directory (${root})` };
|
|
30
|
+
}
|
|
31
|
+
if (!existsSync(named))
|
|
32
|
+
return { ok: true, target: { absolute: named, relative: relative(root, named) } };
|
|
33
|
+
const real = realpathSync(named);
|
|
34
|
+
if (!isInside(root, real))
|
|
35
|
+
return { ok: false, reason: `${envFile} links outside this project's directory (${root})` };
|
|
36
|
+
if (!lstatSync(real).isFile())
|
|
37
|
+
return { ok: false, reason: `${envFile} is not a file` };
|
|
38
|
+
return { ok: true, target: { absolute: real, relative: relative(root, named) } };
|
|
39
|
+
}
|
|
40
|
+
/** A value as a dotenv line holds it: bare when safe, else double-quoted. */
|
|
41
|
+
function quoted(value) {
|
|
42
|
+
return /^[A-Za-z0-9_\-.:/+=@]+$/.test(value) ? value : JSON.stringify(value);
|
|
43
|
+
}
|
|
44
|
+
const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
45
|
+
/** `content` with `name` set to `value`: every line that sets it replaced, or one line appended. Pure. */
|
|
46
|
+
export function withEnvVariable(content, name, value) {
|
|
47
|
+
const line = new RegExp(`^(\\s*(?:export\\s+)?)${escapeRegExp(name)}\\s*=.*$`);
|
|
48
|
+
const eol = content.includes("\r\n") ? "\r\n" : "\n";
|
|
49
|
+
const assignment = `${name}=${quoted(value)}`;
|
|
50
|
+
let replaced = false;
|
|
51
|
+
const lines = content.split(/\r?\n/).map((text) => {
|
|
52
|
+
const match = line.exec(text);
|
|
53
|
+
if (!match)
|
|
54
|
+
return text;
|
|
55
|
+
replaced = true;
|
|
56
|
+
return `${match[1]}${assignment}`;
|
|
57
|
+
});
|
|
58
|
+
if (replaced)
|
|
59
|
+
return lines.join(eol);
|
|
60
|
+
const separator = content === "" || content.endsWith("\n") ? "" : eol;
|
|
61
|
+
return `${content}${separator}${assignment}${eol}`;
|
|
62
|
+
}
|
|
63
|
+
/** Set `name` in the env file: created owner-only when absent, every other line kept when present. */
|
|
64
|
+
export function writeEnvVariable(target, name, value) {
|
|
65
|
+
if (!existsSync(target.absolute)) {
|
|
66
|
+
writeFileSync(target.absolute, withEnvVariable("", name, value), { mode: 0o600, flag: "wx" });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
writeFileSync(target.absolute, withEnvVariable(readFileSync(target.absolute, "utf8"), name, value));
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=env-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-file.js","sourceRoot":"","sources":["../../../src/mcp/local-tools/env-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAYxE,qDAAqD;AACrD,SAAS,QAAQ,CAAC,IAAY,EAAE,IAAY;IAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG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,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAChD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,QAAQ,GAAG,IAAI,CAAC;QAChB,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;IACH,IAAI,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,OAAO,KAAK,EAAE,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACtE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,GAAG,EAAE,CAAC;AACrD,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,gBAAgB,CAAC,MAAqB,EAAE,IAAY,EAAE,KAAa;IACjF,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9F,OAAO;IACT,CAAC;IACD,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TOOLS ONLY `ora mcp serve` HAS — what a server on the person's own machine can do that ora's remote MCP server
|
|
3
|
+
* cannot, such as write into the person's files. A Registry: a new local tool is one entry. Each states what the
|
|
4
|
+
* serve flags read (the command it stands beside, its product, scope and method), so `--product`, `--command` and
|
|
5
|
+
* `--read-only` keep or drop it exactly as they would that command.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolBinding } from "../tool-binding.js";
|
|
8
|
+
import { type FilteredOperation, type ToolFilter } from "../tool-filter.js";
|
|
9
|
+
export interface LocalTool {
|
|
10
|
+
readonly binding: ToolBinding;
|
|
11
|
+
readonly filtered: FilteredOperation;
|
|
12
|
+
}
|
|
13
|
+
export declare const LOCAL_TOOLS: readonly LocalTool[];
|
|
14
|
+
/** The local tools the filter keeps. */
|
|
15
|
+
export declare function localToolBindingsOf(filter: ToolFilter, tools?: readonly LocalTool[]): ToolBinding[];
|
|
16
|
+
//# sourceMappingURL=local-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/local-tools/local-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAkB,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;CACtC;AAED,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAE3C,CAAC;AAEF,wCAAwC;AACxC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,GAAE,SAAS,SAAS,EAAgB,GAAG,WAAW,EAAE,CAEhH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TOOLS ONLY `ora mcp serve` HAS — what a server on the person's own machine can do that ora's remote MCP server
|
|
3
|
+
* cannot, such as write into the person's files. A Registry: a new local tool is one entry. Each states what the
|
|
4
|
+
* serve flags read (the command it stands beside, its product, scope and method), so `--product`, `--command` and
|
|
5
|
+
* `--read-only` keep or drop it exactly as they would that command.
|
|
6
|
+
*/
|
|
7
|
+
import { keepsOperation } from "../tool-filter.js";
|
|
8
|
+
import { SAVE_TRANSMITTER_CREDENTIAL_FILTERED, saveTransmitterCredentialTool } from "./save-transmitter-credential.js";
|
|
9
|
+
export const LOCAL_TOOLS = [
|
|
10
|
+
{ binding: saveTransmitterCredentialTool, filtered: SAVE_TRANSMITTER_CREDENTIAL_FILTERED },
|
|
11
|
+
];
|
|
12
|
+
/** The local tools the filter keeps. */
|
|
13
|
+
export function localToolBindingsOf(filter, tools = LOCAL_TOOLS) {
|
|
14
|
+
return tools.filter((tool) => keepsOperation(filter, tool.filtered)).map((tool) => tool.binding);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=local-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-tools.js","sourceRoot":"","sources":["../../../src/mcp/local-tools/local-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAA2C,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,oCAAoC,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAOvH,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C,EAAE,OAAO,EAAE,6BAA6B,EAAE,QAAQ,EAAE,oCAAoC,EAAE;CAC3F,CAAC;AAEF,wCAAwC;AACxC,MAAM,UAAU,mBAAmB,CAAC,MAAkB,EAAE,QAA8B,WAAW;IAC/F,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `front_save_transmitter_credential` — THE ONE FRONT TOOL ONLY `ora mcp serve` HAS: it mints a transmitter
|
|
3
|
+
* credential for a site and writes it into an env file of the project, so the agent wiring the transmitter never sees
|
|
4
|
+
* the secret. ora's remote MCP server cannot write a person's files, and a secret never reaches a model, so the
|
|
5
|
+
* remote has no such tool (the lockstep test that holds the two servers' Front tools equal names this exception).
|
|
6
|
+
*
|
|
7
|
+
* The operation it calls (`front.connection.credentials.create`) is looked up in the manifest at call time: a CLI
|
|
8
|
+
* whose manifest has no such operation says so, loudly, instead of guessing a path. The env file is checked before
|
|
9
|
+
* anything is minted; when it cannot be written after all, the answer names the credential to revoke.
|
|
10
|
+
*/
|
|
11
|
+
import type { ToolBinding } from "../tool-binding.js";
|
|
12
|
+
import type { FilteredOperation } from "../tool-filter.js";
|
|
13
|
+
export declare const SAVE_TRANSMITTER_CREDENTIAL_TOOL = "front_save_transmitter_credential";
|
|
14
|
+
/** The operation that mints the credential. */
|
|
15
|
+
export declare const MINT_OPERATION_ID = "front.connection.credentials.create";
|
|
16
|
+
/** What a transmitter reads its credential from. */
|
|
17
|
+
export declare const INGEST_KEY_VARIABLE = "ORA_INGEST_KEY";
|
|
18
|
+
/** What the filters read: the command it stands beside, its product, its scope and method (a write). */
|
|
19
|
+
export declare const SAVE_TRANSMITTER_CREDENTIAL_FILTERED: FilteredOperation;
|
|
20
|
+
export declare const saveTransmitterCredentialTool: ToolBinding;
|
|
21
|
+
//# sourceMappingURL=save-transmitter-credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-transmitter-credential.d.ts","sourceRoot":"","sources":["../../../src/mcp/local-tools/save-transmitter-credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAI3D,eAAO,MAAM,gCAAgC,sCAAsC,CAAC;AACpF,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,wCAAwC,CAAC;AACvE,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AA6CpD,wGAAwG;AACxG,eAAO,MAAM,oCAAoC,EAAE,iBAKlD,CAAC;AAkEF,eAAO,MAAM,6BAA6B,EAAE,WAAwC,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `front_save_transmitter_credential` — THE ONE FRONT TOOL ONLY `ora mcp serve` HAS: it mints a transmitter
|
|
3
|
+
* credential for a site and writes it into an env file of the project, so the agent wiring the transmitter never sees
|
|
4
|
+
* the secret. ora's remote MCP server cannot write a person's files, and a secret never reaches a model, so the
|
|
5
|
+
* remote has no such tool (the lockstep test that holds the two servers' Front tools equal names this exception).
|
|
6
|
+
*
|
|
7
|
+
* The operation it calls (`front.connection.credentials.create`) is looked up in the manifest at call time: a CLI
|
|
8
|
+
* whose manifest has no such operation says so, loudly, instead of guessing a path. The env file is checked before
|
|
9
|
+
* anything is minted; when it cannot be written after all, the answer names the credential to revoke.
|
|
10
|
+
*/
|
|
11
|
+
import { textError } from "../defined-tools/tool-results.js";
|
|
12
|
+
import { mintCredential } from "./credential-minting.js";
|
|
13
|
+
import { resolveEnvFile, writeEnvVariable } from "./env-file.js";
|
|
14
|
+
export const SAVE_TRANSMITTER_CREDENTIAL_TOOL = "front_save_transmitter_credential";
|
|
15
|
+
/** The operation that mints the credential. */
|
|
16
|
+
export const MINT_OPERATION_ID = "front.connection.credentials.create";
|
|
17
|
+
/** What a transmitter reads its credential from. */
|
|
18
|
+
export const INGEST_KEY_VARIABLE = "ORA_INGEST_KEY";
|
|
19
|
+
const SAVED_OUTPUT = {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
credentialId: { type: "string", description: "The credential's id: what revoking it takes" },
|
|
23
|
+
fingerprint: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "The credential's visible prefix: enough to tell credentials apart, never enough to use one",
|
|
26
|
+
},
|
|
27
|
+
envFile: { type: "string", description: "The env file it was written into, relative to the project" },
|
|
28
|
+
variable: { type: "string", const: INGEST_KEY_VARIABLE, description: "The variable that holds it there" },
|
|
29
|
+
},
|
|
30
|
+
required: ["credentialId", "fingerprint", "envFile", "variable"],
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
};
|
|
33
|
+
const TOOL = {
|
|
34
|
+
name: SAVE_TRANSMITTER_CREDENTIAL_TOOL,
|
|
35
|
+
title: "Save a new transmitter credential into an env file",
|
|
36
|
+
description: `Mints a new transmitter credential for the site (what its transmitter reports traffic with, its ${INGEST_KEY_VARIABLE}) ` +
|
|
37
|
+
`and writes it into an env file of this project: an ${INGEST_KEY_VARIABLE}= line there is replaced, or one is added, and ` +
|
|
38
|
+
"every other line is kept. The secret is never shown: the answer is the credential's id and fingerprint. Set the " +
|
|
39
|
+
"same variable where the transmitter runs in production yourself. Needs front.secrets:reveal and " +
|
|
40
|
+
"front.connect:write (the key is saved as the site's), and an organization owner or admin behind the " +
|
|
41
|
+
"credential this server signs in with.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
site: { type: "string", minLength: 1, description: "The site: its id, or its hostname (acme.com)" },
|
|
46
|
+
envFile: {
|
|
47
|
+
type: "string",
|
|
48
|
+
minLength: 1,
|
|
49
|
+
description: "The env file to write, relative to this project's directory (.env, .env.local, .dev.vars): it must be inside it",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: ["site", "envFile"],
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
},
|
|
55
|
+
outputSchema: SAVED_OUTPUT,
|
|
56
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
|
|
57
|
+
};
|
|
58
|
+
/** What the filters read: the command it stands beside, its product, its scope and method (a write). */
|
|
59
|
+
export const SAVE_TRANSMITTER_CREDENTIAL_FILTERED = {
|
|
60
|
+
commandPath: ["front", "connection", "credentials"],
|
|
61
|
+
product: "studio",
|
|
62
|
+
scope: "front.secrets:reveal",
|
|
63
|
+
method: "post",
|
|
64
|
+
};
|
|
65
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
66
|
+
const reasonOf = (error) => (error instanceof Error ? error.message : String(error));
|
|
67
|
+
/** Where it may write, or why not: never a thrown error, so a call always answers. */
|
|
68
|
+
const envFileOf = (cwd, envFile) => {
|
|
69
|
+
try {
|
|
70
|
+
return resolveEnvFile(cwd, envFile);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return { ok: false, reason: reasonOf(error) };
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/** How to revoke a credential whose secret is lost. */
|
|
77
|
+
const REVOKE = "front_revoke_transmitter_credential, or `ora front connection credentials delete <site> <credentialId>`";
|
|
78
|
+
const nonBlank = (value) => typeof value === "string" && value.trim() !== "";
|
|
79
|
+
function savedAnswer(credential, envFile) {
|
|
80
|
+
const saved = {
|
|
81
|
+
credentialId: credential.id,
|
|
82
|
+
fingerprint: credential.fingerprint,
|
|
83
|
+
envFile,
|
|
84
|
+
variable: INGEST_KEY_VARIABLE,
|
|
85
|
+
};
|
|
86
|
+
const sentence = `Saved a new transmitter credential (fingerprint ${credential.fingerprint}) as ${INGEST_KEY_VARIABLE} in ${envFile}; the secret was not shown. ` +
|
|
87
|
+
`In production, set ${INGEST_KEY_VARIABLE} to that value where the transmitter runs: \`wrangler secret put ${INGEST_KEY_VARIABLE}\` ` +
|
|
88
|
+
"on Cloudflare, or the Vercel project's Environment Variables.";
|
|
89
|
+
return { structuredContent: saved, content: [{ type: "text", text: sentence }], isError: false };
|
|
90
|
+
}
|
|
91
|
+
async function save(args, ctx) {
|
|
92
|
+
if (!isRecord(args) ||
|
|
93
|
+
!nonBlank(args.site) ||
|
|
94
|
+
!nonBlank(args.envFile) ||
|
|
95
|
+
Object.keys(args).some((key) => key !== "site" && key !== "envFile")) {
|
|
96
|
+
return textError(`Input validation error: Invalid arguments for tool ${SAVE_TRANSMITTER_CREDENTIAL_TOOL}: it takes a site and an envFile, both non-empty.`);
|
|
97
|
+
}
|
|
98
|
+
const mint = ctx.operations.find((meta) => meta.id === MINT_OPERATION_ID);
|
|
99
|
+
if (!mint) {
|
|
100
|
+
return textError(`This ora CLI cannot mint a transmitter credential: its API manifest has no ${MINT_OPERATION_ID}. ` +
|
|
101
|
+
"Update it (npm install -g @ora-ai/cli@latest) and try again. Nothing was minted or written.");
|
|
102
|
+
}
|
|
103
|
+
const resolved = envFileOf(ctx.cwd, args.envFile);
|
|
104
|
+
if (!resolved.ok)
|
|
105
|
+
return textError(`Not written: ${resolved.reason}. Nothing was minted.`);
|
|
106
|
+
const minted = await mintCredential(mint, args.site, ctx);
|
|
107
|
+
if (!minted.ok)
|
|
108
|
+
return minted.result;
|
|
109
|
+
try {
|
|
110
|
+
writeEnvVariable(resolved.target, INGEST_KEY_VARIABLE, minted.credential.secret);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
return textError(`Ora minted credential ${minted.credential.id} (fingerprint ${minted.credential.fingerprint}), but writing ${resolved.target.relative} failed ` +
|
|
114
|
+
`(${reasonOf(error)}), and its secret is never shown again. Revoke it (${REVOKE}) and try again.`);
|
|
115
|
+
}
|
|
116
|
+
return savedAnswer(minted.credential, resolved.target.relative);
|
|
117
|
+
}
|
|
118
|
+
export const saveTransmitterCredentialTool = { tool: TOOL, call: save };
|
|
119
|
+
//# sourceMappingURL=save-transmitter-credential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-transmitter-credential.js","sourceRoot":"","sources":["../../../src/mcp/local-tools/save-transmitter-credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAK7D,OAAO,EAAE,cA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G,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC,gBAAgB,QAAQ,CAAC,MAAM,uBAAuB,CAAC,CAAC;IAE3F,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,CAAC;QACH,gBAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACnF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,SAAS,CACd,yBAAyB,MAAM,CAAC,UAAU,CAAC,EAAE,iBAAiB,MAAM,CAAC,UAAU,CAAC,WAAW,kBAAkB,QAAQ,CAAC,MAAM,CAAC,QAAQ,UAAU;YAC7I,IAAI,QAAQ,CAAC,KAAK,CAAC,sDAAsD,MAAM,kBAAkB,CACpG,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/mcp/mcp-call.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* points at a narrower command.
|
|
14
14
|
*/
|
|
15
15
|
import { type CallOptions } from "../core/http.js";
|
|
16
|
-
import type {
|
|
16
|
+
import type { CommandOperation } from "../core/operation-meta.js";
|
|
17
17
|
import type { McpToolResult } from "./mcp-protocol.js";
|
|
18
18
|
/** The largest answer handed to an agent whole. */
|
|
19
19
|
export declare const MAX_RESULT_CHARS = 200000;
|
|
@@ -21,5 +21,5 @@ export declare const MAX_RESULT_CHARS = 200000;
|
|
|
21
21
|
export interface ToolCallClient {
|
|
22
22
|
call(opts: CallOptions): Promise<unknown>;
|
|
23
23
|
}
|
|
24
|
-
export declare function callOperationTool(meta:
|
|
24
|
+
export declare function callOperationTool(meta: CommandOperation, args: unknown, client: ToolCallClient): Promise<McpToolResult>;
|
|
25
25
|
//# sourceMappingURL=mcp-call.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-call.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"mcp-call.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,mDAAmD;AACnD,eAAO,MAAM,gBAAgB,SAAU,CAAC;AAExC,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3C;AAID,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA6B7H"}
|
package/dist/mcp/mcp-call.js
CHANGED
|
@@ -22,9 +22,15 @@ export async function callOperationTool(meta, args, client) {
|
|
|
22
22
|
const parsed = toolArgumentsOf(meta, args);
|
|
23
23
|
if (!parsed.ok)
|
|
24
24
|
return text(parsed.message, true);
|
|
25
|
-
const { positionals, query, body } = parsed.values;
|
|
25
|
+
const { positionals, query, headers, body } = parsed.values;
|
|
26
26
|
try {
|
|
27
|
-
const data = await client.call({
|
|
27
|
+
const data = await client.call({
|
|
28
|
+
method: meta.method,
|
|
29
|
+
path: buildPath(meta, positionals),
|
|
30
|
+
query,
|
|
31
|
+
...(headers ? { headers } : {}),
|
|
32
|
+
...(body !== undefined ? { body } : {}),
|
|
33
|
+
});
|
|
28
34
|
const rendered = JSON.stringify(data ?? null, null, 2);
|
|
29
35
|
if (rendered.length > MAX_RESULT_CHARS) {
|
|
30
36
|
return text(`The answer is ${rendered.length} characters, more than this tool hands over at once (${MAX_RESULT_CHARS}). ` +
|
package/dist/mcp/mcp-call.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-call.js","sourceRoot":"","sources":["../../src/mcp/mcp-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAoB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,mDAAmD;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAOxC,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,OAAO,GAAG,KAAK,EAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEtJ,MAAM,CAAC,KAAK,UAAU,iBA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C,EAAE,CAAC;YAC/B,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxC,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvD,IAAI,QAAQ,CAAC,MAAM,GAAG,gBAAgB,EAAE,CAAC;YACvC,OAAO,IAAI,CACT,iBAAiB,QAAQ,CAAC,MAAM,wDAAwD,gBAAgB,KAAK;gBAC3G,sFAAsF,EACxF,IAAI,CACL,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,kFAAkF;YAClF,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YACtI,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
|
|
@@ -6,13 +6,17 @@
|
|
|
6
6
|
* beside `ora tunnels`): `serve` starts the server on stdio, `config` prints
|
|
7
7
|
* the entry an agent's configuration needs, `install` writes it for an agent
|
|
8
8
|
* this CLI knows. What the server offers is decided by the manifest and the
|
|
9
|
-
*
|
|
9
|
+
* three flags; what a call may DO is decided by the api key, as for a command.
|
|
10
|
+
*
|
|
11
|
+
* The Front's tools are the very tools ora's remote MCP server serves apps (the
|
|
12
|
+
* document defines them; `--command front` serves exactly those), plus the one
|
|
13
|
+
* tool only a local server can have: front_save_transmitter_credential.
|
|
10
14
|
*/
|
|
11
15
|
import type { Command } from "commander";
|
|
12
16
|
import type { Readable, Writable } from "node:stream";
|
|
13
17
|
import type { ResolvedDeps } from "../program.js";
|
|
14
18
|
import { type ServeOptions } from "./mcp-install.js";
|
|
15
|
-
import {
|
|
19
|
+
import type { ToolBinding } from "./tool-binding.js";
|
|
16
20
|
/** The name an agent lists the server under. */
|
|
17
21
|
export declare const MCP_SERVER_NAME = "ora";
|
|
18
22
|
/** What the server tells an agent once, at initialize. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-command.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-command.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-command.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAItD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAsE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGzH,OAAO,KAAK,EAAwB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG3E,gDAAgD;AAChD,eAAO,MAAM,eAAe,QAAQ,CAAC;AAyBrC,0DAA0D;AAC1D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,CAa9F;AAED,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;CAC5B;AAiBD,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAE,KAAiB,GAAG,IAAI,CAoD5G"}
|
package/dist/mcp/mcp-command.js
CHANGED
|
@@ -6,28 +6,46 @@
|
|
|
6
6
|
* beside `ora tunnels`): `serve` starts the server on stdio, `config` prints
|
|
7
7
|
* the entry an agent's configuration needs, `install` writes it for an agent
|
|
8
8
|
* this CLI knows. What the server offers is decided by the manifest and the
|
|
9
|
-
*
|
|
9
|
+
* three flags; what a call may DO is decided by the api key, as for a command.
|
|
10
|
+
*
|
|
11
|
+
* The Front's tools are the very tools ora's remote MCP server serves apps (the
|
|
12
|
+
* document defines them; `--command front` serves exactly those), plus the one
|
|
13
|
+
* tool only a local server can have: front_save_transmitter_credential.
|
|
10
14
|
*/
|
|
15
|
+
import { randomUUID } from "node:crypto";
|
|
11
16
|
import { renderError } from "../core/output.js";
|
|
12
17
|
import { credentials } from "../core/run-operation.js";
|
|
13
18
|
import { OPERATIONS, SPEC } from "../generated/operations.js";
|
|
14
|
-
import {
|
|
19
|
+
import { localToolBindingsOf } from "./local-tools/local-tools.js";
|
|
15
20
|
import { MCP_TARGET_KEYS, installMcpServer, resolveMcpTarget, serverEntryOf } from "./mcp-install.js";
|
|
16
21
|
import { McpServer } from "./mcp-protocol.js";
|
|
17
22
|
import { serveStdio } from "./mcp-stdio.js";
|
|
18
|
-
import { toolBindingsOf } from "./
|
|
23
|
+
import { toolBindingsOf } from "./tool-bindings.js";
|
|
19
24
|
/** The name an agent lists the server under. */
|
|
20
25
|
export const MCP_SERVER_NAME = "ora";
|
|
21
26
|
const collect = (value, previous) => [...previous, value];
|
|
22
|
-
const serveOptionsOf = (opts) => ({ products: opts.product, readOnly: opts.readOnly === true });
|
|
27
|
+
const serveOptionsOf = (opts) => ({ products: opts.product, commands: opts.command, readOnly: opts.readOnly === true });
|
|
28
|
+
/** The commands a scope keeps, in words: `the study commands`, `the ora front commands`, or every command. */
|
|
29
|
+
function scopeOf(options) {
|
|
30
|
+
const commands = options.commands ?? [];
|
|
31
|
+
const kept = [
|
|
32
|
+
...(options.products.length > 0 ? [`the ${options.products.join(", ")} commands`] : []),
|
|
33
|
+
...(commands.length > 0 ? [`the ${commands.map((command) => `${SPEC.bin} ${command}`).join(", ")} commands`] : []),
|
|
34
|
+
];
|
|
35
|
+
return [kept.length > 0 ? kept.join(" among ") : "every command", options.readOnly ? "reads only" : "reads and writes"].join(", ");
|
|
36
|
+
}
|
|
37
|
+
/** Is this a tool the API's document defines (ora Front's own), rather than a command? */
|
|
38
|
+
const isDefinedTool = (binding) => "meta" in binding && typeof binding.meta.mcpTool === "object";
|
|
23
39
|
/** What the server tells an agent once, at initialize. */
|
|
24
40
|
export function instructionsOf(bindings, options) {
|
|
25
|
-
const
|
|
26
|
-
options.products.length > 0 ? `the ${options.products.join(", ")} commands` : "every command",
|
|
27
|
-
options.readOnly ? "reads only" : "reads and writes",
|
|
28
|
-
].join(", ");
|
|
41
|
+
const front = bindings.some(isDefinedTool);
|
|
29
42
|
return [
|
|
30
|
-
`These ${bindings.length} tools are the ora CLI's commands (${
|
|
43
|
+
`These ${bindings.length} tools are the ora CLI's commands (${scopeOf(options)}). A tool named a_b_c runs the command \`${SPEC.bin} a b c\` and answers the API's JSON.`,
|
|
44
|
+
...(front
|
|
45
|
+
? [
|
|
46
|
+
"The front_ tools are ora Front's own, as ora's MCP server offers them to apps, named for what they do: each answers its result as structured content, and a failed one answers a problem with its code, whether anything changed (outcome) and whether retrying can help.",
|
|
47
|
+
]
|
|
48
|
+
: []),
|
|
31
49
|
"A tool error carries the API's own refusal (status, code and what it said): read it, fix the call, and try again.",
|
|
32
50
|
"Read before you write: get or list the thing first, and for a study run its preflight before creating it.",
|
|
33
51
|
"A write is not retried by the server. Launching a study starts real agent runs and spends the organization's usage.",
|
|
@@ -37,8 +55,14 @@ const processIo = { input: process.stdin, output: process.stdout, cwd: () => pro
|
|
|
37
55
|
function scoped(command) {
|
|
38
56
|
return command
|
|
39
57
|
.option("--product <key>", "serve only this product's commands (repeatable): studio, study, experiment, platform", collect, [])
|
|
58
|
+
.option("--command <name>", 'serve only the commands under this one (repeatable): front, or "front sites"', collect, [])
|
|
40
59
|
.option("--read-only", "serve only the commands that read");
|
|
41
60
|
}
|
|
61
|
+
/** No tool matches: say which flags asked for nothing. */
|
|
62
|
+
function nothingMatches(options) {
|
|
63
|
+
const flags = [...options.products.map((p) => `--product ${p}`), ...(options.commands ?? []).map((c) => `--command ${c}`)];
|
|
64
|
+
return `No command matches ${flags.join(" ") || "these flags"}. Nothing to serve.`;
|
|
65
|
+
}
|
|
42
66
|
export function attachMcp(program, deps, version, io = processIo) {
|
|
43
67
|
const group = program.commands.find((c) => c.name() === "mcp") ?? program.command("mcp").description("mcp commands");
|
|
44
68
|
scoped(group.command("serve"))
|
|
@@ -49,9 +73,9 @@ export function attachMcp(program, deps, version, io = processIo) {
|
|
|
49
73
|
if (!creds)
|
|
50
74
|
return;
|
|
51
75
|
const options = serveOptionsOf(opts);
|
|
52
|
-
const bindings = toolBindingsOf(OPERATIONS, options);
|
|
76
|
+
const bindings = [...toolBindingsOf(OPERATIONS, options), ...localToolBindingsOf(options)];
|
|
53
77
|
if (bindings.length === 0) {
|
|
54
|
-
deps.errOut(
|
|
78
|
+
deps.errOut(nothingMatches(options));
|
|
55
79
|
process.exitCode = 1;
|
|
56
80
|
return;
|
|
57
81
|
}
|
|
@@ -61,7 +85,7 @@ export function attachMcp(program, deps, version, io = processIo) {
|
|
|
61
85
|
listTools: () => bindings.map((binding) => binding.tool),
|
|
62
86
|
callTool: async (name, args) => {
|
|
63
87
|
const binding = byName.get(name);
|
|
64
|
-
return binding ?
|
|
88
|
+
return binding ? binding.call(args, { client, cwd: io.cwd(), operations: OPERATIONS, newId: randomUUID }) : null;
|
|
65
89
|
},
|
|
66
90
|
});
|
|
67
91
|
// For a person watching the agent's logs. On stderr: stdout is the protocol's alone.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-command.js","sourceRoot":"","sources":["../../src/mcp/mcp-command.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-command.js","sourceRoot":"","sources":["../../src/mcp/mcp-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAqB,MAAM,kBAAkB,CAAC;AACzH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,gDAAgD;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAQrC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,QAAkB,EAAY,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC;AACtF,MAAM,cAAc,GAAG,CAAC,IAAgB,EAAgB,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,QA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ACxF,MAAM,CAAC,CAAC,IAAoC,EAAE,EAAE;QAC/C,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACtI,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,SAAS,eAAe,gBAAgB,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1H,IAAI,CAAC,GAAG,CAAC,gHAAgH,CAAC,CAAC;QAC7H,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -21,6 +21,8 @@ export interface McpServerEntry {
|
|
|
21
21
|
}
|
|
22
22
|
export interface ServeOptions {
|
|
23
23
|
readonly products: readonly string[];
|
|
24
|
+
/** Commands the server keeps (`front`, `front sites`). Absent or empty: every command. */
|
|
25
|
+
readonly commands?: readonly string[];
|
|
24
26
|
readonly readOnly: boolean;
|
|
25
27
|
}
|
|
26
28
|
/** The flags of `ora mcp serve` for these options: what `serve` itself parses. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-install.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CA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AAG,gBAAgB,CAI9D;AAKD,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMpI;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,kBAAkB,CAqB/H"}
|
package/dist/mcp/mcp-install.js
CHANGED
|
@@ -18,7 +18,13 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
18
18
|
import { dirname, join } from "node:path";
|
|
19
19
|
/** The flags of `ora mcp serve` for these options: what `serve` itself parses. */
|
|
20
20
|
export function serveArgsOf(options) {
|
|
21
|
-
return [
|
|
21
|
+
return [
|
|
22
|
+
"mcp",
|
|
23
|
+
"serve",
|
|
24
|
+
...options.products.flatMap((product) => ["--product", product]),
|
|
25
|
+
...(options.commands ?? []).flatMap((command) => ["--command", command]),
|
|
26
|
+
...(options.readOnly ? ["--read-only"] : []),
|
|
27
|
+
];
|
|
22
28
|
}
|
|
23
29
|
export const serverEntryOf = (bin, options) => ({ command: bin, args: serveArgsOf(options) });
|
|
24
30
|
export const MCP_INSTALL_TARGETS = [
|