@tpmjs/tools-sprites-sessions 0.1.1 → 0.1.3
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/dist/index.js +1 -1
- package/package.json +10 -10
- package/LICENSE +0 -21
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
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var spritesSessionsTool = tool({
|
|
|
34
34
|
const controller = new AbortController();
|
|
35
35
|
const timeoutId = setTimeout(() => controller.abort(), 3e4);
|
|
36
36
|
response = await fetch(
|
|
37
|
-
`${SPRITES_API_BASE}/sprites/${encodeURIComponent(name)}/exec
|
|
37
|
+
`${SPRITES_API_BASE}/sprites/${encodeURIComponent(name)}/exec`,
|
|
38
38
|
{
|
|
39
39
|
method: "GET",
|
|
40
40
|
headers: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpmjs/tools-sprites-sessions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "List active execution sessions for a sprite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -19,10 +19,16 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup",
|
|
24
|
+
"dev": "tsup --watch",
|
|
25
|
+
"type-check": "tsc --noEmit",
|
|
26
|
+
"clean": "rm -rf dist .turbo"
|
|
27
|
+
},
|
|
22
28
|
"devDependencies": {
|
|
29
|
+
"@tpmjs/tsconfig": "workspace:*",
|
|
23
30
|
"tsup": "^8.5.1",
|
|
24
|
-
"typescript": "^5.9.3"
|
|
25
|
-
"@tpmjs/tsconfig": "0.0.0"
|
|
31
|
+
"typescript": "^5.9.3"
|
|
26
32
|
},
|
|
27
33
|
"publishConfig": {
|
|
28
34
|
"access": "public"
|
|
@@ -60,11 +66,5 @@
|
|
|
60
66
|
},
|
|
61
67
|
"dependencies": {
|
|
62
68
|
"ai": "6.0.23"
|
|
63
|
-
},
|
|
64
|
-
"scripts": {
|
|
65
|
-
"build": "tsup",
|
|
66
|
-
"dev": "tsup --watch",
|
|
67
|
-
"type-check": "tsc --noEmit",
|
|
68
|
-
"clean": "rm -rf dist .turbo"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024-2025 TPMJS
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|