@pstdio/pocketcoder-sdk 0.3.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) PocketCoder contributors
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.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # `@pstdio/pocketcoder-sdk`
2
+
3
+ The Node ESM SDK for the PocketCoder control plane. It ships built JavaScript
4
+ and declarations, so consumers do not need Bun, a TypeScript loader, or access
5
+ to PocketCoder's private workspace packages.
6
+
7
+ Runtime-validated TypeScript client for the PocketCoder control-plane API. It
8
+ uses platform `fetch`, composes timeouts with caller abort signals, validates
9
+ successful and error responses, and exposes typed pagination. Retryable
10
+ transport failures and 408/425/429/5xx responses are retried only for reads or
11
+ mutations carrying an `Idempotency-Key`; configure the bounded retry count with
12
+ `maxRetries` (default `2`).
13
+
14
+ ```ts
15
+ import { PocketCoderClient } from "@pstdio/pocketcoder-sdk";
16
+
17
+ const client = new PocketCoderClient({
18
+ baseUrl: "https://pocketcoder.example.com",
19
+ apiKey: process.env.POCKETCODER_KEY!,
20
+ });
21
+
22
+ for await (const workspace of client.workspaces.all({ state: "ready" })) {
23
+ console.log(workspace.id, workspace.agent_state);
24
+ }
25
+
26
+ const terminal = client.terminals.connect("workspace-id");
27
+ terminal.onMessage((message) => {
28
+ if (message.type === "output") process.stdout.write(Buffer.from(message.data_b64, "base64"));
29
+ });
30
+ ```
31
+
32
+ `client.terminals.connect(id, { sessionId })` opens or reattaches an
33
+ authenticated terminal WebSocket. `client.terminals.list(id)` reads the
34
+ metadata-only terminal audit history.
35
+
36
+ Use `client.raw(path, init)` for endpoints not yet represented by a typed
37
+ resource client. API failures throw `PocketCoderError`; expired or deleted
38
+ conversation history throws the more specific `ConversationGoneError`.