@yadsh/dsh-qa-integrations 0.5.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/LICENSE +21 -0
- package/README.md +617 -0
- package/compatibility.json +10 -0
- package/cordis.patch.yml +5 -0
- package/lib/broker.js +239 -0
- package/lib/broker.js.map +1 -0
- package/lib/client/bitrix24.js +33 -0
- package/lib/client/bitrix24.js.map +1 -0
- package/lib/client/card.js +33 -0
- package/lib/client/card.js.map +1 -0
- package/lib/client/confluence.js +148 -0
- package/lib/client/confluence.js.map +1 -0
- package/lib/client/copy.js +18 -0
- package/lib/client/copy.js.map +1 -0
- package/lib/client/gitlab.js +64 -0
- package/lib/client/gitlab.js.map +1 -0
- package/lib/client/index.js +71 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/integrations.js +34 -0
- package/lib/client/integrations.js.map +1 -0
- package/lib/client/jira.js +150 -0
- package/lib/client/jira.js.map +1 -0
- package/lib/client/provider-card.js +143 -0
- package/lib/client/provider-card.js.map +1 -0
- package/lib/client/styles.js +35 -0
- package/lib/client/styles.js.map +1 -0
- package/lib/client/teamcity.js +55 -0
- package/lib/client/teamcity.js.map +1 -0
- package/lib/client.js +8069 -0
- package/lib/client.js.map +1 -0
- package/lib/coerce.js +69 -0
- package/lib/coerce.js.map +1 -0
- package/lib/config.js +51 -0
- package/lib/config.js.map +1 -0
- package/lib/errors.js +14 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.js +510 -0
- package/lib/index.js.map +1 -0
- package/lib/providers/bitrix24/catalog.js +245 -0
- package/lib/providers/bitrix24/catalog.js.map +1 -0
- package/lib/providers/bitrix24/config.js +40 -0
- package/lib/providers/bitrix24/config.js.map +1 -0
- package/lib/providers/bitrix24/index.js +128 -0
- package/lib/providers/bitrix24/index.js.map +1 -0
- package/lib/providers/bitrix24/operations.js +491 -0
- package/lib/providers/bitrix24/operations.js.map +1 -0
- package/lib/providers/bitrix24/tools.js +1035 -0
- package/lib/providers/bitrix24/tools.js.map +1 -0
- package/lib/providers/bitrix24/transport.js +142 -0
- package/lib/providers/bitrix24/transport.js.map +1 -0
- package/lib/providers/confluence/adf.js +348 -0
- package/lib/providers/confluence/adf.js.map +1 -0
- package/lib/providers/confluence/catalog.js +135 -0
- package/lib/providers/confluence/catalog.js.map +1 -0
- package/lib/providers/confluence/config.js +196 -0
- package/lib/providers/confluence/config.js.map +1 -0
- package/lib/providers/confluence/cql.js +78 -0
- package/lib/providers/confluence/cql.js.map +1 -0
- package/lib/providers/confluence/index.js +319 -0
- package/lib/providers/confluence/index.js.map +1 -0
- package/lib/providers/confluence/operations.js +653 -0
- package/lib/providers/confluence/operations.js.map +1 -0
- package/lib/providers/confluence/tools.js +282 -0
- package/lib/providers/confluence/tools.js.map +1 -0
- package/lib/providers/confluence/transport.js +247 -0
- package/lib/providers/confluence/transport.js.map +1 -0
- package/lib/providers/contract.js +2 -0
- package/lib/providers/contract.js.map +1 -0
- package/lib/providers/gitlab/catalog.js +171 -0
- package/lib/providers/gitlab/catalog.js.map +1 -0
- package/lib/providers/gitlab/config.js +141 -0
- package/lib/providers/gitlab/config.js.map +1 -0
- package/lib/providers/gitlab/index.js +227 -0
- package/lib/providers/gitlab/index.js.map +1 -0
- package/lib/providers/gitlab/operations.js +794 -0
- package/lib/providers/gitlab/operations.js.map +1 -0
- package/lib/providers/gitlab/tools.js +859 -0
- package/lib/providers/gitlab/tools.js.map +1 -0
- package/lib/providers/gitlab/transport.js +140 -0
- package/lib/providers/gitlab/transport.js.map +1 -0
- package/lib/providers/jira/adf.js +235 -0
- package/lib/providers/jira/adf.js.map +1 -0
- package/lib/providers/jira/catalog.js +145 -0
- package/lib/providers/jira/catalog.js.map +1 -0
- package/lib/providers/jira/config.js +198 -0
- package/lib/providers/jira/config.js.map +1 -0
- package/lib/providers/jira/index.js +301 -0
- package/lib/providers/jira/index.js.map +1 -0
- package/lib/providers/jira/jql.js +299 -0
- package/lib/providers/jira/jql.js.map +1 -0
- package/lib/providers/jira/operations.js +617 -0
- package/lib/providers/jira/operations.js.map +1 -0
- package/lib/providers/jira/tools.js +341 -0
- package/lib/providers/jira/tools.js.map +1 -0
- package/lib/providers/jira/transport.js +227 -0
- package/lib/providers/jira/transport.js.map +1 -0
- package/lib/providers/registry.js +21 -0
- package/lib/providers/registry.js.map +1 -0
- package/lib/providers/shared/account.js +20 -0
- package/lib/providers/shared/account.js.map +1 -0
- package/lib/providers/shared/host.js +15 -0
- package/lib/providers/shared/host.js.map +1 -0
- package/lib/providers/shared/http.js +148 -0
- package/lib/providers/shared/http.js.map +1 -0
- package/lib/providers/teamcity/artifacts.js +155 -0
- package/lib/providers/teamcity/artifacts.js.map +1 -0
- package/lib/providers/teamcity/catalog.js +155 -0
- package/lib/providers/teamcity/catalog.js.map +1 -0
- package/lib/providers/teamcity/config.js +262 -0
- package/lib/providers/teamcity/config.js.map +1 -0
- package/lib/providers/teamcity/index.js +228 -0
- package/lib/providers/teamcity/index.js.map +1 -0
- package/lib/providers/teamcity/locators.js +95 -0
- package/lib/providers/teamcity/locators.js.map +1 -0
- package/lib/providers/teamcity/logs.js +113 -0
- package/lib/providers/teamcity/logs.js.map +1 -0
- package/lib/providers/teamcity/network.js +160 -0
- package/lib/providers/teamcity/network.js.map +1 -0
- package/lib/providers/teamcity/operations.js +625 -0
- package/lib/providers/teamcity/operations.js.map +1 -0
- package/lib/providers/teamcity/tools.js +480 -0
- package/lib/providers/teamcity/tools.js.map +1 -0
- package/lib/providers/teamcity/transport.js +126 -0
- package/lib/providers/teamcity/transport.js.map +1 -0
- package/lib/redaction.js +38 -0
- package/lib/redaction.js.map +1 -0
- package/lib/repository.js +414 -0
- package/lib/repository.js.map +1 -0
- package/lib/secrets/key-provider.js +76 -0
- package/lib/secrets/key-provider.js.map +1 -0
- package/lib/secrets/secret-store.js +93 -0
- package/lib/secrets/secret-store.js.map +1 -0
- package/lib/shared/settings.js +19 -0
- package/lib/shared/settings.js.map +1 -0
- package/lib/tool-kit.js +55 -0
- package/lib/tool-kit.js.map +1 -0
- package/lib/tools.js +28 -0
- package/lib/tools.js.map +1 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +1689 -0
- package/lib/typert.remote-client.d.ts +84 -0
- package/lib/typert.remote-client.js +1429 -0
- package/lib/types/broker.d.ts +30 -0
- package/lib/types/client/bitrix24.d.ts +18 -0
- package/lib/types/client/card.d.ts +13 -0
- package/lib/types/client/confluence.d.ts +17 -0
- package/lib/types/client/copy.d.ts +7 -0
- package/lib/types/client/gitlab.d.ts +15 -0
- package/lib/types/client/index.d.ts +13 -0
- package/lib/types/client/integrations.d.ts +28 -0
- package/lib/types/client/jira.d.ts +17 -0
- package/lib/types/client/provider-card.d.ts +63 -0
- package/lib/types/client/styles.d.ts +7 -0
- package/lib/types/client/teamcity.d.ts +19 -0
- package/lib/types/coerce.d.ts +18 -0
- package/lib/types/config.d.ts +48 -0
- package/lib/types/errors.d.ts +26 -0
- package/lib/types/index.d.ts +170 -0
- package/lib/types/providers/bitrix24/catalog.d.ts +48 -0
- package/lib/types/providers/bitrix24/config.d.ts +43 -0
- package/lib/types/providers/bitrix24/index.d.ts +31 -0
- package/lib/types/providers/bitrix24/operations.d.ts +13 -0
- package/lib/types/providers/bitrix24/tools.d.ts +9 -0
- package/lib/types/providers/bitrix24/transport.d.ts +26 -0
- package/lib/types/providers/confluence/adf.d.ts +22 -0
- package/lib/types/providers/confluence/catalog.d.ts +59 -0
- package/lib/types/providers/confluence/config.d.ts +68 -0
- package/lib/types/providers/confluence/cql.d.ts +43 -0
- package/lib/types/providers/confluence/index.d.ts +73 -0
- package/lib/types/providers/confluence/operations.d.ts +92 -0
- package/lib/types/providers/confluence/tools.d.ts +15 -0
- package/lib/types/providers/confluence/transport.d.ts +77 -0
- package/lib/types/providers/contract.d.ts +33 -0
- package/lib/types/providers/gitlab/catalog.d.ts +49 -0
- package/lib/types/providers/gitlab/config.d.ts +50 -0
- package/lib/types/providers/gitlab/index.d.ts +49 -0
- package/lib/types/providers/gitlab/operations.d.ts +40 -0
- package/lib/types/providers/gitlab/tools.d.ts +15 -0
- package/lib/types/providers/gitlab/transport.d.ts +52 -0
- package/lib/types/providers/jira/adf.d.ts +27 -0
- package/lib/types/providers/jira/catalog.d.ts +74 -0
- package/lib/types/providers/jira/config.d.ts +73 -0
- package/lib/types/providers/jira/index.d.ts +79 -0
- package/lib/types/providers/jira/jql.d.ts +51 -0
- package/lib/types/providers/jira/operations.d.ts +58 -0
- package/lib/types/providers/jira/tools.d.ts +17 -0
- package/lib/types/providers/jira/transport.d.ts +65 -0
- package/lib/types/providers/registry.d.ts +9 -0
- package/lib/types/providers/shared/account.d.ts +10 -0
- package/lib/types/providers/shared/host.d.ts +9 -0
- package/lib/types/providers/shared/http.d.ts +51 -0
- package/lib/types/providers/teamcity/artifacts.d.ts +45 -0
- package/lib/types/providers/teamcity/catalog.d.ts +55 -0
- package/lib/types/providers/teamcity/config.d.ts +66 -0
- package/lib/types/providers/teamcity/index.d.ts +62 -0
- package/lib/types/providers/teamcity/locators.d.ts +47 -0
- package/lib/types/providers/teamcity/logs.d.ts +31 -0
- package/lib/types/providers/teamcity/network.d.ts +32 -0
- package/lib/types/providers/teamcity/operations.d.ts +84 -0
- package/lib/types/providers/teamcity/tools.d.ts +15 -0
- package/lib/types/providers/teamcity/transport.d.ts +53 -0
- package/lib/types/redaction.d.ts +3 -0
- package/lib/types/repository.d.ts +48 -0
- package/lib/types/secrets/key-provider.d.ts +30 -0
- package/lib/types/secrets/secret-store.d.ts +12 -0
- package/lib/types/shared/settings.d.ts +19 -0
- package/lib/types/tool-kit.d.ts +26 -0
- package/lib/types/tools.d.ts +16 -0
- package/lib/types/types.d.ts +138 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +143 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
2
|
+
import type { IntegrationCapability, IntegrationCapabilityInfo, ProviderValidation } from "../../types.js";
|
|
3
|
+
import type { IntegrationProvider, ProviderContext } from "../contract.js";
|
|
4
|
+
export { credentialFromPlaintext, parseBitrixWebhook, type BitrixCredential, } from "./transport.js";
|
|
5
|
+
/** Bitrix24 provider: incoming-webhook credentials over the Bitrix24 REST API. */
|
|
6
|
+
export declare class Bitrix24Provider implements IntegrationProvider {
|
|
7
|
+
private readonly config;
|
|
8
|
+
readonly id = "bitrix24";
|
|
9
|
+
readonly displayName = "Bitrix24";
|
|
10
|
+
/** What this deployment allows; the webhook scope probe narrows it per user. */
|
|
11
|
+
readonly capabilities: readonly IntegrationCapability[];
|
|
12
|
+
readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
|
|
13
|
+
private readonly transport;
|
|
14
|
+
constructor(config: ResolvedQaIntegrationsConfig, fetcher?: typeof fetch);
|
|
15
|
+
/** Keep only the secret part of an operator-supplied webhook URL. */
|
|
16
|
+
parseCredential(raw: string): {
|
|
17
|
+
readonly credential: string;
|
|
18
|
+
readonly portal: string;
|
|
19
|
+
};
|
|
20
|
+
operationCapability(operation: string): IntegrationCapability | undefined;
|
|
21
|
+
validate(context: ProviderContext): Promise<ProviderValidation>;
|
|
22
|
+
execute(context: ProviderContext, operation: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* The scopes the connected webhook was actually granted. A portal that
|
|
25
|
+
* refuses `scope` only costs precision: the deployment switches still bound
|
|
26
|
+
* what the agent may try.
|
|
27
|
+
*/
|
|
28
|
+
private grantedScopes;
|
|
29
|
+
}
|
|
30
|
+
export default Bitrix24Provider;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface OperationContext {
|
|
2
|
+
/** Bitrix user id of the webhook owner, resolved from the stored integration. */
|
|
3
|
+
readonly externalUserId?: string | undefined;
|
|
4
|
+
}
|
|
5
|
+
export type BitrixOperationHandler = (input: Readonly<Record<string, unknown>>, context: OperationContext) => Record<string, unknown> | readonly unknown[];
|
|
6
|
+
export declare const BITRIX_HANDLERS: Readonly<Record<string, BitrixOperationHandler>>;
|
|
7
|
+
export type BitrixProjection = (result: unknown) => unknown;
|
|
8
|
+
/**
|
|
9
|
+
* Methods whose response is not a list of items but a bundle of id-keyed maps.
|
|
10
|
+
* Left raw they cost the model most of its context for very little signal.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BITRIX_PROJECTIONS: Readonly<Record<string, BitrixProjection>>;
|
|
13
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
|
|
2
|
+
import type { IntegrationBroker } from "../../broker.js";
|
|
3
|
+
import type { IntegrationPrincipal } from "../../types.js";
|
|
4
|
+
export declare const BITRIX24_TOOL_NAMES: readonly ["bitrix_search_crm", "bitrix_get_crm_item", "bitrix_get_crm_fields", "bitrix_get_crm_funnels", "bitrix_get_crm_statuses", "bitrix_get_crm_activities", "bitrix_get_crm_activity", "bitrix_get_crm_timeline", "bitrix_get_crm_stage_history", "bitrix_get_crm_product_rows", "bitrix_find_crm_duplicates", "bitrix_get_crm_requisites", "bitrix_get_call_transcript", "bitrix_get_current_user", "bitrix_search_users", "bitrix_get_departments", "bitrix_get_user_fields", "bitrix_search_chats", "bitrix_get_chat_messages", "bitrix_search_chat_messages", "bitrix_get_recent_chats", "bitrix_search_chat_users", "bitrix_find_chat", "bitrix_get_chat_participants", "bitrix_get_chat_user_data", "bitrix_get_openline_dialog", "bitrix_get_openline_history", "bitrix_search_tasks", "bitrix_get_task", "bitrix_get_task_history", "bitrix_get_task_results", "bitrix_get_task_elapsed_time", "bitrix_get_calendar_events", "bitrix_get_calendar_accessibility", "bitrix_search_files", "bitrix_get_file", "bitrix_get_drives", "bitrix_get_storage_items", "bitrix_get_folder_items"];
|
|
5
|
+
export declare function createBitrix24Tools(options: {
|
|
6
|
+
readonly broker: IntegrationBroker;
|
|
7
|
+
readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
|
|
8
|
+
}): readonly ToolDefinition[];
|
|
9
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
2
|
+
export interface BitrixCredential {
|
|
3
|
+
readonly webhookBaseUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BitrixResponse {
|
|
6
|
+
readonly result: unknown;
|
|
7
|
+
readonly total?: number | undefined;
|
|
8
|
+
readonly next?: number | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function credentialFromPlaintext(plaintext: string): BitrixCredential;
|
|
11
|
+
/** Parse a complete incoming-webhook URL without ever returning its secret part. */
|
|
12
|
+
export declare function parseBitrixWebhook(raw: string, allowedSuffixes: readonly string[]): {
|
|
13
|
+
readonly credential: string;
|
|
14
|
+
readonly portal: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* HTTP boundary of the provider: one webhook call, bounded in time and size,
|
|
18
|
+
* with upstream failures folded into safe domain errors.
|
|
19
|
+
*/
|
|
20
|
+
export declare class BitrixTransport {
|
|
21
|
+
private readonly config;
|
|
22
|
+
private readonly fetcher;
|
|
23
|
+
constructor(config: ResolvedQaIntegrationsConfig, fetcher?: typeof fetch);
|
|
24
|
+
call(credential: BitrixCredential, method: string, params: Readonly<Record<string, unknown>> | readonly unknown[]): Promise<BitrixResponse>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Confluence answers page bodies as Atlassian Document Format: a JSON tree of
|
|
3
|
+
* typed nodes. Handing that tree to the model would spend the whole answer
|
|
4
|
+
* budget on wrappers, so it is flattened into markdown-like text here.
|
|
5
|
+
*
|
|
6
|
+
* The flattening is deliberately defensive. Anything the provider cannot render
|
|
7
|
+
* — a macro, an embedded view, a media reference — becomes a placeholder: the
|
|
8
|
+
* provider never fetches what a page points at, never renders it, and never
|
|
9
|
+
* lets page content choose what happens next.
|
|
10
|
+
*/
|
|
11
|
+
/** The document body as markdown-like text, or an empty string when unknown. */
|
|
12
|
+
export declare function adfToText(value: unknown): string;
|
|
13
|
+
/**
|
|
14
|
+
* Character budget for one body. What does not fit is cut and said to be cut;
|
|
15
|
+
* the model can ask for a wider budget, up to the deployment ceiling.
|
|
16
|
+
*/
|
|
17
|
+
export declare function textBudget(text: string, limit: number): {
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly totalChars: number;
|
|
20
|
+
readonly truncated: boolean;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=adf.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { IntegrationCapability, IntegrationCapabilityInfo } from "../../types.js";
|
|
2
|
+
import type { ConfluenceFlags } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Capabilities this provider offers. They are narrower than Confluence's own
|
|
5
|
+
* scopes on purpose: one switch per kind of data, so the operator decides what
|
|
6
|
+
* a deployment is willing to expose at all.
|
|
7
|
+
*
|
|
8
|
+
* Unlike GitLab there is no second, per-credential narrowing: an Atlassian API
|
|
9
|
+
* token cannot be asked which scopes it carries, so these switches are the
|
|
10
|
+
* whole of what the agent is offered, and Confluence's own permissions answer
|
|
11
|
+
* on every call. Access a granted capability still needs is refused upstream
|
|
12
|
+
* and surfaces as a permission deny.
|
|
13
|
+
*/
|
|
14
|
+
export type ConfluenceCapability = "identity.read" | "spaces.read" | "search.read" | "content.read" | "comments.read" | "attachments.read" | "versions.read";
|
|
15
|
+
export interface ConfluenceCapabilityDefinition {
|
|
16
|
+
readonly capability: ConfluenceCapability;
|
|
17
|
+
readonly flag: Exclude<keyof ConfluenceFlags, "instances" | "retries" | "enabled" | "allowInsecureHttp" | "allowedSpaces" | "defaultBodyChars" | "maxBodyChars" | "maxResults" | "maxReplyParents">;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly hint: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const CONFLUENCE_CAPABILITIES: readonly ConfluenceCapabilityDefinition[];
|
|
22
|
+
export interface ConfluenceOperationDefinition {
|
|
23
|
+
readonly capability: ConfluenceCapability;
|
|
24
|
+
/** Every Confluence read is a GET; the catalog declares it, the gate checks it. */
|
|
25
|
+
readonly method: "GET";
|
|
26
|
+
/**
|
|
27
|
+
* REST path under the instance's base. `:placeholders` are filled by the
|
|
28
|
+
* handler; the value is a fixed string, so the model can never pick an
|
|
29
|
+
* endpoint of its own.
|
|
30
|
+
*/
|
|
31
|
+
readonly path: string;
|
|
32
|
+
/** Set when the operation answers with one page of a collection. */
|
|
33
|
+
readonly list?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* How the operation pages. Confluence v2 hands out an opaque cursor, while
|
|
36
|
+
* the v1 search endpoint counts rows, so the provider has to know which of
|
|
37
|
+
* the two a `nextCursor` belongs to.
|
|
38
|
+
*/
|
|
39
|
+
readonly cursor?: "offset" | "upstream";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Every model-reachable operation. The provider refuses any operation that is
|
|
43
|
+
* not listed here, so this table — together with `capability` — is the
|
|
44
|
+
* permission surface. Only GET: the catalog carries no operation that could
|
|
45
|
+
* change Confluence state, and the confirmation framework does not exist yet.
|
|
46
|
+
*
|
|
47
|
+
* The mix of REST versions is deliberate. Confluence Cloud v2 covers pages,
|
|
48
|
+
* comments, attachments, versions and spaces, and that is where the reads go;
|
|
49
|
+
* the CQL search and the "who am I" call exist only in v1. Tools never see the
|
|
50
|
+
* difference — an operation answers a normalized object either way.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CONFLUENCE_OPERATIONS: Readonly<Record<string, ConfluenceOperationDefinition>>;
|
|
53
|
+
/** Capabilities this deployment allows, in catalog order. */
|
|
54
|
+
export declare function enabledCapabilities(flags: ConfluenceFlags): readonly ConfluenceCapability[];
|
|
55
|
+
/** Label and hint per capability, for clients that render what we declare. */
|
|
56
|
+
export declare const CONFLUENCE_CAPABILITY_INFO: Readonly<Record<ConfluenceCapability, IntegrationCapabilityInfo>>;
|
|
57
|
+
/** Capability an operation needs, or undefined when the catalog has none. */
|
|
58
|
+
export declare function confluenceOperationCapability(operation: string): IntegrationCapability | undefined;
|
|
59
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
/**
|
|
3
|
+
* One Confluence site the operator allows. A user never types a host: the
|
|
4
|
+
* connect form only picks from this list, so the broker cannot be pointed at an
|
|
5
|
+
* arbitrary origin.
|
|
6
|
+
*
|
|
7
|
+
* The address is the site origin a Confluence Cloud deployment answers on
|
|
8
|
+
* (`https://company.atlassian.net`). Deployments that reach Confluence through
|
|
9
|
+
* the Atlassian gateway for scoped API tokens configure that base instead
|
|
10
|
+
* (`https://api.atlassian.com/ex/confluence/<cloudId>`); both spell the same
|
|
11
|
+
* relative `/wiki/...` paths, so the provider needs no mode switch.
|
|
12
|
+
*/
|
|
13
|
+
export interface ConfluenceInstance {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly label: string;
|
|
16
|
+
/** Canonical `<origin><path>`, without a trailing slash. */
|
|
17
|
+
readonly baseUrl: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Deployment switches for the Confluence provider. Read capabilities are on by
|
|
21
|
+
* default; unlike GitLab there is nothing to narrow them per user, because an
|
|
22
|
+
* Atlassian API token cannot report the scopes it was granted — the connected
|
|
23
|
+
* account's own Confluence permissions decide on every call, and a permission
|
|
24
|
+
* the account lacks answers as a deny.
|
|
25
|
+
*/
|
|
26
|
+
export interface ConfluenceFlags {
|
|
27
|
+
readonly enabled: boolean;
|
|
28
|
+
/** Development escape hatch; production instances must answer over HTTPS. */
|
|
29
|
+
readonly allowInsecureHttp: boolean;
|
|
30
|
+
readonly instances: readonly ConfluenceInstance[];
|
|
31
|
+
readonly identityRead: boolean;
|
|
32
|
+
readonly spacesRead: boolean;
|
|
33
|
+
readonly searchRead: boolean;
|
|
34
|
+
readonly contentRead: boolean;
|
|
35
|
+
readonly commentsRead: boolean;
|
|
36
|
+
readonly attachmentsRead: boolean;
|
|
37
|
+
readonly versionsRead: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Space keys the agent may see, upper-cased. An empty list means every space
|
|
40
|
+
* the connected account can read. A non-empty list narrows search, space
|
|
41
|
+
* listings and every direct page read alike, so a page in a space outside it
|
|
42
|
+
* is refused even when the account may open it.
|
|
43
|
+
*/
|
|
44
|
+
readonly allowedSpaces: readonly string[];
|
|
45
|
+
/** Page body handed to the model when the tool asks for no budget. */
|
|
46
|
+
readonly defaultBodyChars: number;
|
|
47
|
+
/** Ceiling for the body budget a tool argument may ask for. */
|
|
48
|
+
readonly maxBodyChars: number;
|
|
49
|
+
/** Rows per answer for every listing, and the cap on a requested `limit`. */
|
|
50
|
+
readonly maxResults: number;
|
|
51
|
+
/** Parent comments whose replies one call may fetch. */
|
|
52
|
+
readonly maxReplyParents: number;
|
|
53
|
+
/** Extra attempts for a rate-limited or transient read; writes never retry. */
|
|
54
|
+
readonly retries: number;
|
|
55
|
+
}
|
|
56
|
+
export declare const CONFLUENCE_DEFAULTS: ConfluenceFlags;
|
|
57
|
+
/**
|
|
58
|
+
* Config slice of this provider, as it appears under `confluence:` in YAML. The
|
|
59
|
+
* instance list is validated and canonicalized by `resolveConfluenceConfig`,
|
|
60
|
+
* which is where a deployment typo fails loudly.
|
|
61
|
+
*/
|
|
62
|
+
export declare const confluenceConfigSchema: z<Partial<ConfluenceFlags>>;
|
|
63
|
+
export declare function resolveConfluenceConfig(input?: Partial<ConfluenceFlags>): ConfluenceFlags;
|
|
64
|
+
/** The configured site a stored credential names, or a fail-closed error. */
|
|
65
|
+
export declare function confluenceInstance(flags: ConfluenceFlags, instanceId: string): ConfluenceInstance | undefined;
|
|
66
|
+
/** Whether a space key passes the operator allowlist; an empty list allows all. */
|
|
67
|
+
export declare function spaceAllowed(flags: ConfluenceFlags, key: string | undefined): boolean;
|
|
68
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CQL builder. The model never sends CQL: it sends fields, and this
|
|
3
|
+
* module turns them into one query, quoting every literal itself. That is the
|
|
4
|
+
* whole reason the provider can keep searching without shipping a
|
|
5
|
+
* `confluence_search_cql` tool.
|
|
6
|
+
*/
|
|
7
|
+
/** Content types the model may ask for; CQL spells the blog post `blogpost`. */
|
|
8
|
+
export declare const CONTENT_TYPES: readonly ["page", "blogpost"];
|
|
9
|
+
/** Orderings the builder knows. `relevance` leaves ordering to Confluence. */
|
|
10
|
+
export declare const ORDER_BY: Readonly<{
|
|
11
|
+
readonly lastmodified: "lastmodified";
|
|
12
|
+
readonly created: "created";
|
|
13
|
+
}>;
|
|
14
|
+
export type ConfluenceOrder = keyof typeof ORDER_BY;
|
|
15
|
+
export interface ConfluenceSearchFilter {
|
|
16
|
+
/** Free text; a quoted phrase stays a phrase after escaping. */
|
|
17
|
+
readonly query?: string | undefined;
|
|
18
|
+
/** Space keys, already narrowed by the operator allowlist. */
|
|
19
|
+
readonly spaces?: readonly string[] | undefined;
|
|
20
|
+
/** Content types; defaults to `page` when absent or empty. */
|
|
21
|
+
readonly contentTypes?: readonly string[] | undefined;
|
|
22
|
+
readonly labels?: readonly string[] | undefined;
|
|
23
|
+
/** `me` becomes `currentUser()`; anything else is a quoted account literal. */
|
|
24
|
+
readonly creator?: string | undefined;
|
|
25
|
+
readonly contributor?: string | undefined;
|
|
26
|
+
/** Inclusive lower bound on `lastmodified`, as `YYYY-MM-DD`. */
|
|
27
|
+
readonly modifiedAfter?: string | undefined;
|
|
28
|
+
readonly orderBy?: ConfluenceOrder | undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One quoted CQL literal. Confluence escapes an embedded quote with a
|
|
32
|
+
* backslash, which is also the only escape its parser understands, so a
|
|
33
|
+
* backslash of our own is escaped first — otherwise a value ending in `\`
|
|
34
|
+
* would escape the closing quote and let the rest of the line be read as CQL.
|
|
35
|
+
*/
|
|
36
|
+
export declare function cqlLiteral(value: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Build one CQL query out of typed fields. Clauses are ANDed in a fixed order,
|
|
39
|
+
* so the same filter always produces the same query — which is what the tests
|
|
40
|
+
* pin and what keeps a cached upstream response honest.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildCql(filter: ConfluenceSearchFilter): string;
|
|
43
|
+
//# sourceMappingURL=cql.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
2
|
+
import type { IntegrationCapability, IntegrationCapabilityInfo, ProviderValidation } from "../../types.js";
|
|
3
|
+
import type { IntegrationProvider, ProviderContext } from "../contract.js";
|
|
4
|
+
export { credentialFromPlaintext, credentialInstance, type ConfluenceCredential, } from "./transport.js";
|
|
5
|
+
/** Confluence provider: operator-configured sites over an Atlassian API token. */
|
|
6
|
+
export declare class ConfluenceProvider implements IntegrationProvider {
|
|
7
|
+
private readonly config;
|
|
8
|
+
readonly id = "confluence";
|
|
9
|
+
readonly displayName = "Confluence";
|
|
10
|
+
/**
|
|
11
|
+
* What this deployment allows. There is no second, per-credential narrowing:
|
|
12
|
+
* an Atlassian API token cannot be asked which scopes it was granted, so
|
|
13
|
+
* these switches are the whole offer, and Confluence's own permissions answer
|
|
14
|
+
* on every call.
|
|
15
|
+
*/
|
|
16
|
+
readonly capabilities: readonly IntegrationCapability[];
|
|
17
|
+
readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
|
|
18
|
+
private readonly transport;
|
|
19
|
+
constructor(config: ResolvedQaIntegrationsConfig, fetcher?: typeof fetch);
|
|
20
|
+
/**
|
|
21
|
+
* Keep the token together with the account it was minted for and the site it
|
|
22
|
+
* belongs to. Both the site and the e-mail come from the connect form and
|
|
23
|
+
* from operator config, never from a tool argument, which is what keeps the
|
|
24
|
+
* broker from dialling any host the caller names or authenticating as any
|
|
25
|
+
* account the caller names.
|
|
26
|
+
*/
|
|
27
|
+
parseCredential(raw: string, options?: Readonly<Record<string, string>>): {
|
|
28
|
+
readonly credential: string;
|
|
29
|
+
readonly portal: string;
|
|
30
|
+
};
|
|
31
|
+
operationCapability(operation: string): IntegrationCapability | undefined;
|
|
32
|
+
validate(context: ProviderContext): Promise<ProviderValidation>;
|
|
33
|
+
execute(context: ProviderContext, operation: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
34
|
+
/** One list read, with its cursor and with the space policy re-applied. */
|
|
35
|
+
private readList;
|
|
36
|
+
/**
|
|
37
|
+
* A page read is answered with the page's space, because that is what the
|
|
38
|
+
* operator allowlist is written in — and a page whose space the policy does
|
|
39
|
+
* not allow is refused here, after the read and before the model sees it.
|
|
40
|
+
*/
|
|
41
|
+
private readPage;
|
|
42
|
+
/**
|
|
43
|
+
* Comments are read per collection: the catalog names the footer one, the
|
|
44
|
+
* validated `kind` picks between footer-only, inline-only and both. Replies
|
|
45
|
+
* cost one request per parent comment, so a discussion wider than the
|
|
46
|
+
* deployment cap is answered with the parents it did load and says so.
|
|
47
|
+
*/
|
|
48
|
+
private readComments;
|
|
49
|
+
/** One children read per parent comment, capped by the deployment. */
|
|
50
|
+
private withReplies;
|
|
51
|
+
/** One space, by id or by the key the listing endpoint resolves. */
|
|
52
|
+
private readSpace;
|
|
53
|
+
/** The fields a space contributes to a page answer, plus its policy key. */
|
|
54
|
+
private readSpaceFields;
|
|
55
|
+
/**
|
|
56
|
+
* The space of a page the call is about. Only asked for when the deployment
|
|
57
|
+
* narrowed spaces: without an allowlist there is no policy to enforce, and
|
|
58
|
+
* the extra read would be spent for nothing.
|
|
59
|
+
*/
|
|
60
|
+
private assertPageAllowedBySpace;
|
|
61
|
+
/**
|
|
62
|
+
* A space outside the operator allowlist is refused as a policy decision, not
|
|
63
|
+
* as a Confluence permission: the account may well be allowed to read it, and
|
|
64
|
+
* the model should be told which bound it hit.
|
|
65
|
+
*/
|
|
66
|
+
private assertSpaceAllowed;
|
|
67
|
+
/** The space of one search row, as the projection resolved it. */
|
|
68
|
+
private itemSpaceAllowed;
|
|
69
|
+
private projectionContext;
|
|
70
|
+
private resolveInstance;
|
|
71
|
+
}
|
|
72
|
+
export default ConfluenceProvider;
|
|
73
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ConfluenceInstance, ConfluenceFlags } from "./config.js";
|
|
2
|
+
import type { ConfluenceQuery } from "./transport.js";
|
|
3
|
+
/** Rows one answer asks for when the model names no `limit`. */
|
|
4
|
+
export declare const DEFAULT_LIMIT = 20;
|
|
5
|
+
/** A page or comment id, accepted as a number or as its decimal digits. */
|
|
6
|
+
export declare function numericId(value: unknown, field: string): string;
|
|
7
|
+
/** A space key or numeric id, as `confluence_get_space` accepts either. */
|
|
8
|
+
export declare function spaceRef(value: unknown, field?: string): string;
|
|
9
|
+
/** Whether a space reference is the numeric id v2 wants in a path. */
|
|
10
|
+
export declare function isNumericSpace(value: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Rows per answer. A `limit` above the deployment cap is clamped rather than
|
|
13
|
+
* refused: the answer says how many rows it carries, so the model can page on
|
|
14
|
+
* without having to guess what this stand allows.
|
|
15
|
+
*/
|
|
16
|
+
export declare function pageLimit(value: unknown, flags: ConfluenceFlags): number;
|
|
17
|
+
/** Character budget of one body, bounded by the deployment ceiling. */
|
|
18
|
+
export declare function bodyLimit(value: unknown, flags: ConfluenceFlags): number;
|
|
19
|
+
/**
|
|
20
|
+
* Search pagination is offset-based, so its cursor is the row offset the
|
|
21
|
+
* previous answer ended at. It carries no identity: every call re-resolves the
|
|
22
|
+
* account and the space policy from the session, so an offset cannot reach
|
|
23
|
+
* another user's data.
|
|
24
|
+
*/
|
|
25
|
+
export declare function offsetCursor(value: unknown): number;
|
|
26
|
+
/** v2 pagination is cursor-based; the token is shape-checked before it is spent. */
|
|
27
|
+
export declare function upstreamCursor(value: unknown): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The inclusive lower bound on `lastmodified`, either as an absolute date or as
|
|
30
|
+
* a window counted back from today. Resolution happens here, once, so the CQL
|
|
31
|
+
* the provider builds is always an absolute date.
|
|
32
|
+
*/
|
|
33
|
+
export declare function modifiedAfterDate(value: unknown, today?: Date): string | undefined;
|
|
34
|
+
export declare const COMMENT_KINDS: readonly ["footer", "inline", "all"];
|
|
35
|
+
export type ConfluenceCommentKind = (typeof COMMENT_KINDS)[number];
|
|
36
|
+
/** Comment kind, defaulting to the page's footer discussion. */
|
|
37
|
+
export declare function commentKind(value: unknown): ConfluenceCommentKind;
|
|
38
|
+
/** Collections a kind reads; `all` is the two of them, in this order. */
|
|
39
|
+
export declare function commentCollections(kind: ConfluenceCommentKind): readonly ("footer" | "inline")[];
|
|
40
|
+
/** The page-relative collection path of one comment kind. */
|
|
41
|
+
export declare function commentPath(pageId: string, kind: "footer" | "inline"): string;
|
|
42
|
+
/** The replies of one comment; the collection decides which endpoint owns them. */
|
|
43
|
+
export declare function commentChildrenPath(kind: "footer" | "inline", commentId: string): string;
|
|
44
|
+
export declare const SPACE_TYPES: readonly string[];
|
|
45
|
+
export interface OperationContext {
|
|
46
|
+
/**
|
|
47
|
+
* External user id of the credential owner, read from the stored integration.
|
|
48
|
+
* Confluence cannot express "mine" through CQL for every account shape, so no
|
|
49
|
+
* operation substitutes it for a model argument; it is part of the contract
|
|
50
|
+
* for providers that need it.
|
|
51
|
+
*/
|
|
52
|
+
readonly externalUserId?: string | undefined;
|
|
53
|
+
readonly flags: ConfluenceFlags;
|
|
54
|
+
}
|
|
55
|
+
export interface ConfluenceRequest {
|
|
56
|
+
readonly path: string;
|
|
57
|
+
readonly query: ConfluenceQuery;
|
|
58
|
+
}
|
|
59
|
+
export type ConfluenceOperationHandler = (input: Readonly<Record<string, unknown>>, context: OperationContext) => ConfluenceRequest;
|
|
60
|
+
/**
|
|
61
|
+
* Every handler builds a request out of validated arguments: the path is a
|
|
62
|
+
* fixed string with our own placeholders filled, and every query value is
|
|
63
|
+
* either a constant, a number, or a value this module checked first.
|
|
64
|
+
*/
|
|
65
|
+
export declare const CONFLUENCE_HANDLERS: Readonly<Record<string, ConfluenceOperationHandler>>;
|
|
66
|
+
/**
|
|
67
|
+
* Search excerpts arrive highlighted: the default representation wraps the
|
|
68
|
+
* matched terms in `<span>`. The provider hands the words over, never the
|
|
69
|
+
* markup, and undoes only the five entities a highlight can produce.
|
|
70
|
+
*/
|
|
71
|
+
export declare function plainExcerpt(value: string): string;
|
|
72
|
+
/** The replies of one comment, from a children read of its own. */
|
|
73
|
+
export declare function commentReplies(data: unknown, kind: "footer" | "inline", context: ConfluenceProjectionContext): Record<string, unknown>[];
|
|
74
|
+
export interface ConfluenceProjectionContext {
|
|
75
|
+
readonly flags: ConfluenceFlags;
|
|
76
|
+
readonly instance: ConfluenceInstance;
|
|
77
|
+
/** Character budget for a body, resolved from the tool argument. */
|
|
78
|
+
readonly bodyLimit?: number | undefined;
|
|
79
|
+
/** Row offset a search answer started at, needed for its own cursor. */
|
|
80
|
+
readonly start?: number | undefined;
|
|
81
|
+
/** Page the answer is about, as the validated tool argument named it. */
|
|
82
|
+
readonly pageId?: string | undefined;
|
|
83
|
+
/** Space resolved for a page, so its key and name travel with the answer. */
|
|
84
|
+
readonly space?: Record<string, unknown> | undefined;
|
|
85
|
+
/** Which collection a comment answer came from. */
|
|
86
|
+
readonly kind?: "footer" | "inline" | undefined;
|
|
87
|
+
}
|
|
88
|
+
export type ConfluenceProjection = (data: unknown, context: ConfluenceProjectionContext) => Record<string, unknown>;
|
|
89
|
+
/** One source block for every answer: identity of the read, never its content. */
|
|
90
|
+
export declare function confluenceSource(instance: ConfluenceInstance, extra?: Record<string, unknown>): Record<string, unknown>;
|
|
91
|
+
export declare const CONFLUENCE_PROJECTIONS: Readonly<Record<string, ConfluenceProjection>>;
|
|
92
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
|
|
2
|
+
import type { IntegrationBroker } from "../../broker.js";
|
|
3
|
+
import type { IntegrationPrincipal } from "../../types.js";
|
|
4
|
+
export declare const CONFLUENCE_TOOL_NAMES: readonly ["confluence_connection_get", "confluence_search", "confluence_get_page", "confluence_get_page_comments", "confluence_get_page_attachments", "confluence_get_page_versions", "confluence_get_space", "confluence_list_spaces"];
|
|
5
|
+
/**
|
|
6
|
+
* Every tool reports what the *connected* Confluence account may read, never a
|
|
7
|
+
* caller-supplied identity: the account comes from the stored integration of the
|
|
8
|
+
* QA user who owns the DSH session, and the tool schemas carry no user,
|
|
9
|
+
* credential, e-mail or site selector.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createConfluenceTools(options: {
|
|
12
|
+
readonly broker: IntegrationBroker;
|
|
13
|
+
readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
|
|
14
|
+
}): readonly ToolDefinition[];
|
|
15
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
2
|
+
import { type ConfluenceFlags, type ConfluenceInstance } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Encrypted credential payload of one Confluence connection: which configured
|
|
5
|
+
* site it belongs to, the Atlassian account e-mail and the API token. The base
|
|
6
|
+
* URL is not stored — it is re-resolved from operator config on every call, so
|
|
7
|
+
* removing or repointing a site takes effect at once instead of at the next
|
|
8
|
+
* connect.
|
|
9
|
+
*
|
|
10
|
+
* The e-mail is not a secret, but it is part of the authentication pair, and it
|
|
11
|
+
* comes from the connect form through the operator-facing RPC. Keeping both
|
|
12
|
+
* halves in one encrypted record means a token can never be paired with another
|
|
13
|
+
* account's address, not even by a bug in the broker.
|
|
14
|
+
*/
|
|
15
|
+
export interface ConfluenceCredential {
|
|
16
|
+
readonly instanceId: string;
|
|
17
|
+
readonly email: string;
|
|
18
|
+
readonly token: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function credentialFromPlaintext(plaintext: string): ConfluenceCredential;
|
|
21
|
+
/**
|
|
22
|
+
* The configured site a credential belongs to. A credential minted for a site
|
|
23
|
+
* the operator has since removed fails closed: it never falls back to another
|
|
24
|
+
* site, however permissive that one is.
|
|
25
|
+
*/
|
|
26
|
+
export declare function credentialInstance(flags: ConfluenceFlags, credential: ConfluenceCredential): ConfluenceInstance;
|
|
27
|
+
export interface ConfluenceQuery {
|
|
28
|
+
readonly [key: string]: string | number | boolean | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** What a listing answers about its own pagination, in provider terms. */
|
|
31
|
+
export interface ConfluencePage {
|
|
32
|
+
/**
|
|
33
|
+
* Opaque token from the upstream `_links.next`, when the API is cursor-based.
|
|
34
|
+
* It is never a URL: the whole point is that the next request is rebuilt from
|
|
35
|
+
* our own path and parameters, so a caller cannot steer it.
|
|
36
|
+
*/
|
|
37
|
+
readonly nextCursor?: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
export interface ConfluenceJsonResponse<T> {
|
|
40
|
+
readonly data: T;
|
|
41
|
+
readonly page?: ConfluencePage;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* HTTP boundary of the provider: one documented Confluence REST read, bounded
|
|
45
|
+
* in time and size, with upstream failures folded into safe domain errors and
|
|
46
|
+
* bounded retries for the transient ones.
|
|
47
|
+
*/
|
|
48
|
+
export declare class ConfluenceTransport {
|
|
49
|
+
private readonly config;
|
|
50
|
+
private readonly flags;
|
|
51
|
+
private readonly fetcher;
|
|
52
|
+
constructor(config: ResolvedQaIntegrationsConfig, flags: ConfluenceFlags, fetcher?: typeof fetch);
|
|
53
|
+
getJson<T>(instance: ConfluenceInstance, credential: ConfluenceCredential, path: string, query?: ConfluenceQuery): Promise<ConfluenceJsonResponse<T>>;
|
|
54
|
+
private url;
|
|
55
|
+
/**
|
|
56
|
+
* The one place the secret is spent. Basic authentication carries the account
|
|
57
|
+
* e-mail and the API token; nothing else in the request names the user.
|
|
58
|
+
*/
|
|
59
|
+
private authorization;
|
|
60
|
+
private request;
|
|
61
|
+
/** Atlassian asks for a pause through `retry-after`; honour it, but bounded. */
|
|
62
|
+
private backoff;
|
|
63
|
+
private retryDelay;
|
|
64
|
+
/**
|
|
65
|
+
* Confluence answers a page the account may not see with the same 404 as a
|
|
66
|
+
* page that does not exist, and the provider keeps that ambiguity: the model
|
|
67
|
+
* must not learn from an error whether someone else's page is there.
|
|
68
|
+
*/
|
|
69
|
+
private failure;
|
|
70
|
+
/**
|
|
71
|
+
* Read a body without letting upstream decide how much memory the broker
|
|
72
|
+
* spends. A body over the cap is reported as truncated instead of surfacing a
|
|
73
|
+
* raw `content-length` nobody can verify.
|
|
74
|
+
*/
|
|
75
|
+
private readText;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IntegrationCapability, IntegrationCapabilityInfo, IntegrationProviderId, ProviderValidation } from "../types.js";
|
|
2
|
+
export interface ProviderContext {
|
|
3
|
+
readonly credential: string;
|
|
4
|
+
/**
|
|
5
|
+
* External user id of the credential owner, read from the stored integration.
|
|
6
|
+
* Resolved server-side, never a model argument; it backs "mine" defaults.
|
|
7
|
+
*/
|
|
8
|
+
readonly externalUserId?: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface IntegrationProvider {
|
|
11
|
+
readonly id: IntegrationProviderId;
|
|
12
|
+
readonly displayName: string;
|
|
13
|
+
readonly capabilities: readonly IntegrationCapability[];
|
|
14
|
+
/** Labels and hints for `capabilities`, so clients need no provider catalog. */
|
|
15
|
+
readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
|
|
16
|
+
/** Capability a provider operation needs, or undefined when it is unknown. */
|
|
17
|
+
operationCapability(operation: string): IntegrationCapability | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Validate and normalize one operator-supplied credential. The provider owns
|
|
20
|
+
* its credential format; the broker only stores the returned opaque string.
|
|
21
|
+
*
|
|
22
|
+
* `options` carries the non-secret choices the connect form made next to the
|
|
23
|
+
* secret — today only which configured instance a token belongs to. It comes
|
|
24
|
+
* from the operator-facing RPC, never from a model tool call.
|
|
25
|
+
*/
|
|
26
|
+
parseCredential(raw: string, options?: Readonly<Record<string, string>>): {
|
|
27
|
+
readonly credential: string;
|
|
28
|
+
readonly portal: string;
|
|
29
|
+
};
|
|
30
|
+
validate(context: ProviderContext): Promise<ProviderValidation>;
|
|
31
|
+
execute(context: ProviderContext, operation: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { IntegrationCapability, IntegrationCapabilityInfo } from "../../types.js";
|
|
2
|
+
import type { GitlabFlags } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Capabilities this provider offers. They are narrower than GitLab's own token
|
|
5
|
+
* scopes on purpose: GitLab has one broad read scope per area, while the agent
|
|
6
|
+
* gets one switch per kind of data, and the operator decides what a deployment
|
|
7
|
+
* is willing to expose at all.
|
|
8
|
+
*
|
|
9
|
+
* `scopes` lists the GitLab scopes that satisfy a capability; the provider
|
|
10
|
+
* intersects them with the scopes the connected token actually reports. A token
|
|
11
|
+
* with `read_api` satisfies everything readable, `read_repository` adds nothing
|
|
12
|
+
* on top of it, and `read_user` is enough only for the profile.
|
|
13
|
+
*/
|
|
14
|
+
export type GitlabCapability = "identity.read" | "projects.read" | "repository.read" | "search.read" | "issues.read" | "merge_requests.read" | "ci.read";
|
|
15
|
+
export interface GitlabCapabilityDefinition {
|
|
16
|
+
readonly capability: GitlabCapability;
|
|
17
|
+
readonly flag: Exclude<keyof GitlabFlags, "instances" | "retries" | "enabled">;
|
|
18
|
+
readonly scopes: readonly string[];
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly hint: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const GITLAB_CAPABILITIES: readonly GitlabCapabilityDefinition[];
|
|
23
|
+
export interface GitlabOperationDefinition {
|
|
24
|
+
readonly capability: GitlabCapability;
|
|
25
|
+
/**
|
|
26
|
+
* REST path under the instance's `/api/v4` root. `:placeholders` are filled
|
|
27
|
+
* by the handler; the value is a fixed string, so the model can never pick an
|
|
28
|
+
* endpoint of its own.
|
|
29
|
+
*/
|
|
30
|
+
readonly path: string;
|
|
31
|
+
/** Set when the operation answers with one page of a collection. */
|
|
32
|
+
readonly list?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Every model-reachable operation. The provider refuses any operation that is
|
|
36
|
+
* not listed here, so this table — together with `capability` — is the
|
|
37
|
+
* permission surface. Only GET: the catalog carries no operation that could
|
|
38
|
+
* change GitLab state, and the confirmation framework does not exist yet.
|
|
39
|
+
*/
|
|
40
|
+
export declare const GITLAB_OPERATIONS: Readonly<Record<string, GitlabOperationDefinition>>;
|
|
41
|
+
/** Capabilities this deployment allows, in catalog order. */
|
|
42
|
+
export declare function enabledCapabilities(flags: GitlabFlags): readonly GitlabCapability[];
|
|
43
|
+
/** Label and hint per capability, for clients that render what we declare. */
|
|
44
|
+
export declare const GITLAB_CAPABILITY_INFO: Readonly<Record<GitlabCapability, IntegrationCapabilityInfo>>;
|
|
45
|
+
/** Capability an operation needs, or undefined when the catalog has none. */
|
|
46
|
+
export declare function gitlabOperationCapability(operation: string): IntegrationCapability | undefined;
|
|
47
|
+
/** Capabilities satisfied by the scopes a GitLab token reports. */
|
|
48
|
+
export declare function capabilitiesForScopes(scopes: readonly string[]): readonly GitlabCapability[];
|
|
49
|
+
//# sourceMappingURL=catalog.d.ts.map
|