@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.
Files changed (49) hide show
  1. package/README.md +41 -14
  2. package/dist/auth.d.ts +6 -0
  3. package/dist/auth.js +16 -0
  4. package/dist/auth.js.map +1 -1
  5. package/dist/guardrail/estimate.d.ts +23 -2
  6. package/dist/guardrail/estimate.js +54 -12
  7. package/dist/guardrail/estimate.js.map +1 -1
  8. package/dist/roster.d.ts +3 -3
  9. package/dist/roster.js +71 -0
  10. package/dist/roster.js.map +1 -1
  11. package/dist/tools/api-json.d.ts +5 -0
  12. package/dist/tools/api-json.js +15 -0
  13. package/dist/tools/api-json.js.map +1 -0
  14. package/dist/tools/readonly/alerts.d.ts +26 -0
  15. package/dist/tools/readonly/alerts.js +58 -0
  16. package/dist/tools/readonly/alerts.js.map +1 -0
  17. package/dist/tools/readonly/define.d.ts +12 -1
  18. package/dist/tools/readonly/define.js +17 -3
  19. package/dist/tools/readonly/define.js.map +1 -1
  20. package/dist/tools/readonly/index.d.ts +3 -1
  21. package/dist/tools/readonly/index.js +90 -23
  22. package/dist/tools/readonly/index.js.map +1 -1
  23. package/dist/tools/readonly/requests.d.ts +78 -0
  24. package/dist/tools/readonly/requests.js +195 -0
  25. package/dist/tools/readonly/requests.js.map +1 -0
  26. package/dist/tools/readonly/usage.js +48 -11
  27. package/dist/tools/readonly/usage.js.map +1 -1
  28. package/dist/tools/readonly/video-reads.js +7 -4
  29. package/dist/tools/readonly/video-reads.js.map +1 -1
  30. package/dist/tools/spend/define.js +3 -1
  31. package/dist/tools/spend/define.js.map +1 -1
  32. package/dist/tools/spend/index.d.ts +2 -0
  33. package/dist/tools/spend/index.js +181 -30
  34. package/dist/tools/spend/index.js.map +1 -1
  35. package/dist/tools/spend/media.js +7 -5
  36. package/dist/tools/spend/media.js.map +1 -1
  37. package/dist/tools/spend/pricing.js +4 -0
  38. package/dist/tools/spend/pricing.js.map +1 -1
  39. package/dist/tools/write/alerts.d.ts +4 -0
  40. package/dist/tools/write/alerts.js +141 -0
  41. package/dist/tools/write/alerts.js.map +1 -0
  42. package/dist/tools/write/index.d.ts +2 -1
  43. package/dist/tools/write/index.js +10 -3
  44. package/dist/tools/write/index.js.map +1 -1
  45. package/dist/tools/write/payment-links.js +26 -4
  46. package/dist/tools/write/payment-links.js.map +1 -1
  47. package/dist/tools/write/spending-limit.js +26 -33
  48. package/dist/tools/write/spending-limit.js.map +1 -1
  49. package/package.json +2 -2
