@slashfi/agents-sdk 0.34.0 → 0.35.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 +2 -1
- package/dist/agent-definitions/auth.d.ts +3 -3
- package/dist/agent-definitions/auth.d.ts.map +1 -1
- package/dist/agent-definitions/auth.js +10 -4
- package/dist/agent-definitions/auth.js.map +1 -1
- package/dist/agent-definitions/config.d.ts.map +1 -1
- package/dist/agent-definitions/config.js.map +1 -1
- package/dist/agent-definitions/integrations.d.ts +12 -3
- package/dist/agent-definitions/integrations.d.ts.map +1 -1
- package/dist/agent-definitions/integrations.js +35 -16
- package/dist/agent-definitions/integrations.js.map +1 -1
- package/dist/agent-definitions/remote-registry.d.ts.map +1 -1
- package/dist/agent-definitions/remote-registry.js +17 -22
- package/dist/agent-definitions/remote-registry.js.map +1 -1
- package/dist/agent-definitions/users.d.ts.map +1 -1
- package/dist/agent-definitions/users.js.map +1 -1
- package/dist/auth-governance.js.map +1 -1
- package/dist/call-agent-schema.d.ts +128 -135
- package/dist/call-agent-schema.d.ts.map +1 -1
- package/dist/call-agent-schema.js +35 -5
- package/dist/call-agent-schema.js.map +1 -1
- package/dist/cjs/agent-definitions/auth.js +10 -4
- package/dist/cjs/agent-definitions/auth.js.map +1 -1
- package/dist/cjs/agent-definitions/config.js.map +1 -1
- package/dist/cjs/agent-definitions/integrations.js +35 -16
- package/dist/cjs/agent-definitions/integrations.js.map +1 -1
- package/dist/cjs/agent-definitions/remote-registry.js +17 -22
- package/dist/cjs/agent-definitions/remote-registry.js.map +1 -1
- package/dist/cjs/agent-definitions/users.js.map +1 -1
- package/dist/cjs/auth-governance.js.map +1 -1
- package/dist/cjs/call-agent-schema.js +35 -5
- package/dist/cjs/call-agent-schema.js.map +1 -1
- package/dist/cjs/define.js.map +1 -1
- package/dist/cjs/index.js +6 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/key-manager.js.map +1 -1
- package/dist/cjs/registry-consumer.js +60 -15
- package/dist/cjs/registry-consumer.js.map +1 -1
- package/dist/cjs/registry.js +3 -1
- package/dist/cjs/registry.js.map +1 -1
- package/dist/cjs/server.js +70 -121
- package/dist/cjs/server.js.map +1 -1
- package/dist/cjs/types.js +13 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/validate.js +2 -2
- package/dist/cjs/validate.js.map +1 -1
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/key-manager.d.ts.map +1 -1
- package/dist/key-manager.js +1 -1
- package/dist/key-manager.js.map +1 -1
- package/dist/registry-consumer.d.ts +8 -8
- package/dist/registry-consumer.d.ts.map +1 -1
- package/dist/registry-consumer.js +60 -15
- package/dist/registry-consumer.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +3 -1
- package/dist/registry.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +63 -114
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -1
- package/dist/types.js.map +1 -1
- package/dist/validate.d.ts +15 -15
- package/dist/validate.js +2 -2
- package/dist/validate.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-definitions/auth.ts +31 -14
- package/src/agent-definitions/config.ts +4 -4
- package/src/agent-definitions/integrations.ts +119 -63
- package/src/agent-definitions/remote-registry.ts +65 -38
- package/src/agent-definitions/users.ts +36 -3
- package/src/auth-governance.ts +2 -2
- package/src/call-agent-schema.test.ts +4 -1
- package/src/call-agent-schema.ts +39 -5
- package/src/consumer.test.ts +4 -1
- package/src/define.ts +18 -12
- package/src/index.ts +11 -0
- package/src/key-manager.ts +9 -2
- package/src/registry-consumer.ts +85 -24
- package/src/registry.ts +3 -1
- package/src/server.ts +122 -153
- package/src/types.ts +62 -0
- package/src/validate.ts +2 -2
package/dist/validate.d.ts
CHANGED
|
@@ -14,16 +14,16 @@ export declare const SerializedToolSchema: z.ZodObject<{
|
|
|
14
14
|
name: z.ZodString;
|
|
15
15
|
description: z.ZodString;
|
|
16
16
|
inputSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
-
outputSchema: z.ZodOptional<z.
|
|
17
|
+
outputSchema: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
18
18
|
}, "strip", z.ZodTypeAny, {
|
|
19
19
|
name: string;
|
|
20
20
|
description: string;
|
|
21
21
|
inputSchema: Record<string, unknown>;
|
|
22
|
-
outputSchema?:
|
|
22
|
+
outputSchema?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
23
23
|
}, {
|
|
24
24
|
name: string;
|
|
25
25
|
description: string;
|
|
26
|
-
outputSchema?:
|
|
26
|
+
outputSchema?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
27
27
|
inputSchema?: Record<string, unknown> | undefined;
|
|
28
28
|
}>;
|
|
29
29
|
export declare const SerializedAgentDefinitionSchema: z.ZodObject<{
|
|
@@ -32,7 +32,7 @@ export declare const SerializedAgentDefinitionSchema: z.ZodObject<{
|
|
|
32
32
|
description: z.ZodDefault<z.ZodString>;
|
|
33
33
|
version: z.ZodDefault<z.ZodString>;
|
|
34
34
|
visibility: z.ZodDefault<z.ZodEnum<["public", "private"]>>;
|
|
35
|
-
auth: z.ZodOptional<z.
|
|
35
|
+
auth: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
36
36
|
serverSource: z.ZodOptional<z.ZodString>;
|
|
37
37
|
serverInfo: z.ZodOptional<z.ZodObject<{
|
|
38
38
|
name: z.ZodString;
|
|
@@ -48,16 +48,16 @@ export declare const SerializedAgentDefinitionSchema: z.ZodObject<{
|
|
|
48
48
|
name: z.ZodString;
|
|
49
49
|
description: z.ZodString;
|
|
50
50
|
inputSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
51
|
-
outputSchema: z.ZodOptional<z.
|
|
51
|
+
outputSchema: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
52
52
|
}, "strip", z.ZodTypeAny, {
|
|
53
53
|
name: string;
|
|
54
54
|
description: string;
|
|
55
55
|
inputSchema: Record<string, unknown>;
|
|
56
|
-
outputSchema?:
|
|
56
|
+
outputSchema?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
57
57
|
}, {
|
|
58
58
|
name: string;
|
|
59
59
|
description: string;
|
|
60
|
-
outputSchema?:
|
|
60
|
+
outputSchema?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
61
61
|
inputSchema?: Record<string, unknown> | undefined;
|
|
62
62
|
}>, "many">;
|
|
63
63
|
generatedAt: z.ZodOptional<z.ZodString>;
|
|
@@ -68,7 +68,7 @@ export declare const SerializedAgentDefinitionSchema: z.ZodObject<{
|
|
|
68
68
|
description: z.ZodDefault<z.ZodString>;
|
|
69
69
|
version: z.ZodDefault<z.ZodString>;
|
|
70
70
|
visibility: z.ZodDefault<z.ZodEnum<["public", "private"]>>;
|
|
71
|
-
auth: z.ZodOptional<z.
|
|
71
|
+
auth: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
72
72
|
serverSource: z.ZodOptional<z.ZodString>;
|
|
73
73
|
serverInfo: z.ZodOptional<z.ZodObject<{
|
|
74
74
|
name: z.ZodString;
|
|
@@ -84,16 +84,16 @@ export declare const SerializedAgentDefinitionSchema: z.ZodObject<{
|
|
|
84
84
|
name: z.ZodString;
|
|
85
85
|
description: z.ZodString;
|
|
86
86
|
inputSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
87
|
-
outputSchema: z.ZodOptional<z.
|
|
87
|
+
outputSchema: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
88
88
|
}, "strip", z.ZodTypeAny, {
|
|
89
89
|
name: string;
|
|
90
90
|
description: string;
|
|
91
91
|
inputSchema: Record<string, unknown>;
|
|
92
|
-
outputSchema?:
|
|
92
|
+
outputSchema?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
93
93
|
}, {
|
|
94
94
|
name: string;
|
|
95
95
|
description: string;
|
|
96
|
-
outputSchema?:
|
|
96
|
+
outputSchema?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
97
97
|
inputSchema?: Record<string, unknown> | undefined;
|
|
98
98
|
}>, "many">;
|
|
99
99
|
generatedAt: z.ZodOptional<z.ZodString>;
|
|
@@ -104,7 +104,7 @@ export declare const SerializedAgentDefinitionSchema: z.ZodObject<{
|
|
|
104
104
|
description: z.ZodDefault<z.ZodString>;
|
|
105
105
|
version: z.ZodDefault<z.ZodString>;
|
|
106
106
|
visibility: z.ZodDefault<z.ZodEnum<["public", "private"]>>;
|
|
107
|
-
auth: z.ZodOptional<z.
|
|
107
|
+
auth: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
108
108
|
serverSource: z.ZodOptional<z.ZodString>;
|
|
109
109
|
serverInfo: z.ZodOptional<z.ZodObject<{
|
|
110
110
|
name: z.ZodString;
|
|
@@ -120,16 +120,16 @@ export declare const SerializedAgentDefinitionSchema: z.ZodObject<{
|
|
|
120
120
|
name: z.ZodString;
|
|
121
121
|
description: z.ZodString;
|
|
122
122
|
inputSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
123
|
-
outputSchema: z.ZodOptional<z.
|
|
123
|
+
outputSchema: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
124
124
|
}, "strip", z.ZodTypeAny, {
|
|
125
125
|
name: string;
|
|
126
126
|
description: string;
|
|
127
127
|
inputSchema: Record<string, unknown>;
|
|
128
|
-
outputSchema?:
|
|
128
|
+
outputSchema?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
129
129
|
}, {
|
|
130
130
|
name: string;
|
|
131
131
|
description: string;
|
|
132
|
-
outputSchema?:
|
|
132
|
+
outputSchema?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
133
133
|
inputSchema?: Record<string, unknown> | undefined;
|
|
134
134
|
}>, "many">;
|
|
135
135
|
generatedAt: z.ZodOptional<z.ZodString>;
|
package/dist/validate.js
CHANGED
|
@@ -19,7 +19,7 @@ export const SerializedToolSchema = z.object({
|
|
|
19
19
|
inputSchema: z
|
|
20
20
|
.record(z.unknown())
|
|
21
21
|
.default({ type: "object", properties: {} }),
|
|
22
|
-
outputSchema: z.
|
|
22
|
+
outputSchema: z.object({}).passthrough().optional(),
|
|
23
23
|
});
|
|
24
24
|
// ============================================
|
|
25
25
|
// Agent Definition Schema
|
|
@@ -31,7 +31,7 @@ export const SerializedAgentDefinitionSchema = z
|
|
|
31
31
|
description: z.string().default(""),
|
|
32
32
|
version: z.string().default("1.0.0"),
|
|
33
33
|
visibility: z.enum(["public", "private"]).default("public"),
|
|
34
|
-
auth: z.
|
|
34
|
+
auth: z.object({}).passthrough().optional(),
|
|
35
35
|
serverSource: z.string().optional(),
|
|
36
36
|
serverInfo: z
|
|
37
37
|
.object({
|
package/dist/validate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+CAA+C;AAC/C,cAAc;AACd,+CAA+C;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IAChD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACnB,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAC9C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+CAA+C;AAC/C,cAAc;AACd,+CAA+C;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IAChD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACnB,OAAO,CAAC,EAAE,IAAI,EAAE,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|
} from "../jwt.js";
|
|
35
|
-
import type {
|
|
35
|
+
import type {
|
|
36
|
+
AgentDefinition,
|
|
37
|
+
AuthClientCredentialsTokenResult,
|
|
38
|
+
AuthSecretValue,
|
|
39
|
+
ToolContext,
|
|
40
|
+
ToolDefinition,
|
|
41
|
+
} from "../types.js";
|
|
36
42
|
|
|
37
43
|
// ============================================
|
|
38
44
|
// Auth Types
|
|
@@ -120,8 +126,10 @@ export interface AuthStore {
|
|
|
120
126
|
/** Revoke a client (delete). */
|
|
121
127
|
revokeClient(clientId: string): Promise<boolean>;
|
|
122
128
|
|
|
123
|
-
/** Rotate a client's secret. Returns new
|
|
124
|
-
rotateSecret(
|
|
129
|
+
/** Rotate a client's secret. Returns new secret (wrapped for wire format). */
|
|
130
|
+
rotateSecret(
|
|
131
|
+
clientId: string,
|
|
132
|
+
): Promise<{ clientSecret: AuthSecretValue } | null>;
|
|
125
133
|
|
|
126
134
|
/** Store a token. */
|
|
127
135
|
storeToken(token: AuthToken): Promise<void>;
|
|
@@ -333,8 +341,11 @@ export function createMemoryAuthStore(): AuthStore {
|
|
|
333
341
|
const clientSecret = generateSecret();
|
|
334
342
|
client.clientSecretHash = await hashSecret(clientSecret);
|
|
335
343
|
return {
|
|
336
|
-
clientSecret: {
|
|
337
|
-
|
|
344
|
+
clientSecret: {
|
|
345
|
+
$agent_type: "secret",
|
|
346
|
+
value: clientSecret,
|
|
347
|
+
} satisfies AuthSecretValue,
|
|
348
|
+
};
|
|
338
349
|
},
|
|
339
350
|
|
|
340
351
|
async storeToken(token) {
|
|
@@ -572,7 +583,7 @@ export function createAuthAgent(
|
|
|
572
583
|
refreshToken: { $agent_type: "secret", value: result.refreshToken },
|
|
573
584
|
tokenType: "bearer",
|
|
574
585
|
expiresIn: tokenTtl,
|
|
575
|
-
}
|
|
586
|
+
} satisfies AuthClientCredentialsTokenResult;
|
|
576
587
|
}
|
|
577
588
|
|
|
578
589
|
if (input.grantType !== "client_credentials") {
|
|
@@ -607,7 +618,7 @@ export function createAuthAgent(
|
|
|
607
618
|
tokenType: "bearer",
|
|
608
619
|
expiresIn: tokenTtl,
|
|
609
620
|
scopes: client.scopes,
|
|
610
|
-
};
|
|
621
|
+
} satisfies AuthClientCredentialsTokenResult;
|
|
611
622
|
},
|
|
612
623
|
});
|
|
613
624
|
|
|
@@ -666,9 +677,12 @@ export function createAuthAgent(
|
|
|
666
677
|
|
|
667
678
|
return {
|
|
668
679
|
clientId,
|
|
669
|
-
clientSecret: {
|
|
680
|
+
clientSecret: {
|
|
681
|
+
$agent_type: "secret",
|
|
682
|
+
value: clientSecret,
|
|
683
|
+
} satisfies AuthSecretValue,
|
|
670
684
|
scopes,
|
|
671
|
-
}
|
|
685
|
+
};
|
|
672
686
|
},
|
|
673
687
|
});
|
|
674
688
|
|
|
@@ -907,17 +921,20 @@ export function createAuthAgent(
|
|
|
907
921
|
if (parts.length !== 3) {
|
|
908
922
|
return { success: false, error: "Invalid JWT format" };
|
|
909
923
|
}
|
|
910
|
-
let decoded:
|
|
924
|
+
let decoded: Record<string, unknown>;
|
|
911
925
|
try {
|
|
912
|
-
decoded = JSON.parse(
|
|
926
|
+
decoded = JSON.parse(
|
|
927
|
+
Buffer.from(parts[1], "base64url").toString(),
|
|
928
|
+
) as Record<string, unknown>;
|
|
913
929
|
} catch {
|
|
914
930
|
return { success: false, error: "Failed to decode JWT payload" };
|
|
915
931
|
}
|
|
916
932
|
|
|
917
933
|
const issuer = decoded.iss;
|
|
918
934
|
const sub = decoded.sub;
|
|
919
|
-
const foreignTenantId =
|
|
920
|
-
|
|
935
|
+
const foreignTenantId =
|
|
936
|
+
typeof decoded.tenantId === "string" ? decoded.tenantId : undefined;
|
|
937
|
+
if (typeof issuer !== "string" || typeof sub !== "string") {
|
|
921
938
|
return { success: false, error: "JWT missing iss or sub claims" };
|
|
922
939
|
}
|
|
923
940
|
|
|
@@ -928,7 +945,7 @@ export function createAuthAgent(
|
|
|
928
945
|
}
|
|
929
946
|
|
|
930
947
|
// 3. Verify JWT against the matched issuer's JWKS
|
|
931
|
-
let payload:
|
|
948
|
+
let payload: Awaited<ReturnType<typeof verifyJwtFromIssuer>>;
|
|
932
949
|
try {
|
|
933
950
|
payload = await verifyJwtFromIssuer(input.token, issuer);
|
|
934
951
|
} catch {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import type { ConsumerConfig, RefEntry } from "../define-config.js";
|
|
23
|
+
import type { ConsumerConfig, RefEntry, RegistryAuth } from "../define-config.js";
|
|
24
24
|
import { normalizeRef } from "../define-config.js";
|
|
25
25
|
import { defineAgent, defineTool } from "../define.js";
|
|
26
|
-
import type { AgentDefinition, ToolContext } from "../types.js";
|
|
26
|
+
import type { AgentDefinition, ToolContext, ToolDefinition } from "../types.js";
|
|
27
27
|
|
|
28
28
|
// ============================================
|
|
29
29
|
// FsStore Interface
|
|
@@ -275,7 +275,7 @@ export function createConfigAgent(
|
|
|
275
275
|
const entry = {
|
|
276
276
|
url: input.url,
|
|
277
277
|
...(input.name && { name: input.name }),
|
|
278
|
-
...(input.auth && { auth: input.auth as
|
|
278
|
+
...(input.auth && { auth: input.auth as RegistryAuth }),
|
|
279
279
|
};
|
|
280
280
|
|
|
281
281
|
// Upsert by URL
|
|
@@ -313,6 +313,6 @@ export function createConfigAgent(
|
|
|
313
313
|
"Manage consumer config — add/remove/list agent refs and registries. " +
|
|
314
314
|
"Replaces @integrations for connecting to third-party services.",
|
|
315
315
|
},
|
|
316
|
-
tools: [addRefTool, removeRefTool, listRefsTool, addRegistryTool] as
|
|
316
|
+
tools: [addRefTool, removeRefTool, listRefsTool, addRegistryTool] as ToolDefinition<ToolContext>[],
|
|
317
317
|
});
|
|
318
318
|
}
|