@augmentcode/auggie-sdk 0.1.9 → 0.1.11
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/dist/auggie/sdk-acp-client.d.ts +7 -6
- package/dist/auggie/sdk-acp-client.js +299 -332
- package/dist/auggie/sdk-mcp-server.d.ts +5 -3
- package/dist/auggie/sdk-mcp-server.js +102 -112
- package/dist/context/direct-context.d.ts +19 -15
- package/dist/context/direct-context.js +556 -567
- package/dist/context/filesystem-context.d.ts +5 -3
- package/dist/context/filesystem-context.js +187 -209
- package/dist/context/internal/__mocks__/api-client.d.ts +17 -11
- package/dist/context/internal/__mocks__/api-client.js +104 -91
- package/dist/context/internal/api-client.d.ts +15 -15
- package/dist/context/internal/api-client.js +233 -224
- package/dist/context/internal/blob-name-calculator.d.ts +5 -4
- package/dist/context/internal/blob-name-calculator.js +41 -38
- package/dist/context/internal/chat-utils.d.ts +6 -3
- package/dist/context/internal/chat-utils.js +5 -18
- package/dist/context/internal/credentials.d.ts +5 -4
- package/dist/context/internal/credentials.js +24 -38
- package/dist/context/internal/retry-utils.d.ts +5 -4
- package/dist/context/internal/retry-utils.js +60 -114
- package/dist/context/internal/search-utils.d.ts +3 -2
- package/dist/context/internal/search-utils.js +8 -9
- package/dist/context/internal/session-reader.d.ts +4 -3
- package/dist/context/internal/session-reader.js +14 -22
- package/dist/context/types.d.ts +17 -12
- package/dist/context/types.js +0 -5
- package/dist/index.d.ts +8 -7
- package/dist/index.js +14 -9
- package/dist/version.d.ts +3 -2
- package/dist/version.js +24 -38
- package/package.json +3 -2
- package/dist/auggie/sdk-acp-client.d.ts.map +0 -1
- package/dist/auggie/sdk-acp-client.js.map +0 -1
- package/dist/auggie/sdk-mcp-server.d.ts.map +0 -1
- package/dist/auggie/sdk-mcp-server.js.map +0 -1
- package/dist/context/direct-context.d.ts.map +0 -1
- package/dist/context/direct-context.js.map +0 -1
- package/dist/context/filesystem-context.d.ts.map +0 -1
- package/dist/context/filesystem-context.js.map +0 -1
- package/dist/context/internal/__mocks__/api-client.d.ts.map +0 -1
- package/dist/context/internal/__mocks__/api-client.js.map +0 -1
- package/dist/context/internal/api-client.d.ts.map +0 -1
- package/dist/context/internal/api-client.js.map +0 -1
- package/dist/context/internal/blob-name-calculator.d.ts.map +0 -1
- package/dist/context/internal/blob-name-calculator.js.map +0 -1
- package/dist/context/internal/chat-utils.d.ts.map +0 -1
- package/dist/context/internal/chat-utils.js.map +0 -1
- package/dist/context/internal/credentials.d.ts.map +0 -1
- package/dist/context/internal/credentials.js.map +0 -1
- package/dist/context/internal/retry-utils.d.ts.map +0 -1
- package/dist/context/internal/retry-utils.js.map +0 -1
- package/dist/context/internal/search-utils.d.ts.map +0 -1
- package/dist/context/internal/search-utils.js.map +0 -1
- package/dist/context/internal/session-reader.d.ts.map +0 -1
- package/dist/context/internal/session-reader.js.map +0 -1
- package/dist/context/types.d.ts.map +0 -1
- package/dist/context/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
|
@@ -1,40 +1,26 @@
|
|
|
1
|
-
import { readSessionFile } from "./session-reader";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @param options - Optional credential options
|
|
11
|
-
* @returns Resolved credentials
|
|
12
|
-
* @throws Error if credentials cannot be resolved
|
|
13
|
-
*/
|
|
14
|
-
export async function resolveCredentials(options = {}) {
|
|
15
|
-
let apiKey = options.apiKey || process.env.AUGMENT_API_TOKEN;
|
|
16
|
-
let apiUrl = options.apiUrl || process.env.AUGMENT_API_URL;
|
|
17
|
-
// If credentials not provided, try session.json
|
|
18
|
-
if (!(apiKey && apiUrl)) {
|
|
19
|
-
const session = await readSessionFile();
|
|
20
|
-
if (session) {
|
|
21
|
-
apiKey = apiKey || session.accessToken;
|
|
22
|
-
apiUrl = apiUrl || session.tenantURL;
|
|
23
|
-
}
|
|
1
|
+
import { readSessionFile } from "./session-reader.js";
|
|
2
|
+
async function resolveCredentials(options = {}) {
|
|
3
|
+
let apiKey = options.apiKey || process.env.AUGMENT_API_TOKEN;
|
|
4
|
+
let apiUrl = options.apiUrl || process.env.AUGMENT_API_URL;
|
|
5
|
+
if (!(apiKey && apiUrl)) {
|
|
6
|
+
const session = await readSessionFile();
|
|
7
|
+
if (session) {
|
|
8
|
+
apiKey = apiKey || session.accessToken;
|
|
9
|
+
apiUrl = apiUrl || session.tenantURL;
|
|
24
10
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
return { apiKey, apiUrl };
|
|
11
|
+
}
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"API key is required. Provide it via:\n1. options.apiKey parameter\n2. AUGMENT_API_TOKEN environment variable\n3. Run 'auggie login' to create ~/.augment/session.json"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
if (!apiUrl) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
"API URL is required. Provide it via:\n1. options.apiUrl parameter\n2. AUGMENT_API_URL environment variable\n3. Run 'auggie login' to create ~/.augment/session.json"
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return { apiKey, apiUrl };
|
|
39
23
|
}
|
|
40
|
-
|
|
24
|
+
export {
|
|
25
|
+
resolveCredentials
|
|
26
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Retry utilities with exponential backoff
|
|
3
3
|
* Based on clients/sidecar/libs/src/utils/promise-utils.ts
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
type BackoffParams = {
|
|
6
6
|
initialMS: number;
|
|
7
7
|
mult: number;
|
|
8
8
|
maxMS: number;
|
|
@@ -18,7 +18,7 @@ export type BackoffParams = {
|
|
|
18
18
|
* @param backoffParams Backoff parameters
|
|
19
19
|
* @returns Promise that resolves to the function's return value
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
declare function retryWithBackoff<T>(fn: () => Promise<T>, debug?: boolean, backoffParams?: BackoffParams): Promise<T>;
|
|
22
22
|
/**
|
|
23
23
|
* Retry a chat function with exponential backoff
|
|
24
24
|
* Uses chat-specific retry logic that includes 429 and 529 status codes
|
|
@@ -28,5 +28,6 @@ export declare function retryWithBackoff<T>(fn: () => Promise<T>, debug?: boolea
|
|
|
28
28
|
* @param backoffParams Backoff parameters (defaults to chat-optimized settings)
|
|
29
29
|
* @returns Promise that resolves to the function's return value
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
declare function retryChat<T>(fn: () => Promise<T>, debug?: boolean, backoffParams?: BackoffParams): Promise<T>;
|
|
32
|
+
|
|
33
|
+
export { type BackoffParams, retryChat, retryWithBackoff };
|
|
@@ -1,125 +1,71 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retry utilities with exponential backoff
|
|
3
|
-
* Based on clients/sidecar/libs/src/utils/promise-utils.ts
|
|
4
|
-
*/
|
|
5
1
|
const defaultBackoffParams = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
initialMS: 100,
|
|
3
|
+
mult: 2,
|
|
4
|
+
maxMS: 3e4
|
|
9
5
|
};
|
|
10
|
-
/**
|
|
11
|
-
* Delay for the specified number of milliseconds
|
|
12
|
-
*/
|
|
13
6
|
function delayMs(ms) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
if (ms === 0) {
|
|
8
|
+
return Promise.resolve();
|
|
9
|
+
}
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
setTimeout(resolve, ms);
|
|
12
|
+
});
|
|
20
13
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Check if an error is retriable based on its properties
|
|
23
|
-
* Retriable errors include network errors and server errors (5xx)
|
|
24
|
-
*/
|
|
25
14
|
function isRetriableError(e) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// - 503 (unavailable)
|
|
32
|
-
// - 5xx (unavailable)
|
|
33
|
-
//
|
|
34
|
-
// Note: We do NOT retry 429 or 504 by default
|
|
35
|
-
// (only chat streams retry those)
|
|
36
|
-
return status === 499 || status === 503 || (status >= 500 && status < 600);
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
15
|
+
if (e && typeof e === "object" && "status" in e) {
|
|
16
|
+
const status = e.status;
|
|
17
|
+
return status === 499 || status === 503 || status >= 500 && status < 600;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
39
20
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if an error is retriable for chat streaming endpoints
|
|
42
|
-
* Chat streams retry additional status codes beyond the default retry logic
|
|
43
|
-
*/
|
|
44
21
|
function isChatRetriableError(e) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// - 499 (cancelled)
|
|
51
|
-
// - 503 (unavailable)
|
|
52
|
-
// - 529 (overloaded)
|
|
53
|
-
// - 5xx (server errors)
|
|
54
|
-
return (status === 429 ||
|
|
55
|
-
status === 499 ||
|
|
56
|
-
status === 503 ||
|
|
57
|
-
status === 529 ||
|
|
58
|
-
(status >= 500 && status < 600));
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
22
|
+
if (e && typeof e === "object" && "status" in e) {
|
|
23
|
+
const status = e.status;
|
|
24
|
+
return status === 429 || status === 499 || status === 503 || status === 529 || status >= 500 && status < 600;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
61
27
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// Calculate backoff delay
|
|
94
|
-
backoffMs =
|
|
95
|
-
backoffMs === 0
|
|
96
|
-
? backoffParams.initialMS
|
|
97
|
-
: Math.min(backoffMs * backoffParams.mult, backoffParams.maxMS);
|
|
98
|
-
if (debug) {
|
|
99
|
-
console.log(`[RetryUtils] Operation failed with error ${e}, retrying in ${backoffMs} ms; retries = ${tries}`);
|
|
100
|
-
}
|
|
101
|
-
// Check if the backoff delay will exceed total time
|
|
102
|
-
if (backoffParams.maxTotalMs !== undefined &&
|
|
103
|
-
Date.now() - startTime + backoffMs > backoffParams.maxTotalMs) {
|
|
104
|
-
throw e;
|
|
105
|
-
}
|
|
106
|
-
await delayMs(backoffMs);
|
|
107
|
-
}
|
|
28
|
+
async function retryWithBackoff(fn, debug = false, backoffParams = defaultBackoffParams) {
|
|
29
|
+
const canRetryFn = backoffParams.canRetry ?? isRetriableError;
|
|
30
|
+
let backoffMs = 0;
|
|
31
|
+
const startTime = Date.now();
|
|
32
|
+
for (let tries = 0; ; tries++) {
|
|
33
|
+
try {
|
|
34
|
+
const ret = await fn();
|
|
35
|
+
if (tries > 0 && debug) {
|
|
36
|
+
console.log(
|
|
37
|
+
`[RetryUtils] Operation succeeded after ${tries} transient failures`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return ret;
|
|
41
|
+
} catch (e) {
|
|
42
|
+
const currTryCount = tries + 1;
|
|
43
|
+
if (backoffParams.maxTries !== void 0 && currTryCount >= backoffParams.maxTries) {
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
if (!canRetryFn(e)) {
|
|
47
|
+
throw e;
|
|
48
|
+
}
|
|
49
|
+
backoffMs = backoffMs === 0 ? backoffParams.initialMS : Math.min(backoffMs * backoffParams.mult, backoffParams.maxMS);
|
|
50
|
+
if (debug) {
|
|
51
|
+
console.log(
|
|
52
|
+
`[RetryUtils] Operation failed with error ${e}, retrying in ${backoffMs} ms; retries = ${tries}`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (backoffParams.maxTotalMs !== void 0 && Date.now() - startTime + backoffMs > backoffParams.maxTotalMs) {
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
await delayMs(backoffMs);
|
|
108
59
|
}
|
|
60
|
+
}
|
|
109
61
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* @param debug Whether to log debug messages
|
|
116
|
-
* @param backoffParams Backoff parameters (defaults to chat-optimized settings)
|
|
117
|
-
* @returns Promise that resolves to the function's return value
|
|
118
|
-
*/
|
|
119
|
-
export function retryChat(fn, debug = false, backoffParams = defaultBackoffParams) {
|
|
120
|
-
return retryWithBackoff(fn, debug, {
|
|
121
|
-
...backoffParams,
|
|
122
|
-
canRetry: isChatRetriableError,
|
|
123
|
-
});
|
|
62
|
+
function retryChat(fn, debug = false, backoffParams = defaultBackoffParams) {
|
|
63
|
+
return retryWithBackoff(fn, debug, {
|
|
64
|
+
...backoffParams,
|
|
65
|
+
canRetry: isChatRetriableError
|
|
66
|
+
});
|
|
124
67
|
}
|
|
125
|
-
|
|
68
|
+
export {
|
|
69
|
+
retryChat,
|
|
70
|
+
retryWithBackoff
|
|
71
|
+
};
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a question and search results into a prompt for the LLM
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
declare function formatSearchPrompt(question: string, results: string): string;
|
|
8
|
+
|
|
9
|
+
export { formatSearchPrompt };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export function formatSearchPrompt(question, results) {
|
|
8
|
-
return `Relevant context:\n${results}\n\n${question}`;
|
|
1
|
+
function formatSearchPrompt(question, results) {
|
|
2
|
+
return `Relevant context:
|
|
3
|
+
${results}
|
|
4
|
+
|
|
5
|
+
${question}`;
|
|
9
6
|
}
|
|
10
|
-
|
|
7
|
+
export {
|
|
8
|
+
formatSearchPrompt
|
|
9
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Structure of the session.json file created by `auggie login`
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
type SessionData = {
|
|
8
8
|
accessToken: string;
|
|
9
9
|
tenantURL: string;
|
|
10
10
|
scopes?: string[];
|
|
@@ -13,5 +13,6 @@ export type SessionData = {
|
|
|
13
13
|
* Read session data from ~/.augment/session.json
|
|
14
14
|
* Returns null if the file doesn't exist or can't be read
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
declare function readSessionFile(): Promise<SessionData | null>;
|
|
17
|
+
|
|
18
|
+
export { type SessionData, readSessionFile };
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility for reading Augment session file
|
|
3
|
-
*/
|
|
4
1
|
import { readFile } from "node:fs/promises";
|
|
5
2
|
import { homedir } from "node:os";
|
|
6
3
|
import { join } from "node:path";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const content = await readFile(sessionPath, "utf-8");
|
|
15
|
-
const data = JSON.parse(content);
|
|
16
|
-
// Validate required fields
|
|
17
|
-
if (!(data.accessToken && data.tenantURL)) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
// File doesn't exist or can't be read
|
|
24
|
-
return null;
|
|
4
|
+
async function readSessionFile() {
|
|
5
|
+
try {
|
|
6
|
+
const sessionPath = join(homedir(), ".augment", "session.json");
|
|
7
|
+
const content = await readFile(sessionPath, "utf-8");
|
|
8
|
+
const data = JSON.parse(content);
|
|
9
|
+
if (!(data.accessToken && data.tenantURL)) {
|
|
10
|
+
return null;
|
|
25
11
|
}
|
|
12
|
+
return data;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
26
16
|
}
|
|
27
|
-
|
|
17
|
+
export {
|
|
18
|
+
readSessionFile
|
|
19
|
+
};
|
package/dist/context/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a file with path and contents (source-agnostic)
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
type File = {
|
|
8
8
|
/** Relative path (e.g., "src/main.py") */
|
|
9
9
|
path: string;
|
|
10
10
|
/** File contents as string */
|
|
@@ -13,7 +13,7 @@ export type File = {
|
|
|
13
13
|
/**
|
|
14
14
|
* A single code chunk from the retrieval results
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
type Chunk = {
|
|
17
17
|
/** File path relative to workspace root */
|
|
18
18
|
path: string;
|
|
19
19
|
/** Starting line number (1-based) */
|
|
@@ -26,7 +26,7 @@ export type Chunk = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Result from a codebase search query
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
type SearchResult = {
|
|
30
30
|
/** Formatted retrieval results as markdown text */
|
|
31
31
|
formattedRetrieval: string;
|
|
32
32
|
/** Structured list of code chunks */
|
|
@@ -35,20 +35,24 @@ export type SearchResult = {
|
|
|
35
35
|
/**
|
|
36
36
|
* Blob information for a file
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
type BlobInfo = {
|
|
39
39
|
/** SHA-256 hash of the file path and contents */
|
|
40
40
|
blobName: string;
|
|
41
41
|
/** Relative path from workspace root */
|
|
42
42
|
relativePath: string;
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* Blob entry in persistent state - tuple of [
|
|
45
|
+
* Blob entry in persistent state - tuple of [serverBlobId, path, clientBlobId?]
|
|
46
|
+
*
|
|
47
|
+
* The third element (clientBlobId) is optional for backwards compatibility.
|
|
48
|
+
* When present, it indicates the server computed a different blob ID than the client.
|
|
49
|
+
* When absent, assume clientBlobId === serverBlobId.
|
|
46
50
|
*/
|
|
47
|
-
|
|
51
|
+
type BlobEntry = [serverBlobId: string, path: string, clientBlobId?: string];
|
|
48
52
|
/**
|
|
49
53
|
* Blobs payload for API requests
|
|
50
54
|
*/
|
|
51
|
-
|
|
55
|
+
type Blobs = {
|
|
52
56
|
/** Optional checkpoint ID from previous indexing */
|
|
53
57
|
checkpointId?: string;
|
|
54
58
|
/** List of added blob names */
|
|
@@ -59,7 +63,7 @@ export type Blobs = {
|
|
|
59
63
|
/**
|
|
60
64
|
* Result from addToIndex operation
|
|
61
65
|
*/
|
|
62
|
-
|
|
66
|
+
type IndexingResult = {
|
|
63
67
|
/** Paths that were newly uploaded to the backend (queued for indexing) */
|
|
64
68
|
newlyUploaded: string[];
|
|
65
69
|
/** Paths that were already uploaded (content unchanged or already on server) */
|
|
@@ -68,7 +72,7 @@ export type IndexingResult = {
|
|
|
68
72
|
/**
|
|
69
73
|
* Options for configuring the Direct Context
|
|
70
74
|
*/
|
|
71
|
-
|
|
75
|
+
type DirectContextOptions = {
|
|
72
76
|
/**
|
|
73
77
|
* API key for authentication
|
|
74
78
|
* Optional - falls back to AUGMENT_API_TOKEN env var, then ~/.augment/session.json
|
|
@@ -89,7 +93,7 @@ export type DirectContextOptions = {
|
|
|
89
93
|
/**
|
|
90
94
|
* State for Direct Context that can be exported/imported
|
|
91
95
|
*/
|
|
92
|
-
|
|
96
|
+
type DirectContextState = {
|
|
93
97
|
/** Current checkpoint ID */
|
|
94
98
|
checkpointId?: string;
|
|
95
99
|
/** Array of blob names that have been added (pending checkpoint) */
|
|
@@ -102,7 +106,7 @@ export type DirectContextState = {
|
|
|
102
106
|
/**
|
|
103
107
|
* Options for FileSystem Context (MCP mode)
|
|
104
108
|
*/
|
|
105
|
-
|
|
109
|
+
type FileSystemContextOptions = {
|
|
106
110
|
/** Path to the workspace directory to index */
|
|
107
111
|
directory: string;
|
|
108
112
|
/** Path to auggie executable (default: "auggie") */
|
|
@@ -110,4 +114,5 @@ export type FileSystemContextOptions = {
|
|
|
110
114
|
/** Enable debug logging */
|
|
111
115
|
debug?: boolean;
|
|
112
116
|
};
|
|
113
|
-
|
|
117
|
+
|
|
118
|
+
export type { BlobEntry, BlobInfo, Blobs, Chunk, DirectContextOptions, DirectContextState, File, FileSystemContextOptions, IndexingResult, SearchResult };
|
package/dist/context/types.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { Auggie,
|
|
2
|
-
export { DirectContext } from
|
|
3
|
-
export { FileSystemContext } from
|
|
4
|
-
export { APIError } from
|
|
5
|
-
export { BlobTooLargeError } from
|
|
6
|
-
export
|
|
7
|
-
|
|
1
|
+
export { Auggie, PredefinedToolType, ToolIdentifier } from './auggie/sdk-acp-client.js';
|
|
2
|
+
export { DirectContext } from './context/direct-context.js';
|
|
3
|
+
export { FileSystemContext } from './context/filesystem-context.js';
|
|
4
|
+
export { APIError } from './context/internal/api-client.js';
|
|
5
|
+
export { BlobTooLargeError } from './context/internal/blob-name-calculator.js';
|
|
6
|
+
export { BlobEntry, BlobInfo, Blobs, DirectContextOptions, DirectContextState, File, FileSystemContextOptions, IndexingResult } from './context/types.js';
|
|
7
|
+
import '@agentclientprotocol/sdk';
|
|
8
|
+
import 'ai';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
|
|
1
|
+
import {
|
|
2
|
+
Auggie
|
|
3
|
+
} from "./auggie/sdk-acp-client.js";
|
|
4
|
+
import { DirectContext } from "./context/direct-context.js";
|
|
5
|
+
import { FileSystemContext } from "./context/filesystem-context.js";
|
|
6
|
+
import { APIError } from "./context/internal/api-client.js";
|
|
7
|
+
import { BlobTooLargeError } from "./context/internal/blob-name-calculator.js";
|
|
8
|
+
export {
|
|
9
|
+
APIError,
|
|
10
|
+
Auggie,
|
|
11
|
+
BlobTooLargeError,
|
|
12
|
+
DirectContext,
|
|
13
|
+
FileSystemContext
|
|
14
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -12,5 +12,6 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @returns The version string from package.json, or "unknown" if it cannot be read
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
declare function getSDKVersion(): string;
|
|
16
|
+
|
|
17
|
+
export { getSDKVersion };
|
package/dist/version.js
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version information for the Auggie TypeScript SDK
|
|
3
|
-
*
|
|
4
|
-
* This module provides the SDK version by reading it from package.json.
|
|
5
|
-
* The version is read at runtime to ensure it stays in sync with the package.json version.
|
|
6
|
-
*/
|
|
7
1
|
import { readFileSync } from "node:fs";
|
|
8
2
|
import { dirname, join } from "node:path";
|
|
9
3
|
import { fileURLToPath } from "node:url";
|
|
10
4
|
let cachedVersion;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const packageJsonContent = readFileSync(packageJsonPath, "utf-8");
|
|
33
|
-
const packageJson = JSON.parse(packageJsonContent);
|
|
34
|
-
cachedVersion = packageJson.version || "unknown";
|
|
35
|
-
return cachedVersion;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.warn("Failed to read SDK version from package.json:", error instanceof Error ? error.message : String(error));
|
|
39
|
-
cachedVersion = "unknown";
|
|
40
|
-
return cachedVersion;
|
|
41
|
-
}
|
|
5
|
+
function getSDKVersion() {
|
|
6
|
+
if (cachedVersion) {
|
|
7
|
+
return cachedVersion;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const currentFileUrl = import.meta.url;
|
|
11
|
+
const currentFilePath = fileURLToPath(currentFileUrl);
|
|
12
|
+
const currentDir = dirname(currentFilePath);
|
|
13
|
+
const packageJsonPath = join(currentDir, "..", "package.json");
|
|
14
|
+
const packageJsonContent = readFileSync(packageJsonPath, "utf-8");
|
|
15
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
16
|
+
cachedVersion = packageJson.version || "unknown";
|
|
17
|
+
return cachedVersion;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.warn(
|
|
20
|
+
"Failed to read SDK version from package.json:",
|
|
21
|
+
error instanceof Error ? error.message : String(error)
|
|
22
|
+
);
|
|
23
|
+
cachedVersion = "unknown";
|
|
24
|
+
return cachedVersion;
|
|
25
|
+
}
|
|
42
26
|
}
|
|
43
|
-
|
|
27
|
+
export {
|
|
28
|
+
getSDKVersion
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augmentcode/auggie-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "TypeScript SDK for Auggie",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "tsup",
|
|
20
20
|
"prepublishOnly": "bun run build",
|
|
21
21
|
"dev": "bun ./examples/dev.ts",
|
|
22
22
|
"silent": "bun ./examples/silent.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@biomejs/biome": "2.3.4",
|
|
28
28
|
"@types/bun": "latest",
|
|
29
29
|
"husky": "^9.1.7",
|
|
30
|
+
"tsup": "^8.5.1",
|
|
30
31
|
"ultracite": "6.3.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-acp-client.d.ts","sourceRoot":"","sources":["../../src/auggie/sdk-acp-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAUL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAI/B,KAAK,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAE1B,cAAc,GACd,WAAW,GACX,oBAAoB,GACpB,MAAM,GAEN,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,eAAe,GACf,gBAAgB,GAEhB,YAAY,GAEZ,WAAW,GACX,cAAc,GACd,qBAAqB,GACrB,eAAe,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,MAAM,CAAC;AAEzD,KAAK,aAAa,GAAG;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,cAAM,MAAM;IACV,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IACjD,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiC;IAC/D,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,qBAAqB,CAEb;IAChB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+B;IAE7D,OAAO;IAoBP;;;OAGG;WACU,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IASjE;;OAEG;YACW,OAAO;IAyFrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAqCpB;;OAEG;YACW,oBAAoB;IAoBlC;;OAEG;YACW,aAAa;IA2C3B;;;;;;OAMG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,EAAE,YAAoB,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAEtD,GACA,OAAO,CAAC,MAAM,CAAC;IAoFlB;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI;IAItE;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAc7B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B5B;;OAEG;IACH,OAAO,CAAC,WAAW;CAOpB;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|