@slashfi/agents-sdk 0.17.0 → 0.18.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +89 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/cli.ts +293 -0
- package/src/codegen.test.ts +527 -0
- package/src/codegen.ts +1348 -0
- package/src/consumer.test.ts +1 -1
- package/src/index.ts +18 -0
- package/src/types.ts +103 -0
package/src/consumer.test.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -83,6 +83,11 @@ export type {
|
|
|
83
83
|
ToolSchema,
|
|
84
84
|
ToolSelectionContext,
|
|
85
85
|
IntegrationConfig,
|
|
86
|
+
ApiKeySecurityScheme,
|
|
87
|
+
HttpSecurityScheme,
|
|
88
|
+
NoneSecurityScheme,
|
|
89
|
+
OAuth2SecurityScheme,
|
|
90
|
+
SecurityScheme,
|
|
86
91
|
IntegrationMethods,
|
|
87
92
|
IntegrationMethodResult,
|
|
88
93
|
IntegrationMethodContext,
|
|
@@ -277,3 +282,16 @@ export type {
|
|
|
277
282
|
AgentListing,
|
|
278
283
|
SecretResolver,
|
|
279
284
|
} from "./registry-consumer.js";
|
|
285
|
+
|
|
286
|
+
// Codegen (exported from separate entrypoint — see ./codegen.ts)
|
|
287
|
+
// TODO: Re-enable once codegen.ts type errors are fixed
|
|
288
|
+
// export { codegen, useAgent, listAgentTools } from "./codegen.js";
|
|
289
|
+
// export type {
|
|
290
|
+
// CodegenOptions,
|
|
291
|
+
// CodegenResult,
|
|
292
|
+
// CodegenManifest,
|
|
293
|
+
// McpToolDefinition,
|
|
294
|
+
// McpServerInfo,
|
|
295
|
+
// McpTransport,
|
|
296
|
+
// ServerSource,
|
|
297
|
+
// } from "./codegen.js";
|
package/src/types.ts
CHANGED
|
@@ -164,6 +164,100 @@ export interface IntegrationConfig {
|
|
|
164
164
|
connectSchema?: Record<string, unknown>;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
// ============================================
|
|
168
|
+
// Security Scheme
|
|
169
|
+
// ============================================
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* OAuth 2.0 Authorization Code flow configuration.
|
|
173
|
+
* Used by agents that wrap APIs requiring user-authorized access
|
|
174
|
+
* (e.g. Notion, Slack, GitHub, Linear, Google).
|
|
175
|
+
*/
|
|
176
|
+
export interface OAuth2SecurityScheme {
|
|
177
|
+
type: "oauth2";
|
|
178
|
+
flows: {
|
|
179
|
+
authorizationCode: {
|
|
180
|
+
/** URL to redirect users for authorization */
|
|
181
|
+
authorizationUrl: string;
|
|
182
|
+
/** URL to exchange authorization code for tokens */
|
|
183
|
+
tokenUrl: string;
|
|
184
|
+
/** URL for token refresh (defaults to tokenUrl) */
|
|
185
|
+
refreshUrl?: string;
|
|
186
|
+
/** Available scopes: key = scope name, value = description */
|
|
187
|
+
scopes?: Record<string, string>;
|
|
188
|
+
/** How client credentials are sent */
|
|
189
|
+
clientAuth?: "client_secret_post" | "client_secret_basic";
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* API key authentication.
|
|
196
|
+
* Used by agents that wrap APIs using a single key
|
|
197
|
+
* (e.g. OpenAI, Anthropic, Stripe, Datadog).
|
|
198
|
+
*/
|
|
199
|
+
export interface ApiKeySecurityScheme {
|
|
200
|
+
type: "apiKey";
|
|
201
|
+
/** Where the key is sent */
|
|
202
|
+
in: "header" | "query";
|
|
203
|
+
/** Header or query parameter name (e.g. "X-API-Key", "Authorization") */
|
|
204
|
+
name: string;
|
|
205
|
+
/** Optional prefix (e.g. "Bearer" for Authorization header) */
|
|
206
|
+
prefix?: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* HTTP authentication (Bearer token, Basic auth).
|
|
211
|
+
*/
|
|
212
|
+
export interface HttpSecurityScheme {
|
|
213
|
+
type: "http";
|
|
214
|
+
scheme: "bearer" | "basic";
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* No authentication required.
|
|
219
|
+
*/
|
|
220
|
+
export interface NoneSecurityScheme {
|
|
221
|
+
type: "none";
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Security scheme for an agent — describes what authentication the
|
|
226
|
+
* agent's target API requires from consumers.
|
|
227
|
+
*
|
|
228
|
+
* Borrowed from OpenAPI Security Scheme Object, simplified for agents.
|
|
229
|
+
* The system uses this to:
|
|
230
|
+
* - Know what credentials a tenant admin needs to provide (OAuth app creds)
|
|
231
|
+
* - Know what flow a user needs to complete (OAuth exchange)
|
|
232
|
+
* - Know how to send credentials when calling the API
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* // OAuth 2.0 (Notion, Slack, GitHub)
|
|
237
|
+
* security: {
|
|
238
|
+
* type: 'oauth2',
|
|
239
|
+
* flows: {
|
|
240
|
+
* authorizationCode: {
|
|
241
|
+
* authorizationUrl: 'https://api.notion.com/v1/oauth/authorize',
|
|
242
|
+
* tokenUrl: 'https://api.notion.com/v1/oauth/token',
|
|
243
|
+
* clientAuth: 'client_secret_basic',
|
|
244
|
+
* }
|
|
245
|
+
* }
|
|
246
|
+
* }
|
|
247
|
+
*
|
|
248
|
+
* // API Key (OpenAI, Stripe)
|
|
249
|
+
* security: { type: 'apiKey', in: 'header', name: 'Authorization', prefix: 'Bearer' }
|
|
250
|
+
*
|
|
251
|
+
* // No auth (public API)
|
|
252
|
+
* security: { type: 'none' }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
export type SecurityScheme =
|
|
256
|
+
| OAuth2SecurityScheme
|
|
257
|
+
| ApiKeySecurityScheme
|
|
258
|
+
| HttpSecurityScheme
|
|
259
|
+
| NoneSecurityScheme;
|
|
260
|
+
|
|
167
261
|
// ============================================
|
|
168
262
|
// Agent Configuration
|
|
169
263
|
// ============================================
|
|
@@ -217,6 +311,15 @@ export interface AgentConfig {
|
|
|
217
311
|
*/
|
|
218
312
|
integration?: IntegrationConfig;
|
|
219
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Security scheme — describes what authentication the agent's
|
|
316
|
+
* target API requires. Used by the registry to communicate
|
|
317
|
+
* credential requirements to consumers.
|
|
318
|
+
*
|
|
319
|
+
* @see SecurityScheme
|
|
320
|
+
*/
|
|
321
|
+
security?: SecurityScheme;
|
|
322
|
+
|
|
220
323
|
/** Additional configuration */
|
|
221
324
|
/** Agent refs (paths to other agents this agent can call) */
|
|
222
325
|
refs?: Record<string, { description?: string }>;
|