@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,65 @@
|
|
|
1
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
2
|
+
import { type JiraFlags, type JiraSite } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Encrypted payload of one Jira connection: which configured site the token
|
|
5
|
+
* belongs to, the Atlassian account it authenticates as, and the API token
|
|
6
|
+
* itself.
|
|
7
|
+
*
|
|
8
|
+
* The site's address is not stored — it is re-resolved from operator config on
|
|
9
|
+
* every call, so removing or repointing a site takes effect at once instead of
|
|
10
|
+
* at the next connect. The e-mail is not a secret, but it is what makes the
|
|
11
|
+
* token usable (Jira Cloud authenticates an API token with HTTP Basic over
|
|
12
|
+
* `email:token`), so it travels in the same encrypted blob rather than in a
|
|
13
|
+
* second record that could go missing.
|
|
14
|
+
*/
|
|
15
|
+
export interface JiraCredential {
|
|
16
|
+
readonly siteId: string;
|
|
17
|
+
readonly email: string;
|
|
18
|
+
readonly token: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function credentialFromPlaintext(plaintext: string): JiraCredential;
|
|
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 credentialSite(flags: JiraFlags, credential: JiraCredential): JiraSite;
|
|
27
|
+
export type JiraQuery = Readonly<Record<string, string | number | boolean | undefined>>;
|
|
28
|
+
/** Jira Cloud authenticates an API token with HTTP Basic over `email:token`. */
|
|
29
|
+
export declare function basicAuthorization(credential: JiraCredential): string;
|
|
30
|
+
/**
|
|
31
|
+
* HTTP boundary of the provider: one documented Jira Cloud REST call, bounded in
|
|
32
|
+
* time and size, with upstream failures folded into safe domain errors and
|
|
33
|
+
* bounded retries for the transient ones.
|
|
34
|
+
*
|
|
35
|
+
* Requests are GET-only and never follow a redirect: the token must not travel
|
|
36
|
+
* to another origin, and an Atlassian login page is an authentication answer
|
|
37
|
+
* rather than a new address to try.
|
|
38
|
+
*/
|
|
39
|
+
export declare class JiraTransport {
|
|
40
|
+
private readonly config;
|
|
41
|
+
private readonly flags;
|
|
42
|
+
private readonly fetcher;
|
|
43
|
+
constructor(config: ResolvedQaIntegrationsConfig, flags: JiraFlags, fetcher?: typeof fetch);
|
|
44
|
+
getJson<T>(site: JiraSite, credential: JiraCredential, path: string, query?: JiraQuery): Promise<T>;
|
|
45
|
+
private url;
|
|
46
|
+
private request;
|
|
47
|
+
/** Jira asks for a pause through `retry-after`; honour it, but bounded. */
|
|
48
|
+
private backoff;
|
|
49
|
+
private retryDelay;
|
|
50
|
+
/**
|
|
51
|
+
* The provider error model. Jira answers a refused permission with 403 — a
|
|
52
|
+
* permission scheme the connected user is not in, an issue security level, or
|
|
53
|
+
* a project they cannot browse — and an unknown or invisible resource with
|
|
54
|
+
* 404; both stay distinct so the model can tell "you may not" from "it is not
|
|
55
|
+
* there". Neither answer ever carries the upstream body.
|
|
56
|
+
*/
|
|
57
|
+
private failure;
|
|
58
|
+
/**
|
|
59
|
+
* Read a body without letting upstream decide how much memory the broker
|
|
60
|
+
* spends. A body over the cap is reported as truncated instead of surfacing a
|
|
61
|
+
* raw `content-length` nobody can verify.
|
|
62
|
+
*/
|
|
63
|
+
private readText;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IntegrationProviderId } from "../types.js";
|
|
2
|
+
import type { IntegrationProvider } from "./contract.js";
|
|
3
|
+
export declare class IntegrationProviderRegistry {
|
|
4
|
+
private readonly providers;
|
|
5
|
+
register(provider: IntegrationProvider): void;
|
|
6
|
+
get(id: IntegrationProviderId): IntegrationProvider;
|
|
7
|
+
list(): readonly IntegrationProvider[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account naming and payload normalization shared by the providers: every card
|
|
3
|
+
* shows the connected account the same way, and every projection can index an
|
|
4
|
+
* upstream answer without re-checking its shape.
|
|
5
|
+
*/
|
|
6
|
+
/** `Name (@username)` when both exist, whichever does, else the fallback. */
|
|
7
|
+
export declare function accountName(data: Record<string, unknown>, fallback: string): string;
|
|
8
|
+
/** Objects pass through; scalars and arrays wrap into `{ value }`. */
|
|
9
|
+
export declare function objectOf(data: unknown): Record<string, unknown>;
|
|
10
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host matching shared by the provider address policies. Both only ever need
|
|
3
|
+
* the two forms below: a plain hostname, and a `*.suffix` / `.suffix` wildcard.
|
|
4
|
+
*/
|
|
5
|
+
/** `example.com` matches itself, `.corp.example` matches its subdomains. */
|
|
6
|
+
export declare function hostMatchesSuffix(hostname: string, suffix: string): boolean;
|
|
7
|
+
/** `example.com` matches itself, `*.corp.example` matches its subdomains. */
|
|
8
|
+
export declare function hostMatchesPattern(hostname: string, pattern: string): boolean;
|
|
9
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IntegrationError } from "../../errors.js";
|
|
2
|
+
export declare const RETRY_CAP_MS = 2000;
|
|
3
|
+
export declare const BACKOFF_BASE_MS = 250;
|
|
4
|
+
/** Upstream codes that mean "the TLS handshake did not succeed". */
|
|
5
|
+
export declare const TLS_FAILURE: RegExp;
|
|
6
|
+
/** Content types that must never be handed to the model as text. */
|
|
7
|
+
export declare const BINARY_TYPE: RegExp;
|
|
8
|
+
/** A body read up to a cap; the text is empty for a payload that looks binary. */
|
|
9
|
+
export interface BoundedText {
|
|
10
|
+
/** Body prefix; empty for a payload that looks binary. */
|
|
11
|
+
readonly text: string;
|
|
12
|
+
readonly bytes: number;
|
|
13
|
+
readonly truncated: boolean;
|
|
14
|
+
readonly binary: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function numberFrom(value: string | null): number | undefined;
|
|
17
|
+
export declare function looksBinary(contentType: string | null, bytes: Uint8Array): boolean;
|
|
18
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
19
|
+
/** The first upstream error code in a fetch failure chain, if any. */
|
|
20
|
+
export declare function causeCode(error: unknown): string;
|
|
21
|
+
export declare function backoff(response: Response, attempt: number): number;
|
|
22
|
+
export declare function retryDelay(attempt: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* Read a body without letting upstream decide how much memory the broker
|
|
25
|
+
* spends. A body over the cap is reported as truncated instead of surfacing a
|
|
26
|
+
* raw `content-length` nobody can verify.
|
|
27
|
+
*/
|
|
28
|
+
export declare function readBoundedText(response: Response, maxBytes: number): Promise<BoundedText>;
|
|
29
|
+
/**
|
|
30
|
+
* How a provider folds transport outcomes into its own safe domain errors:
|
|
31
|
+
* each transport keeps the wording, the shared loop keeps the mechanics.
|
|
32
|
+
*/
|
|
33
|
+
export interface FetchRetryPolicy {
|
|
34
|
+
readonly timeoutMs: number;
|
|
35
|
+
readonly retries: number;
|
|
36
|
+
readonly headers: Record<string, string>;
|
|
37
|
+
/** Fold a thrown fetch (abort, DNS, refused connection) into a safe error. */
|
|
38
|
+
readonly transportFailure: (error: unknown, timedOut: boolean) => IntegrationError;
|
|
39
|
+
/** Whether a folded transport failure earns another attempt. */
|
|
40
|
+
readonly retriable: (error: IntegrationError) => boolean;
|
|
41
|
+
/** Fold a non-2xx answer into the provider's safe domain error. */
|
|
42
|
+
readonly statusFailure: (response: Response) => IntegrationError;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The shared transport loop: one bounded GET per attempt, transient answers
|
|
46
|
+
* retried with backoff, upstream failures folded into safe domain errors. The
|
|
47
|
+
* deadline is per attempt, and a fetch that answered is never retried by this
|
|
48
|
+
* loop unless its status says the upstream fault may be gone on a later try.
|
|
49
|
+
*/
|
|
50
|
+
export declare function fetchWithRetries(fetcher: typeof fetch, target: string, policy: FetchRetryPolicy): Promise<Response>;
|
|
51
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { TeamCityFlags } from "./config.js";
|
|
2
|
+
export interface ArtifactPath {
|
|
3
|
+
/** Path as the model wrote it, canonicalized and safe to echo back. */
|
|
4
|
+
readonly decoded: string;
|
|
5
|
+
/** Same path, each segment encoded, for use inside the REST path. */
|
|
6
|
+
readonly encoded: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Canonicalize one artifact path. It never leaves the REST path it was built
|
|
10
|
+
* for: no absolute path, no `..` segment, no control character, no backslash and
|
|
11
|
+
* no archive component, because `archive.zip!/inner` would ask TeamCity to
|
|
12
|
+
* extract an archive the model did not have to name.
|
|
13
|
+
*/
|
|
14
|
+
export declare function artifactPath(value: unknown, field?: string, allowEmpty?: boolean): ArtifactPath;
|
|
15
|
+
/** Extension of the last segment, lowercased, without the dot. */
|
|
16
|
+
export declare function artifactExtension(path: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Byte budget of one text artifact: the caller may ask for less than the
|
|
19
|
+
* deployment allows, never for more, and an unasked budget is the configured
|
|
20
|
+
* default rather than the hard ceiling.
|
|
21
|
+
*/
|
|
22
|
+
export declare function artifactByteLimit(requested: unknown, flags: TeamCityFlags): number;
|
|
23
|
+
/** Why this artifact may not be read as text at all. */
|
|
24
|
+
export declare function artifactBinaryProblem(path: string): string | undefined;
|
|
25
|
+
/** A NUL byte in the head of a body is the classic text/binary split. */
|
|
26
|
+
export declare function looksBinary(bytes: Uint8Array): boolean;
|
|
27
|
+
export interface TextArtifactAnswer {
|
|
28
|
+
readonly path: string;
|
|
29
|
+
/** Bytes of the body that was downloaded, not the artifact's full size. */
|
|
30
|
+
readonly bytes: number;
|
|
31
|
+
readonly binary: boolean;
|
|
32
|
+
readonly truncated: boolean;
|
|
33
|
+
readonly content?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Answer for one text artifact. A binary body answers with its size and the
|
|
37
|
+
* `binary` marker instead of bytes, and a body over the budget keeps the prefix
|
|
38
|
+
* that fits, because a bounded preview is useful where an empty answer is not.
|
|
39
|
+
*/
|
|
40
|
+
export declare function textArtifact(path: string, bytes: number, limit: number, body: {
|
|
41
|
+
readonly text: string;
|
|
42
|
+
readonly binary: boolean;
|
|
43
|
+
readonly truncated: boolean;
|
|
44
|
+
}): TextArtifactAnswer;
|
|
45
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { IntegrationCapability, IntegrationCapabilityInfo } from "../../types.js";
|
|
2
|
+
import type { TeamCityFlags } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Capabilities this provider offers, one per kind of TeamCity data a user may
|
|
5
|
+
* hand to the agent. They are narrower than TeamCity's own permissions on
|
|
6
|
+
* purpose: a TeamCity token grants whole areas (or is limited per project), while
|
|
7
|
+
* the agent gets one switch per area, so a user who only needs "why did my build
|
|
8
|
+
* fail" can hand over failures and logs without projects or agents.
|
|
9
|
+
*/
|
|
10
|
+
export type TeamCityCapability = "identity.read" | "projects.read" | "buildConfigs.read" | "builds.read" | "failures.read" | "logs.read" | "queue.read" | "investigations.read" | "agents.read" | "artifacts.read";
|
|
11
|
+
/** Boolean deployment switches of this provider, one per capability. */
|
|
12
|
+
export type TeamCityReadFlag = "identityRead" | "projectsRead" | "buildConfigsRead" | "buildsRead" | "failuresRead" | "logsRead" | "queueRead" | "investigationsRead" | "agentsRead" | "artifactsRead";
|
|
13
|
+
/** Operations whose answer is a window over text rather than JSON. */
|
|
14
|
+
export declare const TEAMCITY_STREAM_OPERATIONS: readonly string[];
|
|
15
|
+
export interface TeamCityCapabilityDefinition {
|
|
16
|
+
readonly capability: TeamCityCapability;
|
|
17
|
+
readonly flag: TeamCityReadFlag;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly hint: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const TEAMCITY_CAPABILITIES: readonly TeamCityCapabilityDefinition[];
|
|
22
|
+
export interface TeamCityOperationDefinition {
|
|
23
|
+
readonly capability: TeamCityCapability;
|
|
24
|
+
/**
|
|
25
|
+
* REST path under `/app/rest`, or the one non-REST path TeamCity serves the
|
|
26
|
+
* plain build log from. `:placeholders` are filled by the handler built for
|
|
27
|
+
* that operation; the value is a fixed string, so the model can never pick an
|
|
28
|
+
* endpoint of its own.
|
|
29
|
+
*
|
|
30
|
+
* Where an operation needs a companion endpoint (`/users/current` next to
|
|
31
|
+
* `/server`, `/problemOccurrences` next to `/testOccurrences`) the provider
|
|
32
|
+
* adds that call itself; the catalog keeps the primary path.
|
|
33
|
+
*/
|
|
34
|
+
readonly path: string;
|
|
35
|
+
/**
|
|
36
|
+
* Every operation of this catalog is a read. The field exists so the package
|
|
37
|
+
* gate can assert that, instead of trusting the path names to look harmless.
|
|
38
|
+
*/
|
|
39
|
+
readonly method: "GET";
|
|
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. The catalog carries no operation that could change
|
|
45
|
+
* TeamCity state: trigger, retry, cancel, comment and tags wait for the
|
|
46
|
+
* confirmation framework the specification requires for them.
|
|
47
|
+
*/
|
|
48
|
+
export declare const TEAMCITY_OPERATIONS: Readonly<Record<string, TeamCityOperationDefinition>>;
|
|
49
|
+
/** Capabilities this deployment allows, in catalog order. */
|
|
50
|
+
export declare function enabledCapabilities(flags: TeamCityFlags): readonly TeamCityCapability[];
|
|
51
|
+
/** Label and hint per capability, for clients that render what we declare. */
|
|
52
|
+
export declare const TEAMCITY_CAPABILITY_INFO: Readonly<Record<TeamCityCapability, IntegrationCapabilityInfo>>;
|
|
53
|
+
/** Capability an operation needs, or undefined when the catalog has none. */
|
|
54
|
+
export declare function teamcityOperationCapability(operation: string): IntegrationCapability | undefined;
|
|
55
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { type TeamCityNetworkPolicy } from "./network.js";
|
|
3
|
+
/**
|
|
4
|
+
* Deployment switches for the TeamCity provider. A read capability reaches the
|
|
5
|
+
* agent only when this deployment enables it, and the connected token can still
|
|
6
|
+
* be narrower: TeamCity enforces its own permissions on every request, and a
|
|
7
|
+
* refusal is reported instead of being worked around.
|
|
8
|
+
*/
|
|
9
|
+
export interface TeamCityFlags {
|
|
10
|
+
readonly enabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The one TeamCity server this deployment dials, canonical `<origin><path>`,
|
|
13
|
+
* or `""` when the operator mounted none. It is operator configuration and
|
|
14
|
+
* never user input: every user connects *there* with their own token, which
|
|
15
|
+
* is what keeps the broker from being pointed at a host of the caller's
|
|
16
|
+
* choosing.
|
|
17
|
+
*/
|
|
18
|
+
readonly serverUrl: string;
|
|
19
|
+
/** Which addresses this deployment may dial at all. */
|
|
20
|
+
readonly network: TeamCityNetworkPolicy;
|
|
21
|
+
readonly identityRead: boolean;
|
|
22
|
+
readonly projectsRead: boolean;
|
|
23
|
+
readonly buildConfigsRead: boolean;
|
|
24
|
+
readonly buildsRead: boolean;
|
|
25
|
+
readonly failuresRead: boolean;
|
|
26
|
+
readonly logsRead: boolean;
|
|
27
|
+
readonly queueRead: boolean;
|
|
28
|
+
readonly investigationsRead: boolean;
|
|
29
|
+
readonly agentsRead: boolean;
|
|
30
|
+
readonly artifactsRead: boolean;
|
|
31
|
+
/** Hard ceiling for one build log answer, in lines. */
|
|
32
|
+
readonly maxLogLines: number;
|
|
33
|
+
/** How much of a build log is downloaded before the window is selected. */
|
|
34
|
+
readonly maxLogBytes: number;
|
|
35
|
+
/** Byte budget of one text artifact when the caller names none. */
|
|
36
|
+
readonly defaultArtifactBytes: number;
|
|
37
|
+
/** Hard ceiling of one text artifact, whatever the caller asks for. */
|
|
38
|
+
readonly maxArtifactBytes: number;
|
|
39
|
+
/** Timeout for the streaming reads; JSON reads use the shared one. */
|
|
40
|
+
readonly streamTimeoutMs: number;
|
|
41
|
+
/** Extra attempts for a throttled or transient read. */
|
|
42
|
+
readonly retries: number;
|
|
43
|
+
}
|
|
44
|
+
/** Config slice as YAML writes it: every member is optional there. */
|
|
45
|
+
export interface TeamCityConfigInput extends Partial<Omit<TeamCityFlags, "network">> {
|
|
46
|
+
readonly network?: Partial<TeamCityNetworkPolicy> | undefined;
|
|
47
|
+
}
|
|
48
|
+
export declare const TEAMCITY_DEFAULTS: TeamCityFlags;
|
|
49
|
+
/** One log answer is a window, so its line count and byte budget are both small. */
|
|
50
|
+
export declare const DEFAULT_LOG_LINES = 200;
|
|
51
|
+
/**
|
|
52
|
+
* True when the policy dials nothing at all. That is the default, and it is
|
|
53
|
+
* deliberately not an error: the plugin has to load in a deployment that mounts
|
|
54
|
+
* no TeamCity yet. The plugin logs it once at startup, so an operator who
|
|
55
|
+
* enabled the provider and forgot the address list hears about it there rather
|
|
56
|
+
* than from a user whose connect form refuses every address.
|
|
57
|
+
*/
|
|
58
|
+
export declare function networkAllowsNothing(policy: TeamCityNetworkPolicy): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Config slice of this provider, as it appears under `teamcity:` in YAML. The
|
|
61
|
+
* address policy is declared with plain types here and validated by
|
|
62
|
+
* `resolveTeamCityConfig`, which is where a deployment typo fails loudly.
|
|
63
|
+
*/
|
|
64
|
+
export declare const teamcityConfigSchema: z<TeamCityConfigInput>;
|
|
65
|
+
export declare function resolveTeamCityConfig(input?: TeamCityConfigInput): TeamCityFlags;
|
|
66
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
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 { configuredServer, credentialFromPlaintext, type TeamCityCredential, } from "./transport.js";
|
|
5
|
+
/**
|
|
6
|
+
* TeamCity provider: one TeamCity server per QA user, connected with that user's
|
|
7
|
+
* own personal access token.
|
|
8
|
+
*
|
|
9
|
+
* The server address is user input, so it is checked against the deployment's
|
|
10
|
+
* address policy when the connection is stored and again on every call, and the
|
|
11
|
+
* token is never part of a URL, a tool argument or a log line.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TeamcityProvider implements IntegrationProvider {
|
|
14
|
+
private readonly config;
|
|
15
|
+
readonly id = "teamcity";
|
|
16
|
+
readonly displayName = "TeamCity";
|
|
17
|
+
/** What this deployment is willing to expose; TeamCity's own rights still apply. */
|
|
18
|
+
readonly capabilities: readonly IntegrationCapability[];
|
|
19
|
+
readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
|
|
20
|
+
private readonly transport;
|
|
21
|
+
constructor(config: ResolvedQaIntegrationsConfig, fetcher?: typeof fetch);
|
|
22
|
+
/**
|
|
23
|
+
* Keep the pasted token. The server it will be dialled at is this
|
|
24
|
+
* deployment's configuration — never a connect-form field and never a tool
|
|
25
|
+
* argument — so a token minted for another TeamCity fails against the address
|
|
26
|
+
* the operator set instead of pointing the broker at a host the caller chose.
|
|
27
|
+
* A deployment with no address configured refuses here, so the connect form
|
|
28
|
+
* cannot store a credential that could never be used.
|
|
29
|
+
*/
|
|
30
|
+
parseCredential(raw: string): {
|
|
31
|
+
readonly credential: string;
|
|
32
|
+
readonly portal: string;
|
|
33
|
+
};
|
|
34
|
+
operationCapability(operation: string): IntegrationCapability | undefined;
|
|
35
|
+
validate(context: ProviderContext): Promise<ProviderValidation>;
|
|
36
|
+
execute(context: ProviderContext, operation: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
37
|
+
/** Server identity: one answer out of the two documented discovery calls. */
|
|
38
|
+
private readConnection;
|
|
39
|
+
/**
|
|
40
|
+
* Failed tests and build problems in one answer: "why did it fail" is one
|
|
41
|
+
* question, and making the model stitch two low-level calls together only
|
|
42
|
+
* invites it to report half of the reason.
|
|
43
|
+
*/
|
|
44
|
+
private readFailures;
|
|
45
|
+
/**
|
|
46
|
+
* A build log is a stream of external text. It is downloaded up to the
|
|
47
|
+
* deployment's byte budget, stripped of terminal control sequences and secret
|
|
48
|
+
* shapes, and cut to the lines the caller asked for: a multi-megabyte log
|
|
49
|
+
* never reaches the model context.
|
|
50
|
+
*/
|
|
51
|
+
private readLog;
|
|
52
|
+
/**
|
|
53
|
+
* One text artifact. Archives, images, binaries and key material are refused
|
|
54
|
+
* by name before a byte is requested, the rest is bounded, and the terminal
|
|
55
|
+
* text is redacted like any other external content.
|
|
56
|
+
*/
|
|
57
|
+
private readArtifact;
|
|
58
|
+
private read;
|
|
59
|
+
private project;
|
|
60
|
+
}
|
|
61
|
+
export default TeamcityProvider;
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TeamCity locator syntax, built server-side.
|
|
3
|
+
*
|
|
4
|
+
* A locator is `<dimension>:<value>,<dimension>:<value>` with parentheses for
|
|
5
|
+
* nested locators, and it has no escape character: a value that contains a
|
|
6
|
+
* comma, a colon or a parenthesis cannot be written plainly, and a half-escaped
|
|
7
|
+
* value would silently become a different query. TeamCity therefore documents
|
|
8
|
+
* the `$base64:` form for arbitrary values, which is what this module uses for
|
|
9
|
+
* anything that does not look like a plain identifier.
|
|
10
|
+
*
|
|
11
|
+
* The model never composes a locator: every tool argument is a validated field
|
|
12
|
+
* that this builder turns into dimensions, so a caller cannot smuggle an extra
|
|
13
|
+
* dimension such as `count` or `agent` into a query.
|
|
14
|
+
*/
|
|
15
|
+
/** One dimension value, plain when it cannot confuse the parser. */
|
|
16
|
+
export declare function locatorValue(value: string): string;
|
|
17
|
+
/** `<name>:<value>` for a single-value dimension. */
|
|
18
|
+
export declare function dimension(name: string, value: string | number): string;
|
|
19
|
+
/** `<name>:(<nested locator>)` for a dimension that takes an entity. */
|
|
20
|
+
export declare function nested(name: string, locator: string): string;
|
|
21
|
+
export declare function joinDimensions(parts: readonly string[]): string;
|
|
22
|
+
/**
|
|
23
|
+
* TeamCity's own date format, in UTC. A bare `YYYY-MM-DD` means midnight UTC,
|
|
24
|
+
* so "since 2026-09-01" includes that day.
|
|
25
|
+
*/
|
|
26
|
+
export declare function teamCityDate(value: string): string | undefined;
|
|
27
|
+
export interface BuildLocatorInput {
|
|
28
|
+
readonly buildTypeId?: string | undefined;
|
|
29
|
+
readonly projectId?: string | undefined;
|
|
30
|
+
readonly branch?: string | undefined;
|
|
31
|
+
readonly status?: string | undefined;
|
|
32
|
+
readonly state?: string | undefined;
|
|
33
|
+
readonly personal?: boolean | undefined;
|
|
34
|
+
readonly since?: string | undefined;
|
|
35
|
+
readonly until?: string | undefined;
|
|
36
|
+
readonly count?: number | undefined;
|
|
37
|
+
readonly start?: number | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The build locator the model's filters map onto. TeamCity applies
|
|
41
|
+
* `defaultFilter:true` unless told otherwise, which hides personal builds
|
|
42
|
+
* entirely; asking for personal builds therefore has to drop that filter, or
|
|
43
|
+
* the query would answer with an empty list instead of the very builds it asked
|
|
44
|
+
* about.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildBuildLocator(input: BuildLocatorInput): string;
|
|
47
|
+
//# sourceMappingURL=locators.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build logs are untrusted external text: they carry ANSI colouring, control
|
|
3
|
+
* characters, commit messages written by anyone who can push, broken Unicode and
|
|
4
|
+
* whatever a job decided to print. The provider hands the model a bounded,
|
|
5
|
+
* cleaned window and never treats a line of it as an instruction.
|
|
6
|
+
*/
|
|
7
|
+
export type LogMode = "tail" | "head" | "search";
|
|
8
|
+
export declare const LOG_MODES: readonly LogMode[];
|
|
9
|
+
export declare function logMode(value: unknown): LogMode;
|
|
10
|
+
export declare function logLines(value: unknown, maxLines: number): number;
|
|
11
|
+
/** Strip terminal control sequences and repair Unicode that cannot be encoded. */
|
|
12
|
+
export declare function sanitizeLog(text: string): string;
|
|
13
|
+
export interface LogWindow {
|
|
14
|
+
readonly text: string;
|
|
15
|
+
readonly returnedLines: number;
|
|
16
|
+
readonly matched?: number | undefined;
|
|
17
|
+
/** The selected window does not cover every requested line. */
|
|
18
|
+
readonly truncated: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One window over the downloaded log. `search` keeps a few lines of context
|
|
22
|
+
* around each hit and marks the gaps, because a failing command rarely prints
|
|
23
|
+
* its verdict on the line that matched the query.
|
|
24
|
+
*/
|
|
25
|
+
export declare function selectLogWindow(text: string, mode: LogMode, maxLines: number, query: string | undefined): LogWindow;
|
|
26
|
+
/** Cut text to a byte budget without leaving a half-decoded character behind. */
|
|
27
|
+
export declare function trimToBytes(text: string, maxBytes: number): {
|
|
28
|
+
readonly text: string;
|
|
29
|
+
readonly truncated: boolean;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type TeamCityNetworkMode = "allowlist" | "trusted-private";
|
|
2
|
+
export interface TeamCityNetworkPolicy {
|
|
3
|
+
readonly mode: TeamCityNetworkMode;
|
|
4
|
+
/** Exact hostnames or `*.suffix` patterns, matched case-insensitively. */
|
|
5
|
+
readonly allowedHosts: readonly string[];
|
|
6
|
+
/** IPv4 networks a literal address must fall into; never matches a hostname. */
|
|
7
|
+
readonly allowedCidrs: readonly string[];
|
|
8
|
+
/** Ports a server URL may use; empty means the scheme default alone. */
|
|
9
|
+
readonly allowedPorts: readonly number[];
|
|
10
|
+
readonly allowHttp: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Private ranges `trusted-private` accepts when the operator names none. */
|
|
13
|
+
export declare const PRIVATE_CIDRS: readonly string[];
|
|
14
|
+
/** True for `a.b.c.d` and for the bracketed IPv6 form a WHATWG URL reports. */
|
|
15
|
+
export declare function isIpLiteral(hostname: string): boolean;
|
|
16
|
+
/** Operator typo in an address policy, so config load fails with a reason. */
|
|
17
|
+
export declare function hostPatternProblem(value: string): string | undefined;
|
|
18
|
+
/** Operator typo in a network; IPv4 only, which is what TeamCity on-prem uses. */
|
|
19
|
+
export declare function cidrProblem(value: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Why this server URL may not be dialled, or `undefined` when it may. The
|
|
22
|
+
* caller picks the error code: a connect form refusal is a credential problem,
|
|
23
|
+
* a runtime refusal is a deployment policy that moved under a stored token.
|
|
24
|
+
*/
|
|
25
|
+
export declare function serverUrlProblem(raw: string, policy: TeamCityNetworkPolicy): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Canonical `<origin><path>`, without a trailing slash. TeamCity is often
|
|
28
|
+
* mounted under a subpath, so the path stays; `..` segments were already folded
|
|
29
|
+
* away by the URL parser.
|
|
30
|
+
*/
|
|
31
|
+
export declare function canonicalServerUrl(raw: string): string;
|
|
32
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { TeamCityFlags } from "./config.js";
|
|
2
|
+
/**
|
|
3
|
+
* Request building and response shaping for the TeamCity REST API.
|
|
4
|
+
*
|
|
5
|
+
* Every operation answers with a normalized object instead of TeamCity's own
|
|
6
|
+
* DTO, and every list answers with the same `{ items, pagination }` envelope, so
|
|
7
|
+
* the model learns one shape rather than a dozen. The operations that hand a
|
|
8
|
+
* bounded window of text to the model are not shaped here: the provider
|
|
9
|
+
* assembles those, where the byte budget lives.
|
|
10
|
+
*/
|
|
11
|
+
/** Hard caps per collection, from the provider specification. */
|
|
12
|
+
export declare const TEAMCITY_LIMITS: Readonly<{
|
|
13
|
+
projects: 100;
|
|
14
|
+
buildConfigs: 100;
|
|
15
|
+
builds: 50;
|
|
16
|
+
changes: 100;
|
|
17
|
+
tests: 100;
|
|
18
|
+
problems: 100;
|
|
19
|
+
queued: 50;
|
|
20
|
+
investigations: 100;
|
|
21
|
+
agents: 100;
|
|
22
|
+
artifacts: 200;
|
|
23
|
+
}>;
|
|
24
|
+
/** Values TeamCity accepts for the dimensions this provider exposes. */
|
|
25
|
+
export declare const BUILD_STATES: readonly string[];
|
|
26
|
+
export declare const BUILD_STATUSES: readonly string[];
|
|
27
|
+
export declare const INVESTIGATION_STATES: readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* The number of rows one call may ask for: the caller's wish is clamped to the
|
|
30
|
+
* deployment cap rather than refused, because a model that asks for "the last
|
|
31
|
+
* 500 builds" still gets a useful answer instead of an error.
|
|
32
|
+
*/
|
|
33
|
+
export declare function listLimit(requested: unknown, cap: number): number;
|
|
34
|
+
export interface OperationContext {
|
|
35
|
+
/**
|
|
36
|
+
* TeamCity user id of the token owner, read from the stored integration. It
|
|
37
|
+
* backs the "mine" default of the investigations tool; no operation ever
|
|
38
|
+
* substitutes it for a model argument.
|
|
39
|
+
*/
|
|
40
|
+
readonly externalUserId?: string | undefined;
|
|
41
|
+
readonly flags: TeamCityFlags;
|
|
42
|
+
}
|
|
43
|
+
export interface TeamCityRequest {
|
|
44
|
+
readonly path: string;
|
|
45
|
+
readonly query: Readonly<Record<string, string | undefined>>;
|
|
46
|
+
/**
|
|
47
|
+
* Which root the path is relative to: the REST API under `/app/rest`, or the
|
|
48
|
+
* server root, which serves the one plain-text endpoint (the build log).
|
|
49
|
+
*/
|
|
50
|
+
readonly root?: "rest" | "server";
|
|
51
|
+
/** Decoded artifact path, so the projection can name children of it. */
|
|
52
|
+
readonly artifactPath?: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
export type TeamCityOperationHandler = (input: Readonly<Record<string, unknown>>, context: OperationContext) => TeamCityRequest;
|
|
55
|
+
export declare function serverRequest(): TeamCityRequest;
|
|
56
|
+
export declare function currentUserRequest(): TeamCityRequest;
|
|
57
|
+
/**
|
|
58
|
+
* Failed tests and problems carry no `count` dimension here: the specification
|
|
59
|
+
* names the bare locator for both, and the answer is bounded by slicing the
|
|
60
|
+
* collection in the projection, which costs nothing and cannot 400 the call.
|
|
61
|
+
*/
|
|
62
|
+
export declare function testsRequest(buildId: number): TeamCityRequest;
|
|
63
|
+
export declare function problemsRequest(buildId: number): TeamCityRequest;
|
|
64
|
+
/** The one endpoint TeamCity serves outside `/app/rest`, in plain text. */
|
|
65
|
+
export declare function buildLogRequest(buildId: number): TeamCityRequest;
|
|
66
|
+
export declare const TEAMCITY_HANDLERS: Readonly<Record<string, TeamCityOperationHandler>>;
|
|
67
|
+
/** TeamCity dates are `yyyyMMddTHHmmss±ZZZZ`; the model gets ISO-8601. */
|
|
68
|
+
export declare function isoDate(value: string | undefined): string | undefined;
|
|
69
|
+
export interface TeamCityProjectionContext {
|
|
70
|
+
readonly flags: TeamCityFlags;
|
|
71
|
+
/**
|
|
72
|
+
* The validated tool arguments. TeamCity cannot filter by a name substring or
|
|
73
|
+
* by "archived only", so those filters are applied here, over the page the
|
|
74
|
+
* server returned; the model is told so in the tool description.
|
|
75
|
+
*/
|
|
76
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
77
|
+
/** Canonical server address, echoed so the model can link back to the UI. */
|
|
78
|
+
readonly serverUrl?: string | undefined;
|
|
79
|
+
/** Decoded path of an artifact listing, so children carry a full path. */
|
|
80
|
+
readonly artifactPath?: string | undefined;
|
|
81
|
+
}
|
|
82
|
+
export type TeamCityProjection = (data: unknown, context: TeamCityProjectionContext) => unknown;
|
|
83
|
+
export declare const TEAMCITY_PROJECTIONS: Readonly<Record<string, TeamCityProjection>>;
|
|
84
|
+
//# 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 TEAMCITY_TOOL_NAMES: readonly ["teamcity_connection_get", "teamcity_projects", "teamcity_build_configs", "teamcity_builds", "teamcity_build", "teamcity_build_changes", "teamcity_build_failures", "teamcity_build_log", "teamcity_queue", "teamcity_investigations", "teamcity_agents", "teamcity_artifacts", "teamcity_artifact_text"];
|
|
5
|
+
/**
|
|
6
|
+
* Every tool reads what the *connected* TeamCity 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 no tool schema carries a user,
|
|
9
|
+
* credential or server selector.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createTeamcityTools(options: {
|
|
12
|
+
readonly broker: IntegrationBroker;
|
|
13
|
+
readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
|
|
14
|
+
}): readonly ToolDefinition[];
|
|
15
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
2
|
+
import { type BoundedText } from "../shared/http.js";
|
|
3
|
+
import type { TeamCityFlags } from "./config.js";
|
|
4
|
+
/**
|
|
5
|
+
* Encrypted payload of one TeamCity connection: the personal access token the
|
|
6
|
+
* user pasted, and nothing else.
|
|
7
|
+
*
|
|
8
|
+
* The server it is dialled at is operator configuration, so a connection cannot
|
|
9
|
+
* be pointed anywhere by its owner and cannot outlive a deployment that
|
|
10
|
+
* repointed or removed the address. A credential stored before that move still
|
|
11
|
+
* carries the address the connect form used to collect; it is accepted and
|
|
12
|
+
* ignored, because the token is what the user owns and the deployment decides
|
|
13
|
+
* where it may be spent.
|
|
14
|
+
*/
|
|
15
|
+
export interface TeamCityCredential {
|
|
16
|
+
readonly token: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function credentialFromPlaintext(plaintext: string): TeamCityCredential;
|
|
19
|
+
/**
|
|
20
|
+
* The address this deployment dials, re-checked against the policy configured
|
|
21
|
+
* *now*: removing a host from the allowlist, or switching the deployment to
|
|
22
|
+
* HTTPS-only, therefore closes existing connections instead of only new ones.
|
|
23
|
+
* A deployment that never configured an address refuses with a reason of its
|
|
24
|
+
* own, so the card and the tools say "TeamCity is not configured here" rather
|
|
25
|
+
* than blaming the caller's token.
|
|
26
|
+
*/
|
|
27
|
+
export declare function configuredServer(flags: TeamCityFlags): string;
|
|
28
|
+
export type TeamCityTextResponse = BoundedText;
|
|
29
|
+
export type TeamCityRequestRoot = "rest" | "server";
|
|
30
|
+
/**
|
|
31
|
+
* HTTP boundary of the provider: one documented TeamCity call, bounded in time
|
|
32
|
+
* and size, with upstream failures folded into safe domain errors and bounded
|
|
33
|
+
* retries for the transient ones.
|
|
34
|
+
*/
|
|
35
|
+
export declare class TeamCityTransport {
|
|
36
|
+
private readonly config;
|
|
37
|
+
private readonly flags;
|
|
38
|
+
private readonly fetcher;
|
|
39
|
+
constructor(config: ResolvedQaIntegrationsConfig, flags: TeamCityFlags, fetcher?: typeof fetch);
|
|
40
|
+
getJson<T>(baseUrl: string, token: string, path: string, query: Readonly<Record<string, string | undefined>>, root?: TeamCityRequestRoot): Promise<T>;
|
|
41
|
+
/** Plain-text read: the build log, and an artifact read as text. */
|
|
42
|
+
getText(baseUrl: string, token: string, path: string, query: Readonly<Record<string, string | undefined>>, root: TeamCityRequestRoot, maxBytes: number, timeoutMs?: number): Promise<TeamCityTextResponse>;
|
|
43
|
+
private url;
|
|
44
|
+
private request;
|
|
45
|
+
/**
|
|
46
|
+
* The provider error model. TeamCity answers a refused permission with 403 and
|
|
47
|
+
* an unknown or hidden resource with 404; both stay distinct so the model can
|
|
48
|
+
* tell "you may not" from "it is not there", and neither ever carries an
|
|
49
|
+
* upstream body, which can be an HTML page naming internal hosts.
|
|
50
|
+
*/
|
|
51
|
+
private failure;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=transport.d.ts.map
|