@factory/droid-sdk 0.2.0 → 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/README.md +214 -82
- package/dist/index.cjs +734 -611
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1649 -206
- package/dist/index.d.ts +1649 -206
- package/dist/index.js +729 -624
- package/dist/index.js.map +1 -1
- package/docs/sdk-usage-guide.md +678 -0
- package/examples/abort-session-stream.ts +19 -55
- package/examples/droid-dev-structured-output.ts +4 -5
- package/examples/fork-session.ts +25 -6
- package/examples/hook-execution.ts +62 -0
- package/examples/init-metadata.ts +9 -66
- package/examples/interrupt-session.ts +19 -54
- package/examples/list-sessions.ts +9 -55
- package/examples/multi-turn-session.ts +21 -53
- package/examples/permission-handler.ts +26 -84
- package/examples/readme-structured-output.ts +25 -0
- package/examples/result-metadata.ts +1 -1
- package/examples/run.ts +1 -1
- package/examples/sdk-mcp-tool.ts +11 -7
- package/examples/session-stream.ts +54 -0
- package/examples/spec-mode-new-session.ts +38 -99
- package/examples/spec-mode-same-session.ts +49 -111
- package/examples/structured-output.ts +16 -10
- package/examples/test-compact.ts +5 -3
- package/examples/test-rewind.ts +49 -117
- package/examples/tool-controls.ts +22 -55
- package/package.json +1 -1
- package/docs/examples/init-metadata.md +0 -79
- package/docs/examples/list-sessions.md +0 -64
- package/docs/examples/multi-turn-session.md +0 -77
- package/docs/examples/one-shot-query.md +0 -73
- package/docs/examples/permission-handler.md +0 -102
- package/docs/examples/run.md +0 -52
- package/docs/examples/spec-mode.md +0 -101
- package/docs/examples/tool-controls.md +0 -90
- package/docs/typescript-sdk-reference.md +0 -372
- package/examples/simple-query.ts +0 -53
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
# Agent SDK reference - TypeScript
|
|
2
|
-
|
|
3
|
-
> Public API reference for `@factory/droid-sdk`, the TypeScript SDK for the Factory Droid CLI.
|
|
4
|
-
|
|
5
|
-
## Documentation Index
|
|
6
|
-
|
|
7
|
-
Use these pages together:
|
|
8
|
-
|
|
9
|
-
- API reference: `docs/typescript-sdk-reference.md`
|
|
10
|
-
- Example walkthroughs: `docs/examples/`
|
|
11
|
-
- Source exports: [`src/index.ts`](../src/index.ts)
|
|
12
|
-
- Runnable repo examples: [`examples/`](../examples)
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install @factory/droid-sdk
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Requirements
|
|
21
|
-
|
|
22
|
-
- Node.js `18+`
|
|
23
|
-
- The `droid` CLI installed and available on your `PATH`
|
|
24
|
-
|
|
25
|
-
## What this SDK provides
|
|
26
|
-
|
|
27
|
-
The SDK wraps `droid exec` as a subprocess and exposes two main patterns:
|
|
28
|
-
|
|
29
|
-
- `query()` for one-shot prompt/response flows
|
|
30
|
-
- `createSession()` / `resumeSession()` for multi-turn sessions
|
|
31
|
-
|
|
32
|
-
It also includes:
|
|
33
|
-
|
|
34
|
-
- streaming message events
|
|
35
|
-
- permission and ask-user handlers
|
|
36
|
-
- MCP server management
|
|
37
|
-
- spec mode controls
|
|
38
|
-
- tool allow/deny controls
|
|
39
|
-
- session utilities such as rename, fork, compact, and rewind
|
|
40
|
-
- local session discovery with `listSessions()`
|
|
41
|
-
- low-level access via `ProcessTransport`, `ProtocolEngine`, and `DroidClient`
|
|
42
|
-
|
|
43
|
-
## Example walkthroughs
|
|
44
|
-
|
|
45
|
-
For copy-pasteable walkthroughs and complete scripts, see:
|
|
46
|
-
|
|
47
|
-
- [One-shot query](./examples/one-shot-query.md)
|
|
48
|
-
- [Multi-turn session](./examples/multi-turn-session.md)
|
|
49
|
-
- [Permission handler](./examples/permission-handler.md)
|
|
50
|
-
- [Initialization metadata](./examples/init-metadata.md)
|
|
51
|
-
- [Spec mode approval flow](./examples/spec-mode.md)
|
|
52
|
-
- [Tool controls](./examples/tool-controls.md)
|
|
53
|
-
- [List saved sessions](./examples/list-sessions.md)
|
|
54
|
-
|
|
55
|
-
## Functions
|
|
56
|
-
|
|
57
|
-
### `query()`
|
|
58
|
-
|
|
59
|
-
Starts a one-shot prompt, streams `DroidMessage` events, and cleans up automatically when the stream ends.
|
|
60
|
-
|
|
61
|
-
```ts
|
|
62
|
-
function query(options: QueryOptions): DroidQuery;
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
#### `QueryOptions`
|
|
66
|
-
|
|
67
|
-
`QueryOptions` extends `CreateSessionOptions` and adds:
|
|
68
|
-
|
|
69
|
-
| Field | Type | Description |
|
|
70
|
-
| :------- | :------- | :--------------------------------------- |
|
|
71
|
-
| `prompt` | `string` | Prompt to send as the first user message |
|
|
72
|
-
|
|
73
|
-
#### `DroidQuery`
|
|
74
|
-
|
|
75
|
-
`DroidQuery` is an `AsyncGenerator<DroidMessage>` with extra controls:
|
|
76
|
-
|
|
77
|
-
| Member | Type | Description |
|
|
78
|
-
| :------------ | :--------------------------------- | :---------------------------------------- |
|
|
79
|
-
| `interrupt()` | `() => Promise<void>` | Gracefully interrupts the current turn |
|
|
80
|
-
| `abort()` | `() => void` | Forcefully closes the subprocess |
|
|
81
|
-
| `sessionId` | `string \| null` | Session ID after initialization completes |
|
|
82
|
-
| `initResult` | `InitializeSessionResult \| null` | Raw initialization result |
|
|
83
|
-
| `initialized` | `Promise<InitializeSessionResult>` | Resolves when initialization finishes |
|
|
84
|
-
|
|
85
|
-
#### Notes
|
|
86
|
-
|
|
87
|
-
- `query()` accepts `abortSignal`
|
|
88
|
-
- `query()` sends text only; image/file message attachments are supported on `DroidSession`, not `query()`
|
|
89
|
-
|
|
90
|
-
### `createSession()`
|
|
91
|
-
|
|
92
|
-
Creates a persistent `DroidSession` for multi-turn conversations.
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
function createSession(options?: CreateSessionOptions): Promise<DroidSession>;
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### `resumeSession()`
|
|
99
|
-
|
|
100
|
-
Reconnects to an existing session by ID.
|
|
101
|
-
|
|
102
|
-
```ts
|
|
103
|
-
function resumeSession(
|
|
104
|
-
sessionId: string,
|
|
105
|
-
options?: ResumeSessionOptions
|
|
106
|
-
): Promise<DroidSession>;
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### `listSessions()`
|
|
110
|
-
|
|
111
|
-
Discovers saved sessions directly from `~/.factory/sessions/` without spawning `droid`.
|
|
112
|
-
|
|
113
|
-
```ts
|
|
114
|
-
function listSessions(
|
|
115
|
-
options?: ListSessionsOptions
|
|
116
|
-
): Promise<SessionMetadata[]>;
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
#### `ListSessionsOptions`
|
|
120
|
-
|
|
121
|
-
| Field | Type | Description |
|
|
122
|
-
| :---------------- | :-------- | :---------------------------------------------------------------- |
|
|
123
|
-
| `cwd` | `string` | Scope results to a project directory. Defaults to `process.cwd()` |
|
|
124
|
-
| `fetchOutsideCWD` | `boolean` | Return sessions across all projects |
|
|
125
|
-
| `numSessions` | `number` | Maximum number of sessions to return |
|
|
126
|
-
| `sessionsDir` | `string` | Override the session storage root |
|
|
127
|
-
|
|
128
|
-
#### Returned `SessionMetadata`
|
|
129
|
-
|
|
130
|
-
Common fields include:
|
|
131
|
-
|
|
132
|
-
- `id`
|
|
133
|
-
- `title`
|
|
134
|
-
- `sessionTitle`
|
|
135
|
-
- `owner`
|
|
136
|
-
- `messageCount`
|
|
137
|
-
- `modifiedTime`
|
|
138
|
-
- `createdTime`
|
|
139
|
-
- `isFavorite`
|
|
140
|
-
- `cwd`
|
|
141
|
-
- `decompSessionType`
|
|
142
|
-
- `decompMissionId`
|
|
143
|
-
|
|
144
|
-
Archived sessions are excluded automatically, and results are sorted by `modifiedTime` descending.
|
|
145
|
-
|
|
146
|
-
## `DroidSession`
|
|
147
|
-
|
|
148
|
-
Returned by `createSession()` and `resumeSession()`.
|
|
149
|
-
|
|
150
|
-
### Core methods
|
|
151
|
-
|
|
152
|
-
| Method | Description |
|
|
153
|
-
| :----------------------- | :--------------------------------------------------------------------- |
|
|
154
|
-
| `stream(text, options?)` | Sends a message and yields `DroidMessage` events until `turn_complete` |
|
|
155
|
-
| `send(text, options?)` | Sends a message and returns aggregated text, messages, and token usage |
|
|
156
|
-
| `interrupt()` | Gracefully interrupts the current turn |
|
|
157
|
-
| `close()` | Closes the underlying connection |
|
|
158
|
-
| `updateSettings(params)` | Updates model/session settings |
|
|
159
|
-
| `enterSpecMode(params?)` | Switches the current session into spec mode |
|
|
160
|
-
|
|
161
|
-
### Session utilities
|
|
162
|
-
|
|
163
|
-
| Method | Description |
|
|
164
|
-
| :------------------------ | :----------------------------------------------------- |
|
|
165
|
-
| `forkSession()` | Creates a new server-side session from the current one |
|
|
166
|
-
| `renameSession(params)` | Renames the current session |
|
|
167
|
-
| `compactSession(params?)` | Requests server-side compaction |
|
|
168
|
-
| `getRewindInfo(params)` | Fetches rewind metadata |
|
|
169
|
-
| `executeRewind(params)` | Executes a rewind |
|
|
170
|
-
|
|
171
|
-
### MCP and discovery helpers
|
|
172
|
-
|
|
173
|
-
| Method | Description |
|
|
174
|
-
| :---------------------------------- | :------------------------------------------------------- |
|
|
175
|
-
| `addMcpServer(params)` | Adds an MCP server |
|
|
176
|
-
| `removeMcpServer(params)` | Removes an MCP server |
|
|
177
|
-
| `toggleMcpServer(params)` | Enables or disables a server |
|
|
178
|
-
| `listMcpServers()` | Lists configured MCP servers |
|
|
179
|
-
| `listMcpTools()` | Lists tools exposed by connected MCP servers |
|
|
180
|
-
| `authenticateMcpServer(params)` | Starts MCP OAuth/authentication flow |
|
|
181
|
-
| `listSkills()` | Lists available skills |
|
|
182
|
-
| `listTools(params?)` | Lists the exec tool catalog and current allow/deny state |
|
|
183
|
-
| `onNotification(callback, filter?)` | Subscribes to raw session notifications |
|
|
184
|
-
|
|
185
|
-
### Properties
|
|
186
|
-
|
|
187
|
-
| Property | Type | Description |
|
|
188
|
-
| :----------- | :--------------------------------------------- | :-------------------------- |
|
|
189
|
-
| `sessionId` | `string` | Active session ID |
|
|
190
|
-
| `initResult` | `InitializeSessionResult \| LoadSessionResult` | Raw initialize/load payload |
|
|
191
|
-
|
|
192
|
-
### Message attachments
|
|
193
|
-
|
|
194
|
-
`session.stream()` and `session.send()` accept `MessageOptions`:
|
|
195
|
-
|
|
196
|
-
| Field | Type | Description |
|
|
197
|
-
| :------- | :-------------------- | :------------------------------- |
|
|
198
|
-
| `images` | `Base64ImageSource[]` | Inline image attachments |
|
|
199
|
-
| `files` | `DocumentSource[]` | Inline file/document attachments |
|
|
200
|
-
|
|
201
|
-
### `DroidResult`
|
|
202
|
-
|
|
203
|
-
Returned by `session.send()`:
|
|
204
|
-
|
|
205
|
-
| Field | Type | Description |
|
|
206
|
-
| :----------- | :------------------------- | :-------------------------------- |
|
|
207
|
-
| `text` | `string` | Concatenated assistant text |
|
|
208
|
-
| `messages` | `DroidMessage[]` | All stream messages from the turn |
|
|
209
|
-
| `tokenUsage` | `TokenUsageUpdate \| null` | Final token usage if available |
|
|
210
|
-
|
|
211
|
-
## Stream message model
|
|
212
|
-
|
|
213
|
-
All streamed events are part of the `DroidMessage` union and are discriminated by `type`.
|
|
214
|
-
|
|
215
|
-
### Common message types
|
|
216
|
-
|
|
217
|
-
| Type | Description |
|
|
218
|
-
| :---------------------- | :------------------------------------------ |
|
|
219
|
-
| `assistant_text_delta` | Assistant text token |
|
|
220
|
-
| `thinking_text_delta` | Thinking/reasoning token |
|
|
221
|
-
| `tool_use` | Tool invocation |
|
|
222
|
-
| `tool_result` | Tool result |
|
|
223
|
-
| `tool_progress` | Tool progress update |
|
|
224
|
-
| `working_state_changed` | Agent state transition |
|
|
225
|
-
| `token_usage_update` | Token counter update |
|
|
226
|
-
| `create_message` | Full assistant message |
|
|
227
|
-
| `permission_resolved` | Permission outcome |
|
|
228
|
-
| `settings_updated` | Session settings changed |
|
|
229
|
-
| `session_title_updated` | Session title changed |
|
|
230
|
-
| `mcp_status_changed` | MCP status changed |
|
|
231
|
-
| `mcp_auth_required` | MCP authentication required |
|
|
232
|
-
| `mcp_auth_completed` | MCP authentication completed |
|
|
233
|
-
| `error` | Error from the process |
|
|
234
|
-
| `turn_complete` | End-of-turn sentinel synthesized by the SDK |
|
|
235
|
-
|
|
236
|
-
### Mission and AGI messages
|
|
237
|
-
|
|
238
|
-
When running in `DroidInteractionMode.AGI`, the stream can also emit:
|
|
239
|
-
|
|
240
|
-
- `mission_state_changed`
|
|
241
|
-
- `mission_features_changed`
|
|
242
|
-
- `mission_progress_entry`
|
|
243
|
-
- `mission_heartbeat`
|
|
244
|
-
- `mission_worker_started`
|
|
245
|
-
- `mission_worker_completed`
|
|
246
|
-
|
|
247
|
-
## Configuration and enums
|
|
248
|
-
|
|
249
|
-
High-value exported enums include:
|
|
250
|
-
|
|
251
|
-
- `DroidInteractionMode`
|
|
252
|
-
- `AutonomyLevel`
|
|
253
|
-
- `ReasoningEffort`
|
|
254
|
-
- `ToolConfirmationOutcome`
|
|
255
|
-
- `ToolConfirmationType`
|
|
256
|
-
- `SessionNotificationType`
|
|
257
|
-
- `DroidWorkingState`
|
|
258
|
-
- `McpServerType`
|
|
259
|
-
- `McpServerStatus`
|
|
260
|
-
- `McpAuthOutcome`
|
|
261
|
-
- `MissionState`
|
|
262
|
-
- `FeatureStatus`
|
|
263
|
-
- `SettingsLevel`
|
|
264
|
-
- `SkillLocation`
|
|
265
|
-
|
|
266
|
-
### Common `CreateSessionOptions`
|
|
267
|
-
|
|
268
|
-
`CreateSessionOptions` supports the main runtime controls:
|
|
269
|
-
|
|
270
|
-
| Field | Description |
|
|
271
|
-
| :------------------------------ | :------------------------------------------------- |
|
|
272
|
-
| `cwd` | Working directory |
|
|
273
|
-
| `machineId` | Machine identifier passed during initialization |
|
|
274
|
-
| `modelId` | Default model |
|
|
275
|
-
| `autonomyLevel` | Command autonomy level |
|
|
276
|
-
| `interactionMode` | `Auto`, `Spec`, or `AGI` |
|
|
277
|
-
| `reasoningEffort` | LLM reasoning depth |
|
|
278
|
-
| `specModeModelId` | Spec-mode model override |
|
|
279
|
-
| `specModeReasoningEffort` | Spec-mode reasoning override |
|
|
280
|
-
| `mcpServers` | Initial MCP server configs |
|
|
281
|
-
| `enabledToolIds` | Explicit tool allowlist |
|
|
282
|
-
| `disabledToolIds` | Explicit tool denylist |
|
|
283
|
-
| `tags` | Session tags; the SDK also appends its own SDK tag |
|
|
284
|
-
| `permissionHandler` | Tool confirmation callback |
|
|
285
|
-
| `askUserHandler` | Structured user-input callback |
|
|
286
|
-
| `transport` | Custom transport override |
|
|
287
|
-
| `execPath` / `execArgs` / `env` | Subprocess configuration |
|
|
288
|
-
| `abortSignal` | External cancellation signal |
|
|
289
|
-
|
|
290
|
-
## Permission and ask-user handling
|
|
291
|
-
|
|
292
|
-
The high-level APIs support:
|
|
293
|
-
|
|
294
|
-
- `permissionHandler` for tool approval decisions
|
|
295
|
-
- `askUserHandler` for structured clarification flows
|
|
296
|
-
|
|
297
|
-
For spec mode, approval flows also support fresh-session outcomes such as `ToolConfirmationOutcome.ProceedNewSessionHigh`.
|
|
298
|
-
|
|
299
|
-
## MCP support
|
|
300
|
-
|
|
301
|
-
The SDK supports:
|
|
302
|
-
|
|
303
|
-
- configuring MCP servers at session startup
|
|
304
|
-
- adding/removing/toggling servers during a session
|
|
305
|
-
- listing MCP servers and tools
|
|
306
|
-
- starting authentication flows with `authenticateMcpServer()`
|
|
307
|
-
- receiving `mcp_auth_required` and `mcp_auth_completed` stream events
|
|
308
|
-
|
|
309
|
-
Advanced auth controls such as cancelling or clearing MCP auth are available on the low-level `DroidClient`.
|
|
310
|
-
|
|
311
|
-
## Low-level APIs
|
|
312
|
-
|
|
313
|
-
Most users should use `query()` and `DroidSession`, but the package also exports lower layers.
|
|
314
|
-
|
|
315
|
-
### `ProcessTransport`
|
|
316
|
-
|
|
317
|
-
Spawns `droid exec --input-format stream-jsonrpc --output-format stream-jsonrpc` and implements the transport interface used by the client.
|
|
318
|
-
|
|
319
|
-
### `ProtocolEngine`
|
|
320
|
-
|
|
321
|
-
Handles JSON-RPC framing, request/response correlation, notifications, permission requests, and ask-user requests.
|
|
322
|
-
|
|
323
|
-
### `DroidClient`
|
|
324
|
-
|
|
325
|
-
Low-level typed JSON-RPC client. Use it when you need direct RPC access beyond `DroidSession`.
|
|
326
|
-
|
|
327
|
-
Notable client-only capabilities include:
|
|
328
|
-
|
|
329
|
-
- `killWorkerSession()`
|
|
330
|
-
- `cancelMcpAuth()`
|
|
331
|
-
- `clearMcpAuth()`
|
|
332
|
-
- `submitMcpAuthCode()`
|
|
333
|
-
- `listMcpRegistry()`
|
|
334
|
-
- `toggleMcpTool()`
|
|
335
|
-
- `submitBugReport()`
|
|
336
|
-
|
|
337
|
-
## Runtime validation and schemas
|
|
338
|
-
|
|
339
|
-
The package exports its Zod schema surface from `src/schemas/index.ts`, including:
|
|
340
|
-
|
|
341
|
-
- request and response schemas
|
|
342
|
-
- notification schemas
|
|
343
|
-
- enum schemas and constants
|
|
344
|
-
- message/content schemas
|
|
345
|
-
- mission schemas
|
|
346
|
-
- MCP schemas
|
|
347
|
-
|
|
348
|
-
This makes it possible to validate protocol payloads at runtime in advanced integrations.
|
|
349
|
-
|
|
350
|
-
## Errors
|
|
351
|
-
|
|
352
|
-
The SDK exports these custom errors:
|
|
353
|
-
|
|
354
|
-
| Error | Description |
|
|
355
|
-
| :--------------------- | :---------------------------------------- |
|
|
356
|
-
| `ConnectionError` | Failed to connect to the Droid subprocess |
|
|
357
|
-
| `ProtocolError` | JSON-RPC or protocol-level failure |
|
|
358
|
-
| `SessionError` | Base session error |
|
|
359
|
-
| `SessionNotFoundError` | Requested session does not exist |
|
|
360
|
-
| `TimeoutError` | RPC timed out |
|
|
361
|
-
| `ProcessExitError` | The subprocess exited unexpectedly |
|
|
362
|
-
|
|
363
|
-
## Feature coverage in this document
|
|
364
|
-
|
|
365
|
-
This reference intentionally documents only features confirmed in the current SDK implementation and recent shipped commits, including:
|
|
366
|
-
|
|
367
|
-
- spec mode controls
|
|
368
|
-
- tool controls
|
|
369
|
-
- initialization metadata
|
|
370
|
-
- session forking
|
|
371
|
-
- filesystem-based session discovery
|
|
372
|
-
- rename, compact, rewind, and MCP/session management APIs
|
package/examples/simple-query.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple one-shot query example.
|
|
3
|
-
*
|
|
4
|
-
* Demonstrates using `query()` to send a single prompt, streaming
|
|
5
|
-
* `AssistantTextDelta` messages to stdout, and handling `TurnComplete`.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* npx tsx examples/simple-query.ts
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { DroidMessageType, query } from '../src/index.js';
|
|
12
|
-
|
|
13
|
-
async function main(): Promise<void> {
|
|
14
|
-
const prompt = process.argv[2] ?? 'What files are in the current directory?';
|
|
15
|
-
|
|
16
|
-
console.log(`Sending prompt: "${prompt}"\n`);
|
|
17
|
-
|
|
18
|
-
const stream = query({
|
|
19
|
-
prompt,
|
|
20
|
-
cwd: process.cwd(),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
for await (const msg of stream) {
|
|
24
|
-
switch (msg.type) {
|
|
25
|
-
case DroidMessageType.AssistantTextDelta:
|
|
26
|
-
process.stdout.write(msg.text);
|
|
27
|
-
break;
|
|
28
|
-
|
|
29
|
-
case DroidMessageType.ToolUse:
|
|
30
|
-
console.log(`\n[Tool] ${msg.toolName}`);
|
|
31
|
-
break;
|
|
32
|
-
|
|
33
|
-
case DroidMessageType.ToolResult:
|
|
34
|
-
console.log(`[Tool Result] ${msg.isError ? 'Error' : 'OK'}`);
|
|
35
|
-
break;
|
|
36
|
-
|
|
37
|
-
case DroidMessageType.TurnComplete:
|
|
38
|
-
console.log('\n\n--- Turn complete ---');
|
|
39
|
-
if (msg.tokenUsage) {
|
|
40
|
-
console.log(
|
|
41
|
-
`Tokens — input: ${msg.tokenUsage.inputTokens}, ` +
|
|
42
|
-
`output: ${msg.tokenUsage.outputTokens}`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
main().catch((err: unknown) => {
|
|
51
|
-
console.error('Error:', err);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
});
|