@slashfi/agents-sdk 0.50.5 → 0.60.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/adk.d.ts +4 -9
- package/dist/adk.d.ts.map +1 -1
- package/dist/adk.js +72 -245
- package/dist/adk.js.map +1 -1
- package/dist/cjs/config-store.js +3 -1
- package/dist/cjs/config-store.js.map +1 -1
- package/dist/cjs/init.js +175 -0
- package/dist/cjs/init.js.map +1 -0
- package/dist/cjs/materialize.js +115 -0
- package/dist/cjs/materialize.js.map +1 -0
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +3 -1
- package/dist/config-store.js.map +1 -1
- package/dist/init.d.ts +31 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +166 -0
- package/dist/init.js.map +1 -0
- package/dist/materialize.d.ts +17 -0
- package/dist/materialize.d.ts.map +1 -0
- package/dist/materialize.js +112 -0
- package/dist/materialize.js.map +1 -0
- package/package.json +1 -1
- package/src/adk.ts +73 -307
- package/src/config-store.ts +3 -1
- package/src/init.test.ts +419 -0
- package/src/init.ts +211 -0
- package/src/materialize.ts +158 -0
- package/src/presets/claude.json +5 -0
- package/src/presets/codex.json +5 -0
- package/src/presets/copilot.json +5 -0
- package/src/presets/cursor.json +5 -0
- package/src/presets/hermes.json +5 -0
- package/src/presets/windsurf.json +5 -0
package/src/adk.ts
CHANGED
|
@@ -3,34 +3,28 @@
|
|
|
3
3
|
* ADK CLI — Agent Development Kit
|
|
4
4
|
*
|
|
5
5
|
* Commands:
|
|
6
|
-
*
|
|
7
|
-
* introspect Introspect an MCP server → agent.json
|
|
8
|
-
* pack Generate publishable @agentdef/* package
|
|
9
|
-
* publish Pack + npm publish to @agentdef/*
|
|
10
|
-
* use Execute a tool on a generated agent
|
|
11
|
-
* list List all generated agents
|
|
6
|
+
* init Setup + skill injection for coding agents
|
|
12
7
|
* registry <op> Manage registry connections (add, remove, list, browse, inspect, test)
|
|
13
8
|
* ref <op> Manage agent refs (add, remove, list, get, inspect, call, resources, read)
|
|
14
9
|
*
|
|
15
10
|
* @example
|
|
16
11
|
* ```bash
|
|
17
|
-
* adk registry add https://registry.slash.com --name
|
|
18
|
-
* adk registry browse
|
|
19
|
-
* adk ref add notion --registry
|
|
12
|
+
* adk registry add https://registry.slash.com --name public
|
|
13
|
+
* adk registry browse public
|
|
14
|
+
* adk ref add notion --registry public
|
|
20
15
|
* adk ref inspect notion
|
|
21
16
|
* adk ref call notion notion-search '{"query":"hello"}'
|
|
22
17
|
* ```
|
|
23
18
|
*/
|
|
24
19
|
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { codegen, listAgentTools, useAgent } from "./codegen.js";
|
|
28
|
-
import type { CodegenManifest } from "./codegen.js";
|
|
29
|
-
import { pack, publish } from "./pack.js";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import { homedir } from "node:os";
|
|
30
22
|
import { createAdk } from "./config-store.js";
|
|
31
23
|
import { createLocalFsStore, getLocalEncryptionKey } from "./local-fs.js";
|
|
32
24
|
import type { Adk } from "./config-store.js";
|
|
33
25
|
import { AdkError, getError, getRecentErrors } from "./adk-error.js";
|
|
26
|
+
import { runInit, parseTarget } from "./init.js";
|
|
27
|
+
import { materializeRef } from "./materialize.js";
|
|
34
28
|
|
|
35
29
|
const args = process.argv.slice(2);
|
|
36
30
|
const command = args[0];
|
|
@@ -49,25 +43,6 @@ function hasFlag(flag: string): boolean {
|
|
|
49
43
|
return args.includes(flag);
|
|
50
44
|
}
|
|
51
45
|
|
|
52
|
-
function getAgentsDir(): string {
|
|
53
|
-
return resolve(process.env.AGENTS_SDK_DIR ?? "./agents");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function findAgentDir(name: string): string | null {
|
|
57
|
-
const agentsDir = getAgentsDir();
|
|
58
|
-
|
|
59
|
-
const exactPath = resolve(name);
|
|
60
|
-
if (existsSync(join(exactPath, ".codegen-manifest.json"))) return exactPath;
|
|
61
|
-
|
|
62
|
-
const withAt = join(agentsDir, `@${name}`);
|
|
63
|
-
if (existsSync(join(withAt, ".codegen-manifest.json"))) return withAt;
|
|
64
|
-
|
|
65
|
-
const withoutAt = join(agentsDir, name);
|
|
66
|
-
if (existsSync(join(withoutAt, ".codegen-manifest.json"))) return withoutAt;
|
|
67
|
-
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
46
|
function getAdk(): Adk {
|
|
72
47
|
const token = process.env.ADK_TOKEN ?? undefined;
|
|
73
48
|
const encryptionKey = getLocalEncryptionKey();
|
|
@@ -79,15 +54,12 @@ function printUsage() {
|
|
|
79
54
|
adk — Agent Development Kit
|
|
80
55
|
|
|
81
56
|
Usage:
|
|
57
|
+
adk init [--target <agent>:<path>] Setup + install skills for coding agents
|
|
82
58
|
adk proxy <op> [options] Manage remote adk proxies
|
|
83
59
|
adk registry <op> [options] Manage registry connections
|
|
84
60
|
adk ref <op> [options] Manage agent refs
|
|
85
|
-
adk
|
|
86
|
-
adk
|
|
87
|
-
adk pack [options] Generate publishable package from agent.json
|
|
88
|
-
adk publish [options] Pack + npm publish to @agentdef/*
|
|
89
|
-
adk use <agent> [options] Execute a tool on a generated agent
|
|
90
|
-
adk list List all generated agents
|
|
61
|
+
adk config-path Print config directory path
|
|
62
|
+
adk error [id] View recent errors or a specific error
|
|
91
63
|
|
|
92
64
|
Proxy operations:
|
|
93
65
|
adk proxy add <url> --name <name> [--type mcp|registry] [--agent @config] [--default]
|
|
@@ -114,15 +86,26 @@ Ref operations:
|
|
|
114
86
|
adk ref auth <name> [--api-key <key>]
|
|
115
87
|
adk ref auth-status <name>
|
|
116
88
|
|
|
89
|
+
Init targets (presets):
|
|
90
|
+
claude Claude Code skills (default: ~/.claude/skills)
|
|
91
|
+
cursor Cursor rules (default: .cursor/rules)
|
|
92
|
+
copilot GitHub Copilot instructions (default: .github)
|
|
93
|
+
windsurf Windsurf rules (default: .)
|
|
94
|
+
codex OpenAI Codex (default: .)
|
|
95
|
+
hermes Hermes skills (default: ~/.hermes/skills)
|
|
96
|
+
|
|
97
|
+
Custom path: adk init --target <preset>:<path>
|
|
98
|
+
|
|
117
99
|
Environment:
|
|
118
100
|
ADK_CONFIG_DIR Config directory (default: ~/.adk)
|
|
119
101
|
ADK_TOKEN Bearer token for authenticated registries
|
|
120
102
|
ADK_ENCRYPTION_KEY Override encryption key (default: auto from ~/.adk/.encryption-key)
|
|
121
103
|
|
|
122
104
|
Examples:
|
|
123
|
-
adk
|
|
124
|
-
adk registry
|
|
125
|
-
adk
|
|
105
|
+
adk init --target claude --target cursor --target codex
|
|
106
|
+
adk registry add https://registry.slash.com --name public
|
|
107
|
+
adk registry browse public
|
|
108
|
+
adk ref add notion --registry public
|
|
126
109
|
adk ref inspect notion --full
|
|
127
110
|
adk ref call notion notion-search '{"query":"hello"}'
|
|
128
111
|
`);
|
|
@@ -132,253 +115,6 @@ Examples:
|
|
|
132
115
|
// Commands
|
|
133
116
|
// ============================================
|
|
134
117
|
|
|
135
|
-
async function runCodegen() {
|
|
136
|
-
const server = getArg("--server");
|
|
137
|
-
const name = getArg("--name");
|
|
138
|
-
const outDir = getArg("--out");
|
|
139
|
-
const agentPath = getArg("--path");
|
|
140
|
-
const visibility = getArg("--visibility") as
|
|
141
|
-
| "public"
|
|
142
|
-
| "internal"
|
|
143
|
-
| "private"
|
|
144
|
-
| undefined;
|
|
145
|
-
const noCli = hasFlag("--no-cli");
|
|
146
|
-
const noTypes = hasFlag("--no-types");
|
|
147
|
-
|
|
148
|
-
if (!server) {
|
|
149
|
-
console.error(
|
|
150
|
-
"Error: --server is required.\n" +
|
|
151
|
-
" Example: adk codegen --server 'npx @mcp/notion' --name notion",
|
|
152
|
-
);
|
|
153
|
-
process.exit(1);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const resolvedOutDir =
|
|
157
|
-
outDir ??
|
|
158
|
-
join(
|
|
159
|
-
getAgentsDir(),
|
|
160
|
-
`@${(name ?? "mcp-agent").toLowerCase().replace(/[^a-z0-9-]/g, "-")}`,
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
console.log(`Connecting to MCP server: ${server}`);
|
|
164
|
-
console.log(`Output: ${resolvedOutDir}\n`);
|
|
165
|
-
|
|
166
|
-
try {
|
|
167
|
-
const result = await codegen({
|
|
168
|
-
server,
|
|
169
|
-
outDir: resolvedOutDir,
|
|
170
|
-
agentPath,
|
|
171
|
-
name,
|
|
172
|
-
cli: !noCli,
|
|
173
|
-
types: !noTypes,
|
|
174
|
-
visibility,
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
console.log(
|
|
178
|
-
`\x1b[32m\u2713\x1b[0m Generated ${result.toolCount} tools from ${result.serverInfo.name ?? "MCP server"}`,
|
|
179
|
-
);
|
|
180
|
-
console.log("\nFiles:");
|
|
181
|
-
for (const f of result.files) {
|
|
182
|
-
console.log(` ${f}`);
|
|
183
|
-
}
|
|
184
|
-
console.log(
|
|
185
|
-
`\nUse: adk use ${name ?? result.serverInfo.name ?? "<agent>"} --list`,
|
|
186
|
-
);
|
|
187
|
-
} catch (err) {
|
|
188
|
-
console.error(
|
|
189
|
-
`\x1b[31mError:\x1b[0m ${err instanceof Error ? err.message : String(err)}`,
|
|
190
|
-
);
|
|
191
|
-
process.exit(1);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
async function runIntrospect() {
|
|
196
|
-
const server = getArg("--server");
|
|
197
|
-
const name = getArg("--name");
|
|
198
|
-
const out = getArg("--out") || (name ? `./${name}.json` : undefined);
|
|
199
|
-
|
|
200
|
-
if (!server || !name) {
|
|
201
|
-
console.error(
|
|
202
|
-
"Usage: adk introspect --server <cmd> --name <name> [--out <path>]",
|
|
203
|
-
);
|
|
204
|
-
process.exit(1);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const { introspectMcp } = await import("./introspect.js");
|
|
208
|
-
await introspectMcp({ server, name, out });
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function runPack() {
|
|
212
|
-
const agentFile = getArg("--agent") || "./agent.json";
|
|
213
|
-
const outDir = getArg("--out") || "./dist";
|
|
214
|
-
const scope = getArg("--scope") || "@agentdef";
|
|
215
|
-
const previousAgentFile = getArg("--previous");
|
|
216
|
-
|
|
217
|
-
if (!existsSync(resolve(agentFile))) {
|
|
218
|
-
console.error(`agent.json not found at ${resolve(agentFile)}`);
|
|
219
|
-
console.error("Run 'adk introspect' first, or specify --agent <path>");
|
|
220
|
-
process.exit(1);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const result = pack({ agentFile, outDir, scope, previousAgentFile });
|
|
224
|
-
console.log(`\n\u2705 Packed ${result.packageName}@${result.version}`);
|
|
225
|
-
console.log(` Hash: ${result.hash}`);
|
|
226
|
-
console.log(` Tools: ${result.meta.toolCount}`);
|
|
227
|
-
console.log(` Size: ${(result.meta.sizeBytes / 1024).toFixed(1)}KB`);
|
|
228
|
-
console.log(` Output: ${result.packageDir}`);
|
|
229
|
-
if (result.meta.changes) {
|
|
230
|
-
const c = result.meta.changes;
|
|
231
|
-
if (c.toolsAdded.length > 0)
|
|
232
|
-
console.log(` Added: ${c.toolsAdded.join(", ")}`);
|
|
233
|
-
if (c.toolsRemoved.length > 0)
|
|
234
|
-
console.log(` Removed: ${c.toolsRemoved.join(", ")}`);
|
|
235
|
-
if (c.toolsModified.length > 0)
|
|
236
|
-
console.log(` Modified: ${c.toolsModified.join(", ")}`);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function runPublish() {
|
|
241
|
-
const agentFile = getArg("--agent") || "./agent.json";
|
|
242
|
-
const outDir = getArg("--out") || "./dist";
|
|
243
|
-
const scope = getArg("--scope") || "@agentdef";
|
|
244
|
-
const previousAgentFile = getArg("--previous");
|
|
245
|
-
const dryRun = hasFlag("--dry-run");
|
|
246
|
-
const tag = getArg("--tag");
|
|
247
|
-
const access = getArg("--access") as "public" | "restricted" | undefined;
|
|
248
|
-
const registry = getArg("--registry");
|
|
249
|
-
|
|
250
|
-
if (!existsSync(resolve(agentFile))) {
|
|
251
|
-
console.error(`agent.json not found at ${resolve(agentFile)}`);
|
|
252
|
-
console.error("Run 'adk introspect' first, or specify --agent <path>");
|
|
253
|
-
process.exit(1);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
try {
|
|
257
|
-
const result = publish({
|
|
258
|
-
agentFile,
|
|
259
|
-
outDir,
|
|
260
|
-
scope,
|
|
261
|
-
previousAgentFile,
|
|
262
|
-
dryRun,
|
|
263
|
-
tag,
|
|
264
|
-
access,
|
|
265
|
-
registry,
|
|
266
|
-
});
|
|
267
|
-
console.log(
|
|
268
|
-
`\n\u2705 Published ${result.packageName}@${result.version} (hash: ${result.hash})`,
|
|
269
|
-
);
|
|
270
|
-
} catch (err) {
|
|
271
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
272
|
-
process.exit(1);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
async function runUse() {
|
|
277
|
-
const agentName = args[1];
|
|
278
|
-
|
|
279
|
-
if (!agentName) {
|
|
280
|
-
console.error(
|
|
281
|
-
"Error: agent name required.\n" +
|
|
282
|
-
" Example: adk use notion search_pages '{...}'",
|
|
283
|
-
);
|
|
284
|
-
process.exit(1);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const agentDir = findAgentDir(agentName);
|
|
288
|
-
if (!agentDir) {
|
|
289
|
-
console.error(
|
|
290
|
-
`Error: agent '${agentName}' not found.\n` +
|
|
291
|
-
` Looked in: ${getAgentsDir()}\n` +
|
|
292
|
-
` Generate first: adk codegen --server '...' --name ${agentName}`,
|
|
293
|
-
);
|
|
294
|
-
process.exit(1);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (hasFlag("--list")) {
|
|
298
|
-
const tools = listAgentTools(agentDir);
|
|
299
|
-
console.log(`Tools for ${agentName}:\n`);
|
|
300
|
-
for (const t of tools) {
|
|
301
|
-
console.log(` ${t.name.padEnd(30)} ${t.description ?? ""}`);
|
|
302
|
-
}
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
const toolName = args[2];
|
|
307
|
-
if (!toolName) {
|
|
308
|
-
console.error(
|
|
309
|
-
`Error: tool name required.\n Example: adk use ${agentName} <tool> [params]\n List tools: adk use ${agentName} --list`,
|
|
310
|
-
);
|
|
311
|
-
process.exit(1);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const paramsStr = args[3];
|
|
315
|
-
const params = paramsStr ? JSON.parse(paramsStr) : {};
|
|
316
|
-
|
|
317
|
-
try {
|
|
318
|
-
const result = await useAgent({
|
|
319
|
-
agentDir,
|
|
320
|
-
tool: toolName,
|
|
321
|
-
params,
|
|
322
|
-
});
|
|
323
|
-
console.log(JSON.stringify(result, null, 2));
|
|
324
|
-
} catch (err) {
|
|
325
|
-
console.error(
|
|
326
|
-
`\x1b[31mError:\x1b[0m ${err instanceof Error ? err.message : String(err)}`,
|
|
327
|
-
);
|
|
328
|
-
process.exit(1);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function runList() {
|
|
333
|
-
const agentsDir = getAgentsDir();
|
|
334
|
-
|
|
335
|
-
if (!existsSync(agentsDir)) {
|
|
336
|
-
console.log("No generated agents found.");
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const entries = readdirSync(agentsDir);
|
|
341
|
-
const agents: { name: string; tools: number; server?: string }[] = [];
|
|
342
|
-
|
|
343
|
-
for (const entry of entries) {
|
|
344
|
-
const manifestPath = join(agentsDir, entry, ".codegen-manifest.json");
|
|
345
|
-
if (existsSync(manifestPath)) {
|
|
346
|
-
try {
|
|
347
|
-
const manifest: CodegenManifest = JSON.parse(
|
|
348
|
-
require("node:fs").readFileSync(manifestPath, "utf-8"),
|
|
349
|
-
);
|
|
350
|
-
agents.push({
|
|
351
|
-
name: manifest.agentPath,
|
|
352
|
-
tools: manifest.tools.length,
|
|
353
|
-
server: manifest.serverInfo.name,
|
|
354
|
-
});
|
|
355
|
-
} catch {
|
|
356
|
-
agents.push({ name: entry, tools: 0 });
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (agents.length === 0) {
|
|
362
|
-
console.log("No generated agents found.");
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
console.log("Generated agents:\n");
|
|
367
|
-
for (const a of agents) {
|
|
368
|
-
console.log(
|
|
369
|
-
` ${a.name.padEnd(25)} ${String(a.tools).padEnd(5)} tools${a.server ? ` (${a.server})` : ""}`,
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// ============================================
|
|
375
|
-
// Registry CLI
|
|
376
|
-
// ============================================
|
|
377
|
-
|
|
378
|
-
// ============================================
|
|
379
|
-
// Proxy CLI
|
|
380
|
-
// ============================================
|
|
381
|
-
|
|
382
118
|
async function runProxy() {
|
|
383
119
|
const op = args[1];
|
|
384
120
|
const adk = getAdk();
|
|
@@ -547,6 +283,31 @@ async function runRef() {
|
|
|
547
283
|
console.log(`\n Auth required: ${security.type}`);
|
|
548
284
|
console.log(` Run: adk ref auth ${alias ?? refArg}`);
|
|
549
285
|
}
|
|
286
|
+
|
|
287
|
+
// Materialize local docs
|
|
288
|
+
const configDir = process.env.ADK_CONFIG_DIR ?? join(homedir(), ".adk");
|
|
289
|
+
const refDisplayName = alias ?? refArg;
|
|
290
|
+
try {
|
|
291
|
+
const result = await materializeRef(adk, refDisplayName, configDir);
|
|
292
|
+
if (result.toolCount > 0) {
|
|
293
|
+
console.log(`\x1b[32m\u2713\x1b[0m Materialized ${result.toolCount} tool schemas`);
|
|
294
|
+
}
|
|
295
|
+
if (result.skillCount > 0) {
|
|
296
|
+
console.log(`\x1b[32m\u2713\x1b[0m Downloaded ${result.skillCount} skill files`);
|
|
297
|
+
}
|
|
298
|
+
if (result.typesGenerated) {
|
|
299
|
+
console.log(`\x1b[32m\u2713\x1b[0m Generated TypeScript types`);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Per-ref skills removed — refs are discovered via refs/<name>/ in config dir
|
|
303
|
+
const config = await adk.readConfig();
|
|
304
|
+
const targets = (config as any).targets as string[] | undefined;
|
|
305
|
+
if (!targets || targets.length === 0) {
|
|
306
|
+
console.log(`\nRun \`adk init\` to install skills for your coding agents.`);
|
|
307
|
+
}
|
|
308
|
+
} catch {
|
|
309
|
+
// Materialization is best-effort, don't fail the ref add
|
|
310
|
+
}
|
|
550
311
|
} catch (err) {
|
|
551
312
|
if (err instanceof AdkError) {
|
|
552
313
|
console.error(err.toAgentString());
|
|
@@ -699,6 +460,29 @@ async function runRef() {
|
|
|
699
460
|
// ============================================
|
|
700
461
|
|
|
701
462
|
switch (command) {
|
|
463
|
+
case "init": {
|
|
464
|
+
const adk = getAdk();
|
|
465
|
+
const targets = args
|
|
466
|
+
.slice(1)
|
|
467
|
+
.filter((_, i, arr) => i > 0 && arr[i - 1] === "--target")
|
|
468
|
+
.concat(
|
|
469
|
+
// Also grab positional --target values
|
|
470
|
+
args.reduce<string[]>((acc, arg, i) => {
|
|
471
|
+
if (arg === "--target" && args[i + 1]) acc.push(args[i + 1]);
|
|
472
|
+
return acc;
|
|
473
|
+
}, []),
|
|
474
|
+
)
|
|
475
|
+
// Deduplicate
|
|
476
|
+
.filter((v, i, a) => a.indexOf(v) === i)
|
|
477
|
+
.map(parseTarget);
|
|
478
|
+
await runInit(adk, targets);
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
case "config-path": {
|
|
482
|
+
const dir = process.env.ADK_CONFIG_DIR ?? join(homedir(), ".adk");
|
|
483
|
+
console.log(dir);
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
702
486
|
case "error": {
|
|
703
487
|
const errorId = args[1];
|
|
704
488
|
if (!errorId) {
|
|
@@ -725,24 +509,6 @@ switch (command) {
|
|
|
725
509
|
case "ref":
|
|
726
510
|
await runRef();
|
|
727
511
|
break;
|
|
728
|
-
case "codegen":
|
|
729
|
-
await runCodegen();
|
|
730
|
-
break;
|
|
731
|
-
case "introspect":
|
|
732
|
-
await runIntrospect();
|
|
733
|
-
break;
|
|
734
|
-
case "pack":
|
|
735
|
-
runPack();
|
|
736
|
-
break;
|
|
737
|
-
case "publish":
|
|
738
|
-
runPublish();
|
|
739
|
-
break;
|
|
740
|
-
case "use":
|
|
741
|
-
await runUse();
|
|
742
|
-
break;
|
|
743
|
-
case "list":
|
|
744
|
-
runList();
|
|
745
|
-
break;
|
|
746
512
|
case "--help":
|
|
747
513
|
case "-h":
|
|
748
514
|
case undefined:
|
package/src/config-store.ts
CHANGED
|
@@ -1086,10 +1086,12 @@ export function createAdk(fs: FsStore, options: AdkOptions = {}): Adk {
|
|
|
1086
1086
|
const state = btoa(JSON.stringify(statePayload));
|
|
1087
1087
|
|
|
1088
1088
|
const securityExt2 = security as { requiredScopes?: string[]; optionalScopes?: string[] };
|
|
1089
|
+
const flowScopes = (authCodeFlow as Record<string, unknown>).scopes as Record<string, string> | undefined;
|
|
1089
1090
|
const agentScopes = [
|
|
1090
1091
|
...(securityExt2.requiredScopes ?? []),
|
|
1092
|
+
...(flowScopes ? Object.keys(flowScopes) : []),
|
|
1091
1093
|
...(opts?.scopes ?? []),
|
|
1092
|
-
];
|
|
1094
|
+
].filter((v, i, a) => a.indexOf(v) === i);
|
|
1093
1095
|
const scopes = agentScopes.length > 0
|
|
1094
1096
|
? [
|
|
1095
1097
|
...agentScopes,
|