agentuity-vscode 0.0.86
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/.vscode/launch.json +26 -0
- package/.vscode/tasks.json +22 -0
- package/.vscodeignore +22 -0
- package/LICENSE +21 -0
- package/README.md +156 -0
- package/package.json +476 -0
- package/resources/icon.png +0 -0
- package/resources/icon.svg +1 -0
- package/src/core/auth.ts +128 -0
- package/src/core/baseTreeDataProvider.ts +92 -0
- package/src/core/cliClient.ts +777 -0
- package/src/core/index.ts +5 -0
- package/src/core/project.ts +98 -0
- package/src/core/readonlyDocument.ts +57 -0
- package/src/core/service.ts +208 -0
- package/src/extension.ts +260 -0
- package/src/features/agentExplorer/agentTreeData.ts +149 -0
- package/src/features/agentExplorer/index.ts +105 -0
- package/src/features/chat/agentuityParticipant.ts +838 -0
- package/src/features/chat/cliTool.ts +91 -0
- package/src/features/chat/index.ts +2 -0
- package/src/features/codeLens/agentCodeLensProvider.ts +116 -0
- package/src/features/codeLens/index.ts +132 -0
- package/src/features/dataExplorer/dataTreeData.ts +480 -0
- package/src/features/dataExplorer/index.ts +362 -0
- package/src/features/deploymentExplorer/deploymentTreeData.ts +238 -0
- package/src/features/deploymentExplorer/index.ts +107 -0
- package/src/features/devServer/devServerManager.ts +258 -0
- package/src/features/devServer/index.ts +52 -0
- package/src/features/workbench/index.ts +19 -0
- package/tsconfig.json +20 -0
package/package.json
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agentuity-vscode",
|
|
3
|
+
"displayName": "Agentuity VSCode Extension",
|
|
4
|
+
"description": "Build, deploy, and manage AI agents with Agentuity",
|
|
5
|
+
"version": "0.0.86",
|
|
6
|
+
"publisher": "agentuity",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/agentuity/sdk"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"vscode": "^1.90.0"
|
|
14
|
+
},
|
|
15
|
+
"categories": [
|
|
16
|
+
"Other",
|
|
17
|
+
"Snippets"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"agentuity",
|
|
21
|
+
"ai",
|
|
22
|
+
"agents",
|
|
23
|
+
"llm"
|
|
24
|
+
],
|
|
25
|
+
"icon": "resources/icon.png",
|
|
26
|
+
"activationEvents": [
|
|
27
|
+
"onStartupFinished"
|
|
28
|
+
],
|
|
29
|
+
"main": "./dist/extension.js",
|
|
30
|
+
"contributes": {
|
|
31
|
+
"commands": [
|
|
32
|
+
{
|
|
33
|
+
"command": "agentuity.login",
|
|
34
|
+
"title": "Login",
|
|
35
|
+
"category": "Agentuity"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"command": "agentuity.logout",
|
|
39
|
+
"title": "Logout",
|
|
40
|
+
"category": "Agentuity"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"command": "agentuity.whoami",
|
|
44
|
+
"title": "Who Am I?",
|
|
45
|
+
"category": "Agentuity"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"command": "agentuity.refresh",
|
|
49
|
+
"title": "Refresh All",
|
|
50
|
+
"category": "Agentuity",
|
|
51
|
+
"icon": "$(refresh)"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"command": "agentuity.agents.refresh",
|
|
55
|
+
"title": "Refresh Agents",
|
|
56
|
+
"category": "Agentuity",
|
|
57
|
+
"icon": "$(refresh)"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"command": "agentuity.deployments.refresh",
|
|
61
|
+
"title": "Refresh Deployments",
|
|
62
|
+
"category": "Agentuity",
|
|
63
|
+
"icon": "$(refresh)"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"command": "agentuity.data.refresh",
|
|
67
|
+
"title": "Refresh Data",
|
|
68
|
+
"category": "Agentuity",
|
|
69
|
+
"icon": "$(refresh)"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"command": "agentuity.dev.start",
|
|
73
|
+
"title": "Start Dev Server",
|
|
74
|
+
"category": "Agentuity"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"command": "agentuity.dev.stop",
|
|
78
|
+
"title": "Stop Dev Server",
|
|
79
|
+
"category": "Agentuity"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"command": "agentuity.dev.restart",
|
|
83
|
+
"title": "Restart Dev Server",
|
|
84
|
+
"category": "Agentuity"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"command": "agentuity.dev.showLogs",
|
|
88
|
+
"title": "Show Dev Server Logs",
|
|
89
|
+
"category": "Agentuity"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"command": "agentuity.workbench.open",
|
|
93
|
+
"title": "Open Workbench",
|
|
94
|
+
"category": "Agentuity"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"command": "agentuity.deploy",
|
|
98
|
+
"title": "Deploy",
|
|
99
|
+
"category": "Agentuity"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"command": "agentuity.getAiCapabilities",
|
|
103
|
+
"title": "Get AI Capabilities (JSON)",
|
|
104
|
+
"category": "Agentuity"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"command": "agentuity.getAiSchema",
|
|
108
|
+
"title": "Get AI Schema (JSON)",
|
|
109
|
+
"category": "Agentuity"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"command": "agentuity.deployment.viewLogs",
|
|
113
|
+
"title": "View Deployment Logs",
|
|
114
|
+
"category": "Agentuity",
|
|
115
|
+
"icon": "$(output)"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"command": "agentuity.deployment.showDetails",
|
|
119
|
+
"title": "Show Deployment Details",
|
|
120
|
+
"category": "Agentuity",
|
|
121
|
+
"icon": "$(info)"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"command": "agentuity.db.copyConnectionString",
|
|
125
|
+
"title": "Copy Connection String",
|
|
126
|
+
"category": "Agentuity",
|
|
127
|
+
"icon": "$(copy)"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"command": "agentuity.db.openConnectionUri",
|
|
131
|
+
"title": "Open Connection URI",
|
|
132
|
+
"category": "Agentuity",
|
|
133
|
+
"icon": "$(link-external)"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"command": "agentuity.db.viewLogs",
|
|
137
|
+
"title": "View Database Logs",
|
|
138
|
+
"category": "Agentuity",
|
|
139
|
+
"icon": "$(output)"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"command": "agentuity.vector.search",
|
|
143
|
+
"title": "Search Vectors",
|
|
144
|
+
"category": "Agentuity",
|
|
145
|
+
"icon": "$(search)"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"command": "agentuity.vector.clearSearches",
|
|
149
|
+
"title": "Clear Vector Searches",
|
|
150
|
+
"category": "Agentuity",
|
|
151
|
+
"icon": "$(clear-all)"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"command": "agentuity.agent.goToFile",
|
|
155
|
+
"title": "Go to Source File",
|
|
156
|
+
"category": "Agentuity",
|
|
157
|
+
"icon": "$(go-to-file)"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"command": "agentuity.agent.viewSessions",
|
|
161
|
+
"title": "View Sessions",
|
|
162
|
+
"category": "Agentuity",
|
|
163
|
+
"icon": "$(pulse)"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"command": "agentuity.agent.viewSessionLogs",
|
|
167
|
+
"title": "View Session Logs",
|
|
168
|
+
"category": "Agentuity",
|
|
169
|
+
"icon": "$(output)"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"command": "agentuity.installCli",
|
|
173
|
+
"title": "Install CLI",
|
|
174
|
+
"category": "Agentuity"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"command": "agentuity.createProject",
|
|
178
|
+
"title": "Create Project",
|
|
179
|
+
"category": "Agentuity"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"command": "agentuity.codeLens.openInWorkbench",
|
|
183
|
+
"title": "Open Agent in Workbench",
|
|
184
|
+
"category": "Agentuity"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"command": "agentuity.codeLens.viewSessions",
|
|
188
|
+
"title": "View Agent Sessions",
|
|
189
|
+
"category": "Agentuity"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"viewsContainers": {
|
|
193
|
+
"activitybar": [
|
|
194
|
+
{
|
|
195
|
+
"id": "agentuity",
|
|
196
|
+
"title": "Agentuity",
|
|
197
|
+
"icon": "resources/icon.svg"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
"views": {
|
|
202
|
+
"agentuity": [
|
|
203
|
+
{
|
|
204
|
+
"id": "agentuity.agents",
|
|
205
|
+
"name": "Agents",
|
|
206
|
+
"contextualTitle": "Agentuity Agents"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"id": "agentuity.deployments",
|
|
210
|
+
"name": "Deployments",
|
|
211
|
+
"contextualTitle": "Agentuity Deployments"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": "agentuity.data",
|
|
215
|
+
"name": "Data",
|
|
216
|
+
"contextualTitle": "Agentuity Data"
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"menus": {
|
|
221
|
+
"view/title": [
|
|
222
|
+
{
|
|
223
|
+
"command": "agentuity.agents.refresh",
|
|
224
|
+
"when": "view == agentuity.agents",
|
|
225
|
+
"group": "navigation"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"command": "agentuity.deploy",
|
|
229
|
+
"when": "view == agentuity.agents && agentuity.hasProject",
|
|
230
|
+
"group": "1_actions"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"command": "agentuity.dev.start",
|
|
234
|
+
"when": "view == agentuity.agents && agentuity.hasProject && !agentuity.devServerRunning",
|
|
235
|
+
"group": "1_actions"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"command": "agentuity.dev.stop",
|
|
239
|
+
"when": "view == agentuity.agents && agentuity.devServerRunning",
|
|
240
|
+
"group": "1_actions"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"command": "agentuity.workbench.open",
|
|
244
|
+
"when": "view == agentuity.agents && agentuity.hasProject",
|
|
245
|
+
"group": "2_links"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"command": "agentuity.deployments.refresh",
|
|
249
|
+
"when": "view == agentuity.deployments",
|
|
250
|
+
"group": "navigation"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"command": "agentuity.data.refresh",
|
|
254
|
+
"when": "view == agentuity.data",
|
|
255
|
+
"group": "navigation"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"view/item/context": [
|
|
259
|
+
{
|
|
260
|
+
"command": "agentuity.deployment.viewLogs",
|
|
261
|
+
"when": "view == agentuity.deployments && viewItem == deployment",
|
|
262
|
+
"group": "inline"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"command": "agentuity.deployment.showDetails",
|
|
266
|
+
"when": "view == agentuity.deployments && viewItem == deployment",
|
|
267
|
+
"group": "context"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"command": "agentuity.db.copyConnectionString",
|
|
271
|
+
"when": "view == agentuity.data && viewItem == database",
|
|
272
|
+
"group": "inline"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"command": "agentuity.db.openConnectionUri",
|
|
276
|
+
"when": "view == agentuity.data && viewItem == database",
|
|
277
|
+
"group": "context"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"command": "agentuity.db.viewLogs",
|
|
281
|
+
"when": "view == agentuity.data && viewItem == database",
|
|
282
|
+
"group": "context"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"command": "agentuity.vector.search",
|
|
286
|
+
"when": "view == agentuity.data && viewItem == category-vector",
|
|
287
|
+
"group": "inline"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"command": "agentuity.vector.clearSearches",
|
|
291
|
+
"when": "view == agentuity.data && viewItem == vectorSearchGroup",
|
|
292
|
+
"group": "context"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"command": "agentuity.agent.viewSessions",
|
|
296
|
+
"when": "view == agentuity.agents && viewItem == agent",
|
|
297
|
+
"group": "inline"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"command": "agentuity.agent.goToFile",
|
|
301
|
+
"when": "view == agentuity.agents && viewItem == agent",
|
|
302
|
+
"group": "1_navigation"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"command": "agentuity.agent.viewSessions",
|
|
306
|
+
"when": "view == agentuity.agents && viewItem == agent",
|
|
307
|
+
"group": "2_actions"
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
"configuration": {
|
|
312
|
+
"title": "Agentuity",
|
|
313
|
+
"properties": {
|
|
314
|
+
"agentuity.cliPath": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"default": "",
|
|
317
|
+
"description": "Path to the Agentuity CLI executable. Leave empty to use PATH."
|
|
318
|
+
},
|
|
319
|
+
"agentuity.devServer.port": {
|
|
320
|
+
"type": "number",
|
|
321
|
+
"default": 3500,
|
|
322
|
+
"description": "Default port for the dev server."
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"chatParticipants": [
|
|
327
|
+
{
|
|
328
|
+
"id": "agentuity.assistant",
|
|
329
|
+
"name": "agentuity",
|
|
330
|
+
"fullName": "Agentuity Assistant",
|
|
331
|
+
"description": "Help with building and managing Agentuity agents",
|
|
332
|
+
"isSticky": false,
|
|
333
|
+
"commands": [
|
|
334
|
+
{
|
|
335
|
+
"name": "help",
|
|
336
|
+
"description": "Show CLI reference and getting started guide"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "agents",
|
|
340
|
+
"description": "List agents in this project"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"name": "deploy",
|
|
344
|
+
"description": "Deploy to Agentuity Cloud"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"name": "dev",
|
|
348
|
+
"description": "Start or stop the dev server"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"name": "sessions",
|
|
352
|
+
"description": "Show recent sessions"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"name": "status",
|
|
356
|
+
"description": "Show project and auth status"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"name": "kv",
|
|
360
|
+
"description": "List KV namespaces or keys in a namespace"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"name": "db",
|
|
364
|
+
"description": "List databases with connection info"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"name": "vector",
|
|
368
|
+
"description": "Search vectors in a namespace"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"name": "deployments",
|
|
372
|
+
"description": "List deployments with details"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"name": "logs",
|
|
376
|
+
"description": "View logs for a session"
|
|
377
|
+
}
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
],
|
|
381
|
+
"languageModelTools": [
|
|
382
|
+
{
|
|
383
|
+
"name": "agentuity_run_cli",
|
|
384
|
+
"displayName": "Run Agentuity CLI",
|
|
385
|
+
"toolReferenceName": "agentuity-cli",
|
|
386
|
+
"icon": "$(terminal)",
|
|
387
|
+
"userDescription": "Execute Agentuity CLI commands to manage agents and cloud resources",
|
|
388
|
+
"modelDescription": "Execute an Agentuity CLI command. Use this to run CLI commands like 'cloud agent list', 'cloud session list', 'ai capabilities show', etc. The command should be the subcommand and arguments only, not 'agentuity' itself. Destructive commands (delete, logout) are blocked.",
|
|
389
|
+
"canBeReferencedInPrompt": true,
|
|
390
|
+
"inputSchema": {
|
|
391
|
+
"type": "object",
|
|
392
|
+
"properties": {
|
|
393
|
+
"command": {
|
|
394
|
+
"type": "string",
|
|
395
|
+
"description": "The Agentuity CLI subcommand and arguments (e.g., 'cloud agent list', 'cloud session list --count 10')"
|
|
396
|
+
},
|
|
397
|
+
"jsonOutput": {
|
|
398
|
+
"type": "boolean",
|
|
399
|
+
"description": "Whether to request JSON output from the CLI (default: true)",
|
|
400
|
+
"default": true
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"required": [
|
|
404
|
+
"command"
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
"walkthroughs": [
|
|
410
|
+
{
|
|
411
|
+
"id": "gettingStarted",
|
|
412
|
+
"title": "Getting Started with Agentuity",
|
|
413
|
+
"description": "Set up the CLI, login, and deploy your first agent.",
|
|
414
|
+
"steps": [
|
|
415
|
+
{
|
|
416
|
+
"id": "installCli",
|
|
417
|
+
"title": "Install the Agentuity CLI",
|
|
418
|
+
"description": "The CLI is required for all Agentuity features.\n\nRun `bun install -g @agentuity/cli` to install.\n\n[Install CLI](command:agentuity.installCli)",
|
|
419
|
+
"completionEvents": [
|
|
420
|
+
"onContext:agentuity.cliInstalled"
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"id": "login",
|
|
425
|
+
"title": "Login to Agentuity",
|
|
426
|
+
"description": "Authenticate with your Agentuity account.\n\nRun `agentuity auth login` in your terminal.\n\n[Login](command:agentuity.login)",
|
|
427
|
+
"completionEvents": [
|
|
428
|
+
"onContext:agentuity.authenticated"
|
|
429
|
+
]
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"id": "createProject",
|
|
433
|
+
"title": "Create or Open a Project",
|
|
434
|
+
"description": "Create a new project or open an existing one.\n\nRun `agentuity project new` to create a new project.\n\n[Create Project](command:agentuity.createProject)",
|
|
435
|
+
"completionEvents": [
|
|
436
|
+
"onContext:agentuity.hasProject"
|
|
437
|
+
]
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"id": "startDev",
|
|
441
|
+
"title": "Start the Dev Server",
|
|
442
|
+
"description": "Run your agents locally.\n\nThe dev server lets you test agents locally.\n\n[Start Dev Server](command:agentuity.dev.start)",
|
|
443
|
+
"completionEvents": [
|
|
444
|
+
"onCommand:agentuity.dev.start"
|
|
445
|
+
]
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"id": "deploy",
|
|
449
|
+
"title": "Deploy to Agentuity Cloud",
|
|
450
|
+
"description": "Deploy your agents to production.\n\nDeploy to make your agents available online.\n\n[Deploy](command:agentuity.deploy)",
|
|
451
|
+
"completionEvents": [
|
|
452
|
+
"onCommand:agentuity.deploy"
|
|
453
|
+
]
|
|
454
|
+
}
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
]
|
|
458
|
+
},
|
|
459
|
+
"scripts": {
|
|
460
|
+
"build": "bun run compile",
|
|
461
|
+
"compile": "bunx esbuild ./src/extension.ts --bundle --outfile=./dist/extension.js --platform=node --format=cjs --external:vscode --main-fields=module,main",
|
|
462
|
+
"watch": "bunx esbuild ./src/extension.ts --bundle --outfile=./dist/extension.js --platform=node --format=cjs --external:vscode --main-fields=module,main --watch",
|
|
463
|
+
"typecheck": "bunx tsc --noEmit",
|
|
464
|
+
"vscode:prepublish": "bun run build",
|
|
465
|
+
"package": "bunx @vscode/vsce package --no-dependencies",
|
|
466
|
+
"clean": "rm -rf dist *.vsix"
|
|
467
|
+
},
|
|
468
|
+
"devDependencies": {
|
|
469
|
+
"@types/vscode": "^1.90.0",
|
|
470
|
+
"@vscode/vsce": "^3.3.2",
|
|
471
|
+
"typescript": "^5.9.0"
|
|
472
|
+
},
|
|
473
|
+
"dependencies": {
|
|
474
|
+
"jsonc-parser": "^3.3.1"
|
|
475
|
+
}
|
|
476
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="220" height="191" viewBox="0 0 220 191" fill="none" xmlns="http://www.w3.org/2000/svg"><title>Agentuity</title><path fill-rule="evenodd" clip-rule="evenodd" d="M220 191H0L31.427 136.5H0L8 122.5H180.5L220 191ZM47.5879 136.5L24.2339 177H195.766L172.412 136.5H47.5879Z" fill="#000"/><path fill-rule="evenodd" clip-rule="evenodd" d="M110 0L157.448 82.5H189L197 96.5H54.5L110 0ZM78.7021 82.5L110 28.0811L141.298 82.5H78.7021Z" fill="#000"/></svg>
|
package/src/core/auth.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as vscode from 'vscode';
|
|
2
|
+
import { getCliClient, type WhoamiResponse } from './cliClient';
|
|
3
|
+
|
|
4
|
+
export type AuthState = 'unknown' | 'authenticated' | 'unauthenticated' | 'cli-missing' | 'error';
|
|
5
|
+
|
|
6
|
+
export interface AuthStatus {
|
|
7
|
+
state: AuthState;
|
|
8
|
+
user?: WhoamiResponse;
|
|
9
|
+
error?: string;
|
|
10
|
+
cliVersion?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let _authStatus: AuthStatus = { state: 'unknown' };
|
|
14
|
+
const _onAuthStatusChanged = new vscode.EventEmitter<AuthStatus>();
|
|
15
|
+
export const onAuthStatusChanged = _onAuthStatusChanged.event;
|
|
16
|
+
|
|
17
|
+
export function getAuthStatus(): AuthStatus {
|
|
18
|
+
return _authStatus;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function setAuthStatus(status: AuthStatus): void {
|
|
22
|
+
_authStatus = status;
|
|
23
|
+
_onAuthStatusChanged.fire(status);
|
|
24
|
+
void vscode.commands.executeCommand(
|
|
25
|
+
'setContext',
|
|
26
|
+
'agentuity.authenticated',
|
|
27
|
+
status.state === 'authenticated'
|
|
28
|
+
);
|
|
29
|
+
void vscode.commands.executeCommand(
|
|
30
|
+
'setContext',
|
|
31
|
+
'agentuity.cliInstalled',
|
|
32
|
+
status.state !== 'cli-missing'
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function checkAuth(): Promise<AuthStatus> {
|
|
37
|
+
const cli = getCliClient();
|
|
38
|
+
|
|
39
|
+
const versionResult = await cli.version();
|
|
40
|
+
if (!versionResult.success) {
|
|
41
|
+
if (versionResult.error?.includes('ENOENT') || versionResult.error?.includes('not found')) {
|
|
42
|
+
const status: AuthStatus = { state: 'cli-missing', error: 'Agentuity CLI not found' };
|
|
43
|
+
setAuthStatus(status);
|
|
44
|
+
return status;
|
|
45
|
+
}
|
|
46
|
+
const status: AuthStatus = { state: 'error', error: versionResult.error };
|
|
47
|
+
setAuthStatus(status);
|
|
48
|
+
return status;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const cliVersion = typeof versionResult.data === 'string' ? versionResult.data : undefined;
|
|
52
|
+
|
|
53
|
+
const whoamiResult = await cli.whoami();
|
|
54
|
+
if (!whoamiResult.success) {
|
|
55
|
+
if (
|
|
56
|
+
whoamiResult.error?.toLowerCase().includes('unauthorized') ||
|
|
57
|
+
whoamiResult.error?.toLowerCase().includes('not logged in') ||
|
|
58
|
+
whoamiResult.error?.toLowerCase().includes('401')
|
|
59
|
+
) {
|
|
60
|
+
const status: AuthStatus = { state: 'unauthenticated', cliVersion };
|
|
61
|
+
setAuthStatus(status);
|
|
62
|
+
return status;
|
|
63
|
+
}
|
|
64
|
+
const status: AuthStatus = { state: 'error', error: whoamiResult.error, cliVersion };
|
|
65
|
+
setAuthStatus(status);
|
|
66
|
+
return status;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const status: AuthStatus = {
|
|
70
|
+
state: 'authenticated',
|
|
71
|
+
user: whoamiResult.data,
|
|
72
|
+
cliVersion,
|
|
73
|
+
};
|
|
74
|
+
setAuthStatus(status);
|
|
75
|
+
return status;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function promptLogin(): Promise<void> {
|
|
79
|
+
const status = getAuthStatus();
|
|
80
|
+
|
|
81
|
+
if (status.state === 'cli-missing') {
|
|
82
|
+
const action = await vscode.window.showErrorMessage(
|
|
83
|
+
'Agentuity CLI not found. Please install it first.',
|
|
84
|
+
'View Install Instructions',
|
|
85
|
+
'Copy Install Command'
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if (action === 'View Install Instructions') {
|
|
89
|
+
void vscode.env.openExternal(vscode.Uri.parse('https://agentuity.com/docs/cli'));
|
|
90
|
+
} else if (action === 'Copy Install Command') {
|
|
91
|
+
await vscode.env.clipboard.writeText('bun install -g @agentuity/cli');
|
|
92
|
+
vscode.window.showInformationMessage('Install command copied to clipboard');
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (status.state === 'unauthenticated') {
|
|
98
|
+
const action = await vscode.window.showWarningMessage(
|
|
99
|
+
'You are not logged in to Agentuity.',
|
|
100
|
+
'Login via Terminal'
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (action === 'Login via Terminal') {
|
|
104
|
+
const terminal = vscode.window.createTerminal('Agentuity Login');
|
|
105
|
+
terminal.sendText('agentuity auth login');
|
|
106
|
+
terminal.show();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function requireAuth(): Promise<boolean> {
|
|
112
|
+
let status = getAuthStatus();
|
|
113
|
+
|
|
114
|
+
// If auth state is unknown, check it first
|
|
115
|
+
if (status.state === 'unknown') {
|
|
116
|
+
status = await checkAuth();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (status.state !== 'authenticated') {
|
|
120
|
+
void promptLogin();
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function disposeAuth(): void {
|
|
127
|
+
_onAuthStatusChanged.dispose();
|
|
128
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as vscode from 'vscode';
|
|
2
|
+
import { getAuthStatus } from './auth';
|
|
3
|
+
import { hasProject } from './project';
|
|
4
|
+
|
|
5
|
+
export abstract class BaseTreeItem extends vscode.TreeItem {
|
|
6
|
+
constructor(
|
|
7
|
+
public readonly label: string,
|
|
8
|
+
public readonly collapsibleState: vscode.TreeItemCollapsibleState
|
|
9
|
+
) {
|
|
10
|
+
super(label, collapsibleState);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface TreeDataProviderState {
|
|
15
|
+
loading: boolean;
|
|
16
|
+
error: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export abstract class BaseTreeDataProvider<T extends BaseTreeItem>
|
|
20
|
+
implements vscode.TreeDataProvider<T>
|
|
21
|
+
{
|
|
22
|
+
protected _onDidChangeTreeData = new vscode.EventEmitter<T | undefined | null | void>();
|
|
23
|
+
readonly onDidChangeTreeData = this._onDidChangeTreeData.event;
|
|
24
|
+
|
|
25
|
+
protected loading = false;
|
|
26
|
+
protected error: string | undefined;
|
|
27
|
+
|
|
28
|
+
refresh(): void {
|
|
29
|
+
this._onDidChangeTreeData.fire();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getTreeItem(element: T): vscode.TreeItem {
|
|
33
|
+
return element;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
abstract getChildren(element?: T): Promise<T[]>;
|
|
37
|
+
|
|
38
|
+
protected abstract createMessageItem(message: string): T;
|
|
39
|
+
|
|
40
|
+
protected abstract loadData(): Promise<void>;
|
|
41
|
+
|
|
42
|
+
protected checkAuthAndProject(): T[] | null {
|
|
43
|
+
const authStatus = getAuthStatus();
|
|
44
|
+
|
|
45
|
+
if (authStatus.state === 'unknown') {
|
|
46
|
+
return [this.createMessageItem('Checking auth...')];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (authStatus.state === 'cli-missing') {
|
|
50
|
+
return [this.createMessageItem('CLI not installed')];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (authStatus.state === 'unauthenticated') {
|
|
54
|
+
return [this.createMessageItem('Not logged in')];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!hasProject()) {
|
|
58
|
+
return [this.createMessageItem('No project detected')];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected getLoadingItems(): T[] {
|
|
65
|
+
return [this.createMessageItem('Loading...')];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
protected getErrorItems(): T[] {
|
|
69
|
+
return [this.createMessageItem(`Error: ${this.error}`)];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
protected getEmptyItems(message = 'No items found'): T[] {
|
|
73
|
+
return [this.createMessageItem(message)];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async forceRefresh(): Promise<void> {
|
|
77
|
+
this.error = undefined;
|
|
78
|
+
await this.loadData();
|
|
79
|
+
this.refresh();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getState(): TreeDataProviderState {
|
|
83
|
+
return {
|
|
84
|
+
loading: this.loading,
|
|
85
|
+
error: this.error,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
dispose(): void {
|
|
90
|
+
this._onDidChangeTreeData.dispose();
|
|
91
|
+
}
|
|
92
|
+
}
|