@zdql/giga-claude-client 1.0.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/dist/client/errors.d.ts +26 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +48 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/index.d.ts +50 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +216 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +60 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +5 -0
- package/dist/client/types.js.map +1 -0
- package/dist/types/api.d.ts +96 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +6 -0
- package/dist/types/api.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for client SDK
|
|
3
|
+
*/
|
|
4
|
+
export declare class GigaClaudeError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class NetworkError extends GigaClaudeError {
|
|
8
|
+
originalError?: any | undefined;
|
|
9
|
+
constructor(message: string, originalError?: any | undefined);
|
|
10
|
+
}
|
|
11
|
+
export declare class ValidationError extends GigaClaudeError {
|
|
12
|
+
details?: any | undefined;
|
|
13
|
+
constructor(message: string, details?: any | undefined);
|
|
14
|
+
}
|
|
15
|
+
export declare class NotFoundError extends GigaClaudeError {
|
|
16
|
+
constructor(message: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class TimeoutError extends GigaClaudeError {
|
|
19
|
+
constructor(message: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class AgentRunError extends GigaClaudeError {
|
|
22
|
+
runId: number;
|
|
23
|
+
status: string;
|
|
24
|
+
constructor(message: string, runId: number, status: string);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,YAAa,SAAQ,eAAe;IACX,aAAa,CAAC,EAAE,GAAG;gBAA3C,OAAO,EAAE,MAAM,EAAS,aAAa,CAAC,EAAE,GAAG,YAAA;CAIxD;AAED,qBAAa,eAAgB,SAAQ,eAAe;IACd,OAAO,CAAC,EAAE,GAAG;gBAArC,OAAO,EAAE,MAAM,EAAS,OAAO,CAAC,EAAE,GAAG,YAAA;CAIlD;AAED,qBAAa,aAAc,SAAQ,eAAe;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,YAAa,SAAQ,eAAe;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAc,SAAQ,eAAe;IAGvC,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;gBAFrB,OAAO,EAAE,MAAM,EACR,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;CAKxB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for client SDK
|
|
3
|
+
*/
|
|
4
|
+
export class GigaClaudeError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "GigaClaudeError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class NetworkError extends GigaClaudeError {
|
|
11
|
+
originalError;
|
|
12
|
+
constructor(message, originalError) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.originalError = originalError;
|
|
15
|
+
this.name = "NetworkError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class ValidationError extends GigaClaudeError {
|
|
19
|
+
details;
|
|
20
|
+
constructor(message, details) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.details = details;
|
|
23
|
+
this.name = "ValidationError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export class NotFoundError extends GigaClaudeError {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = "NotFoundError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class TimeoutError extends GigaClaudeError {
|
|
33
|
+
constructor(message) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "TimeoutError";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export class AgentRunError extends GigaClaudeError {
|
|
39
|
+
runId;
|
|
40
|
+
status;
|
|
41
|
+
constructor(message, runId, status) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.runId = runId;
|
|
44
|
+
this.status = status;
|
|
45
|
+
this.name = "AgentRunError";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,eAAe;IACX;IAApC,YAAY,OAAe,EAAS,aAAmB;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,kBAAa,GAAb,aAAa,CAAM;QAErD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,eAAe;IACd;IAApC,YAAY,OAAe,EAAS,OAAa;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,YAAO,GAAP,OAAO,CAAM;QAE/C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,eAAe;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,eAAe;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,eAAe;IAGvC;IACA;IAHT,YACE,OAAe,EACR,KAAa,EACb,MAAc;QAErB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;QAGrB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Giga-Claude Client SDK
|
|
3
|
+
* Strongly-typed client for interacting with Giga-Claude server
|
|
4
|
+
*/
|
|
5
|
+
import type { ClientOptions, StartRequest, StartResponse, PollOptions, PollResponse, StreamLogsOptions, AgentLog, WaitForCompletionOptions, ArtifactsResponse, ArtifactFile } from "./types.js";
|
|
6
|
+
export declare class GigaClaudeClient {
|
|
7
|
+
private baseUrl;
|
|
8
|
+
private apiKey?;
|
|
9
|
+
private timeout;
|
|
10
|
+
private retries;
|
|
11
|
+
constructor(options: ClientOptions);
|
|
12
|
+
/**
|
|
13
|
+
* Make HTTP request with retry logic
|
|
14
|
+
*/
|
|
15
|
+
private request;
|
|
16
|
+
/**
|
|
17
|
+
* Start a new agent run
|
|
18
|
+
*/
|
|
19
|
+
start(request: StartRequest): Promise<StartResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Poll for agent run status and logs
|
|
22
|
+
*/
|
|
23
|
+
poll(runId: number, options?: PollOptions): Promise<PollResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Stream logs in real-time using polling
|
|
26
|
+
*/
|
|
27
|
+
streamLogs(runId: number, options?: StreamLogsOptions): AsyncGenerator<AgentLog, void, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Wait for agent run to complete
|
|
30
|
+
*/
|
|
31
|
+
waitForCompletion(runId: number, options?: WaitForCompletionOptions): Promise<PollResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Get list of artifacts from agent run
|
|
34
|
+
*/
|
|
35
|
+
getArtifacts(runId: number): Promise<ArtifactsResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Get specific artifact file
|
|
38
|
+
*/
|
|
39
|
+
getArtifactFile(runId: number, path: string): Promise<ArtifactFile>;
|
|
40
|
+
/**
|
|
41
|
+
* Health check
|
|
42
|
+
*/
|
|
43
|
+
health(): Promise<{
|
|
44
|
+
status: string;
|
|
45
|
+
timestamp: string;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
export * from "./types.js";
|
|
49
|
+
export * from "./errors.js";
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACb,MAAM,YAAY,CAAC;AAUpB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,aAAa;IAOlC;;OAEG;YACW,OAAO;IA+ErB;;OAEG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAO1D;;OAEG;IACG,IAAI,CACR,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,YAAY,CAAC;IA2CxB;;OAEG;IACI,UAAU,CACf,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC;IAiC1C;;OAEG;IACG,iBAAiB,CACrB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,YAAY,CAAC;IAyDxB;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI7D;;OAEG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC;IAaxB;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAK/D;AAGD,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Giga-Claude Client SDK
|
|
3
|
+
* Strongly-typed client for interacting with Giga-Claude server
|
|
4
|
+
*/
|
|
5
|
+
import { GigaClaudeError, NetworkError, ValidationError, NotFoundError, TimeoutError, AgentRunError, } from "./errors.js";
|
|
6
|
+
export class GigaClaudeClient {
|
|
7
|
+
baseUrl;
|
|
8
|
+
apiKey;
|
|
9
|
+
timeout;
|
|
10
|
+
retries;
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this.baseUrl = options.baseUrl.replace(/\/$/, ""); // Remove trailing slash
|
|
13
|
+
this.apiKey = options.apiKey;
|
|
14
|
+
this.timeout = options.timeout || 30000; // 30 seconds default
|
|
15
|
+
this.retries = options.retries || 3;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Make HTTP request with retry logic
|
|
19
|
+
*/
|
|
20
|
+
async request(path, options = {}, attempt = 1) {
|
|
21
|
+
const url = `${this.baseUrl}${path}`;
|
|
22
|
+
const headers = {
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
...(options.headers || {}),
|
|
25
|
+
};
|
|
26
|
+
if (this.apiKey) {
|
|
27
|
+
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const controller = new AbortController();
|
|
31
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
32
|
+
const response = await fetch(url, {
|
|
33
|
+
...options,
|
|
34
|
+
headers,
|
|
35
|
+
signal: controller.signal,
|
|
36
|
+
});
|
|
37
|
+
clearTimeout(timeoutId);
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
const error = await response.json().catch(() => ({
|
|
40
|
+
error: `HTTP ${response.status}`,
|
|
41
|
+
}));
|
|
42
|
+
if (response.status === 404) {
|
|
43
|
+
throw new NotFoundError(error.error || "Resource not found");
|
|
44
|
+
}
|
|
45
|
+
else if (response.status === 400) {
|
|
46
|
+
throw new ValidationError(error.error || "Validation failed", error.details);
|
|
47
|
+
}
|
|
48
|
+
else if (response.status >= 500 && attempt < this.retries) {
|
|
49
|
+
// Retry on server errors
|
|
50
|
+
console.warn(`Request failed (attempt ${attempt}/${this.retries}), retrying...`);
|
|
51
|
+
await new Promise((resolve) => setTimeout(resolve, 1000 * attempt));
|
|
52
|
+
return this.request(path, options, attempt + 1);
|
|
53
|
+
}
|
|
54
|
+
throw new GigaClaudeError(error.error || `Request failed with status ${response.status}`);
|
|
55
|
+
}
|
|
56
|
+
return await response.json();
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error.name === "AbortError") {
|
|
60
|
+
throw new TimeoutError(`Request timeout after ${this.timeout}ms`);
|
|
61
|
+
}
|
|
62
|
+
if (error instanceof GigaClaudeError ||
|
|
63
|
+
error instanceof NotFoundError ||
|
|
64
|
+
error instanceof ValidationError) {
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
throw new NetworkError(`Network request failed: ${error instanceof Error ? error.message : String(error)}`, error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Start a new agent run
|
|
72
|
+
*/
|
|
73
|
+
async start(request) {
|
|
74
|
+
return this.request("/start", {
|
|
75
|
+
method: "POST",
|
|
76
|
+
body: JSON.stringify(request),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Poll for agent run status and logs
|
|
81
|
+
*/
|
|
82
|
+
async poll(runId, options) {
|
|
83
|
+
const params = new URLSearchParams();
|
|
84
|
+
if (options?.includeLogs !== undefined) {
|
|
85
|
+
params.set("includeLogs", String(options.includeLogs));
|
|
86
|
+
}
|
|
87
|
+
if (options?.logFilter) {
|
|
88
|
+
if (options.logFilter.type) {
|
|
89
|
+
if (Array.isArray(options.logFilter.type)) {
|
|
90
|
+
options.logFilter.type.forEach((t) => params.append("type", t));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
params.set("type", options.logFilter.type);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (options.logFilter.afterTime) {
|
|
97
|
+
params.set("afterTime", options.logFilter.afterTime);
|
|
98
|
+
}
|
|
99
|
+
if (options.logFilter.beforeTime) {
|
|
100
|
+
params.set("beforeTime", options.logFilter.beforeTime);
|
|
101
|
+
}
|
|
102
|
+
if (options.logFilter.toolName) {
|
|
103
|
+
params.set("toolName", options.logFilter.toolName);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (options?.limit !== undefined) {
|
|
107
|
+
params.set("limit", String(options.limit));
|
|
108
|
+
}
|
|
109
|
+
if (options?.offset !== undefined) {
|
|
110
|
+
params.set("offset", String(options.offset));
|
|
111
|
+
}
|
|
112
|
+
const queryString = params.toString();
|
|
113
|
+
const path = `/poll/${runId}${queryString ? `?${queryString}` : ""}`;
|
|
114
|
+
return this.request(path);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Stream logs in real-time using polling
|
|
118
|
+
*/
|
|
119
|
+
async *streamLogs(runId, options) {
|
|
120
|
+
const pollInterval = options?.pollInterval || 1000;
|
|
121
|
+
let offset = options?.startOffset || 0;
|
|
122
|
+
let lastStatus = "running";
|
|
123
|
+
while (true) {
|
|
124
|
+
const response = await this.poll(runId, {
|
|
125
|
+
includeLogs: true,
|
|
126
|
+
logFilter: options?.logFilter,
|
|
127
|
+
offset,
|
|
128
|
+
});
|
|
129
|
+
// Yield new logs
|
|
130
|
+
if (response.logs && response.logs.length > 0) {
|
|
131
|
+
for (const log of response.logs) {
|
|
132
|
+
yield log;
|
|
133
|
+
}
|
|
134
|
+
offset += response.logs.length;
|
|
135
|
+
}
|
|
136
|
+
// Update status
|
|
137
|
+
lastStatus = response.status;
|
|
138
|
+
// Stop if completed or failed
|
|
139
|
+
if (response.status !== "running") {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
// Wait before next poll
|
|
143
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Wait for agent run to complete
|
|
148
|
+
*/
|
|
149
|
+
async waitForCompletion(runId, options) {
|
|
150
|
+
const pollInterval = options?.pollInterval || 2000;
|
|
151
|
+
const timeout = options?.timeout;
|
|
152
|
+
const startTime = Date.now();
|
|
153
|
+
let lastLogOffset = 0;
|
|
154
|
+
let lastStatus = "running";
|
|
155
|
+
while (true) {
|
|
156
|
+
// Check timeout
|
|
157
|
+
if (timeout && Date.now() - startTime > timeout) {
|
|
158
|
+
throw new TimeoutError(`Agent run ${runId} did not complete within ${timeout}ms`);
|
|
159
|
+
}
|
|
160
|
+
// Poll for status
|
|
161
|
+
const response = await this.poll(runId, {
|
|
162
|
+
includeLogs: !!options?.onLog,
|
|
163
|
+
offset: lastLogOffset,
|
|
164
|
+
});
|
|
165
|
+
// Call status change callback
|
|
166
|
+
if (options?.onStatusChange &&
|
|
167
|
+
response.status !== lastStatus) {
|
|
168
|
+
options.onStatusChange(response.status);
|
|
169
|
+
lastStatus = response.status;
|
|
170
|
+
}
|
|
171
|
+
// Call log callback for new logs
|
|
172
|
+
if (options?.onLog && response.logs && response.logs.length > 0) {
|
|
173
|
+
for (const log of response.logs) {
|
|
174
|
+
options.onLog(log);
|
|
175
|
+
}
|
|
176
|
+
lastLogOffset += response.logs.length;
|
|
177
|
+
}
|
|
178
|
+
// Check if completed
|
|
179
|
+
if (response.status === "completed") {
|
|
180
|
+
return response;
|
|
181
|
+
}
|
|
182
|
+
if (response.status === "failed") {
|
|
183
|
+
throw new AgentRunError(response.error || "Agent run failed", runId, response.status);
|
|
184
|
+
}
|
|
185
|
+
// Wait before next poll
|
|
186
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get list of artifacts from agent run
|
|
191
|
+
*/
|
|
192
|
+
async getArtifacts(runId) {
|
|
193
|
+
return this.request(`/artifacts/${runId}`);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get specific artifact file
|
|
197
|
+
*/
|
|
198
|
+
async getArtifactFile(runId, path) {
|
|
199
|
+
const params = new URLSearchParams({ path });
|
|
200
|
+
const response = await this.request(`/artifacts/${runId}?${params.toString()}`);
|
|
201
|
+
if (!response.file) {
|
|
202
|
+
throw new NotFoundError(`Artifact file not found: ${path}`);
|
|
203
|
+
}
|
|
204
|
+
return response.file;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Health check
|
|
208
|
+
*/
|
|
209
|
+
async health() {
|
|
210
|
+
return this.request("/health");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Export types and errors
|
|
214
|
+
export * from "./types.js";
|
|
215
|
+
export * from "./errors.js";
|
|
216
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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AK,IAAI,kBAAkB,EACpC,KAAK,EACL,QAAQ,CAAC,MAAM,CAChB,CAAC;YACJ,CAAC;YAED,wBAAwB;YACxB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAoB,cAAc,KAAK,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe,CACnB,KAAa,EACb,IAAY;QAEZ,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CACjC,cAAc,KAAK,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAC3C,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,IAAI,aAAa,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,OAAO,CACjB,SAAS,CACV,CAAC;IACJ,CAAC;CACF;AAED,0BAA0B;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for client SDK
|
|
3
|
+
*/
|
|
4
|
+
export type { StartRequest, StartResponse, LogFilter, PollQuery, PollResponse, ArtifactsQuery, ArtifactsResponse, } from "../types/api.js";
|
|
5
|
+
import type { LogFilter } from "../types/api.js";
|
|
6
|
+
/**
|
|
7
|
+
* Client configuration options
|
|
8
|
+
*/
|
|
9
|
+
export interface ClientOptions {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
timeout?: number;
|
|
13
|
+
retries?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Agent log entry
|
|
17
|
+
*/
|
|
18
|
+
export interface AgentLog {
|
|
19
|
+
id: number;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
type: string;
|
|
22
|
+
content: any;
|
|
23
|
+
toolNumber?: number;
|
|
24
|
+
toolName?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Poll options
|
|
28
|
+
*/
|
|
29
|
+
export interface PollOptions {
|
|
30
|
+
includeLogs?: boolean;
|
|
31
|
+
logFilter?: LogFilter;
|
|
32
|
+
limit?: number;
|
|
33
|
+
offset?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Stream logs options
|
|
37
|
+
*/
|
|
38
|
+
export interface StreamLogsOptions {
|
|
39
|
+
pollInterval?: number;
|
|
40
|
+
logFilter?: LogFilter;
|
|
41
|
+
startOffset?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Wait for completion options
|
|
45
|
+
*/
|
|
46
|
+
export interface WaitForCompletionOptions {
|
|
47
|
+
pollInterval?: number;
|
|
48
|
+
timeout?: number;
|
|
49
|
+
onLog?: (log: AgentLog) => void;
|
|
50
|
+
onStatusChange?: (status: string) => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Artifact file
|
|
54
|
+
*/
|
|
55
|
+
export interface ArtifactFile {
|
|
56
|
+
path: string;
|
|
57
|
+
content: string | Buffer;
|
|
58
|
+
mimeType: string;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,S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C;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared API type definitions
|
|
3
|
+
* Used by both server and client packages
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Request to start a new agent run
|
|
7
|
+
*/
|
|
8
|
+
export interface StartRequest {
|
|
9
|
+
prompt: string;
|
|
10
|
+
systemPrompt?: string;
|
|
11
|
+
model?: string;
|
|
12
|
+
allowedTools?: string[];
|
|
13
|
+
maxTurns?: number;
|
|
14
|
+
maxBudgetUsd?: number;
|
|
15
|
+
permissionMode?: "default" | "acceptEdits" | "bypassPermissions";
|
|
16
|
+
env?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Response from starting an agent run
|
|
20
|
+
*/
|
|
21
|
+
export interface StartResponse {
|
|
22
|
+
runId: number;
|
|
23
|
+
sessionId: string;
|
|
24
|
+
status: "running";
|
|
25
|
+
createdAt: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Log filter options
|
|
29
|
+
*/
|
|
30
|
+
export interface LogFilter {
|
|
31
|
+
type?: string | string[];
|
|
32
|
+
afterTime?: string;
|
|
33
|
+
beforeTime?: string;
|
|
34
|
+
toolName?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Query parameters for poll endpoint
|
|
38
|
+
*/
|
|
39
|
+
export interface PollQuery {
|
|
40
|
+
includeLogs?: boolean;
|
|
41
|
+
logFilter?: LogFilter;
|
|
42
|
+
limit?: number;
|
|
43
|
+
offset?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Response from polling an agent run
|
|
47
|
+
*/
|
|
48
|
+
export interface PollResponse {
|
|
49
|
+
runId: number;
|
|
50
|
+
sessionId: string;
|
|
51
|
+
status: "running" | "completed" | "failed";
|
|
52
|
+
model: string;
|
|
53
|
+
prompt: string;
|
|
54
|
+
systemPrompt?: string;
|
|
55
|
+
allowedTools: string[];
|
|
56
|
+
createdAt: string;
|
|
57
|
+
completedAt?: string;
|
|
58
|
+
totalCostUsd?: number;
|
|
59
|
+
error?: string;
|
|
60
|
+
result?: any;
|
|
61
|
+
logs?: Array<{
|
|
62
|
+
id: number;
|
|
63
|
+
timestamp: string;
|
|
64
|
+
type: string;
|
|
65
|
+
content: any;
|
|
66
|
+
toolNumber?: number;
|
|
67
|
+
toolName?: string;
|
|
68
|
+
}>;
|
|
69
|
+
logsCount: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Query parameters for artifacts endpoint
|
|
73
|
+
*/
|
|
74
|
+
export interface ArtifactsQuery {
|
|
75
|
+
path?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Response from artifacts endpoint
|
|
79
|
+
*/
|
|
80
|
+
export interface ArtifactsResponse {
|
|
81
|
+
runId: number;
|
|
82
|
+
source: "live" | "s3" | "none";
|
|
83
|
+
artifacts: Array<{
|
|
84
|
+
path: string;
|
|
85
|
+
type: "file" | "directory";
|
|
86
|
+
size?: number;
|
|
87
|
+
url?: string;
|
|
88
|
+
}>;
|
|
89
|
+
file?: {
|
|
90
|
+
path: string;
|
|
91
|
+
content: string | Buffer;
|
|
92
|
+
mimeType: string;
|
|
93
|
+
url?: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../types/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM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MAAM,CAAC,EAAE,GAAG,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,GAAG,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;IAC/B,SAAS,EAAE,KAAK,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../types/api.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zdql/giga-claude-client",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Strongly-typed client SDK for Giga-Claude",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/client/index.js",
|
|
7
|
+
"types": "./dist/client/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/client/index.d.ts",
|
|
11
|
+
"import": "./dist/client/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"clean": "rm -rf dist"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"typescript": "^5.7.3"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"giga-claude",
|
|
26
|
+
"claude",
|
|
27
|
+
"ai",
|
|
28
|
+
"agent",
|
|
29
|
+
"sdk",
|
|
30
|
+
"client"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT"
|
|
33
|
+
}
|