@tool-bridge/server 0.1.1 → 0.3.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-V6446SVY.js +792 -0
- package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
- package/dist/amap-TTTVB6WS.js +755 -0
- package/dist/anthropic-JH3RA363.js +224 -0
- package/dist/apify-ETNN7ITU.js +262 -0
- package/dist/brave_search-3DDR2MMB.js +322 -0
- package/dist/chunk-CSJEZHQO.js +252 -0
- package/dist/chunk-JLTYA2B3.js +20121 -0
- package/dist/chunk-K7FVSFUX.js +333 -0
- package/dist/{chunk-MQEYFCJB.js → chunk-KGYJEEBI.js} +2770 -21574
- package/dist/circleci-MX3TX3HC.js +409 -0
- package/dist/clerk-MRPORVF4.js +1036 -0
- package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
- package/dist/cohere-GPECP66S.js +197 -0
- package/dist/confluence-BN7LZ6BC.js +436 -0
- package/dist/convertapi-SBEOFOFQ.js +161 -0
- package/dist/currencyapi-P2YY7Y7P.js +306 -0
- package/dist/deepseek-MWB3NYIN.js +205 -0
- package/dist/docker_hub-3JSCIGQ3.js +946 -0
- package/dist/dropbox-RFIBDAXO.js +1308 -0
- package/dist/dub-YVP57ELQ.js +706 -0
- package/dist/e2b-NFSUHTZR.js +305 -0
- package/dist/exa-KTDY6IV3.js +360 -0
- package/dist/fal_ai-OCUENLNQ.js +405 -0
- package/dist/feishu-5CWBQ7E5.js +225 -0
- package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
- package/dist/figma-YULGANSA.js +798 -0
- package/dist/firehydrant-2V6YSYAP.js +573 -0
- package/dist/fixer-LTCDB3CJ.js +171 -0
- package/dist/fly-IXPKMAML.js +478 -0
- package/dist/front-KRFB4M5X.js +379 -0
- package/dist/geocodio-VVURKYHQ.js +236 -0
- package/dist/ghost-6J2RIOUB.js +341 -0
- package/dist/github-5Z6KQRYH.js +5410 -0
- package/dist/gmail-KU4NZ7VA.js +1894 -0
- package/dist/googlecalendar-X44DFFXG.js +2539 -0
- package/dist/googledocs-WSGLPKSF.js +1322 -0
- package/dist/grafana-4PKSSDXY.js +817 -0
- package/dist/graphhopper-DF65ZNGK.js +336 -0
- package/dist/index.d.ts +181 -2
- package/dist/index.js +2 -1
- package/dist/ip2proxy-UCAQ5P2J.js +118 -0
- package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
- package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
- package/dist/jina_ai-MRHPCSV5.js +119 -0
- package/dist/jira-EG7ZPOIW.js +627 -0
- package/dist/langsmith-FNO3RCOZ.js +597 -0
- package/dist/lemlist-SN6BJHSG.js +298 -0
- package/dist/linear-H3VU4PSD.js +2163 -0
- package/dist/logsnag-OY2JJT2H.js +167 -0
- package/dist/main.js +246 -2
- package/dist/mattermost-C5SQ7PGD.js +320 -0
- package/dist/mem0-LMLE5BFC.js +567 -0
- package/dist/memos-UWFAMBZC.js +781 -0
- package/dist/metabase-SRYDSDJ6.js +365 -0
- package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
- package/dist/mother_duck-CPGOFEXE.js +322 -0
- package/dist/ngrok-CDJFBSOM.js +375 -0
- package/dist/notes-DIVFH3P3.js +109 -0
- package/dist/notion-HGDKS4HK.js +945 -0
- package/dist/open_exchange_rates-COHHYJDD.js +216 -0
- package/dist/openai-4TRT66GW.js +795 -0
- package/dist/opengraph_io-YKVW4PXI.js +377 -0
- package/dist/openrouter-6CV7B7V5.js +444 -0
- package/dist/outline-YWDUK5F7.js +604 -0
- package/dist/paddle-MEU7HWDZ.js +464 -0
- package/dist/perplexity-MRQUDBIC.js +238 -0
- package/dist/pinecone-JI7X2TAF.js +599 -0
- package/dist/pipedrive-6JQPAW23.js +453 -0
- package/dist/polar-7BF56CMC.js +400 -0
- package/dist/posthog-YPU5ADEN.js +3462 -0
- package/dist/postmark-BEU5OFKU.js +441 -0
- package/dist/prerender-UT5GOOZH.js +180 -0
- package/dist/pubmed-3SGOE24Q.js +1052 -0
- package/dist/railway-CEK4GLRQ.js +452 -0
- package/dist/readwise-DXQUQU67.js +482 -0
- package/dist/render-7TGAU5AW.js +473 -0
- package/dist/replicate-VICFSQ5A.js +347 -0
- package/dist/resend-3E76WK3O.js +100 -0
- package/dist/rootly-36GY46BY.js +345 -0
- package/dist/scrapfly-VDVUYAHX.js +289 -0
- package/dist/scrapingbee-3KTPMAVY.js +247 -0
- package/dist/screenshot_fyi-LKG62C3J.js +116 -0
- package/dist/semantic_scholar-4WREECYO.js +626 -0
- package/dist/sentry-HUQTGXOV.js +1139 -0
- package/dist/shodan-SGRKU4KS.js +303 -0
- package/dist/shopify-YCZ4L5HT.js +620 -0
- package/dist/stripe-OEBKMELB.js +583 -0
- package/dist/supabase-I3DBY7L4.js +937 -0
- package/dist/tavily-B2YHCNRD.js +349 -0
- package/dist/telegram-2VYJELZX.js +1773 -0
- package/dist/telnyx-HHXD3CXL.js +237 -0
- package/dist/todoist-PHFDEEIS.js +672 -0
- package/dist/trello-WUSAK6YN.js +1091 -0
- package/dist/turso-FW56U2B3.js +432 -0
- package/dist/twilio-M5JI7XHA.js +321 -0
- package/dist/umami-HAYODRC4.js +411 -0
- package/dist/unsplash-EDPTNEHJ.js +364 -0
- package/dist/upstash_redis-GC2CLIWD.js +299 -0
- package/dist/uptimerobot-XMSNYLIT.js +481 -0
- package/dist/v2ex-KU4ECD65.js +672 -0
- package/dist/vercel-THPCEFHW.js +1096 -0
- package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
- package/dist/wordpress-O6TQEQNF.js +822 -0
- package/dist/workos-A3VHHWI3.js +681 -0
- package/dist/zhihu-BJAI64YJ.js +273 -0
- package/package.json +5 -4
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderPlugin,
|
|
3
|
+
guardedFetch,
|
|
4
|
+
requireApiKey,
|
|
5
|
+
upstreamError
|
|
6
|
+
} from "./chunk-CSJEZHQO.js";
|
|
7
|
+
import "./chunk-K7FVSFUX.js";
|
|
8
|
+
import {
|
|
9
|
+
external_exports
|
|
10
|
+
} from "./chunk-JLTYA2B3.js";
|
|
11
|
+
import "./chunk-MLKGABMK.js";
|
|
12
|
+
|
|
13
|
+
// ../plugins/src/cohere/api.ts
|
|
14
|
+
var SERVICE = "cohere";
|
|
15
|
+
var API_BASE = "https://api.cohere.com";
|
|
16
|
+
function text(value) {
|
|
17
|
+
if (typeof value !== "string") return void 0;
|
|
18
|
+
const trimmed = value.trim();
|
|
19
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
20
|
+
}
|
|
21
|
+
function record(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
23
|
+
}
|
|
24
|
+
function errorMessage(body, status) {
|
|
25
|
+
const fallback = text(body) ?? `cohere request failed with ${status}`;
|
|
26
|
+
let payload;
|
|
27
|
+
try {
|
|
28
|
+
payload = JSON.parse(body);
|
|
29
|
+
} catch {
|
|
30
|
+
return fallback;
|
|
31
|
+
}
|
|
32
|
+
const root = record(payload);
|
|
33
|
+
return text(record(root?.error)?.message) ?? text(root?.message) ?? fallback;
|
|
34
|
+
}
|
|
35
|
+
function cohereError(status, body) {
|
|
36
|
+
return upstreamError(status === 498 ? 401 : status, errorMessage(body, status));
|
|
37
|
+
}
|
|
38
|
+
async function post(ctx, path, body) {
|
|
39
|
+
const response = await guardedFetch(`${API_BASE}${path}`, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
"accept": "application/json",
|
|
43
|
+
"authorization": `Bearer ${requireApiKey(ctx, SERVICE)}`,
|
|
44
|
+
"content-type": "application/json"
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify(body)
|
|
47
|
+
});
|
|
48
|
+
const raw = await response.text().catch(() => "");
|
|
49
|
+
if (!response.ok) throw cohereError(response.status, raw);
|
|
50
|
+
let payload;
|
|
51
|
+
try {
|
|
52
|
+
payload = JSON.parse(raw);
|
|
53
|
+
} catch {
|
|
54
|
+
throw upstreamError(502, "cohere returned an invalid JSON response");
|
|
55
|
+
}
|
|
56
|
+
const result = record(payload);
|
|
57
|
+
if (result === void 0) throw upstreamError(502, "cohere returned an invalid JSON response");
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
async function chat(input, ctx) {
|
|
61
|
+
return post(ctx, "/v2/chat", input);
|
|
62
|
+
}
|
|
63
|
+
async function embedTexts(input, ctx) {
|
|
64
|
+
return post(ctx, "/v2/embed", input);
|
|
65
|
+
}
|
|
66
|
+
async function rerankDocuments(input, ctx) {
|
|
67
|
+
return post(ctx, "/v2/rerank", input);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ../plugins/src/cohere/schema.ts
|
|
71
|
+
var chatInput = external_exports.strictObject({
|
|
72
|
+
model: external_exports.string().min(1).describe("The name of a compatible Cohere chat model."),
|
|
73
|
+
messages: external_exports.array(external_exports.strictObject({
|
|
74
|
+
role: external_exports.enum(["system", "user", "assistant", "tool"]).describe("The author role for the message."),
|
|
75
|
+
content: external_exports.union([external_exports.string().describe("Plain text message content."), external_exports.array(external_exports.looseObject({
|
|
76
|
+
type: external_exports.string().describe("The content block type, such as text or image_url.")
|
|
77
|
+
}).describe("A Cohere chat message content block.")).min(1).describe("Structured content blocks for the message.")]).describe("The content of a Cohere chat message.").optional(),
|
|
78
|
+
tool_calls: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Tool calls made by the assistant message.").optional(),
|
|
79
|
+
tool_call_id: external_exports.string().describe("The identifier of the tool call this tool message responds to.").optional()
|
|
80
|
+
}).describe("A message in the conversation sent to the Cohere Chat API.")).min(1).describe("The ordered conversation messages to send to Cohere."),
|
|
81
|
+
tools: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Function tools available to the model.").optional(),
|
|
82
|
+
strict_tools: external_exports.boolean().describe("Whether tool calls must strictly follow the tool definition.").optional(),
|
|
83
|
+
documents: external_exports.array(external_exports.union([external_exports.string().describe("Document text."), external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")]).describe("A document supplied to the model.")).describe("Documents that the model can cite while generating the response.").optional(),
|
|
84
|
+
citation_options: external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.").optional(),
|
|
85
|
+
response_format: external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.").optional(),
|
|
86
|
+
safety_mode: external_exports.string().describe("The Cohere safety mode to use for the request.").optional(),
|
|
87
|
+
max_tokens: external_exports.int().describe("The maximum number of output tokens the model will generate.").optional(),
|
|
88
|
+
stop_sequences: external_exports.array(external_exports.string().describe("A stop sequence.")).max(5).describe("Stop sequences that halt generation.").optional(),
|
|
89
|
+
temperature: external_exports.number().describe("Randomness used for generation.").optional(),
|
|
90
|
+
seed: external_exports.int().describe("A best-effort deterministic sampling seed.").optional(),
|
|
91
|
+
frequency_penalty: external_exports.number().describe("Penalty used to reduce repeated tokens.").optional(),
|
|
92
|
+
presence_penalty: external_exports.number().describe("Penalty used to reduce reused token content.").optional(),
|
|
93
|
+
k: external_exports.int().describe("Top-k sampling value. Use 0 to disable k-sampling.").optional(),
|
|
94
|
+
p: external_exports.number().describe("Top-p sampling value.").optional(),
|
|
95
|
+
logprobs: external_exports.boolean().describe("Whether to include generated-token log probabilities.").optional(),
|
|
96
|
+
tool_choice: external_exports.union([external_exports.string().describe("A predefined tool choice value."), external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")]).describe("Tool selection behavior for the model.").optional(),
|
|
97
|
+
thinking: external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.").optional(),
|
|
98
|
+
priority: external_exports.int().describe("Lower values are handled earlier by Cohere.").optional()
|
|
99
|
+
}).describe("Input for generating a synchronous response with the Cohere Chat API.");
|
|
100
|
+
var chatOutput = external_exports.looseObject({
|
|
101
|
+
id: external_exports.string().describe("The unique Cohere response identifier."),
|
|
102
|
+
finish_reason: external_exports.string().describe("Why generation finished."),
|
|
103
|
+
message: external_exports.looseObject({
|
|
104
|
+
role: external_exports.string().describe("The role of the returned message.").optional(),
|
|
105
|
+
content: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Content blocks returned by the assistant message.").optional(),
|
|
106
|
+
tool_calls: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Tool calls returned by Cohere.").optional()
|
|
107
|
+
}).describe("The assistant message returned by Cohere."),
|
|
108
|
+
usage: external_exports.looseObject({}).describe("Usage statistics returned by Cohere.")
|
|
109
|
+
}).describe("The response returned by the Cohere Chat API.");
|
|
110
|
+
var embedTextsInput = external_exports.strictObject({
|
|
111
|
+
model: external_exports.string().min(1).describe("The Cohere embedding model identifier."),
|
|
112
|
+
input_type: external_exports.enum(["search_document", "search_query", "classification", "clustering"]).describe("The type of input passed to the embedding model."),
|
|
113
|
+
texts: external_exports.array(external_exports.string().describe("A text value to embed.")).min(1).max(96).describe("Text strings for the model to embed."),
|
|
114
|
+
max_tokens: external_exports.int().describe("The maximum number of tokens to embed per input.").optional(),
|
|
115
|
+
output_dimension: external_exports.int().describe("The number of dimensions for embed-v4 and newer models.").optional(),
|
|
116
|
+
embedding_types: external_exports.array(external_exports.enum(["float", "int8", "uint8", "binary", "ubinary", "base64"]).describe("The embedding representation to return.")).min(1).describe("Embedding representations to return.").optional(),
|
|
117
|
+
truncate: external_exports.enum(["NONE", "START", "END"]).describe("How Cohere handles inputs longer than the model limit.").optional(),
|
|
118
|
+
priority: external_exports.int().describe("Lower values are handled earlier by Cohere.").optional()
|
|
119
|
+
}).describe("Input for generating text embeddings with the Cohere Embed API.");
|
|
120
|
+
var embedTextsOutput = external_exports.looseObject({
|
|
121
|
+
id: external_exports.string().describe("The unique Cohere response identifier."),
|
|
122
|
+
embeddings: external_exports.looseObject({}).describe("Embeddings grouped by requested representation type."),
|
|
123
|
+
texts: external_exports.array(external_exports.string().describe("A text input.")).describe("Text inputs echoed by Cohere."),
|
|
124
|
+
meta: external_exports.looseObject({
|
|
125
|
+
api_version: external_exports.looseObject({
|
|
126
|
+
version: external_exports.string().describe("The API version used for the response.").optional(),
|
|
127
|
+
is_deprecated: external_exports.boolean().describe("Whether this API version is deprecated.").optional(),
|
|
128
|
+
is_experimental: external_exports.boolean().describe("Whether this API version is experimental.").optional()
|
|
129
|
+
}).describe("The Cohere API version metadata.").optional(),
|
|
130
|
+
billed_units: external_exports.looseObject({}).describe("Billing unit counts reported by Cohere.").optional(),
|
|
131
|
+
tokens: external_exports.looseObject({}).describe("Token usage counts reported by Cohere.").optional(),
|
|
132
|
+
warnings: external_exports.array(external_exports.string().describe("A warning message.")).describe("Warnings returned by Cohere.").optional()
|
|
133
|
+
}).describe("Cohere API metadata including usage and billing details.")
|
|
134
|
+
}).describe("The response returned by the Cohere Embed API.");
|
|
135
|
+
var rerankDocumentsInput = external_exports.strictObject({
|
|
136
|
+
model: external_exports.string().min(1).describe("The Cohere rerank model identifier."),
|
|
137
|
+
query: external_exports.string().min(1).describe("The search query used to rank documents."),
|
|
138
|
+
documents: external_exports.array(external_exports.string().describe("A text document to rank.")).min(1).describe("Texts that will be compared to the query."),
|
|
139
|
+
top_n: external_exports.int().describe("Maximum number of rerank results to return.").optional(),
|
|
140
|
+
max_tokens_per_doc: external_exports.int().describe("Maximum tokens to keep per document before ranking.").optional(),
|
|
141
|
+
priority: external_exports.int().describe("Lower values are handled earlier by Cohere.").optional()
|
|
142
|
+
}).describe("Input for ranking documents by relevance with the Cohere Rerank API.");
|
|
143
|
+
var rerankDocumentsOutput = external_exports.looseObject({
|
|
144
|
+
id: external_exports.string().describe("The unique Cohere response identifier."),
|
|
145
|
+
results: external_exports.array(external_exports.strictObject({
|
|
146
|
+
index: external_exports.int().describe("The original zero-based index of the ranked document.").optional(),
|
|
147
|
+
relevance_score: external_exports.number().describe("Normalized relevance score between 0 and 1.").optional()
|
|
148
|
+
}).describe("A ranked document result returned by Cohere.")).describe("Ranked document results."),
|
|
149
|
+
meta: external_exports.looseObject({
|
|
150
|
+
api_version: external_exports.looseObject({
|
|
151
|
+
version: external_exports.string().describe("The API version used for the response.").optional(),
|
|
152
|
+
is_deprecated: external_exports.boolean().describe("Whether this API version is deprecated.").optional(),
|
|
153
|
+
is_experimental: external_exports.boolean().describe("Whether this API version is experimental.").optional()
|
|
154
|
+
}).describe("The Cohere API version metadata.").optional(),
|
|
155
|
+
billed_units: external_exports.looseObject({}).describe("Billing unit counts reported by Cohere.").optional(),
|
|
156
|
+
tokens: external_exports.looseObject({}).describe("Token usage counts reported by Cohere.").optional(),
|
|
157
|
+
warnings: external_exports.array(external_exports.string().describe("A warning message.")).describe("Warnings returned by Cohere.").optional()
|
|
158
|
+
}).describe("Cohere API metadata including usage and billing details.")
|
|
159
|
+
}).describe("The response returned by the Cohere Rerank API.");
|
|
160
|
+
var cohereActions = {
|
|
161
|
+
chat: {
|
|
162
|
+
description: "Generate a synchronous text response using the Cohere Chat API.",
|
|
163
|
+
effect: "write",
|
|
164
|
+
inputSchema: chatInput,
|
|
165
|
+
outputSchema: external_exports.toJSONSchema(chatOutput, { io: "output", unrepresentable: "any" })
|
|
166
|
+
},
|
|
167
|
+
embed_texts: {
|
|
168
|
+
description: "Generate embeddings for text inputs using the Cohere Embed API.",
|
|
169
|
+
effect: "write",
|
|
170
|
+
inputSchema: embedTextsInput,
|
|
171
|
+
outputSchema: external_exports.toJSONSchema(embedTextsOutput, { io: "output", unrepresentable: "any" })
|
|
172
|
+
},
|
|
173
|
+
rerank_documents: {
|
|
174
|
+
description: "Rank text documents by relevance to a query using the Cohere Rerank API.",
|
|
175
|
+
effect: "write",
|
|
176
|
+
inputSchema: rerankDocumentsInput,
|
|
177
|
+
outputSchema: external_exports.toJSONSchema(rerankDocumentsOutput, { io: "output", unrepresentable: "any" })
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// ../plugins/src/cohere/index.ts
|
|
182
|
+
function createCoherePlugin() {
|
|
183
|
+
return createProviderPlugin({
|
|
184
|
+
description: "Cohere",
|
|
185
|
+
actions: cohereActions,
|
|
186
|
+
handlers: {
|
|
187
|
+
chat,
|
|
188
|
+
embed_texts: embedTexts,
|
|
189
|
+
rerank_documents: rerankDocuments
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
var cohere_default = createCoherePlugin();
|
|
194
|
+
export {
|
|
195
|
+
createCoherePlugin,
|
|
196
|
+
cohere_default as default
|
|
197
|
+
};
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderPlugin,
|
|
3
|
+
guardedFetch,
|
|
4
|
+
requireCredential,
|
|
5
|
+
upstreamError
|
|
6
|
+
} from "./chunk-CSJEZHQO.js";
|
|
7
|
+
import "./chunk-K7FVSFUX.js";
|
|
8
|
+
import {
|
|
9
|
+
TBError,
|
|
10
|
+
external_exports
|
|
11
|
+
} from "./chunk-JLTYA2B3.js";
|
|
12
|
+
import "./chunk-MLKGABMK.js";
|
|
13
|
+
|
|
14
|
+
// ../plugins/src/confluence/api.ts
|
|
15
|
+
var SERVICE = "confluence";
|
|
16
|
+
var REQUEST_TIMEOUT_MS = 3e4;
|
|
17
|
+
var DEFAULT_LIMIT = 25;
|
|
18
|
+
function text(value) {
|
|
19
|
+
if (typeof value !== "string") return void 0;
|
|
20
|
+
const trimmed = value.trim();
|
|
21
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
22
|
+
}
|
|
23
|
+
function record(value) {
|
|
24
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
25
|
+
}
|
|
26
|
+
function integer(value) {
|
|
27
|
+
return typeof value === "number" && Number.isInteger(value) ? value : void 0;
|
|
28
|
+
}
|
|
29
|
+
function boolean(value) {
|
|
30
|
+
return typeof value === "boolean" ? value : void 0;
|
|
31
|
+
}
|
|
32
|
+
function compact(input) {
|
|
33
|
+
return Object.fromEntries(
|
|
34
|
+
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function requireRecord(value, message) {
|
|
38
|
+
const result = record(value);
|
|
39
|
+
if (result === void 0) throw upstreamError(502, message);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
function siteBaseUrl(ctx) {
|
|
43
|
+
const raw = requireCredential(ctx, SERVICE, "siteUrl");
|
|
44
|
+
let url;
|
|
45
|
+
try {
|
|
46
|
+
url = new URL(raw.includes("://") ? raw : `https://${raw}`);
|
|
47
|
+
} catch {
|
|
48
|
+
throw new TBError("invalid_argument", "Confluence siteUrl must be a valid URL");
|
|
49
|
+
}
|
|
50
|
+
if (url.protocol !== "https:") {
|
|
51
|
+
throw new TBError("invalid_argument", "Confluence siteUrl must use https");
|
|
52
|
+
}
|
|
53
|
+
if (!url.hostname.endsWith(".atlassian.net")) {
|
|
54
|
+
throw new TBError("invalid_argument", "Confluence siteUrl must be an atlassian.net Cloud site");
|
|
55
|
+
}
|
|
56
|
+
return `https://${url.hostname}/wiki/api/v2`;
|
|
57
|
+
}
|
|
58
|
+
function basicAuthHeader(ctx) {
|
|
59
|
+
const email = requireCredential(ctx, SERVICE, "email");
|
|
60
|
+
const apiToken = requireCredential(ctx, SERVICE, "apiKey");
|
|
61
|
+
const bytes = new TextEncoder().encode(`${email}:${apiToken}`);
|
|
62
|
+
let binary = "";
|
|
63
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
64
|
+
return `Basic ${btoa(binary)}`;
|
|
65
|
+
}
|
|
66
|
+
function errorMessage(payload, response) {
|
|
67
|
+
if (typeof payload === "string") {
|
|
68
|
+
const trimmed = payload.trim();
|
|
69
|
+
if (trimmed !== "") return trimmed;
|
|
70
|
+
}
|
|
71
|
+
const body = record(payload);
|
|
72
|
+
const fromList = Array.isArray(body?.errors) ? body.errors.map((item) => text(record(item)?.message)).find((item) => item !== void 0) : void 0;
|
|
73
|
+
return text(body?.message) ?? text(body?.errorMessage) ?? text(body?.error) ?? fromList ?? text(response.statusText) ?? "Confluence request failed";
|
|
74
|
+
}
|
|
75
|
+
async function request(ctx, options) {
|
|
76
|
+
const headers = {
|
|
77
|
+
accept: "application/json",
|
|
78
|
+
authorization: basicAuthHeader(ctx)
|
|
79
|
+
};
|
|
80
|
+
if (options.body !== void 0) headers["content-type"] = "application/json";
|
|
81
|
+
const url = new URL(options.path.replace(/^\//, ""), `${siteBaseUrl(ctx)}/`);
|
|
82
|
+
for (const [key, value] of Object.entries(options.query ?? {})) {
|
|
83
|
+
if (value !== void 0) url.searchParams.set(key, String(value));
|
|
84
|
+
}
|
|
85
|
+
let response;
|
|
86
|
+
try {
|
|
87
|
+
response = await guardedFetch(url.toString(), {
|
|
88
|
+
method: options.method,
|
|
89
|
+
headers,
|
|
90
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
91
|
+
...options.body === void 0 ? {} : { body: JSON.stringify(options.body) }
|
|
92
|
+
});
|
|
93
|
+
} catch (error) {
|
|
94
|
+
if (error instanceof TBError) throw error;
|
|
95
|
+
if (error instanceof Error && error.name === "TimeoutError") {
|
|
96
|
+
throw upstreamError(504, `Confluence request timed out after ${REQUEST_TIMEOUT_MS / 1e3} seconds`);
|
|
97
|
+
}
|
|
98
|
+
throw upstreamError(
|
|
99
|
+
502,
|
|
100
|
+
error instanceof Error ? `Confluence request failed: ${error.message}` : "Confluence request failed"
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
const raw = await response.text().catch(() => "");
|
|
104
|
+
let payload = null;
|
|
105
|
+
if (raw.trim() !== "") {
|
|
106
|
+
try {
|
|
107
|
+
payload = JSON.parse(raw);
|
|
108
|
+
} catch {
|
|
109
|
+
payload = raw;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!response.ok) throw upstreamError(response.status, errorMessage(payload, response));
|
|
113
|
+
return payload;
|
|
114
|
+
}
|
|
115
|
+
function nextCursor(payload) {
|
|
116
|
+
const link = text(record(payload._links)?.next);
|
|
117
|
+
if (link === void 0) return null;
|
|
118
|
+
const questionIndex = link.indexOf("?");
|
|
119
|
+
const search = questionIndex >= 0 ? link.slice(questionIndex) : link;
|
|
120
|
+
try {
|
|
121
|
+
return new URLSearchParams(search).get("cursor");
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function normalizeSpace(value) {
|
|
127
|
+
const space = requireRecord(value, "Confluence space must be an object");
|
|
128
|
+
return compact({
|
|
129
|
+
id: text(space.id),
|
|
130
|
+
key: text(space.key),
|
|
131
|
+
name: text(space.name),
|
|
132
|
+
type: text(space.type),
|
|
133
|
+
status: text(space.status),
|
|
134
|
+
homepageId: text(space.homepageId ?? record(space.homepage)?.id) ?? null,
|
|
135
|
+
raw: space
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function normalizePage(value) {
|
|
139
|
+
const page = requireRecord(value, "Confluence page must be an object");
|
|
140
|
+
const version = record(page.version);
|
|
141
|
+
return compact({
|
|
142
|
+
id: text(page.id),
|
|
143
|
+
status: text(page.status),
|
|
144
|
+
title: text(page.title),
|
|
145
|
+
spaceId: text(page.spaceId),
|
|
146
|
+
parentId: text(page.parentId) ?? null,
|
|
147
|
+
createdAt: text(page.createdAt),
|
|
148
|
+
version: version === void 0 ? null : compact({
|
|
149
|
+
number: integer(version.number),
|
|
150
|
+
message: text(version.message),
|
|
151
|
+
minorEdit: boolean(version.minorEdit)
|
|
152
|
+
}),
|
|
153
|
+
body: record(page.body) ?? null,
|
|
154
|
+
raw: page
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function normalizeSearchResult(value) {
|
|
158
|
+
const result = requireRecord(value, "Confluence search result must be an object");
|
|
159
|
+
const content = record(result.content);
|
|
160
|
+
return compact({
|
|
161
|
+
// 搜索结果的字段有时挂在顶层、有时挂在 content 下,两处都要看。
|
|
162
|
+
id: text(result.id ?? content?.id),
|
|
163
|
+
type: text(result.type ?? content?.type),
|
|
164
|
+
title: text(result.title ?? content?.title),
|
|
165
|
+
url: text(result.url ?? result.webUrl ?? result.link),
|
|
166
|
+
excerpt: text(result.excerpt),
|
|
167
|
+
containerTitle: text(record(result.resultGlobalContainer)?.title),
|
|
168
|
+
raw: result
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
async function searchContent(input, ctx) {
|
|
172
|
+
const payload = requireRecord(
|
|
173
|
+
await request(ctx, {
|
|
174
|
+
method: "GET",
|
|
175
|
+
path: "/search",
|
|
176
|
+
query: compact({
|
|
177
|
+
cql: input.cql,
|
|
178
|
+
limit: input.limit ?? DEFAULT_LIMIT,
|
|
179
|
+
cursor: text(input.cursor)
|
|
180
|
+
})
|
|
181
|
+
}),
|
|
182
|
+
"Confluence search response must be an object"
|
|
183
|
+
);
|
|
184
|
+
const results = Array.isArray(payload.results) ? payload.results : [];
|
|
185
|
+
return { results: results.map(normalizeSearchResult), pagination: { nextCursor: nextCursor(payload) } };
|
|
186
|
+
}
|
|
187
|
+
async function listSpaces(input, ctx) {
|
|
188
|
+
const payload = requireRecord(
|
|
189
|
+
await request(ctx, {
|
|
190
|
+
method: "GET",
|
|
191
|
+
path: "/spaces",
|
|
192
|
+
query: compact({
|
|
193
|
+
limit: input.limit ?? DEFAULT_LIMIT,
|
|
194
|
+
cursor: text(input.cursor),
|
|
195
|
+
type: text(input.type),
|
|
196
|
+
status: text(input.status)
|
|
197
|
+
})
|
|
198
|
+
}),
|
|
199
|
+
"Confluence spaces response must be an object"
|
|
200
|
+
);
|
|
201
|
+
const results = Array.isArray(payload.results) ? payload.results : [];
|
|
202
|
+
return { spaces: results.map(normalizeSpace), pagination: { nextCursor: nextCursor(payload) } };
|
|
203
|
+
}
|
|
204
|
+
async function getPage(input, ctx) {
|
|
205
|
+
const payload = await request(ctx, {
|
|
206
|
+
method: "GET",
|
|
207
|
+
path: `/pages/${encodeURIComponent(input.pageId)}`,
|
|
208
|
+
query: compact({ "body-format": text(input.bodyFormat) })
|
|
209
|
+
});
|
|
210
|
+
return { page: normalizePage(payload) };
|
|
211
|
+
}
|
|
212
|
+
async function createPage(input, ctx) {
|
|
213
|
+
const payload = await request(ctx, {
|
|
214
|
+
method: "POST",
|
|
215
|
+
path: "/pages",
|
|
216
|
+
body: compact({
|
|
217
|
+
spaceId: input.spaceId,
|
|
218
|
+
status: text(input.status) ?? "current",
|
|
219
|
+
title: input.title,
|
|
220
|
+
parentId: text(input.parentId),
|
|
221
|
+
body: { representation: text(input.bodyRepresentation) ?? "storage", value: input.body }
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
return { page: normalizePage(payload) };
|
|
225
|
+
}
|
|
226
|
+
async function updatePage(input, ctx) {
|
|
227
|
+
const body = text(input.body);
|
|
228
|
+
const payload = await request(ctx, {
|
|
229
|
+
method: "PUT",
|
|
230
|
+
path: `/pages/${encodeURIComponent(input.pageId)}`,
|
|
231
|
+
body: compact({
|
|
232
|
+
// Confluence 的 PUT 要求 body 里再带一次 id,少了会 400。
|
|
233
|
+
id: input.pageId,
|
|
234
|
+
status: text(input.status) ?? "current",
|
|
235
|
+
title: input.title,
|
|
236
|
+
// 没给正文就整块省略 —— 发一个空 value 会把页面内容清空。
|
|
237
|
+
body: body === void 0 ? void 0 : { representation: text(input.bodyRepresentation) ?? "storage", value: body },
|
|
238
|
+
version: compact({
|
|
239
|
+
number: input.versionNumber,
|
|
240
|
+
message: text(input.versionMessage),
|
|
241
|
+
minorEdit: input.minorEdit
|
|
242
|
+
})
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
return { page: normalizePage(payload) };
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// ../plugins/src/confluence/schema.ts
|
|
249
|
+
var searchContentInput = external_exports.strictObject({
|
|
250
|
+
cql: external_exports.string().min(1).describe("The Confluence Query Language string to execute."),
|
|
251
|
+
limit: external_exports.int().min(1).max(100).describe("Maximum number of items to return.").optional(),
|
|
252
|
+
cursor: external_exports.string().min(1).describe("Opaque pagination cursor returned by Confluence.").optional()
|
|
253
|
+
}).describe("Input parameters for searching Confluence content.");
|
|
254
|
+
var searchContentOutput = external_exports.strictObject({
|
|
255
|
+
results: external_exports.array(external_exports.looseObject({
|
|
256
|
+
id: external_exports.string().describe("The Confluence content ID when returned.").optional(),
|
|
257
|
+
type: external_exports.string().describe("The Confluence content type when returned.").optional(),
|
|
258
|
+
title: external_exports.string().describe("The Confluence content title when returned.").optional(),
|
|
259
|
+
url: external_exports.string().describe("The Confluence web URL when returned.").optional(),
|
|
260
|
+
excerpt: external_exports.string().describe("The Confluence search excerpt when returned.").optional(),
|
|
261
|
+
containerTitle: external_exports.string().describe("The Confluence container title when returned.").optional(),
|
|
262
|
+
raw: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").optional()
|
|
263
|
+
}).describe("A Confluence search result.")).describe("The matching Confluence search results.").optional(),
|
|
264
|
+
pagination: external_exports.strictObject({
|
|
265
|
+
nextCursor: external_exports.string().describe("Cursor for the next Confluence page, or null when no next page is available.").nullable().optional()
|
|
266
|
+
}).describe("Confluence pagination metadata.").optional()
|
|
267
|
+
}).describe("The normalized Confluence search response.");
|
|
268
|
+
var listSpacesInput = external_exports.strictObject({
|
|
269
|
+
limit: external_exports.int().min(1).max(100).describe("Maximum number of items to return.").optional(),
|
|
270
|
+
cursor: external_exports.string().min(1).describe("Opaque pagination cursor returned by Confluence.").optional(),
|
|
271
|
+
type: external_exports.enum(["global", "personal"]).describe("Filter spaces by Confluence space type.").optional(),
|
|
272
|
+
status: external_exports.enum(["current", "archived"]).describe("Filter spaces by Confluence space status.").optional()
|
|
273
|
+
}).describe("Input parameters for listing Confluence spaces.");
|
|
274
|
+
var listSpacesOutput = external_exports.strictObject({
|
|
275
|
+
spaces: external_exports.array(external_exports.looseObject({
|
|
276
|
+
id: external_exports.string().describe("The Confluence space ID.").optional(),
|
|
277
|
+
key: external_exports.string().describe("The Confluence space key.").optional(),
|
|
278
|
+
name: external_exports.string().describe("The Confluence space name.").optional(),
|
|
279
|
+
type: external_exports.string().describe("The Confluence space type.").optional(),
|
|
280
|
+
status: external_exports.string().describe("The Confluence space status.").optional(),
|
|
281
|
+
homepageId: external_exports.string().describe("The ID of the space homepage, or null when unavailable.").nullable().optional(),
|
|
282
|
+
raw: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").optional()
|
|
283
|
+
}).describe("A Confluence space.")).describe("The Confluence spaces returned by the request.").optional(),
|
|
284
|
+
pagination: external_exports.strictObject({
|
|
285
|
+
nextCursor: external_exports.string().describe("Cursor for the next Confluence page, or null when no next page is available.").nullable().optional()
|
|
286
|
+
}).describe("Confluence pagination metadata.").optional()
|
|
287
|
+
}).describe("The normalized Confluence spaces response.");
|
|
288
|
+
var getPageInput = external_exports.strictObject({
|
|
289
|
+
pageId: external_exports.string().min(1).describe("The Confluence page ID."),
|
|
290
|
+
bodyFormat: external_exports.enum(["storage", "atlas_doc_format", "view", "export_view", "styled_view"]).describe("The body representation to include.").optional()
|
|
291
|
+
}).describe("Input parameters for retrieving a Confluence page.");
|
|
292
|
+
var getPageOutput = external_exports.strictObject({
|
|
293
|
+
page: external_exports.looseObject({
|
|
294
|
+
id: external_exports.string().describe("The Confluence page ID.").optional(),
|
|
295
|
+
status: external_exports.string().describe("The Confluence page status.").optional(),
|
|
296
|
+
title: external_exports.string().describe("The Confluence page title.").optional(),
|
|
297
|
+
spaceId: external_exports.string().describe("The Confluence space ID containing the page.").optional(),
|
|
298
|
+
parentId: external_exports.string().describe("The parent page ID, or null when unavailable.").nullable().optional(),
|
|
299
|
+
createdAt: external_exports.string().describe("The Confluence page creation timestamp.").optional(),
|
|
300
|
+
version: external_exports.looseObject({
|
|
301
|
+
number: external_exports.int().describe("The Confluence page version number.").optional(),
|
|
302
|
+
message: external_exports.string().describe("The Confluence page version message.").optional(),
|
|
303
|
+
minorEdit: external_exports.boolean().describe("Whether this version is marked as a minor edit.").optional()
|
|
304
|
+
}).describe("A Confluence page version.").nullable().optional(),
|
|
305
|
+
body: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").nullable().optional(),
|
|
306
|
+
raw: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").optional()
|
|
307
|
+
}).describe("A Confluence page.").optional()
|
|
308
|
+
}).describe("The normalized Confluence page response.");
|
|
309
|
+
var createPageInput = external_exports.strictObject({
|
|
310
|
+
spaceId: external_exports.string().min(1).describe("The Confluence space ID where the page will be created."),
|
|
311
|
+
title: external_exports.string().min(1).describe("The title for the new Confluence page."),
|
|
312
|
+
body: external_exports.string().min(1).describe("The page body value for the selected representation."),
|
|
313
|
+
bodyRepresentation: external_exports.enum(["storage", "atlas_doc_format"]).describe("The representation used for the page body.").optional(),
|
|
314
|
+
parentId: external_exports.string().min(1).describe("The parent Confluence page ID.").optional(),
|
|
315
|
+
status: external_exports.enum(["current", "draft"]).describe("The Confluence page status to create.").optional()
|
|
316
|
+
}).describe("Input parameters for creating a Confluence page.");
|
|
317
|
+
var createPageOutput = external_exports.strictObject({
|
|
318
|
+
page: external_exports.looseObject({
|
|
319
|
+
id: external_exports.string().describe("The Confluence page ID.").optional(),
|
|
320
|
+
status: external_exports.string().describe("The Confluence page status.").optional(),
|
|
321
|
+
title: external_exports.string().describe("The Confluence page title.").optional(),
|
|
322
|
+
spaceId: external_exports.string().describe("The Confluence space ID containing the page.").optional(),
|
|
323
|
+
parentId: external_exports.string().describe("The parent page ID, or null when unavailable.").nullable().optional(),
|
|
324
|
+
createdAt: external_exports.string().describe("The Confluence page creation timestamp.").optional(),
|
|
325
|
+
version: external_exports.looseObject({
|
|
326
|
+
number: external_exports.int().describe("The Confluence page version number.").optional(),
|
|
327
|
+
message: external_exports.string().describe("The Confluence page version message.").optional(),
|
|
328
|
+
minorEdit: external_exports.boolean().describe("Whether this version is marked as a minor edit.").optional()
|
|
329
|
+
}).describe("A Confluence page version.").nullable().optional(),
|
|
330
|
+
body: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").nullable().optional(),
|
|
331
|
+
raw: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").optional()
|
|
332
|
+
}).describe("A Confluence page.").optional()
|
|
333
|
+
}).describe("The normalized Confluence create page response.");
|
|
334
|
+
var updatePageInput = external_exports.strictObject({
|
|
335
|
+
pageId: external_exports.string().min(1).describe("The Confluence page ID."),
|
|
336
|
+
title: external_exports.string().min(1).describe("The updated Confluence page title."),
|
|
337
|
+
versionNumber: external_exports.int().min(1).describe("The next Confluence page version number."),
|
|
338
|
+
body: external_exports.string().min(1).describe("The updated page body value for the selected representation.").optional(),
|
|
339
|
+
bodyRepresentation: external_exports.enum(["storage", "atlas_doc_format"]).describe("The representation used for the page body.").optional(),
|
|
340
|
+
status: external_exports.enum(["current", "draft"]).describe("The updated Confluence page status.").optional(),
|
|
341
|
+
versionMessage: external_exports.string().min(1).describe("A message stored with the new Confluence page version.").optional(),
|
|
342
|
+
minorEdit: external_exports.boolean().describe("Whether the update should be marked as a minor edit.").optional()
|
|
343
|
+
}).describe("Input parameters for updating a Confluence page.");
|
|
344
|
+
var updatePageOutput = external_exports.strictObject({
|
|
345
|
+
page: external_exports.looseObject({
|
|
346
|
+
id: external_exports.string().describe("The Confluence page ID.").optional(),
|
|
347
|
+
status: external_exports.string().describe("The Confluence page status.").optional(),
|
|
348
|
+
title: external_exports.string().describe("The Confluence page title.").optional(),
|
|
349
|
+
spaceId: external_exports.string().describe("The Confluence space ID containing the page.").optional(),
|
|
350
|
+
parentId: external_exports.string().describe("The parent page ID, or null when unavailable.").nullable().optional(),
|
|
351
|
+
createdAt: external_exports.string().describe("The Confluence page creation timestamp.").optional(),
|
|
352
|
+
version: external_exports.looseObject({
|
|
353
|
+
number: external_exports.int().describe("The Confluence page version number.").optional(),
|
|
354
|
+
message: external_exports.string().describe("The Confluence page version message.").optional(),
|
|
355
|
+
minorEdit: external_exports.boolean().describe("Whether this version is marked as a minor edit.").optional()
|
|
356
|
+
}).describe("A Confluence page version.").nullable().optional(),
|
|
357
|
+
body: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").nullable().optional(),
|
|
358
|
+
raw: external_exports.looseObject({}).describe("Provider-specific Confluence payload fields.").optional()
|
|
359
|
+
}).describe("A Confluence page.").optional()
|
|
360
|
+
}).describe("The normalized Confluence update page response.");
|
|
361
|
+
var confluenceActions = {
|
|
362
|
+
search_content: {
|
|
363
|
+
description: "Search Confluence content with CQL and return normalized result metadata plus pagination.",
|
|
364
|
+
effect: "read",
|
|
365
|
+
inputSchema: searchContentInput,
|
|
366
|
+
outputSchema: external_exports.toJSONSchema(searchContentOutput, { io: "output", unrepresentable: "any" })
|
|
367
|
+
},
|
|
368
|
+
list_spaces: {
|
|
369
|
+
description: "List Confluence spaces and return normalized space metadata plus pagination.",
|
|
370
|
+
effect: "read",
|
|
371
|
+
inputSchema: listSpacesInput,
|
|
372
|
+
outputSchema: external_exports.toJSONSchema(listSpacesOutput, { io: "output", unrepresentable: "any" })
|
|
373
|
+
},
|
|
374
|
+
get_page: {
|
|
375
|
+
description: "Get a Confluence page by ID and optionally include its body representation.",
|
|
376
|
+
effect: "read",
|
|
377
|
+
inputSchema: getPageInput,
|
|
378
|
+
outputSchema: external_exports.toJSONSchema(getPageOutput, { io: "output", unrepresentable: "any" })
|
|
379
|
+
},
|
|
380
|
+
create_page: {
|
|
381
|
+
description: "Create a Confluence page using a JSON-friendly body value and return the created page.",
|
|
382
|
+
effect: "write",
|
|
383
|
+
inputSchema: createPageInput,
|
|
384
|
+
outputSchema: external_exports.toJSONSchema(createPageOutput, { io: "output", unrepresentable: "any" })
|
|
385
|
+
},
|
|
386
|
+
update_page: {
|
|
387
|
+
description: "Update a Confluence page title, body, or status using an explicit next version number.",
|
|
388
|
+
effect: "write",
|
|
389
|
+
inputSchema: updatePageInput,
|
|
390
|
+
outputSchema: external_exports.toJSONSchema(updatePageOutput, { io: "output", unrepresentable: "any" })
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// ../plugins/src/confluence/index.ts
|
|
395
|
+
function createConfluencePlugin() {
|
|
396
|
+
return createProviderPlugin({
|
|
397
|
+
description: "Confluence",
|
|
398
|
+
credentialFields: [
|
|
399
|
+
{
|
|
400
|
+
key: "apiKey",
|
|
401
|
+
label: "API Token",
|
|
402
|
+
required: true,
|
|
403
|
+
secret: true,
|
|
404
|
+
description: "Atlassian API token,\u5F53 Basic \u8BA4\u8BC1\u7684\u5BC6\u7801;\u5728 https://id.atlassian.com/manage-profile/security/api-tokens \u521B\u5EFA"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
key: "email",
|
|
408
|
+
label: "Atlassian Email",
|
|
409
|
+
required: true,
|
|
410
|
+
secret: false,
|
|
411
|
+
description: "Atlassian \u8D26\u53F7\u90AE\u7BB1,\u5F53 Basic \u8BA4\u8BC1\u7684\u7528\u6237\u540D"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
key: "siteUrl",
|
|
415
|
+
label: "Confluence Site URL",
|
|
416
|
+
required: true,
|
|
417
|
+
secret: false,
|
|
418
|
+
description: "Confluence Cloud \u7AD9\u70B9\u5730\u5740(https://<site>.atlassian.net);\u53EA\u63A5\u53D7 https \u7684 atlassian.net \u7AD9\u70B9"
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
credentialProbe: "list_spaces",
|
|
422
|
+
actions: confluenceActions,
|
|
423
|
+
handlers: {
|
|
424
|
+
search_content: searchContent,
|
|
425
|
+
list_spaces: listSpaces,
|
|
426
|
+
get_page: getPage,
|
|
427
|
+
create_page: createPage,
|
|
428
|
+
update_page: updatePage
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
var confluence_default = createConfluencePlugin();
|
|
433
|
+
export {
|
|
434
|
+
createConfluencePlugin,
|
|
435
|
+
confluence_default as default
|
|
436
|
+
};
|