@slashfi/agents-sdk 0.73.0 → 0.74.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-tools.d.ts +1 -1
- package/dist/adk-tools.d.ts.map +1 -1
- package/dist/adk-tools.js +122 -26
- package/dist/adk-tools.js.map +1 -1
- package/dist/cjs/adk-tools.js +122 -26
- package/dist/cjs/adk-tools.js.map +1 -1
- package/dist/cjs/config-store.js +10 -1
- package/dist/cjs/config-store.js.map +1 -1
- package/dist/cjs/define-config.js +9 -2
- package/dist/cjs/define-config.js.map +1 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +10 -1
- package/dist/config-store.js.map +1 -1
- package/dist/define-config.d.ts +23 -3
- package/dist/define-config.d.ts.map +1 -1
- package/dist/define-config.js +9 -2
- package/dist/define-config.js.map +1 -1
- package/dist/validate.d.ts +8 -8
- package/package.json +1 -1
- package/src/adk-tools.ts +177 -36
- package/src/config-store.ts +9 -1
- package/src/define-config.ts +25 -4
- package/src/ref-naming.test.ts +351 -0
package/dist/adk-tools.d.ts
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* });
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
import type { ToolDefinition, ToolContext } from "./types.js";
|
|
20
19
|
import type { Adk } from "./config-store.js";
|
|
20
|
+
import type { ToolContext, ToolDefinition } from "./types.js";
|
|
21
21
|
export interface AdkToolsHooks<TCtx extends ToolContext = ToolContext> {
|
|
22
22
|
/**
|
|
23
23
|
* Return extra context to embed in the OAuth state parameter.
|
package/dist/adk-tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adk-tools.d.ts","sourceRoot":"","sources":["../src/adk-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"adk-tools.d.ts","sourceRoot":"","sources":["../src/adk-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,WAAW,aAAa,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW;IACnE;;;;;;;;;OASG;IACH,mBAAmB,CAAC,EAAE,CACpB,GAAG,EAAE,IAAI,KACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,qBAAqB,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW;IAC3E;;;OAGG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,IAAI,KAAK,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3E,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,EACnE,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,GAChC,cAAc,CAAC,IAAI,CAAC,EAAE,CAqRxB"}
|
package/dist/adk-tools.js
CHANGED
|
@@ -20,32 +20,88 @@ import { defineTool } from "./define.js";
|
|
|
20
20
|
export function createAdkTools(opts) {
|
|
21
21
|
const { resolveScope, scopes } = opts;
|
|
22
22
|
const scopeSchema = scopes
|
|
23
|
-
? {
|
|
23
|
+
? {
|
|
24
|
+
type: "string",
|
|
25
|
+
enum: scopes,
|
|
26
|
+
description: "Config scope to operate on",
|
|
27
|
+
}
|
|
24
28
|
: { type: "string", description: "Config scope (optional)" };
|
|
25
29
|
const refTool = defineTool({
|
|
26
30
|
name: "ref",
|
|
27
|
-
description: "Manage agent refs. Operations: add, remove, list, update, inspect, call, auth, auth-status, refresh-token, resources, read.",
|
|
31
|
+
description: "Manage agent refs. Operations: add, remove, list, update, inspect, call, auth, auth-status, refresh-token, resources, read. For `add`, supply `ref` (canonical agent path, e.g. 'notion') and optionally `name` for a local alias; either one uniquely identifies the ref. For every other operation, pass `name` (the local identifier you used on add — defaults to `ref` when you didn't set it explicitly).",
|
|
28
32
|
inputSchema: {
|
|
29
33
|
type: "object",
|
|
30
34
|
properties: {
|
|
31
35
|
operation: {
|
|
32
36
|
type: "string",
|
|
33
|
-
enum: [
|
|
37
|
+
enum: [
|
|
38
|
+
"add",
|
|
39
|
+
"remove",
|
|
40
|
+
"list",
|
|
41
|
+
"update",
|
|
42
|
+
"inspect",
|
|
43
|
+
"call",
|
|
44
|
+
"auth",
|
|
45
|
+
"auth-status",
|
|
46
|
+
"refresh-token",
|
|
47
|
+
"resources",
|
|
48
|
+
"read",
|
|
49
|
+
],
|
|
34
50
|
},
|
|
35
51
|
scope: scopeSchema,
|
|
36
|
-
ref: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
ref: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Canonical agent path on the remote registry (e.g. 'notion', 'linear', 'github'). Used by `add` to identify which agent definition to connect to. Other operations use `name` instead. If you call `add` with only `name` and no `ref`, `ref` defaults to `name`.",
|
|
55
|
+
},
|
|
56
|
+
name: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Local identifier for this ref, used by all operations except `add` to look up the entry. On `add`, `name` is optional — it only needs to differ from `ref` when you want multiple local instances of the same agent (e.g. `{ ref: 'notion', name: 'work-notion' }`). Omit it and the ref is identified by its canonical path.",
|
|
59
|
+
},
|
|
60
|
+
scheme: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "Connection scheme: 'mcp' (direct MCP server), 'https' (REST proxy), or 'registry' (discovered via a registry). Auto-inferred from `url` or `sourceRegistry` when omitted.",
|
|
63
|
+
},
|
|
64
|
+
url: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Direct URL to the agent (e.g. https://mcp.notion.com/mcp). Required for 'mcp' and 'https' schemes.",
|
|
67
|
+
},
|
|
68
|
+
sourceRegistry: {
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: {
|
|
71
|
+
url: { type: "string" },
|
|
72
|
+
agentPath: { type: "string" },
|
|
73
|
+
},
|
|
74
|
+
description: "When scheme is 'registry', the registry + agent path to resolve through.",
|
|
75
|
+
},
|
|
76
|
+
config: {
|
|
77
|
+
type: "object",
|
|
78
|
+
description: "Per-instance config passed to the agent (headers, credentials, etc.). Supports `{{secret-uri}}` templates.",
|
|
79
|
+
},
|
|
80
|
+
tool: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "For `call` operation: the tool name on the ref to invoke.",
|
|
83
|
+
},
|
|
84
|
+
params: {
|
|
85
|
+
type: "object",
|
|
86
|
+
description: "For `call` operation: arguments to pass to the tool.",
|
|
87
|
+
},
|
|
88
|
+
full: {
|
|
89
|
+
type: "boolean",
|
|
90
|
+
description: "For `inspect` operation: include full agent definition.",
|
|
91
|
+
},
|
|
92
|
+
uris: {
|
|
93
|
+
type: "array",
|
|
94
|
+
items: { type: "string" },
|
|
95
|
+
description: "For `read` operation: the resource URIs to read.",
|
|
96
|
+
},
|
|
97
|
+
apiKey: {
|
|
98
|
+
type: "string",
|
|
99
|
+
description: "For `auth` operation: pre-provisioned API key.",
|
|
100
|
+
},
|
|
101
|
+
credentials: {
|
|
102
|
+
type: "object",
|
|
103
|
+
description: "For `auth` operation: key-value map of credential fields (keys match field names from the auth challenge).",
|
|
104
|
+
},
|
|
49
105
|
},
|
|
50
106
|
required: ["operation"],
|
|
51
107
|
},
|
|
@@ -54,28 +110,53 @@ export function createAdkTools(opts) {
|
|
|
54
110
|
const op = input.operation;
|
|
55
111
|
switch (op) {
|
|
56
112
|
case "add": {
|
|
57
|
-
|
|
113
|
+
// Accept `ref` or `name` (or both). If only one is given, the
|
|
114
|
+
// other defaults to it. This matches the "Add a ref called X"
|
|
115
|
+
// natural-language phrasing — LLMs that pick `name` get the
|
|
116
|
+
// same behavior as ones that pick `ref`, eliminating
|
|
117
|
+
// non-determinism on the identifier field. Throws when both
|
|
118
|
+
// are missing, so misuse is loud instead of silently storing
|
|
119
|
+
// `{ ref: undefined }`.
|
|
120
|
+
const refValue = (input.ref ?? input.name);
|
|
121
|
+
if (!refValue) {
|
|
122
|
+
throw new Error("ref.add: must supply either 'ref' (canonical agent path) or 'name' (local identifier); both may be the same string for the common single-instance case.");
|
|
123
|
+
}
|
|
124
|
+
const entry = { ref: refValue };
|
|
58
125
|
if (input.scheme)
|
|
59
126
|
entry.scheme = input.scheme;
|
|
60
127
|
if (input.url)
|
|
61
128
|
entry.url = input.url;
|
|
62
|
-
|
|
63
|
-
|
|
129
|
+
// Only store `name` when it's meaningfully different from
|
|
130
|
+
// `ref` (the multi-instance aliasing case). Avoids a
|
|
131
|
+
// redundant `{ name: 'notion', ref: 'notion' }` stored shape.
|
|
132
|
+
const nameValue = input.name;
|
|
133
|
+
if (nameValue && nameValue !== refValue) {
|
|
134
|
+
entry.name = nameValue;
|
|
135
|
+
}
|
|
64
136
|
if (input.sourceRegistry)
|
|
65
137
|
entry.sourceRegistry = input.sourceRegistry;
|
|
66
138
|
if (input.config)
|
|
67
139
|
entry.config = input.config;
|
|
68
140
|
const { security } = await adk.ref.add(entry);
|
|
69
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
added: true,
|
|
143
|
+
ref: refValue,
|
|
144
|
+
name: (entry.name ?? refValue),
|
|
145
|
+
security,
|
|
146
|
+
};
|
|
70
147
|
}
|
|
71
148
|
case "remove":
|
|
72
149
|
return { removed: await adk.ref.remove(input.name) };
|
|
73
150
|
case "list":
|
|
74
151
|
return { refs: await adk.ref.list() };
|
|
75
152
|
case "update":
|
|
76
|
-
return {
|
|
153
|
+
return {
|
|
154
|
+
updated: await adk.ref.update(input.name, input),
|
|
155
|
+
};
|
|
77
156
|
case "inspect":
|
|
78
|
-
return await adk.ref.inspect(input.name, {
|
|
157
|
+
return await adk.ref.inspect(input.name, {
|
|
158
|
+
full: input.full,
|
|
159
|
+
});
|
|
79
160
|
case "call":
|
|
80
161
|
return await adk.ref.call(input.name, input.tool, input.params);
|
|
81
162
|
case "auth": {
|
|
@@ -110,7 +191,15 @@ export function createAdkTools(opts) {
|
|
|
110
191
|
properties: {
|
|
111
192
|
operation: {
|
|
112
193
|
type: "string",
|
|
113
|
-
enum: [
|
|
194
|
+
enum: [
|
|
195
|
+
"add",
|
|
196
|
+
"remove",
|
|
197
|
+
"list",
|
|
198
|
+
"update",
|
|
199
|
+
"browse",
|
|
200
|
+
"inspect",
|
|
201
|
+
"test",
|
|
202
|
+
],
|
|
114
203
|
},
|
|
115
204
|
scope: scopeSchema,
|
|
116
205
|
url: { type: "string" },
|
|
@@ -126,7 +215,10 @@ export function createAdkTools(opts) {
|
|
|
126
215
|
const op = input.operation;
|
|
127
216
|
switch (op) {
|
|
128
217
|
case "add": {
|
|
129
|
-
const entry = {
|
|
218
|
+
const entry = {
|
|
219
|
+
url: input.url,
|
|
220
|
+
name: input.name,
|
|
221
|
+
};
|
|
130
222
|
if (input.auth)
|
|
131
223
|
entry.auth = input.auth;
|
|
132
224
|
if (input.headers)
|
|
@@ -148,10 +240,14 @@ export function createAdkTools(opts) {
|
|
|
148
240
|
updates.auth = input.auth;
|
|
149
241
|
if (input.headers)
|
|
150
242
|
updates.headers = input.headers;
|
|
151
|
-
return {
|
|
243
|
+
return {
|
|
244
|
+
updated: await adk.registry.update(input.name, updates),
|
|
245
|
+
};
|
|
152
246
|
}
|
|
153
247
|
case "browse":
|
|
154
|
-
return {
|
|
248
|
+
return {
|
|
249
|
+
agents: await adk.registry.browse(input.name, input.query),
|
|
250
|
+
};
|
|
155
251
|
case "inspect":
|
|
156
252
|
return await adk.registry.inspect(input.name);
|
|
157
253
|
case "test":
|
package/dist/adk-tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adk-tools.js","sourceRoot":"","sources":["../src/adk-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"adk-tools.js","sourceRoot":"","sources":["../src/adk-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+BzC,MAAM,UAAU,cAAc,CAC5B,IAAiC;IAEjC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEtC,MAAM,WAAW,GAAG,MAAM;QACxB,CAAC,CAAC;YACE,IAAI,EAAE,QAAiB;YACvB,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,4BAA4B;SAC1C;QACH,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;IAExE,MAAM,OAAO,GAAG,UAAU,CAAC;QACzB,IAAI,EAAE,KAAK;QACX,WAAW,EACT,iZAAiZ;QACnZ,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE;wBACJ,KAAK;wBACL,QAAQ;wBACR,MAAM;wBACN,QAAQ;wBACR,SAAS;wBACT,MAAM;wBACN,MAAM;wBACN,aAAa;wBACb,eAAe;wBACf,WAAW;wBACX,MAAM;qBACP;iBACF;gBACD,KAAK,EAAE,WAAW;gBAClB,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,kQAAkQ;iBACrQ;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;o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IAAI;wBAAE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;oBAC1C,IAAI,KAAK,CAAC,OAAO;wBAAE,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;oBACnD,OAAO;wBACL,OAAO,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAChC,KAAK,CAAC,IAAc,EACpB,OAA4C,CAC7C;qBACF,CAAC;gBACJ,CAAC;gBACD,KAAK,QAAQ;oBACX,OAAO;wBACL,MAAM,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAC/B,KAAK,CAAC,IAAc,EACpB,KAAK,CAAC,KAAe,CACtB;qBACF,CAAC;gBACJ,KAAK,SAAS;oBACZ,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAc,CAAC,CAAC;gBAC1D,KAAK,MAAM;oBACT,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAc,CAAC,EAAE,CAAC;gBACpE;oBACE,MAAM,IAAI,KAAK,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,EAAE,YAA+C,CAAC,CAAC;AACpE,CAAC"}
|
package/dist/cjs/adk-tools.js
CHANGED
|
@@ -23,32 +23,88 @@ const define_js_1 = require("./define.js");
|
|
|
23
23
|
function createAdkTools(opts) {
|
|
24
24
|
const { resolveScope, scopes } = opts;
|
|
25
25
|
const scopeSchema = scopes
|
|
26
|
-
? {
|
|
26
|
+
? {
|
|
27
|
+
type: "string",
|
|
28
|
+
enum: scopes,
|
|
29
|
+
description: "Config scope to operate on",
|
|
30
|
+
}
|
|
27
31
|
: { type: "string", description: "Config scope (optional)" };
|
|
28
32
|
const refTool = (0, define_js_1.defineTool)({
|
|
29
33
|
name: "ref",
|
|
30
|
-
description: "Manage agent refs. Operations: add, remove, list, update, inspect, call, auth, auth-status, refresh-token, resources, read.",
|
|
34
|
+
description: "Manage agent refs. Operations: add, remove, list, update, inspect, call, auth, auth-status, refresh-token, resources, read. For `add`, supply `ref` (canonical agent path, e.g. 'notion') and optionally `name` for a local alias; either one uniquely identifies the ref. For every other operation, pass `name` (the local identifier you used on add — defaults to `ref` when you didn't set it explicitly).",
|
|
31
35
|
inputSchema: {
|
|
32
36
|
type: "object",
|
|
33
37
|
properties: {
|
|
34
38
|
operation: {
|
|
35
39
|
type: "string",
|
|
36
|
-
enum: [
|
|
40
|
+
enum: [
|
|
41
|
+
"add",
|
|
42
|
+
"remove",
|
|
43
|
+
"list",
|
|
44
|
+
"update",
|
|
45
|
+
"inspect",
|
|
46
|
+
"call",
|
|
47
|
+
"auth",
|
|
48
|
+
"auth-status",
|
|
49
|
+
"refresh-token",
|
|
50
|
+
"resources",
|
|
51
|
+
"read",
|
|
52
|
+
],
|
|
37
53
|
},
|
|
38
54
|
scope: scopeSchema,
|
|
39
|
-
ref: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
ref: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Canonical agent path on the remote registry (e.g. 'notion', 'linear', 'github'). Used by `add` to identify which agent definition to connect to. Other operations use `name` instead. If you call `add` with only `name` and no `ref`, `ref` defaults to `name`.",
|
|
58
|
+
},
|
|
59
|
+
name: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Local identifier for this ref, used by all operations except `add` to look up the entry. On `add`, `name` is optional — it only needs to differ from `ref` when you want multiple local instances of the same agent (e.g. `{ ref: 'notion', name: 'work-notion' }`). Omit it and the ref is identified by its canonical path.",
|
|
62
|
+
},
|
|
63
|
+
scheme: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Connection scheme: 'mcp' (direct MCP server), 'https' (REST proxy), or 'registry' (discovered via a registry). Auto-inferred from `url` or `sourceRegistry` when omitted.",
|
|
66
|
+
},
|
|
67
|
+
url: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Direct URL to the agent (e.g. https://mcp.notion.com/mcp). Required for 'mcp' and 'https' schemes.",
|
|
70
|
+
},
|
|
71
|
+
sourceRegistry: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
url: { type: "string" },
|
|
75
|
+
agentPath: { type: "string" },
|
|
76
|
+
},
|
|
77
|
+
description: "When scheme is 'registry', the registry + agent path to resolve through.",
|
|
78
|
+
},
|
|
79
|
+
config: {
|
|
80
|
+
type: "object",
|
|
81
|
+
description: "Per-instance config passed to the agent (headers, credentials, etc.). Supports `{{secret-uri}}` templates.",
|
|
82
|
+
},
|
|
83
|
+
tool: {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "For `call` operation: the tool name on the ref to invoke.",
|
|
86
|
+
},
|
|
87
|
+
params: {
|
|
88
|
+
type: "object",
|
|
89
|
+
description: "For `call` operation: arguments to pass to the tool.",
|
|
90
|
+
},
|
|
91
|
+
full: {
|
|
92
|
+
type: "boolean",
|
|
93
|
+
description: "For `inspect` operation: include full agent definition.",
|
|
94
|
+
},
|
|
95
|
+
uris: {
|
|
96
|
+
type: "array",
|
|
97
|
+
items: { type: "string" },
|
|
98
|
+
description: "For `read` operation: the resource URIs to read.",
|
|
99
|
+
},
|
|
100
|
+
apiKey: {
|
|
101
|
+
type: "string",
|
|
102
|
+
description: "For `auth` operation: pre-provisioned API key.",
|
|
103
|
+
},
|
|
104
|
+
credentials: {
|
|
105
|
+
type: "object",
|
|
106
|
+
description: "For `auth` operation: key-value map of credential fields (keys match field names from the auth challenge).",
|
|
107
|
+
},
|
|
52
108
|
},
|
|
53
109
|
required: ["operation"],
|
|
54
110
|
},
|
|
@@ -57,28 +113,53 @@ function createAdkTools(opts) {
|
|
|
57
113
|
const op = input.operation;
|
|
58
114
|
switch (op) {
|
|
59
115
|
case "add": {
|
|
60
|
-
|
|
116
|
+
// Accept `ref` or `name` (or both). If only one is given, the
|
|
117
|
+
// other defaults to it. This matches the "Add a ref called X"
|
|
118
|
+
// natural-language phrasing — LLMs that pick `name` get the
|
|
119
|
+
// same behavior as ones that pick `ref`, eliminating
|
|
120
|
+
// non-determinism on the identifier field. Throws when both
|
|
121
|
+
// are missing, so misuse is loud instead of silently storing
|
|
122
|
+
// `{ ref: undefined }`.
|
|
123
|
+
const refValue = (input.ref ?? input.name);
|
|
124
|
+
if (!refValue) {
|
|
125
|
+
throw new Error("ref.add: must supply either 'ref' (canonical agent path) or 'name' (local identifier); both may be the same string for the common single-instance case.");
|
|
126
|
+
}
|
|
127
|
+
const entry = { ref: refValue };
|
|
61
128
|
if (input.scheme)
|
|
62
129
|
entry.scheme = input.scheme;
|
|
63
130
|
if (input.url)
|
|
64
131
|
entry.url = input.url;
|
|
65
|
-
|
|
66
|
-
|
|
132
|
+
// Only store `name` when it's meaningfully different from
|
|
133
|
+
// `ref` (the multi-instance aliasing case). Avoids a
|
|
134
|
+
// redundant `{ name: 'notion', ref: 'notion' }` stored shape.
|
|
135
|
+
const nameValue = input.name;
|
|
136
|
+
if (nameValue && nameValue !== refValue) {
|
|
137
|
+
entry.name = nameValue;
|
|
138
|
+
}
|
|
67
139
|
if (input.sourceRegistry)
|
|
68
140
|
entry.sourceRegistry = input.sourceRegistry;
|
|
69
141
|
if (input.config)
|
|
70
142
|
entry.config = input.config;
|
|
71
143
|
const { security } = await adk.ref.add(entry);
|
|
72
|
-
return {
|
|
144
|
+
return {
|
|
145
|
+
added: true,
|
|
146
|
+
ref: refValue,
|
|
147
|
+
name: (entry.name ?? refValue),
|
|
148
|
+
security,
|
|
149
|
+
};
|
|
73
150
|
}
|
|
74
151
|
case "remove":
|
|
75
152
|
return { removed: await adk.ref.remove(input.name) };
|
|
76
153
|
case "list":
|
|
77
154
|
return { refs: await adk.ref.list() };
|
|
78
155
|
case "update":
|
|
79
|
-
return {
|
|
156
|
+
return {
|
|
157
|
+
updated: await adk.ref.update(input.name, input),
|
|
158
|
+
};
|
|
80
159
|
case "inspect":
|
|
81
|
-
return await adk.ref.inspect(input.name, {
|
|
160
|
+
return await adk.ref.inspect(input.name, {
|
|
161
|
+
full: input.full,
|
|
162
|
+
});
|
|
82
163
|
case "call":
|
|
83
164
|
return await adk.ref.call(input.name, input.tool, input.params);
|
|
84
165
|
case "auth": {
|
|
@@ -113,7 +194,15 @@ function createAdkTools(opts) {
|
|
|
113
194
|
properties: {
|
|
114
195
|
operation: {
|
|
115
196
|
type: "string",
|
|
116
|
-
enum: [
|
|
197
|
+
enum: [
|
|
198
|
+
"add",
|
|
199
|
+
"remove",
|
|
200
|
+
"list",
|
|
201
|
+
"update",
|
|
202
|
+
"browse",
|
|
203
|
+
"inspect",
|
|
204
|
+
"test",
|
|
205
|
+
],
|
|
117
206
|
},
|
|
118
207
|
scope: scopeSchema,
|
|
119
208
|
url: { type: "string" },
|
|
@@ -129,7 +218,10 @@ function createAdkTools(opts) {
|
|
|
129
218
|
const op = input.operation;
|
|
130
219
|
switch (op) {
|
|
131
220
|
case "add": {
|
|
132
|
-
const entry = {
|
|
221
|
+
const entry = {
|
|
222
|
+
url: input.url,
|
|
223
|
+
name: input.name,
|
|
224
|
+
};
|
|
133
225
|
if (input.auth)
|
|
134
226
|
entry.auth = input.auth;
|
|
135
227
|
if (input.headers)
|
|
@@ -151,10 +243,14 @@ function createAdkTools(opts) {
|
|
|
151
243
|
updates.auth = input.auth;
|
|
152
244
|
if (input.headers)
|
|
153
245
|
updates.headers = input.headers;
|
|
154
|
-
return {
|
|
246
|
+
return {
|
|
247
|
+
updated: await adk.registry.update(input.name, updates),
|
|
248
|
+
};
|
|
155
249
|
}
|
|
156
250
|
case "browse":
|
|
157
|
-
return {
|
|
251
|
+
return {
|
|
252
|
+
agents: await adk.registry.browse(input.name, input.query),
|
|
253
|
+
};
|
|
158
254
|
case "inspect":
|
|
159
255
|
return await adk.registry.inspect(input.name);
|
|
160
256
|
case "test":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adk-tools.js","sourceRoot":"","sources":["../../src/adk-tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;
|
|
1
|
+
{"version":3,"file":"adk-tools.js","sourceRoot":"","sources":["../../src/adk-tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAmCH,wCAuRC;AAtTD,2CAAyC;AA+BzC,SAAgB,cAAc,CAC5B,IAAiC;IAEjC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEtC,MAAM,WAAW,GAAG,MAAM;QACxB,CAAC,CAAC;YACE,IAAI,EAAE,QAAiB;YACvB,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,4BAA4B;SAC1C;QACH,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;IAExE,MAAM,OAAO,GAAG,IAAA,sBAAU,EAAC;QACzB,IAAI,EAAE,KAAK;QACX,WAAW,EACT,iZAAiZ;QACnZ,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE;wBACJ,KAAK;wBACL,QAAQ;wBACR,MAAM;wBACN,QAAQ;wBACR,SAAS;wBACT,MAAM;wBACN,MAAM;wBACN,aAAa;wBACb,eAAe;wBACf,WAAW;wBACX,MAAM;qBACP;iBACF;gBACD,KAAK,EAAE,WAAW;gBAClB,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,kQAAkQ;iBACrQ;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,+TAA+T;iBAClU;gBACD,MAAM,EAAE;oBACN,IAAI,EAA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AC;oBAC1C,IAAI,KAAK,CAAC,OAAO;wBAAE,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;oBACnD,OAAO;wBACL,OAAO,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAChC,KAAK,CAAC,IAAc,EACpB,OAA4C,CAC7C;qBACF,CAAC;gBACJ,CAAC;gBACD,KAAK,QAAQ;oBACX,OAAO;wBACL,MAAM,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAC/B,KAAK,CAAC,IAAc,EACpB,KAAK,CAAC,KAAe,CACtB;qBACF,CAAC;gBACJ,KAAK,SAAS;oBACZ,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAc,CAAC,CAAC;gBAC1D,KAAK,MAAM;oBACT,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAc,CAAC,EAAE,CAAC;gBACpE;oBACE,MAAM,IAAI,KAAK,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,EAAE,YAA+C,CAAC,CAAC;AACpE,CAAC"}
|
package/dist/cjs/config-store.js
CHANGED
|
@@ -672,8 +672,17 @@ function createAdk(fs, options = {}) {
|
|
|
672
672
|
const updated = { ...r };
|
|
673
673
|
if (updates.url)
|
|
674
674
|
updated.url = updates.url;
|
|
675
|
-
|
|
675
|
+
// Rename: prefer `name`, fall back to legacy `as`. When the
|
|
676
|
+
// caller passes `name`, clear the legacy `as` so the stored
|
|
677
|
+
// entry has one source of truth.
|
|
678
|
+
if (updates.name !== undefined) {
|
|
679
|
+
updated.name = updates.name;
|
|
680
|
+
if (updated.as !== undefined)
|
|
681
|
+
updated.as = undefined;
|
|
682
|
+
}
|
|
683
|
+
else if (updates.as !== undefined) {
|
|
676
684
|
updated.as = updates.as;
|
|
685
|
+
}
|
|
677
686
|
if (updates.scheme)
|
|
678
687
|
updated.scheme = updates.scheme;
|
|
679
688
|
if (updates.config)
|