package/README.md CHANGED
@@ -4,10 +4,11 @@ This server connects Claude Code, Claude Desktop, Cursor, or any other
4
4
  [MCP](https://modelcontextprotocol.io) client straight to the deeprelay
5
5
  serverless inference API. The agent can browse models and their prices, run
6
6
  chat, embeddings, image and video generation inside a budget you approve, read
7
- your balance and usage, manage webhook endpoints, lower or clear your spending
8
- limit, and create checkout or billing links, all without leaving the editor.
7
+ your balance, usage and request log, manage webhook endpoints, lower or clear
8
+ your spending limit, change alert settings, and create checkout or billing
9
+ links, all without leaving the editor.
9
10
 
10
- **29 tools in three tiers: reads are free, writes confirm once, money tools
11
+ **33 tools in three tiers: reads are free, writes confirm once, money tools
11
12
  quote a price and require explicit confirmation.** The server enforces these
12
13
  rules, so they do not depend on the agent behaving well.
13
14
 
@@ -89,7 +90,7 @@ clear error on the first tool call. The key is never echoed in a result, an
89
90
  error or a confirmation prompt.
90
91
 
91
92
  **Use a dedicated key** for agent work, so you can revoke it on its own and see
92
- its usage separately. A `read_only` key covers all 17 free tools and cannot
93
+ its usage separately. A `read_only` key covers all 20 free tools and cannot
93
94
  write or spend. Checkout, the billing portal and spending-limit changes also
94
95
  need the org-admin role. **No key scope limits how much a key can spend.** Your
95
96
  organization's spending limit and the session budget below do.
@@ -98,8 +99,8 @@ organization's spending limit and the session budget below do.
98
99
 
99
100
  | Tier | Tools | What happens before it runs |
100
101
  | --- | --- | --- |
101
- | Free, read-only | 17 | Nothing. No confirmation, no charge, no change. |
102
- | Writes: single confirmation | 8 | One confirmation. The first call describes the change and returns a `confirmation_token`. The second call, with the same arguments plus the token, runs it. |
102
+ | Free, read-only | 20 | Nothing. No confirmation, no charge, no change. |
103
+ | Writes: single confirmation | 9 | One confirmation. The first call describes the change and returns a `confirmation_token`. The second call, with the same arguments plus the token, runs it. |
103
104
  | Money tools | 4 | A price. Priced from the catalog, then checked against the per-call ceiling and the session budget. |
104
105
 
105
106
  Tokens are single-use, expire after five minutes, and are bound to the exact
@@ -124,8 +125,9 @@ one server process.
124
125
  Estimates are reserved before each call and replaced by the actual cost
125
126
  afterwards. A failed call releases its reservation.
126
127
 
127
- **Video is quoted as a floor, not a cap.** `deeprelay_videos_create` reserves
128
- the floor price. When `deeprelay_videos_get` or `deeprelay_videos_list` sees the
128
+ **Video is quoted as a floor, not a cap.** `deeprelay_videos_create` prices the
129
+ clip the way the platform bills it, per second of the requested `seconds` (the
130
+ model's default length when omitted), and reserves that floor. When `deeprelay_videos_get` or `deeprelay_videos_list` sees the
129
131
  job completed, the reservation settles at the actual `cost_cents`. Failed,
130
132
  cancelled or expired jobs are not billed. If the server exits before the job
131
133
  finishes, the reservation is dropped and the real charge appears in
@@ -149,26 +151,30 @@ finishes, the reservation is dropped and the real charge appears in
149
151
  - `deeprelay_subscription_checkout`, `deeprelay_billing_portal` and
150
152
  `deeprelay_deposits_create_crypto` **only create links** (or a deposit
151
153
  address). They never charge. Nothing is paid until you complete the step
152
- yourself.
154
+ yourself. For the same reason there is **no upgrade tool**: moving to the
155
+ Plus plan charges the card on file immediately, so it happens only from the
156
+ billing page or `deeprelay billing upgrade`, never from inside a tool call.
153
157
  - `deeprelay_deposits_create_crypto` is listed only on accounts with crypto
154
158
  deposits enabled. It stays hidden at startup and appears once the account is
155
159
  shown to have the feature.
156
160
 
157
161
  ## Tools
158
162
 
159
- **Free, read-only (17):** `deeprelay_auth_status`, `deeprelay_health`,
163
+ **Free, read-only (20):** `deeprelay_auth_status`, `deeprelay_health`,
160
164
  `deeprelay_models_list`, `deeprelay_models_get`,
161
165
  `deeprelay_inference_preflight`, `deeprelay_usage_get`,
162
166
  `deeprelay_balance_get`, `deeprelay_spending_limit_get`,
163
167
  `deeprelay_subscription_get`, `deeprelay_deposits_list`,
164
168
  `deeprelay_deposits_get`, `deeprelay_referrals_get`,
165
169
  `deeprelay_webhooks_list`, `deeprelay_webhooks_get`, `deeprelay_videos_list`,
166
- `deeprelay_videos_get`, `deeprelay_videos_content`.
170
+ `deeprelay_videos_get`, `deeprelay_videos_content`,
171
+ `deeprelay_requests_list`, `deeprelay_requests_get`, `deeprelay_alerts_get`.
167
172
 
168
- **Writes: single confirmation (8):** `deeprelay_webhooks_create`,
173
+ **Writes: single confirmation (9):** `deeprelay_webhooks_create`,
169
174
  `deeprelay_webhooks_delete`, `deeprelay_spending_limit_update`,
170
175
  `deeprelay_spending_limit_clear`, `deeprelay_subscription_checkout`, `deeprelay_billing_portal`,
171
- `deeprelay_deposits_create_crypto`, `deeprelay_videos_cancel`.
176
+ `deeprelay_deposits_create_crypto`, `deeprelay_videos_cancel`,
177
+ `deeprelay_alerts_set`.
172
178
 
173
179
  **Money (4):** `deeprelay_chat_completion`, `deeprelay_embeddings_create`,
174
180
  `deeprelay_images_generate`, `deeprelay_videos_create`.
@@ -179,9 +185,30 @@ even when the key is wrong or revoked; the server itself still needs
179
185
  inference usage: optional `modality` (`chat`, `image`, `video`, `embedding`),
180
186
  `model`, `bucket`, `start` and `end`; with no `modality` or `model` it covers
181
187
  all four modalities and returns `total_cost_cents` plus per-modality subtotals.
188
+ It follows pages itself and never counts a row twice; `truncated: true` means
189
+ the totals cover only the rows returned, so narrow `start`/`end`.
182
190
  `deeprelay_videos_content` saves the MP4
183
191
  to a local file (under the system temp directory by default, or an absolute
184
- `output_path`) instead of returning it inline.
192
+ `output_path`) instead of returning it inline. Because it writes a file it
193
+ advertises `readOnlyHint: false` and `idempotentHint: false`; it still costs
194
+ nothing and needs no confirmation.
195
+
196
+ Results use the API's own snake_case field names. `deeprelay_models_list` and
197
+ `deeprelay_models_get` return each model exactly as the API does, including
198
+ `name`, `tier`, `max_completion_tokens`, `reasoning_efforts` and the observed
199
+ `metrics` (median time to first token, tokens per second, success rate).
200
+
201
+ `deeprelay_chat_completion` takes `model`, `messages` and optional
202
+ `max_tokens` (or `max_completion_tokens`), `temperature`, `tools`,
203
+ `tool_choice`, `parallel_tool_calls`, `response_format` (JSON mode or a strict
204
+ JSON schema), `reasoning_effort` and `seed`. A reply that calls tools comes back
205
+ with `finish_reason: "tool_calls"`, `message.tool_calls` and `content: null`;
206
+ send the assistant message back with one `tool` message per call
207
+ (`tool_call_id` plus `content`) to continue. Tool definitions count toward the
208
+ quoted price. `deeprelay_requests_list` / `deeprelay_requests_get` read the
209
+ request log (90 days, never prompt or completion content), and
210
+ `deeprelay_alerts_get` / `deeprelay_alerts_set` read and change the alert
211
+ settings.
185
212
 
186
213
  Per-tool arguments and the full guide are at <https://deeprelay.ai/docs/mcp>.
187
214
 
package/dist/auth.d.ts CHANGED
@@ -28,6 +28,12 @@ export declare function requireApiKey(env?: Env): string;
28
28
  * never produce `//`.
29
29
  */
30
30
  export declare function resolveBaseUrl(env?: Env): string;
31
+ /**
32
+ * The API base as it may be shown to the agent: resolveBaseUrl with any
33
+ * userinfo (`user:pass@`) removed (WR-07). A proxy basic-auth base must never
34
+ * land in a transcript; errors.ts strips it from messages the same way.
35
+ */
36
+ export declare function displayBaseUrl(env?: Env): string;
31
37
  /**
32
38
  * Build the single SDK Configuration every tool uses.
33
39
  *
package/dist/auth.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StartupConfigError = exports.PROD_API_BASE = exports.API_BASE_ENV = exports.API_KEY_ENV = void 0;
4
4
  exports.requireApiKey = requireApiKey;
5
5
  exports.resolveBaseUrl = resolveBaseUrl;
6
+ exports.displayBaseUrl = displayBaseUrl;
6
7
  exports.buildConfiguration = buildConfiguration;
7
8
  exports.describeStartupError = describeStartupError;
8
9
  // Startup configuration and the one API-client construction site
@@ -87,6 +88,21 @@ function resolveBaseUrl(env = process.env) {
87
88
  }
88
89
  return raw.replace(/\/+$/, "");
89
90
  }
91
+ /**
92
+ * The API base as it may be shown to the agent: resolveBaseUrl with any
93
+ * userinfo (`user:pass@`) removed (WR-07). A proxy basic-auth base must never
94
+ * land in a transcript; errors.ts strips it from messages the same way.
95
+ */
96
+ function displayBaseUrl(env = process.env) {
97
+ const base = resolveBaseUrl(env);
98
+ const url = new URL(base);
99
+ if (url.username === "" && url.password === "") {
100
+ return base;
101
+ }
102
+ url.username = "";
103
+ url.password = "";
104
+ return url.toString().replace(/\/+$/, "");
105
+ }
90
106
  /**
91
107
  * Build the single SDK Configuration every tool uses.
92
108
  *
package/dist/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;AAgEA,sCAMC;AASD,wCAmBC;AASD,gDAQC;AAqBD,oDAUC;AAlJD,iEAAiE;AACjE,yEAAyE;AACzE,EAAE;AACF,+BAA+B;AAC/B,EAAE;AACF,4EAA4E;AAC5E,uEAAuE;AACvE,yEAAyE;AACzE,+EAA+E;AAC/E,8CAA8C;AAC9C,0EAA0E;AAC1E,6EAA6E;AAC7E,kDAAkD;AAClD,yEAAyE;AACzE,6EAA6E;AAC7E,iCAAiC;AACjC,gFAAgF;AAChF,mEAAmE;AACnE,+EAA+E;AAC/E,sDAAsD;AACtD,uEAAuE;AACvE,wCAA+C;AAE/C,2CAA4C;AAE5C,6CAA2C;AAI3C,6CAA6C;AAChC,QAAA,WAAW,GAAG,mBAAmB,CAAC;AAE/C,+DAA+D;AAClD,QAAA,YAAY,GAAG,oBAAoB,CAAC;AAEjD,gEAAgE;AACnD,QAAA,aAAa,GAAG,6BAA6B,CAAC;AAE3D,gEAAgE;AAChE,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,wDAAwD;IAC/C,MAAM,CAAS;IAExB,YAAY,O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AC,CAAC,GAAG,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,GAAY,EAAE,MAAW,OAAO,CAAC,GAAG;IACvE,IAAI,GAAG,YAAY,kBAAkB,EAAE,CAAC;QACtC,OAAO,IAAA,yBAAa,EAAC,kBAAkB,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,IAAA,yBAAa,EAClB,mCAAmC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI;QACxE,aAAa,mBAAW,QAAQ,oBAAY,6CAA6C,EAC3F,GAAG,CACJ,CAAC;AACJ,CAAC"}
@@ -12,13 +12,27 @@ export interface PricingLike {
12
12
  perMpxlMicrocents?: number;
13
13
  perVideoMicrocents?: number;
14
14
  perVideoSecondMicrocents?: number;
15
+ /**
16
+ * Not a rate: the model's default clip length from its catalog `seconds`
17
+ * parameter descriptor. The server bills an omitted `seconds` at this value.
18
+ */
19
+ defaultVideoSeconds?: number;
15
20
  }
