@agentarea/cli 0.1.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.
Files changed (110) hide show
  1. package/dist/app.d.ts +7 -0
  2. package/dist/app.d.ts.map +1 -0
  3. package/dist/app.js +32 -0
  4. package/dist/app.js.map +1 -0
  5. package/dist/cli-commands.d.ts +9 -0
  6. package/dist/cli-commands.d.ts.map +1 -0
  7. package/dist/cli-commands.js +62 -0
  8. package/dist/cli-commands.js.map +1 -0
  9. package/dist/cli.d.ts +3 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +66 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/commands/agentsList.d.ts +2 -0
  14. package/dist/commands/agentsList.d.ts.map +1 -0
  15. package/dist/commands/agentsList.js +67 -0
  16. package/dist/commands/agentsList.js.map +1 -0
  17. package/dist/commands/authToken.d.ts +6 -0
  18. package/dist/commands/authToken.d.ts.map +1 -0
  19. package/dist/commands/authToken.js +67 -0
  20. package/dist/commands/authToken.js.map +1 -0
  21. package/dist/commands/connect.d.ts +10 -0
  22. package/dist/commands/connect.d.ts.map +1 -0
  23. package/dist/commands/connect.js +204 -0
  24. package/dist/commands/connect.js.map +1 -0
  25. package/dist/commands/interactiveTUI.d.ts +7 -0
  26. package/dist/commands/interactiveTUI.d.ts.map +1 -0
  27. package/dist/commands/interactiveTUI.js +186 -0
  28. package/dist/commands/interactiveTUI.js.map +1 -0
  29. package/dist/components/ErrorBoundary.d.ts +18 -0
  30. package/dist/components/ErrorBoundary.d.ts.map +1 -0
  31. package/dist/components/ErrorBoundary.js +32 -0
  32. package/dist/components/ErrorBoundary.js.map +1 -0
  33. package/dist/components/InteractiveCLI.d.ts +7 -0
  34. package/dist/components/InteractiveCLI.d.ts.map +1 -0
  35. package/dist/components/InteractiveCLI.js +129 -0
  36. package/dist/components/InteractiveCLI.js.map +1 -0
  37. package/dist/components/REPL.d.ts +7 -0
  38. package/dist/components/REPL.d.ts.map +1 -0
  39. package/dist/components/REPL.js +153 -0
  40. package/dist/components/REPL.js.map +1 -0
  41. package/dist/context/AuthContext.d.ts +28 -0
  42. package/dist/context/AuthContext.d.ts.map +1 -0
  43. package/dist/context/AuthContext.js +14 -0
  44. package/dist/context/AuthContext.js.map +1 -0
  45. package/dist/hooks/useAgent.d.ts +39 -0
  46. package/dist/hooks/useAgent.d.ts.map +1 -0
  47. package/dist/hooks/useAgent.js +125 -0
  48. package/dist/hooks/useAgent.js.map +1 -0
  49. package/dist/hooks/useAuth.d.ts +45 -0
  50. package/dist/hooks/useAuth.d.ts.map +1 -0
  51. package/dist/hooks/useAuth.js +177 -0
  52. package/dist/hooks/useAuth.js.map +1 -0
  53. package/dist/hooks/useSSE.d.ts +32 -0
  54. package/dist/hooks/useSSE.d.ts.map +1 -0
  55. package/dist/hooks/useSSE.js +113 -0
  56. package/dist/hooks/useSSE.js.map +1 -0
  57. package/dist/services/agent.d.ts +13 -0
  58. package/dist/services/agent.d.ts.map +1 -0
  59. package/dist/services/agent.js +114 -0
  60. package/dist/services/agent.js.map +1 -0
  61. package/dist/services/apiClient.d.ts +25 -0
  62. package/dist/services/apiClient.d.ts.map +1 -0
  63. package/dist/services/apiClient.js +258 -0
  64. package/dist/services/apiClient.js.map +1 -0
  65. package/dist/services/auth.d.ts +20 -0
  66. package/dist/services/auth.d.ts.map +1 -0
  67. package/dist/services/auth.js +147 -0
  68. package/dist/services/auth.js.map +1 -0
  69. package/dist/services/sse.d.ts +18 -0
  70. package/dist/services/sse.d.ts.map +1 -0
  71. package/dist/services/sse.js +153 -0
  72. package/dist/services/sse.js.map +1 -0
  73. package/dist/services/task.d.ts +15 -0
  74. package/dist/services/task.d.ts.map +1 -0
  75. package/dist/services/task.js +110 -0
  76. package/dist/services/task.js.map +1 -0
  77. package/dist/tui.d.ts +6 -0
  78. package/dist/tui.d.ts.map +1 -0
  79. package/dist/tui.js +94 -0
  80. package/dist/tui.js.map +1 -0
  81. package/dist/types/index.d.ts +119 -0
  82. package/dist/types/index.d.ts.map +1 -0
  83. package/dist/types/index.js +2 -0
  84. package/dist/types/index.js.map +1 -0
  85. package/dist/utils/config.d.ts +14 -0
  86. package/dist/utils/config.d.ts.map +1 -0
  87. package/dist/utils/config.js +146 -0
  88. package/dist/utils/config.js.map +1 -0
  89. package/dist/utils/error.d.ts +33 -0
  90. package/dist/utils/error.d.ts.map +1 -0
  91. package/dist/utils/error.js +83 -0
  92. package/dist/utils/error.js.map +1 -0
  93. package/dist/utils/formatting.d.ts +18 -0
  94. package/dist/utils/formatting.d.ts.map +1 -0
  95. package/dist/utils/formatting.js +62 -0
  96. package/dist/utils/formatting.js.map +1 -0
  97. package/dist/utils/logger.d.ts +14 -0
  98. package/dist/utils/logger.d.ts.map +1 -0
  99. package/dist/utils/logger.js +49 -0
  100. package/dist/utils/logger.js.map +1 -0
  101. package/dist/utils/signals.d.ts +10 -0
  102. package/dist/utils/signals.d.ts.map +1 -0
  103. package/dist/utils/signals.js +71 -0
  104. package/dist/utils/signals.js.map +1 -0
  105. package/dist/utils/storage.d.ts +11 -0
  106. package/dist/utils/storage.d.ts.map +1 -0
  107. package/dist/utils/storage.js +73 -0
  108. package/dist/utils/storage.js.map +1 -0
  109. package/package.json +103 -0
  110. package/readme.md +229 -0
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "@agentarea/cli",
3
+ "version": "0.1.0",
4
+ "description": "Interactive CLI for AgentArea — authenticate, discover agents, submit tasks, and monitor real-time execution via SSE.",
5
+ "license": "Apache-2.0",
6
+ "author": "AgentArea",
7
+ "homepage": "https://github.com/agentarea/agentarea/tree/main/agentarea-cli#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/agentarea/agentarea.git",
11
+ "directory": "agentarea-cli"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/agentarea/agentarea/issues"
15
+ },
16
+ "keywords": [
17
+ "agentarea",
18
+ "cli",
19
+ "agents",
20
+ "ai",
21
+ "ink",
22
+ "sse"
23
+ ],
24
+ "bin": {
25
+ "agentarea": "dist/cli.js"
26
+ },
27
+ "type": "module",
28
+ "engines": {
29
+ "node": ">=16"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "dependencies": {
38
+ "ink": "^4.1.0",
39
+ "meow": "^11.0.0",
40
+ "react": "^18.2.0",
41
+ "axios": "^1.16.1",
42
+ "eventsource": "^2.0.2",
43
+ "@zowe/secrets-for-zowe-sdk": "^8.8.3",
44
+ "async-exit-hook": "^2.0.1",
45
+ "conf": "^12.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@sindresorhus/tsconfig": "^8.1.0",
49
+ "@types/react": "^18.0.32",
50
+ "@types/node": "^20.0.0",
51
+ "@types/eventsource": "^1.1.11",
52
+ "@vdemedes/prettier-config": "^2.0.1",
53
+ "ava": "^5.2.0",
54
+ "chalk": "^5.2.0",
55
+ "eslint": "^9.39.4",
56
+ "eslint-config-xo-react": "^0.30.1",
57
+ "eslint-plugin-react": "^7.37.5",
58
+ "eslint-plugin-react-hooks": "^7.0.1",
59
+ "ink-testing-library": "^3.0.0",
60
+ "prettier": "^2.8.7",
61
+ "ts-node": "^10.9.2",
62
+ "typescript": "^5.9.3",
63
+ "webpack": "^5.106.1",
64
+ "xo": "^0.61.1"
65
+ },
66
+ "ava": {
67
+ "extensions": {
68
+ "ts": "module",
69
+ "tsx": "module"
70
+ },
71
+ "nodeArguments": [
72
+ "--loader=ts-node/esm"
73
+ ]
74
+ },
75
+ "xo": {
76
+ "react": true,
77
+ "semicolon": true,
78
+ "prettier": true,
79
+ "rules": {
80
+ "react/prop-types": "off",
81
+ "unicorn/expiring-todo-comments": "off"
82
+ }
83
+ },
84
+ "prettier": "@vdemedes/prettier-config",
85
+ "overrides": {
86
+ "@eslint/plugin-kit@<0.3.4": "0.7.1",
87
+ "axios@>=1.0.0 <1.15.2": "1.16.1",
88
+ "brace-expansion@<1.1.13": "1.1.14",
89
+ "brace-expansion@>=4.0.0 <5.0.6": "5.0.6",
90
+ "diff@>=4.0.0 <4.0.4": "4.0.4",
91
+ "fast-uri@<=3.1.1": "3.1.2",
92
+ "json-schema-typed@8.0.1": "8.0.2",
93
+ "minimatch@>=3.0.0 <3.1.5": "3.1.5",
94
+ "ws@>=8.0.0 <8.20.1": "8.21.0"
95
+ },
96
+ "scripts": {
97
+ "build": "tsc",
98
+ "dev": "tsc --watch",
99
+ "typecheck": "tsc --noEmit",
100
+ "lint": "prettier --check . && xo",
101
+ "test": "prettier --check . && tsc --noEmit"
102
+ }
103
+ }
package/readme.md ADDED
@@ -0,0 +1,229 @@
1
+ # agentarea-cli
2
+
3
+ Interactive CLI for Agent Management using Ink. Authenticate, discover agents, submit tasks, and monitor real-time execution output via Server-Sent Events (SSE).
4
+
5
+ ## Features
6
+
7
+ - 🔐 **Authentication**: Secure login with token persistence in OS keychain
8
+ - 👥 **Agent Discovery**: List and filter available agents by status and capabilities
9
+ - 📋 **Task Submission**: Submit tasks with configurable parameters to agents
10
+ - 🔄 **Real-time Streaming**: Monitor task execution with live output streaming via SSE
11
+ - ⌨️ **Interactive CLI**: Responsive Ink-based interface with keyboard navigation
12
+ - 🛡️ **Error Handling**: Graceful error handling with user-friendly messages
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ # Install globally
18
+ npm install --global agentarea-cli
19
+
20
+ # Or run locally
21
+ npm install
22
+ npm run build
23
+ npm start
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```bash
29
+ $ agentarea-cli
30
+
31
+ # First time: You'll be prompted to login
32
+ [?] Email: your.email@example.com
33
+ [?] Password: ••••••••
34
+
35
+ # Then: Select an agent and submit a task
36
+ [?] Select agent: Agent-1 (online)
37
+ [?] Task title: Run Analysis
38
+ [?] Parameters: {"dataset": "data.csv"}
39
+
40
+ # Finally: Watch real-time output
41
+ Running analysis...
42
+ Processing: 50%
43
+ ✓ Analysis complete!
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ ### Login
49
+
50
+ ```bash
51
+ $ agentarea-cli
52
+ # Prompts for email and password
53
+ # Token stored securely in OS keychain
54
+ ```
55
+
56
+ ### List Agents
57
+
58
+ After login, select "List Agents" to:
59
+
60
+ - View all available agents
61
+ - See agent status (online/offline/busy)
62
+ - View agent capabilities
63
+ - Filter by status or search by name
64
+
65
+ ### Submit Task
66
+
67
+ After selecting an agent:
68
+
69
+ 1. Enter task title
70
+ 2. Provide task description (optional)
71
+ 3. Configure parameters
72
+ 4. Confirm submission
73
+
74
+ ### Monitor Execution
75
+
76
+ Once task is submitted:
77
+
78
+ - Real-time stdout/stderr output displayed
79
+ - Progress indicators updated
80
+ - Status changes shown
81
+ - Completion or failure reported
82
+
83
+ ## Configuration
84
+
85
+ Create a `.env` file based on `.env.example`:
86
+
87
+ ```bash
88
+ # API Configuration
89
+ API_URL=http://localhost:3000
90
+ API_TIMEOUT=30000
91
+ MAX_RETRIES=3
92
+
93
+ # Logging
94
+ LOG_LEVEL=info
95
+
96
+ # UI
97
+ THEME=auto
98
+ ```
99
+
100
+ ## Development
101
+
102
+ ```bash
103
+ # Install dependencies
104
+ npm install
105
+
106
+ # Watch mode
107
+ npm run dev
108
+
109
+ # Build
110
+ npm run build
111
+
112
+ # Test
113
+ npm test
114
+
115
+ # Lint and format
116
+ npm run test
117
+ ```
118
+
119
+ ## Architecture
120
+
121
+ ```
122
+ source/
123
+ ├── cli.tsx # CLI entry point with meow parser
124
+ ├── app.tsx # Main application component
125
+ ├── components/ # Ink UI components
126
+ ├── services/ # API clients and business logic
127
+ ├── hooks/ # React hooks for state management
128
+ ├── context/ # React context providers
129
+ ├── utils/ # Utility functions
130
+ └── types/ # TypeScript type definitions
131
+ ```
132
+
133
+ ## API Requirements
134
+
135
+ The CLI expects the following API endpoints:
136
+
137
+ ### Authentication
138
+
139
+ - `POST /auth/login` - Login with credentials
140
+ - `POST /auth/refresh` - Refresh access token
141
+ - `POST /auth/logout` - Logout and invalidate token
142
+
143
+ ### Agents
144
+
145
+ - `GET /agents` - List available agents
146
+ - `GET /agents/{agentId}` - Get agent details
147
+ - `GET /agents/{agentId}/capabilities` - Get agent capabilities
148
+
149
+ ### Tasks
150
+
151
+ - `POST /tasks` - Submit a new task
152
+ - `GET /tasks` - List tasks
153
+ - `GET /tasks/{taskId}` - Get task details
154
+ - `DELETE /tasks/{taskId}` - Cancel a task
155
+ - `GET /sse/tasks/{taskId}` - SSE stream for task output
156
+
157
+ ## Authentication
158
+
159
+ Credentials are stored securely:
160
+
161
+ - **macOS**: Keychain
162
+ - **Linux**: Secret Service (requires `libsecret`)
163
+ - **Windows**: Credential Manager
164
+
165
+ Token is automatically:
166
+
167
+ - Retrieved on app startup
168
+ - Refreshed before expiration
169
+ - Cleared on logout
170
+
171
+ ## Keyboard Shortcuts
172
+
173
+ | Key | Action |
174
+ | ------ | ---------------- |
175
+ | ↑/↓ | Navigate options |
176
+ | Enter | Select/Submit |
177
+ | q | Back to menu |
178
+ | Escape | Cancel |
179
+ | Ctrl+C | Exit CLI |
180
+
181
+ ## Testing
182
+
183
+ ```bash
184
+ # Run all tests
185
+ npm test
186
+
187
+ # Watch mode
188
+ npm run test -- --watch
189
+
190
+ # With coverage
191
+ npm run test -- --coverage
192
+ ```
193
+
194
+ ## Troubleshooting
195
+
196
+ ### "Cannot find module"
197
+
198
+ ```bash
199
+ npm install
200
+ npm run build
201
+ ```
202
+
203
+ ### Keychain errors
204
+
205
+ ```bash
206
+ # Linux: Install libsecret
207
+ sudo apt-get install libsecret-1-dev
208
+
209
+ # Then rebuild
210
+ npm rebuild
211
+ ```
212
+
213
+ ### API connection errors
214
+
215
+ 1. Check API_URL in .env
216
+ 2. Verify API server is running
217
+ 3. Check network connectivity
218
+ 4. Enable debug logging: `LOG_LEVEL=debug`
219
+
220
+ ## License
221
+
222
+ MIT
223
+
224
+ ## See Also
225
+
226
+ - [Feature Specification](../specs/001-ink-cli/spec.md)
227
+ - [Implementation Plan](../specs/001-ink-cli/plan.md)
228
+ - [API Contracts](../specs/001-ink-cli/contracts/)
229
+ - [Data Model](../specs/001-ink-cli/data-model.md)