@hanhnd/agent-kit 1.0.42 → 1.0.44

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.
@@ -1,6 +1,158 @@
1
1
  /**
2
- * Integration Tools - Bitbucket, Jira
3
- * Tools: kit_get_bitbucket_pr, kit_jira_get_ticket
2
+ * Integration Tools - Bitbucket, Jira, Confluence
3
+ * Tools: kit_get_bitbucket_pr, kit_create_bitbucket_pr, kit_find_bitbucket_reviewers, kit_get_bitbucket_pr_comments, kit_jira_get_ticket, kit_confluence_get_page
4
4
  */
5
5
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
+ /**
7
+ * Payload size (chars) at or above which a body is spilled to a temp file
8
+ * instead of inlined into the agent context.
9
+ */
10
+ export declare const LARGE_PAYLOAD_THRESHOLD = 50000;
11
+ export type ConfluenceIdResolution = {
12
+ kind: 'id';
13
+ pageId: string;
14
+ } | {
15
+ kind: 'tiny';
16
+ } | {
17
+ kind: 'blog';
18
+ } | {
19
+ kind: 'unknown';
20
+ };
21
+ export interface AtlassianContext {
22
+ auth: string;
23
+ cloudId: string;
24
+ }
25
+ /**
26
+ * API token scopes each tool needs, from Atlassian's OpenAPI specs (`x-atlassian-oauth2-scopes`).
27
+ * Used for 401/403 hints; mcp/README.md lists the same scopes for setup.
28
+ */
29
+ export declare const REQUIRED_SCOPES: {
30
+ readonly kit_get_bitbucket_pr: readonly ["read:pullrequest:bitbucket", "read:repository:bitbucket"];
31
+ readonly kit_get_bitbucket_pr_comments: readonly ["read:pullrequest:bitbucket"];
32
+ readonly kit_create_bitbucket_pr: readonly ["read:pullrequest:bitbucket", "write:pullrequest:bitbucket", "read:workspace:bitbucket", "read:user:bitbucket"];
33
+ readonly kit_find_bitbucket_reviewers: readonly ["read:workspace:bitbucket", "read:user:bitbucket"];
34
+ readonly kit_jira_get_ticket: readonly ["read:jira-work"];
35
+ readonly kit_confluence_get_page: readonly ["read:page:confluence"];
36
+ };
37
+ /** Resolve the shared cloud id plus the product's basic-auth header (shared email, own token). */
38
+ export declare function buildAtlassianContext(product: 'jira' | 'confluence'): AtlassianContext;
39
+ /**
40
+ * Resolve a user-supplied Confluence reference to a numeric page id.
41
+ *
42
+ * The blog branch MUST stay ahead of numeric extraction: a blog URL carries date and
43
+ * post-id segments that generic extraction would misread as a page id, silently
44
+ * fetching the wrong content.
45
+ */
46
+ export declare function resolveConfluencePageId(input: string): ConfluenceIdResolution;
47
+ /**
48
+ * Handler for kit_confluence_get_page. Exported (rather than living inside the
49
+ * registerTool closure) so behaviour is unit testable without a transport or network.
50
+ * Never rejects — every failure path resolves to an actionable mcpText message.
51
+ */
52
+ export declare function handleConfluenceGetPage(args: {
53
+ input: string;
54
+ }): Promise<{
55
+ content: [{
56
+ type: 'text';
57
+ text: string;
58
+ }];
59
+ }>;
60
+ /** Safety cap on followed pagination pages (100 items each). */
61
+ export declare const MAX_PAGES = 20;
62
+ export type BitbucketRef<T> = ({
63
+ ok: true;
64
+ } & T) | {
65
+ ok: false;
66
+ error: string;
67
+ };
68
+ /** Resolve a PR URL, or a numeric PR id plus workspace/repoSlug, to its coordinates. */
69
+ export declare function resolveBitbucketPr(input: string, workspace?: string, repoSlug?: string): BitbucketRef<{
70
+ ws: string;
71
+ repo: string;
72
+ prId: number;
73
+ }>;
74
+ /** Resolve a repo URL, `workspace/repo`, or a bare repo slug (plus workspace or default) to its coordinates. */
75
+ export declare function resolveBitbucketRepo(repository: string, workspace?: string): BitbucketRef<{
76
+ ws: string;
77
+ repo: string;
78
+ }>;
79
+ export interface BitbucketMember {
80
+ uuid: string;
81
+ displayName: string;
82
+ nickname?: string;
83
+ }
84
+ export interface ReviewerResolution {
85
+ resolved: Array<{
86
+ query: string;
87
+ member: BitbucketMember;
88
+ }>;
89
+ ambiguous: Array<{
90
+ query: string;
91
+ candidates: BitbucketMember[];
92
+ }>;
93
+ unmatched: string[];
94
+ }
95
+ /** Lowercase and strip diacritics so "Dũng" matches "Dung" and "Đức" matches "Duc". */
96
+ export declare function normalizeName(value: string): string;
97
+ /**
98
+ * Match reviewer queries against workspace members. A query matches a member by exact
99
+ * display name / nickname first; failing that, when every word of the query is a whole
100
+ * word of the member's name ("Dung" → "Nguyen Tien Dung"). More than one hit is ambiguous —
101
+ * never guessed. UUID queries must be resolved by the caller before this runs.
102
+ */
103
+ export declare function matchReviewers(queries: string[], members: BitbucketMember[]): ReviewerResolution;
104
+ export interface FindBitbucketReviewersArgs {
105
+ names: string[];
106
+ workspace?: string;
107
+ }
108
+ /**
109
+ * Handler for kit_find_bitbucket_reviewers: dry-run of the reviewer resolution that
110
+ * kit_create_bitbucket_pr performs, so callers can verify names before pushing anything.
111
+ * Never rejects — every failure path resolves to an actionable mcpText message.
112
+ */
113
+ export declare function handleFindBitbucketReviewers(args: FindBitbucketReviewersArgs): Promise<{
114
+ content: [{
115
+ type: 'text';
116
+ text: string;
117
+ }];
118
+ }>;
119
+ export interface CreateBitbucketPrArgs {
120
+ repository: string;
121
+ workspace?: string;
122
+ title: string;
123
+ sourceBranch: string;
124
+ destinationBranch?: string;
125
+ description?: string;
126
+ closeSourceBranch?: boolean;
127
+ draft?: boolean;
128
+ reviewers?: string[];
129
+ }
130
+ /**
131
+ * Handler for kit_create_bitbucket_pr. Exported so it is unit testable without a transport.
132
+ * Never rejects — every failure path resolves to an actionable mcpText message.
133
+ */
134
+ export declare function handleCreateBitbucketPr(args: CreateBitbucketPrArgs): Promise<{
135
+ content: [{
136
+ type: 'text';
137
+ text: string;
138
+ }];
139
+ }>;
140
+ export interface GetBitbucketPrCommentsArgs {
141
+ input: string;
142
+ workspace?: string;
143
+ repoSlug?: string;
144
+ includeResolved?: boolean;
145
+ includeDeleted?: boolean;
146
+ }
147
+ /**
148
+ * Handler for kit_get_bitbucket_pr_comments. Follows `next` links (pagelen=100) up to
149
+ * MAX_PAGES, then renders threads: general comments first, inline ones grouped by file.
150
+ * Never rejects — every failure path resolves to an actionable mcpText message.
151
+ */
152
+ export declare function handleGetBitbucketPrComments(args: GetBitbucketPrCommentsArgs): Promise<{
153
+ content: [{
154
+ type: 'text';
155
+ text: string;
156
+ }];
157
+ }>;
6
158
  export declare function registerIntegrationTools(server: McpServer): void;