@rayrun/sdk 0.3.0 → 0.4.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
@@ -9,6 +9,7 @@ import { Rayrun } from '@rayrun/sdk';
9
9
 
10
10
  const rayrun = new Rayrun({ apiKey: process.env.RAYRUN_API_KEY });
11
11
  const { items: connections } = await rayrun.connections.list();
12
+ const { items: matchingTools } = await rayrun.tools.list({ query: 'create issue' });
12
13
  ```
13
14
 
14
15
  Create keys in **Dashboard → Settings → API keys**. The plaintext is shown once.
@@ -17,6 +18,18 @@ The client covers catalog search, connection and credential setup, OAuth links,
17
18
  client policies, reusable access profiles, activity, review queues, and webhooks. Safe reads retry
18
19
  rate limits, server errors, and transient network failures; writes do not retry automatically.
19
20
 
21
+ Inspect the effective policy applied to one connected client without reproducing policy logic in
22
+ your application:
23
+
24
+ ```js
25
+ const { items: effectivePolicy } = await rayrun.clients.listTools(clientUid, {
26
+ query: 'create issue',
27
+ });
28
+ ```
29
+
30
+ Each result includes the effective decision and the workspace, access-profile, or client layer that
31
+ restricted it.
32
+
20
33
  ## Reuse one access ceiling across clients
21
34
 
22
35
  ```js
@@ -92,7 +105,8 @@ const valid = verifyWebhookSignature({
92
105
  ```
93
106
 
94
107
  After verification, parse the body as `WebhookPayload`. Every event has a stable `id`, `type`, and
95
- `occurredAt`; its `data` shape is narrowed by `type`. Use `id` to deduplicate retries.
108
+ `occurredAt`; its `data` shape is narrowed by `type`. Delivery is at least once, so make processing
109
+ idempotent and deduplicate on `id`.
96
110
  For `activity.call`, `arguments` and `result` contain the captured tool payloads, or `null` when
97
111
  capture was disabled for that connection, the webhook did not opt in with
98
112
  `forwardToolPayloads: true`, or no result existed. `payloadCaptured` distinguishes a metadata-only
package/index.d.ts CHANGED
@@ -63,6 +63,27 @@ export type Client = {
63
63
  uid: string;
64
64
  userName: string;
65
65
  };
66
+ export type ClientTool = {
67
+ approved: boolean;
68
+ clientDecision: ToolDecision | null;
69
+ effectiveDecision: ToolDecision;
70
+ effectiveReason:
71
+ | 'definition-unapproved'
72
+ | 'workspace-tool-rule'
73
+ | 'workspace-default'
74
+ | 'client-profile-tool-rule'
75
+ | 'client-profile-default'
76
+ | 'client-tool-rule'
77
+ | 'client-default'
78
+ | 'multiple-layers'
79
+ | 'workspace-and-client';
80
+ name: string;
81
+ riskLevel: Risk;
82
+ riskReason: string;
83
+ serviceName: string;
84
+ uid: string;
85
+ workspaceDecision: ToolDecision | null;
86
+ };
66
87
  export type AccessProfile = {
67
88
  assignedClientCount: number;
68
89
  description: string;
@@ -263,7 +284,7 @@ export class Rayrun {
263
284
  setPolicy(uid: string, mode: ToolAccessMode): Promise<void>;
264
285
  };
265
286
  tools: {
266
- list(query?: PageQuery & { connectionUid?: string }): Promise<CursorPage<Tool>>;
287
+ list(query?: PageQuery & { connectionUid?: string; query?: string }): Promise<CursorPage<Tool>>;
267
288
  setPolicy(
268
289
  connectionUid: string,
269
290
  toolUid: string,
@@ -272,6 +293,7 @@ export class Rayrun {
272
293
  };
273
294
  clients: {
274
295
  list(query?: PageQuery): Promise<CursorPage<Client>>;
296
+ listTools(uid: string, query?: PageQuery & { query?: string }): Promise<CursorPage<ClientTool>>;
275
297
  setAccessProfile(
276
298
  uid: string,
277
299
  profileUid: string | null,
package/index.js CHANGED
@@ -114,6 +114,7 @@ export class Rayrun {
114
114
  };
115
115
  this.clients = {
116
116
  list: (query) => this.request('GET', '/clients', { query }),
117
+ listTools: (uid, query) => this.request('GET', `/clients/${uid}/tools`, { query }),
117
118
  setAccessProfile: (uid, profileUid, expectedVersion) =>
118
119
  this.request('PATCH', `/clients/${uid}/access-profile`, {
119
120
  body: { expectedVersion, profileUid },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayrun/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Type-safe client for the Rayrun public API",
5
5
  "license": "MIT",
6
6
  "repository": {