@loopstack/github-oauth-example 0.3.1 → 0.4.1
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/README.md +3 -4
- package/dist/tools/authenticate-github-task.tool.d.ts +13 -5
- package/dist/tools/authenticate-github-task.tool.d.ts.map +1 -1
- package/dist/tools/authenticate-github-task.tool.js +17 -17
- package/dist/tools/authenticate-github-task.tool.js.map +1 -1
- package/dist/workflows/github-agent.ui.yaml +6 -16
- package/dist/workflows/github-agent.workflow.d.ts +44 -40
- package/dist/workflows/github-agent.workflow.d.ts.map +1 -1
- package/dist/workflows/github-agent.workflow.js +143 -195
- package/dist/workflows/github-agent.workflow.js.map +1 -1
- package/dist/workflows/github-repos-overview.workflow.d.ts +31 -28
- package/dist/workflows/github-repos-overview.workflow.d.ts.map +1 -1
- package/dist/workflows/github-repos-overview.workflow.js +92 -115
- package/dist/workflows/github-repos-overview.workflow.js.map +1 -1
- package/package.json +6 -7
- package/src/tools/authenticate-github-task.tool.ts +30 -18
- package/src/workflows/__tests__/github-repos-overview-workflow.spec.ts +18 -44
- package/src/workflows/github-agent.ui.yaml +6 -16
- package/src/workflows/github-agent.workflow.ts +134 -128
- package/src/workflows/github-repos-overview.workflow.ts +103 -150
- package/dist/workflows/github-repos-overview.ui.yaml +0 -17
- package/src/workflows/github-repos-overview.ui.yaml +0 -17
|
@@ -24,167 +24,132 @@ let GitHubReposOverviewWorkflow = class GitHubReposOverviewWorkflow extends comm
|
|
|
24
24
|
gitHubListDirectory;
|
|
25
25
|
gitHubListWorkflowRuns;
|
|
26
26
|
gitHubSearchCode;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
oAuthWorkflow;
|
|
28
|
+
constructor(gitHubGetAuthenticatedUser, gitHubListUserOrgs, gitHubGetRepo, gitHubListBranches, gitHubListIssues, gitHubListPullRequests, gitHubListDirectory, gitHubListWorkflowRuns, gitHubSearchCode, oAuthWorkflow) {
|
|
29
|
+
super();
|
|
30
|
+
this.gitHubGetAuthenticatedUser = gitHubGetAuthenticatedUser;
|
|
31
|
+
this.gitHubListUserOrgs = gitHubListUserOrgs;
|
|
32
|
+
this.gitHubGetRepo = gitHubGetRepo;
|
|
33
|
+
this.gitHubListBranches = gitHubListBranches;
|
|
34
|
+
this.gitHubListIssues = gitHubListIssues;
|
|
35
|
+
this.gitHubListPullRequests = gitHubListPullRequests;
|
|
36
|
+
this.gitHubListDirectory = gitHubListDirectory;
|
|
37
|
+
this.gitHubListWorkflowRuns = gitHubListWorkflowRuns;
|
|
38
|
+
this.gitHubSearchCode = gitHubSearchCode;
|
|
39
|
+
this.oAuthWorkflow = oAuthWorkflow;
|
|
40
|
+
}
|
|
41
|
+
async fetchUser(state, ctx) {
|
|
42
|
+
const args = ctx.args;
|
|
43
43
|
const result = await this.gitHubGetAuthenticatedUser.call();
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
return {
|
|
45
|
+
...state,
|
|
46
|
+
owner: args.owner,
|
|
47
|
+
repo: args.repo,
|
|
48
|
+
requiresAuthentication: result.data.error === 'unauthorized',
|
|
49
|
+
user: result.data.user,
|
|
50
|
+
};
|
|
46
51
|
}
|
|
47
|
-
async authRequired() {
|
|
48
|
-
const result = await this.
|
|
49
|
-
await this.
|
|
52
|
+
async authRequired(state) {
|
|
53
|
+
const result = await this.oAuthWorkflow.run({ provider: 'github', scopes: ['repo', 'read:org', 'workflow'] }, { callback: { transition: 'authCompleted' } });
|
|
54
|
+
await this.documentStore.save(common_1.LinkDocument, {
|
|
50
55
|
label: 'GitHub authentication required',
|
|
51
56
|
workflowId: result.workflowId,
|
|
52
57
|
embed: true,
|
|
53
58
|
expanded: true,
|
|
54
59
|
}, { id: `link_${result.workflowId}` });
|
|
60
|
+
return state;
|
|
55
61
|
}
|
|
56
|
-
needsAuth() {
|
|
57
|
-
return !!
|
|
62
|
+
needsAuth(state) {
|
|
63
|
+
return !!state.requiresAuthentication;
|
|
58
64
|
}
|
|
59
|
-
async authCompleted(payload) {
|
|
60
|
-
await this.
|
|
65
|
+
async authCompleted(state, payload) {
|
|
66
|
+
await this.documentStore.save(common_1.LinkDocument, {
|
|
61
67
|
status: 'success',
|
|
62
68
|
label: 'GitHub authentication completed',
|
|
63
69
|
workflowId: payload.workflowId,
|
|
64
70
|
embed: true,
|
|
65
71
|
expanded: false,
|
|
66
72
|
}, { id: `link_${payload.workflowId}` });
|
|
73
|
+
return state;
|
|
67
74
|
}
|
|
68
|
-
async fetchOrgs() {
|
|
75
|
+
async fetchOrgs(state) {
|
|
69
76
|
const result = await this.gitHubListUserOrgs.call({ perPage: 10 });
|
|
70
|
-
|
|
77
|
+
return { ...state, orgs: result.data.orgs };
|
|
71
78
|
}
|
|
72
|
-
async fetchRepoDetails() {
|
|
79
|
+
async fetchRepoDetails(state) {
|
|
73
80
|
const repoResult = await this.gitHubGetRepo.call({
|
|
74
|
-
owner:
|
|
75
|
-
repo:
|
|
81
|
+
owner: state.owner,
|
|
82
|
+
repo: state.repo,
|
|
76
83
|
});
|
|
77
|
-
this.repoDetails = repoResult.data.repo;
|
|
78
84
|
const branchesResult = await this.gitHubListBranches.call({
|
|
79
|
-
owner:
|
|
80
|
-
repo:
|
|
85
|
+
owner: state.owner,
|
|
86
|
+
repo: state.repo,
|
|
81
87
|
});
|
|
82
|
-
|
|
88
|
+
return { ...state, repoDetails: repoResult.data.repo, branches: branchesResult.data.branches };
|
|
83
89
|
}
|
|
84
|
-
async fetchIssuesPrs() {
|
|
90
|
+
async fetchIssuesPrs(state) {
|
|
85
91
|
const issuesResult = await this.gitHubListIssues.call({
|
|
86
|
-
owner:
|
|
87
|
-
repo:
|
|
92
|
+
owner: state.owner,
|
|
93
|
+
repo: state.repo,
|
|
88
94
|
state: 'open',
|
|
89
95
|
perPage: 10,
|
|
90
96
|
});
|
|
91
|
-
this.issues = issuesResult.data.issues;
|
|
92
97
|
const prsResult = await this.gitHubListPullRequests.call({
|
|
93
|
-
owner:
|
|
94
|
-
repo:
|
|
98
|
+
owner: state.owner,
|
|
99
|
+
repo: state.repo,
|
|
95
100
|
state: 'open',
|
|
96
101
|
perPage: 10,
|
|
97
102
|
});
|
|
98
|
-
|
|
103
|
+
return { ...state, issues: issuesResult.data.issues, pullRequests: prsResult.data.pullRequests };
|
|
99
104
|
}
|
|
100
|
-
async fetchContentActions() {
|
|
105
|
+
async fetchContentActions(state) {
|
|
101
106
|
const dirResult = await this.gitHubListDirectory.call({
|
|
102
|
-
owner:
|
|
103
|
-
repo:
|
|
107
|
+
owner: state.owner,
|
|
108
|
+
repo: state.repo,
|
|
104
109
|
});
|
|
105
|
-
this.directoryEntries = dirResult.data.entries;
|
|
106
110
|
const runsResult = await this.gitHubListWorkflowRuns.call({
|
|
107
|
-
owner:
|
|
108
|
-
repo:
|
|
111
|
+
owner: state.owner,
|
|
112
|
+
repo: state.repo,
|
|
109
113
|
perPage: 5,
|
|
110
114
|
});
|
|
111
|
-
|
|
115
|
+
return { ...state, directoryEntries: dirResult.data.entries, workflowRuns: runsResult.data.runs };
|
|
112
116
|
}
|
|
113
|
-
async fetchSearch() {
|
|
117
|
+
async fetchSearch(state) {
|
|
114
118
|
const result = await this.gitHubSearchCode.call({
|
|
115
|
-
query: `repo:${
|
|
119
|
+
query: `repo:${state.owner}/${state.repo}`,
|
|
116
120
|
perPage: 5,
|
|
117
121
|
});
|
|
118
|
-
|
|
122
|
+
return { ...state, searchResults: result.data.results };
|
|
119
123
|
}
|
|
120
|
-
async displayResults() {
|
|
121
|
-
await this.
|
|
124
|
+
async displayResults(state) {
|
|
125
|
+
await this.documentStore.save(common_1.MarkdownDocument, {
|
|
122
126
|
markdown: this.render(__dirname + '/templates/repoOverview.md', {
|
|
123
|
-
user:
|
|
124
|
-
orgs:
|
|
125
|
-
repo:
|
|
126
|
-
branches:
|
|
127
|
-
issues:
|
|
128
|
-
pullRequests:
|
|
129
|
-
directoryEntries:
|
|
130
|
-
workflowRuns:
|
|
131
|
-
searchResults:
|
|
127
|
+
user: state.user,
|
|
128
|
+
orgs: state.orgs,
|
|
129
|
+
repo: state.repoDetails,
|
|
130
|
+
branches: state.branches,
|
|
131
|
+
issues: state.issues,
|
|
132
|
+
pullRequests: state.pullRequests,
|
|
133
|
+
directoryEntries: state.directoryEntries,
|
|
134
|
+
workflowRuns: state.workflowRuns,
|
|
135
|
+
searchResults: state.searchResults,
|
|
132
136
|
}),
|
|
133
137
|
});
|
|
138
|
+
return {};
|
|
134
139
|
}
|
|
135
140
|
};
|
|
136
141
|
exports.GitHubReposOverviewWorkflow = GitHubReposOverviewWorkflow;
|
|
137
142
|
__decorate([
|
|
138
|
-
(0, common_1.
|
|
139
|
-
__metadata("design:type", github_module_1.GitHubGetAuthenticatedUserTool)
|
|
140
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubGetAuthenticatedUser", void 0);
|
|
141
|
-
__decorate([
|
|
142
|
-
(0, common_1.InjectTool)(),
|
|
143
|
-
__metadata("design:type", github_module_1.GitHubListUserOrgsTool)
|
|
144
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubListUserOrgs", void 0);
|
|
145
|
-
__decorate([
|
|
146
|
-
(0, common_1.InjectTool)(),
|
|
147
|
-
__metadata("design:type", github_module_1.GitHubGetRepoTool)
|
|
148
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubGetRepo", void 0);
|
|
149
|
-
__decorate([
|
|
150
|
-
(0, common_1.InjectTool)(),
|
|
151
|
-
__metadata("design:type", github_module_1.GitHubListBranchesTool)
|
|
152
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubListBranches", void 0);
|
|
153
|
-
__decorate([
|
|
154
|
-
(0, common_1.InjectTool)(),
|
|
155
|
-
__metadata("design:type", github_module_1.GitHubListIssuesTool)
|
|
156
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubListIssues", void 0);
|
|
157
|
-
__decorate([
|
|
158
|
-
(0, common_1.InjectTool)(),
|
|
159
|
-
__metadata("design:type", github_module_1.GitHubListPullRequestsTool)
|
|
160
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubListPullRequests", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
(0, common_1.InjectTool)(),
|
|
163
|
-
__metadata("design:type", github_module_1.GitHubListDirectoryTool)
|
|
164
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubListDirectory", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
(0, common_1.InjectTool)(),
|
|
167
|
-
__metadata("design:type", github_module_1.GitHubListWorkflowRunsTool)
|
|
168
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubListWorkflowRuns", void 0);
|
|
169
|
-
__decorate([
|
|
170
|
-
(0, common_1.InjectTool)(),
|
|
171
|
-
__metadata("design:type", github_module_1.GitHubSearchCodeTool)
|
|
172
|
-
], GitHubReposOverviewWorkflow.prototype, "gitHubSearchCode", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
(0, common_1.InjectWorkflow)(),
|
|
175
|
-
__metadata("design:type", oauth_module_1.OAuthWorkflow)
|
|
176
|
-
], GitHubReposOverviewWorkflow.prototype, "oAuth", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
(0, common_1.Initial)({ to: 'user_fetched' }),
|
|
143
|
+
(0, common_1.Transition)({ to: 'user_fetched' }),
|
|
179
144
|
__metadata("design:type", Function),
|
|
180
|
-
__metadata("design:paramtypes", [Object]),
|
|
145
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
181
146
|
__metadata("design:returntype", Promise)
|
|
182
147
|
], GitHubReposOverviewWorkflow.prototype, "fetchUser", null);
|
|
183
148
|
__decorate([
|
|
184
149
|
(0, common_1.Transition)({ from: 'user_fetched', to: 'awaiting_auth', priority: 10 }),
|
|
185
150
|
(0, common_1.Guard)('needsAuth'),
|
|
186
151
|
__metadata("design:type", Function),
|
|
187
|
-
__metadata("design:paramtypes", []),
|
|
152
|
+
__metadata("design:paramtypes", [Object]),
|
|
188
153
|
__metadata("design:returntype", Promise)
|
|
189
154
|
], GitHubReposOverviewWorkflow.prototype, "authRequired", null);
|
|
190
155
|
__decorate([
|
|
@@ -195,54 +160,66 @@ __decorate([
|
|
|
195
160
|
schema: common_1.CallbackSchema,
|
|
196
161
|
}),
|
|
197
162
|
__metadata("design:type", Function),
|
|
198
|
-
__metadata("design:paramtypes", [Object]),
|
|
163
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
199
164
|
__metadata("design:returntype", Promise)
|
|
200
165
|
], GitHubReposOverviewWorkflow.prototype, "authCompleted", null);
|
|
201
166
|
__decorate([
|
|
202
167
|
(0, common_1.Transition)({ from: 'user_fetched', to: 'orgs_fetched' }),
|
|
203
168
|
__metadata("design:type", Function),
|
|
204
|
-
__metadata("design:paramtypes", []),
|
|
169
|
+
__metadata("design:paramtypes", [Object]),
|
|
205
170
|
__metadata("design:returntype", Promise)
|
|
206
171
|
], GitHubReposOverviewWorkflow.prototype, "fetchOrgs", null);
|
|
207
172
|
__decorate([
|
|
208
173
|
(0, common_1.Transition)({ from: 'orgs_fetched', to: 'repo_fetched' }),
|
|
209
174
|
__metadata("design:type", Function),
|
|
210
|
-
__metadata("design:paramtypes", []),
|
|
175
|
+
__metadata("design:paramtypes", [Object]),
|
|
211
176
|
__metadata("design:returntype", Promise)
|
|
212
177
|
], GitHubReposOverviewWorkflow.prototype, "fetchRepoDetails", null);
|
|
213
178
|
__decorate([
|
|
214
179
|
(0, common_1.Transition)({ from: 'repo_fetched', to: 'issues_prs_fetched' }),
|
|
215
180
|
__metadata("design:type", Function),
|
|
216
|
-
__metadata("design:paramtypes", []),
|
|
181
|
+
__metadata("design:paramtypes", [Object]),
|
|
217
182
|
__metadata("design:returntype", Promise)
|
|
218
183
|
], GitHubReposOverviewWorkflow.prototype, "fetchIssuesPrs", null);
|
|
219
184
|
__decorate([
|
|
220
185
|
(0, common_1.Transition)({ from: 'issues_prs_fetched', to: 'content_actions_fetched' }),
|
|
221
186
|
__metadata("design:type", Function),
|
|
222
|
-
__metadata("design:paramtypes", []),
|
|
187
|
+
__metadata("design:paramtypes", [Object]),
|
|
223
188
|
__metadata("design:returntype", Promise)
|
|
224
189
|
], GitHubReposOverviewWorkflow.prototype, "fetchContentActions", null);
|
|
225
190
|
__decorate([
|
|
226
191
|
(0, common_1.Transition)({ from: 'content_actions_fetched', to: 'search_done' }),
|
|
227
192
|
__metadata("design:type", Function),
|
|
228
|
-
__metadata("design:paramtypes", []),
|
|
193
|
+
__metadata("design:paramtypes", [Object]),
|
|
229
194
|
__metadata("design:returntype", Promise)
|
|
230
195
|
], GitHubReposOverviewWorkflow.prototype, "fetchSearch", null);
|
|
231
196
|
__decorate([
|
|
232
|
-
(0, common_1.
|
|
197
|
+
(0, common_1.Transition)({ from: 'search_done', to: 'end' }),
|
|
233
198
|
__metadata("design:type", Function),
|
|
234
|
-
__metadata("design:paramtypes", []),
|
|
199
|
+
__metadata("design:paramtypes", [Object]),
|
|
235
200
|
__metadata("design:returntype", Promise)
|
|
236
201
|
], GitHubReposOverviewWorkflow.prototype, "displayResults", null);
|
|
237
202
|
exports.GitHubReposOverviewWorkflow = GitHubReposOverviewWorkflow = __decorate([
|
|
238
203
|
(0, common_1.Workflow)({
|
|
239
|
-
|
|
204
|
+
title: 'GitHub Repository Overview',
|
|
205
|
+
description: 'Comprehensive GitHub example that exercises every GitHub tool.\nFetches user info, repository details, issues, pull requests, branches,\ndirectory contents, workflow runs, and search results for a given repository.\nIf not authenticated, launches the OAuth sub-workflow and retries.',
|
|
206
|
+
name: 'github_repos_overview',
|
|
240
207
|
schema: zod_1.z
|
|
241
208
|
.object({
|
|
242
209
|
owner: zod_1.z.string().default('octocat'),
|
|
243
210
|
repo: zod_1.z.string().default('Hello-World'),
|
|
244
211
|
})
|
|
245
212
|
.strict(),
|
|
246
|
-
})
|
|
213
|
+
}),
|
|
214
|
+
__metadata("design:paramtypes", [github_module_1.GitHubGetAuthenticatedUserTool,
|
|
215
|
+
github_module_1.GitHubListUserOrgsTool,
|
|
216
|
+
github_module_1.GitHubGetRepoTool,
|
|
217
|
+
github_module_1.GitHubListBranchesTool,
|
|
218
|
+
github_module_1.GitHubListIssuesTool,
|
|
219
|
+
github_module_1.GitHubListPullRequestsTool,
|
|
220
|
+
github_module_1.GitHubListDirectoryTool,
|
|
221
|
+
github_module_1.GitHubListWorkflowRunsTool,
|
|
222
|
+
github_module_1.GitHubSearchCodeTool,
|
|
223
|
+
oauth_module_1.OAuthWorkflow])
|
|
247
224
|
], GitHubReposOverviewWorkflow);
|
|
248
225
|
//# sourceMappingURL=github-repos-overview.workflow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-repos-overview.workflow.js","sourceRoot":"","sources":["../../src/workflows/github-repos-overview.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"github-repos-overview.workflow.js","sourceRoot":"","sources":["../../src/workflows/github-repos-overview.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAAwB;AACxB,8CAQ2B;AAE3B,4DAUkC;AAClC,0DAAwD;AAmDjD,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,qBAGhD;IAEoB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAVnB,YACmB,0BAA0D,EAC1D,kBAA0C,EAC1C,aAAgC,EAChC,kBAA0C,EAC1C,gBAAsC,EACtC,sBAAkD,EAClD,mBAA4C,EAC5C,sBAAkD,EAClD,gBAAsC,EACtC,aAA4B;QAE7C,KAAK,EAAE,CAAC;QAXS,+BAA0B,GAA1B,0BAA0B,CAAgC;QAC1D,uBAAkB,GAAlB,kBAAkB,CAAwB;QAC1C,kBAAa,GAAb,aAAa,CAAmB;QAChC,uBAAkB,GAAlB,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
|
10
10
|
],
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.4.1",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"author": {
|
|
14
14
|
"name": "Jakob Klippel",
|
|
@@ -29,12 +29,11 @@
|
|
|
29
29
|
"watch": "nest build --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@loopstack/claude-module": "^0.
|
|
33
|
-
"@loopstack/llm-provider-module": "^0.
|
|
34
|
-
"@loopstack/common": "^0.
|
|
35
|
-
"@loopstack/
|
|
36
|
-
"@loopstack/
|
|
37
|
-
"@loopstack/oauth-module": "^0.3.1",
|
|
32
|
+
"@loopstack/claude-module": "^0.25.0",
|
|
33
|
+
"@loopstack/llm-provider-module": "^0.4.0",
|
|
34
|
+
"@loopstack/common": "^0.32.1",
|
|
35
|
+
"@loopstack/github-module": "^0.4.0",
|
|
36
|
+
"@loopstack/oauth-module": "^0.4.0",
|
|
38
37
|
"@nestjs/common": "^11.1.19",
|
|
39
38
|
"zod": "^4.3.6"
|
|
40
39
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { BaseTool,
|
|
3
|
+
import { BaseTool, LinkDocument, Tool, ToolCallOptions, ToolResult } from '@loopstack/common';
|
|
4
|
+
import type { LoopstackContext } from '@loopstack/common';
|
|
4
5
|
import { OAuthWorkflow } from '@loopstack/oauth-module';
|
|
5
6
|
|
|
6
7
|
const AuthenticateGitHubTaskInputSchema = z
|
|
@@ -17,29 +18,39 @@ const AuthenticateGitHubTaskInputSchema = z
|
|
|
17
18
|
|
|
18
19
|
type AuthenticateGitHubTaskInput = z.infer<typeof AuthenticateGitHubTaskInputSchema>;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
export type AuthenticateGitHubTaskResult = { workflowId: string; mode: string; [key: string]: unknown } | string;
|
|
22
|
+
|
|
21
23
|
@Tool({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
24
|
+
name: 'authenticate_github',
|
|
25
|
+
description:
|
|
26
|
+
'Launches GitHub OAuth authentication. Shows the user a sign-in prompt to authorize access to GitHub. ' +
|
|
27
|
+
'Use this when a GitHub tool returns an "unauthorized" error. ' +
|
|
28
|
+
'Pass the required OAuth scopes for the GitHub APIs you need access to. ' +
|
|
29
|
+
'IMPORTANT: When using this tool, it must be the ONLY tool call in your response. Do not combine it with other tool calls.',
|
|
29
30
|
schema: AuthenticateGitHubTaskInputSchema,
|
|
30
31
|
})
|
|
31
|
-
export class AuthenticateGitHubTask extends BaseTool
|
|
32
|
+
export class AuthenticateGitHubTask extends BaseTool<
|
|
33
|
+
AuthenticateGitHubTaskInput,
|
|
34
|
+
object,
|
|
35
|
+
AuthenticateGitHubTaskResult
|
|
36
|
+
> {
|
|
32
37
|
private readonly logger = new Logger(AuthenticateGitHubTask.name);
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
constructor(private readonly oAuthWorkflow: OAuthWorkflow) {
|
|
40
|
+
super();
|
|
41
|
+
}
|
|
35
42
|
|
|
36
|
-
async
|
|
37
|
-
|
|
43
|
+
protected async handle(
|
|
44
|
+
args: AuthenticateGitHubTaskInput,
|
|
45
|
+
ctx: LoopstackContext,
|
|
46
|
+
options?: ToolCallOptions,
|
|
47
|
+
): Promise<ToolResult<AuthenticateGitHubTaskResult>> {
|
|
48
|
+
const result = await this.oAuthWorkflow.run(
|
|
38
49
|
{ provider: 'github', scopes: args.scopes },
|
|
39
|
-
{
|
|
50
|
+
{ callback: options?.callback ?? args.callback },
|
|
40
51
|
);
|
|
41
52
|
|
|
42
|
-
await this.
|
|
53
|
+
await this.documentStore.save(
|
|
43
54
|
LinkDocument,
|
|
44
55
|
{
|
|
45
56
|
status: 'pending',
|
|
@@ -53,13 +64,14 @@ export class AuthenticateGitHubTask extends BaseTool {
|
|
|
53
64
|
|
|
54
65
|
return {
|
|
55
66
|
data: { ...result, mode: 'async' },
|
|
67
|
+
pending: { workflowId: result.workflowId },
|
|
56
68
|
};
|
|
57
69
|
}
|
|
58
70
|
|
|
59
|
-
async complete(result: Record<string, unknown>): Promise<ToolResult
|
|
71
|
+
async complete(result: Record<string, unknown>): Promise<ToolResult<AuthenticateGitHubTaskResult>> {
|
|
60
72
|
const data = result as { workflowId?: string };
|
|
61
73
|
|
|
62
|
-
await this.
|
|
74
|
+
await this.documentStore.save(
|
|
63
75
|
LinkDocument,
|
|
64
76
|
{
|
|
65
77
|
status: 'success',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TestingModule } from '@nestjs/testing';
|
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { RunContext, WorkflowEntity, getBlockArgsSchema, getBlockConfig
|
|
4
|
+
import { RunContext, WorkflowEntity, getBlockArgsSchema, getBlockConfig } from '@loopstack/common';
|
|
5
5
|
import { WorkflowProcessorService } from '@loopstack/core';
|
|
6
6
|
import {
|
|
7
7
|
GitHubCreateIssueCommentTool,
|
|
@@ -35,7 +35,7 @@ import { ToolMock, createStatelessContext, createWorkflowTest } from '@loopstack
|
|
|
35
35
|
import { GitHubReposOverviewWorkflow } from '../github-repos-overview.workflow';
|
|
36
36
|
|
|
37
37
|
const mockOAuthWorkflow = {
|
|
38
|
-
run: vi.fn(),
|
|
38
|
+
run: vi.fn().mockResolvedValue({ workflowId: 'sub-1' }),
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
function applyAllGitHubToolMocks(builder: ReturnType<typeof createWorkflowTest>) {
|
|
@@ -72,7 +72,7 @@ function buildWorkflowTest() {
|
|
|
72
72
|
createWorkflowTest()
|
|
73
73
|
.forWorkflow(GitHubReposOverviewWorkflow)
|
|
74
74
|
.withImports(OAuthModule)
|
|
75
|
-
.
|
|
75
|
+
.withOverride(OAuthWorkflow, mockOAuthWorkflow),
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -130,20 +130,16 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
130
130
|
expect(getBlockConfig(workflow)).toBeDefined();
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
it('should have GitHub tools available', () => {
|
|
134
|
-
|
|
135
|
-
expect(
|
|
136
|
-
|
|
137
|
-
expect(
|
|
138
|
-
expect(
|
|
139
|
-
expect(
|
|
140
|
-
|
|
141
|
-
expect(
|
|
142
|
-
expect(
|
|
143
|
-
expect(tools).toContain('gitHubListPullRequests');
|
|
144
|
-
expect(tools).toContain('gitHubListDirectory');
|
|
145
|
-
expect(tools).toContain('gitHubListWorkflowRuns');
|
|
146
|
-
expect(tools).toContain('gitHubSearchCode');
|
|
133
|
+
it('should have GitHub tools available via constructor injection', () => {
|
|
134
|
+
expect(mockGetAuthenticatedUser).toBeDefined();
|
|
135
|
+
expect(mockListUserOrgs).toBeDefined();
|
|
136
|
+
expect(mockGetRepo).toBeDefined();
|
|
137
|
+
expect(mockListBranches).toBeDefined();
|
|
138
|
+
expect(mockListIssues).toBeDefined();
|
|
139
|
+
expect(mockListPullRequests).toBeDefined();
|
|
140
|
+
expect(mockListDirectory).toBeDefined();
|
|
141
|
+
expect(mockListWorkflowRuns).toBeDefined();
|
|
142
|
+
expect(mockSearchCode).toBeDefined();
|
|
147
143
|
});
|
|
148
144
|
});
|
|
149
145
|
|
|
@@ -330,9 +326,7 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
330
326
|
expect(result.place).toBe('end');
|
|
331
327
|
|
|
332
328
|
// Verify markdown document was created
|
|
333
|
-
expect(result.documents).toEqual(
|
|
334
|
-
expect.arrayContaining([expect.objectContaining({ className: 'MarkdownDocument' })]),
|
|
335
|
-
);
|
|
329
|
+
expect(result.documents).toEqual(expect.arrayContaining([expect.objectContaining({ documentName: 'markdown' })]));
|
|
336
330
|
|
|
337
331
|
// Verify all read tools were called
|
|
338
332
|
expect(mockGetAuthenticatedUser.call).toHaveBeenCalledTimes(1);
|
|
@@ -352,10 +346,7 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
352
346
|
|
|
353
347
|
await processor.process(workflow, args, context);
|
|
354
348
|
|
|
355
|
-
expect(mockGetRepo.call).toHaveBeenCalledWith(
|
|
356
|
-
expect.objectContaining({ owner: 'octocat', repo: 'Hello-World' }),
|
|
357
|
-
undefined,
|
|
358
|
-
);
|
|
349
|
+
expect(mockGetRepo.call).toHaveBeenCalledWith(expect.objectContaining({ owner: 'octocat', repo: 'Hello-World' }));
|
|
359
350
|
});
|
|
360
351
|
|
|
361
352
|
it('should pass owner and repo to gitHubListBranches', async () => {
|
|
@@ -366,7 +357,6 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
366
357
|
|
|
367
358
|
expect(mockListBranches.call).toHaveBeenCalledWith(
|
|
368
359
|
expect.objectContaining({ owner: 'octocat', repo: 'Hello-World' }),
|
|
369
|
-
undefined,
|
|
370
360
|
);
|
|
371
361
|
});
|
|
372
362
|
|
|
@@ -378,7 +368,6 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
378
368
|
|
|
379
369
|
expect(mockListIssues.call).toHaveBeenCalledWith(
|
|
380
370
|
expect.objectContaining({ owner: 'octocat', repo: 'Hello-World', state: 'open' }),
|
|
381
|
-
undefined,
|
|
382
371
|
);
|
|
383
372
|
});
|
|
384
373
|
|
|
@@ -390,7 +379,6 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
390
379
|
|
|
391
380
|
expect(mockListPullRequests.call).toHaveBeenCalledWith(
|
|
392
381
|
expect.objectContaining({ owner: 'octocat', repo: 'Hello-World', state: 'open' }),
|
|
393
|
-
undefined,
|
|
394
382
|
);
|
|
395
383
|
});
|
|
396
384
|
|
|
@@ -402,7 +390,6 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
402
390
|
|
|
403
391
|
expect(mockListDirectory.call).toHaveBeenCalledWith(
|
|
404
392
|
expect.objectContaining({ owner: 'octocat', repo: 'Hello-World' }),
|
|
405
|
-
undefined,
|
|
406
393
|
);
|
|
407
394
|
});
|
|
408
395
|
|
|
@@ -414,7 +401,6 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
414
401
|
|
|
415
402
|
expect(mockListWorkflowRuns.call).toHaveBeenCalledWith(
|
|
416
403
|
expect.objectContaining({ owner: 'octocat', repo: 'Hello-World' }),
|
|
417
|
-
undefined,
|
|
418
404
|
);
|
|
419
405
|
});
|
|
420
406
|
|
|
@@ -424,10 +410,7 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
424
410
|
|
|
425
411
|
await processor.process(workflow, args, context);
|
|
426
412
|
|
|
427
|
-
expect(mockSearchCode.call).toHaveBeenCalledWith(
|
|
428
|
-
expect.objectContaining({ query: 'repo:octocat/Hello-World' }),
|
|
429
|
-
undefined,
|
|
430
|
-
);
|
|
413
|
+
expect(mockSearchCode.call).toHaveBeenCalledWith(expect.objectContaining({ query: 'repo:octocat/Hello-World' }));
|
|
431
414
|
});
|
|
432
415
|
});
|
|
433
416
|
|
|
@@ -442,10 +425,6 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
442
425
|
},
|
|
443
426
|
});
|
|
444
427
|
|
|
445
|
-
mockOAuthWorkflow.run.mockResolvedValue({
|
|
446
|
-
workflowId: 'test-workflow-id',
|
|
447
|
-
});
|
|
448
|
-
|
|
449
428
|
const result = await processor.process(workflow, { owner: 'octocat', repo: 'Hello-World' }, context);
|
|
450
429
|
|
|
451
430
|
expect(result).toBeDefined();
|
|
@@ -457,10 +436,7 @@ describe('GitHubReposOverviewWorkflow', () => {
|
|
|
457
436
|
expect(mockOAuthWorkflow.run).toHaveBeenCalledTimes(1);
|
|
458
437
|
expect(mockOAuthWorkflow.run).toHaveBeenCalledWith(
|
|
459
438
|
{ provider: 'github', scopes: ['repo', 'read:org', 'workflow'] },
|
|
460
|
-
|
|
461
|
-
alias: 'oAuth',
|
|
462
|
-
callback: { transition: 'authCompleted' },
|
|
463
|
-
}),
|
|
439
|
+
{ callback: { transition: 'authCompleted' } },
|
|
464
440
|
);
|
|
465
441
|
|
|
466
442
|
// Subsequent tools should NOT be called
|
|
@@ -570,9 +546,7 @@ describe('GitHubReposOverviewWorkflow with existing entity', () => {
|
|
|
570
546
|
expect(result.place).toBe('end');
|
|
571
547
|
|
|
572
548
|
// Verify markdown document was created after auth resume
|
|
573
|
-
expect(result.documents).toEqual(
|
|
574
|
-
expect.arrayContaining([expect.objectContaining({ className: 'MarkdownDocument' })]),
|
|
575
|
-
);
|
|
549
|
+
expect(result.documents).toEqual(expect.arrayContaining([expect.objectContaining({ documentName: 'markdown' })]));
|
|
576
550
|
|
|
577
551
|
expect(mockGetAuthenticatedUser.call).toHaveBeenCalledTimes(1);
|
|
578
552
|
expect(mockGetRepo.call).toHaveBeenCalledTimes(1);
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
the agent detects unauthorized errors and launches authentication on its own.
|
|
8
|
-
|
|
9
|
-
ui:
|
|
10
|
-
widgets:
|
|
11
|
-
- widget: prompt-input
|
|
12
|
-
enabledWhen:
|
|
13
|
-
- waiting_for_user
|
|
14
|
-
options:
|
|
15
|
-
transition: userMessage
|
|
16
|
-
label: Send Message
|
|
1
|
+
widget: prompt-input
|
|
2
|
+
enabledWhen:
|
|
3
|
+
- waiting_for_user
|
|
4
|
+
options:
|
|
5
|
+
transition: userMessage
|
|
6
|
+
label: Send Message
|