@tpmjs/tools-sprites-sessions 0.1.1 → 0.1.2
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 +73 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @tpmjs/sprites-sessions
|
|
2
|
+
|
|
3
|
+
List active execution sessions for a sprite.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tpmjs/sprites-sessions
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { spritesSessionsTool } from '@tpmjs/sprites-sessions';
|
|
19
|
+
|
|
20
|
+
const result = await spritesSessionsTool.execute({
|
|
21
|
+
name: 'my-sandbox'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log(result);
|
|
25
|
+
// {
|
|
26
|
+
// sessions: [
|
|
27
|
+
// { id: 'sess_123', status: 'active', startedAt: '2024-01-15T10:30:00Z', command: 'python server.py' },
|
|
28
|
+
// { id: 'sess_124', status: 'completed', startedAt: '2024-01-15T10:25:00Z' }
|
|
29
|
+
// ],
|
|
30
|
+
// count: 2
|
|
31
|
+
// }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Input Parameters
|
|
35
|
+
|
|
36
|
+
| Parameter | Type | Required | Description |
|
|
37
|
+
|-----------|------|----------|-------------|
|
|
38
|
+
| `name` | `string` | Yes | Name of the sprite to list sessions for |
|
|
39
|
+
|
|
40
|
+
## Output
|
|
41
|
+
|
|
42
|
+
| Field | Type | Description |
|
|
43
|
+
|-------|------|-------------|
|
|
44
|
+
| `sessions` | `ExecSession[]` | Array of execution sessions |
|
|
45
|
+
| `count` | `number` | Total number of sessions |
|
|
46
|
+
|
|
47
|
+
### ExecSession Object
|
|
48
|
+
|
|
49
|
+
| Field | Type | Description |
|
|
50
|
+
|-------|------|-------------|
|
|
51
|
+
| `id` | `string` | Unique session identifier |
|
|
52
|
+
| `status` | `'active' \| 'completed' \| 'terminated'` | Session status |
|
|
53
|
+
| `startedAt` | `string` | ISO 8601 timestamp when session started |
|
|
54
|
+
| `command` | `string?` | Optional command that started the session |
|
|
55
|
+
|
|
56
|
+
## Use Cases
|
|
57
|
+
|
|
58
|
+
- Monitor running commands in a sprite
|
|
59
|
+
- Check if long-running processes are still active
|
|
60
|
+
- Debug execution issues by reviewing session history
|
|
61
|
+
|
|
62
|
+
## Error Handling
|
|
63
|
+
|
|
64
|
+
The tool throws errors in these cases:
|
|
65
|
+
- `SPRITES_TOKEN` environment variable is not set
|
|
66
|
+
- Sprite not found (HTTP 404)
|
|
67
|
+
- Invalid or expired API token (HTTP 401)
|
|
68
|
+
- Network timeout (30 second limit)
|
|
69
|
+
- API errors with descriptive messages
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|