@loopstack/github-module 0.4.2 → 0.4.4
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 +6 -17
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ The fastest way to use GitHub tools is through `AgentWorkflow` — pass tool nam
|
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
56
|
import { AgentWorkflow } from '@loopstack/agent';
|
|
57
|
-
import { BaseWorkflow,
|
|
57
|
+
import { BaseWorkflow, Transition, Workflow } from '@loopstack/common';
|
|
58
58
|
|
|
59
59
|
@Workflow({ title: 'GitHub Assistant' })
|
|
60
60
|
export class GitHubAssistantWorkflow extends BaseWorkflow {
|
|
@@ -64,7 +64,7 @@ export class GitHubAssistantWorkflow extends BaseWorkflow {
|
|
|
64
64
|
|
|
65
65
|
@Transition({ to: 'chatting' })
|
|
66
66
|
async start(state: Record<string, unknown>): Promise<Record<string, unknown>> {
|
|
67
|
-
|
|
67
|
+
await this.agent.run(
|
|
68
68
|
{
|
|
69
69
|
system: 'You are a GitHub assistant. Help the user manage repos, issues, PRs, and actions.',
|
|
70
70
|
tools: [
|
|
@@ -80,13 +80,7 @@ export class GitHubAssistantWorkflow extends BaseWorkflow {
|
|
|
80
80
|
],
|
|
81
81
|
userMessage: 'List my five most recently updated repositories.',
|
|
82
82
|
},
|
|
83
|
-
{ callback: { transition: 'agentDone' } },
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
await this.documentStore.save(
|
|
87
|
-
LinkDocument,
|
|
88
|
-
{ label: 'Working...', workflowId: result.workflowId, embed: true, expanded: true },
|
|
89
|
-
{ id: `link_${result.workflowId}` },
|
|
83
|
+
{ callback: { transition: 'agentDone' }, show: 'inline', label: 'Working...' },
|
|
90
84
|
);
|
|
91
85
|
return state;
|
|
92
86
|
}
|
|
@@ -101,7 +95,7 @@ For full control over the auth flow, inject the individual tools and `OAuthWorkf
|
|
|
101
95
|
|
|
102
96
|
```typescript
|
|
103
97
|
import { z } from 'zod';
|
|
104
|
-
import { BaseWorkflow, CallbackSchema, Guard,
|
|
98
|
+
import { BaseWorkflow, CallbackSchema, Guard, Transition, Workflow } from '@loopstack/common';
|
|
105
99
|
import type { RunContext } from '@loopstack/common';
|
|
106
100
|
import { GitHubGetAuthenticatedUserTool, GitHubListReposTool } from '@loopstack/github-module';
|
|
107
101
|
import { OAuthWorkflow } from '@loopstack/oauth-module';
|
|
@@ -134,14 +128,9 @@ export class MyGitHubWorkflow extends BaseWorkflow<Record<string, unknown>, Stat
|
|
|
134
128
|
@Transition({ from: 'user_checked', to: 'awaiting_auth', priority: 10 })
|
|
135
129
|
@Guard('needsAuth')
|
|
136
130
|
async startAuth(state: State): Promise<State> {
|
|
137
|
-
|
|
131
|
+
await this.oAuthWorkflow.run(
|
|
138
132
|
{ provider: 'github', scopes: ['repo', 'read:org', 'workflow'] },
|
|
139
|
-
{ callback: { transition: 'authCompleted' } },
|
|
140
|
-
);
|
|
141
|
-
await this.documentStore.save(
|
|
142
|
-
LinkDocument,
|
|
143
|
-
{ label: 'GitHub authentication required', workflowId: result.workflowId, embed: true, expanded: true },
|
|
144
|
-
{ id: `link_${result.workflowId}` },
|
|
133
|
+
{ callback: { transition: 'authCompleted' }, show: 'inline', label: 'GitHub authentication required' },
|
|
145
134
|
);
|
|
146
135
|
return state;
|
|
147
136
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"module",
|
|
10
10
|
"oauth"
|
|
11
11
|
],
|
|
12
|
-
"version": "0.4.
|
|
12
|
+
"version": "0.4.4",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": {
|
|
15
15
|
"name": "Jakob Klippel",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"watch": "nest build --watch"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loopstack/common": "^0.
|
|
36
|
-
"@loopstack/oauth-module": "^0.4.
|
|
35
|
+
"@loopstack/common": "^0.35.0",
|
|
36
|
+
"@loopstack/oauth-module": "^0.4.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"zod": "^4.3.6"
|