@termfleet/core 0.1.3 → 0.1.4
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 +9 -1
- package/dist/provider-client.d.ts +4 -4
- package/dist/provider-client.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -102,10 +102,18 @@ const off = client.onSnapshot((snapshot) => { /* … */ });
|
|
|
102
102
|
|
|
103
103
|
// create a fresh agent window (boot a claude/codex/gemini session)
|
|
104
104
|
await client.createAgentWindow({ /* AgentWindowCreateOptions */ });
|
|
105
|
+
|
|
106
|
+
// terminals + files: capture/send, and read/write through the provider filesystem
|
|
107
|
+
const { content } = await client.captureTerminal("term-1", 40);
|
|
108
|
+
await client.sendTerminalInput("term-1", "echo hi\n", { breakGlass: true });
|
|
109
|
+
const bytes = await client.readFile("term-1", "/path/file"); // Uint8Array (browser-safe)
|
|
110
|
+
const text = new TextDecoder().decode(bytes); // node: or Buffer.from(bytes)
|
|
105
111
|
```
|
|
106
112
|
|
|
107
113
|
Pass `{ authToken }` for an authenticated/shared provider, or a `urlResolver`
|
|
108
|
-
when proxying through a console; omit both for a direct connection.
|
|
114
|
+
when proxying through a console; omit both for a direct connection. `readFile`
|
|
115
|
+
returns a `Uint8Array` (not a node `Buffer`, since this client also runs in the
|
|
116
|
+
browser) — decode with `new TextDecoder().decode(bytes)` or `Buffer.from(bytes)`.
|
|
109
117
|
|
|
110
118
|
## What's inside
|
|
111
119
|
|
|
@@ -120,15 +120,15 @@ export declare class ProviderClient {
|
|
|
120
120
|
}): Promise<CommandAck<T>>;
|
|
121
121
|
listDirectory(terminalId: string, path: string): Promise<ProviderDirectoryList>;
|
|
122
122
|
listDirectoryByFilesystem(filesystemId: string, path: string): Promise<ProviderDirectoryList>;
|
|
123
|
-
readFile(terminalId: string, path: string): Promise<
|
|
124
|
-
readFileByFilesystem(filesystemId: string, path: string): Promise<
|
|
123
|
+
readFile(terminalId: string, path: string): Promise<Uint8Array>;
|
|
124
|
+
readFileByFilesystem(filesystemId: string, path: string): Promise<Uint8Array>;
|
|
125
125
|
statFile(terminalId: string, path: string): Promise<ProviderFileStat>;
|
|
126
126
|
statFileByFilesystem(filesystemId: string, path: string): Promise<ProviderFileStat>;
|
|
127
|
-
writeFile(terminalId: string, path: string, data:
|
|
127
|
+
writeFile(terminalId: string, path: string, data: Uint8Array, options?: {
|
|
128
128
|
mkdirs?: boolean;
|
|
129
129
|
mode?: string;
|
|
130
130
|
}): Promise<ProviderFileWriteResult>;
|
|
131
|
-
writeFileByFilesystem(filesystemId: string, path: string, data:
|
|
131
|
+
writeFileByFilesystem(filesystemId: string, path: string, data: Uint8Array, options?: {
|
|
132
132
|
mkdirs?: boolean;
|
|
133
133
|
mode?: string;
|
|
134
134
|
}): Promise<ProviderFileWriteResult>;
|
package/dist/provider-client.js
CHANGED
|
@@ -385,6 +385,9 @@ export class ProviderClient {
|
|
|
385
385
|
}
|
|
386
386
|
return await response.json();
|
|
387
387
|
}
|
|
388
|
+
// Returns raw bytes as a Uint8Array (browser-safe — this client also runs in the
|
|
389
|
+
// browser, where node's Buffer is absent). Node consumers decode with
|
|
390
|
+
// `Buffer.from(bytes)` or `new TextDecoder().decode(bytes)`.
|
|
388
391
|
async readFile(terminalId, path) {
|
|
389
392
|
const url = new URL(`${this.apiBase}/api/files`);
|
|
390
393
|
url.searchParams.set("terminalId", terminalId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@termfleet/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Termfleet core: contracts, the provider SDK, and the agent-transcript/session library (Claude Code / Codex / Gemini). The reusable layer, usable beyond the console.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -p tsconfig.json",
|
|
40
|
-
"
|
|
40
|
+
"prepack": "tsc -p tsconfig.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"socket.io-client": "^4.8.3",
|