@deeprelay/mcp 0.1.1 → 0.2.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 +41 -14
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +16 -0
- package/dist/auth.js.map +1 -1
- package/dist/guardrail/estimate.d.ts +23 -2
- package/dist/guardrail/estimate.js +54 -12
- package/dist/guardrail/estimate.js.map +1 -1
- package/dist/roster.d.ts +3 -3
- package/dist/roster.js +71 -0
- package/dist/roster.js.map +1 -1
- package/dist/tools/api-json.d.ts +5 -0
- package/dist/tools/api-json.js +15 -0
- package/dist/tools/api-json.js.map +1 -0
- package/dist/tools/readonly/alerts.d.ts +26 -0
- package/dist/tools/readonly/alerts.js +58 -0
- package/dist/tools/readonly/alerts.js.map +1 -0
- package/dist/tools/readonly/define.d.ts +12 -1
- package/dist/tools/readonly/define.js +17 -3
- package/dist/tools/readonly/define.js.map +1 -1
- package/dist/tools/readonly/index.d.ts +3 -1
- package/dist/tools/readonly/index.js +90 -23
- package/dist/tools/readonly/index.js.map +1 -1
- package/dist/tools/readonly/requests.d.ts +78 -0
- package/dist/tools/readonly/requests.js +195 -0
- package/dist/tools/readonly/requests.js.map +1 -0
- package/dist/tools/readonly/usage.js +48 -11
- package/dist/tools/readonly/usage.js.map +1 -1
- package/dist/tools/readonly/video-reads.js +7 -4
- package/dist/tools/readonly/video-reads.js.map +1 -1
- package/dist/tools/spend/define.js +3 -1
- package/dist/tools/spend/define.js.map +1 -1
- package/dist/tools/spend/index.d.ts +2 -0
- package/dist/tools/spend/index.js +181 -30
- package/dist/tools/spend/index.js.map +1 -1
- package/dist/tools/spend/media.js +7 -5
- package/dist/tools/spend/media.js.map +1 -1
- package/dist/tools/spend/pricing.js +4 -0
- package/dist/tools/spend/pricing.js.map +1 -1
- package/dist/tools/write/alerts.d.ts +4 -0
- package/dist/tools/write/alerts.js +141 -0
- package/dist/tools/write/alerts.js.map +1 -0
- package/dist/tools/write/index.d.ts +2 -1
- package/dist/tools/write/index.js +10 -3
- package/dist/tools/write/index.js.map +1 -1
- package/dist/tools/write/payment-links.js +26 -4
- package/dist/tools/write/payment-links.js.map +1 -1
- package/dist/tools/write/spending-limit.js +26 -33
- package/dist/tools/write/spending-limit.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alertReadTools = exports.alertSettingsSchema = exports.alertEmailTogglesSchema = void 0;
|
|
4
|
+
exports.getAlertSettings = getAlertSettings;
|
|
5
|
+
exports.alertSettingsView = alertSettingsView;
|
|
6
|
+
// deeprelay_alerts_get: the organization's alert settings (Phase 111, D-13,
|
|
7
|
+
// D-15). Transport: @deeprelay/sdk AlertsApi, with the body parsed by the
|
|
8
|
+
// closed zod schema below (see tools/api-json.ts).
|
|
9
|
+
//
|
|
10
|
+
// The write half (deeprelay_alerts_set) lives in tools/write/alerts.ts and
|
|
11
|
+
// reuses getAlertSettings/alertSettingsSchema from here.
|
|
12
|
+
const sdk_1 = require("@deeprelay/sdk");
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
const api_json_js_1 = require("../api-json.js");
|
|
15
|
+
const define_js_1 = require("./define.js");
|
|
16
|
+
exports.alertEmailTogglesSchema = zod_1.z.object({
|
|
17
|
+
balance_low: zod_1.z.boolean(),
|
|
18
|
+
subscription_quota: zod_1.z.boolean(),
|
|
19
|
+
api_key_budget: zod_1.z.boolean(),
|
|
20
|
+
member_spend: zod_1.z.boolean(),
|
|
21
|
+
});
|
|
22
|
+
/** The settings view. Closed: unknown fields are dropped. */
|
|
23
|
+
exports.alertSettingsSchema = zod_1.z.object({
|
|
24
|
+
balance_threshold_cents: zod_1.z.number().int(),
|
|
25
|
+
email: exports.alertEmailTogglesSchema,
|
|
26
|
+
updated_at: zod_1.z.string().nullable().optional(),
|
|
27
|
+
note: zod_1.z.string().optional(),
|
|
28
|
+
});
|
|
29
|
+
/** GET /alerts/settings, parsed. */
|
|
30
|
+
async function getAlertSettings(config) {
|
|
31
|
+
return exports.alertSettingsSchema.parse(await (0, api_json_js_1.apiJson)(new sdk_1.AlertsApi(config).getAlertSettingsRaw()));
|
|
32
|
+
}
|
|
33
|
+
/** The view the agent sees: the API fields plus the threshold in dollars. */
|
|
34
|
+
function alertSettingsView(s) {
|
|
35
|
+
return {
|
|
36
|
+
balance_threshold_cents: s.balance_threshold_cents,
|
|
37
|
+
balance_threshold_dollars: `$${(s.balance_threshold_cents / 100).toFixed(2)}`,
|
|
38
|
+
email: s.email,
|
|
39
|
+
updated_at: s.updated_at ?? null,
|
|
40
|
+
...(s.note === undefined ? {} : { note: s.note }),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.alertReadTools = [
|
|
44
|
+
(0, define_js_1.defineTool)({
|
|
45
|
+
name: "deeprelay_alerts_get",
|
|
46
|
+
title: "Get the deeprelay alert settings",
|
|
47
|
+
description: "Get the organization's alert settings: the low-balance threshold, and which governance alerts are emailed " +
|
|
48
|
+
"to org admins (balance_low, subscription_quota, api_key_budget, member_spend). updated_at is null until the " +
|
|
49
|
+
"organization saves its settings once. Change them with deeprelay_alerts_set. Free: charges nothing and needs " +
|
|
50
|
+
"no confirmation.",
|
|
51
|
+
inputSchema: {},
|
|
52
|
+
context: "getting the alert settings",
|
|
53
|
+
async call(_args, config) {
|
|
54
|
+
return alertSettingsView(await getAlertSettings(config));
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
];
|
|
58
|
+
//# sourceMappingURL=alerts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../../src/tools/readonly/alerts.ts"],"names":[],"mappings":";;;AA8BA,4CAEC;AAGD,8CAQC;AA3CD,4EAA4E;AAC5E,0EAA0E;AAC1E,mDAAmD;AACnD,EAAE;AACF,2EAA2E;AAC3E,yDAAyD;AACz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C,IAAI,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC;AAEY,QAAA,cAAc,GAAG;IAC5B,IAAA,sBAAU,EAAC;QACT,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,kCAAkC;QACzC,WAAW,EACT,4GAA4G;YAC5G,8GAA8G;YAC9G,+GAA+G;YAC/G,kBAAkB;QACpB,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,4BAA4B;QACrC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;YACtB,OAAO,iBAAiB,CAAC,MAAM,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -11,8 +11,17 @@ import type { Env, ToolAnnotations, ToolDefinition } from "../types.js";
|
|
|
11
11
|
export declare class ReadRefusal extends Error {
|
|
12
12
|
constructor(message: string);
|
|
13
13
|
}
|
|
14
|
-
/** Every read tool advertises the same four hints. */
|
|
14
|
+
/** Every read tool advertises the same four hints, except a local-file writer (below). */
|
|
15
15
|
export declare const READ_ANNOTATIONS: ToolAnnotations;
|
|
16
|
+
/**
|
|
17
|
+
* Hints for the one read-tier tool that writes to the local filesystem
|
|
18
|
+
* (deeprelay_videos_content, WR-08). It spends nothing and needs no
|
|
19
|
+
* confirmation, so it stays in the read tier, but it is not read-only (it
|
|
20
|
+
* creates a file and its directory) and not idempotent (a repeat call for the
|
|
21
|
+
* same default path is refused because the file exists). Clients that
|
|
22
|
+
* auto-approve readOnlyHint tools must not auto-approve a file write.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LOCAL_WRITE_READ_ANNOTATIONS: ToolAnnotations;
|
|
16
25
|
export interface ReadToolSpec<Shape extends ZodRawShape> {
|
|
17
26
|
name: ReadToolName;
|
|
18
27
|
title: string;
|
|
@@ -26,6 +35,8 @@ export interface ReadToolSpec<Shape extends ZodRawShape> {
|
|
|
26
35
|
* unauthenticated liveness probe sets this.
|
|
27
36
|
*/
|
|
28
37
|
keyless?: boolean;
|
|
38
|
+
/** The tool writes a local file: advertise LOCAL_WRITE_READ_ANNOTATIONS. */
|
|
39
|
+
writesLocalFiles?: boolean;
|
|
29
40
|
call(args: z.infer<z.ZodObject<Shape>>, config: Configuration, env: Env): Promise<unknown>;
|
|
30
41
|
}
|
|
31
42
|
/** Wrap a typed SDK call into a read-tier ToolDefinition. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.READ_ANNOTATIONS = exports.ReadRefusal = void 0;
|
|
3
|
+
exports.LOCAL_WRITE_READ_ANNOTATIONS = exports.READ_ANNOTATIONS = exports.ReadRefusal = void 0;
|
|
4
4
|
exports.defineTool = defineTool;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const auth_js_1 = require("../../auth.js");
|
|
@@ -19,13 +19,27 @@ class ReadRefusal extends Error {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.ReadRefusal = ReadRefusal;
|
|
22
|
-
/** Every read tool advertises the same four hints. */
|
|
22
|
+
/** Every read tool advertises the same four hints, except a local-file writer (below). */
|
|
23
23
|
exports.READ_ANNOTATIONS = Object.freeze({
|
|
24
24
|
readOnlyHint: true,
|
|
25
25
|
destructiveHint: false,
|
|
26
26
|
idempotentHint: true,
|
|
27
27
|
openWorldHint: true,
|
|
28
28
|
});
|
|
29
|
+
/**
|
|
30
|
+
* Hints for the one read-tier tool that writes to the local filesystem
|
|
31
|
+
* (deeprelay_videos_content, WR-08). It spends nothing and needs no
|
|
32
|
+
* confirmation, so it stays in the read tier, but it is not read-only (it
|
|
33
|
+
* creates a file and its directory) and not idempotent (a repeat call for the
|
|
34
|
+
* same default path is refused because the file exists). Clients that
|
|
35
|
+
* auto-approve readOnlyHint tools must not auto-approve a file write.
|
|
36
|
+
*/
|
|
37
|
+
exports.LOCAL_WRITE_READ_ANNOTATIONS = Object.freeze({
|
|
38
|
+
readOnlyHint: false,
|
|
39
|
+
destructiveHint: false,
|
|
40
|
+
idempotentHint: false,
|
|
41
|
+
openWorldHint: true,
|
|
42
|
+
});
|
|
29
43
|
/** Wrap a typed SDK call into a read-tier ToolDefinition. */
|
|
30
44
|
function defineTool(spec) {
|
|
31
45
|
const schema = zod_1.z.object(spec.inputSchema);
|
|
@@ -35,7 +49,7 @@ function defineTool(spec) {
|
|
|
35
49
|
title: spec.title,
|
|
36
50
|
description: spec.description,
|
|
37
51
|
inputSchema: spec.inputSchema,
|
|
38
|
-
annotations: { ...exports.READ_ANNOTATIONS },
|
|
52
|
+
annotations: { ...(spec.writesLocalFiles === true ? exports.LOCAL_WRITE_READ_ANNOTATIONS : exports.READ_ANNOTATIONS) },
|
|
39
53
|
enabledAtBoot: true,
|
|
40
54
|
async handler(args, ctx) {
|
|
41
55
|
const env = ctx?.env ?? process.env;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/tools/readonly/define.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/tools/readonly/define.ts"],"names":[],"mappings":";;;AA8EA,gCA+BC;AA9FD,6BAA0C;AAE1C,2CAAmD;AACnD,+CAAgE;AAEhE,4CAAwC;AAGxC;;;;;GAKG;AACH,MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AAED,0FAA0F;AAC7E,QAAA,gBAAgB,GAAoB,MAAM,CAAC,MAAM,CAAC;IAC7D,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACU,QAAA,4BAA4B,GAAoB,MAAM,CAAC,MAAM,CAAC;I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AAE,MAAM,EAAE,GAAG,CAAC,CAAC;gBACrD,OAAO,IAAA,cAAE,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YAC9B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,WAAW,EAAE,CAAC;oBAC/B,OAAO,IAAA,gBAAI,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACxB,CAAC;gBACD,OAAO,IAAA,gBAAI,EAAC,MAAM,IAAA,4BAAgB,EAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ToolDefinition } from "../types.js";
|
|
2
|
-
export { defineTool, READ_ANNOTATIONS } from "./define.js";
|
|
2
|
+
export { defineTool, LOCAL_WRITE_READ_ANNOTATIONS, READ_ANNOTATIONS } from "./define.js";
|
|
3
3
|
export { observeVideoJob, VIDEO_TMP_DIR, videoReadTools } from "./video-reads.js";
|
|
4
|
+
export { alertReadTools } from "./alerts.js";
|
|
5
|
+
export { requestReadTools } from "./requests.js";
|
|
4
6
|
/** The in-process session budget (D-06/D-08), in dollars, with pending video holds. */
|
|
5
7
|
export declare function renderSessionBudget(): Record<string, unknown>;
|
|
6
8
|
/** The full read tier. Every name in roster READ_TOOLS appears here exactly once. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readonlyTools = exports.videoReadTools = exports.VIDEO_TMP_DIR = exports.observeVideoJob = exports.READ_ANNOTATIONS = exports.defineTool = void 0;
|
|
3
|
+
exports.readonlyTools = exports.requestReadTools = exports.alertReadTools = exports.videoReadTools = exports.VIDEO_TMP_DIR = exports.observeVideoJob = exports.READ_ANNOTATIONS = exports.LOCAL_WRITE_READ_ANNOTATIONS = exports.defineTool = void 0;
|
|
4
4
|
exports.renderSessionBudget = renderSessionBudget;
|
|
5
5
|
// The free read tier (Phase 104, D-03/D-04/D-05/D-10). Authored fresh (D-12).
|
|
6
6
|
//
|
|
@@ -10,23 +10,39 @@ exports.renderSessionBudget = renderSessionBudget;
|
|
|
10
10
|
// accounting, and every result goes through ok(), so credential fields are
|
|
11
11
|
// sanitized and key-shaped text is redacted before the agent sees it.
|
|
12
12
|
//
|
|
13
|
+
// Output shape: snake_case, the API's own field names, as the docs describe
|
|
14
|
+
// every tool's output. A tool that passes an API object through returns the
|
|
15
|
+
// API's JSON body from the SDK's *Raw method (tools/api-json.ts), not the
|
|
16
|
+
// SDK's camelCase model: the agent sees the field names the API reference and
|
|
17
|
+
// docs use, and a field newer than the pinned SDK (a model's metrics, name,
|
|
18
|
+
// tier, reasoning_efforts, ...) still reaches it. auth_status, usage and the
|
|
19
|
+
// video reads build their own snake_case views.
|
|
20
|
+
//
|
|
13
21
|
// There is no operations tool (D-04). The video reads, which are the only
|
|
14
22
|
// place a pending video reservation settles (D-07), live in video-reads.ts.
|
|
15
23
|
const sdk_1 = require("@deeprelay/sdk");
|
|
16
24
|
const zod_1 = require("zod");
|
|
17
25
|
const auth_js_1 = require("../../auth.js");
|
|
26
|
+
const api_json_js_1 = require("../api-json.js");
|
|
18
27
|
const errors_js_1 = require("../../errors.js");
|
|
19
28
|
const budget_js_1 = require("../../guardrail/budget.js");
|
|
29
|
+
const alerts_js_1 = require("./alerts.js");
|
|
20
30
|
const define_js_1 = require("./define.js");
|
|
31
|
+
const requests_js_1 = require("./requests.js");
|
|
21
32
|
const usage_js_1 = require("./usage.js");
|
|
22
33
|
const video_reads_js_1 = require("./video-reads.js");
|
|
23
34
|
var define_js_2 = require("./define.js");
|
|
24
35
|
Object.defineProperty(exports, "defineTool", { enumerable: true, get: function () { return define_js_2.defineTool; } });
|
|
36
|
+
Object.defineProperty(exports, "LOCAL_WRITE_READ_ANNOTATIONS", { enumerable: true, get: function () { return define_js_2.LOCAL_WRITE_READ_ANNOTATIONS; } });
|
|
25
37
|
Object.defineProperty(exports, "READ_ANNOTATIONS", { enumerable: true, get: function () { return define_js_2.READ_ANNOTATIONS; } });
|
|
26
38
|
var video_reads_js_2 = require("./video-reads.js");
|
|
27
39
|
Object.defineProperty(exports, "observeVideoJob", { enumerable: true, get: function () { return video_reads_js_2.observeVideoJob; } });
|
|
28
40
|
Object.defineProperty(exports, "VIDEO_TMP_DIR", { enumerable: true, get: function () { return video_reads_js_2.VIDEO_TMP_DIR; } });
|
|
29
41
|
Object.defineProperty(exports, "videoReadTools", { enumerable: true, get: function () { return video_reads_js_2.videoReadTools; } });
|
|
42
|
+
var alerts_js_2 = require("./alerts.js");
|
|
43
|
+
Object.defineProperty(exports, "alertReadTools", { enumerable: true, get: function () { return alerts_js_2.alertReadTools; } });
|
|
44
|
+
var requests_js_2 = require("./requests.js");
|
|
45
|
+
Object.defineProperty(exports, "requestReadTools", { enumerable: true, get: function () { return requests_js_2.requestReadTools; } });
|
|
30
46
|
/** Render 1e-6-cent units as dollars, for the agent's summary to the user. */
|
|
31
47
|
function dollars(microCents) {
|
|
32
48
|
return `$${(microCents / (budget_js_1.MICRO_CENTS_PER_CENT * 100)).toFixed(2)}`;
|
|
@@ -43,6 +59,39 @@ async function orNotFound(call, onNotFound) {
|
|
|
43
59
|
throw err;
|
|
44
60
|
}
|
|
45
61
|
}
|
|
62
|
+
/** The API's code for a crypto route while the feature is dark for this account. */
|
|
63
|
+
const CRYPTO_DARK_CODE = "not-found";
|
|
64
|
+
/** The API's code for an unknown (or another org's) deposit id; the feature is on. */
|
|
65
|
+
const DEPOSIT_NOT_FOUND_CODE = "deposit-not-found";
|
|
66
|
+
/**
|
|
67
|
+
* deeprelay_deposits_get's 404s are two different answers (WR-05): the dark
|
|
68
|
+
* route (`not-found`) means the feature is not enabled, while
|
|
69
|
+
* `deposit-not-found` means the feature is on and there is no deposit with
|
|
70
|
+
* that id on this account. Any other 404 is a real error.
|
|
71
|
+
*/
|
|
72
|
+
async function getDepositOrExplain(api, id) {
|
|
73
|
+
try {
|
|
74
|
+
return { crypto_deposits_enabled: true, ...(await (0, api_json_js_1.apiObject)(api.getDepositRaw({ id }))) };
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
if ((0, errors_js_1.httpStatusOf)(err) !== 404)
|
|
78
|
+
throw err;
|
|
79
|
+
const { code } = await (0, errors_js_1.readErrorEnvelope)(err);
|
|
80
|
+
if (code === DEPOSIT_NOT_FOUND_CODE) {
|
|
81
|
+
return {
|
|
82
|
+
crypto_deposits_enabled: true,
|
|
83
|
+
found: false,
|
|
84
|
+
id,
|
|
85
|
+
note: "No crypto deposit with this id exists on this account. Crypto deposits are enabled; check the id " +
|
|
86
|
+
"with deeprelay_deposits_list.",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (code === CRYPTO_DARK_CODE) {
|
|
90
|
+
return { crypto_deposits_enabled: false };
|
|
91
|
+
}
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
46
95
|
/** The in-process session budget (D-06/D-08), in dollars, with pending video holds. */
|
|
47
96
|
function renderSessionBudget() {
|
|
48
97
|
const s = (0, budget_js_1.budgetStatus)();
|
|
@@ -97,7 +146,7 @@ const coreReadTools = [
|
|
|
97
146
|
const balance = await billing.getBalance();
|
|
98
147
|
return {
|
|
99
148
|
authenticated: true,
|
|
100
|
-
api_base: (0, auth_js_1.
|
|
149
|
+
api_base: (0, auth_js_1.displayBaseUrl)(env),
|
|
101
150
|
spending_limit: limit === null ? null : spendingLimitView(limit),
|
|
102
151
|
balance: balanceView(balance),
|
|
103
152
|
session_budget: renderSessionBudget(),
|
|
@@ -114,34 +163,40 @@ const coreReadTools = [
|
|
|
114
163
|
keyless: true,
|
|
115
164
|
async call(_args, config, env) {
|
|
116
165
|
const health = await new sdk_1.MetaApi(config).getHealth();
|
|
117
|
-
return { status: health.status ?? "unknown", api_base: (0, auth_js_1.
|
|
166
|
+
return { status: health.status ?? "unknown", api_base: (0, auth_js_1.displayBaseUrl)(env) };
|
|
118
167
|
},
|
|
119
168
|
}),
|
|
120
169
|
(0, define_js_1.defineTool)({
|
|
121
170
|
name: "deeprelay_models_list",
|
|
122
171
|
title: "List deeprelay models",
|
|
123
|
-
description: "List the models deeprelay serves,
|
|
124
|
-
"
|
|
172
|
+
description: "List the models deeprelay serves, exactly as the API returns them: id, name, modality (chat, embedding, " +
|
|
173
|
+
"image, video), tier, pricing, plan_covered, context_length, max_completion_tokens, reasoning_efforts and " +
|
|
174
|
+
"metrics (observed ttft_p50_ms, tokens_per_second_p50 and success_rate over a recent window). Each chat " +
|
|
175
|
+
"model's supported_parameters says what it accepts: tools, response_format (JSON mode), structured_outputs " +
|
|
176
|
+
"(strict JSON schema), logprobs, vision (image input). Call this before any inference call to pick a model " +
|
|
177
|
+
"id and see what it costs; filter with `modality`. " +
|
|
125
178
|
FREE,
|
|
126
179
|
inputSchema: {
|
|
127
180
|
modality: zod_1.z.enum(sdk_1.ListModelsModalityEnum).optional().describe("Only models of this modality."),
|
|
128
181
|
},
|
|
129
182
|
context: "listing models",
|
|
130
183
|
async call(args, config) {
|
|
131
|
-
return new sdk_1.InferenceApi(config).
|
|
184
|
+
return (0, api_json_js_1.apiJson)(new sdk_1.InferenceApi(config).listModelsRaw({ modality: args.modality }));
|
|
132
185
|
},
|
|
133
186
|
}),
|
|
134
187
|
(0, define_js_1.defineTool)({
|
|
135
188
|
name: "deeprelay_models_get",
|
|
136
189
|
title: "Get one deeprelay model",
|
|
137
|
-
description: "Get one model by id
|
|
138
|
-
|
|
190
|
+
description: "Get one model by id, exactly as the API returns it: modality, supported_parameters (capabilities such as " +
|
|
191
|
+
"tools, structured_outputs, logprobs and vision), reasoning_efforts, max_completion_tokens, pricing and " +
|
|
192
|
+
"metrics. Call this to confirm a model id exists and to read its exact rates " +
|
|
193
|
+
`before quoting a spend call. ${FREE}`,
|
|
139
194
|
inputSchema: {
|
|
140
195
|
id: zod_1.z.string().min(1).describe("Model id, as returned by deeprelay_models_list."),
|
|
141
196
|
},
|
|
142
197
|
context: "getting a model",
|
|
143
198
|
async call(args, config) {
|
|
144
|
-
return new sdk_1.InferenceApi(config).
|
|
199
|
+
return (0, api_json_js_1.apiJson)(new sdk_1.InferenceApi(config).getModelRaw({ id: args.id }));
|
|
145
200
|
},
|
|
146
201
|
}),
|
|
147
202
|
(0, define_js_1.defineTool)({
|
|
@@ -155,7 +210,7 @@ const coreReadTools = [
|
|
|
155
210
|
},
|
|
156
211
|
context: "preflighting an inference call",
|
|
157
212
|
async call(args, config) {
|
|
158
|
-
return new sdk_1.InferenceApi(config).
|
|
213
|
+
return (0, api_json_js_1.apiJson)(new sdk_1.InferenceApi(config).inferencePreflightRaw({ model: args.model }));
|
|
159
214
|
},
|
|
160
215
|
}),
|
|
161
216
|
(0, define_js_1.defineTool)({
|
|
@@ -193,7 +248,7 @@ const billingReadTools = [
|
|
|
193
248
|
inputSchema: {},
|
|
194
249
|
context: "getting the balance",
|
|
195
250
|
async call(_args, config) {
|
|
196
|
-
return new sdk_1.BillingApi(config).
|
|
251
|
+
return (0, api_json_js_1.apiJson)(new sdk_1.BillingApi(config).getBalanceRaw());
|
|
197
252
|
},
|
|
198
253
|
}),
|
|
199
254
|
(0, define_js_1.defineTool)({
|
|
@@ -205,7 +260,7 @@ const billingReadTools = [
|
|
|
205
260
|
inputSchema: {},
|
|
206
261
|
context: "getting the spending limit",
|
|
207
262
|
async call(_args, config) {
|
|
208
|
-
return orNotFound(async () => ({ configured: true, ...(await new sdk_1.BillingApi(config).
|
|
263
|
+
return orNotFound(async () => ({ configured: true, ...(await (0, api_json_js_1.apiObject)(new sdk_1.BillingApi(config).getSpendingLimitRaw())) }), () => ({ configured: false }));
|
|
209
264
|
},
|
|
210
265
|
}),
|
|
211
266
|
(0, define_js_1.defineTool)({
|
|
@@ -216,7 +271,7 @@ const billingReadTools = [
|
|
|
216
271
|
inputSchema: {},
|
|
217
272
|
context: "getting the subscription",
|
|
218
273
|
async call(_args, config) {
|
|
219
|
-
return new sdk_1.BillingApi(config).
|
|
274
|
+
return (0, api_json_js_1.apiJson)(new sdk_1.BillingApi(config).getSubscriptionRaw());
|
|
220
275
|
},
|
|
221
276
|
}),
|
|
222
277
|
(0, define_js_1.defineTool)({
|
|
@@ -226,20 +281,24 @@ const billingReadTools = [
|
|
|
226
281
|
inputSchema: {},
|
|
227
282
|
context: "listing crypto deposits",
|
|
228
283
|
async call(_args, config) {
|
|
229
|
-
return orNotFound(async () => ({
|
|
284
|
+
return orNotFound(async () => ({
|
|
285
|
+
crypto_deposits_enabled: true,
|
|
286
|
+
...(await (0, api_json_js_1.apiObject)(new sdk_1.BillingApi(config).listDepositsRaw())),
|
|
287
|
+
}), () => ({ crypto_deposits_enabled: false }));
|
|
230
288
|
},
|
|
231
289
|
}),
|
|
232
290
|
(0, define_js_1.defineTool)({
|
|
233
291
|
name: "deeprelay_deposits_get",
|
|
234
292
|
title: "Get a crypto deposit",
|
|
235
293
|
description: `Get one crypto deposit by id: status, chain, asset, amount and credited cents. ${DEPOSITS_NOTE} ` +
|
|
236
|
-
|
|
294
|
+
"An id that does not exist on this account returns `{ crypto_deposits_enabled: true, found: false }`: the " +
|
|
295
|
+
`feature is on and the id is wrong, so check it with deeprelay_deposits_list. ${FREE}`,
|
|
237
296
|
inputSchema: {
|
|
238
297
|
id: zod_1.z.string().min(1).describe("Deposit id, as returned by deeprelay_deposits_list."),
|
|
239
298
|
},
|
|
240
299
|
context: "getting a crypto deposit",
|
|
241
300
|
async call(args, config) {
|
|
242
|
-
return
|
|
301
|
+
return getDepositOrExplain(new sdk_1.BillingApi(config), args.id);
|
|
243
302
|
},
|
|
244
303
|
}),
|
|
245
304
|
(0, define_js_1.defineTool)({
|
|
@@ -250,22 +309,23 @@ const billingReadTools = [
|
|
|
250
309
|
inputSchema: {},
|
|
251
310
|
context: "getting the referral program",
|
|
252
311
|
async call(_args, config) {
|
|
253
|
-
return new sdk_1.BillingApi(config).
|
|
312
|
+
return (0, api_json_js_1.apiJson)(new sdk_1.BillingApi(config).getReferralRaw());
|
|
254
313
|
},
|
|
255
314
|
}),
|
|
256
315
|
(0, define_js_1.defineTool)({
|
|
257
316
|
name: "deeprelay_webhooks_list",
|
|
258
317
|
title: "List webhook endpoints",
|
|
259
318
|
description: "List the account's webhook endpoints: id, URL, subscribed event types and whether each is enabled. Pass " +
|
|
260
|
-
`\`cursor\` from \`
|
|
319
|
+
`\`cursor\` from \`next_cursor\` to page. ${NO_SECRET_NOTE} ${FREE}`,
|
|
261
320
|
inputSchema: {
|
|
262
|
-
cursor: zod_1.z.string().min(1).optional().describe("Page cursor from a previous result's
|
|
321
|
+
cursor: zod_1.z.string().min(1).optional().describe("Page cursor from a previous result's next_cursor."),
|
|
263
322
|
limit: zod_1.z.number().int().min(1).max(100).optional().describe("Endpoints per page (1-100)."),
|
|
264
323
|
},
|
|
265
324
|
context: "listing webhook endpoints",
|
|
266
325
|
async call(args, config) {
|
|
267
|
-
const page = await new sdk_1.WebhooksApi(config).
|
|
268
|
-
|
|
326
|
+
const page = await (0, api_json_js_1.apiObject)(new sdk_1.WebhooksApi(config).listWebhookEndpointsRaw({ cursor: args.cursor, limit: args.limit }));
|
|
327
|
+
const data = Array.isArray(page.data) ? page.data : [];
|
|
328
|
+
return { ...page, data: data.map(withoutSecret) };
|
|
269
329
|
},
|
|
270
330
|
}),
|
|
271
331
|
(0, define_js_1.defineTool)({
|
|
@@ -277,10 +337,17 @@ const billingReadTools = [
|
|
|
277
337
|
},
|
|
278
338
|
context: "getting a webhook endpoint",
|
|
279
339
|
async call(args, config) {
|
|
280
|
-
return withoutSecret(await new sdk_1.WebhooksApi(config).
|
|
340
|
+
return withoutSecret(await (0, api_json_js_1.apiObject)(new sdk_1.WebhooksApi(config).getWebhookEndpointRaw({ id: args.id })));
|
|
281
341
|
},
|
|
282
342
|
}),
|
|
283
343
|
];
|
|
284
344
|
/** The full read tier. Every name in roster READ_TOOLS appears here exactly once. */
|
|
285
|
-
exports.readonlyTools = [
|
|
345
|
+
exports.readonlyTools = [
|
|
346
|
+
...coreReadTools,
|
|
347
|
+
...billingReadTools,
|
|
348
|
+
...video_reads_js_1.videoReadTools,
|
|
349
|
+
// Phase 111: the request log and alert settings (RequestsApi / AlertsApi).
|
|
350
|
+
...requests_js_1.requestReadTools,
|
|
351
|
+
...alerts_js_1.alertReadTools,
|
|
352
|
+
];
|
|
286
353
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/readonly/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/readonly/index.ts"],"names":[],"mappings":";;;AAiGA,kDAiBC;AAlHD,8EAA8E;AAC9E,EAAE;AACF,gFAAgF;AAChF,kEAAkE;AAClE,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,gDAAgD;AAChD,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,wCAQwB;AACxB,6BAAwB;AAExB,2CAA+C;AAC/C,gDAAoD;AACpD,+CAAkE;AAClE,yDAAyG;AAEzG,2CAA6C;AAC7C,2CAAyC;AACzC,+CAAiD;AACjD,yCAAiE;AACjE,qDAAkD;AAElD,yCAAyF;AAAhF,uGAAA,UAAU,OAAA;AAAE,yHAAA,4BAA4B,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AACnE,mDAAkF;AAAzE,iHAAA,eAAe,OAAA;AAAE,+GAAA,aAAa,OAAA;AAAE,gHAAA,cAAc,OAAA;AACvD,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AAEzB,8EAA8E;A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,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;QACpD,CAAC;KACF,CAAC;IACF,IAAA,sBAAU,EAAC;QACT,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,sEAAsE,cAAc,IAAI,IAAI,EAAE;QAC3G,WAAW,EAAE;YACX,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8DAA8D,CAAC;SAC/F;QACD,OAAO,EAAE,4BAA4B;QACrC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM;YACrB,OAAO,aAAa,CAAC,MAAM,IAAA,uBAAS,EAAC,IAAI,iBAAW,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACxG,CAAC;KACF,CAAC;CACH,CAAC;AAEF,qFAAqF;AACxE,QAAA,aAAa,GAAqB;IAC7C,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,+BAAc;IACjB,2EAA2E;IAC3E,GAAG,8BAAgB;IACnB,GAAG,0BAAc;CAClB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type Configuration } from "@deeprelay/sdk";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
/** The API's page-size maximum for GET /v1/requests. */
|
|
4
|
+
export declare const REQUESTS_MAX_LIMIT = 100;
|
|
5
|
+
/** Most pages one tool call follows. */
|
|
6
|
+
export declare const REQUESTS_MAX_PAGES = 10;
|
|
7
|
+
export declare const REQUEST_SURFACES: readonly ["chat", "messages", "responses", "embeddings", "image", "video"];
|
|
8
|
+
export declare const REQUEST_STATUSES: readonly ["ok", "error", "cancelled", "rejected"];
|
|
9
|
+
/**
|
|
10
|
+
* A key's public prefix (`deeprelay_live_` plus four characters) is not a
|
|
11
|
+
* secret, but it has the shape redactSecrets() exists to catch, so passed
|
|
12
|
+
* through whole it would reach the agent as [REDACTED]. Loosening the
|
|
13
|
+
* redactor is the wrong fix. Instead the prefix is shown without its leading
|
|
14
|
+
* `deeprelay_` (`live_AbC1`): still enough to match it against the dashboard,
|
|
15
|
+
* and never key-shaped.
|
|
16
|
+
*/
|
|
17
|
+
export declare function shortKeyPrefix(prefix: string | undefined): string | undefined;
|
|
18
|
+
/** One request-log row as the agent sees it. Closed: unknown fields are dropped. */
|
|
19
|
+
export declare const requestLogEntrySchema: z.ZodObject<{
|
|
20
|
+
request_id: z.ZodString;
|
|
21
|
+
client_request_id: z.ZodOptional<z.ZodString>;
|
|
22
|
+
occurred_at: z.ZodString;
|
|
23
|
+
surface: z.ZodString;
|
|
24
|
+
model: z.ZodString;
|
|
25
|
+
key_id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
key_name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
key_prefix: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
28
|
+
status: z.ZodString;
|
|
29
|
+
http_status: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
error_code: z.ZodOptional<z.ZodString>;
|
|
31
|
+
finish_reason: z.ZodOptional<z.ZodString>;
|
|
32
|
+
prompt_tokens: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
completion_tokens: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
cached_tokens: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
reasoning_tokens: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
quota_units: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
cost: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
38
|
+
cost_micro_cents: z.ZodNumber;
|
|
39
|
+
plan_covered: z.ZodBoolean;
|
|
40
|
+
ttft_ms: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
ignored_params: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
had_tool_calls: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
image_count: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
video_seconds: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
suppressed_count: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type RequestLogEntry = z.infer<typeof requestLogEntrySchema>;
|
|
49
|
+
export declare const requestsListInputSchema: {
|
|
50
|
+
key: z.ZodOptional<z.ZodGUID>;
|
|
51
|
+
model: z.ZodOptional<z.ZodString>;
|
|
52
|
+
surface: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
chat: "chat";
|
|
54
|
+
embeddings: "embeddings";
|
|
55
|
+
image: "image";
|
|
56
|
+
video: "video";
|
|
57
|
+
messages: "messages";
|
|
58
|
+
responses: "responses";
|
|
59
|
+
}>>;
|
|
60
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
ok: "ok";
|
|
62
|
+
error: "error";
|
|
63
|
+
cancelled: "cancelled";
|
|
64
|
+
rejected: "rejected";
|
|
65
|
+
}>>;
|
|
66
|
+
error_code: z.ZodOptional<z.ZodString>;
|
|
67
|
+
client_request_id: z.ZodOptional<z.ZodString>;
|
|
68
|
+
from: z.ZodOptional<z.ZodISODateTime>;
|
|
69
|
+
to: z.ZodOptional<z.ZodISODateTime>;
|
|
70
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
71
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
max_pages: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
};
|
|
74
|
+
type ListArgs = z.infer<z.ZodObject<typeof requestsListInputSchema>>;
|
|
75
|
+
/** List the request log, following cursors up to max_pages. */
|
|
76
|
+
export declare function listRequestLog(args: ListArgs, config: Configuration): Promise<Record<string, unknown>>;
|
|
77
|
+
export declare const requestReadTools: import("../types.js").ToolDefinition[];
|
|
78
|
+
export {};
|