@tool-bridge/server 0.10.0 → 0.12.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-5W6SJMSM.js → airtable-E2TJFCGB.js} +4 -4
- package/dist/{alt_text_generator_ai-YYVJM3RG.js → alt_text_generator_ai-UBV5H2N3.js} +4 -4
- package/dist/{amap-EREMQZHQ.js → amap-ASVRIYPW.js} +4 -4
- package/dist/{anthropic-53H7WGSE.js → anthropic-LQSJWGV3.js} +4 -4
- package/dist/{apify-CMRNU7VZ.js → apify-CL4YK6HT.js} +4 -4
- package/dist/{brave_search-AFZVZ3QK.js → brave_search-WZQF2QWE.js} +4 -4
- package/dist/{chunk-TPGTA43F.js → chunk-4U5OQW7F.js} +144 -115
- package/dist/{chunk-2DA2UI37.js → chunk-BK2ZIWLD.js} +2 -2
- package/dist/{chunk-Q44CYUSI.js → chunk-HIROW6TB.js} +36 -35
- package/dist/{chunk-SBJMMSPA.js → chunk-P4TQJHBO.js} +1 -1
- package/dist/{chunk-Q7YHZ2SD.js → chunk-TXOHC56J.js} +212 -183
- package/dist/{circleci-JG7RV2RU.js → circleci-EHGI2HKR.js} +4 -4
- package/dist/{clerk-U7OS5ALG.js → clerk-OUN4SX22.js} +4 -4
- package/dist/{cloudflare_dns-ADCTFMMI.js → cloudflare_dns-DMU3WOPG.js} +4 -4
- package/dist/{cohere-Z7ZEC2YV.js → cohere-3HDSCQIB.js} +4 -4
- package/dist/{confluence-FT22JGYQ.js → confluence-YPZXKQTQ.js} +4 -4
- package/dist/{convertapi-UQQCWVWP.js → convertapi-47ENNUBY.js} +4 -4
- package/dist/{currencyapi-Y63O7JTP.js → currencyapi-IX4ICDZA.js} +4 -4
- package/dist/{deepseek-7TSAMZJ6.js → deepseek-SCOPJSA6.js} +4 -4
- package/dist/{docker_hub-AJYTVI25.js → docker_hub-2DXJVAP4.js} +4 -4
- package/dist/{dropbox-CNGGNR5J.js → dropbox-LE2OM2SR.js} +4 -4
- package/dist/{dub-WTADKHA7.js → dub-7LKKJADI.js} +4 -4
- package/dist/{e2b-75EKXMN5.js → e2b-P3EOM65Q.js} +4 -4
- package/dist/{exa-OFLA5XND.js → exa-AETANJQ3.js} +4 -4
- package/dist/{fal_ai-5542HB7N.js → fal_ai-VWAMTEZE.js} +4 -4
- package/dist/{feishu-QQIZ7G24.js → feishu-VQMM3APW.js} +3 -3
- package/dist/{feishu_custom_bot-EVDKIZCR.js → feishu_custom_bot-HEK63AP3.js} +4 -4
- package/dist/{figma-ZEBDUMWI.js → figma-7JMV3B5O.js} +4 -4
- package/dist/{firehydrant-CTBNY6FL.js → firehydrant-SOU4P7SE.js} +4 -4
- package/dist/{fixer-ITDYMRBW.js → fixer-KELXNOIQ.js} +4 -4
- package/dist/{fly-IBFMSAAO.js → fly-Y26QH6AC.js} +4 -4
- package/dist/{front-AZQLLUJQ.js → front-2RUHP54Y.js} +4 -4
- package/dist/{geocodio-XHZHEWQW.js → geocodio-BTSXWU55.js} +4 -4
- package/dist/{ghost-RTIKXD3T.js → ghost-BA55ISIU.js} +4 -4
- package/dist/{github-WRJBJ5N7.js → github-VUYFDSHK.js} +4 -4
- package/dist/{gmail-527RVDXV.js → gmail-3Z2WCVLT.js} +4 -4
- package/dist/{googlecalendar-WZJSK2MR.js → googlecalendar-LZKRUXHY.js} +4 -4
- package/dist/{googledocs-LFBVIHIK.js → googledocs-RBK2HMPZ.js} +4 -4
- package/dist/{grafana-3JEKO7NT.js → grafana-E626W3N3.js} +4 -4
- package/dist/{graphhopper-TOJN6K2Q.js → graphhopper-YNURJCFZ.js} +4 -4
- package/dist/index.d.ts +11 -11
- package/dist/index.js +2 -2
- package/dist/{ip2proxy-KOA2JUNV.js → ip2proxy-4DAJUOUR.js} +4 -4
- package/dist/{ipgeolocation_io-KNOQD7R7.js → ipgeolocation_io-3BUSFLVD.js} +4 -4
- package/dist/{ipqualityscore-GF2MQKXI.js → ipqualityscore-7DKMRMEQ.js} +4 -4
- package/dist/{jina_ai-GB3CQPJ4.js → jina_ai-NXXZRPT6.js} +4 -4
- package/dist/{jira-35XYV6G4.js → jira-UG7ZIKSW.js} +4 -4
- package/dist/{langsmith-W5234OE7.js → langsmith-66IP4KJ6.js} +4 -4
- package/dist/{lemlist-QB6W2G7N.js → lemlist-MVB4EQMS.js} +4 -4
- package/dist/{linear-MHBD6A7X.js → linear-6UC3AFY3.js} +4 -4
- package/dist/{logsnag-RN57XIJS.js → logsnag-NFJM6O4U.js} +4 -4
- package/dist/main.js +102 -102
- package/dist/{mattermost-QRXSZMZA.js → mattermost-FTJER2B6.js} +4 -4
- package/dist/{mem0-K63NN3LA.js → mem0-RR5ALUKD.js} +4 -4
- package/dist/{memos-4IOUOFKH.js → memos-WOAY3T76.js} +4 -4
- package/dist/{metabase-IOE44EKL.js → metabase-ZYG7NBPU.js} +4 -4
- package/dist/{mistral_ai-X7ASGV5I.js → mistral_ai-FTCSXHJ5.js} +4 -4
- package/dist/{mother_duck-CNN3QWQH.js → mother_duck-ZMIGT5ZK.js} +4 -4
- package/dist/{ngrok-QNE4AHEH.js → ngrok-TEDZ4WUB.js} +4 -4
- package/dist/{notes-Q6OLBS2L.js → notes-4KZGQBRF.js} +2 -2
- package/dist/{notion-ADDRQTCE.js → notion-ERLC3SKM.js} +4 -4
- package/dist/{open_exchange_rates-WR5PJQTG.js → open_exchange_rates-GBBHZLUS.js} +4 -4
- package/dist/{openai-UZBNNAAH.js → openai-24N26QWI.js} +4 -4
- package/dist/{opengraph_io-2JNEXCPJ.js → opengraph_io-MTN4TTXP.js} +4 -4
- package/dist/{openrouter-EF62BDIH.js → openrouter-BK6BL7EH.js} +4 -4
- package/dist/{outline-O4TIRWJT.js → outline-O3LF5SNM.js} +4 -4
- package/dist/{paddle-SEFKNENH.js → paddle-IEDD5BMW.js} +4 -4
- package/dist/{perplexity-FZYOIPDS.js → perplexity-HGPLFK72.js} +4 -4
- package/dist/{pinecone-EXDPYDY7.js → pinecone-FTWR4JVG.js} +4 -4
- package/dist/{pipedrive-EDO4C3AM.js → pipedrive-DDMA36AB.js} +4 -4
- package/dist/{polar-QJXHVFIP.js → polar-YFGTOQYM.js} +4 -4
- package/dist/{posthog-U6QEXJE2.js → posthog-GFEFPIH3.js} +4 -4
- package/dist/{postmark-PFZIWXMP.js → postmark-N7YCE2DZ.js} +4 -4
- package/dist/{prerender-SK2AXNJY.js → prerender-B77XIKL7.js} +4 -4
- package/dist/{pubmed-CB7OJNBH.js → pubmed-XAFQSOCJ.js} +4 -4
- package/dist/{railway-BMMNQ6XH.js → railway-DJ4P5DAJ.js} +4 -4
- package/dist/{readwise-YQY7O5QR.js → readwise-UNBGXBYC.js} +4 -4
- package/dist/{render-7CRNEEJ3.js → render-Z43FLDJ3.js} +4 -4
- package/dist/{replicate-V6AX7WFC.js → replicate-BZAMQO7R.js} +4 -4
- package/dist/{resend-ZBH56UAQ.js → resend-MFUW2LNU.js} +4 -4
- package/dist/{rootly-C4FIXIF7.js → rootly-5CHCWRPM.js} +4 -4
- package/dist/{scrapfly-UE434KD7.js → scrapfly-36O4IJDA.js} +4 -4
- package/dist/{scrapingbee-PQCNKALD.js → scrapingbee-JK6HZA75.js} +4 -4
- package/dist/{screenshot_fyi-U6QGI6ZH.js → screenshot_fyi-BDEL4D53.js} +4 -4
- package/dist/{semantic_scholar-PSMUOG2W.js → semantic_scholar-QHHG7RWT.js} +4 -4
- package/dist/{sentry-F5CNVQA2.js → sentry-OCUW4KNC.js} +4 -4
- package/dist/{shodan-NOWG7NV5.js → shodan-5UBQ6RKP.js} +4 -4
- package/dist/{shopify-GGPLJIGC.js → shopify-OXIMRVHL.js} +4 -4
- package/dist/{stripe-72K2UMK3.js → stripe-W5XRW7WG.js} +4 -4
- package/dist/{supabase-H7NRCSAO.js → supabase-DIC7ZIG7.js} +4 -4
- package/dist/{tavily-ISP24QUX.js → tavily-NVWQPGF3.js} +4 -4
- package/dist/{telegram-POII6NKE.js → telegram-S755MPMM.js} +4 -4
- package/dist/{telnyx-3D7TOVNA.js → telnyx-MXRX75AP.js} +4 -4
- package/dist/{todoist-LKYPKRKB.js → todoist-MNVUPHIF.js} +4 -4
- package/dist/{trello-WW74UYIQ.js → trello-T7JLVYU4.js} +4 -4
- package/dist/{turso-SUFRHBHW.js → turso-JDBW2RN4.js} +4 -4
- package/dist/{twilio-QB7PBL2B.js → twilio-EGYNUGMZ.js} +4 -4
- package/dist/{umami-CAHHP3SV.js → umami-QF2V23Z5.js} +4 -4
- package/dist/{unsplash-ZCGEPHGQ.js → unsplash-VWTABYWL.js} +4 -4
- package/dist/{upstash_redis-DZ4AKZWT.js → upstash_redis-FKUGE73T.js} +4 -4
- package/dist/{uptimerobot-KVEQJGTZ.js → uptimerobot-55LTBUWA.js} +4 -4
- package/dist/{v2ex-BCYYBPH7.js → v2ex-LGG6X53N.js} +4 -4
- package/dist/{vercel-GH4G7EUS.js → vercel-VAZGWMOZ.js} +4 -4
- package/dist/{wolfram_alpha_api-XFG2MQBL.js → wolfram_alpha_api-YLVVZTPP.js} +4 -4
- package/dist/{wordpress-DZ2TVNAA.js → wordpress-6LDTITVV.js} +4 -4
- package/dist/{workos-EHUAGTGN.js → workos-ML6NIEEP.js} +4 -4
- package/dist/{zhihu-OJJW3ZIH.js → zhihu-CACG2ZNY.js} +4 -4
- package/package.json +4 -4
|
@@ -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
|
}
|
|
@@ -14637,6 +14658,20 @@ var KEY_BOOTSTRAPPED = "sys:bootstrapped";
|
|
|
14637
14658
|
var KEY_REMOTE_ALLOWLIST = "sys:remoteallowlist";
|
|
14638
14659
|
var KEY_ANNOTATION = "annotation:";
|
|
14639
14660
|
var KEY_FEEDBACK = "feedback:";
|
|
14661
|
+
var MAX_CODE_POINT = 1114111;
|
|
14662
|
+
var SURROGATE_START = 55296;
|
|
14663
|
+
var SURROGATE_END = 57343;
|
|
14664
|
+
function prefixUpperBound(prefix) {
|
|
14665
|
+
const points = [...prefix];
|
|
14666
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
14667
|
+
const code = points[i]?.codePointAt(0);
|
|
14668
|
+
if (code === void 0 || code >= MAX_CODE_POINT) continue;
|
|
14669
|
+
let next = code + 1;
|
|
14670
|
+
if (next >= SURROGATE_START && next <= SURROGATE_END) next = SURROGATE_END + 1;
|
|
14671
|
+
return points.slice(0, i).join("") + String.fromCodePoint(next);
|
|
14672
|
+
}
|
|
14673
|
+
return void 0;
|
|
14674
|
+
}
|
|
14640
14675
|
|
|
14641
14676
|
// ../core/src/annotation/store.ts
|
|
14642
14677
|
var ANNOTATION_TEXT_MAX = 2e3;
|
|
@@ -14744,11 +14779,12 @@ var MAX_PATTERN_SEGMENTS = 64;
|
|
|
14744
14779
|
function matchGlob(pattern, path) {
|
|
14745
14780
|
const pat = [];
|
|
14746
14781
|
for (const token of segments2(pattern)) {
|
|
14747
|
-
|
|
14748
|
-
pat.
|
|
14782
|
+
const lower = token.toLowerCase();
|
|
14783
|
+
if (lower === "**" && pat[pat.length - 1] === "**") continue;
|
|
14784
|
+
pat.push(lower);
|
|
14749
14785
|
}
|
|
14750
14786
|
if (pat.length > MAX_PATTERN_SEGMENTS) return false;
|
|
14751
|
-
return matchFrom(pat, 0, segments2(path), 0);
|
|
14787
|
+
return matchFrom(pat, 0, segments2(path).map((s) => s.toLowerCase()), 0);
|
|
14752
14788
|
}
|
|
14753
14789
|
var effectOf = (scope) => scope.effect ?? "allow";
|
|
14754
14790
|
var matches = (scope, path, action) => scope.actions.includes(action) && matchGlob(scope.pattern, path);
|
|
@@ -15035,6 +15071,9 @@ async function identify(store, bearer, now) {
|
|
|
15035
15071
|
|
|
15036
15072
|
// ../core/src/builtin/util.ts
|
|
15037
15073
|
var VOID_ACK = { ok: true };
|
|
15074
|
+
function withCommandPaths(nodePath, cmds) {
|
|
15075
|
+
return cmds.map((cmd) => ({ ...cmd, path: `/${nodePath}/${cmd.name}` }));
|
|
15076
|
+
}
|
|
15038
15077
|
var LIST_OPTS_SCHEMA = {
|
|
15039
15078
|
type: "object",
|
|
15040
15079
|
description: "pagination options",
|
|
@@ -15135,7 +15174,7 @@ function matches2(item, query) {
|
|
|
15135
15174
|
}
|
|
15136
15175
|
function catalogCmds(nodePath) {
|
|
15137
15176
|
const path = cmdPath(nodePath);
|
|
15138
|
-
|
|
15177
|
+
const cmds = [
|
|
15139
15178
|
{
|
|
15140
15179
|
name: "list",
|
|
15141
15180
|
method: "POST",
|
|
@@ -15175,6 +15214,7 @@ function catalogCmds(nodePath) {
|
|
|
15175
15214
|
scope: "read"
|
|
15176
15215
|
}
|
|
15177
15216
|
];
|
|
15217
|
+
return withCommandPaths(nodePath, cmds);
|
|
15178
15218
|
}
|
|
15179
15219
|
function paginate(items, opts) {
|
|
15180
15220
|
const o = typeof opts === "object" && opts !== null ? opts : {};
|
|
@@ -15384,8 +15424,8 @@ function parseTokenResponse(payload, config2, now) {
|
|
|
15384
15424
|
}
|
|
15385
15425
|
|
|
15386
15426
|
// ../core/src/context/capabilities.ts
|
|
15387
|
-
var CONTEXT_METHODS = ["
|
|
15388
|
-
var CONTEXT_WRITE_METHODS = ["
|
|
15427
|
+
var CONTEXT_METHODS = ["list", "get", "search", "write", "update", "delete"];
|
|
15428
|
+
var CONTEXT_WRITE_METHODS = ["write", "update", "delete"];
|
|
15389
15429
|
function contextMethodsOf(provider) {
|
|
15390
15430
|
const methods = /* @__PURE__ */ new Set();
|
|
15391
15431
|
for (const method of CONTEXT_METHODS) {
|
|
@@ -15398,8 +15438,8 @@ function isReadOnlyProvider(provider) {
|
|
|
15398
15438
|
}
|
|
15399
15439
|
function contextCapabilitiesOf(provider) {
|
|
15400
15440
|
const capabilities = [];
|
|
15401
|
-
if (provider.
|
|
15402
|
-
if (provider.
|
|
15441
|
+
if (provider.search !== void 0) capabilities.push("search");
|
|
15442
|
+
if (provider.delete !== void 0) capabilities.push("delete");
|
|
15403
15443
|
return capabilities;
|
|
15404
15444
|
}
|
|
15405
15445
|
|
|
@@ -15410,8 +15450,8 @@ var NODE_KIND_BY_PROFILE2 = {
|
|
|
15410
15450
|
"context/v1": "context"
|
|
15411
15451
|
};
|
|
15412
15452
|
var OPTIONAL_METHOD_BY_CAPABILITY = {
|
|
15413
|
-
search: "
|
|
15414
|
-
delete: "
|
|
15453
|
+
search: "search",
|
|
15454
|
+
delete: "delete"
|
|
15415
15455
|
};
|
|
15416
15456
|
function optionalMethodsForCapabilities(capabilities) {
|
|
15417
15457
|
const methods = /* @__PURE__ */ new Set();
|
|
@@ -15717,7 +15757,7 @@ function pluginCmds(nodePath) {
|
|
|
15717
15757
|
properties: { id: { type: "string", description: "plugin id" } },
|
|
15718
15758
|
required: ["id"]
|
|
15719
15759
|
};
|
|
15720
|
-
|
|
15760
|
+
const cmds = [
|
|
15721
15761
|
{
|
|
15722
15762
|
name: "list",
|
|
15723
15763
|
method: "POST",
|
|
@@ -15801,6 +15841,7 @@ function pluginCmds(nodePath) {
|
|
|
15801
15841
|
scope: "admin"
|
|
15802
15842
|
}
|
|
15803
15843
|
];
|
|
15844
|
+
return withCommandPaths(nodePath, cmds);
|
|
15804
15845
|
}
|
|
15805
15846
|
function clampLimit2(limit) {
|
|
15806
15847
|
if (limit === void 0 || limit < 1) return LIST_LIMIT_DEFAULT;
|
|
@@ -16000,7 +16041,7 @@ function createPluginModule(deps) {
|
|
|
16000
16041
|
var DESCRIPTION3 = "Path annotations: admin-curated notes shown in ~help of the annotated path (set / get / remove / list)";
|
|
16001
16042
|
function annotationCmds(nodePath) {
|
|
16002
16043
|
const path = cmdPath(nodePath);
|
|
16003
|
-
|
|
16044
|
+
const cmds = [
|
|
16004
16045
|
{
|
|
16005
16046
|
name: "set",
|
|
16006
16047
|
method: "POST",
|
|
@@ -16061,6 +16102,7 @@ function annotationCmds(nodePath) {
|
|
|
16061
16102
|
scope: "read"
|
|
16062
16103
|
}
|
|
16063
16104
|
];
|
|
16105
|
+
return withCommandPaths(nodePath, cmds);
|
|
16064
16106
|
}
|
|
16065
16107
|
function requireRootablePath(args) {
|
|
16066
16108
|
const v = args.path;
|
|
@@ -16178,7 +16220,7 @@ var RemoteAllowlistStore = class {
|
|
|
16178
16220
|
var DESCRIPTION4 = "Remote federation host allowlist: which hosts kind=remote nodes may connect to (env baseline is read-only; admin only)";
|
|
16179
16221
|
function federationCmds(nodePath) {
|
|
16180
16222
|
const path = cmdPath(nodePath);
|
|
16181
|
-
|
|
16223
|
+
const cmds = [
|
|
16182
16224
|
{
|
|
16183
16225
|
name: "list",
|
|
16184
16226
|
method: "POST",
|
|
@@ -16220,6 +16262,7 @@ function federationCmds(nodePath) {
|
|
|
16220
16262
|
scope: "admin"
|
|
16221
16263
|
}
|
|
16222
16264
|
];
|
|
16265
|
+
return withCommandPaths(nodePath, cmds);
|
|
16223
16266
|
}
|
|
16224
16267
|
function mergedView(base, entries) {
|
|
16225
16268
|
const byHost = /* @__PURE__ */ new Map();
|
|
@@ -16296,7 +16339,7 @@ var NODE_FIELD_SCHEMAS = {
|
|
|
16296
16339
|
};
|
|
16297
16340
|
function registryCmds(nodePath) {
|
|
16298
16341
|
const path = cmdPath(nodePath);
|
|
16299
|
-
|
|
16342
|
+
const cmds = [
|
|
16300
16343
|
{
|
|
16301
16344
|
name: "list",
|
|
16302
16345
|
method: "POST",
|
|
@@ -16372,6 +16415,7 @@ function registryCmds(nodePath) {
|
|
|
16372
16415
|
scope: "register"
|
|
16373
16416
|
}
|
|
16374
16417
|
];
|
|
16418
|
+
return withCommandPaths(nodePath, cmds);
|
|
16375
16419
|
}
|
|
16376
16420
|
function parseNodeInput(args) {
|
|
16377
16421
|
const path = requireString(args, "path");
|
|
@@ -16443,7 +16487,7 @@ function assertUserSecretName(name) {
|
|
|
16443
16487
|
}
|
|
16444
16488
|
function secretCmds(nodePath) {
|
|
16445
16489
|
const path = cmdPath(nodePath);
|
|
16446
|
-
|
|
16490
|
+
const cmds = [
|
|
16447
16491
|
{
|
|
16448
16492
|
name: "set",
|
|
16449
16493
|
method: "POST",
|
|
@@ -16489,6 +16533,7 @@ function secretCmds(nodePath) {
|
|
|
16489
16533
|
scope: "admin"
|
|
16490
16534
|
}
|
|
16491
16535
|
];
|
|
16536
|
+
return withCommandPaths(nodePath, cmds);
|
|
16492
16537
|
}
|
|
16493
16538
|
function createSecretModule(store, now) {
|
|
16494
16539
|
return {
|
|
@@ -16526,7 +16571,7 @@ function createSecretModule(store, now) {
|
|
|
16526
16571
|
// ../core/src/builtin/status.ts
|
|
16527
16572
|
var DESCRIPTION7 = "Gateway health and summary (readable without admin)";
|
|
16528
16573
|
function statusCmds(nodePath) {
|
|
16529
|
-
return [
|
|
16574
|
+
return withCommandPaths(nodePath, [
|
|
16530
16575
|
{
|
|
16531
16576
|
name: "get",
|
|
16532
16577
|
method: "POST",
|
|
@@ -16536,7 +16581,7 @@ function statusCmds(nodePath) {
|
|
|
16536
16581
|
returns: "{ healthy, version, nodeCount }",
|
|
16537
16582
|
scope: "read"
|
|
16538
16583
|
}
|
|
16539
|
-
];
|
|
16584
|
+
]);
|
|
16540
16585
|
}
|
|
16541
16586
|
function createStatusModule(deps) {
|
|
16542
16587
|
return {
|
|
@@ -16601,7 +16646,7 @@ var SK_FIELD_SCHEMAS = {
|
|
|
16601
16646
|
};
|
|
16602
16647
|
function skCmds(nodePath) {
|
|
16603
16648
|
const path = cmdPath(nodePath);
|
|
16604
|
-
|
|
16649
|
+
const cmds = [
|
|
16605
16650
|
{
|
|
16606
16651
|
name: "list",
|
|
16607
16652
|
method: "POST",
|
|
@@ -16676,6 +16721,7 @@ function skCmds(nodePath) {
|
|
|
16676
16721
|
scope: "admin"
|
|
16677
16722
|
}
|
|
16678
16723
|
];
|
|
16724
|
+
return withCommandPaths(nodePath, cmds);
|
|
16679
16725
|
}
|
|
16680
16726
|
function asSecretKeyInput(args) {
|
|
16681
16727
|
const owner = requireString(args, "owner");
|
|
@@ -16777,12 +16823,12 @@ function createBuiltins(deps) {
|
|
|
16777
16823
|
// ../core/src/context/help.ts
|
|
16778
16824
|
var CONTEXT_CAPABILITIES = ["search", "delete"];
|
|
16779
16825
|
var SCOPE_BY_CMD = {
|
|
16780
|
-
|
|
16781
|
-
|
|
16782
|
-
|
|
16783
|
-
|
|
16784
|
-
|
|
16785
|
-
|
|
16826
|
+
list: "read",
|
|
16827
|
+
get: "read",
|
|
16828
|
+
search: "read",
|
|
16829
|
+
write: "write",
|
|
16830
|
+
update: "write",
|
|
16831
|
+
delete: "write"
|
|
16786
16832
|
};
|
|
16787
16833
|
function contextScopeForCmd(tool) {
|
|
16788
16834
|
return SCOPE_BY_CMD[tool] ?? null;
|
|
@@ -16833,9 +16879,9 @@ var PATCH_SCHEMA = {
|
|
|
16833
16879
|
};
|
|
16834
16880
|
function contextCmds(nodePath) {
|
|
16835
16881
|
const path = cmdPath(nodePath);
|
|
16836
|
-
|
|
16882
|
+
const cmds = [
|
|
16837
16883
|
{
|
|
16838
|
-
name: "
|
|
16884
|
+
name: "list",
|
|
16839
16885
|
method: "POST",
|
|
16840
16886
|
path,
|
|
16841
16887
|
h: "list entries directly under a path (shallow, paginated)",
|
|
@@ -16850,7 +16896,7 @@ function contextCmds(nodePath) {
|
|
|
16850
16896
|
scope: "read"
|
|
16851
16897
|
},
|
|
16852
16898
|
{
|
|
16853
|
-
name: "
|
|
16899
|
+
name: "get",
|
|
16854
16900
|
method: "POST",
|
|
16855
16901
|
path,
|
|
16856
16902
|
h: "read one entry with content (oversized content comes back as { $ref: <download URL> })",
|
|
@@ -16865,7 +16911,7 @@ function contextCmds(nodePath) {
|
|
|
16865
16911
|
scope: "read"
|
|
16866
16912
|
},
|
|
16867
16913
|
{
|
|
16868
|
-
name: "
|
|
16914
|
+
name: "write",
|
|
16869
16915
|
method: "POST",
|
|
16870
16916
|
path,
|
|
16871
16917
|
h: "create or fully replace an entry (idempotent upsert)",
|
|
@@ -16881,7 +16927,7 @@ function contextCmds(nodePath) {
|
|
|
16881
16927
|
scope: "write"
|
|
16882
16928
|
},
|
|
16883
16929
|
{
|
|
16884
|
-
name: "
|
|
16930
|
+
name: "update",
|
|
16885
16931
|
method: "POST",
|
|
16886
16932
|
path,
|
|
16887
16933
|
h: "partially update content and/or metadata (shallow merge); not_found if the entry does not exist",
|
|
@@ -16897,7 +16943,7 @@ function contextCmds(nodePath) {
|
|
|
16897
16943
|
scope: "write"
|
|
16898
16944
|
},
|
|
16899
16945
|
{
|
|
16900
|
-
name: "
|
|
16946
|
+
name: "delete",
|
|
16901
16947
|
method: "POST",
|
|
16902
16948
|
path,
|
|
16903
16949
|
h: "delete an entry (idempotent)",
|
|
@@ -16912,7 +16958,7 @@ function contextCmds(nodePath) {
|
|
|
16912
16958
|
effect: "destructive"
|
|
16913
16959
|
},
|
|
16914
16960
|
{
|
|
16915
|
-
name: "
|
|
16961
|
+
name: "search",
|
|
16916
16962
|
method: "POST",
|
|
16917
16963
|
path,
|
|
16918
16964
|
h: "keyword search: substring match on entry paths and metadata values",
|
|
@@ -16928,6 +16974,7 @@ function contextCmds(nodePath) {
|
|
|
16928
16974
|
scope: "read"
|
|
16929
16975
|
}
|
|
16930
16976
|
];
|
|
16977
|
+
return withCommandPaths(nodePath, cmds);
|
|
16931
16978
|
}
|
|
16932
16979
|
function contextHelpModel(node, opts = {}) {
|
|
16933
16980
|
const all = contextCmds(node.path);
|
|
@@ -17096,7 +17143,7 @@ function createObjectContextProvider(store, opts) {
|
|
|
17096
17143
|
};
|
|
17097
17144
|
const notFound = (path) => TBError.notFound(`context entry \u4E0D\u5B58\u5728:'${path}'`);
|
|
17098
17145
|
return {
|
|
17099
|
-
async
|
|
17146
|
+
async list(path, listOpts) {
|
|
17100
17147
|
rejectFilter(listOpts);
|
|
17101
17148
|
const limit = clampLimit3(listOpts?.limit);
|
|
17102
17149
|
const rel = path === "" ? "" : `${normalizeEntryPath(path)}/`;
|
|
@@ -17118,7 +17165,7 @@ function createObjectContextProvider(store, opts) {
|
|
|
17118
17165
|
}
|
|
17119
17166
|
return res.cursor !== void 0 ? { items, cursor: res.cursor } : { items };
|
|
17120
17167
|
},
|
|
17121
|
-
async
|
|
17168
|
+
async get(path) {
|
|
17122
17169
|
const key = keyFor(path);
|
|
17123
17170
|
const head = await store.head(key);
|
|
17124
17171
|
if (!head) throw notFound(path);
|
|
@@ -17137,8 +17184,8 @@ function createObjectContextProvider(store, opts) {
|
|
|
17137
17184
|
}
|
|
17138
17185
|
return { ...meta3, content: text };
|
|
17139
17186
|
},
|
|
17140
|
-
async
|
|
17141
|
-
assertWritable("
|
|
17187
|
+
async write(path, entry) {
|
|
17188
|
+
assertWritable("write");
|
|
17142
17189
|
const key = keyFor(path);
|
|
17143
17190
|
const { body, contentType } = serializeInput(entry);
|
|
17144
17191
|
const meta3 = await store.put(key, body, {
|
|
@@ -17148,8 +17195,8 @@ function createObjectContextProvider(store, opts) {
|
|
|
17148
17195
|
});
|
|
17149
17196
|
return toMeta(meta3);
|
|
17150
17197
|
},
|
|
17151
|
-
async
|
|
17152
|
-
assertWritable("
|
|
17198
|
+
async update(path, patch) {
|
|
17199
|
+
assertWritable("update");
|
|
17153
17200
|
const key = keyFor(path);
|
|
17154
17201
|
if (patch.content === void 0 && patch.metadata === void 0) {
|
|
17155
17202
|
throw new TBError("invalid_argument", "patch \u81F3\u5C11\u63D0\u4F9B content \u6216 metadata \u4E4B\u4E00");
|
|
@@ -17176,11 +17223,11 @@ function createObjectContextProvider(store, opts) {
|
|
|
17176
17223
|
});
|
|
17177
17224
|
return toMeta(meta3);
|
|
17178
17225
|
},
|
|
17179
|
-
async
|
|
17180
|
-
assertWritable("
|
|
17226
|
+
async delete(path) {
|
|
17227
|
+
assertWritable("delete");
|
|
17181
17228
|
await store.delete(keyFor(path));
|
|
17182
17229
|
},
|
|
17183
|
-
async
|
|
17230
|
+
async search(query, searchOpts) {
|
|
17184
17231
|
const mode = searchOpts?.mode ?? "keyword";
|
|
17185
17232
|
if (mode === "semantic") {
|
|
17186
17233
|
throw new TBError("invalid_argument", "semantic \u68C0\u7D22\u672A\u58F0\u660E('search:semantic' capability)");
|
|
@@ -17299,8 +17346,7 @@ var schemaByType = {
|
|
|
17299
17346
|
call: external_exports.object({
|
|
17300
17347
|
type: external_exports.literal("call"),
|
|
17301
17348
|
id: idSchema,
|
|
17302
|
-
path: external_exports.string(),
|
|
17303
|
-
tool: external_exports.string().min(1),
|
|
17349
|
+
path: external_exports.string().min(1),
|
|
17304
17350
|
arguments: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
17305
17351
|
context: deviceCallContextSchema.optional()
|
|
17306
17352
|
}),
|
|
@@ -17530,7 +17576,6 @@ var DeviceGatewaySession = class {
|
|
|
17530
17576
|
type: "call",
|
|
17531
17577
|
id: req.id,
|
|
17532
17578
|
path: req.path,
|
|
17533
|
-
tool: req.tool,
|
|
17534
17579
|
arguments: req.arguments,
|
|
17535
17580
|
// undefined 经 JSON.stringify 丢弃:老网关不带 context 时帧形状不变。
|
|
17536
17581
|
...req.context !== void 0 ? { context: req.context } : {}
|
|
@@ -17798,8 +17843,7 @@ function renderHelpDsl(model) {
|
|
|
17798
17843
|
lines.push(`cmd ${cmd.name} ${cmd.method} ${cmd.path}`);
|
|
17799
17844
|
if (cmd.h !== void 0) lines.push(...attrLines("h", cmd.h));
|
|
17800
17845
|
if (cmd.inputSchema !== void 0) {
|
|
17801
|
-
|
|
17802
|
-
lines.push(` body ${JSON.stringify(body)}`);
|
|
17846
|
+
lines.push(` body ${JSON.stringify(cmd.inputSchema)}`);
|
|
17803
17847
|
}
|
|
17804
17848
|
if (cmd.outputSchema !== void 0) lines.push(` result ${JSON.stringify(cmd.outputSchema)}`);
|
|
17805
17849
|
if (cmd.returns !== void 0) lines.push(...attrLines("returns", cmd.returns));
|
|
@@ -17873,8 +17917,7 @@ function cmdSection(cmd, index) {
|
|
|
17873
17917
|
if (cmd.h !== void 0 && cmd.h.trim() !== "") {
|
|
17874
17918
|
lines.push(cmd.h.trim(), "");
|
|
17875
17919
|
}
|
|
17876
|
-
|
|
17877
|
-
lines.push(`- Invoke: \`POST ${cmd.path}\` with body ${bodyShape}`);
|
|
17920
|
+
lines.push(`- Invoke: \`POST ${cmd.path}\` with body \`{...arguments}\``);
|
|
17878
17921
|
lines.push(`- Required scope: \`${cmd.scope}\``);
|
|
17879
17922
|
if (cmd.effect !== void 0) {
|
|
17880
17923
|
lines.push(
|
|
@@ -17887,15 +17930,14 @@ function cmdSection(cmd, index) {
|
|
|
17887
17930
|
if (cmd.inputSchema !== void 0) {
|
|
17888
17931
|
lines.push(
|
|
17889
17932
|
"",
|
|
17890
|
-
|
|
17933
|
+
"Request body (JSON Schema):",
|
|
17891
17934
|
"",
|
|
17892
17935
|
"```json",
|
|
17893
17936
|
JSON.stringify(cmd.inputSchema, null, 2),
|
|
17894
17937
|
"```"
|
|
17895
17938
|
);
|
|
17896
17939
|
} else if (index) {
|
|
17897
|
-
|
|
17898
|
-
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\``);
|
|
17899
17941
|
} else {
|
|
17900
17942
|
lines.push("- Arguments: none declared");
|
|
17901
17943
|
}
|
|
@@ -17920,31 +17962,18 @@ function renderHelpMarkdown(model) {
|
|
|
17920
17962
|
out.push(model.note.trim(), "");
|
|
17921
17963
|
}
|
|
17922
17964
|
if (model.cmds.length > 0) {
|
|
17923
|
-
const allFlat = model.cmds.every((c) => c.flatBody === true);
|
|
17924
17965
|
out.push("## How to call");
|
|
17925
17966
|
out.push("");
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
17929
|
-
|
|
17930
|
-
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
|
|
17934
|
-
|
|
17935
|
-
|
|
17936
|
-
out.push("```");
|
|
17937
|
-
} else {
|
|
17938
|
-
const invokePath = model.cmds[0]?.path ?? displayPath2(model.node.path);
|
|
17939
|
-
out.push("Every command on this node is invoked with the same request shape:");
|
|
17940
|
-
out.push("");
|
|
17941
|
-
out.push("```");
|
|
17942
|
-
out.push(`POST ${invokePath}`);
|
|
17943
|
-
out.push("Content-Type: application/json");
|
|
17944
|
-
out.push("");
|
|
17945
|
-
out.push('{"tool": "<command name>", "arguments": {...}}');
|
|
17946
|
-
out.push("```");
|
|
17947
|
-
}
|
|
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("```");
|
|
17948
17977
|
out.push("");
|
|
17949
17978
|
out.push("`Required scope` names the permission your Secret Key must hold for that command.");
|
|
17950
17979
|
out.push("");
|
|
@@ -19365,11 +19394,11 @@ function parseFrontmatter(text) {
|
|
|
19365
19394
|
// ../core/src/skillhub/help.ts
|
|
19366
19395
|
var SKILLHUB_CAPABILITIES = ["search"];
|
|
19367
19396
|
var SCOPE_BY_CMD2 = {
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19397
|
+
list: "read",
|
|
19398
|
+
get: "read",
|
|
19399
|
+
search: "read",
|
|
19400
|
+
publish: "write",
|
|
19401
|
+
remove: "write"
|
|
19373
19402
|
};
|
|
19374
19403
|
function skillhubScopeForCmd(tool) {
|
|
19375
19404
|
return SCOPE_BY_CMD2[tool] ?? null;
|
|
@@ -19396,9 +19425,9 @@ var PUBLISH_FILE_SCHEMA = {
|
|
|
19396
19425
|
};
|
|
19397
19426
|
function skillhubCmds(nodePath) {
|
|
19398
19427
|
const path = cmdPath(nodePath);
|
|
19399
|
-
|
|
19428
|
+
const cmds = [
|
|
19400
19429
|
{
|
|
19401
|
-
name: "
|
|
19430
|
+
name: "list",
|
|
19402
19431
|
method: "POST",
|
|
19403
19432
|
path,
|
|
19404
19433
|
h: "list published skills (id / name / description from SKILL.md frontmatter, paginated)",
|
|
@@ -19410,7 +19439,7 @@ function skillhubCmds(nodePath) {
|
|
|
19410
19439
|
scope: "read"
|
|
19411
19440
|
},
|
|
19412
19441
|
{
|
|
19413
|
-
name: "
|
|
19442
|
+
name: "get",
|
|
19414
19443
|
method: "POST",
|
|
19415
19444
|
path,
|
|
19416
19445
|
h: "read a skill: SKILL.md body + file manifest; pass 'file' to fetch one bundled file (oversized/binary as { $ref })",
|
|
@@ -19429,7 +19458,7 @@ function skillhubCmds(nodePath) {
|
|
|
19429
19458
|
scope: "read"
|
|
19430
19459
|
},
|
|
19431
19460
|
{
|
|
19432
|
-
name: "
|
|
19461
|
+
name: "search",
|
|
19433
19462
|
method: "POST",
|
|
19434
19463
|
path,
|
|
19435
19464
|
h: "keyword search over skill id / name / description",
|
|
@@ -19445,7 +19474,7 @@ function skillhubCmds(nodePath) {
|
|
|
19445
19474
|
scope: "read"
|
|
19446
19475
|
},
|
|
19447
19476
|
{
|
|
19448
|
-
name: "
|
|
19477
|
+
name: "publish",
|
|
19449
19478
|
method: "POST",
|
|
19450
19479
|
path,
|
|
19451
19480
|
h: "publish/replace a skill from a set of text files (must include SKILL.md with name+description frontmatter)",
|
|
@@ -19468,7 +19497,7 @@ function skillhubCmds(nodePath) {
|
|
|
19468
19497
|
scope: "write"
|
|
19469
19498
|
},
|
|
19470
19499
|
{
|
|
19471
|
-
name: "
|
|
19500
|
+
name: "remove",
|
|
19472
19501
|
method: "POST",
|
|
19473
19502
|
path,
|
|
19474
19503
|
h: "delete a skill and all its files (not_found if it does not exist)",
|
|
@@ -19481,6 +19510,7 @@ function skillhubCmds(nodePath) {
|
|
|
19481
19510
|
effect: "destructive"
|
|
19482
19511
|
}
|
|
19483
19512
|
];
|
|
19513
|
+
return withCommandPaths(nodePath, cmds);
|
|
19484
19514
|
}
|
|
19485
19515
|
function skillhubHelpModel(node, opts = {}) {
|
|
19486
19516
|
const cmds = skillhubCmds(node.path);
|
|
@@ -19567,7 +19597,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19567
19597
|
};
|
|
19568
19598
|
};
|
|
19569
19599
|
return {
|
|
19570
|
-
async
|
|
19600
|
+
async list(listOpts) {
|
|
19571
19601
|
const limit = clampLimit4(listOpts?.limit);
|
|
19572
19602
|
const res = await store.list(keyPrefix, {
|
|
19573
19603
|
delimiter: "/",
|
|
@@ -19587,7 +19617,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19587
19617
|
}
|
|
19588
19618
|
return res.cursor !== void 0 ? { items, cursor: res.cursor } : { items };
|
|
19589
19619
|
},
|
|
19590
|
-
async
|
|
19620
|
+
async get(idRaw) {
|
|
19591
19621
|
const id = assertSkillId(idRaw);
|
|
19592
19622
|
const { text, meta: meta3 } = await readDoc(id);
|
|
19593
19623
|
const summary = summaryOf(id, text, meta3);
|
|
@@ -19609,7 +19639,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19609
19639
|
} while (cursor !== void 0);
|
|
19610
19640
|
return { ...summary, content: text, files };
|
|
19611
19641
|
},
|
|
19612
|
-
async
|
|
19642
|
+
async get_file(idRaw, file2) {
|
|
19613
19643
|
const id = assertSkillId(idRaw);
|
|
19614
19644
|
const rel = normalizeEntryPath(file2);
|
|
19615
19645
|
const key = `${skillPrefix(id)}${rel}`;
|
|
@@ -19624,7 +19654,7 @@ function createSkillhubProvider(store, opts) {
|
|
|
19624
19654
|
if (!got) throw TBError.notFound(`skill \u6587\u4EF6\u4E0D\u5B58\u5728:'${id}/${rel}'`);
|
|
19625
19655
|
return { ...base, content: await readStreamText(got.body) };
|
|
19626
19656
|
},
|
|
19627
|
-
async
|
|
19657
|
+
async search(query, searchOpts) {
|
|
19628
19658
|
if (typeof query !== "string" || query === "") {
|
|
19629
19659
|
throw new TBError("invalid_argument", "query \u4E0D\u80FD\u4E3A\u7A7A");
|
|
19630
19660
|
}
|
|
@@ -19676,8 +19706,8 @@ ${summary.description}`.toLowerCase();
|
|
|
19676
19706
|
} while (storeCursor !== void 0);
|
|
19677
19707
|
return hasMore && lastPrefix !== void 0 ? { items, cursor: lastPrefix } : { items };
|
|
19678
19708
|
},
|
|
19679
|
-
async
|
|
19680
|
-
assertWritable("
|
|
19709
|
+
async publish(input) {
|
|
19710
|
+
assertWritable("publish");
|
|
19681
19711
|
if (!Array.isArray(input.files) || input.files.length === 0) {
|
|
19682
19712
|
throw new TBError("invalid_argument", "files \u4E0D\u80FD\u4E3A\u7A7A");
|
|
19683
19713
|
}
|
|
@@ -19720,8 +19750,8 @@ ${summary.description}`.toLowerCase();
|
|
|
19720
19750
|
}
|
|
19721
19751
|
return { id, name: fm.name, description: fm.description, fileCount: files.length };
|
|
19722
19752
|
},
|
|
19723
|
-
async
|
|
19724
|
-
assertWritable("
|
|
19753
|
+
async remove(idRaw) {
|
|
19754
|
+
assertWritable("remove");
|
|
19725
19755
|
const id = assertSkillId(idRaw);
|
|
19726
19756
|
const prefix = skillPrefix(id);
|
|
19727
19757
|
let cursor;
|
|
@@ -19797,9 +19827,8 @@ function toolToCmd(nodePath, tool, index) {
|
|
|
19797
19827
|
const cmd = {
|
|
19798
19828
|
name: tool.name,
|
|
19799
19829
|
method: "POST",
|
|
19800
|
-
path:
|
|
19801
|
-
scope: "call"
|
|
19802
|
-
flatBody: true
|
|
19830
|
+
path: `/${nodePath}/${tool.name}`,
|
|
19831
|
+
scope: "call"
|
|
19803
19832
|
};
|
|
19804
19833
|
if (tool.description !== void 0) {
|
|
19805
19834
|
cmd.h = index ? summarizeOneLine(tool.description) : tool.description;
|
|
@@ -19964,10 +19993,9 @@ var NodeRegistryStore = class {
|
|
|
19964
19993
|
* 只扫子树(前缀限定),不再对全树做内存过滤——避免 children/hasChildren/subtree 的
|
|
19965
19994
|
* O(N²)(每层各扫全树)。`opts.limit` 传给底层 `store.list` 以小步取(hasChildren 短路用)。
|
|
19966
19995
|
*
|
|
19967
|
-
* **Workers
|
|
19968
|
-
*
|
|
19969
|
-
* (
|
|
19970
|
-
* 需改 KV metadata 承载值(list 不再逐 get)或换 SQLite 宿主。
|
|
19996
|
+
* **Workers 查询预算约束**:D1StateStore.list 是单条 SQL 直接带值返回(ADR-001 迁 D1 后
|
|
19997
|
+
* 不再逐键 get),每页只花一次 D1 查询;但 Workers 单请求仍有查询/子请求预算,深翻页的
|
|
19998
|
+
* 页数应远小于预算——当前树规模小(节点数十级)可接受。
|
|
19971
19999
|
*/
|
|
19972
20000
|
async scanPrefix(keyPrefix, opts) {
|
|
19973
20001
|
const out = [];
|
|
@@ -20005,16 +20033,16 @@ var NodeRegistryStore = class {
|
|
|
20005
20033
|
const page = await this.store.list(this.subtreePrefix(norm), { limit: 1 });
|
|
20006
20034
|
return page.items.length > 0;
|
|
20007
20035
|
}
|
|
20008
|
-
/** 取单个;不存在 → not_found。 */
|
|
20036
|
+
/** 取单个;不存在 → not_found。路径大小写不敏感(规范化为小写后查)。 */
|
|
20009
20037
|
async get(path) {
|
|
20010
|
-
const norm =
|
|
20038
|
+
const norm = canonicalizePath(path);
|
|
20011
20039
|
const node = await this.read(norm);
|
|
20012
20040
|
if (!node) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20013
20041
|
return node;
|
|
20014
20042
|
}
|
|
20015
|
-
/**
|
|
20043
|
+
/** 批量取节点;路径先规范化(小写)去重,不存在的节点不进入返回 Map。 */
|
|
20016
20044
|
async getMany(paths) {
|
|
20017
|
-
const canonical = [...new Set(paths.map((path) =>
|
|
20045
|
+
const canonical = [...new Set(paths.map((path) => canonicalizePath(path)))];
|
|
20018
20046
|
const values = await this.store.getMany(canonical.map((path) => this.keyOf(path)));
|
|
20019
20047
|
const out = /* @__PURE__ */ new Map();
|
|
20020
20048
|
for (const path of canonical) {
|
|
@@ -20028,7 +20056,7 @@ var NodeRegistryStore = class {
|
|
|
20028
20056
|
* 无 prefix = 全树。cursor 为上一页末节点的 path。
|
|
20029
20057
|
*/
|
|
20030
20058
|
async list(prefix, opts) {
|
|
20031
|
-
const normPrefix = prefix === void 0 ? "" :
|
|
20059
|
+
const normPrefix = prefix === void 0 ? "" : canonicalizePath(prefix);
|
|
20032
20060
|
const limit = clampLimit5(opts?.limit);
|
|
20033
20061
|
const all = (await this.scanAll()).filter((n) => isPrefixOf(normPrefix, n.path)).sort(byPath);
|
|
20034
20062
|
const cursor = opts?.cursor;
|
|
@@ -20042,7 +20070,7 @@ var NodeRegistryStore = class {
|
|
|
20042
20070
|
}
|
|
20043
20071
|
/** 直接子节点(段深恰好 +1);~help 列子节点用。只扫子树前缀,不扫全树。 */
|
|
20044
20072
|
async children(path) {
|
|
20045
|
-
const norm =
|
|
20073
|
+
const norm = canonicalizePath(path);
|
|
20046
20074
|
const depth = segments(norm).length;
|
|
20047
20075
|
const sub = await this.scanPrefix(this.subtreePrefix(norm));
|
|
20048
20076
|
return sub.filter((n) => segments(n.path).length === depth + 1).sort(byPath);
|
|
@@ -20053,7 +20081,7 @@ var NodeRegistryStore = class {
|
|
|
20053
20081
|
* 不存在的根返回空数组(调用方自行判 not_found)。
|
|
20054
20082
|
*/
|
|
20055
20083
|
async subtree(path, opts) {
|
|
20056
|
-
const norm =
|
|
20084
|
+
const norm = canonicalizePath(path);
|
|
20057
20085
|
if (opts?.maxNodes !== void 0 && (!Number.isInteger(opts.maxNodes) || opts.maxNodes < 1)) {
|
|
20058
20086
|
throw new TBError("invalid_argument", "maxNodes \u5FC5\u987B\u662F\u6B63\u6574\u6570");
|
|
20059
20087
|
}
|
|
@@ -20094,9 +20122,9 @@ var NodeRegistryStore = class {
|
|
|
20094
20122
|
* conflict(覆盖他人节点)判定在网关注册路径层,不在此——本层是幂等 upsert。
|
|
20095
20123
|
*/
|
|
20096
20124
|
async write(node, registeredBy, now, opts = {}) {
|
|
20097
|
-
const
|
|
20098
|
-
const invalid2 = validatePath(path);
|
|
20125
|
+
const invalid2 = validatePath(node.path);
|
|
20099
20126
|
if (invalid2) throw invalid2;
|
|
20127
|
+
const path = canonicalizePath(node.path);
|
|
20100
20128
|
assertKindConfig(node);
|
|
20101
20129
|
for (const parent of parentPaths(path)) {
|
|
20102
20130
|
if (!await this.read(parent)) {
|
|
@@ -20129,10 +20157,10 @@ var NodeRegistryStore = class {
|
|
|
20129
20157
|
}
|
|
20130
20158
|
/** 部分更新(patch);不存在 → not_found;path 不可改。 */
|
|
20131
20159
|
async update(path, patch, now) {
|
|
20132
|
-
const norm =
|
|
20160
|
+
const norm = canonicalizePath(path);
|
|
20133
20161
|
const existing = await this.read(norm);
|
|
20134
20162
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20135
|
-
if (patch.path !== void 0 &&
|
|
20163
|
+
if (patch.path !== void 0 && canonicalizePath(patch.path) !== norm) {
|
|
20136
20164
|
throw new TBError("invalid_argument", "path \u4E0D\u53EF\u901A\u8FC7 Update \u53D8\u66F4");
|
|
20137
20165
|
}
|
|
20138
20166
|
const merged = {
|
|
@@ -20154,7 +20182,7 @@ var NodeRegistryStore = class {
|
|
|
20154
20182
|
* `lastSeenAt`(用于展示"最后在线于")。
|
|
20155
20183
|
*/
|
|
20156
20184
|
async setOnline(path, online, now) {
|
|
20157
|
-
const norm =
|
|
20185
|
+
const norm = canonicalizePath(path);
|
|
20158
20186
|
const existing = await this.read(norm);
|
|
20159
20187
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20160
20188
|
const updated = {
|
|
@@ -20171,7 +20199,7 @@ var NodeRegistryStore = class {
|
|
|
20171
20199
|
* 不该扰动 updatedAt 的语义)。节点不存在时静默返回——心跳晚于节点删除是正常竞态,不报错。
|
|
20172
20200
|
*/
|
|
20173
20201
|
async touchSeen(path, now) {
|
|
20174
|
-
const norm =
|
|
20202
|
+
const norm = canonicalizePath(path);
|
|
20175
20203
|
const existing = await this.read(norm);
|
|
20176
20204
|
if (!existing) return;
|
|
20177
20205
|
await this.store.put(this.keyOf(norm), { ...existing, lastSeenAt: now });
|
|
@@ -20184,7 +20212,7 @@ var NodeRegistryStore = class {
|
|
|
20184
20212
|
* (不允许删除非空子树;显式 directory 同理)。
|
|
20185
20213
|
*/
|
|
20186
20214
|
async delete(path) {
|
|
20187
|
-
const norm =
|
|
20215
|
+
const norm = canonicalizePath(path);
|
|
20188
20216
|
const existing = await this.read(norm);
|
|
20189
20217
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20190
20218
|
if (await this.hasChildren(norm)) {
|
|
@@ -20203,7 +20231,7 @@ var NodeRegistryStore = class {
|
|
|
20203
20231
|
* 普通管理面仍使用 delete(),不允许误删非空子树。
|
|
20204
20232
|
*/
|
|
20205
20233
|
async deleteSubtree(path) {
|
|
20206
|
-
const norm =
|
|
20234
|
+
const norm = canonicalizePath(path);
|
|
20207
20235
|
const existing = await this.read(norm);
|
|
20208
20236
|
if (!existing) throw new TBError("not_found", `\u8282\u70B9\u4E0D\u5B58\u5728:'${norm}'`);
|
|
20209
20237
|
const descendants = await this.scanPrefix(this.subtreePrefix(norm));
|
|
@@ -20222,7 +20250,7 @@ var NodeRegistryStore = class {
|
|
|
20222
20250
|
* 完全匹配 → rest=''。无任何匹配 → not_found。
|
|
20223
20251
|
*/
|
|
20224
20252
|
async resolve(path) {
|
|
20225
|
-
const norm =
|
|
20253
|
+
const norm = canonicalizePath(path);
|
|
20226
20254
|
const candidates = [norm, ...parentPaths(norm).reverse()];
|
|
20227
20255
|
for (const cand of candidates) {
|
|
20228
20256
|
const node = await this.read(cand);
|
|
@@ -20246,6 +20274,7 @@ export {
|
|
|
20246
20274
|
KEY_PLUGIN,
|
|
20247
20275
|
KEY_BOOTSTRAPPED,
|
|
20248
20276
|
KEY_FEEDBACK,
|
|
20277
|
+
prefixUpperBound,
|
|
20249
20278
|
AnnotationStore,
|
|
20250
20279
|
checkScopes,
|
|
20251
20280
|
check2 as check,
|