@loopstack/github-oauth-example 0.3.1 → 0.4.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.
@@ -8,13 +8,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.GitHubReposOverviewWorkflow = void 0;
16
+ const common_1 = require("@nestjs/common");
13
17
  const zod_1 = require("zod");
14
- const common_1 = require("@loopstack/common");
18
+ const common_2 = require("@loopstack/common");
15
19
  const github_module_1 = require("@loopstack/github-module");
16
20
  const oauth_module_1 = require("@loopstack/oauth-module");
17
- let GitHubReposOverviewWorkflow = class GitHubReposOverviewWorkflow extends common_1.BaseWorkflow {
21
+ let GitHubReposOverviewWorkflow = class GitHubReposOverviewWorkflow extends common_2.BaseWorkflow {
18
22
  gitHubGetAuthenticatedUser;
19
23
  gitHubListUserOrgs;
20
24
  gitHubGetRepo;
@@ -24,225 +28,205 @@ let GitHubReposOverviewWorkflow = class GitHubReposOverviewWorkflow extends comm
24
28
  gitHubListDirectory;
25
29
  gitHubListWorkflowRuns;
26
30
  gitHubSearchCode;
27
- oAuth;
28
- owner;
29
- repo;
30
- requiresAuthentication;
31
- user;
32
- orgs;
33
- repoDetails;
34
- branches;
35
- issues;
36
- pullRequests;
37
- directoryEntries;
38
- workflowRuns;
39
- searchResults;
40
- async fetchUser(args) {
41
- this.owner = args.owner;
42
- this.repo = args.repo;
31
+ oAuthWorkflow;
32
+ render;
33
+ constructor(gitHubGetAuthenticatedUser, gitHubListUserOrgs, gitHubGetRepo, gitHubListBranches, gitHubListIssues, gitHubListPullRequests, gitHubListDirectory, gitHubListWorkflowRuns, gitHubSearchCode, oAuthWorkflow, render) {
34
+ super();
35
+ this.gitHubGetAuthenticatedUser = gitHubGetAuthenticatedUser;
36
+ this.gitHubListUserOrgs = gitHubListUserOrgs;
37
+ this.gitHubGetRepo = gitHubGetRepo;
38
+ this.gitHubListBranches = gitHubListBranches;
39
+ this.gitHubListIssues = gitHubListIssues;
40
+ this.gitHubListPullRequests = gitHubListPullRequests;
41
+ this.gitHubListDirectory = gitHubListDirectory;
42
+ this.gitHubListWorkflowRuns = gitHubListWorkflowRuns;
43
+ this.gitHubSearchCode = gitHubSearchCode;
44
+ this.oAuthWorkflow = oAuthWorkflow;
45
+ this.render = render;
46
+ }
47
+ async fetchUser(state, ctx) {
48
+ const args = ctx.args;
43
49
  const result = await this.gitHubGetAuthenticatedUser.call();
44
- this.requiresAuthentication = result.data.error === 'unauthorized';
45
- this.user = result.data.user;
50
+ return {
51
+ ...state,
52
+ owner: args.owner,
53
+ repo: args.repo,
54
+ requiresAuthentication: result.data.error === 'unauthorized',
55
+ user: result.data.user,
56
+ };
46
57
  }
47
- async authRequired() {
48
- const result = await this.oAuth.run({ provider: 'github', scopes: ['repo', 'read:org', 'workflow'] }, { alias: 'oAuth', callback: { transition: 'authCompleted' } });
49
- await this.repository.save(common_1.LinkDocument, {
58
+ async authRequired(state) {
59
+ const result = await this.oAuthWorkflow.run({ provider: 'github', scopes: ['repo', 'read:org', 'workflow'] }, { callback: { transition: 'authCompleted' } });
60
+ await this.documentStore.save(common_2.LinkDocument, {
50
61
  label: 'GitHub authentication required',
51
62
  workflowId: result.workflowId,
52
63
  embed: true,
53
64
  expanded: true,
54
65
  }, { id: `link_${result.workflowId}` });
66
+ return state;
55
67
  }
56
- needsAuth() {
57
- return !!this.requiresAuthentication;
68
+ needsAuth(state) {
69
+ return !!state.requiresAuthentication;
58
70
  }
59
- async authCompleted(payload) {
60
- await this.repository.save(common_1.LinkDocument, {
71
+ async authCompleted(state, payload) {
72
+ await this.documentStore.save(common_2.LinkDocument, {
61
73
  status: 'success',
62
74
  label: 'GitHub authentication completed',
63
75
  workflowId: payload.workflowId,
64
76
  embed: true,
65
77
  expanded: false,
66
78
  }, { id: `link_${payload.workflowId}` });
79
+ return state;
67
80
  }
68
- async fetchOrgs() {
81
+ async fetchOrgs(state) {
69
82
  const result = await this.gitHubListUserOrgs.call({ perPage: 10 });
70
- this.orgs = result.data.orgs;
83
+ return { ...state, orgs: result.data.orgs };
71
84
  }
72
- async fetchRepoDetails() {
85
+ async fetchRepoDetails(state) {
73
86
  const repoResult = await this.gitHubGetRepo.call({
74
- owner: this.owner,
75
- repo: this.repo,
87
+ owner: state.owner,
88
+ repo: state.repo,
76
89
  });
77
- this.repoDetails = repoResult.data.repo;
78
90
  const branchesResult = await this.gitHubListBranches.call({
79
- owner: this.owner,
80
- repo: this.repo,
91
+ owner: state.owner,
92
+ repo: state.repo,
81
93
  });
82
- this.branches = branchesResult.data.branches;
94
+ return { ...state, repoDetails: repoResult.data.repo, branches: branchesResult.data.branches };
83
95
  }
84
- async fetchIssuesPrs() {
96
+ async fetchIssuesPrs(state) {
85
97
  const issuesResult = await this.gitHubListIssues.call({
86
- owner: this.owner,
87
- repo: this.repo,
98
+ owner: state.owner,
99
+ repo: state.repo,
88
100
  state: 'open',
89
101
  perPage: 10,
90
102
  });
91
- this.issues = issuesResult.data.issues;
92
103
  const prsResult = await this.gitHubListPullRequests.call({
93
- owner: this.owner,
94
- repo: this.repo,
104
+ owner: state.owner,
105
+ repo: state.repo,
95
106
  state: 'open',
96
107
  perPage: 10,
97
108
  });
98
- this.pullRequests = prsResult.data.pullRequests;
109
+ return { ...state, issues: issuesResult.data.issues, pullRequests: prsResult.data.pullRequests };
99
110
  }
100
- async fetchContentActions() {
111
+ async fetchContentActions(state) {
101
112
  const dirResult = await this.gitHubListDirectory.call({
102
- owner: this.owner,
103
- repo: this.repo,
113
+ owner: state.owner,
114
+ repo: state.repo,
104
115
  });
105
- this.directoryEntries = dirResult.data.entries;
106
116
  const runsResult = await this.gitHubListWorkflowRuns.call({
107
- owner: this.owner,
108
- repo: this.repo,
117
+ owner: state.owner,
118
+ repo: state.repo,
109
119
  perPage: 5,
110
120
  });
111
- this.workflowRuns = runsResult.data.runs;
121
+ return { ...state, directoryEntries: dirResult.data.entries, workflowRuns: runsResult.data.runs };
112
122
  }
113
- async fetchSearch() {
123
+ async fetchSearch(state) {
114
124
  const result = await this.gitHubSearchCode.call({
115
- query: `repo:${this.owner}/${this.repo}`,
125
+ query: `repo:${state.owner}/${state.repo}`,
116
126
  perPage: 5,
117
127
  });
118
- this.searchResults = result.data.results;
128
+ return { ...state, searchResults: result.data.results };
119
129
  }
120
- async displayResults() {
121
- await this.repository.save(common_1.MarkdownDocument, {
130
+ async displayResults(state) {
131
+ await this.documentStore.save(common_2.MarkdownDocument, {
122
132
  markdown: this.render(__dirname + '/templates/repoOverview.md', {
123
- user: this.user,
124
- orgs: this.orgs,
125
- repo: this.repoDetails,
126
- branches: this.branches,
127
- issues: this.issues,
128
- pullRequests: this.pullRequests,
129
- directoryEntries: this.directoryEntries,
130
- workflowRuns: this.workflowRuns,
131
- searchResults: this.searchResults,
133
+ user: state.user,
134
+ orgs: state.orgs,
135
+ repo: state.repoDetails,
136
+ branches: state.branches,
137
+ issues: state.issues,
138
+ pullRequests: state.pullRequests,
139
+ directoryEntries: state.directoryEntries,
140
+ workflowRuns: state.workflowRuns,
141
+ searchResults: state.searchResults,
132
142
  }),
133
143
  });
144
+ return {};
134
145
  }
135
146
  };
136
147
  exports.GitHubReposOverviewWorkflow = GitHubReposOverviewWorkflow;
137
148
  __decorate([
138
- (0, common_1.InjectTool)(),
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' }),
149
+ (0, common_2.Transition)({ to: 'user_fetched' }),
179
150
  __metadata("design:type", Function),
180
- __metadata("design:paramtypes", [Object]),
151
+ __metadata("design:paramtypes", [Object, Object]),
181
152
  __metadata("design:returntype", Promise)
182
153
  ], GitHubReposOverviewWorkflow.prototype, "fetchUser", null);
183
154
  __decorate([
184
- (0, common_1.Transition)({ from: 'user_fetched', to: 'awaiting_auth', priority: 10 }),
185
- (0, common_1.Guard)('needsAuth'),
155
+ (0, common_2.Transition)({ from: 'user_fetched', to: 'awaiting_auth', priority: 10 }),
156
+ (0, common_2.Guard)('needsAuth'),
186
157
  __metadata("design:type", Function),
187
- __metadata("design:paramtypes", []),
158
+ __metadata("design:paramtypes", [Object]),
188
159
  __metadata("design:returntype", Promise)
189
160
  ], GitHubReposOverviewWorkflow.prototype, "authRequired", null);
190
161
  __decorate([
191
- (0, common_1.Transition)({
162
+ (0, common_2.Transition)({
192
163
  from: 'awaiting_auth',
193
164
  to: 'start',
194
165
  wait: true,
195
- schema: common_1.CallbackSchema,
166
+ schema: common_2.CallbackSchema,
196
167
  }),
197
168
  __metadata("design:type", Function),
198
- __metadata("design:paramtypes", [Object]),
169
+ __metadata("design:paramtypes", [Object, Object]),
199
170
  __metadata("design:returntype", Promise)
200
171
  ], GitHubReposOverviewWorkflow.prototype, "authCompleted", null);
201
172
  __decorate([
202
- (0, common_1.Transition)({ from: 'user_fetched', to: 'orgs_fetched' }),
173
+ (0, common_2.Transition)({ from: 'user_fetched', to: 'orgs_fetched' }),
203
174
  __metadata("design:type", Function),
204
- __metadata("design:paramtypes", []),
175
+ __metadata("design:paramtypes", [Object]),
205
176
  __metadata("design:returntype", Promise)
206
177
  ], GitHubReposOverviewWorkflow.prototype, "fetchOrgs", null);
207
178
  __decorate([
208
- (0, common_1.Transition)({ from: 'orgs_fetched', to: 'repo_fetched' }),
179
+ (0, common_2.Transition)({ from: 'orgs_fetched', to: 'repo_fetched' }),
209
180
  __metadata("design:type", Function),
210
- __metadata("design:paramtypes", []),
181
+ __metadata("design:paramtypes", [Object]),
211
182
  __metadata("design:returntype", Promise)
212
183
  ], GitHubReposOverviewWorkflow.prototype, "fetchRepoDetails", null);
213
184
  __decorate([
214
- (0, common_1.Transition)({ from: 'repo_fetched', to: 'issues_prs_fetched' }),
185
+ (0, common_2.Transition)({ from: 'repo_fetched', to: 'issues_prs_fetched' }),
215
186
  __metadata("design:type", Function),
216
- __metadata("design:paramtypes", []),
187
+ __metadata("design:paramtypes", [Object]),
217
188
  __metadata("design:returntype", Promise)
218
189
  ], GitHubReposOverviewWorkflow.prototype, "fetchIssuesPrs", null);
219
190
  __decorate([
220
- (0, common_1.Transition)({ from: 'issues_prs_fetched', to: 'content_actions_fetched' }),
191
+ (0, common_2.Transition)({ from: 'issues_prs_fetched', to: 'content_actions_fetched' }),
221
192
  __metadata("design:type", Function),
222
- __metadata("design:paramtypes", []),
193
+ __metadata("design:paramtypes", [Object]),
223
194
  __metadata("design:returntype", Promise)
224
195
  ], GitHubReposOverviewWorkflow.prototype, "fetchContentActions", null);
225
196
  __decorate([
226
- (0, common_1.Transition)({ from: 'content_actions_fetched', to: 'search_done' }),
197
+ (0, common_2.Transition)({ from: 'content_actions_fetched', to: 'search_done' }),
227
198
  __metadata("design:type", Function),
228
- __metadata("design:paramtypes", []),
199
+ __metadata("design:paramtypes", [Object]),
229
200
  __metadata("design:returntype", Promise)
230
201
  ], GitHubReposOverviewWorkflow.prototype, "fetchSearch", null);
231
202
  __decorate([
232
- (0, common_1.Final)({ from: 'search_done' }),
203
+ (0, common_2.Transition)({ from: 'search_done', to: 'end' }),
233
204
  __metadata("design:type", Function),
234
- __metadata("design:paramtypes", []),
205
+ __metadata("design:paramtypes", [Object]),
235
206
  __metadata("design:returntype", Promise)
236
207
  ], GitHubReposOverviewWorkflow.prototype, "displayResults", null);
237
208
  exports.GitHubReposOverviewWorkflow = GitHubReposOverviewWorkflow = __decorate([
238
- (0, common_1.Workflow)({
239
- uiConfig: __dirname + '/github-repos-overview.ui.yaml',
209
+ (0, common_2.Workflow)({
210
+ title: 'GitHub Repository Overview',
211
+ 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.',
212
+ name: 'github_repos_overview',
240
213
  schema: zod_1.z
241
214
  .object({
242
215
  owner: zod_1.z.string().default('octocat'),
243
216
  repo: zod_1.z.string().default('Hello-World'),
244
217
  })
245
218
  .strict(),
246
- })
219
+ }),
220
+ __param(10, (0, common_1.Inject)(common_2.TEMPLATE_RENDERER)),
221
+ __metadata("design:paramtypes", [github_module_1.GitHubGetAuthenticatedUserTool,
222
+ github_module_1.GitHubListUserOrgsTool,
223
+ github_module_1.GitHubGetRepoTool,
224
+ github_module_1.GitHubListBranchesTool,
225
+ github_module_1.GitHubListIssuesTool,
226
+ github_module_1.GitHubListPullRequestsTool,
227
+ github_module_1.GitHubListDirectoryTool,
228
+ github_module_1.GitHubListWorkflowRunsTool,
229
+ github_module_1.GitHubSearchCodeTool,
230
+ oauth_module_1.OAuthWorkflow, Function])
247
231
  ], GitHubReposOverviewWorkflow);
248
232
  //# 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,8CAa2B;AAC3B,4DAUkC;AAClC,0DAAwD;AAwEjD,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,qBAA6C;IAEtE,0BAA0B,CAAiC;IAC3D,kBAAkB,CAAyB;IAC3C,aAAa,CAAoB;IACjC,kBAAkB,CAAyB;IAC3C,gBAAgB,CAAuB;IACvC,sBAAsB,CAA6B;IACnD,mBAAmB,CAA0B;IAC7C,sBAAsB,CAA6B;IACnD,gBAAgB,CAAuB;IAE3C,KAAK,CAAgB;IAEvC,KAAK,CAAU;IACf,IAAI,CAAU;IACd,sBAAsB,CAAW;IACjC,IAAI,CAAgF;IACpF,IAAI,CAAwD;IAC5D,WAAW,CAST;IACF,QAAQ,CAA+C;IACvD,MAAM,CAA0F;IAChG,YAAY,CAOT;IACH,gBAAgB,CAAuD;IACvE,YAAY,CAMT;IACH,aAAa,CAA6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E,IAAI;QACV,MAAM,EAAE,uBAAc;KACvB,CAAC;;;;gEAaD;AAKK;IADL,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC;;;;4DAIxD;AAKK;IADL,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC;;;;mEAaxD;AAKK;IADL,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,oBAAoB,EAAE,CAAC;;;;iEAiB9D;AAKK;IADL,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,EAAE,yBAAyB,EAAE,CAAC;;;;sEAczE;AAKK;IADL,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,yBAAyB,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC;;;;8DAOlE;AAKK;IADL,IAAA,cAAK,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;;;;iEAe9B;sCArMU,2BAA2B;IATvC,IAAA,iBAAQ,EAAC;QACR,QAAQ,EAAE,SAAS,GAAG,gCAAgC;QACtD,MAAM,EAAE,OAAC;aACN,MAAM,CAAC;YACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;YACpC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;SACxC,CAAC;aACD,MAAM,EAAE;KACZ,CAAC;GACW,2BAA2B,CAsMvC"}
1
+ {"version":3,"file":"github-repos-overview.workflow.js","sourceRoot":"","sources":["../../src/workflows/github-repos-overview.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAS2B;AAE3B,4DAUkC;AAClC,0DAAwD;AAmDjD,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,qBAGhD;IAEoB;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AAE,CAAC,OAAO,CAAC,SAAS,CAAC;YACpC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;SACxC,CAAC;aACD,MAAM,EAAE;KACZ,CAAC;IAgBG,YAAA,IAAA,eAAM,EAAC,0BAAiB,CAAC,CAAA;qCAVmB,8CAA8B;QACtC,sCAAsB;QAC3B,iCAAiB;QACZ,sCAAsB;QACxB,oCAAoB;QACd,0CAA0B;QAC7B,uCAAuB;QACpB,0CAA0B;QAChC,oCAAoB;QACvB,4BAAa;GAdpC,2BAA2B,CAiLvC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "loopstack",
9
9
  "oauth"
10
10
  ],
11
- "version": "0.3.1",
11
+ "version": "0.4.0",
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.24.1",
33
- "@loopstack/llm-provider-module": "^0.3.1",
34
- "@loopstack/common": "^0.31.0",
35
- "@loopstack/core": "^0.31.0",
36
- "@loopstack/github-module": "^0.3.1",
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.0",
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 { Injectable, Logger } from '@nestjs/common';
1
+ import { Logger } from '@nestjs/common';
2
2
  import { z } from 'zod';
3
- import { BaseTool, InjectWorkflow, LinkDocument, Tool, ToolResult } from '@loopstack/common';
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
- @Injectable()
21
+ export type AuthenticateGitHubTaskResult = { workflowId: string; mode: string; [key: string]: unknown } | string;
22
+
21
23
  @Tool({
22
- uiConfig: {
23
- description:
24
- 'Launches GitHub OAuth authentication. Shows the user a sign-in prompt to authorize access to GitHub. ' +
25
- 'Use this when a GitHub tool returns an "unauthorized" error. ' +
26
- 'Pass the required OAuth scopes for the GitHub APIs you need access to. ' +
27
- 'IMPORTANT: When using this tool, it must be the ONLY tool call in your response. Do not combine it with other tool calls.',
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
- @InjectWorkflow() private oAuth: OAuthWorkflow;
39
+ constructor(private readonly oAuthWorkflow: OAuthWorkflow) {
40
+ super();
41
+ }
35
42
 
36
- async call(args: AuthenticateGitHubTaskInput): Promise<ToolResult> {
37
- const result = await this.oAuth.run(
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
- { alias: 'oAuth', callback: args.callback },
50
+ { callback: options?.callback ?? args.callback },
40
51
  );
41
52
 
42
- await this.repository.save(
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.repository.save(
74
+ await this.documentStore.save(
63
75
  LinkDocument,
64
76
  {
65
77
  status: 'success',