@tool-bridge/server 0.14.0 → 0.15.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-NVGQVZJW.js → airtable-QYTOPRFV.js} +4 -4
- package/dist/{alt_text_generator_ai-WF7NHVWE.js → alt_text_generator_ai-2CFYNSZV.js} +4 -4
- package/dist/{amap-EPI7AQ4O.js → amap-HGOBOHSZ.js} +4 -4
- package/dist/{anthropic-KVYWBZIV.js → anthropic-3OXOQNSR.js} +4 -4
- package/dist/{apify-MB56RQIA.js → apify-PUV2QGKL.js} +4 -4
- package/dist/{brave_search-JDAGJ7PO.js → brave_search-DG75AVKA.js} +4 -4
- package/dist/{chunk-ABHHWYEV.js → chunk-DXXYNIXV.js} +82 -1
- package/dist/{chunk-HGIPJFHA.js → chunk-KH663T3A.js} +1 -1
- package/dist/{chunk-X6LLG5OZ.js → chunk-NLPTB3IL.js} +76 -8
- package/dist/{chunk-BWGAV3MR.js → chunk-NQ67PIIS.js} +2 -2
- package/dist/{chunk-CDOWN2AB.js → chunk-UI4E4T5Q.js} +1 -1
- package/dist/{circleci-2IL5RU2O.js → circleci-EFNLX5AW.js} +4 -4
- package/dist/{clerk-A5YYGWYM.js → clerk-UWDLMZVM.js} +4 -4
- package/dist/{cloudflare_dns-GUA5BUWO.js → cloudflare_dns-WQXVDSPU.js} +4 -4
- package/dist/{cohere-BS27QMKR.js → cohere-VPDIKUDP.js} +4 -4
- package/dist/{confluence-675IWLHU.js → confluence-NBOOQNTR.js} +4 -4
- package/dist/{convertapi-DGKXP2T3.js → convertapi-6Z6OP25T.js} +4 -4
- package/dist/{currencyapi-PFH3UKVU.js → currencyapi-CAMUWCTV.js} +4 -4
- package/dist/{deepseek-5U3STDGY.js → deepseek-GRALXYXR.js} +4 -4
- package/dist/{docker_hub-UVXRU2L3.js → docker_hub-5AASF3TJ.js} +4 -4
- package/dist/{dropbox-BC54XUXF.js → dropbox-HS3VGRD3.js} +4 -4
- package/dist/{dub-GV5M6PWD.js → dub-KHERUTW6.js} +4 -4
- package/dist/{e2b-KEQ3PYPV.js → e2b-4MGHPFXY.js} +4 -4
- package/dist/{exa-OGQR7D47.js → exa-O77PKTBT.js} +4 -4
- package/dist/{fal_ai-ULI6YF4O.js → fal_ai-TX2TZFMP.js} +4 -4
- package/dist/{feishu-YWLRRUGP.js → feishu-I7VPWO3C.js} +3 -3
- package/dist/{feishu_custom_bot-7HP4UHB7.js → feishu_custom_bot-D4XZDLES.js} +4 -4
- package/dist/{figma-BFGC24YI.js → figma-SW3HZCZ5.js} +4 -4
- package/dist/{firehydrant-R6DG7SBL.js → firehydrant-ND5DEW3L.js} +4 -4
- package/dist/{fixer-ZVXOVTMF.js → fixer-ZTSV7ZK3.js} +4 -4
- package/dist/{fly-EBKWMDWV.js → fly-RZ7SZKFT.js} +4 -4
- package/dist/{front-CFWVIQYX.js → front-Q5MZVUGX.js} +4 -4
- package/dist/{geocodio-N27RDBFV.js → geocodio-QPHHODHG.js} +4 -4
- package/dist/{ghost-2HT2SJYO.js → ghost-3Q6O7EWZ.js} +4 -4
- package/dist/{github-ZDLAIRXP.js → github-LDMGJHXV.js} +4 -4
- package/dist/{gmail-TICKPP6S.js → gmail-6QBCI3TT.js} +4 -4
- package/dist/{googlecalendar-GUR47UTF.js → googlecalendar-LLSYY4ZJ.js} +4 -4
- package/dist/{googledocs-QGDIJA4S.js → googledocs-KRGVBGWY.js} +4 -4
- package/dist/{grafana-33Y3WEU5.js → grafana-OHPZMRHT.js} +4 -4
- package/dist/{graphhopper-KWTMYEVH.js → graphhopper-2PBY7OX4.js} +4 -4
- package/dist/index.d.ts +17 -0
- package/dist/index.js +2 -2
- package/dist/{ip2proxy-4SAYDJPQ.js → ip2proxy-GPBQZKKG.js} +4 -4
- package/dist/{ipgeolocation_io-4WT2WKHF.js → ipgeolocation_io-YNTOLOFH.js} +4 -4
- package/dist/{ipqualityscore-VGZCROJJ.js → ipqualityscore-CZLQUAQ7.js} +4 -4
- package/dist/{jina_ai-X5VJVORK.js → jina_ai-JIFEYH5C.js} +4 -4
- package/dist/{jira-XUAF2UPM.js → jira-2DKTIWHK.js} +4 -4
- package/dist/{langsmith-RRLFNL6D.js → langsmith-UCX7NHKP.js} +4 -4
- package/dist/{lemlist-KQKG6JHM.js → lemlist-IS6K2VJG.js} +4 -4
- package/dist/{linear-I32UBCBL.js → linear-AK6547ZS.js} +4 -4
- package/dist/{logsnag-TVNUQEM7.js → logsnag-EB5LICOH.js} +4 -4
- package/dist/main.js +101 -101
- package/dist/{mattermost-OCIA7Z4P.js → mattermost-YOSWUA3R.js} +4 -4
- package/dist/{mem0-FARYP2ZM.js → mem0-IICTSHLB.js} +4 -4
- package/dist/{memos-6M6QEUYI.js → memos-DIV6MZPB.js} +4 -4
- package/dist/{metabase-VCNMPHIR.js → metabase-ZGHNTCAT.js} +4 -4
- package/dist/{mistral_ai-SMPVEWBM.js → mistral_ai-IAG3WZYO.js} +4 -4
- package/dist/{mother_duck-CMHFH5A6.js → mother_duck-PYKG4ZHO.js} +4 -4
- package/dist/{ngrok-WRQJ3X54.js → ngrok-BXN3DGTK.js} +4 -4
- package/dist/{notes-HLPED7H7.js → notes-L2UO36HQ.js} +2 -2
- package/dist/{notion-FFCK2KZ4.js → notion-PVHVOV4R.js} +4 -4
- package/dist/{open_exchange_rates-VKQICRS6.js → open_exchange_rates-DVMOPFNQ.js} +4 -4
- package/dist/{openai-PJDJ2AZ2.js → openai-VW6F5YTK.js} +4 -4
- package/dist/{opengraph_io-DMQQXMEC.js → opengraph_io-MQUREYWM.js} +4 -4
- package/dist/{openrouter-I52ZZHQT.js → openrouter-5MI3ODCU.js} +4 -4
- package/dist/{outline-I6EIBEHQ.js → outline-B2U7NIVA.js} +4 -4
- package/dist/{paddle-4DU7GKCS.js → paddle-LDZTVYQO.js} +4 -4
- package/dist/{perplexity-DE6K444O.js → perplexity-P7BNWFMH.js} +4 -4
- package/dist/{pinecone-KMRF5YWJ.js → pinecone-3Y67EJYP.js} +4 -4
- package/dist/{pipedrive-4OC5UU3L.js → pipedrive-4KFLGCJW.js} +4 -4
- package/dist/{polar-OACUFN7P.js → polar-NIULQPUD.js} +4 -4
- package/dist/{posthog-PSGNT66O.js → posthog-UXGCIHRP.js} +4 -4
- package/dist/{postmark-CSOVREPD.js → postmark-XT77YNQM.js} +4 -4
- package/dist/{prerender-B7M6SAIA.js → prerender-37E6ZN6Z.js} +4 -4
- package/dist/{pubmed-JJ5URMS6.js → pubmed-BO2W4IR6.js} +4 -4
- package/dist/{railway-VO42EWHC.js → railway-5BACZNYC.js} +4 -4
- package/dist/{readwise-O7I4HLU4.js → readwise-DXABSDKY.js} +4 -4
- package/dist/{render-24X3H3WB.js → render-4MCO6RLA.js} +4 -4
- package/dist/{replicate-TO6OPISC.js → replicate-IVEPY4EP.js} +4 -4
- package/dist/{resend-IBVGUV4X.js → resend-XJBJO46B.js} +4 -4
- package/dist/{rootly-MD5GFDUC.js → rootly-R6QDVF3D.js} +4 -4
- package/dist/{scrapfly-ZKDGE4IL.js → scrapfly-E24XNN32.js} +4 -4
- package/dist/{scrapingbee-2FVX2BFI.js → scrapingbee-QT3O334C.js} +4 -4
- package/dist/{screenshot_fyi-HNPNS43Z.js → screenshot_fyi-MJNFPUFV.js} +4 -4
- package/dist/{semantic_scholar-EJ2CYAKO.js → semantic_scholar-BVKWS72R.js} +4 -4
- package/dist/{sentry-DXB3CQZA.js → sentry-52T5XARK.js} +4 -4
- package/dist/{shodan-HEFZ6NHP.js → shodan-RTOTTCX2.js} +4 -4
- package/dist/{shopify-SUN5J257.js → shopify-3RVWQDZ6.js} +4 -4
- package/dist/{stripe-N3HNTHD5.js → stripe-M3T2K3EW.js} +4 -4
- package/dist/{supabase-IMZ6YRES.js → supabase-UUUXAEYR.js} +4 -4
- package/dist/{tavily-QMPSOIGW.js → tavily-LVOZQQKJ.js} +4 -4
- package/dist/{telegram-SHZX3C73.js → telegram-WJQPCKQT.js} +4 -4
- package/dist/{telnyx-SF6KMQ7W.js → telnyx-THKSKAI2.js} +4 -4
- package/dist/{todoist-Y252DAZ2.js → todoist-YTRGFFRC.js} +4 -4
- package/dist/{trello-BTRC6I5Y.js → trello-QBK6WKN2.js} +4 -4
- package/dist/{turso-SB4KFTUP.js → turso-EA44ZKLR.js} +4 -4
- package/dist/{twilio-CRRJZ6MR.js → twilio-GSW3V55S.js} +4 -4
- package/dist/{umami-7PJKITQ5.js → umami-DVZ7XUYC.js} +4 -4
- package/dist/{unsplash-PYZXMXH2.js → unsplash-ZWUWQ7OS.js} +4 -4
- package/dist/{upstash_redis-L2IJTHFW.js → upstash_redis-BQIQB5NM.js} +4 -4
- package/dist/{uptimerobot-XDYEYFJQ.js → uptimerobot-2OJHTUPV.js} +4 -4
- package/dist/{v2ex-TNACDCAO.js → v2ex-IZF4BB4O.js} +4 -4
- package/dist/{vercel-QRU4UC5M.js → vercel-PI3BJENX.js} +4 -4
- package/dist/{wolfram_alpha_api-TS663Q5L.js → wolfram_alpha_api-EYQ2QCHH.js} +4 -4
- package/dist/{wordpress-RTEUS26Y.js → wordpress-ETDA6XLX.js} +4 -4
- package/dist/{workos-4NGPU4VP.js → workos-D7INO4Y4.js} +4 -4
- package/dist/{zhihu-GGLOXAVO.js → zhihu-Q7FNHEDM.js} +4 -4
- package/package.json +3 -3
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/airtable/api.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/alt_text_generator_ai/schema.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/amap/api.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/anthropic/api.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/apify/api.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/brave_search/api.ts
|
|
@@ -16822,13 +16822,15 @@ function createBuiltins(deps) {
|
|
|
16822
16822
|
|
|
16823
16823
|
// ../core/src/context/help.ts
|
|
16824
16824
|
var CONTEXT_CAPABILITIES = ["search", "delete"];
|
|
16825
|
+
var CONTEXT_DIRECT_UPLOAD_CAPABILITY = "direct-upload";
|
|
16825
16826
|
var SCOPE_BY_CMD = {
|
|
16826
16827
|
list: "read",
|
|
16827
16828
|
get: "read",
|
|
16828
16829
|
search: "read",
|
|
16829
16830
|
write: "write",
|
|
16830
16831
|
update: "write",
|
|
16831
|
-
delete: "write"
|
|
16832
|
+
delete: "write",
|
|
16833
|
+
create_upload: "write"
|
|
16832
16834
|
};
|
|
16833
16835
|
function contextScopeForCmd(command) {
|
|
16834
16836
|
return SCOPE_BY_CMD[command] ?? null;
|
|
@@ -16976,6 +16978,29 @@ function contextCmds(nodePath) {
|
|
|
16976
16978
|
];
|
|
16977
16979
|
return withCommandPaths(nodePath, cmds);
|
|
16978
16980
|
}
|
|
16981
|
+
function contextUploadCmd(nodePath) {
|
|
16982
|
+
return withCommandPaths(nodePath, [{
|
|
16983
|
+
name: "create_upload",
|
|
16984
|
+
method: "POST",
|
|
16985
|
+
path: cmdPath(nodePath),
|
|
16986
|
+
h: "create a short-lived, path-scoped direct-upload grant; persist the returned uri, not url",
|
|
16987
|
+
inputSchema: {
|
|
16988
|
+
type: "object",
|
|
16989
|
+
required: ["path", "contentType"],
|
|
16990
|
+
properties: {
|
|
16991
|
+
path: { type: "string", description: "target entry path inside the namespace" },
|
|
16992
|
+
contentType: { type: "string", description: "media type signed into the PUT request" },
|
|
16993
|
+
overwrite: {
|
|
16994
|
+
type: "boolean",
|
|
16995
|
+
description: "allow replacing an existing object; default false"
|
|
16996
|
+
}
|
|
16997
|
+
}
|
|
16998
|
+
},
|
|
16999
|
+
returns: "ContextUploadGrant",
|
|
17000
|
+
scope: "write",
|
|
17001
|
+
effect: "write"
|
|
17002
|
+
}])[0];
|
|
17003
|
+
}
|
|
16979
17004
|
function contextHelpModel(node, opts = {}) {
|
|
16980
17005
|
const all = contextCmds(node.path);
|
|
16981
17006
|
const present = opts.methods === void 0 ? all : all.filter((c) => opts.methods?.has(c.name));
|
|
@@ -17075,8 +17100,59 @@ function normalizeEntryPath(path) {
|
|
|
17075
17100
|
// ../core/src/context/objectProvider.ts
|
|
17076
17101
|
var REF_THRESHOLD_BYTES_DEFAULT = 1024 * 1024;
|
|
17077
17102
|
var PRESIGN_TTL_SEC_DEFAULT = 900;
|
|
17103
|
+
var PRESIGN_TTL_SEC_MAX = 604800;
|
|
17104
|
+
function assertPresignTtlSec(ttlSec) {
|
|
17105
|
+
if (!Number.isInteger(ttlSec) || ttlSec < 1 || ttlSec > PRESIGN_TTL_SEC_MAX) {
|
|
17106
|
+
throw new TBError(
|
|
17107
|
+
"invalid_argument",
|
|
17108
|
+
`presign TTL \u5FC5\u987B\u662F 1..${PRESIGN_TTL_SEC_MAX} \u7684\u6574\u6570\u79D2`
|
|
17109
|
+
);
|
|
17110
|
+
}
|
|
17111
|
+
return ttlSec;
|
|
17112
|
+
}
|
|
17078
17113
|
var SEARCH_METADATA_HEAD_MAX = 200;
|
|
17079
17114
|
var DIRECTORY_CONTENT_TYPE = "application/x-directory";
|
|
17115
|
+
async function createObjectContextUploadGrant(store, opts, input) {
|
|
17116
|
+
if (opts.readOnly === true) {
|
|
17117
|
+
throw new TBError("permission_denied", "readOnly \u6302\u8F7D\u62D2\u7EDD create_upload");
|
|
17118
|
+
}
|
|
17119
|
+
if (store.presignPut === void 0) {
|
|
17120
|
+
throw new TBError("unavailable", "\u5BF9\u8C61\u5B58\u50A8\u672A\u914D\u7F6E\u76F4\u4F20\u7B7E\u540D\u80FD\u529B", { retryable: false });
|
|
17121
|
+
}
|
|
17122
|
+
if (typeof input?.path !== "string") {
|
|
17123
|
+
throw new TBError("invalid_argument", "create_upload \u9700\u8981\u5B57\u7B26\u4E32 'path'");
|
|
17124
|
+
}
|
|
17125
|
+
if (input.overwrite !== void 0 && typeof input.overwrite !== "boolean") {
|
|
17126
|
+
throw new TBError("invalid_argument", "create_upload \u7684 'overwrite' \u5FC5\u987B\u662F boolean");
|
|
17127
|
+
}
|
|
17128
|
+
const unknownKeys = Object.keys(input).filter(
|
|
17129
|
+
(key2) => key2 !== "path" && key2 !== "contentType" && key2 !== "overwrite"
|
|
17130
|
+
);
|
|
17131
|
+
if (unknownKeys.length > 0) {
|
|
17132
|
+
throw new TBError("invalid_argument", `create_upload \u542B\u672A\u77E5\u5B57\u6BB5:${unknownKeys.join(",")}`);
|
|
17133
|
+
}
|
|
17134
|
+
if (typeof input?.contentType !== "string" || input.contentType.trim() === "" || input.contentType.length > 255 || !input.contentType.includes("/") || /[\r\n\0]/.test(input.contentType)) {
|
|
17135
|
+
throw new TBError("invalid_argument", "create_upload \u9700\u8981\u5408\u6CD5\u7684 'contentType'");
|
|
17136
|
+
}
|
|
17137
|
+
const nsPath = normalizePath(opts.nsPath);
|
|
17138
|
+
const entryPath = normalizeEntryPath(input.path);
|
|
17139
|
+
const keyPrefixBare = opts.keyPrefix?.replace(/^\/+|\/+$/g, "") ?? "";
|
|
17140
|
+
const key = `${keyPrefixBare === "" ? "" : `${keyPrefixBare}/`}${entryPath}`;
|
|
17141
|
+
const ttlSec = assertPresignTtlSec(opts.uploadGrantTtlSec ?? PRESIGN_TTL_SEC_DEFAULT);
|
|
17142
|
+
const contentType = input.contentType.trim();
|
|
17143
|
+
const expiresAt = new Date(Date.now() + ttlSec * 1e3).toISOString();
|
|
17144
|
+
const signed = await store.presignPut(key, ttlSec, {
|
|
17145
|
+
contentType,
|
|
17146
|
+
...input.overwrite === true ? {} : { ifNoneMatch: "*" }
|
|
17147
|
+
});
|
|
17148
|
+
return {
|
|
17149
|
+
uri: `node://${nsPath}/${entryPath}`,
|
|
17150
|
+
method: "PUT",
|
|
17151
|
+
url: signed.url,
|
|
17152
|
+
headers: signed.headers,
|
|
17153
|
+
expiresAt
|
|
17154
|
+
};
|
|
17155
|
+
}
|
|
17080
17156
|
function clampLimit3(limit) {
|
|
17081
17157
|
if (limit === void 0) return LIST_LIMIT_DEFAULT;
|
|
17082
17158
|
if (!Number.isInteger(limit) || limit < 1) {
|
|
@@ -20297,12 +20373,17 @@ export {
|
|
|
20297
20373
|
parseNodeInput,
|
|
20298
20374
|
createBuiltins,
|
|
20299
20375
|
CONTEXT_CAPABILITIES,
|
|
20376
|
+
CONTEXT_DIRECT_UPLOAD_CAPABILITY,
|
|
20300
20377
|
contextScopeForCmd,
|
|
20378
|
+
contextUploadCmd,
|
|
20301
20379
|
contextHelpModel,
|
|
20302
20380
|
objectBodyToBytes,
|
|
20303
20381
|
bytesToObjectStream,
|
|
20304
20382
|
normalizeEntryPath,
|
|
20305
20383
|
PRESIGN_TTL_SEC_DEFAULT,
|
|
20384
|
+
PRESIGN_TTL_SEC_MAX,
|
|
20385
|
+
assertPresignTtlSec,
|
|
20386
|
+
createObjectContextUploadGrant,
|
|
20306
20387
|
createObjectContextProvider,
|
|
20307
20388
|
isContextExpired,
|
|
20308
20389
|
decodeDeviceFrame,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AnnotationStore,
|
|
3
3
|
CONTEXT_CAPABILITIES,
|
|
4
|
+
CONTEXT_DIRECT_UPLOAD_CAPABILITY,
|
|
4
5
|
DEFAULT_MAX_NODES,
|
|
5
6
|
DEVICE_CALL_TIMEOUT_MS,
|
|
6
7
|
DeviceGatewaySession,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
PG_SEARCH_TOOLS_TABLE,
|
|
26
27
|
PG_SEARCH_WRITE_LOCK_KEY,
|
|
27
28
|
PRESIGN_TTL_SEC_DEFAULT,
|
|
29
|
+
PRESIGN_TTL_SEC_MAX,
|
|
28
30
|
RemoteAllowlistStore,
|
|
29
31
|
SKILLHUB_CAPABILITIES,
|
|
30
32
|
SKRegistryStore,
|
|
@@ -47,6 +49,7 @@ import {
|
|
|
47
49
|
appendVia,
|
|
48
50
|
array,
|
|
49
51
|
assertPluginPayloadSize,
|
|
52
|
+
assertPresignTtlSec,
|
|
50
53
|
assertSecretRefUse,
|
|
51
54
|
assertSecureUrl,
|
|
52
55
|
authHeaderFor,
|
|
@@ -71,8 +74,10 @@ import {
|
|
|
71
74
|
contextHelpModel,
|
|
72
75
|
contextMethodsOf,
|
|
73
76
|
contextScopeForCmd,
|
|
77
|
+
contextUploadCmd,
|
|
74
78
|
createBuiltins,
|
|
75
79
|
createObjectContextProvider,
|
|
80
|
+
createObjectContextUploadGrant,
|
|
76
81
|
createSkillhubProvider,
|
|
77
82
|
decodeDeviceFrame,
|
|
78
83
|
derivePresence,
|
|
@@ -141,7 +146,7 @@ import {
|
|
|
141
146
|
url,
|
|
142
147
|
validatePath,
|
|
143
148
|
virtualizeTools
|
|
144
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-DXXYNIXV.js";
|
|
145
150
|
|
|
146
151
|
// src/config.ts
|
|
147
152
|
var DEFAULT_PORT = 8787;
|
|
@@ -151,6 +156,10 @@ function positiveIntEnv(value) {
|
|
|
151
156
|
const n = Number(value);
|
|
152
157
|
return Number.isFinite(n) && n > 0 ? Math.floor(n) : void 0;
|
|
153
158
|
}
|
|
159
|
+
function presignTtlEnv(value) {
|
|
160
|
+
const ttl = positiveIntEnv(value);
|
|
161
|
+
return ttl === void 0 ? void 0 : Math.min(ttl, PRESIGN_TTL_SEC_MAX);
|
|
162
|
+
}
|
|
154
163
|
function portEnv(value) {
|
|
155
164
|
if (value === void 0 || value === "") return void 0;
|
|
156
165
|
const n = Number(value);
|
|
@@ -224,8 +233,10 @@ function configFromEnv(env = process.env) {
|
|
|
224
233
|
if (ttl !== void 0) config.toolCacheTtlSec = ttl;
|
|
225
234
|
const refThreshold = positiveIntEnv(env.TB_REF_THRESHOLD_BYTES);
|
|
226
235
|
if (refThreshold !== void 0) config.refThresholdBytes = refThreshold;
|
|
227
|
-
const refTtl =
|
|
236
|
+
const refTtl = presignTtlEnv(env.TB_REF_TTL_SEC);
|
|
228
237
|
if (refTtl !== void 0) config.refTtlSec = refTtl;
|
|
238
|
+
const uploadGrantTtl = presignTtlEnv(env.TB_UPLOAD_GRANT_TTL_SEC);
|
|
239
|
+
if (uploadGrantTtl !== void 0) config.uploadGrantTtlSec = uploadGrantTtl;
|
|
229
240
|
return config;
|
|
230
241
|
}
|
|
231
242
|
|
|
@@ -533,6 +544,7 @@ function encodeObjectKey(key) {
|
|
|
533
544
|
return key.split("/").map(encodeURIComponent).join("/");
|
|
534
545
|
}
|
|
535
546
|
async function presignS3Url(client, url2, ttlSec) {
|
|
547
|
+
assertPresignTtlSec(ttlSec);
|
|
536
548
|
const target = new URL(url2);
|
|
537
549
|
target.searchParams.set("X-Amz-Expires", String(ttlSec));
|
|
538
550
|
const signed = await client.sign(new Request(target.toString(), { method: "GET" }), {
|
|
@@ -540,6 +552,20 @@ async function presignS3Url(client, url2, ttlSec) {
|
|
|
540
552
|
});
|
|
541
553
|
return signed.url;
|
|
542
554
|
}
|
|
555
|
+
async function presignS3Put(client, url2, ttlSec, opts) {
|
|
556
|
+
assertPresignTtlSec(ttlSec);
|
|
557
|
+
const target = new URL(url2);
|
|
558
|
+
target.searchParams.set("X-Amz-Expires", String(ttlSec));
|
|
559
|
+
const headers = {
|
|
560
|
+
"content-type": opts.contentType,
|
|
561
|
+
...opts.ifNoneMatch === void 0 ? {} : { "if-none-match": opts.ifNoneMatch }
|
|
562
|
+
};
|
|
563
|
+
const signed = await client.sign(
|
|
564
|
+
new Request(target.toString(), { method: "PUT", headers }),
|
|
565
|
+
{ aws: { signQuery: true, allHeaders: true } }
|
|
566
|
+
);
|
|
567
|
+
return { method: "PUT", url: signed.url, headers };
|
|
568
|
+
}
|
|
543
569
|
|
|
544
570
|
// ../app/src/providers/s3Object.ts
|
|
545
571
|
var META_HEADER_PREFIX = "x-amz-meta-";
|
|
@@ -701,6 +727,9 @@ function createS3ObjectStore(cfg, opts) {
|
|
|
701
727
|
},
|
|
702
728
|
presign(key, ttlSec) {
|
|
703
729
|
return presignS3Url(client, urlFor(key), ttlSec);
|
|
730
|
+
},
|
|
731
|
+
presignPut(key, ttlSec, putOpts) {
|
|
732
|
+
return presignS3Put(client, urlFor(key), ttlSec, putOpts);
|
|
704
733
|
}
|
|
705
734
|
};
|
|
706
735
|
}
|
|
@@ -19692,6 +19721,24 @@ async function contextObjectStoreFor(cfg, deps) {
|
|
|
19692
19721
|
}
|
|
19693
19722
|
throw TBError.unimplemented(`context provider '${cfg.provider}' not implemented yet`);
|
|
19694
19723
|
}
|
|
19724
|
+
async function contextDirectUploadAvailable(cfg, deps) {
|
|
19725
|
+
if (cfg.provider === "s3") return true;
|
|
19726
|
+
try {
|
|
19727
|
+
return (await contextObjectStoreFor(cfg, deps)).presignPut !== void 0;
|
|
19728
|
+
} catch {
|
|
19729
|
+
return false;
|
|
19730
|
+
}
|
|
19731
|
+
}
|
|
19732
|
+
async function createContextUploadGrant(node, cfg, deps, input) {
|
|
19733
|
+
const objects = await contextObjectStoreFor(cfg, deps);
|
|
19734
|
+
const uploadGrantTtlSec = deps.uploadGrantTtlSec ?? Math.min(deps.refTtlSec ?? PRESIGN_TTL_SEC_DEFAULT, PRESIGN_TTL_SEC_DEFAULT);
|
|
19735
|
+
return createObjectContextUploadGrant(objects, {
|
|
19736
|
+
nsPath: node.path,
|
|
19737
|
+
keyPrefix: contextKeyPrefix(cfg, node.path),
|
|
19738
|
+
readOnly: cfg.readOnly ?? false,
|
|
19739
|
+
uploadGrantTtlSec
|
|
19740
|
+
}, input);
|
|
19741
|
+
}
|
|
19695
19742
|
async function contextProviderFor(node, cfg, deps, requestUrl) {
|
|
19696
19743
|
const objects = await contextObjectStoreFor(cfg, deps);
|
|
19697
19744
|
const opts = {
|
|
@@ -36473,7 +36520,10 @@ async function handleDescribe(c, env) {
|
|
|
36473
36520
|
await assertContextAlive(node, node.config, registry);
|
|
36474
36521
|
const cfg = node.config;
|
|
36475
36522
|
const local = cfg.provider !== "r2" && cfg.provider !== "s3" ? localContext(deps, node) : null;
|
|
36476
|
-
|
|
36523
|
+
let capabilities = cfg.provider === "r2" || cfg.provider === "s3" || cfg.provider === "device-fs" || deviceMarkerOf(cfg.providerConfig) !== null ? CONTEXT_CAPABILITIES : local !== null ? localCapabilities(local) : (await requirePluginExport(deps, cfg.provider, "context", "context", cfg.export)).export.capabilities ?? [];
|
|
36524
|
+
if ((cfg.provider === "r2" || cfg.provider === "s3") && cfg.readOnly !== true && await contextDirectUploadAvailable(cfg, deps)) {
|
|
36525
|
+
capabilities = [...capabilities, CONTEXT_DIRECT_UPLOAD_CAPABILITY];
|
|
36526
|
+
}
|
|
36477
36527
|
return new Response(JSON.stringify({ kind: "context", capabilities }), {
|
|
36478
36528
|
headers: { "content-type": contentTypeFor("json") }
|
|
36479
36529
|
});
|
|
@@ -36857,7 +36907,7 @@ async function helpModelFor(node, registry, ctx, builtins, deps, opts) {
|
|
|
36857
36907
|
readOnly: (node.config.readOnly ?? false) || isReadOnlyProvider(local)
|
|
36858
36908
|
});
|
|
36859
36909
|
}
|
|
36860
|
-
const
|
|
36910
|
+
const model2 = contextHelpModel(node, { readOnly: node.config.readOnly ?? false });
|
|
36861
36911
|
const { export: exported } = await requirePluginExport(
|
|
36862
36912
|
deps,
|
|
36863
36913
|
node.config.provider,
|
|
@@ -36872,9 +36922,13 @@ async function helpModelFor(node, registry, ctx, builtins, deps, opts) {
|
|
|
36872
36922
|
"update",
|
|
36873
36923
|
...optionalMethodsForCapabilities(exported.capabilities ?? [])
|
|
36874
36924
|
]);
|
|
36875
|
-
return { ...
|
|
36925
|
+
return { ...model2, cmds: model2.cmds.filter((c) => declared.has(c.name)) };
|
|
36926
|
+
}
|
|
36927
|
+
const model = contextHelpModel(node, { readOnly: node.config.readOnly ?? false });
|
|
36928
|
+
if (node.config.readOnly !== true && opts.includeDirectUpload !== false && await contextDirectUploadAvailable(node.config, deps)) {
|
|
36929
|
+
return { ...model, cmds: [...model.cmds, contextUploadCmd(node.path)] };
|
|
36876
36930
|
}
|
|
36877
|
-
return
|
|
36931
|
+
return model;
|
|
36878
36932
|
}
|
|
36879
36933
|
if (node.kind === "skillhub" && node.config?.kind === "skillhub") {
|
|
36880
36934
|
await assertContextAlive(node, node.config, registry);
|
|
@@ -37135,6 +37189,7 @@ function mcpBridgeFor(c, env, app) {
|
|
|
37135
37189
|
continue;
|
|
37136
37190
|
}
|
|
37137
37191
|
const model = await helpModelFor(node, registry, ctx, builtinsOf(c.get("store")), deps, {
|
|
37192
|
+
includeDirectUpload: check(ctx, node.path, "write").allow,
|
|
37138
37193
|
refresh: false,
|
|
37139
37194
|
now
|
|
37140
37195
|
});
|
|
@@ -37332,7 +37387,8 @@ async function handleInvoke(c, env) {
|
|
|
37332
37387
|
await assertContextAlive(node, cfg, registry);
|
|
37333
37388
|
const args2 = await readInvokeBody();
|
|
37334
37389
|
const scope = contextScopeForCmd(command);
|
|
37335
|
-
|
|
37390
|
+
const directUpload = command === "create_upload";
|
|
37391
|
+
if (scope === null || directUpload && cfg.provider !== "r2" && cfg.provider !== "s3") {
|
|
37336
37392
|
throw new TBError("invalid_argument", `unknown cmd '${command}' on '${node.path}'`);
|
|
37337
37393
|
}
|
|
37338
37394
|
if (!check(ctx, node.path, scope).allow) {
|
|
@@ -37341,6 +37397,15 @@ async function handleInvoke(c, env) {
|
|
|
37341
37397
|
if (cfg.readOnly === true && scope === "write") {
|
|
37342
37398
|
throw new TBError("permission_denied", `readOnly \u6302\u8F7D\u62D2\u7EDD '${command}'`);
|
|
37343
37399
|
}
|
|
37400
|
+
if (directUpload) {
|
|
37401
|
+
const result3 = await createContextUploadGrant(
|
|
37402
|
+
node,
|
|
37403
|
+
cfg,
|
|
37404
|
+
deps,
|
|
37405
|
+
args2
|
|
37406
|
+
);
|
|
37407
|
+
return renderResult(result3, negotiate(c.req.header("accept")));
|
|
37408
|
+
}
|
|
37344
37409
|
if (cfg.provider === "device-fs") {
|
|
37345
37410
|
const result3 = await invokeDevice(deps, deviceIdForDeviceFs(cfg), {
|
|
37346
37411
|
path: `fs/${command}`,
|
|
@@ -38816,7 +38881,7 @@ import { join as join4 } from "path";
|
|
|
38816
38881
|
// package.json
|
|
38817
38882
|
var package_default = {
|
|
38818
38883
|
name: "@tool-bridge/server",
|
|
38819
|
-
version: "0.
|
|
38884
|
+
version: "0.15.0",
|
|
38820
38885
|
description: "tool-bridge self-hosted server: run the HTBP gateway on Node with SQLite or PostgreSQL persistence, filesystem object storage and WebSocket device channel \u2014 single container via docker run",
|
|
38821
38886
|
type: "module",
|
|
38822
38887
|
license: "MIT",
|
|
@@ -39128,6 +39193,9 @@ function createTbServer(config) {
|
|
|
39128
39193
|
if (config.toolCacheTtlSec !== void 0) deps.toolCacheTtlSec = config.toolCacheTtlSec;
|
|
39129
39194
|
if (config.refThresholdBytes !== void 0) deps.refThresholdBytes = config.refThresholdBytes;
|
|
39130
39195
|
if (config.refTtlSec !== void 0) deps.refTtlSec = config.refTtlSec;
|
|
39196
|
+
if (config.uploadGrantTtlSec !== void 0) {
|
|
39197
|
+
deps.uploadGrantTtlSec = config.uploadGrantTtlSec;
|
|
39198
|
+
}
|
|
39131
39199
|
const app = createTbApp(deps);
|
|
39132
39200
|
let server;
|
|
39133
39201
|
return {
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/circleci/api.ts
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
external_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DXXYNIXV.js";
|
|
13
13
|
import "./chunk-MLKGABMK.js";
|
|
14
14
|
|
|
15
15
|
// ../plugins/src/clerk/api.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/cloudflare_dns/api.ts
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
external_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DXXYNIXV.js";
|
|
13
13
|
import "./chunk-MLKGABMK.js";
|
|
14
14
|
|
|
15
15
|
// ../plugins/src/cohere/api.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireCredential,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/confluence/api.ts
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
assertPublicHttpUrl,
|
|
8
8
|
guardedFetch
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-KH663T3A.js";
|
|
10
|
+
import "./chunk-UI4E4T5Q.js";
|
|
11
11
|
import {
|
|
12
12
|
TBError,
|
|
13
13
|
external_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DXXYNIXV.js";
|
|
15
15
|
import "./chunk-MLKGABMK.js";
|
|
16
16
|
|
|
17
17
|
// ../plugins/src/convertapi/schema.ts
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
external_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DXXYNIXV.js";
|
|
13
13
|
import "./chunk-MLKGABMK.js";
|
|
14
14
|
|
|
15
15
|
// ../plugins/src/currencyapi/api.ts
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NQ67PIIS.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KH663T3A.js";
|
|
9
|
+
import "./chunk-UI4E4T5Q.js";
|
|
10
10
|
import {
|
|
11
11
|
TBError,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DXXYNIXV.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// ../plugins/src/deepseek/api.ts
|