@tool-bridge/server 0.10.1 → 0.13.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/{airtable-SLT4UDB3.js → airtable-E2TJFCGB.js} +4 -4
- package/dist/{alt_text_generator_ai-HCFYQNEN.js → alt_text_generator_ai-UBV5H2N3.js} +4 -4
- package/dist/{amap-ZOOTZCI2.js → amap-ASVRIYPW.js} +4 -4
- package/dist/{anthropic-IUWXKV76.js → anthropic-LQSJWGV3.js} +4 -4
- package/dist/{apify-HQXUP3ZL.js → apify-CL4YK6HT.js} +4 -4
- package/dist/{brave_search-HG5PMEDZ.js → brave_search-WZQF2QWE.js} +4 -4
- package/dist/{chunk-AWXZMW6M.js → chunk-4U5OQW7F.js} +126 -111
- package/dist/{chunk-V4VHC3Q6.js → chunk-BK2ZIWLD.js} +2 -2
- package/dist/{chunk-WIH5OHFG.js → chunk-HIROW6TB.js} +36 -35
- package/dist/{chunk-EMUJLM32.js → chunk-M4LHMRRY.js} +210 -154
- package/dist/{chunk-THDEI7S7.js → chunk-P4TQJHBO.js} +1 -1
- package/dist/{circleci-XA4GXPOT.js → circleci-EHGI2HKR.js} +4 -4
- package/dist/{clerk-MUAETUIY.js → clerk-OUN4SX22.js} +4 -4
- package/dist/{cloudflare_dns-BRYRH55W.js → cloudflare_dns-DMU3WOPG.js} +4 -4
- package/dist/{cohere-XKVGQJQH.js → cohere-3HDSCQIB.js} +4 -4
- package/dist/{confluence-SWP6UUEK.js → confluence-YPZXKQTQ.js} +4 -4
- package/dist/{convertapi-42FNXPAS.js → convertapi-47ENNUBY.js} +4 -4
- package/dist/{currencyapi-7IECLAKK.js → currencyapi-IX4ICDZA.js} +4 -4
- package/dist/{deepseek-VD3VY3D2.js → deepseek-SCOPJSA6.js} +4 -4
- package/dist/{docker_hub-YCEWCV5D.js → docker_hub-2DXJVAP4.js} +4 -4
- package/dist/{dropbox-KCAEQENT.js → dropbox-LE2OM2SR.js} +4 -4
- package/dist/{dub-AVLJI73G.js → dub-7LKKJADI.js} +4 -4
- package/dist/{e2b-NZPEKNY3.js → e2b-P3EOM65Q.js} +4 -4
- package/dist/{exa-MHHTRY4Y.js → exa-AETANJQ3.js} +4 -4
- package/dist/{fal_ai-VKVUKXE2.js → fal_ai-VWAMTEZE.js} +4 -4
- package/dist/{feishu-AFLX4VZX.js → feishu-VQMM3APW.js} +3 -3
- package/dist/{feishu_custom_bot-S4XJYZVB.js → feishu_custom_bot-HEK63AP3.js} +4 -4
- package/dist/{figma-6LBMPYPL.js → figma-7JMV3B5O.js} +4 -4
- package/dist/{firehydrant-JRAJ4CMG.js → firehydrant-SOU4P7SE.js} +4 -4
- package/dist/{fixer-BTWM3K4Z.js → fixer-KELXNOIQ.js} +4 -4
- package/dist/{fly-FUY25D36.js → fly-Y26QH6AC.js} +4 -4
- package/dist/{front-SFQD4V63.js → front-2RUHP54Y.js} +4 -4
- package/dist/{geocodio-JZTFWKOE.js → geocodio-BTSXWU55.js} +4 -4
- package/dist/{ghost-HNZTH6AR.js → ghost-BA55ISIU.js} +4 -4
- package/dist/{github-3J6ZYHGY.js → github-VUYFDSHK.js} +4 -4
- package/dist/{gmail-Y4GWZ2UJ.js → gmail-3Z2WCVLT.js} +4 -4
- package/dist/{googlecalendar-JK6B3ZCO.js → googlecalendar-LZKRUXHY.js} +4 -4
- package/dist/{googledocs-VERSNFGF.js → googledocs-RBK2HMPZ.js} +4 -4
- package/dist/{grafana-WABWHNKT.js → grafana-E626W3N3.js} +4 -4
- package/dist/{graphhopper-PWZOVQQF.js → graphhopper-YNURJCFZ.js} +4 -4
- package/dist/index.d.ts +7 -7
- package/dist/index.js +2 -2
- package/dist/{ip2proxy-IJKSNZVR.js → ip2proxy-4DAJUOUR.js} +4 -4
- package/dist/{ipgeolocation_io-I27LWP7M.js → ipgeolocation_io-3BUSFLVD.js} +4 -4
- package/dist/{ipqualityscore-THLB64L6.js → ipqualityscore-7DKMRMEQ.js} +4 -4
- package/dist/{jina_ai-KHC4WQAK.js → jina_ai-NXXZRPT6.js} +4 -4
- package/dist/{jira-NAGZYZLK.js → jira-UG7ZIKSW.js} +4 -4
- package/dist/{langsmith-5BZ4CAWL.js → langsmith-66IP4KJ6.js} +4 -4
- package/dist/{lemlist-4D5DLIWT.js → lemlist-MVB4EQMS.js} +4 -4
- package/dist/{linear-5A6IZTNW.js → linear-6UC3AFY3.js} +4 -4
- package/dist/{logsnag-Q7CU4J7A.js → logsnag-NFJM6O4U.js} +4 -4
- package/dist/main.js +102 -102
- package/dist/{mattermost-36YSAHMQ.js → mattermost-FTJER2B6.js} +4 -4
- package/dist/{mem0-EVJ7KY5E.js → mem0-RR5ALUKD.js} +4 -4
- package/dist/{memos-KDNZATPM.js → memos-WOAY3T76.js} +4 -4
- package/dist/{metabase-MRBJG473.js → metabase-ZYG7NBPU.js} +4 -4
- package/dist/{mistral_ai-PDT25XCR.js → mistral_ai-FTCSXHJ5.js} +4 -4
- package/dist/{mother_duck-MN3OHZDF.js → mother_duck-ZMIGT5ZK.js} +4 -4
- package/dist/{ngrok-PEGRSO2H.js → ngrok-TEDZ4WUB.js} +4 -4
- package/dist/{notes-UUDL64JP.js → notes-4KZGQBRF.js} +2 -2
- package/dist/{notion-XRTFGM3Q.js → notion-ERLC3SKM.js} +4 -4
- package/dist/{open_exchange_rates-TLNDRZ54.js → open_exchange_rates-GBBHZLUS.js} +4 -4
- package/dist/{openai-EUDWNNU6.js → openai-24N26QWI.js} +4 -4
- package/dist/{opengraph_io-MKH5AUR3.js → opengraph_io-MTN4TTXP.js} +4 -4
- package/dist/{openrouter-YMGWGPI3.js → openrouter-BK6BL7EH.js} +4 -4
- package/dist/{outline-MTH7SZBU.js → outline-O3LF5SNM.js} +4 -4
- package/dist/{paddle-PWSGQPO6.js → paddle-IEDD5BMW.js} +4 -4
- package/dist/{perplexity-NBUHF5Z6.js → perplexity-HGPLFK72.js} +4 -4
- package/dist/{pinecone-5FVBDTET.js → pinecone-FTWR4JVG.js} +4 -4
- package/dist/{pipedrive-IJUNMGFQ.js → pipedrive-DDMA36AB.js} +4 -4
- package/dist/{polar-L72J7ISM.js → polar-YFGTOQYM.js} +4 -4
- package/dist/{posthog-4GDGMSSQ.js → posthog-GFEFPIH3.js} +4 -4
- package/dist/{postmark-25TFX6LC.js → postmark-N7YCE2DZ.js} +4 -4
- package/dist/{prerender-ZY7S5S4R.js → prerender-B77XIKL7.js} +4 -4
- package/dist/{pubmed-KCPFV76N.js → pubmed-XAFQSOCJ.js} +4 -4
- package/dist/{railway-IWOCVOXL.js → railway-DJ4P5DAJ.js} +4 -4
- package/dist/{readwise-JCN5J4ON.js → readwise-UNBGXBYC.js} +4 -4
- package/dist/{render-FUM4QWKI.js → render-Z43FLDJ3.js} +4 -4
- package/dist/{replicate-V5VIAEYB.js → replicate-BZAMQO7R.js} +4 -4
- package/dist/{resend-F3XQOI24.js → resend-MFUW2LNU.js} +4 -4
- package/dist/{rootly-XEDRHK66.js → rootly-5CHCWRPM.js} +4 -4
- package/dist/{scrapfly-PXDWBCOD.js → scrapfly-36O4IJDA.js} +4 -4
- package/dist/{scrapingbee-X5QCNZSS.js → scrapingbee-JK6HZA75.js} +4 -4
- package/dist/{screenshot_fyi-V6CE6WQS.js → screenshot_fyi-BDEL4D53.js} +4 -4
- package/dist/{semantic_scholar-NHEQ5J72.js → semantic_scholar-QHHG7RWT.js} +4 -4
- package/dist/{sentry-XDLPYMQI.js → sentry-OCUW4KNC.js} +4 -4
- package/dist/{shodan-H2YTSK7R.js → shodan-5UBQ6RKP.js} +4 -4
- package/dist/{shopify-Q5YDMDAD.js → shopify-OXIMRVHL.js} +4 -4
- package/dist/{stripe-ZXSIKY6A.js → stripe-W5XRW7WG.js} +4 -4
- package/dist/{supabase-TV2ZEVH5.js → supabase-DIC7ZIG7.js} +4 -4
- package/dist/{tavily-KKBMTUW6.js → tavily-NVWQPGF3.js} +4 -4
- package/dist/{telegram-JM4VE5FR.js → telegram-S755MPMM.js} +4 -4
- package/dist/{telnyx-NOXAAP6B.js → telnyx-MXRX75AP.js} +4 -4
- package/dist/{todoist-ATYSMZ2W.js → todoist-MNVUPHIF.js} +4 -4
- package/dist/{trello-BWRSV7VZ.js → trello-T7JLVYU4.js} +4 -4
- package/dist/{turso-P7Z4X5C5.js → turso-JDBW2RN4.js} +4 -4
- package/dist/{twilio-YL7NUXCX.js → twilio-EGYNUGMZ.js} +4 -4
- package/dist/{umami-JPWFBAPI.js → umami-QF2V23Z5.js} +4 -4
- package/dist/{unsplash-CJBI3UGZ.js → unsplash-VWTABYWL.js} +4 -4
- package/dist/{upstash_redis-J5IGSHWB.js → upstash_redis-FKUGE73T.js} +4 -4
- package/dist/{uptimerobot-HEFFBT3N.js → uptimerobot-55LTBUWA.js} +4 -4
- package/dist/{v2ex-MRYW7RM6.js → v2ex-LGG6X53N.js} +4 -4
- package/dist/{vercel-RNY4ZRTH.js → vercel-VAZGWMOZ.js} +4 -4
- package/dist/{wolfram_alpha_api-AF346YID.js → wolfram_alpha_api-YLVVZTPP.js} +4 -4
- package/dist/{wordpress-YWKGCQA5.js → wordpress-6LDTITVV.js} +4 -4
- package/dist/{workos-Y7AORGEG.js → workos-ML6NIEEP.js} +4 -4
- package/dist/{zhihu-X4FAKOAQ.js → zhihu-CACG2ZNY.js} +4 -4
- package/package.json +5 -5
|
@@ -14591,6 +14591,24 @@ config(en_default());
|
|
|
14591
14591
|
function normalizePath(path) {
|
|
14592
14592
|
return path.replace(/^\/+|\/+$/g, "");
|
|
14593
14593
|
}
|
|
14594
|
+
function validateSegment(seg) {
|
|
14595
|
+
if (seg === "") return new TBError("invalid_argument", "\u6807\u8BC6\u7B26\u6BB5\u4E0D\u80FD\u4E3A\u7A7A");
|
|
14596
|
+
if (seg.startsWith("~")) return new TBError("invalid_argument", `\u6807\u8BC6\u7B26\u6BB5\u4E0D\u80FD\u4EE5 '~' \u5F00\u5934:'${seg}'`);
|
|
14597
|
+
if (seg === "." || seg === "..") {
|
|
14598
|
+
return new TBError("invalid_argument", `\u6807\u8BC6\u7B26\u6BB5\u4E0D\u80FD\u662F '.' \u6216 '..':'${seg}'`);
|
|
14599
|
+
}
|
|
14600
|
+
return null;
|
|
14601
|
+
}
|
|
14602
|
+
function canonicalizeSegment(seg) {
|
|
14603
|
+
const invalid2 = validateSegment(seg);
|
|
14604
|
+
if (invalid2) throw invalid2;
|
|
14605
|
+
return seg.toLowerCase();
|
|
14606
|
+
}
|
|
14607
|
+
function canonicalizePath(path) {
|
|
14608
|
+
const norm = normalizePath(path);
|
|
14609
|
+
if (norm === "") return "";
|
|
14610
|
+
return norm.split("/").map((seg) => canonicalizeSegment(seg)).join("/");
|
|
14611
|
+
}
|
|
14594
14612
|
function segments(path) {
|
|
14595
14613
|
const p = normalizePath(path);
|
|
14596
14614
|
return p === "" ? [] : p.split("/");
|
|
@@ -14607,6 +14625,9 @@ function validatePath(path, opts = {}) {
|
|
|
14607
14625
|
if (seg.startsWith("~")) {
|
|
14608
14626
|
return new TBError("invalid_argument", `\u8DEF\u5F84\u542B\u4FDD\u7559\u6BB5:'${seg}'`);
|
|
14609
14627
|
}
|
|
14628
|
+
if (seg === "." || seg === "..") {
|
|
14629
|
+
return new TBError("invalid_argument", `\u8DEF\u5F84\u542B\u76F8\u5BF9\u5BFC\u822A\u6BB5:'${seg}'`);
|
|
14630
|
+
}
|
|
14610
14631
|
}
|
|
14611
14632
|
return null;
|
|
14612
14633
|
}
|
|
@@ -14758,11 +14779,12 @@ var MAX_PATTERN_SEGMENTS = 64;
|
|
|
14758
14779
|
function matchGlob(pattern, path) {
|
|
14759
14780
|
const pat = [];
|
|
14760
14781
|
for (const token of segments2(pattern)) {
|
|
14761
|
-
|
|
14762
|
-
pat.
|
|
14782
|
+
const lower = token.toLowerCase();
|
|
14783
|
+
if (lower === "**" && pat[pat.length - 1] === "**") continue;
|
|
14784
|
+
pat.push(lower);
|
|
14763
14785
|
}
|
|
14764
14786
|
if (pat.length > MAX_PATTERN_SEGMENTS) return false;
|
|
14765
|
-
return matchFrom(pat, 0, segments2(path), 0);
|
|
14787
|
+
return matchFrom(pat, 0, segments2(path).map((s) => s.toLowerCase()), 0);
|
|
14766
14788
|
}
|
|
14767
14789
|
var effectOf = (scope) => scope.effect ?? "allow";
|
|
14768
14790
|
var matches = (scope, path, action) => scope.actions.includes(action) && matchGlob(scope.pattern, path);
|
|
@@ -15049,6 +15071,9 @@ async function identify(store, bearer, now) {
|
|
|
15049
15071
|
|
|
15050
15072
|
// ../core/src/builtin/util.ts
|
|
15051
15073
|
var VOID_ACK = { ok: true };
|
|
15074
|
+
function withCommandPaths(nodePath, cmds) {
|
|
15075
|
+
return cmds.map((cmd) => ({ ...cmd, path: `/${nodePath}/${cmd.name}` }));
|
|
15076
|
+
}
|
|
15052
15077
|
var LIST_OPTS_SCHEMA = {
|
|
15053
15078
|
type: "object",
|
|
15054
15079
|
description: "pagination options",
|
|
@@ -15149,7 +15174,7 @@ function matches2(item, query) {
|
|
|
15149
15174
|
}
|
|
15150
15175
|
function catalogCmds(nodePath) {
|
|
15151
15176
|
const path = cmdPath(nodePath);
|
|
15152
|
-
|
|
15177
|
+
const cmds = [
|
|
15153
15178
|
{
|
|
15154
15179
|
name: "list",
|
|
15155
15180
|
method: "POST",
|
|
@@ -15189,6 +15214,7 @@ function catalogCmds(nodePath) {
|
|
|
15189
15214
|
scope: "read"
|
|
15190
15215
|
}
|
|
15191
15216
|
];
|
|
15217
|
+
return withCommandPaths(nodePath, cmds);
|
|
15192
15218
|
}
|
|
15193
15219
|
function paginate(items, opts) {
|
|
15194
15220
|
const o = typeof opts === "object" && opts !== null ? opts : {};
|
|
@@ -15398,8 +15424,8 @@ function parseTokenResponse(payload, config2, now) {
|
|
|
15398
15424
|
}
|
|
15399
15425
|
|
|
15400
15426
|
// ../core/src/context/capabilities.ts
|
|
15401
|
-
var CONTEXT_METHODS = ["
|
|
15402
|
-
var CONTEXT_WRITE_METHODS = ["
|
|
15427
|
+
var CONTEXT_METHODS = ["list", "get", "search", "write", "update", "delete"];
|
|
15428
|
+
var CONTEXT_WRITE_METHODS = ["write", "update", "delete"];
|
|
15403
15429
|
function contextMethodsOf(provider) {
|
|
15404
15430
|
const methods = /* @__PURE__ */ new Set();
|
|
15405
15431
|
for (const method of CONTEXT_METHODS) {
|
|
@@ -15412,8 +15438,8 @@ function isReadOnlyProvider(provider) {
|
|
|
15412
15438
|
}
|
|
15413
15439
|
function contextCapabilitiesOf(provider) {
|
|
15414
15440
|
const capabilities = [];
|
|
15415
|
-
if (provider.
|
|
15416
|
-
if (provider.
|
|
15441
|
+
if (provider.search !== void 0) capabilities.push("search");
|
|
15442
|
+
if (provider.delete !== void 0) capabilities.push("delete");
|
|
15417
15443
|
return capabilities;
|
|
15418
15444
|
}
|
|
15419
15445
|
|
|
@@ -15424,8 +15450,8 @@ var NODE_KIND_BY_PROFILE2 = {
|
|
|
15424
15450
|
"context/v1": "context"
|
|
15425
15451
|
};
|
|
15426
15452
|
var OPTIONAL_METHOD_BY_CAPABILITY = {
|
|
15427
|
-
search: "
|
|
15428
|
-
delete: "
|
|
15453
|
+
search: "search",
|
|
15454
|
+
delete: "delete"
|
|
15429
15455
|
};
|
|
15430
15456
|
function optionalMethodsForCapabilities(capabilities) {
|
|
15431
15457
|
const methods = /* @__PURE__ */ new Set();
|
|
@@ -15731,7 +15757,7 @@ function pluginCmds(nodePath) {
|
|
|
15731
15757
|
properties: { id: { type: "string", description: "plugin id" } },
|
|
15732
15758
|
required: ["id"]
|
|
15733
15759
|
};
|
|
15734
|
-
|
|
15760
|
+
const cmds = [
|
|
15735
15761
|
{
|
|
15736
15762
|
name: "list",
|
|
15737
15763
|
method: "POST",
|
|
@@ -15815,6 +15841,7 @@ function pluginCmds(nodePath) {
|
|
|
15815
15841
|
scope: "admin"
|
|
15816
15842
|
}
|
|
15817
15843
|
];
|
|
15844
|
+
return withCommandPaths(nodePath, cmds);
|
|
15818
15845
|
}
|
|
15819
15846
|
function clampLimit2(limit) {
|
|
15820
15847
|
if (limit === void 0 || limit < 1) return LIST_LIMIT_DEFAULT;
|
|
@@ -16014,7 +16041,7 @@ function createPluginModule(deps) {
|
|
|
16014
16041
|
var DESCRIPTION3 = "Path annotations: admin-curated notes shown in ~help of the annotated path (set / get / remove / list)";
|
|
16015
16042
|
function annotationCmds(nodePath) {
|
|
16016
16043
|
const path = cmdPath(nodePath);
|
|
16017
|
-
|
|
16044
|
+
const cmds = [
|
|
16018
16045
|
{
|
|
16019
16046
|
name: "set",
|
|
16020
16047
|
method: "POST",
|
|
@@ -16075,6 +16102,7 @@ function annotationCmds(nodePath) {
|
|
|
16075
16102
|
scope: "read"
|
|
16076
16103
|
}
|
|
16077
16104
|
];
|
|
16105
|
+
return withCommandPaths(nodePath, cmds);
|
|
16078
16106
|
}
|
|
16079
16107
|
function requireRootablePath(args) {
|
|
16080
16108
|
const v = args.path;
|
|
@@ -16192,7 +16220,7 @@ var RemoteAllowlistStore = class {
|
|
|
16192
16220
|
var DESCRIPTION4 = "Remote federation host allowlist: which hosts kind=remote nodes may connect to (env baseline is read-only; admin only)";
|
|
16193
16221
|
function federationCmds(nodePath) {
|
|
16194
16222
|
const path = cmdPath(nodePath);
|
|
16195
|
-
|
|
16223
|
+
const cmds = [
|
|
16196
16224
|
{
|
|
16197
16225
|
name: "list",
|
|
16198
16226
|
method: "POST",
|
|
@@ -16234,6 +16262,7 @@ function federationCmds(nodePath) {
|
|
|
16234
16262
|
scope: "admin"
|
|
16235
16263
|
}
|
|
16236
16264
|
];
|
|
16265
|
+
return withCommandPaths(nodePath, cmds);
|
|
16237
16266
|
}
|
|
16238
16267
|
function mergedView(base, entries) {
|
|
16239
16268
|
const byHost = /* @__PURE__ */ new Map();
|
|
@@ -16310,7 +16339,7 @@ var NODE_FIELD_SCHEMAS = {
|
|
|
16310
16339
|
};
|
|
16311
16340
|
function registryCmds(nodePath) {
|
|
16312
16341
|
const path = cmdPath(nodePath);
|
|
16313
|
-
|
|
16342
|
+
const cmds = [
|
|
16314
16343
|
{
|
|
16315
16344
|
name: "list",
|
|
16316
16345
|
method: "POST",
|
|
@@ -16386,6 +16415,7 @@ function registryCmds(nodePath) {
|
|
|
16386
16415
|
scope: "register"
|
|
16387
16416
|
}
|
|
16388
16417
|
];
|
|
16418
|
+
return withCommandPaths(nodePath, cmds);
|
|
16389
16419
|
}
|
|
16390
16420
|
function parseNodeInput(args) {
|
|
16391
16421
|
const path = requireString(args, "path");
|
|
@@ -16457,7 +16487,7 @@ function assertUserSecretName(name) {
|
|
|
16457
16487
|
}
|
|
16458
16488
|
function secretCmds(nodePath) {
|
|
16459
16489
|
const path = cmdPath(nodePath);
|
|
16460
|
-
|
|
16490
|
+
const cmds = [
|
|
16461
16491
|
{
|
|
16462
16492
|
name: "set",
|
|
16463
16493
|
method: "POST",
|
|
@@ -16503,6 +16533,7 @@ function secretCmds(nodePath) {
|
|
|
16503
16533
|
scope: "admin"
|
|
16504
16534
|
}
|
|
16505
16535
|
];
|
|
16536
|
+
return withCommandPaths(nodePath, cmds);
|
|
16506
16537
|
}
|
|
16507
16538
|
function createSecretModule(store, now) {
|
|
16508
16539
|
return {
|
|
@@ -16540,7 +16571,7 @@ function createSecretModule(store, now) {
|
|
|
16540
16571
|
// ../core/src/builtin/status.ts
|
|
16541
16572
|
var DESCRIPTION7 = "Gateway health and summary (readable without admin)";
|
|
16542
16573
|
function statusCmds(nodePath) {
|
|
16543
|
-
return [
|
|
16574
|
+
return withCommandPaths(nodePath, [
|
|
16544
16575
|
{
|
|
16545
16576
|
name: "get",
|
|
16546
16577
|
method: "POST",
|
|
@@ -16550,7 +16581,7 @@ function statusCmds(nodePath) {
|
|
|
16550
16581
|
returns: "{ healthy, version, nodeCount }",
|
|
16551
16582
|
scope: "read"
|
|
16552
16583
|
}
|
|
16553
|
-
];
|
|
16584
|
+
]);
|
|
16554
16585
|
}
|
|
16555
16586
|
function createStatusModule(deps) {
|
|
16556
16587
|
return {
|
|
@@ -16615,7 +16646,7 @@ var SK_FIELD_SCHEMAS = {
|
|
|
16615
16646
|
};
|
|
16616
16647
|
function skCmds(nodePath) {
|
|
16617
16648
|
const path = cmdPath(nodePath);
|
|
16618
|
-
|
|
16649
|
+
const cmds = [
|
|
16619
16650
|
{
|
|
16620
16651
|
name: "list",
|
|
16621
16652
|
method: "POST",
|
|
@@ -16690,6 +16721,7 @@ function skCmds(nodePath) {
|
|
|
16690
16721
|
scope: "admin"
|
|
16691
16722
|
}
|
|
16692
16723
|
];
|
|
16724
|
+
return withCommandPaths(nodePath, cmds);
|
|
16693
16725
|
}
|
|
16694
16726
|
function asSecretKeyInput(args) {
|
|
16695
16727
|
const owner = requireString(args, "owner");
|
|
@@ -16791,12 +16823,12 @@ function createBuiltins(deps) {
|
|
|
16791
16823
|
// ../core/src/context/help.ts
|
|
16792
16824
|
var CONTEXT_CAPABILITIES = ["search", "delete"];
|
|
16793
16825
|
var SCOPE_BY_CMD = {
|
|
16794
|
-
|
|
16795
|
-
|
|
16796
|
-
|
|
16797
|
-
|
|
16798
|
-
|
|
16799
|
-
|
|
16826
|
+
list: "read",
|
|
16827
|
+
get: "read",
|
|
16828
|
+
search: "read",
|
|
16829
|
+
write: "write",
|
|
16830
|
+
update: "write",
|
|
16831
|
+
delete: "write"
|
|
16800
16832
|
};
|
|
16801
16833
|
function contextScopeForCmd(tool) {
|
|
16802
16834
|
return SCOPE_BY_CMD[tool] ?? null;
|
|
@@ -16847,9 +16879,9 @@ var PATCH_SCHEMA = {
|
|
|
16847
16879
|
};
|
|
16848
16880
|
function contextCmds(nodePath) {
|
|
16849
16881
|
const path = cmdPath(nodePath);
|
|
16850
|
-
|
|
16882
|
+
const cmds = [
|
|
16851
16883
|
{
|
|
16852
|
-
name: "
|
|
16884
|
+
name: "list",
|
|
16853
16885
|
method: "POST",
|
|
16854
16886
|
path,
|
|
16855
16887
|
h: "list entries directly under a path (shallow, paginated)",
|
|
@@ -16864,7 +16896,7 @@ function contextCmds(nodePath) {
|
|
|
16864
16896
|
scope: "read"
|
|
16865
16897
|
},
|
|
16866
16898
|
{
|
|
16867
|
-
name: "
|
|
16899
|
+
name: "get",
|
|
16868
16900
|
method: "POST",
|
|
16869
16901
|
path,
|
|
16870
16902
|
h: "read one entry with content (oversized content comes back as { $ref: <download URL> })",
|
|
@@ -16879,7 +16911,7 @@ function contextCmds(nodePath) {
|
|
|
16879
16911
|
scope: "read"
|
|
16880
16912
|
},
|
|
16881
16913
|
{
|
|
16882
|
-
name: "
|
|
16914
|
+
name: "write",
|
|
16883
16915
|
method: "POST",
|
|
16884
16916
|
path,
|
|
16885
16917
|
h: "create or fully replace an entry (idempotent upsert)",
|
|
@@ -16895,7 +16927,7 @@ function contextCmds(nodePath) {
|
|
|
16895
16927
|
scope: "write"
|
|
16896
16928
|
},
|
|
16897
16929
|
{
|
|
16898
|
-
name: "
|
|
16930
|
+
name: "update",
|
|
16899
16931
|
method: "POST",
|
|
16900
16932
|
path,
|
|
16901
16933
|
h: "partially update content and/or metadata (shallow merge); not_found if the entry does not exist",
|
|
@@ -16911,7 +16943,7 @@ function contextCmds(nodePath) {
|
|
|
16911
16943
|
scope: "write"
|
|
16912
16944
|
},
|
|
16913
16945
|
{
|
|
16914
|
-
name: "
|
|
16946
|
+
name: "delete",
|
|
16915
16947
|
method: "POST",
|
|
16916
16948
|
path,
|
|
16917
16949
|
h: "delete an entry (idempotent)",
|
|
@@ -16926,7 +16958,7 @@ function contextCmds(nodePath) {
|
|
|
16926
16958
|
effect: "destructive"
|
|
16927
16959
|
},
|
|
16928
16960
|
{
|
|
16929
|
-
name: "
|
|
16961
|
+
name: "search",
|
|
16930
16962
|
method: "POST",
|
|
16931
16963
|
path,
|
|
16932
16964
|
h: "keyword search: substring match on entry paths and metadata values",
|
|
@@ -16942,6 +16974,7 @@ function contextCmds(nodePath) {
|
|
|
16942
16974
|
scope: "read"
|
|
16943
16975
|
}
|
|
16944
16976
|
];
|
|
16977
|
+
return withCommandPaths(nodePath, cmds);
|
|
16945
16978
|
}
|
|
16946
16979
|
function contextHelpModel(node, opts = {}) {
|
|
16947
16980
|
const all = contextCmds(node.path);
|
|
@@ -17110,7 +17143,7 @@ function createObjectContextProvider(store, opts) {
|
|
|
17110
17143
|
};
|
|
17111
17144
|
const notFound = (path) => TBError.notFound(`context entry \u4E0D\u5B58\u5728:'${path}'`);
|
|
17112
17145
|
return {
|
|
17113
|
-
async
|
|
17146
|
+
async list(path, listOpts) {
|
|
17114
17147
|
rejectFilter(listOpts);
|
|
17115
17148
|
const limit = clampLimit3(listOpts?.limit);
|
|
17116
17149
|
const rel = path === "" ? "" : `${normalizeEntryPath(path)}/`;
|
|
@@ -17132,7 +17165,7 @@ function createObjectContextProvider(store, opts) {
|
|
|
17132
17165
|
}
|
|
17133
17166
|
return res.cursor !== void 0 ? { items, cursor: res.cursor } : { items };
|
|
17134
17167
|
},
|
|
17135
|
-
async
|
|
17168
|
+
async get(path) {
|
|
17136
17169
|
const key = keyFor(path);
|
|
17137
17170
|
const head = await store.head(key);
|
|
17138
17171
|
if (!head) throw notFound(path);
|
|
@@ -17151,8 +17184,8 @@ function createObjectContextProvider(store, opts) {
|
|
|
17151
17184
|
}
|
|
17152
17185
|
return { ...meta3, content: text };
|
|
17153
17186
|
},
|
|
17154
|
-
async
|
|
17155
|
-
assertWritable("
|
|
17187
|
+
async write(path, entry) {
|
|
17188
|
+
assertWritable("write");
|
|
17156
17189
|
const key = keyFor(path);
|
|
17157
17190
|
const { body, contentType } = serializeInput(entry);
|
|
17158
17191
|
const meta3 = await store.put(key, body, {
|
|
@@ -17162,8 +17195,8 @@ function createObjectContextProvider(store, opts) {
|
|
|
17162
17195
|
});
|
|
17163
17196
|
return toMeta(meta3);
|
|
17164
17197
|
},
|
|
17165
|
-
async
|
|
17166
|
-
assertWritable("
|
|
17198
|
+
async update(path, patch) {
|
|
17199
|
+
assertWritable("update");
|
|
17167
17200
|
const key = keyFor(path);
|
|
17168
17201
|
if (patch.content === void 0 && patch.metadata === void 0) {
|
|
17169
17202
|
throw new TBError("invalid_argument", "patch \u81F3\u5C11\u63D0\u4F9B content \u6216 metadata \u4E4B\u4E00");
|
|
@@ -17190,11 +17223,11 @@ function createObjectContextProvider(store, opts) {
|
|
|
17190
17223
|
});
|
|
17191
17224
|
return toMeta(meta3);
|
|
17192
17225
|
},
|
|
17193
|
-
async
|
|
17194
|
-
assertWritable("
|
|
17226
|
+
async delete(path) {
|
|
17227
|
+
assertWritable("delete");
|
|
17195
17228
|
await store.delete(keyFor(path));
|
|
17196
17229
|
},
|
|
17197
|
-
async
|
|
17230
|
+
async search(query, searchOpts) {
|
|
17198
17231
|
const mode = searchOpts?.mode ?? "keyword";
|
|
17199
17232
|
if (mode === "semantic") {
|
|
17200
17233
|
throw new TBError("invalid_argument", "semantic \u68C0\u7D22\u672A\u58F0\u660E('search:semantic' capability)");
|
|
@@ -17313,8 +17346,7 @@ var schemaByType = {
|
|
|
17313
17346
|
call: external_exports.object({
|
|
17314
17347
|
type: external_exports.literal("call"),
|
|
17315
17348
|
id: idSchema,
|
|
17316
|
-
path: external_exports.string(),
|
|
17317
|
-
tool: external_exports.string().min(1),
|
|
17349
|
+
path: external_exports.string().min(1),
|
|
17318
17350
|
arguments: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
17319
17351
|
context: deviceCallContextSchema.optional()
|
|
17320
17352
|
}),
|
|
@@ -17544,7 +17576,6 @@ var DeviceGatewaySession = class {
|
|
|
17544
17576
|
type: "call",
|
|
17545
17577
|
id: req.id,
|
|
17546
17578
|
path: req.path,
|
|
17547
|
-
tool: req.tool,
|
|
17548
17579
|
arguments: req.arguments,
|
|
17549
17580
|
// undefined 经 JSON.stringify 丢弃:老网关不带 context 时帧形状不变。
|
|
17550
17581
|
...req.context !== void 0 ? { context: req.context } : {}
|
|
@@ -17812,8 +17843,7 @@ function renderHelpDsl(model) {
|
|
|
17812
17843
|
lines.push(`cmd ${cmd.name} ${cmd.method} ${cmd.path}`);
|
|
17813
17844
|
if (cmd.h !== void 0) lines.push(...attrLines("h", cmd.h));
|
|
17814
17845
|
if (cmd.inputSchema !== void 0) {
|
|
17815
|
-
|
|
17816
|
-
lines.push(` body ${JSON.stringify(body)}`);
|
|
17846
|
+
lines.push(` body ${JSON.stringify(cmd.inputSchema)}`);
|
|
17817
17847
|
}
|
|
17818
17848
|
if (cmd.outputSchema !== void 0) lines.push(` result ${JSON.stringify(cmd.outputSchema)}`);
|
|
17819
17849
|
if (cmd.returns !== void 0) lines.push(...attrLines("returns", cmd.returns));
|
|
@@ -17887,8 +17917,7 @@ function cmdSection(cmd, index) {
|
|
|
17887
17917
|
if (cmd.h !== void 0 && cmd.h.trim() !== "") {
|
|
17888
17918
|
lines.push(cmd.h.trim(), "");
|
|
17889
17919
|
}
|
|
17890
|
-
|
|
17891
|
-
lines.push(`- Invoke: \`POST ${cmd.path}\` with body ${bodyShape}`);
|
|
17920
|
+
lines.push(`- Invoke: \`POST ${cmd.path}\` with body \`{...arguments}\``);
|
|
17892
17921
|
lines.push(`- Required scope: \`${cmd.scope}\``);
|
|
17893
17922
|
if (cmd.effect !== void 0) {
|
|
17894
17923
|
lines.push(
|
|
@@ -17901,15 +17930,14 @@ function cmdSection(cmd, index) {
|
|
|
17901
17930
|
if (cmd.inputSchema !== void 0) {
|
|
17902
17931
|
lines.push(
|
|
17903
17932
|
"",
|
|
17904
|
-
|
|
17933
|
+
"Request body (JSON Schema):",
|
|
17905
17934
|
"",
|
|
17906
17935
|
"```json",
|
|
17907
17936
|
JSON.stringify(cmd.inputSchema, null, 2),
|
|
17908
17937
|
"```"
|
|
17909
17938
|
);
|
|
17910
17939
|
} else if (index) {
|
|
17911
|
-
|
|
17912
|
-
lines.push(`- Arguments: schema not shown in this index \u2014 \`GET ${specPath}\``);
|
|
17940
|
+
lines.push(`- Arguments: schema not shown in this index \u2014 \`GET ${cmd.path}/~help\``);
|
|
17913
17941
|
} else {
|
|
17914
17942
|
lines.push("- Arguments: none declared");
|
|
17915
17943
|
}
|
|
@@ -17934,31 +17962,18 @@ function renderHelpMarkdown(model) {
|
|
|
17934
17962
|
out.push(model.note.trim(), "");
|
|
17935
17963
|
}
|
|
17936
17964
|
if (model.cmds.length > 0) {
|
|
17937
|
-
const allFlat = model.cmds.every((c) => c.flatBody === true);
|
|
17938
17965
|
out.push("## How to call");
|
|
17939
17966
|
out.push("");
|
|
17940
|
-
|
|
17941
|
-
|
|
17942
|
-
|
|
17943
|
-
|
|
17944
|
-
|
|
17945
|
-
|
|
17946
|
-
|
|
17947
|
-
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
out.push("```");
|
|
17951
|
-
} else {
|
|
17952
|
-
const invokePath = model.cmds[0]?.path ?? displayPath2(model.node.path);
|
|
17953
|
-
out.push("Every command on this node is invoked with the same request shape:");
|
|
17954
|
-
out.push("");
|
|
17955
|
-
out.push("```");
|
|
17956
|
-
out.push(`POST ${invokePath}`);
|
|
17957
|
-
out.push("Content-Type: application/json");
|
|
17958
|
-
out.push("");
|
|
17959
|
-
out.push('{"tool": "<command name>", "arguments": {...}}');
|
|
17960
|
-
out.push("```");
|
|
17961
|
-
}
|
|
17967
|
+
out.push(
|
|
17968
|
+
"Each command has its own direct URL; the request body is the arguments object itself:"
|
|
17969
|
+
);
|
|
17970
|
+
out.push("");
|
|
17971
|
+
out.push("```");
|
|
17972
|
+
out.push(`POST ${model.cmds[0]?.path ?? displayPath2(model.node.path)}`);
|
|
17973
|
+
out.push("Content-Type: application/json");
|
|
17974
|
+
out.push("");
|
|
17975
|
+
out.push("{...arguments}");
|
|
17976
|
+
out.push("```");
|
|
17962
17977
|
out.push("");
|
|
17963
17978
|
out.push("`Required scope` names the permission your Secret Key must hold for that command.");
|
|
17964
17979
|
out.push("");
|
|
@@ -19379,11 +19394,11 @@ function parseFrontmatter(text) {
|
|
|
19379
19394
|
// ../core/src/skillhub/help.ts
|
|
19380
19395
|
var SKILLHUB_CAPABILITIES = ["search"];
|
|
19381
19396
|
var SCOPE_BY_CMD2 = {
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19397
|
+
list: "read",
|
|
19398
|
+
get: "read",
|
|
19399
|
+
search: "read",
|
|
19400
|
+
publish: "write",
|
|
19401
|
+
remove: "write"
|
|
19387
19402
|
};
|
|
19388
19403
|
function skillhubScopeForCmd(tool) {
|
|
19389
19404
|
return SCOPE_BY_CMD2[tool] ?? null;
|
|
@@ -19410,9 +19425,9 @@ var PUBLISH_FILE_SCHEMA = {
|
|
|
19410
19425
|
};
|
|
19411
19426
|
function skillhubCmds(nodePath) {
|
|
19412
19427
|
const path = cmdPath(nodePath);
|
|
19413
|
-
|
|
19428
|
+
const cmds = [
|
|
19414
19429
|
{
|
|
19415
|
-
name: "
|
|
19430
|
+
name: "list",
|
|
19416
19431
|
method: "POST",
|
|
19417
19432
|
path,
|
|
19418
19433
|
h: "list published skills (id / name / description from SKILL.md frontmatter, paginated)",
|
|
@@ -19424,7 +19439,7 @@ function skillhubCmds(nodePath) {
|
|
|
19424
19439
|
scope: "read"
|
|
19425
19440
|
},
|
|
19426
19441
|
{
|
|
19427
|
-
name: "
|
|
19442
|
+
name: "get",
|
|
19428
19443
|
method: "POST",
|
|
19429
19444
|
path,
|
|
19430
19445
|
h: "read a skill: SKILL.md body + file manifest; pass 'file' to fetch one bundled file (oversized/binary as { $ref })",
|
|
@@ -19443,7 +19458,7 @@ function skillhubCmds(nodePath) {
|
|
|
19443
19458
|
scope: "read"
|
|
19444
19459
|
},
|
|
19445
19460
|
{
|
|
19446
|
-
name: "
|
|
19461
|
+
name: "search",
|
|
19447
19462
|
method: "POST",
|
|
19448
19463
|
path,
|
|
19449
19464
|
h: "keyword search over skill id / name / description",
|
|
@@ -19459,7 +19474,7 @@ function skillhubCmds(nodePath) {
|
|
|
19459
19474
|
scope: "read"
|
|
19460
19475
|
},
|
|
19461
19476
|
{
|
|
19462
|
-
name: "
|
|
19477
|
+
name: "publish",
|
|
19463
19478
|
method: "POST",
|
|
19464
19479
|
path,
|
|
19465
19480
|
h: "publish/replace a skill from a set of text files (must include SKILL.md with name+description frontmatter)",
|
|
@@ -19482,7 +19497,7 @@ function skillhubCmds(nodePath) {
|
|
|
19482
19497
|
scope: "write"
|
|
19483
19498
|
},
|
|
19484
19499
|
{
|
|
19485
|
-
name: "
|
|
19500
|
+
name: "remove",
|
|
19486
19501
|
method: "POST",
|
|
19487
19502
|
path,
|
|
19488
19503
|
h: "delete a skill and all its files (not_found if it does not exist)",
|
|
@@ -19495,6 +19510,7 @@ function skillhubCmds(nodePath) {
|
|
|
19495
19510
|
effect: "destructive"
|
|
19496
19511
|
}
|
|
19497
19512
|
];
|
|
19513
|
+
return withCommandPaths(nodePath, cmds);
|
|
19498
19514
|
}
|
|
19499
19515
|
function skillhubHelpModel(node, opts = {}) {
|
|
19500
19516
|
const cmds = skillhubCmds(node.path);
|
|
@@ -19581,7 +19597,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19581
19597
|
};
|
|
19582
19598
|
};
|
|
19583
19599
|
return {
|
|
19584
|
-
async
|
|
19600
|
+
async list(listOpts) {
|
|
19585
19601
|
const limit = clampLimit4(listOpts?.limit);
|
|
19586
19602
|
const res = await store.list(keyPrefix, {
|
|
19587
19603
|
delimiter: "/",
|
|
@@ -19601,7 +19617,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19601
19617
|
}
|
|
19602
19618
|
return res.cursor !== void 0 ? { items, cursor: res.cursor } : { items };
|
|
19603
19619
|
},
|
|
19604
|
-
async
|
|
19620
|
+
async get(idRaw) {
|
|
19605
19621
|
const id = assertSkillId(idRaw);
|
|
19606
19622
|
const { text, meta: meta3 } = await readDoc(id);
|
|
19607
19623
|
const summary = summaryOf(id, text, meta3);
|
|
@@ -19623,7 +19639,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19623
19639
|
} while (cursor !== void 0);
|
|
19624
19640
|
return { ...summary, content: text, files };
|
|
19625
19641
|
},
|
|
19626
|
-
async
|
|
19642
|
+
async get_file(idRaw, file2) {
|
|
19627
19643
|
const id = assertSkillId(idRaw);
|
|
19628
19644
|
const rel = normalizeEntryPath(file2);
|
|
19629
19645
|
const key = `${skillPrefix(id)}${rel}`;
|
|
@@ -19638,7 +19654,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19638
19654
|
if (!got) throw TBError.notFound(`skill \u6587\u4EF6\u4E0D\u5B58\u5728:'${id}/${rel}'`);
|
|
19639
19655
|
return { ...base, content: await readStreamText(got.body) };
|
|
19640
19656
|
},
|
|
19641
|
-
async
|
|
19657
|
+
async search(query, searchOpts) {
|
|
19642
19658
|
if (typeof query !== "string" || query === "") {
|
|
19643
19659
|
throw new TBError("invalid_argument", "query \u4E0D\u80FD\u4E3A\u7A7A");
|
|
19644
19660
|
}
|
|
@@ -19690,8 +19706,8 @@ ${summary.description}`.toLowerCase();
|
|
|
19690
19706
|
} while (storeCursor !== void 0);
|
|
19691
19707
|
return hasMore && lastPrefix !== void 0 ? { items, cursor: lastPrefix } : { items };
|
|
19692
19708
|
},
|
|
19693
|
-
async
|
|
19694
|
-
assertWritable("
|
|
19709
|
+
async publish(input) {
|
|
19710
|
+
assertWritable("publish");
|
|
19695
19711
|
if (!Array.isArray(input.files) || input.files.length === 0) {
|
|
19696
19712
|
throw new TBError("invalid_argument", "files \u4E0D\u80FD\u4E3A\u7A7A");
|
|
19697
19713
|
}
|
|
@@ -19734,8 +19750,8 @@ ${summary.description}`.toLowerCase();
|
|
|
19734
19750
|
}
|
|
19735
19751
|
return { id, name: fm.name, description: fm.description, fileCount: files.length };
|
|
19736
19752
|
},
|
|
19737
|
-
async
|
|
19738
|
-
assertWritable("
|
|
19753
|
+
async remove(idRaw) {
|
|
19754
|
+
assertWritable("remove");
|
|
19739
19755
|
const id = assertSkillId(idRaw);
|
|
19740
19756
|
const prefix = skillPrefix(id);
|
|
19741
19757
|
let cursor;
|
|
@@ -19811,9 +19827,8 @@ function toolToCmd(nodePath, tool, index) {
|
|
|
19811
19827
|
const cmd = {
|
|
19812
19828
|
name: tool.name,
|
|
19813
19829
|
method: "POST",
|
|
19814
|
-
path:
|
|
19815
|
-
scope: "call"
|
|
19816
|
-
flatBody: true
|
|
19830
|
+
path: `/${nodePath}/${tool.name}`,
|
|
19831
|
+
scope: "call"
|
|
19817
19832
|
};
|
|
19818
19833
|
if (tool.description !== void 0) {
|
|
19819
19834
|
cmd.h = index ? summarizeOneLine(tool.description) : tool.description;
|
|
@@ -20018,16 +20033,16 @@ var NodeRegistryStore = class {
|
|
|
20018
20033
|
const page = await this.store.list(this.subtreePrefix(norm), { limit: 1 });
|
|
20019
20034
|
return page.items.length > 0;
|
|
20020
20035
|
}
|
|
20021
|
-
/** 取单个;不存在 → not_found。 */
|
|
20036
|
+
/** 取单个;不存在 → not_found。路径大小写不敏感(规范化为小写后查)。 */
|
|
20022
20037
|
async get(path) {
|
|
20023
|
-
const norm =
|
|
20038
|
+
const norm = canonicalizePath(path);
|
|
20024
20039
|
const node = await this.read(norm);
|
|
20025
20040
|
if (!node) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20026
20041
|
return node;
|
|
20027
20042
|
}
|
|
20028
|
-
/**
|
|
20043
|
+
/** 批量取节点;路径先规范化(小写)去重,不存在的节点不进入返回 Map。 */
|
|
20029
20044
|
async getMany(paths) {
|
|
20030
|
-
const canonical = [...new Set(paths.map((path) =>
|
|
20045
|
+
const canonical = [...new Set(paths.map((path) => canonicalizePath(path)))];
|
|
20031
20046
|
const values = await this.store.getMany(canonical.map((path) => this.keyOf(path)));
|
|
20032
20047
|
const out = /* @__PURE__ */ new Map();
|
|
20033
20048
|
for (const path of canonical) {
|
|
@@ -20041,7 +20056,7 @@ var NodeRegistryStore = class {
|
|
|
20041
20056
|
* 无 prefix = 全树。cursor 为上一页末节点的 path。
|
|
20042
20057
|
*/
|
|
20043
20058
|
async list(prefix, opts) {
|
|
20044
|
-
const normPrefix = prefix === void 0 ? "" :
|
|
20059
|
+
const normPrefix = prefix === void 0 ? "" : canonicalizePath(prefix);
|
|
20045
20060
|
const limit = clampLimit5(opts?.limit);
|
|
20046
20061
|
const all = (await this.scanAll()).filter((n) => isPrefixOf(normPrefix, n.path)).sort(byPath);
|
|
20047
20062
|
const cursor = opts?.cursor;
|
|
@@ -20055,7 +20070,7 @@ var NodeRegistryStore = class {
|
|
|
20055
20070
|
}
|
|
20056
20071
|
/** 直接子节点(段深恰好 +1);~help 列子节点用。只扫子树前缀,不扫全树。 */
|
|
20057
20072
|
async children(path) {
|
|
20058
|
-
const norm =
|
|
20073
|
+
const norm = canonicalizePath(path);
|
|
20059
20074
|
const depth = segments(norm).length;
|
|
20060
20075
|
const sub = await this.scanPrefix(this.subtreePrefix(norm));
|
|
20061
20076
|
return sub.filter((n) => segments(n.path).length === depth + 1).sort(byPath);
|
|
@@ -20066,7 +20081,7 @@ var NodeRegistryStore = class {
|
|
|
20066
20081
|
* 不存在的根返回空数组(调用方自行判 not_found)。
|
|
20067
20082
|
*/
|
|
20068
20083
|
async subtree(path, opts) {
|
|
20069
|
-
const norm =
|
|
20084
|
+
const norm = canonicalizePath(path);
|
|
20070
20085
|
if (opts?.maxNodes !== void 0 && (!Number.isInteger(opts.maxNodes) || opts.maxNodes < 1)) {
|
|
20071
20086
|
throw new TBError("invalid_argument", "maxNodes \u5FC5\u987B\u662F\u6B63\u6574\u6570");
|
|
20072
20087
|
}
|
|
@@ -20107,9 +20122,9 @@ var NodeRegistryStore = class {
|
|
|
20107
20122
|
* conflict(覆盖他人节点)判定在网关注册路径层,不在此——本层是幂等 upsert。
|
|
20108
20123
|
*/
|
|
20109
20124
|
async write(node, registeredBy, now, opts = {}) {
|
|
20110
|
-
const
|
|
20111
|
-
const invalid2 = validatePath(path);
|
|
20125
|
+
const invalid2 = validatePath(node.path);
|
|
20112
20126
|
if (invalid2) throw invalid2;
|
|
20127
|
+
const path = canonicalizePath(node.path);
|
|
20113
20128
|
assertKindConfig(node);
|
|
20114
20129
|
for (const parent of parentPaths(path)) {
|
|
20115
20130
|
if (!await this.read(parent)) {
|
|
@@ -20142,10 +20157,10 @@ var NodeRegistryStore = class {
|
|
|
20142
20157
|
}
|
|
20143
20158
|
/** 部分更新(patch);不存在 → not_found;path 不可改。 */
|
|
20144
20159
|
async update(path, patch, now) {
|
|
20145
|
-
const norm =
|
|
20160
|
+
const norm = canonicalizePath(path);
|
|
20146
20161
|
const existing = await this.read(norm);
|
|
20147
20162
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20148
|
-
if (patch.path !== void 0 &&
|
|
20163
|
+
if (patch.path !== void 0 && canonicalizePath(patch.path) !== norm) {
|
|
20149
20164
|
throw new TBError("invalid_argument", "path \u4E0D\u53EF\u901A\u8FC7 Update \u53D8\u66F4");
|
|
20150
20165
|
}
|
|
20151
20166
|
const merged = {
|
|
@@ -20167,7 +20182,7 @@ var NodeRegistryStore = class {
|
|
|
20167
20182
|
* `lastSeenAt`(用于展示"最后在线于")。
|
|
20168
20183
|
*/
|
|
20169
20184
|
async setOnline(path, online, now) {
|
|
20170
|
-
const norm =
|
|
20185
|
+
const norm = canonicalizePath(path);
|
|
20171
20186
|
const existing = await this.read(norm);
|
|
20172
20187
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20173
20188
|
const updated = {
|
|
@@ -20184,7 +20199,7 @@ var NodeRegistryStore = class {
|
|
|
20184
20199
|
* 不该扰动 updatedAt 的语义)。节点不存在时静默返回——心跳晚于节点删除是正常竞态,不报错。
|
|
20185
20200
|
*/
|
|
20186
20201
|
async touchSeen(path, now) {
|
|
20187
|
-
const norm =
|
|
20202
|
+
const norm = canonicalizePath(path);
|
|
20188
20203
|
const existing = await this.read(norm);
|
|
20189
20204
|
if (!existing) return;
|
|
20190
20205
|
await this.store.put(this.keyOf(norm), { ...existing, lastSeenAt: now });
|
|
@@ -20197,7 +20212,7 @@ var NodeRegistryStore = class {
|
|
|
20197
20212
|
* (不允许删除非空子树;显式 directory 同理)。
|
|
20198
20213
|
*/
|
|
20199
20214
|
async delete(path) {
|
|
20200
|
-
const norm =
|
|
20215
|
+
const norm = canonicalizePath(path);
|
|
20201
20216
|
const existing = await this.read(norm);
|
|
20202
20217
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20203
20218
|
if (await this.hasChildren(norm)) {
|
|
@@ -20216,7 +20231,7 @@ var NodeRegistryStore = class {
|
|
|
20216
20231
|
* 普通管理面仍使用 delete(),不允许误删非空子树。
|
|
20217
20232
|
*/
|
|
20218
20233
|
async deleteSubtree(path) {
|
|
20219
|
-
const norm =
|
|
20234
|
+
const norm = canonicalizePath(path);
|
|
20220
20235
|
const existing = await this.read(norm);
|
|
20221
20236
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20222
20237
|
const descendants = await this.scanPrefix(this.subtreePrefix(norm));
|
|
@@ -20235,7 +20250,7 @@ var NodeRegistryStore = class {
|
|
|
20235
20250
|
* 完全匹配 → rest=''。无任何匹配 → not_found。
|
|
20236
20251
|
*/
|
|
20237
20252
|
async resolve(path) {
|
|
20238
|
-
const norm =
|
|
20253
|
+
const norm = canonicalizePath(path);
|
|
20239
20254
|
const candidates = [norm, ...parentPaths(norm).reverse()];
|
|
20240
20255
|
for (const cand of candidates) {
|
|
20241
20256
|
const node = await this.read(cand);
|