16
21
  /** Agent-supplied request parameters that the estimate depends on. */
17
22
  export interface EstimateParams {
18
- /** Chat: messages. Content may be a string or an array of `{ text }` parts. */
23
+ /**
24
+ * Chat: messages. Content may be a string, null, or an array of `{ text }`
25
+ * parts; an assistant message's tool_calls count as prompt text too.
26
+ */
19
27
  messages?: ReadonlyArray<{
20
28
  content?: unknown;
29
+ tool_calls?: unknown;
21
30
  } | string>;
31
+ /**
32
+ * Chat: request parts the model reads as prompt besides the messages (tool
33
+ * definitions, a response_format JSON schema). Counted by their JSON length.
34
+ */
35
+ promptExtras?: ReadonlyArray<unknown>;
22
36
  /** Chat: the completion bound. Defaults to DEFAULT_MAX_TOKENS. */
23
37
  maxTokens?: number;
24
38
  /** Embeddings: input string(s). */
@@ -27,7 +41,7 @@ export interface EstimateParams {
27
41
  n?: number;
28
42
  /** Image: "WxH". Defaults to 1024x1024. */
29
43
  size?: string;
30
- /** Video: clip length in seconds. Defaults to 5. */
44
+ /** Video: clip length in seconds. Defaults to the model's catalog default, then 5. */
31
45
  seconds?: number;
32
46
  }
33
47
  export interface Estimate {
@@ -46,6 +60,11 @@ export declare const DEFAULT_VIDEO_SECONDS = 5;
46
60
  export declare function estimatePromptTokens(texts: ReadonlyArray<string>): number;
47
61
  /** Megapixels for a "WxH" size. Anything unparseable uses the default size. */
48
62
  export declare function megapixels(size: string | undefined): number;
63
+ /**
64
+ * The clip length the server will bill: the requested seconds, else the
65
+ * model's catalog default, else DEFAULT_VIDEO_SECONDS.
66
+ */
67
+ export declare function videoSeconds(requested: number | undefined, pricing: PricingLike): number;
49
68
  /** Estimate one invocation's billed cost before it runs. */
50
69
  export declare function estimateMicroCents(modality: Modality, params: EstimateParams, pricing: PricingLike): Estimate;
51
70
  /** Usage fields the API returns, per modality (camelCase SDK shapes). */
@@ -58,6 +77,8 @@ export interface UsageLike {
58
77
  imageCount?: number;
59
78
  /** Video (VideoJob, populated on completed). */
60
79
  costCents?: number;
80
+ /** Video: the clip length the job reports, used when costCents is absent. */
81
+ seconds?: number;
61
82
  }
62
83
  /**
63
84
  * The billed actual cost of one completed invocation, from the API's usage
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_VIDEO_SECONDS = exports.DEFAULT_IMAGE_SIZE = exports.DEFAULT_MAX_TOKENS = exports.CHARS_PER_TOKEN = void 0;
4
4
  exports.estimatePromptTokens = estimatePromptTokens;
5
5
  exports.megapixels = megapixels;
6
+ exports.videoSeconds = videoSeconds;
6
7
  exports.estimateMicroCents = estimateMicroCents;
7
8
  exports.actualMicroCents = actualMicroCents;
8
9
  // Per-modality cost estimator for the unified session budget (Phase 104 D-06).
@@ -19,8 +20,14 @@ exports.actualMicroCents = actualMicroCents;
19
20
  // Inputs from the agent (messages, n, size, seconds, max_tokens) are untrusted.
20
21
  // Non-finite or non-positive counts fall back to the defaults. For chat the
21
22
  // estimate is bounded by max_tokens. For video it is a FLOOR (isFloor: true),
22
- // because the catalog publishes a "from" price and the real cost arrives later
23
- // on VideoJob.costCents.
23
+ // because the real cost arrives later on VideoJob.costCents.
24
+ //
25
+ // Video is priced the way the server bills it (CR-01): per second of output x
26
+ // the requested seconds, where an omitted `seconds` resolves to the model's own
27
+ // catalog default (its `seconds` parameter descriptor), then DEFAULT_VIDEO_SECONDS.
28
+ // The per-clip price is only a representative "from" price for an example clip
29
+ // length, so it never stands in for a known per-second rate; when both are
30
+ // published the estimate is the larger of the two.
24
31
  const budget_js_1 = require("./budget.js");
25
32
  exports.CHARS_PER_TOKEN = 4;
26
33
  exports.DEFAULT_MAX_TOKENS = 1024;
@@ -62,10 +69,20 @@ function textOf(content) {
62
69
  }
63
70
  return "";
64
71
  }
72
+ function jsonText(v) {
73
+ if (v === undefined || v === null)
74
+ return "";
75
+ try {
76
+ return JSON.stringify(v) ?? "";
77
+ }
78
+ catch {
79
+ return "";
80
+ }
81
+ }
65
82
  function messageTexts(messages) {
66
83
  if (!messages)
67
84
  return [];
68
- return messages.map((m) => (typeof m === "string" ? m : textOf(m?.content)));
85
+ return messages.map((m) => typeof m === "string" ? m : textOf(m?.content) + (m?.tool_calls === undefined ? "" : jsonText(m.tool_calls)));
69
86
  }
70
87
  function inputTexts(input) {
71
88
  if (input === undefined)
@@ -94,11 +111,33 @@ function imageRaw(count, size, pricing) {
94
111
  return count * per;
95
112
  return count * rate(pricing.perMpxlMicrocents) * megapixels(size);
96
113
  }
114
+ /**
115
+ * The clip length the server will bill: the requested seconds, else the
116
+ * model's catalog default, else DEFAULT_VIDEO_SECONDS.
117
+ */
118
+ function videoSeconds(requested, pricing) {
119
+ return positiveCount(requested, positiveCount(pricing.defaultVideoSeconds, exports.DEFAULT_VIDEO_SECONDS));
120
+ }
121
+ /**
122
+ * Raw micro-cents for one clip, priced exactly the way the server bills it:
123
+ * per-second rate x seconds (internal/mediajob/poller.go costCents). The
124
+ * per-clip "from" price is only a representative figure for an example
125
+ * length and is never charged, so it is used solely as a fallback when a
126
+ * model publishes no per-second rate.
127
+ */
128
+ function videoRaw(seconds, pricing) {
129
+ return known(pricing.perVideoSecondMicrocents)
130
+ ? rate(pricing.perVideoSecondMicrocents) * seconds
131
+ : rate(pricing.perVideoMicrocents);
132
+ }
97
133
  /** Estimate one invocation's billed cost before it runs. */
98
134
  function estimateMicroCents(modality, params, pricing) {
99
135
  switch (modality) {
100
136
  case "chat": {
101
- const promptTokens = estimatePromptTokens(messageTexts(params.messages));
137
+ const promptTokens = estimatePromptTokens([
138
+ ...messageTexts(params.messages),
139
+ ...(params.promptExtras ?? []).map(jsonText),
140
+ ]);
102
141
  const maxTokens = positiveCount(params.maxTokens, exports.DEFAULT_MAX_TOKENS);
103
142
  return {
104
143
  microCents: (0, budget_js_1.billedMicroCents)(tokenMicroCents(promptTokens, pricing.inputPer1mTokensCents) +
@@ -124,12 +163,8 @@ function estimateMicroCents(modality, params, pricing) {
124
163
  };
125
164
  }
126
165
  case "video": {
127
- const seconds = positiveCount(params.seconds, exports.DEFAULT_VIDEO_SECONDS);
128
- const raw = known(pricing.perVideoMicrocents)
129
- ? rate(pricing.perVideoMicrocents)
130
- : rate(pricing.perVideoSecondMicrocents) * seconds;
131
166
  return {
132
- microCents: (0, budget_js_1.billedMicroCents)(raw),
167
+ microCents: (0, budget_js_1.billedMicroCents)(videoRaw(videoSeconds(params.seconds, pricing), pricing)),
133
168
  isFloor: true,
134
169
  pricingKnown: known(pricing.perVideoMicrocents) || known(pricing.perVideoSecondMicrocents),
135
170
  };
@@ -163,9 +198,16 @@ function actualMicroCents(modality, usage, pricing, fallbackEstimateMicroCents,
163
198
  return fallback;
164
199
  return (0, budget_js_1.billedMicroCents)(imageRaw(usage.imageCount, params?.size, pricing));
165
200
  case "video":
166
- if (!num(usage.costCents))
167
- return fallback;
168
- return (0, budget_js_1.billedMicroCents)(usage.costCents * budget_js_1.MICRO_CENTS_PER_CENT);
201
+ if (num(usage.costCents))
202
+ return (0, budget_js_1.billedMicroCents)(usage.costCents * budget_js_1.MICRO_CENTS_PER_CENT);
203
+ // No cost on the job: price it on the same basis as the estimate, at the
204
+ // job's own seconds when it reports them.
205
+ if (num(usage.seconds) && usage.seconds > 0) {
206
+ const raw = videoRaw(videoSeconds(usage.seconds, pricing), pricing);
207
+ if (raw > 0)
208
+ return (0, budget_js_1.billedMicroCents)(raw);
209
+ }
210
+ return fallback;
169
211
  }
170
212
  }
171
213
  //# sourceMappingURL=estimate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"estimate.js","sourceRoot":"","sources":["../../src/guardrail/estimate.ts"],"names":[],"mappings":";;;AAoFA,oDAOC;AA2BD,gCAMC;AAeD,gDA0CC;AAuBD,4CA0BC;AAtOD,+EAA+E;AAC/E,yBAAyB;AACzB,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,iFAAiF;AACjF,kBAAkB;AAClB,EAAE;AACF,gFAAgF;AAChF,iCAAiC;AACjC,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,yBAAyB;AACzB,2CAAqE;AA2CxD,QAAA,eAAe,GAAG,CAAC,CAAC;AACpB,QAAA,kBAAkB,GAAG,IAAI,CAAC;AAC1B,QAAA,kBAAkB,GAAG,WAAW,CAAC;AACjC,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAEvC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAEvC,SAAS,IAAI,CAAC,CAAqB;IACjC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACt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AAgB,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAC1E,CAAC;QACJ,KAAK,YAAY;YACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC;gBAAE,OAAO,QAAQ,CAAC;YAC9C,OAAO,IAAA,4BAAgB,EAAC,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC9F,KAAK,OAAO;YACV,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;gBAAE,OAAO,QAAQ,CAAC;YAC5C,OAAO,IAAA,4BAAgB,EAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7E,KAAK,OAAO;YACV,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;gBAAE,OAAO,IAAA,4BAAgB,EAAC,KAAK,CAAC,SAAS,GAAG,gCAAoB,CAAC,CAAC;YAC1F,yEAAyE;YACzE,0CAA0C;YAC1C,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;gBAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;gBACpE,IAAI,GAAG,GAAG,CAAC;oBAAE,OAAO,IAAA,4BAAgB,EAAC,GAAG,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC"}
package/dist/roster.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  export declare const TOOL_PREFIX = "deeprelay_";
2
2
  /** Free, non-mutating reads. No confirmation. Every route is a GET. */
3
- export declare const READ_TOOLS: readonly ["deeprelay_auth_status", "deeprelay_health", "deeprelay_models_list", "deeprelay_models_get", "deeprelay_inference_preflight", "deeprelay_usage_get", "deeprelay_balance_get", "deeprelay_spending_limit_get", "deeprelay_subscription_get", "deeprelay_deposits_list", "deeprelay_deposits_get", "deeprelay_referrals_get", "deeprelay_webhooks_list", "deeprelay_webhooks_get", "deeprelay_videos_list", "deeprelay_videos_get", "deeprelay_videos_content"];
3
+ export declare const READ_TOOLS: readonly ["deeprelay_auth_status", "deeprelay_health", "deeprelay_models_list", "deeprelay_models_get", "deeprelay_inference_preflight", "deeprelay_usage_get", "deeprelay_balance_get", "deeprelay_spending_limit_get", "deeprelay_subscription_get", "deeprelay_deposits_list", "deeprelay_deposits_get", "deeprelay_referrals_get", "deeprelay_webhooks_list", "deeprelay_webhooks_get", "deeprelay_videos_list", "deeprelay_videos_get", "deeprelay_videos_content", "deeprelay_requests_list", "deeprelay_requests_get", "deeprelay_alerts_get"];
4
4
  /**
5
5
  * Mutations that do not charge the account directly. Each one asks for
6
6
  * confirmation once. Payment-link tools are here with no quote (D-09), because
7
7
  * nothing is charged until the user acts on the link.
8
8
  */
9
- export declare const WRITE_TOOLS: readonly ["deeprelay_webhooks_create", "deeprelay_webhooks_delete", "deeprelay_spending_limit_update", "deeprelay_spending_limit_clear", "deeprelay_subscription_checkout", "deeprelay_billing_portal", "deeprelay_deposits_create_crypto", "deeprelay_videos_cancel"];
9
+ export declare const WRITE_TOOLS: readonly ["deeprelay_webhooks_create", "deeprelay_webhooks_delete", "deeprelay_spending_limit_update", "deeprelay_spending_limit_clear", "deeprelay_subscription_checkout", "deeprelay_billing_portal", "deeprelay_deposits_create_crypto", "deeprelay_videos_cancel", "deeprelay_alerts_set"];
10
10
  /** Billable inference. Each call goes quote → session budget → confirm (D-06..D-08, D-10). */
11
11
  export declare const SPEND_TOOLS: readonly ["deeprelay_chat_completion", "deeprelay_embeddings_create", "deeprelay_images_generate", "deeprelay_videos_create"];
12
- export declare const ALL_TOOLS: readonly ["deeprelay_auth_status", "deeprelay_health", "deeprelay_models_list", "deeprelay_models_get", "deeprelay_inference_preflight", "deeprelay_usage_get", "deeprelay_balance_get", "deeprelay_spending_limit_get", "deeprelay_subscription_get", "deeprelay_deposits_list", "deeprelay_deposits_get", "deeprelay_referrals_get", "deeprelay_webhooks_list", "deeprelay_webhooks_get", "deeprelay_videos_list", "deeprelay_videos_get", "deeprelay_videos_content", "deeprelay_webhooks_create", "deeprelay_webhooks_delete", "deeprelay_spending_limit_update", "deeprelay_spending_limit_clear", "deeprelay_subscription_checkout", "deeprelay_billing_portal", "deeprelay_deposits_create_crypto", "deeprelay_videos_cancel", "deeprelay_chat_completion", "deeprelay_embeddings_create", "deeprelay_images_generate", "deeprelay_videos_create"];
12
+ export declare const ALL_TOOLS: readonly ["deeprelay_auth_status", "deeprelay_health", "deeprelay_models_list", "deeprelay_models_get", "deeprelay_inference_preflight", "deeprelay_usage_get", "deeprelay_balance_get", "deeprelay_spending_limit_get", "deeprelay_subscription_get", "deeprelay_deposits_list", "deeprelay_deposits_get", "deeprelay_referrals_get", "deeprelay_webhooks_list", "deeprelay_webhooks_get", "deeprelay_videos_list", "deeprelay_videos_get", "deeprelay_videos_content", "deeprelay_requests_list", "deeprelay_requests_get", "deeprelay_alerts_get", "deeprelay_webhooks_create", "deeprelay_webhooks_delete", "deeprelay_spending_limit_update", "deeprelay_spending_limit_clear", "deeprelay_subscription_checkout", "deeprelay_billing_portal", "deeprelay_deposits_create_crypto", "deeprelay_videos_cancel", "deeprelay_alerts_set", "deeprelay_chat_completion", "deeprelay_embeddings_create", "deeprelay_images_generate", "deeprelay_videos_create"];
13
13
  export type ReadToolName = (typeof READ_TOOLS)[number];
14
14
  export type WriteToolName = (typeof WRITE_TOOLS)[number];
15
15
  export type SpendToolName = (typeof SPEND_TOOLS)[number];
package/dist/roster.js CHANGED
@@ -29,6 +29,11 @@
29
29
  // @deeprelay/sdk@0.2.0, exposes BillingApi.deleteSpendingLimit
30
30
  // (DELETE /billing/spending-limit). It is a WRITE because it removes a safety
31
31
  // cap: it confirms once, and requires the org-admin role server-side.
32
+ // Phase 111 (R-08, D-15) adds tools 30-33: deeprelay_requests_list,
33
+ // deeprelay_requests_get and deeprelay_alerts_get (READ) and
34
+ // deeprelay_alerts_set (WRITE, confirms once, org-admin server-side), served
35
+ // by @deeprelay/sdk RequestsApi / AlertsApi since the 0.3.0 pin.
36
+ // /api-keys* is excluded on purpose.
32
37
  Object.defineProperty(exports, "__esModule", { value: true });
33
38
  exports.EXCLUDED_PATHS = exports.TOOL_ROUTES = exports.ALL_TOOLS = exports.SPEND_TOOLS = exports.WRITE_TOOLS = exports.READ_TOOLS = exports.TOOL_PREFIX = void 0;
34
39
  exports.TOOL_PREFIX = "deeprelay_";
@@ -51,6 +56,10 @@ exports.READ_TOOLS = [
51
56
  "deeprelay_videos_list",
52
57
  "deeprelay_videos_get",
53
58
  "deeprelay_videos_content",
59
+ // Phase 111 (R-08): the request log and the alert settings.
60
+ "deeprelay_requests_list",
61
+ "deeprelay_requests_get",
62
+ "deeprelay_alerts_get",
54
63
  ];
55
64
  /**
56
65
  * Mutations that do not charge the account directly. Each one asks for
@@ -66,6 +75,7 @@ exports.WRITE_TOOLS = [
66
75
  "deeprelay_billing_portal",
67
76
  "deeprelay_deposits_create_crypto",
68
77
  "deeprelay_videos_cancel",
78
+ "deeprelay_alerts_set",
69
79
  ];
70
80
  /** Billable inference. Each call goes quote → session budget → confirm (D-06..D-08, D-10). */
71
81
  exports.SPEND_TOOLS = [
@@ -99,6 +109,9 @@ exports.TOOL_ROUTES = {
99
109
  deeprelay_videos_list: { method: "GET", path: "/videos" },
100
110
  deeprelay_videos_get: { method: "GET", path: "/videos/{id}" },
101
111
  deeprelay_videos_content: { method: "GET", path: "/videos/{id}/content" },
112
+ deeprelay_requests_list: { method: "GET", path: "/requests" },
113
+ deeprelay_requests_get: { method: "GET", path: "/requests/{id}" },
114
+ deeprelay_alerts_get: { method: "GET", path: "/alerts/settings" },
102
115
  // WRITE
103
116
  deeprelay_webhooks_create: { method: "POST", path: "/webhook-endpoints" },
104
117
  deeprelay_webhooks_delete: { method: "DELETE", path: "/webhook-endpoints/{id}" },
@@ -108,6 +121,7 @@ exports.TOOL_ROUTES = {
108
121
  deeprelay_billing_portal: { method: "POST", path: "/billing/subscription/portal" },
109
122
  deeprelay_deposits_create_crypto: { method: "POST", path: "/billing/deposits/crypto" },
110
123
  deeprelay_videos_cancel: { method: "POST", path: "/videos/{id}/cancel" },
124
+ deeprelay_alerts_set: { method: "PUT", path: "/alerts/settings" },
111
125
  // SPEND
112
126
  deeprelay_chat_completion: { method: "POST", path: "/chat/completions" },
113
127
  deeprelay_embeddings_create: { method: "POST", path: "/embeddings" },
@@ -121,6 +135,63 @@ exports.TOOL_ROUTES = {
121
135
  */
122
136
  exports.EXCLUDED_PATHS = {
123
137
  "/openapi.json": "spec download, not an agent capability (D-05)",
138
+ // Phase 105: the Anthropic Messages protocol for Claude Code and Anthropic
139
+ // SDK clients. chat_completion already covers inference for an agent; these
140
+ // are a wire-protocol twin, not a new capability.
141
+ "/messages": "Anthropic Messages protocol twin of chat completions, for Claude Code and Anthropic SDK clients (Phase 105)",
142
+ "/messages/count_tokens": "local, unbilled token estimate for Anthropic Messages clients (Phase 105)",
143
+ // Phase 106: the OpenAI Responses protocol for the Codex CLI. Same reasoning
144
+ // as /messages: a wire-protocol twin of chat completions, not a new agent
145
+ // capability. The four sub-routes and /responses/compact only ever return a
146
+ // documented stateless/compaction error.
147
+ "/responses": "OpenAI Responses protocol twin of chat completions, for the Codex CLI (Phase 106)",
148
+ "/responses/{id}": "stateless: always 404 `stateless`, deeprelay stores no responses (Phase 106)",
149
+ "/responses/{id}/cancel": "stateless: always 404 `stateless`, deeprelay stores no responses (Phase 106)",
150
+ "/responses/{id}/input_items": "stateless: always 404 `stateless`, deeprelay stores no responses (Phase 106)",
151
+ "/responses/compact": "always 400 `compaction_unsupported`; Codex compacts client-side (Phase 106)",
152
+ // Plus tier (2026-10-07): the upgrade endpoint CHARGES THE CARD ON FILE
153
+ // directly (full new price now, new period now). The MCP's payment surface
154
+ // is link-only (D-09): checkout and the portal mint a page the human
155
+ // completes, and nothing is paid from inside a tool call. An agent that
156
+ // wants a bigger plan sends the human to the billing page or
157
+ // `deeprelay billing upgrade`.
158
+ "/billing/subscription/upgrade": "charges the card on file directly; the MCP payment surface is link-only (D-09) — upgrade from the console or `deeprelay billing upgrade`",
159
+ // Payment methods and in-app plan management (dark-launched on demo):
160
+ // payment instruments and money/plan actions stay out of agent reach, like
161
+ // upgrade (D-09). Console Billing → Payment methods, or the CLI.
162
+ "/billing/payment-methods": "lists the org's payment instruments; admin-only and out of agent reach (D-09) — console or `deeprelay billing payment-methods`",
163
+ "/billing/payment-methods/setup": "adds a payment method; the MCP payment surface is link-only (D-09) — console or `deeprelay billing payment-methods add`",
164
+ "/billing/payment-methods/default": "changes which method auto-pay charges (D-09) — console or `deeprelay billing payment-methods set --auto-pay`",
165
+ "/billing/payment-methods/{id}": "removes a payment method and can cancel the plan (D-09) — console or `deeprelay billing payment-methods remove`",
166
+ "/billing/subscription/payment-method": "changes the plan's renewal method and retries a failed renewal, a charge (D-09) — console or `deeprelay billing payment-methods set --plan`",
167
+ "/billing/subscription/cancel": "cancels the plan (D-09) — console or `deeprelay billing cancel`",
168
+ "/billing/subscription/resume": "resumes a cancelling plan (D-09) — console or `deeprelay billing resume`",
169
+ // Phase 111 (R-08). The CSV export is a file download; an agent reads the
170
+ // same rows through deeprelay_requests_list. Key management stays out of
171
+ // agent reach entirely: an agent that can mint, widen or revoke keys is
172
+ // exactly what the keys:manage capability guards against.
173
+ "/requests/export": "file download; agents use deeprelay_requests_list (Phase 111)",
174
+ "/api-keys": "agent key management is what keys:manage guards against (R-08)",
175
+ "/api-keys/{id}": "agent key management is what keys:manage guards against (R-08)",
176
+ // Dedicated endpoints. These are marked `x-dark-launch: true` rather than
177
+ // `x-gpu-supply-paused`, and this audit's scanner only treats the latter as
178
+ // leaving its domain, so a dark path arrives here as an UNPAUSED path with
179
+ // no tool and has to be declined explicitly. That is the right shape: the
180
+ // routes exist only when DEDICATED_ENDPOINTS_ENABLED is on, which is
181
+ // nowhere, so a tool for them would be a tool whose every call 404s, and
182
+ // the replicas they provision are hourly GPU instances an agent must not be
183
+ // able to rent unattended. When the flag flips, whoever removes the marker
184
+ // meets these two entries and decides deliberately whether a tool is
185
+ // wanted, which is exactly what the mapped-or-excluded contract is for.
186
+ "/endpoints": "dark-launched (DEDICATED_ENDPOINTS_ENABLED is off everywhere); creating one rents hourly GPU replicas, which is not agent-unattended spend authority",
187
+ "/endpoints/{id}": "dark-launched (DEDICATED_ENDPOINTS_ENABLED is off everywhere); read, scale and delete follow the create exclusion above",
188
+ "/deployments": "dark-launched (the product is unpublished); creating one rents dedicated GPUs billed per second, which is not agent-unattended spend authority",
189
+ "/deployments/hardware": "dark-launched; the hardware list only feeds the create above",
190
+ "/deployments/{id}": "dark-launched; read, scale and delete follow the create exclusion above",
191
+ "/deployments/{id}/stop": "dark-launched; follows the create exclusion above",
192
+ "/deployments/{id}/start": "dark-launched; starting resumes paid GPUs, which follows the create exclusion above",
193
+ "/deployments/{id}/events": "dark-launched; follows the create exclusion above",
194
+ "/deployments/{id}/metrics": "dark-launched; follows the create exclusion above",
124
195
  // /operations/{id} was listed here while it was still an UNPAUSED path with
125
196
  // no tool. Phase 103 D-08 landed the x-gpu-supply-paused marker, so it is no
126
197
  // longer unpaused and an exclusion entry for it would now fail the audit's
@@ -1 +1 @@
1
- {"version":3,"file":"roster.js","sourceRoot":"","sources":["../src/roster.ts"],"names":[],"mappings":";AAAA,kEAAkE;AAClE,EAAE;AACF,2EAA2E;AAC3E,iFAAiF;AACjF,+EAA+E;AAC/E,uBAAuB;AACvB,EAAE;AACF,2BAA2B;AAC3B,gFAAgF;AAChF,6EAA6E;AAC7E,uBAAuB;AACvB,uEAAuE;AACvE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,sEAAsE;AACtE,mEAAmE;AACnE,kFAAkF;AAClF,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF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,mDAAmD;IAC/E,2BAA2B,EAAE,mDAAmD;IAChF,4EAA4E;IAC5E,6EAA6E;IAC7E,2EAA2E;IAC3E,4EAA4E;IAC5E,oEAAoE;CACrE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ApiResponse } from "@deeprelay/sdk";
2
+ /** Await a *Raw SDK call and decode its JSON body without the SDK's model mapping. */
3
+ export declare function apiJson(call: Promise<ApiResponse<unknown>>): Promise<unknown>;
4
+ /** apiJson for an endpoint that answers with a JSON object (for spreading into a view). */
5
+ export declare function apiObject(call: Promise<ApiResponse<unknown>>): Promise<Record<string, unknown>>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apiJson = apiJson;
4
+ exports.apiObject = apiObject;
5
+ /** Await a *Raw SDK call and decode its JSON body without the SDK's model mapping. */
6
+ async function apiJson(call) {
7
+ const response = await call;
8
+ return (await response.raw.json());
9
+ }
10
+ /** apiJson for an endpoint that answers with a JSON object (for spreading into a view). */
11
+ async function apiObject(call) {
12
+ const body = await apiJson(call);
13
+ return typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
14
+ }
15
+ //# sourceMappingURL=api-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-json.js","sourceRoot":"","sources":["../../src/tools/api-json.ts"],"names":[],"mappings":";;AAuBA,0BAGC;AAGD,8BAGC;AAVD,sFAAsF;AAC/E,KAAK,UAAU,OAAO,CAAC,IAAmC;IAC/D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC;IAC5B,OAAO,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAY,CAAC;AAChD,CAAC;AAED,2FAA2F;AACpF,KAAK,UAAU,SAAS,CAAC,IAAmC;IACjE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,IAAgC,CAAC,CAAC,CAAC,EAAE,CAAC;AACpH,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type Configuration } from "@deeprelay/sdk";
2
+ import { z } from "zod";
3
+ export declare const alertEmailTogglesSchema: z.ZodObject<{
4
+ balance_low: z.ZodBoolean;
5
+ subscription_quota: z.ZodBoolean;
6
+ api_key_budget: z.ZodBoolean;
7
+ member_spend: z.ZodBoolean;
8
+ }, z.core.$strip>;
9
+ /** The settings view. Closed: unknown fields are dropped. */
10
+ export declare const alertSettingsSchema: z.ZodObject<{
11
+ balance_threshold_cents: z.ZodNumber;
12
+ email: z.ZodObject<{
13
+ balance_low: z.ZodBoolean;
14
+ subscription_quota: z.ZodBoolean;
15
+ api_key_budget: z.ZodBoolean;
16
+ member_spend: z.ZodBoolean;
17
+ }, z.core.$strip>;
18
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ note: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ export type AlertSettings = z.infer<typeof alertSettingsSchema>;
22
+ /** GET /alerts/settings, parsed. */
23
+ export declare function getAlertSettings(config: Configuration): Promise<AlertSettings>;
24
+ /** The view the agent sees: the API fields plus the threshold in dollars. */
25
+ export declare function alertSettingsView(s: AlertSettings): Record<string, unknown>;
26
+ export declare const alertReadTools: import("../types.js").ToolDefinition[];