@cmdop/core 0.1.1
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 +86 -0
- package/dist/index.cjs +6753 -0
- package/dist/index.d.cts +6502 -0
- package/dist/index.d.ts +6502 -0
- package/dist/index.js +6703 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @cmdop/core
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types, interfaces, and configuration for the CMDOP SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @cmdop/core
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @cmdop/core
|
|
11
|
+
# or
|
|
12
|
+
yarn add @cmdop/core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
This package provides shared code between `@cmdop/node` and `@cmdop/react` packages:
|
|
18
|
+
|
|
19
|
+
- TypeScript interfaces and types
|
|
20
|
+
- Error classes
|
|
21
|
+
- Configuration types
|
|
22
|
+
- HTTP API clients (optional, for REST API)
|
|
23
|
+
|
|
24
|
+
**Note:** This package has no protobuf/gRPC dependencies to keep the bundle small for browser usage.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### Types & Errors
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import {
|
|
32
|
+
// Types
|
|
33
|
+
CMDOPConfig,
|
|
34
|
+
SessionInfo,
|
|
35
|
+
FileInfo,
|
|
36
|
+
AgentEvent,
|
|
37
|
+
|
|
38
|
+
// Errors
|
|
39
|
+
CMDOPError,
|
|
40
|
+
ConnectionError,
|
|
41
|
+
AuthenticationError,
|
|
42
|
+
SessionError,
|
|
43
|
+
TimeoutError,
|
|
44
|
+
NotFoundError,
|
|
45
|
+
PermissionError,
|
|
46
|
+
|
|
47
|
+
// Config
|
|
48
|
+
DEFAULT_CONFIG,
|
|
49
|
+
} from '@cmdop/core';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### HTTP API Clients (Optional)
|
|
53
|
+
|
|
54
|
+
HTTP API clients for the CMDOP REST API. These are provided for convenience if you need to manage machines, workspaces, etc. via REST.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { api } from '@cmdop/core';
|
|
58
|
+
|
|
59
|
+
// Set JWT token (from OAuth or API key exchange)
|
|
60
|
+
api.machines.setToken('jwt-token');
|
|
61
|
+
|
|
62
|
+
// Use REST API
|
|
63
|
+
const list = await api.machines.machines_machines.machinesList();
|
|
64
|
+
const machine = await api.machines.machines_machines.machinesRetrieve({ id: 'machine-id' });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Pre-configured for `https://api.cmdop.com`. For a custom URL:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { MachinesModule } from '@cmdop/core';
|
|
71
|
+
|
|
72
|
+
const customApi = new MachinesModule.API('https://custom.api.com');
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Related Packages
|
|
76
|
+
|
|
77
|
+
- [@cmdop/node](https://www.npmjs.com/package/@cmdop/node) - Node.js SDK with gRPC (terminal, files, agent)
|
|
78
|
+
- [@cmdop/react](https://www.npmjs.com/package/@cmdop/react) - React hooks for browser-based interaction
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
For full documentation, visit [https://cmdop.com/docs](https://cmdop.com/docs)
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|