@slashfi/agents-sdk 0.78.0 → 0.80.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.js +90 -1
- package/dist/adk.js.map +1 -1
- package/dist/cjs/config-store.js +75 -0
- package/dist/cjs/config-store.js.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/materialize.js +37 -10
- package/dist/cjs/materialize.js.map +1 -1
- package/dist/cjs/search.js +406 -0
- package/dist/cjs/search.js.map +1 -0
- package/dist/config-store.d.ts +60 -4
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +74 -0
- package/dist/config-store.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/materialize.d.ts.map +1 -1
- package/dist/materialize.js +37 -10
- package/dist/materialize.js.map +1 -1
- package/dist/search.d.ts +185 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +396 -0
- package/dist/search.js.map +1 -0
- package/package.json +1 -1
- package/src/adk.ts +96 -1
- package/src/config-store.test.ts +154 -0
- package/src/config-store.ts +115 -4
- package/src/index.ts +2 -0
- package/src/materialize.ts +48 -10
- package/src/search.test.ts +406 -0
- package/src/search.ts +541 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* adk search — BM25 over materialized ref/tool docs.
|
|
4
|
+
*
|
|
5
|
+
* Walks `${configDir}/refs/` and indexes every ref + tool + skill found:
|
|
6
|
+
*
|
|
7
|
+
* `<configDir>/refs/<ref>/agent.json` → ref-level fields
|
|
8
|
+
* `<configDir>/refs/<ref>/entrypoint.md` → ref-level body
|
|
9
|
+
* `<configDir>/refs/<ref>/tools/<t>.tool.md` → per-tool body
|
|
10
|
+
* `<configDir>/refs/<ref>/tools/<t>.tool.json` → per-tool param names/descs
|
|
11
|
+
* `<configDir>/refs/<ref>/skills/<file>` → per-resource body
|
|
12
|
+
*
|
|
13
|
+
* Platform agents nest under `refs/agents/<@name>/`; integration refs sit
|
|
14
|
+
* directly at `refs/<name>/`. The walker handles both layouts.
|
|
15
|
+
*
|
|
16
|
+
* One BM25 document per ref + one per tool + one per skill resource. Tool
|
|
17
|
+
* and ref names get inserted multiple times into the document text so they
|
|
18
|
+
* outweigh surrounding prose without the BM25 implementation needing
|
|
19
|
+
* per-field weighting.
|
|
20
|
+
*
|
|
21
|
+
* Persistence: `adk sync` calls `writeSearchIndex(configDir)` to dump the
|
|
22
|
+
* raw BM25 docs + per-doc result metadata to `<configDir>/.search-index.json`.
|
|
23
|
+
* `searchRefs` prefers that file when it exists — `adk search` becomes a
|
|
24
|
+
* single file read + BM25 build (a few ms) instead of a recursive walk.
|
|
25
|
+
* Falls back to a fresh walk when the persisted file is missing or stale.
|
|
26
|
+
*
|
|
27
|
+
* The file is dot-prefixed so coding agents treat it as a hidden artifact
|
|
28
|
+
* and don't try to read it directly — they should use `adk search` instead.
|
|
29
|
+
*/
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.SEARCH_INDEX_FILENAME = void 0;
|
|
32
|
+
exports.buildSearchIndex = buildSearchIndex;
|
|
33
|
+
exports.searchIndexPath = searchIndexPath;
|
|
34
|
+
exports.writeSearchIndex = writeSearchIndex;
|
|
35
|
+
exports.readSearchIndex = readSearchIndex;
|
|
36
|
+
exports.searchRefs = searchRefs;
|
|
37
|
+
exports.renderResults = renderResults;
|
|
38
|
+
exports.refsRootExists = refsRootExists;
|
|
39
|
+
const node_fs_1 = require("node:fs");
|
|
40
|
+
const node_path_1 = require("node:path");
|
|
41
|
+
const bm25_js_1 = require("./bm25.js");
|
|
42
|
+
const INDEX_VERSION = 1;
|
|
43
|
+
/**
|
|
44
|
+
* Sibling to `refs/` and `adk.d.ts` in the config directory. Dot-prefixed
|
|
45
|
+
* so coding agents treat it as a hidden artifact rather than something
|
|
46
|
+
* they should read directly — agents should query through `adk search`.
|
|
47
|
+
*/
|
|
48
|
+
exports.SEARCH_INDEX_FILENAME = ".search-index.json";
|
|
49
|
+
// ============================================
|
|
50
|
+
// Index building (filesystem walk)
|
|
51
|
+
// ============================================
|
|
52
|
+
/**
|
|
53
|
+
* Walk `refsRoot` recursively. Every directory containing an `agent.json`
|
|
54
|
+
* is a materialized ref. Builds the unified BM25 docs + per-result metadata
|
|
55
|
+
* map used by both the live search path and the persisted index writer.
|
|
56
|
+
*
|
|
57
|
+
* Ids embed the kind so that `adk search`'s kind filters can apply post-rank
|
|
58
|
+
* without re-running BM25:
|
|
59
|
+
*
|
|
60
|
+
* `ref:<refName>`
|
|
61
|
+
* `tool:<refName>|<toolName>`
|
|
62
|
+
* `resource:<refName>|<fileName>`
|
|
63
|
+
*
|
|
64
|
+
* The `|` separator is safe because ref / tool / resource names use
|
|
65
|
+
* letters / numbers / `-` / `_` / `/` / `@` / `.` only.
|
|
66
|
+
*/
|
|
67
|
+
function buildSearchIndex(refsRoot) {
|
|
68
|
+
const docs = [];
|
|
69
|
+
const items = {};
|
|
70
|
+
function walk(dir) {
|
|
71
|
+
if (!(0, node_fs_1.existsSync)(dir))
|
|
72
|
+
return;
|
|
73
|
+
let entries;
|
|
74
|
+
try {
|
|
75
|
+
entries = (0, node_fs_1.readdirSync)(dir);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const agentJsonPath = (0, node_path_1.join)(dir, "agent.json");
|
|
81
|
+
if ((0, node_fs_1.existsSync)(agentJsonPath)) {
|
|
82
|
+
try {
|
|
83
|
+
const manifest = JSON.parse((0, node_fs_1.readFileSync)(agentJsonPath, "utf-8"));
|
|
84
|
+
const refName = manifest.name ?? (0, node_path_1.basename)(dir);
|
|
85
|
+
const description = manifest.description ?? "";
|
|
86
|
+
const toolCount = manifest.toolCount ?? manifest.tools?.length ?? 0;
|
|
87
|
+
const entrypointPath = (0, node_path_1.join)(dir, "entrypoint.md");
|
|
88
|
+
const entrypointBody = (0, node_fs_1.existsSync)(entrypointPath)
|
|
89
|
+
? (0, node_fs_1.readFileSync)(entrypointPath, "utf-8")
|
|
90
|
+
: "";
|
|
91
|
+
const refId = `ref:${refName}`;
|
|
92
|
+
docs.push({
|
|
93
|
+
id: refId,
|
|
94
|
+
text: [refName, refName, description, entrypointBody].join(" \n "),
|
|
95
|
+
});
|
|
96
|
+
items[refId] = {
|
|
97
|
+
kind: "ref",
|
|
98
|
+
ref: refName,
|
|
99
|
+
summary: description || refName,
|
|
100
|
+
docs: dir,
|
|
101
|
+
entrypoint: entrypointPath,
|
|
102
|
+
toolCount,
|
|
103
|
+
};
|
|
104
|
+
const toolsDir = (0, node_path_1.join)(dir, "tools");
|
|
105
|
+
if ((0, node_fs_1.existsSync)(toolsDir)) {
|
|
106
|
+
for (const file of (0, node_fs_1.readdirSync)(toolsDir)) {
|
|
107
|
+
if (!file.endsWith(".tool.md"))
|
|
108
|
+
continue;
|
|
109
|
+
const toolMdPath = (0, node_path_1.join)(toolsDir, file);
|
|
110
|
+
const toolJsonPath = toolMdPath.replace(/\.tool\.md$/, ".tool.json");
|
|
111
|
+
const md = (0, node_fs_1.readFileSync)(toolMdPath, "utf-8");
|
|
112
|
+
const summary = firstNonBlankLine(md, refName, file);
|
|
113
|
+
const tool = parseToolName(toolJsonPath, file);
|
|
114
|
+
const paramText = extractParamText(toolJsonPath);
|
|
115
|
+
// Repeat the high-signal terms (ref + tool name) so BM25
|
|
116
|
+
// ranks exact-name matches above ambient body matches.
|
|
117
|
+
const text = [
|
|
118
|
+
tool,
|
|
119
|
+
tool,
|
|
120
|
+
tool,
|
|
121
|
+
refName,
|
|
122
|
+
refName,
|
|
123
|
+
md,
|
|
124
|
+
paramText,
|
|
125
|
+
].join(" \n ");
|
|
126
|
+
const id = `tool:${refName}|${tool}`;
|
|
127
|
+
docs.push({ id, text });
|
|
128
|
+
items[id] = {
|
|
129
|
+
kind: "tool",
|
|
130
|
+
ref: refName,
|
|
131
|
+
tool,
|
|
132
|
+
summary,
|
|
133
|
+
docs: toolMdPath,
|
|
134
|
+
schema: toolJsonPath,
|
|
135
|
+
call: `adk ref call ${refName} ${tool} '{...}'`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Skills / resources written by `materializeRef` — text content
|
|
140
|
+
// synced from the registry's `read_resources` / `list_resources`
|
|
141
|
+
// surface. Indexed so `adk search` can surface ref-specific
|
|
142
|
+
// skill files (e.g. "writing pages" → notion's writing-pages.md).
|
|
143
|
+
const skillsDir = (0, node_path_1.join)(dir, "skills");
|
|
144
|
+
if ((0, node_fs_1.existsSync)(skillsDir)) {
|
|
145
|
+
for (const file of (0, node_fs_1.readdirSync)(skillsDir)) {
|
|
146
|
+
const path = (0, node_path_1.join)(skillsDir, file);
|
|
147
|
+
try {
|
|
148
|
+
if (!(0, node_fs_1.statSync)(path).isFile())
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
let body;
|
|
155
|
+
try {
|
|
156
|
+
body = (0, node_fs_1.readFileSync)(path, "utf-8");
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const summary = firstNonBlankLine(body, refName, file);
|
|
162
|
+
const text = [file, file, refName, refName, body].join(" \n ");
|
|
163
|
+
const id = `resource:${refName}|${file}`;
|
|
164
|
+
docs.push({ id, text });
|
|
165
|
+
items[id] = {
|
|
166
|
+
kind: "resource",
|
|
167
|
+
ref: refName,
|
|
168
|
+
resource: file,
|
|
169
|
+
summary,
|
|
170
|
+
docs: path,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// Malformed agent.json — skip this directory but keep walking.
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Recurse into subdirectories that aren't tool / skill / types output —
|
|
180
|
+
// those have no nested agents. Anything else (e.g. `agents/`) might
|
|
181
|
+
// hold platform-agent refs.
|
|
182
|
+
for (const entry of entries) {
|
|
183
|
+
const full = (0, node_path_1.join)(dir, entry);
|
|
184
|
+
let isDir;
|
|
185
|
+
try {
|
|
186
|
+
isDir = (0, node_fs_1.statSync)(full).isDirectory();
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (!isDir)
|
|
192
|
+
continue;
|
|
193
|
+
if (entry === "tools" || entry === "skills" || entry === "types")
|
|
194
|
+
continue;
|
|
195
|
+
walk(full);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
walk(refsRoot);
|
|
199
|
+
return {
|
|
200
|
+
version: INDEX_VERSION,
|
|
201
|
+
generatedAt: new Date().toISOString(),
|
|
202
|
+
docs,
|
|
203
|
+
items,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// ============================================
|
|
207
|
+
// Persistence
|
|
208
|
+
// ============================================
|
|
209
|
+
/** Resolve the persisted-index path for a given config directory. */
|
|
210
|
+
function searchIndexPath(configDir) {
|
|
211
|
+
return (0, node_path_1.join)(configDir, exports.SEARCH_INDEX_FILENAME);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Build and write the persisted index to `<configDir>/.search-index.json`.
|
|
215
|
+
* Called from `adk sync` so subsequent `adk search` invocations skip the
|
|
216
|
+
* recursive ref walk.
|
|
217
|
+
*/
|
|
218
|
+
function writeSearchIndex(configDir) {
|
|
219
|
+
const refsRoot = (0, node_path_1.join)(configDir, "refs");
|
|
220
|
+
const index = buildSearchIndex(refsRoot);
|
|
221
|
+
const path = searchIndexPath(configDir);
|
|
222
|
+
const dir = (0, node_path_1.dirname)(path);
|
|
223
|
+
if (!(0, node_fs_1.existsSync)(dir))
|
|
224
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
225
|
+
// Pretty-print in dev only; production indexes will be small enough
|
|
226
|
+
// that minified output isn't worth the readability cost.
|
|
227
|
+
(0, node_fs_1.writeFileSync)(path, `${JSON.stringify(index, null, 2)}\n`, "utf-8");
|
|
228
|
+
return { path, documentCount: index.docs.length };
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Read a persisted index. Returns `null` if the file is missing,
|
|
232
|
+
* unreadable, malformed, or written by an incompatible version.
|
|
233
|
+
*/
|
|
234
|
+
function readSearchIndex(configDir) {
|
|
235
|
+
const path = searchIndexPath(configDir);
|
|
236
|
+
if (!(0, node_fs_1.existsSync)(path))
|
|
237
|
+
return null;
|
|
238
|
+
try {
|
|
239
|
+
const raw = (0, node_fs_1.readFileSync)(path, "utf-8");
|
|
240
|
+
const parsed = JSON.parse(raw);
|
|
241
|
+
if (parsed?.version !== INDEX_VERSION)
|
|
242
|
+
return null;
|
|
243
|
+
if (!Array.isArray(parsed.docs))
|
|
244
|
+
return null;
|
|
245
|
+
if (!parsed.items || typeof parsed.items !== "object")
|
|
246
|
+
return null;
|
|
247
|
+
return parsed;
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/** Pick the first non-blank line of `body` as a one-line summary. */
|
|
254
|
+
function firstNonBlankLine(body, refName, fileName) {
|
|
255
|
+
for (const raw of body.split("\n")) {
|
|
256
|
+
const line = raw.trim();
|
|
257
|
+
if (!line)
|
|
258
|
+
continue;
|
|
259
|
+
if (line.startsWith("#"))
|
|
260
|
+
continue;
|
|
261
|
+
return line;
|
|
262
|
+
}
|
|
263
|
+
return `${refName}/${fileName}`;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Pull the actual tool name from the .tool.json. Falls back to the
|
|
267
|
+
* filename (without .tool.md) if the json is missing or unreadable —
|
|
268
|
+
* still useful as a search anchor even if not exact.
|
|
269
|
+
*/
|
|
270
|
+
function parseToolName(toolJsonPath, fileName) {
|
|
271
|
+
if ((0, node_fs_1.existsSync)(toolJsonPath)) {
|
|
272
|
+
try {
|
|
273
|
+
const obj = JSON.parse((0, node_fs_1.readFileSync)(toolJsonPath, "utf-8"));
|
|
274
|
+
if (typeof obj.name === "string" && obj.name.length > 0)
|
|
275
|
+
return obj.name;
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// fall through
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return fileName.replace(/\.tool\.md$/, "");
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Pull parameter names + descriptions out of a .tool.json's inputSchema.
|
|
285
|
+
* Surfaces them as plain text into the BM25 index so queries like
|
|
286
|
+
* "calendar event id" land on the right tool.
|
|
287
|
+
*/
|
|
288
|
+
function extractParamText(toolJsonPath) {
|
|
289
|
+
if (!(0, node_fs_1.existsSync)(toolJsonPath))
|
|
290
|
+
return "";
|
|
291
|
+
try {
|
|
292
|
+
const obj = JSON.parse((0, node_fs_1.readFileSync)(toolJsonPath, "utf-8"));
|
|
293
|
+
const parts = [];
|
|
294
|
+
if (obj.description)
|
|
295
|
+
parts.push(obj.description);
|
|
296
|
+
const props = obj.inputSchema?.properties ?? {};
|
|
297
|
+
for (const [name, info] of Object.entries(props)) {
|
|
298
|
+
parts.push(name);
|
|
299
|
+
if (typeof info?.description === "string")
|
|
300
|
+
parts.push(info.description);
|
|
301
|
+
}
|
|
302
|
+
return parts.join(" ");
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
return "";
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// ============================================
|
|
309
|
+
// Search
|
|
310
|
+
// ============================================
|
|
311
|
+
/**
|
|
312
|
+
* Run a BM25 search over the materialized refs.
|
|
313
|
+
*
|
|
314
|
+
* Prefers the persisted `<configDir>/search-index.json` (written by
|
|
315
|
+
* `adk sync`) when it exists — that path skips the recursive walk and
|
|
316
|
+
* runs in single-digit ms even with hundreds of tools. Falls back to a
|
|
317
|
+
* fresh walk of `refsRoot` when the persisted file is missing or stale.
|
|
318
|
+
*
|
|
319
|
+
* @param refsRoot The materialized refs directory (e.g. `~/.adk/refs`).
|
|
320
|
+
* We derive `<configDir>` from this as the parent so callers don't
|
|
321
|
+
* have to plumb both. Pass an `index` directly via `options.index` to
|
|
322
|
+
* bypass disk I/O entirely (used by tests).
|
|
323
|
+
*/
|
|
324
|
+
function searchRefs(refsRoot, query, options = {}) {
|
|
325
|
+
const index = options.index ??
|
|
326
|
+
readSearchIndex((0, node_path_1.dirname)(refsRoot)) ??
|
|
327
|
+
buildSearchIndex(refsRoot);
|
|
328
|
+
const bm25 = (0, bm25_js_1.createBM25Index)(index.docs);
|
|
329
|
+
const limit = options.limit ?? 10;
|
|
330
|
+
// Pull more raw hits than `limit` so the kind / ref filters below have
|
|
331
|
+
// headroom to drop irrelevant matches without short-changing the caller.
|
|
332
|
+
// 5x is plenty for typical 10-20 limits.
|
|
333
|
+
const raw = bm25.search(query, limit * 5);
|
|
334
|
+
const results = [];
|
|
335
|
+
for (const hit of raw) {
|
|
336
|
+
if (results.length >= limit)
|
|
337
|
+
break;
|
|
338
|
+
const item = index.items[hit.id];
|
|
339
|
+
if (!item)
|
|
340
|
+
continue;
|
|
341
|
+
if (options.toolsOnly && item.kind !== "tool")
|
|
342
|
+
continue;
|
|
343
|
+
if (options.refsOnly && item.kind !== "ref")
|
|
344
|
+
continue;
|
|
345
|
+
if (options.ref && !refMatches(options.ref, item.ref))
|
|
346
|
+
continue;
|
|
347
|
+
// Spread the stored item and tack on the query-time score. Each
|
|
348
|
+
// `item` matches one of the `SearchResult` variants by construction
|
|
349
|
+
// (see `buildSearchIndex`), so this is type-safe.
|
|
350
|
+
results.push({ ...item, score: hit.score });
|
|
351
|
+
}
|
|
352
|
+
return results;
|
|
353
|
+
}
|
|
354
|
+
/** Match `ref` filter loosely — accepts both bare names and `/agents/@…` paths. */
|
|
355
|
+
function refMatches(filter, ref) {
|
|
356
|
+
if (filter === ref)
|
|
357
|
+
return true;
|
|
358
|
+
// Allow `@clock` as a shorthand for `/agents/@clock`, and vice versa.
|
|
359
|
+
if (ref === `/agents/${filter}`)
|
|
360
|
+
return true;
|
|
361
|
+
if (`/agents/${ref}` === filter)
|
|
362
|
+
return true;
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
// ============================================
|
|
366
|
+
// CLI rendering
|
|
367
|
+
// ============================================
|
|
368
|
+
/** Concise human-readable rendering — one numbered block per result. */
|
|
369
|
+
function renderResults(results) {
|
|
370
|
+
if (results.length === 0)
|
|
371
|
+
return "No results.";
|
|
372
|
+
const blocks = [];
|
|
373
|
+
for (let i = 0; i < results.length; i++) {
|
|
374
|
+
const r = results[i];
|
|
375
|
+
const score = r.score.toFixed(2);
|
|
376
|
+
if (r.kind === "tool") {
|
|
377
|
+
blocks.push([
|
|
378
|
+
`${i + 1}. ${r.ref}.${r.tool} score=${score}`,
|
|
379
|
+
` ${r.summary}`,
|
|
380
|
+
` Docs: ${r.docs}`,
|
|
381
|
+
` Call: ${r.call}`,
|
|
382
|
+
].join("\n"));
|
|
383
|
+
}
|
|
384
|
+
else if (r.kind === "ref") {
|
|
385
|
+
blocks.push([
|
|
386
|
+
`${i + 1}. ${r.ref} (ref, ${r.toolCount} tools) score=${score}`,
|
|
387
|
+
` ${r.summary}`,
|
|
388
|
+
` Docs: ${r.docs}`,
|
|
389
|
+
].join("\n"));
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
blocks.push([
|
|
393
|
+
`${i + 1}. ${r.ref}/${r.resource} (resource) score=${score}`,
|
|
394
|
+
` ${r.summary}`,
|
|
395
|
+
` Docs: ${r.docs}`,
|
|
396
|
+
].join("\n"));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return blocks.join("\n\n");
|
|
400
|
+
}
|
|
401
|
+
// Local helpers — exposed so callers (the CLI) can detect a missing
|
|
402
|
+
// refs root and print a useful message instead of an empty result list.
|
|
403
|
+
function refsRootExists(refsRoot) {
|
|
404
|
+
return (0, node_fs_1.existsSync)(refsRoot) && (0, node_fs_1.statSync)(refsRoot).isDirectory();
|
|
405
|
+
}
|
|
406
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;AAyJH,4CAgJC;AAOD,0CAEC;AAOD,4CAaC;AAMD,0CAeC;AA8ED,gCAgCC;AAgBD,sCAkCC;AAID,wCAEC;AA/fD,qCAOiB;AACjB,yCAAoD;AACpD,uCAA4C;AAmH5C,MAAM,aAAa,GAAG,CAAU,CAAC;AACjC;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,oBAAoB,CAAC;AAE1D,+CAA+C;AAC/C,mCAAmC;AACnC,+CAA+C;AAE/C;;;;;;;;;;;;;;GAcG;AACH,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,IAAI,GAAmC,EAAE,CAAC;IAChD,MAAM,KAAK,GAA8B,EAAE,CAAC;IAE5C,SAAS,IAAI,CAAC,GAAW;QACvB,IAAI,CAAC,IAAA,oBAAU,EAAC,GAAG,CAAC;YAAE,OAAO;QAC7B,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,GAAG,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAAG,IAAA,gBAAI,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC9C,IAAI,IAAA,oBAAU,EAAC,aAAa,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,aAAa,EAAE,OAAO,CAAC,CAK/D,CAAC;gBACF,MAAM,OAAO,GAAG,QAAQ,CAAC,IA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AC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,SAAS,kBAAkB,KAAK,EAAE;gBACjE,MAAM,CAAC,CAAC,OAAO,EAAE;gBACjB,YAAY,CAAC,CAAC,IAAI,EAAE;aACrB,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CACT;gBACE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,QAAQ,uBAAuB,KAAK,EAAE;gBAC9D,MAAM,CAAC,CAAC,OAAO,EAAE;gBACjB,YAAY,CAAC,CAAC,IAAI,EAAE;aACrB,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,oEAAoE;AACpE,wEAAwE;AACxE,SAAgB,cAAc,CAAC,QAAgB;IAC7C,OAAO,IAAA,oBAAU,EAAC,QAAQ,CAAC,IAAI,IAAA,kBAAQ,EAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC"}
|
package/dist/config-store.d.ts
CHANGED
|
@@ -33,16 +33,48 @@ export interface RegistryCacheToolSummary {
|
|
|
33
33
|
description?: string;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
36
|
+
* Slim auth-field metadata cached so hosts can locally answer "is this
|
|
37
|
+
* ref ready to call?" without a registry round-trip. Mirrors the
|
|
38
|
+
* authoritative shape `auth-status` produces — same source of truth,
|
|
39
|
+
* just persisted.
|
|
40
|
+
*
|
|
41
|
+
* For each field name in the security scheme:
|
|
42
|
+
* - `required` — must end up satisfied for `ref.call` to work.
|
|
43
|
+
* - `automated` — adk fills this in itself (e.g. dynamic OAuth
|
|
44
|
+
* client registration). Doesn't need to be `present`
|
|
45
|
+
* in the user's config to count as satisfied.
|
|
46
|
+
*/
|
|
47
|
+
export interface RegistryCacheAuthField {
|
|
48
|
+
required: boolean;
|
|
49
|
+
automated: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Per-ref cache entry. Updated as a side-effect of `ref.add()`,
|
|
53
|
+
* `ref.inspect()`, and `ref.authStatus()` whenever the registry
|
|
54
|
+
* response carries description / tool / security-scheme info.
|
|
55
|
+
* Identity-relative (lives next to the consumer-config that issued
|
|
56
|
+
* the registry call), so permission-filtered views stay consistent.
|
|
40
57
|
*/
|
|
41
58
|
export interface RegistryCacheEntry {
|
|
42
59
|
/** Canonical agent path (e.g. `notion`). Stored for sanity/debug. */
|
|
43
60
|
ref: string;
|
|
44
61
|
description?: string;
|
|
45
62
|
tools?: RegistryCacheToolSummary[];
|
|
63
|
+
/**
|
|
64
|
+
* Auth field requirements derived from the registry's security
|
|
65
|
+
* scheme (extracted by `auth-status`). When present, hosts can
|
|
66
|
+
* compute "is this ref callable?" by intersecting these with the
|
|
67
|
+
* entry's `config` — no network round-trip needed. Absent when the
|
|
68
|
+
* scheme couldn't be fetched (e.g. registry was offline at add
|
|
69
|
+
* time); fall back to whatever heuristic the caller chooses.
|
|
70
|
+
*
|
|
71
|
+
* Note on proxy refs: when the entry is in `proxy` mode the
|
|
72
|
+
* security scheme is exposed by the *proxy*, and the answer to
|
|
73
|
+
* "is this callable?" lives server-side — `authFields` is omitted
|
|
74
|
+
* locally and hosts should treat proxy refs as authoritative
|
|
75
|
+
* regardless of entry-side fields.
|
|
76
|
+
*/
|
|
77
|
+
authFields?: Record<string, RegistryCacheAuthField>;
|
|
46
78
|
/** ISO timestamp of the most recent registry round-trip that wrote this. */
|
|
47
79
|
fetchedAt: string;
|
|
48
80
|
}
|
|
@@ -54,6 +86,30 @@ export interface RegistryCacheEntry {
|
|
|
54
86
|
export interface RegistryCache {
|
|
55
87
|
refs: Record<string, RegistryCacheEntry>;
|
|
56
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* "Is this ref ready to call?" answered locally using the cached
|
|
91
|
+
* security-scheme requirements. Mirrors the `complete` boolean
|
|
92
|
+
* `auth-status` returns, but doesn't need a network round-trip — the
|
|
93
|
+
* cached `authFields` capture what the registry said is required, and
|
|
94
|
+
* we evaluate satisfaction against the entry's current `config`.
|
|
95
|
+
*
|
|
96
|
+
* Behavior:
|
|
97
|
+
* - `mode: 'proxy'` refs → always true. Auth lives server-side; the
|
|
98
|
+
* proxy is the source of truth, no entry-side fields involved.
|
|
99
|
+
* - Cache miss (no `authFields` for this ref yet) → returns `null`,
|
|
100
|
+
* signaling "I don't know — caller should fall back to its own
|
|
101
|
+
* heuristic or call `auth-status` to populate the cache".
|
|
102
|
+
* - Cache hit → for every required, non-automated field, checks
|
|
103
|
+
* presence in `entry.config`. Mirrors the `present || resolvable`
|
|
104
|
+
* check in `auth-status` but evaluates against current config.
|
|
105
|
+
* `automated` fields (e.g. dynamic OAuth client_id) count as
|
|
106
|
+
* satisfied even when absent — adk supplies them at call time.
|
|
107
|
+
*
|
|
108
|
+
* Returning `null` for cache miss is intentional. A boolean would
|
|
109
|
+
* force callers to choose a default that's wrong half the time;
|
|
110
|
+
* `null` lets them branch explicitly.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isRefAuthComplete(entry: RefEntry, cacheEntry: RegistryCacheEntry | undefined): boolean | null;
|
|
57
113
|
/** Context passed to the resolveCredentials callback */
|
|
58
114
|
export interface ResolveCredentialsContext {
|
|
59
115
|
/** Ref name */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-store.d.ts","sourceRoot":"","sources":["../src/config-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EAEZ,MAAM,oBAAoB,CAA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,MAAM,EAAE,CAAC;QAClB;;;;WAIG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,GACA,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5B;;;;OAIG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;QACL,8DAA8D;QAC9D,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QACvC,8CAA8C;QAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClC;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,GAAG;IAClB,QAAQ,EAAE,cAAc,CAAC;IACzB,GAAG,EAAE,SAAS,CAAC;IACf,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACtC,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAC/D,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,OAAO,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACxC,CAAC,CAAC;CACJ;AAmLD,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,GAAE,UAAe,GAAG,GAAG,CA+6EpE"}
|
package/dist/config-store.js
CHANGED
|
@@ -24,6 +24,48 @@ import { createRegistryConsumer } from "./registry-consumer.js";
|
|
|
24
24
|
const CONFIG_PATH = "consumer-config.json";
|
|
25
25
|
const REGISTRY_CACHE_PATH = "registry-cache.json";
|
|
26
26
|
const SECRET_PREFIX = "secret:";
|
|
27
|
+
/**
|
|
28
|
+
* "Is this ref ready to call?" answered locally using the cached
|
|
29
|
+
* security-scheme requirements. Mirrors the `complete` boolean
|
|
30
|
+
* `auth-status` returns, but doesn't need a network round-trip — the
|
|
31
|
+
* cached `authFields` capture what the registry said is required, and
|
|
32
|
+
* we evaluate satisfaction against the entry's current `config`.
|
|
33
|
+
*
|
|
34
|
+
* Behavior:
|
|
35
|
+
* - `mode: 'proxy'` refs → always true. Auth lives server-side; the
|
|
36
|
+
* proxy is the source of truth, no entry-side fields involved.
|
|
37
|
+
* - Cache miss (no `authFields` for this ref yet) → returns `null`,
|
|
38
|
+
* signaling "I don't know — caller should fall back to its own
|
|
39
|
+
* heuristic or call `auth-status` to populate the cache".
|
|
40
|
+
* - Cache hit → for every required, non-automated field, checks
|
|
41
|
+
* presence in `entry.config`. Mirrors the `present || resolvable`
|
|
42
|
+
* check in `auth-status` but evaluates against current config.
|
|
43
|
+
* `automated` fields (e.g. dynamic OAuth client_id) count as
|
|
44
|
+
* satisfied even when absent — adk supplies them at call time.
|
|
45
|
+
*
|
|
46
|
+
* Returning `null` for cache miss is intentional. A boolean would
|
|
47
|
+
* force callers to choose a default that's wrong half the time;
|
|
48
|
+
* `null` lets them branch explicitly.
|
|
49
|
+
*/
|
|
50
|
+
export function isRefAuthComplete(entry, cacheEntry) {
|
|
51
|
+
if (typeof entry === "string")
|
|
52
|
+
return false;
|
|
53
|
+
if (entry.mode === "proxy")
|
|
54
|
+
return true;
|
|
55
|
+
const authFields = cacheEntry?.authFields;
|
|
56
|
+
if (!authFields)
|
|
57
|
+
return null;
|
|
58
|
+
const config = entry.config ?? {};
|
|
59
|
+
for (const [field, info] of Object.entries(authFields)) {
|
|
60
|
+
if (!info.required)
|
|
61
|
+
continue;
|
|
62
|
+
if (info.automated)
|
|
63
|
+
continue;
|
|
64
|
+
if (!(field in config))
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
27
69
|
// ============================================
|
|
28
70
|
// Internal helpers
|
|
29
71
|
// ============================================
|
|
@@ -253,6 +295,24 @@ export function createAdk(fs, options = {}) {
|
|
|
253
295
|
cache.refs[name] = entry;
|
|
254
296
|
await writeRegistryCache(cache);
|
|
255
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Merge `authFields` into an existing cache entry without clobbering
|
|
300
|
+
* description/tools, or create a minimal entry if one doesn't exist
|
|
301
|
+
* yet. Called from `authStatus` so the slim {required, automated}
|
|
302
|
+
* shape is always available for `isRefAuthComplete` to answer
|
|
303
|
+
* locally on subsequent calls.
|
|
304
|
+
*/
|
|
305
|
+
async function upsertRegistryCacheAuthFields(name, ref, authFields) {
|
|
306
|
+
const cache = await readRegistryCache();
|
|
307
|
+
const existing = cache.refs[name];
|
|
308
|
+
cache.refs[name] = {
|
|
309
|
+
...(existing ?? { ref, fetchedAt: new Date().toISOString() }),
|
|
310
|
+
authFields,
|
|
311
|
+
// Refresh fetchedAt so freshness telemetry stays accurate.
|
|
312
|
+
fetchedAt: new Date().toISOString(),
|
|
313
|
+
};
|
|
314
|
+
await writeRegistryCache(cache);
|
|
315
|
+
}
|
|
256
316
|
async function removeRegistryCacheEntry(name) {
|
|
257
317
|
const cache = await readRegistryCache();
|
|
258
318
|
if (!(name in cache.refs))
|
|
@@ -1642,6 +1702,20 @@ export function createAdk(fs, options = {}) {
|
|
|
1642
1702
|
};
|
|
1643
1703
|
}
|
|
1644
1704
|
const complete = Object.values(fields).every((f) => !f.required || f.present || f.resolvable);
|
|
1705
|
+
// Persist the slim {required, automated} per-field shape into the
|
|
1706
|
+
// registry cache so `isRefAuthComplete` can answer subsequent
|
|
1707
|
+
// host-side "is this ref ready?" checks without re-fetching the
|
|
1708
|
+
// security scheme. We deliberately omit `present`/`resolvable`
|
|
1709
|
+
// because those are computed against the current entry.config and
|
|
1710
|
+
// host environment — caching them would go stale immediately.
|
|
1711
|
+
const authFields = {};
|
|
1712
|
+
for (const [field, info] of Object.entries(fields)) {
|
|
1713
|
+
authFields[field] = {
|
|
1714
|
+
required: info.required,
|
|
1715
|
+
automated: info.automated,
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
await upsertRegistryCacheAuthFields(name, entry.ref, authFields);
|
|
1645
1719
|
return { name, security, complete, fields };
|
|
1646
1720
|
},
|
|
1647
1721
|
async auth(name, opts) {
|