gopher-orch 0.1.0-20260131-081911

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.
@@ -0,0 +1,80 @@
1
+ /**
2
+ * koffi interface to the gopher-orch native library.
3
+ */
4
+ declare const OpaqueHandle: unique symbol;
5
+ export type GopherOrchHandle = {
6
+ readonly [OpaqueHandle]: 'GopherOrchHandle';
7
+ };
8
+ export interface GopherOrchErrorInfoData {
9
+ code: number;
10
+ message: string | null;
11
+ details: string | null;
12
+ file: string | null;
13
+ line: number;
14
+ }
15
+ /**
16
+ * Wrapper for the gopher-orch native library using koffi.
17
+ */
18
+ export declare class GopherOrchLibrary {
19
+ private static instance;
20
+ private lib;
21
+ private available;
22
+ private debug;
23
+ private _agentCreateByJson;
24
+ private _agentCreateByApiKey;
25
+ private _agentRun;
26
+ private _agentAddRef;
27
+ private _agentRelease;
28
+ private _apiFetchServers;
29
+ private _lastError;
30
+ private _clearError;
31
+ private _free;
32
+ private _setLogLevel;
33
+ private constructor();
34
+ /**
35
+ * Get the library instance, loading it if necessary.
36
+ */
37
+ static getInstance(): GopherOrchLibrary | null;
38
+ /**
39
+ * Check if the library is available.
40
+ */
41
+ static isAvailable(): boolean;
42
+ private loadLibrary;
43
+ private setupFunctions;
44
+ private getLibraryName;
45
+ private getSearchPaths;
46
+ /**
47
+ * Get the path to the platform-specific optional dependency package.
48
+ * These packages are published as gopher-orch-{platform}-{arch}
49
+ * and contain the native library for that specific platform.
50
+ */
51
+ private getPlatformPackagePath;
52
+ agentCreateByJson(provider: string, model: string, serverJson: string): GopherOrchHandle | null;
53
+ agentCreateByApiKey(provider: string, model: string, apiKey: string): GopherOrchHandle | null;
54
+ agentRun(agent: GopherOrchHandle, query: string, timeoutMs: number): string | null;
55
+ agentAddRef(agent: GopherOrchHandle): void;
56
+ agentRelease(agent: GopherOrchHandle): void;
57
+ apiFetchServers(apiKey: string): string | null;
58
+ lastError(): GopherOrchErrorInfoData | null;
59
+ getLastErrorMessage(): string | null;
60
+ clearError(): void;
61
+ free(ptr: unknown): void;
62
+ /**
63
+ * Set the global log level for the native library.
64
+ * Log levels:
65
+ * 0 = Debug (most verbose)
66
+ * 1 = Info
67
+ * 2 = Notice
68
+ * 3 = Warning (default for production)
69
+ * 4 = Error
70
+ * 5 = Critical
71
+ * 6 = Alert
72
+ * 7 = Emergency
73
+ * 8 = Off (no logging)
74
+ *
75
+ * @param level - Log level (0-8)
76
+ */
77
+ setLogLevel(level: number): void;
78
+ }
79
+ export {};
80
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/ffi/library.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,CAAC,MAAM,YAAY,EAAE,OAAO,MAAM,CAAC;AAC1C,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAoB/E,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IACzD,OAAO,CAAC,GAAG,CAAgC;IAC3C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAS;IAGtB,OAAO,CAAC,kBAAkB,CAMV;IAChB,OAAO,CAAC,oBAAoB,CAEZ;IAChB,OAAO,CAAC,SAAS,CAMD;IAChB,OAAO,CAAC,YAAY,CAAoD;IACxE,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,gBAAgB,CAAoD;IAC5E,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,YAAY,CAA0C;IAE9D,OAAO;IAIP;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,iBAAiB,GAAG,IAAI;IAS9C;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,OAAO;IAK7B,OAAO,CAAC,WAAW;IAiEnB,OAAO,CAAC,cAAc;IA4DtB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,cAAc;IA8BtB;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IA8C9B,iBAAiB,CACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,gBAAgB,GAAG,IAAI;IAO1B,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,gBAAgB,GAAG,IAAI;IAO1B,QAAQ,CACN,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI;IAOhB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAM1C,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAO3C,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAQ9C,SAAS,IAAI,uBAAuB,GAAG,IAAI;IAiB3C,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAQpC,UAAU,IAAI,IAAI;IAMlB,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAMxB;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAKjC"}
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+ /**
3
+ * koffi interface to the gopher-orch native library.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.GopherOrchLibrary = void 0;
40
+ const koffi = __importStar(require("koffi"));
41
+ const path = __importStar(require("path"));
42
+ const fs = __importStar(require("fs"));
43
+ const os = __importStar(require("os"));
44
+ /**
45
+ * Error info structure matching C:
46
+ * typedef struct {
47
+ * gopher_orch_error_t code;
48
+ * const char* message;
49
+ * const char* details;
50
+ * const char* file;
51
+ * int32_t line;
52
+ * } gopher_orch_error_info_t;
53
+ */
54
+ const GopherOrchErrorInfo = koffi.struct('GopherOrchErrorInfo', {
55
+ code: 'int32_t',
56
+ message: 'const char*',
57
+ details: 'const char*',
58
+ file: 'const char*',
59
+ line: 'int32_t',
60
+ });
61
+ /**
62
+ * Wrapper for the gopher-orch native library using koffi.
63
+ */
64
+ class GopherOrchLibrary {
65
+ static instance = null;
66
+ lib = null;
67
+ available = false;
68
+ debug = false;
69
+ // Function bindings
70
+ _agentCreateByJson = null;
71
+ _agentCreateByApiKey = null;
72
+ _agentRun = null;
73
+ _agentAddRef = null;
74
+ _agentRelease = null;
75
+ _apiFetchServers = null;
76
+ _lastError = null;
77
+ _clearError = null;
78
+ _free = null;
79
+ _setLogLevel = null;
80
+ constructor() {
81
+ this.loadLibrary();
82
+ }
83
+ /**
84
+ * Get the library instance, loading it if necessary.
85
+ */
86
+ static getInstance() {
87
+ if (GopherOrchLibrary.instance === null) {
88
+ GopherOrchLibrary.instance = new GopherOrchLibrary();
89
+ }
90
+ return GopherOrchLibrary.instance.available
91
+ ? GopherOrchLibrary.instance
92
+ : null;
93
+ }
94
+ /**
95
+ * Check if the library is available.
96
+ */
97
+ static isAvailable() {
98
+ const instance = GopherOrchLibrary.getInstance();
99
+ return instance !== null && instance.available;
100
+ }
101
+ loadLibrary() {
102
+ this.debug = process.env['DEBUG'] !== undefined;
103
+ const libraryName = this.getLibraryName();
104
+ const searchPaths = this.getSearchPaths();
105
+ // Try custom path from environment variable
106
+ const envPath = process.env['GOPHER_ORCH_LIBRARY_PATH'];
107
+ if (envPath && fs.existsSync(envPath)) {
108
+ try {
109
+ this.lib = koffi.load(envPath);
110
+ this.setupFunctions();
111
+ this.available = true;
112
+ return;
113
+ }
114
+ catch (e) {
115
+ if (this.debug) {
116
+ console.error(`Failed to load from GOPHER_ORCH_LIBRARY_PATH: ${e.message}`);
117
+ }
118
+ }
119
+ }
120
+ // Try search paths
121
+ for (const searchPath of searchPaths) {
122
+ const libFile = path.join(searchPath, libraryName);
123
+ if (fs.existsSync(libFile)) {
124
+ try {
125
+ this.lib = koffi.load(libFile);
126
+ this.setupFunctions();
127
+ this.available = true;
128
+ return;
129
+ }
130
+ catch (e) {
131
+ if (this.debug) {
132
+ console.error(`Failed to load from ${searchPath}: ${e.message}`);
133
+ }
134
+ }
135
+ }
136
+ }
137
+ // Try loading by name (system paths)
138
+ const systemLibName = os.platform() === 'darwin' ? 'libgopher-orch.dylib' : 'libgopher-orch.so';
139
+ try {
140
+ this.lib = koffi.load(systemLibName);
141
+ this.setupFunctions();
142
+ this.available = true;
143
+ return;
144
+ }
145
+ catch (e) {
146
+ if (this.debug) {
147
+ console.error(`Failed to load gopher-orch library: ${e.message}`);
148
+ console.error('Searched paths:');
149
+ for (const p of searchPaths) {
150
+ console.error(` - ${p}`);
151
+ }
152
+ }
153
+ }
154
+ this.available = false;
155
+ }
156
+ setupFunctions() {
157
+ if (this.lib === null) {
158
+ return;
159
+ }
160
+ // Agent functions
161
+ this._agentCreateByJson = this.lib.func('gopher_orch_agent_create_by_json', 'void*', ['const char*', 'const char*', 'const char*']);
162
+ this._agentCreateByApiKey = this.lib.func('gopher_orch_agent_create_by_api_key', 'void*', ['const char*', 'const char*', 'const char*']);
163
+ this._agentRun = this.lib.func('gopher_orch_agent_run', 'const char*', [
164
+ 'void*',
165
+ 'const char*',
166
+ 'int64_t',
167
+ ]);
168
+ this._agentAddRef = this.lib.func('gopher_orch_agent_add_ref', 'void', [
169
+ 'void*',
170
+ ]);
171
+ this._agentRelease = this.lib.func('gopher_orch_agent_release', 'void', [
172
+ 'void*',
173
+ ]);
174
+ // API functions
175
+ this._apiFetchServers = this.lib.func('gopher_orch_api_fetch_servers', 'const char*', ['const char*']);
176
+ // Error functions
177
+ this._lastError = this.lib.func('gopher_orch_last_error', koffi.pointer(GopherOrchErrorInfo), []);
178
+ this._clearError = this.lib.func('gopher_orch_clear_error', 'void', []);
179
+ this._free = this.lib.func('gopher_orch_free', 'void', ['void*']);
180
+ // Logging functions
181
+ this._setLogLevel = this.lib.func('gopher_orch_set_log_level', 'void', [
182
+ 'int',
183
+ ]);
184
+ // Set default log level to Warning (3) for production use
185
+ // This suppresses debug and info logs that appear during normal operation
186
+ this._setLogLevel(3);
187
+ }
188
+ getLibraryName() {
189
+ switch (os.platform()) {
190
+ case 'darwin':
191
+ return 'libgopher-orch.dylib';
192
+ case 'win32':
193
+ return 'gopher-orch.dll';
194
+ default:
195
+ return 'libgopher-orch.so';
196
+ }
197
+ }
198
+ getSearchPaths() {
199
+ const paths = [];
200
+ // 1. Try platform-specific optional dependency package (npm distribution)
201
+ const platformPackagePath = this.getPlatformPackagePath();
202
+ if (platformPackagePath) {
203
+ paths.push(platformPackagePath);
204
+ }
205
+ // 2. Get the directory containing this module for development fallbacks
206
+ const moduleDir = path.dirname(path.dirname(__dirname));
207
+ // Development paths (native/lib in various locations)
208
+ paths.push(
209
+ // Project root native/lib
210
+ path.join(process.cwd(), 'native', 'lib'),
211
+ // Relative to module location
212
+ path.join(moduleDir, 'native', 'lib'), path.join(path.dirname(moduleDir), 'native', 'lib'));
213
+ // 3. System paths as last resort
214
+ if (os.platform() === 'darwin') {
215
+ paths.push('/usr/local/lib', '/opt/homebrew/lib');
216
+ }
217
+ paths.push('/usr/lib');
218
+ return paths;
219
+ }
220
+ /**
221
+ * Get the path to the platform-specific optional dependency package.
222
+ * These packages are published as gopher-orch-{platform}-{arch}
223
+ * and contain the native library for that specific platform.
224
+ */
225
+ getPlatformPackagePath() {
226
+ const platform = os.platform(); // 'darwin', 'linux', 'win32'
227
+ const arch = os.arch(); // 'arm64', 'x64'
228
+ // Map Node.js platform names to package names
229
+ const platformMap = {
230
+ darwin: 'darwin',
231
+ linux: 'linux',
232
+ win32: 'win32',
233
+ };
234
+ const platformName = platformMap[platform];
235
+ if (!platformName) {
236
+ if (this.debug) {
237
+ console.error(`Unsupported platform: ${platform}`);
238
+ }
239
+ return null;
240
+ }
241
+ // Construct the package name: @gopher-test/gopher-orch-darwin-arm64, etc.
242
+ const packageName = `@gopher-test/gopher-orch-${platformName}-${arch}`;
243
+ try {
244
+ // Try to resolve the package.json of the platform-specific package
245
+ const packageJsonPath = require.resolve(`${packageName}/package.json`);
246
+ const packageDir = path.dirname(packageJsonPath);
247
+ const libPath = path.join(packageDir, 'lib');
248
+ if (fs.existsSync(libPath)) {
249
+ if (this.debug) {
250
+ console.log(`Found platform package at: ${libPath}`);
251
+ }
252
+ return libPath;
253
+ }
254
+ }
255
+ catch {
256
+ // Package not installed - this is expected on platforms where
257
+ // the optional dependency wasn't installed
258
+ if (this.debug) {
259
+ console.log(`Platform package ${packageName} not found`);
260
+ }
261
+ }
262
+ return null;
263
+ }
264
+ // Agent functions
265
+ agentCreateByJson(provider, model, serverJson) {
266
+ if (!this.available || this._agentCreateByJson === null) {
267
+ return null;
268
+ }
269
+ return this._agentCreateByJson(provider, model, serverJson);
270
+ }
271
+ agentCreateByApiKey(provider, model, apiKey) {
272
+ if (!this.available || this._agentCreateByApiKey === null) {
273
+ return null;
274
+ }
275
+ return this._agentCreateByApiKey(provider, model, apiKey);
276
+ }
277
+ agentRun(agent, query, timeoutMs) {
278
+ if (!this.available || this._agentRun === null) {
279
+ return null;
280
+ }
281
+ return this._agentRun(agent, query, BigInt(timeoutMs));
282
+ }
283
+ agentAddRef(agent) {
284
+ if (this.available && this._agentAddRef !== null) {
285
+ this._agentAddRef(agent);
286
+ }
287
+ }
288
+ agentRelease(agent) {
289
+ if (this.available && this._agentRelease !== null) {
290
+ this._agentRelease(agent);
291
+ }
292
+ }
293
+ // API functions
294
+ apiFetchServers(apiKey) {
295
+ if (!this.available || this._apiFetchServers === null) {
296
+ return null;
297
+ }
298
+ return this._apiFetchServers(apiKey);
299
+ }
300
+ // Error functions
301
+ lastError() {
302
+ if (!this.available || this._lastError === null) {
303
+ return null;
304
+ }
305
+ const errorPtr = this._lastError();
306
+ if (errorPtr === null) {
307
+ return null;
308
+ }
309
+ try {
310
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
311
+ const decoded = koffi.decode(errorPtr, GopherOrchErrorInfo);
312
+ return decoded;
313
+ }
314
+ catch {
315
+ return null;
316
+ }
317
+ }
318
+ getLastErrorMessage() {
319
+ const errorInfo = this.lastError();
320
+ if (errorInfo && errorInfo.message) {
321
+ return errorInfo.message;
322
+ }
323
+ return null;
324
+ }
325
+ clearError() {
326
+ if (this.available && this._clearError !== null) {
327
+ this._clearError();
328
+ }
329
+ }
330
+ free(ptr) {
331
+ if (this.available && this._free !== null) {
332
+ this._free(ptr);
333
+ }
334
+ }
335
+ /**
336
+ * Set the global log level for the native library.
337
+ * Log levels:
338
+ * 0 = Debug (most verbose)
339
+ * 1 = Info
340
+ * 2 = Notice
341
+ * 3 = Warning (default for production)
342
+ * 4 = Error
343
+ * 5 = Critical
344
+ * 6 = Alert
345
+ * 7 = Emergency
346
+ * 8 = Off (no logging)
347
+ *
348
+ * @param level - Log level (0-8)
349
+ */
350
+ setLogLevel(level) {
351
+ if (this.available && this._setLogLevel !== null) {
352
+ this._setLogLevel(level);
353
+ }
354
+ }
355
+ }
356
+ exports.GopherOrchLibrary = GopherOrchLibrary;
357
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/ffi/library.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,2CAA6B;AAC7B,uCAAyB;AACzB,uCAAyB;AAOzB;;;;;;;;;GASG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAAE;IAC9D,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,SAAS;CAChB,CAAC,CAAC;AAUH;;GAEG;AACH,MAAa,iBAAiB;IACpB,MAAM,CAAC,QAAQ,GAA6B,IAAI,CAAC;IACjD,GAAG,GAA2B,IAAI,CAAC;IACnC,SAAS,GAAG,KAAK,CAAC;IAClB,KAAK,GAAG,KAAK,CAAC;IAEtB,oBAAoB;IACZ,kBAAkB,GAMf,IAAI,CAAC;IACR,oBAAoB,GAEjB,IAAI,CA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AAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,mBAAmB;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACnC,IAAI,SAAS,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACnC,OAAO,SAAS,CAAC,OAAO,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU;QACR,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;YAChD,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAY;QACf,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,KAAa;QACvB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;YACjD,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;;AA/XH,8CAgYC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * gopher-orch TypeScript SDK
3
+ *
4
+ * TypeScript SDK for Gopher Orch - AI Agent orchestration framework with native performance.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { GopherAgent, GopherAgentConfig } from 'gopher-orch';
9
+ *
10
+ * // Create an agent with API key
11
+ * const agent = GopherAgent.create(
12
+ * GopherAgentConfig.builder()
13
+ * .provider('AnthropicProvider')
14
+ * .model('claude-3-haiku-20240307')
15
+ * .apiKey('your-api-key')
16
+ * .build()
17
+ * );
18
+ *
19
+ * // Run a query
20
+ * const answer = agent.run('What time is it in Tokyo?');
21
+ * console.log(answer);
22
+ *
23
+ * // Cleanup
24
+ * agent.dispose();
25
+ * ```
26
+ */
27
+ export { GopherAgent } from './agent';
28
+ export { GopherAgentConfig, GopherAgentConfigBuilder } from './config';
29
+ export type { GopherAgentConfigOptions } from './config';
30
+ export { AgentResult, AgentResultBuilder, AgentResultStatus } from './result';
31
+ export type { AgentResultOptions } from './result';
32
+ export { ServerConfig } from './serverConfig';
33
+ export { AgentError, ApiKeyError, ConnectionError, TimeoutError, } from './errors';
34
+ export { GopherOrchLibrary } from './ffi';
35
+ export type { GopherOrchHandle, GopherOrchErrorInfoData } from './ffi';
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,GACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * gopher-orch TypeScript SDK
4
+ *
5
+ * TypeScript SDK for Gopher Orch - AI Agent orchestration framework with native performance.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { GopherAgent, GopherAgentConfig } from 'gopher-orch';
10
+ *
11
+ * // Create an agent with API key
12
+ * const agent = GopherAgent.create(
13
+ * GopherAgentConfig.builder()
14
+ * .provider('AnthropicProvider')
15
+ * .model('claude-3-haiku-20240307')
16
+ * .apiKey('your-api-key')
17
+ * .build()
18
+ * );
19
+ *
20
+ * // Run a query
21
+ * const answer = agent.run('What time is it in Tokyo?');
22
+ * console.log(answer);
23
+ *
24
+ * // Cleanup
25
+ * agent.dispose();
26
+ * ```
27
+ */
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.GopherOrchLibrary = exports.TimeoutError = exports.ConnectionError = exports.ApiKeyError = exports.AgentError = exports.ServerConfig = exports.AgentResultStatus = exports.AgentResultBuilder = exports.AgentResult = exports.GopherAgentConfigBuilder = exports.GopherAgentConfig = exports.GopherAgent = void 0;
30
+ // Main exports
31
+ var agent_1 = require("./agent");
32
+ Object.defineProperty(exports, "GopherAgent", { enumerable: true, get: function () { return agent_1.GopherAgent; } });
33
+ var config_1 = require("./config");
34
+ Object.defineProperty(exports, "GopherAgentConfig", { enumerable: true, get: function () { return config_1.GopherAgentConfig; } });
35
+ Object.defineProperty(exports, "GopherAgentConfigBuilder", { enumerable: true, get: function () { return config_1.GopherAgentConfigBuilder; } });
36
+ var result_1 = require("./result");
37
+ Object.defineProperty(exports, "AgentResult", { enumerable: true, get: function () { return result_1.AgentResult; } });
38
+ Object.defineProperty(exports, "AgentResultBuilder", { enumerable: true, get: function () { return result_1.AgentResultBuilder; } });
39
+ Object.defineProperty(exports, "AgentResultStatus", { enumerable: true, get: function () { return result_1.AgentResultStatus; } });
40
+ var serverConfig_1 = require("./serverConfig");
41
+ Object.defineProperty(exports, "ServerConfig", { enumerable: true, get: function () { return serverConfig_1.ServerConfig; } });
42
+ // Error exports
43
+ var errors_1 = require("./errors");
44
+ Object.defineProperty(exports, "AgentError", { enumerable: true, get: function () { return errors_1.AgentError; } });
45
+ Object.defineProperty(exports, "ApiKeyError", { enumerable: true, get: function () { return errors_1.ApiKeyError; } });
46
+ Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return errors_1.ConnectionError; } });
47
+ Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_1.TimeoutError; } });
48
+ // FFI exports (for advanced use)
49
+ var ffi_1 = require("./ffi");
50
+ Object.defineProperty(exports, "GopherOrchLibrary", { enumerable: true, get: function () { return ffi_1.GopherOrchLibrary; } });
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,eAAe;AACf,iCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,mCAAuE;AAA9D,2GAAA,iBAAiB,OAAA;AAAE,kHAAA,wBAAwB,OAAA;AAEpD,mCAA8E;AAArE,qGAAA,WAAW,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAE3D,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,gBAAgB;AAChB,mCAKkB;AAJhB,oGAAA,UAAU,OAAA;AACV,qGAAA,WAAW,OAAA;AACX,yGAAA,eAAe,OAAA;AACf,sGAAA,YAAY,OAAA;AAGd,iCAAiC;AACjC,6BAA0C;AAAjC,wGAAA,iBAAiB,OAAA"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Status of agent query execution.
3
+ */
4
+ export declare enum AgentResultStatus {
5
+ SUCCESS = "success",
6
+ ERROR = "error",
7
+ TIMEOUT = "timeout"
8
+ }
9
+ /**
10
+ * Options for creating an AgentResult.
11
+ */
12
+ export interface AgentResultOptions {
13
+ response: string;
14
+ status: AgentResultStatus;
15
+ iterationCount?: number;
16
+ tokensUsed?: number;
17
+ }
18
+ /**
19
+ * Result from agent query execution.
20
+ */
21
+ export declare class AgentResult {
22
+ readonly response: string;
23
+ readonly status: AgentResultStatus;
24
+ readonly iterationCount?: number;
25
+ readonly tokensUsed?: number;
26
+ private constructor();
27
+ /**
28
+ * Check if the result is a success.
29
+ */
30
+ isSuccess(): boolean;
31
+ /**
32
+ * Create a new builder for AgentResult.
33
+ */
34
+ static builder(): AgentResultBuilder;
35
+ /**
36
+ * Create a success result.
37
+ */
38
+ static success(response: string): AgentResult;
39
+ /**
40
+ * Create an error result.
41
+ */
42
+ static error(message: string): AgentResult;
43
+ /**
44
+ * Create a timeout result.
45
+ */
46
+ static timeout(message: string): AgentResult;
47
+ /**
48
+ * String representation of the result.
49
+ */
50
+ toString(): string;
51
+ }
52
+ /**
53
+ * Builder for AgentResult.
54
+ */
55
+ export declare class AgentResultBuilder {
56
+ private _response?;
57
+ private _status?;
58
+ private _iterationCount?;
59
+ private _tokensUsed?;
60
+ /**
61
+ * Set the response.
62
+ */
63
+ response(response: string): this;
64
+ /**
65
+ * Set the status.
66
+ */
67
+ status(status: AgentResultStatus): this;
68
+ /**
69
+ * Set the iteration count.
70
+ */
71
+ iterationCount(iterationCount: number): this;
72
+ /**
73
+ * Set the tokens used.
74
+ */
75
+ tokensUsed(tokensUsed: number): this;
76
+ /**
77
+ * Build the AgentResult.
78
+ */
79
+ build(): AgentResult;
80
+ }
81
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,MAAM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