@deliverd/sdk 0.37.0 → 0.38.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 CHANGED
@@ -887,6 +887,22 @@ const output = await generateWithDeliverdApprovals(agent, agent.generate("Refund
887
887
  Each suspended call is approved with `agent.approveToolCallGenerate` or declined
888
888
  with `agent.declineToolCallGenerate`, and the person's reason reaches the model.
889
889
 
890
+ **OpenRouter Agent SDK** (`@openrouter/agent`) — mark tools `requireApproval: true` as usual, then hand OpenRouter's `PermissionRequest` hook to Deliverd:
891
+
892
+ ```ts
893
+ import { deliverdPermissionRequest, resolveOpenRouterApprovals } from "@deliverd/sdk/adapters";
894
+
895
+ const result = openrouter.callModel({
896
+ model, input, tools,
897
+ hooks: { PermissionRequest: [deliverdPermissionRequest({ deliverd, approvers: ["finance"] })] },
898
+ });
899
+ ```
900
+
901
+ The run waits for the person and carries on; a no reaches the model with their
902
+ reason. For a wait longer than a process should stay up, let the run pause with
903
+ a `state` accessor, then `resolveOpenRouterApprovals(result, { deliverd })`
904
+ returns the `approveToolCalls` and `rejectToolCalls` to resume it with.
905
+
890
906
  **Muse Spark** (Meta Model API) — the loop runs the calls, so hand them over with the function that runs them:
891
907
 
892
908
  ```ts
@@ -18,6 +18,10 @@ export { approveInGraph, resumeFromCallback } from "./langgraph.js";
18
18
  export type { DeliverdInterruptValue, GraphApprovalRecord, GraphApprover, GraphDecision } from "./langgraph.js";
19
19
  export { generateWithDeliverdApprovals, pendingMastraApproval, resolveMastraApproval } from "./mastra.js";
20
20
  export type { MastraApprovingAgent, MastraOutput } from "./mastra.js";
21
+ export { deliverdPermissionRequest, resolveOpenRouterApprovals } from "./openrouter.js";
22
+ export type { OpenRouterHookContext, OpenRouterPausedResult, OpenRouterPendingCall, OpenRouterPermissionHook, OpenRouterPermissionPayload, OpenRouterPermissionResult, OpenRouterResume, } from "./openrouter.js";
23
+ export { changeOpenRouterGuardrail, openRouterGuardrailForData, openRouterModelsInUse, raiseOpenRouterKeyLimit, registerOpenRouterModels, } from "./openrouter.js";
24
+ export type { OpenRouterAdmin, OpenRouterChangeOptions, OpenRouterChangeResult, OpenRouterGuardrailSettings, OpenRouterModelUse, OpenRouterPolicyReading, RegisterClient, } from "./openrouter.js";
21
25
  export { runMuseFunctionCalls, runMuseToolCalls } from "./muse-spark.js";
22
26
  export type { MuseFunctionCall, MuseFunctionCallOutput, MuseToolApprovalOptions, MuseToolCall, MuseToolMessage, MuseToolRunner, } from "./muse-spark.js";
23
27
  export { deliverdAllow, deliverdWebMcpAllow, describeStep, uiSdkApprovalRoute, UI_SDK_DEFAULT_TIMEOUT } from "./ui-sdk.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACpF,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpE,YAAY,EAAE,sBAAsB,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B,EAAE,MAAM,aAAa,CAAC;AAC3H,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpI,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -12,6 +12,8 @@ export { deliverdToolApproval } from "./ai-sdk.js";
12
12
  export { resolveInterruptions, runWithDeliverdApprovals } from "./openai-agents.js";
13
13
  export { approveInGraph, resumeFromCallback } from "./langgraph.js";
14
14
  export { generateWithDeliverdApprovals, pendingMastraApproval, resolveMastraApproval } from "./mastra.js";
15
+ export { deliverdPermissionRequest, resolveOpenRouterApprovals } from "./openrouter.js";
16
+ export { changeOpenRouterGuardrail, openRouterGuardrailForData, openRouterModelsInUse, raiseOpenRouterKeyLimit, registerOpenRouterModels, } from "./openrouter.js";
15
17
  export { runMuseFunctionCalls, runMuseToolCalls } from "./muse-spark.js";
16
18
  export { deliverdAllow, deliverdWebMcpAllow, describeStep, uiSdkApprovalRoute, UI_SDK_DEFAULT_TIMEOUT } from "./ui-sdk.js";
17
19
  export { defaultDescription, DEFAULT_TOOL_EXPIRY } from "./shared.js";
@@ -0,0 +1,277 @@
1
+ import type { Duration } from "../duration.js";
2
+ import type { RegisterAiSystemInput, UsePolicy, UsePolicyData, UsePolicyDeploymentClass } from "../types.js";
3
+ import { type Approver, type ToolApprovalOptions } from "./shared.js";
4
+ /**
5
+ * OpenRouter's Agent SDK (`@openrouter/agent`): a person approves the tool
6
+ * calls you mark `requireApproval`, through Deliverd.
7
+ *
8
+ * OpenRouter pauses a run when a tool marked `requireApproval` is called and
9
+ * leaves who decides, and where, to you. Two ways to hand that to Deliverd:
10
+ *
11
+ * In the run, with the `PermissionRequest` hook, which fires just before the
12
+ * SDK would pause. The run waits for the person and goes on by itself; a no
13
+ * reaches the model with the person's reason.
14
+ *
15
+ * ```ts
16
+ * import { OpenRouter } from "@openrouter/agent";
17
+ * import { Deliverd } from "@deliverd/sdk";
18
+ * import { deliverdPermissionRequest } from "@deliverd/sdk/adapters";
19
+ *
20
+ * const result = openrouter.callModel({
21
+ * model: "anthropic/claude-sonnet-4.5",
22
+ * input: "Refund order 1042",
23
+ * tools: [refundTool], // tool({ ..., requireApproval: true })
24
+ * hooks: { PermissionRequest: [deliverdPermissionRequest({ deliverd: new Deliverd(), approvers: ["finance"] })] },
25
+ * });
26
+ * console.log(await result.getText());
27
+ * ```
28
+ *
29
+ * Or across a pause, for a wait longer than a process should hold open: let
30
+ * the run pause as OpenRouter does (with a `state` accessor), then
31
+ * `resolveOpenRouterApprovals(result, options)` asks about each pending call
32
+ * and returns the `approveToolCalls` and `rejectToolCalls` to resume with.
33
+ * Each call is keyed by the conversation and call id, so asking again after a
34
+ * restart finds the same request rather than filing a second one. OpenRouter
35
+ * tells the model only "Rejected by user" on this path; the hook passes the
36
+ * person's own reason.
37
+ *
38
+ * Shapes follow `@openrouter/agent` 1.2.1's type definitions: the
39
+ * `PermissionRequest` entry of `BuiltInHookDefinitions` (`HookEntry`,
40
+ * `PermissionRequestPayload` `{ toolName, toolInput, riskLevel }`,
41
+ * `PermissionRequestResult` `{ decision: "allow" | "deny" | "ask_user",
42
+ * reason }`, `LifecycleHookContext` `{ signal, hookName, sessionId }`) in
43
+ * `esm/lib/hooks-types.d.ts` and `hooks-schemas.d.ts`; `ModelResult`'s
44
+ * `getPendingToolCalls()` and `getState()` in `esm/lib/model-result.d.ts`;
45
+ * and `ParsedToolCall` `{ id, name, arguments }` and `ConversationState`'s
46
+ * `id` and `status` in `esm/lib/tool-types.d.ts`.
47
+ */
48
+ /** The `PermissionRequest` hook payload. */
49
+ export interface OpenRouterPermissionPayload {
50
+ toolName: string;
51
+ toolInput: Record<string, unknown>;
52
+ riskLevel?: "low" | "medium" | "high";
53
+ }
54
+ /** What a `PermissionRequest` handler returns. */
55
+ export interface OpenRouterPermissionResult {
56
+ decision: "allow" | "deny" | "ask_user";
57
+ reason?: string;
58
+ }
59
+ /** The hook context OpenRouter passes every handler. */
60
+ export interface OpenRouterHookContext {
61
+ signal?: AbortSignal;
62
+ sessionId?: string;
63
+ }
64
+ /** A `HookEntry` for `hooks.PermissionRequest`. */
65
+ export interface OpenRouterPermissionHook {
66
+ handler: (payload: OpenRouterPermissionPayload, context: OpenRouterHookContext) => Promise<OpenRouterPermissionResult>;
67
+ }
68
+ /**
69
+ * A `PermissionRequest` hook entry: each call OpenRouter would pause for is
70
+ * decided by a person in Deliverd, and the run carries on.
71
+ *
72
+ * A call `when` does not select is allowed, as with the other adapters.
73
+ * OpenRouter's payload carries no call id, so a call is keyed by the session
74
+ * (or, when the run names none, this hook), the tool, its input and how many
75
+ * times that same call has come up: the same call asked again in one run gets
76
+ * a request of its own, and another run never reuses this one's yes.
77
+ */
78
+ export declare function deliverdPermissionRequest(options: ToolApprovalOptions): OpenRouterPermissionHook;
79
+ /** The part of a `ParsedToolCall` this adapter reads. */
80
+ export interface OpenRouterPendingCall {
81
+ id: string;
82
+ name: string;
83
+ arguments: unknown;
84
+ }
85
+ /** The part of a `ModelResult` this adapter reads. */
86
+ export interface OpenRouterPausedResult {
87
+ getPendingToolCalls(): Promise<OpenRouterPendingCall[]>;
88
+ getState(): Promise<{
89
+ id: string;
90
+ status?: string;
91
+ }>;
92
+ }
93
+ /** What to resume a paused conversation with: pass both to `callModel` with the same `state`. */
94
+ export interface OpenRouterResume {
95
+ approveToolCalls: string[];
96
+ rejectToolCalls: string[];
97
+ /** Each refused call's reason, by call id, for your own log. OpenRouter does not pass it on. */
98
+ reasons: Record<string, string>;
99
+ }
100
+ /**
101
+ * Ask about every call a paused run is waiting on, and return the decisions
102
+ * to resume it with. Calls `when` does not select are approved.
103
+ */
104
+ export declare function resolveOpenRouterApprovals(result: OpenRouterPausedResult, options: ToolApprovalOptions): Promise<OpenRouterResume>;
105
+ /**
106
+ * OpenRouter's own controls, with a person's yes on every change, and the
107
+ * AI register kept to what OpenRouter actually routes.
108
+ *
109
+ * OpenRouter guardrails set what a key may spend, which models and providers
110
+ * it may reach, zero data retention and data regions. Anyone holding a
111
+ * management key can change them, and nothing records who agreed. These
112
+ * helpers run on your side, with your management key, which never reaches
113
+ * Deliverd:
114
+ *
115
+ * - `changeOpenRouterGuardrail` reads the guardrail, shows a person what would
116
+ * change, and applies it only on their yes.
117
+ * - `raiseOpenRouterKeyLimit` does the same for one key's credit limit.
118
+ * - `openRouterGuardrailForData` reads your AI use policy for the data a key
119
+ * will carry and says whether OpenRouter may carry it at all, and with which
120
+ * guardrail settings.
121
+ * - `openRouterModelsInUse` reads OpenRouter's activity (the last 30 days, by
122
+ * model) and `registerOpenRouterModels` adds the models nobody registered to
123
+ * the AI register, as found in use, for a person to triage.
124
+ *
125
+ * Shapes follow `@openrouter/sdk` 1.5.103's generated models: `Guardrail` and
126
+ * `UpdateGuardrailRequest` (snake_case on the wire, `GET`/`PATCH
127
+ * /guardrails/{id}`, answered as `{ data }`), `UpdateKeysRequestBody`
128
+ * (`limit`, `limit_reset`; `GET`/`PATCH /keys/{hash}`) and `ActivityItem`
129
+ * (`GET /activity`: `date`, `model`, `provider_name`, `requests`, `usage`).
130
+ */
131
+ export interface OpenRouterAdmin {
132
+ /** A management key (OpenRouter → Settings → Management keys). It stays in your process. */
133
+ managementKey: string;
134
+ /** Default `https://openrouter.ai/api/v1`; `https://eu.openrouter.ai/api/v1` for EU in-region routing. */
135
+ baseUrl?: string;
136
+ fetch?: typeof fetch;
137
+ }
138
+ /** The guardrail settings these helpers read and change, as OpenRouter names them in its SDK. */
139
+ export interface OpenRouterGuardrailSettings {
140
+ name?: string;
141
+ description?: string | null;
142
+ /** Spend limit in US dollars; null removes it. */
143
+ limitUsd?: number | null;
144
+ resetInterval?: "daily" | "weekly" | "monthly" | null;
145
+ allowedModels?: string[] | null;
146
+ ignoredModels?: string[] | null;
147
+ allowedProviders?: string[] | null;
148
+ ignoredProviders?: string[] | null;
149
+ /** Zero data retention, for every provider. */
150
+ enforceZdr?: boolean | null;
151
+ allowedDataRegions?: ("global" | "europe" | "us")[] | null;
152
+ enablePaidModelTraining?: boolean | null;
153
+ enableFreeModelTraining?: boolean | null;
154
+ enableFreeModelPublication?: boolean | null;
155
+ }
156
+ export interface OpenRouterChangeOptions {
157
+ /** The client: `new Deliverd()`. */
158
+ deliverd: Approver;
159
+ openrouter: OpenRouterAdmin;
160
+ /** Who may decide. The organisation's admins when omitted. */
161
+ approvers?: string[];
162
+ /** Why the change is wanted, in a sentence the approver reads first. */
163
+ reason?: string;
164
+ /** How long the request stays open. Default one day: nobody is waiting on a run. */
165
+ expiresIn?: Duration;
166
+ timeout?: Duration;
167
+ flowId?: string;
168
+ metadata?: Record<string, unknown>;
169
+ }
170
+ /** What happened to a change. */
171
+ export type OpenRouterChangeResult = {
172
+ applied: true;
173
+ decidedBy: string | null;
174
+ approvalId: string;
175
+ changes: string[];
176
+ } | {
177
+ applied: false;
178
+ reason: string;
179
+ approvalId: string | null;
180
+ changes: string[];
181
+ };
182
+ /**
183
+ * Change an OpenRouter guardrail only once a person says yes.
184
+ *
185
+ * The approver sees each setting that would change, before and after. A
186
+ * change that loosens anything (a higher or removed spend limit, zero data
187
+ * retention off, training on, more regions, models or providers) is asked as
188
+ * high risk. The same change to the same guardrail, asked again before it was
189
+ * applied, finds the same request; once the guardrail has changed, a new ask
190
+ * is a new request.
191
+ */
192
+ export declare function changeOpenRouterGuardrail(guardrailId: string, change: OpenRouterGuardrailSettings, options: OpenRouterChangeOptions): Promise<OpenRouterChangeResult>;
193
+ /**
194
+ * Raise (or change, or remove) one OpenRouter key's credit limit only once a
195
+ * person says yes. The approver sees what the key has spent against its
196
+ * current limit. Removing a limit, or more than doubling it, is high risk.
197
+ */
198
+ export declare function raiseOpenRouterKeyLimit(keyHash: string, next: {
199
+ limit: number | null;
200
+ limitReset?: "daily" | "weekly" | "monthly" | null;
201
+ }, options: OpenRouterChangeOptions): Promise<OpenRouterChangeResult>;
202
+ /** What the AI use policy says about sending this data through OpenRouter. */
203
+ export interface OpenRouterPolicyReading {
204
+ /** False when the policy keeps some of the data to a private deployment, or out of AI tools altogether. */
205
+ allowed: boolean;
206
+ /** The least-controlled kind of tool the policy accepts for all of the data. */
207
+ deploymentClass: UsePolicyDeploymentClass | null;
208
+ /** Guardrail settings that make OpenRouter that kind of tool, as far as settings can. Empty when nothing is needed. */
209
+ guardrail: OpenRouterGuardrailSettings;
210
+ /** Conditions the policy attaches, which still apply per use: a person asked, or a current DPIA. */
211
+ conditions: string[];
212
+ /** In a sentence or two, for a log or the approver. */
213
+ explanation: string;
214
+ }
215
+ /**
216
+ * Read the AI use policy for the data a key will carry.
217
+ *
218
+ * OpenRouter on its defaults is treated as a consumer tool. With zero data
219
+ * retention enforced and training and publication off, under your own
220
+ * agreement with OpenRouter, it is treated as an enterprise tenant. It is
221
+ * never a private deployment. Pass the policy from
222
+ * `deliverd.governance.aiUsePolicy()`.
223
+ */
224
+ export declare function openRouterGuardrailForData(policy: UsePolicy, data: UsePolicyData[], options?: {
225
+ region?: "europe" | "us";
226
+ }): OpenRouterPolicyReading;
227
+ /** One model OpenRouter routed to, from its activity. */
228
+ export interface OpenRouterModelUse {
229
+ model: string;
230
+ providers: string[];
231
+ requests: number;
232
+ /** US dollars. */
233
+ usage: number;
234
+ firstSeen: string;
235
+ lastSeen: string;
236
+ }
237
+ /** The models a management key's organisation used through OpenRouter, from its activity (the last 30 days), most requests first. */
238
+ export declare function openRouterModelsInUse(openrouter: OpenRouterAdmin): Promise<OpenRouterModelUse[]>;
239
+ /** The part of the Deliverd client this needs: `deliverd.governance.aiSystems`. */
240
+ export interface RegisterClient {
241
+ governance: {
242
+ aiSystems: {
243
+ list(input?: {
244
+ status?: "active" | "retired";
245
+ }): Promise<{
246
+ id: string;
247
+ model: string | null;
248
+ name: string;
249
+ }[]>;
250
+ register(input: RegisterAiSystemInput): Promise<{
251
+ id: string;
252
+ name: string;
253
+ }>;
254
+ };
255
+ };
256
+ }
257
+ /**
258
+ * Add each model OpenRouter routed to, and nobody registered, to the AI
259
+ * register as found in use (`entryType: "discovered"`, supplier OpenRouter),
260
+ * for a person to triage. A model already on a record, active or retired, is
261
+ * left alone. Returns what it added and what it skipped.
262
+ */
263
+ export declare function registerOpenRouterModels(options: {
264
+ deliverd: RegisterClient;
265
+ openrouter: OpenRouterAdmin;
266
+ /** Only models with at least this many requests. Default 1. */
267
+ minRequests?: number;
268
+ /** What to put on each new record, on top of what is found. */
269
+ defaults?: Partial<RegisterAiSystemInput>;
270
+ }): Promise<{
271
+ registered: {
272
+ id: string;
273
+ model: string;
274
+ }[];
275
+ skipped: string[];
276
+ }>;
277
+ //# sourceMappingURL=openrouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openrouter.d.ts","sourceRoot":"","sources":["../../src/adapters/openrouter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAA0B,qBAAqB,EAAE,SAAS,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACrI,OAAO,EAAgB,KAAK,QAAQ,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,4CAA4C;AAC5C,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;CACvC;AAED,kDAAkD;AAClD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA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