@augmentcode/auggie-sdk 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 +16 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,10 +36,9 @@ pnpm add /path/to/auggie-sdk
|
|
|
36
36
|
import { Auggie } from "@augmentcode/auggie-sdk";
|
|
37
37
|
|
|
38
38
|
async function main() {
|
|
39
|
-
// Create and initialize Auggie
|
|
39
|
+
// Create and initialize Auggie instance
|
|
40
40
|
const client = await Auggie.create({
|
|
41
41
|
model: "sonnet4.5", // Optional: haiku4.5, opus4.1, sonnet4.5, sonnet4
|
|
42
|
-
debug: false, // Optional: enable debug logging
|
|
43
42
|
apiKey: "your-api-key", // Optional: API key for authentication
|
|
44
43
|
apiUrl: "https://api.augmentcode.com", // Optional: API URL
|
|
45
44
|
});
|
|
@@ -51,7 +50,7 @@ async function main() {
|
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
// Send a prompt
|
|
54
|
-
const response = await client.
|
|
53
|
+
const response = await client.prompt("What files are in the current directory?");
|
|
55
54
|
console.log("Response:", response);
|
|
56
55
|
|
|
57
56
|
// Close the connection
|
|
@@ -126,14 +125,14 @@ const weatherTool = tool({
|
|
|
126
125
|
});
|
|
127
126
|
|
|
128
127
|
async function main() {
|
|
129
|
-
//
|
|
128
|
+
// Create the instance with tools
|
|
130
129
|
const client = await Auggie.create({
|
|
131
130
|
model: "sonnet4.5",
|
|
132
|
-
toolsMap: { weather_tool: weatherTool }
|
|
131
|
+
toolsMap: { weather_tool: weatherTool },
|
|
133
132
|
});
|
|
134
133
|
|
|
135
134
|
try {
|
|
136
|
-
const response = await client.
|
|
135
|
+
const response = await client.prompt("What's the weather in San Francisco?");
|
|
137
136
|
console.log(response);
|
|
138
137
|
|
|
139
138
|
await client.close();
|
|
@@ -152,10 +151,10 @@ When the agent uses tools (like file operations, web searches, etc.), you can ch
|
|
|
152
151
|
|
|
153
152
|
```typescript
|
|
154
153
|
// Get all agent responses (default behavior)
|
|
155
|
-
const fullResponse = await client.
|
|
154
|
+
const fullResponse = await client.prompt("List all TypeScript files in this project");
|
|
156
155
|
|
|
157
156
|
// Get only the final response after tool calls
|
|
158
|
-
const finalAnswer = await client.
|
|
157
|
+
const finalAnswer = await client.prompt(
|
|
159
158
|
"List all TypeScript files in this project",
|
|
160
159
|
{ isAnswerOnly: true }
|
|
161
160
|
);
|
|
@@ -209,7 +208,6 @@ const client = await Auggie.create({
|
|
|
209
208
|
auggiePath: "/path/to/auggie",
|
|
210
209
|
workspaceRoot: "/path/to/workspace",
|
|
211
210
|
model: "sonnet4.5",
|
|
212
|
-
debug: true,
|
|
213
211
|
allowIndexing: true,
|
|
214
212
|
apiKey: "your-api-key", // Optional
|
|
215
213
|
apiUrl: "https://api.augmentcode.com", // Optional
|
|
@@ -226,40 +224,28 @@ const client = await Auggie.create({
|
|
|
226
224
|
static async create(options?: AuggieOptions): Promise<Auggie>
|
|
227
225
|
```
|
|
228
226
|
|
|
229
|
-
Creates a new Auggie instance
|
|
227
|
+
Creates and initializes a new Auggie instance. This method automatically connects to the ACP server and creates a session before returning.
|
|
230
228
|
|
|
231
229
|
**Options:**
|
|
232
230
|
- `auggiePath?: string` - Path to the Auggie executable (default: "auggie")
|
|
233
231
|
- `workspaceRoot?: string` - Working directory for the Auggie process (default: `process.cwd()`)
|
|
234
|
-
- `debug?: boolean` - Enable debug logging (default: false)
|
|
235
232
|
- `model?: "haiku4.5" | "opus4.1" | "sonnet4.5" | "sonnet4"` - Model to use (default: "haiku4.5")
|
|
236
233
|
- `allowIndexing?: boolean` - Allow codebase indexing (default: true)
|
|
237
234
|
- `toolsMap?: Record<string, Tool>` - Custom tools to provide to Auggie (optional)
|
|
238
235
|
- `apiKey?: string` - API key for authentication (optional, sets AUGMENT_API_TOKEN)
|
|
239
236
|
- `apiUrl?: string` - API URL for authentication (optional, sets AUGMENT_API_URL)
|
|
240
237
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
##### `connect(): Promise<void>`
|
|
244
|
-
|
|
245
|
-
Launches Auggie in ACP mode and establishes a connection. (Called automatically by `create()`)
|
|
246
|
-
|
|
247
|
-
##### `createSession(toolsMap?: Record<string, Tool>): Promise<string>`
|
|
238
|
+
When `toolsMap` is provided, an MCP server is automatically started and connected to the session.
|
|
248
239
|
|
|
249
|
-
|
|
240
|
+
**Note:** The constructor is private. Always use `Auggie.create()` to instantiate the class.
|
|
250
241
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
- `toolsMap`: Optional map of tool names to AI SDK Tool objects
|
|
254
|
-
- Returns: Session ID
|
|
255
|
-
|
|
256
|
-
When tools are provided, an MCP server is automatically started and connected to the session.
|
|
242
|
+
#### Methods
|
|
257
243
|
|
|
258
|
-
##### `
|
|
244
|
+
##### `prompt(message: string, options?: { isAnswerOnly?: boolean }): Promise<string>`
|
|
259
245
|
|
|
260
246
|
Sends a prompt to the agent and waits for completion.
|
|
261
247
|
|
|
262
|
-
- `
|
|
248
|
+
- `message`: The text prompt to send
|
|
263
249
|
- `options.isAnswerOnly`: Optional boolean (default: `false`). When set to `true`, returns only the final response after all tool calls complete. When `false` or omitted, returns all agent message chunks including any intermediate responses.
|
|
264
250
|
- Returns: The accumulated text response from the agent
|
|
265
251
|
|
|
@@ -334,8 +320,7 @@ const weatherTool = tool({
|
|
|
334
320
|
async function main() {
|
|
335
321
|
const client = await Auggie.create({
|
|
336
322
|
model: "sonnet4.5",
|
|
337
|
-
|
|
338
|
-
toolsMap: { weather_tool: weatherTool }
|
|
323
|
+
toolsMap: { weather_tool: weatherTool },
|
|
339
324
|
});
|
|
340
325
|
|
|
341
326
|
try {
|
|
@@ -357,7 +342,7 @@ async function main() {
|
|
|
357
342
|
}
|
|
358
343
|
});
|
|
359
344
|
|
|
360
|
-
const response = await client.
|
|
345
|
+
const response = await client.prompt(
|
|
361
346
|
"What's the weather in Tokyo?",
|
|
362
347
|
{ isAnswerOnly: true }
|
|
363
348
|
);
|
|
@@ -378,7 +363,7 @@ main();
|
|
|
378
363
|
```typescript
|
|
379
364
|
try {
|
|
380
365
|
const client = await Auggie.create();
|
|
381
|
-
await client.
|
|
366
|
+
await client.prompt("Hello!");
|
|
382
367
|
await client.close();
|
|
383
368
|
} catch (error) {
|
|
384
369
|
if (error instanceof Error) {
|