@geoffai/geoff 0.1.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.
@@ -0,0 +1,579 @@
1
+ import { C as ChatCompletionRequest, e as ChatCompletionChunk, c as TaskPayload, g as MagmaFile, i as ImaginationMetadata, v as MCPSessionConfig, w as MCPSession, z as MCPToolResult, U as SocialClientConfig, B as MediaType, G as FeedResponse, P as PostResponse, H as CommentsResponse, R as RemixesResponse, L as LikeCheckResponse, J as LikeResponse, K as CommentResponse, N as CreatePostInput, O as CreatePostResponse, Q as ProfileResponse, u as AgentsClientConfig, p as AgentsListResponse, A as Agent, r as AgentCreateInput, q as AgentResponse, s as AgentUpdateInput, n as AgentExecuteRequest, o as AgentExecuteResponse, t as AgentFromPromptInput, a0 as WidgetsClientConfig, X as WidgetsListResponse, V as Widget, Z as WidgetCreateInput, Y as WidgetResponse, _ as WidgetUpdateInput, $ as WidgetSystemPromptResponse, a4 as UserClientConfig, a1 as UserProfile, a2 as UserProfileUpdateInput, a3 as UserProfileResponse, a6 as FilesClientConfig, a5 as FileUploadResponse, ad as SkillsClientConfig, a9 as SkillsListResponse, a7 as Skill, ab as SkillCreateInput, aa as SkillResponse, ac as SkillUpdateInput, a8 as SkillVerifyResponse, ae as SkillMapResponse, af as SkillMapPromptResponse, ag as SkillSummaryResponse, aJ as PointsClientConfig, aH as InitNetworkResponse, ay as DomainsListResponse, ah as ContextDomain, ar as CreateDomainInput, az as DomainResponse, aA as ContextsListResponse, ai as PointContext, as as CreateContextInput, aB as ContextResponse, ax as DelegationFilters, aC as DelegationsListResponse, at as CreateDelegationInput, aD as DelegationResponse, au as AddPointsInput, aE as PointRecordResponse, av as SpendPointsInput, aF as PointSpendResponse, aq as PointBalance, aw as HistoryFilters, aG as HistoryResponse } from './points-CGAg3YZi.cjs';
2
+
3
+ /**
4
+ * TaskNetworkClient - OpenAI-compatible SDK for GeoffNet
5
+ *
6
+ * Provides streaming chat completions via the local GeoffNet
7
+ */
8
+
9
+ interface TaskNetworkConfig {
10
+ baseUrl?: string;
11
+ apiKey?: string;
12
+ timeout?: number;
13
+ }
14
+ declare class TaskNetworkClient {
15
+ private baseUrl;
16
+ private apiKey?;
17
+ private timeout;
18
+ constructor(config?: TaskNetworkConfig);
19
+ /**
20
+ * OpenAI-compatible streaming chat completions
21
+ */
22
+ chatCompletions(request: ChatCompletionRequest): AsyncIterable<ChatCompletionChunk>;
23
+ /**
24
+ * Submit a task to the network
25
+ */
26
+ submitTask(payload: TaskPayload): Promise<string>;
27
+ /**
28
+ * Get task status
29
+ */
30
+ getTask(taskId: string): Promise<{
31
+ status: string;
32
+ result?: unknown;
33
+ }>;
34
+ /**
35
+ * Stream task results as OpenAI-compatible chunks
36
+ */
37
+ streamTaskResults(taskId: string, model: string): AsyncIterable<ChatCompletionChunk>;
38
+ /**
39
+ * Stream raw task results (not OpenAI format)
40
+ */
41
+ streamTaskRaw(taskId: string): AsyncIterable<unknown>;
42
+ /**
43
+ * Health check
44
+ */
45
+ healthCheck(): Promise<boolean>;
46
+ /**
47
+ * Get node information
48
+ */
49
+ getNode(): Promise<unknown>;
50
+ }
51
+ /**
52
+ * Factory function to create a client
53
+ */
54
+ declare function createTaskNetworkClient(config?: TaskNetworkConfig): TaskNetworkClient;
55
+ /**
56
+ * Default singleton instance
57
+ */
58
+ declare const taskNetworkClient: TaskNetworkClient;
59
+
60
+ /**
61
+ * MagmaClient - File storage and imagination management
62
+ *
63
+ * Interfaces with the MetaChain P2P network for distributed file storage
64
+ */
65
+
66
+ interface MagmaClientConfig {
67
+ baseUrl?: string;
68
+ localServerUrl?: string;
69
+ }
70
+ declare class MagmaClient {
71
+ private baseUrl;
72
+ private localServerUrl;
73
+ constructor(config?: MagmaClientConfig);
74
+ /**
75
+ * Upload a file and get its CID
76
+ */
77
+ uploadFile(file: File): Promise<MagmaFile>;
78
+ /**
79
+ * Upload text content and get its CID
80
+ */
81
+ uploadText(text: string, name: string): Promise<MagmaFile>;
82
+ /**
83
+ * Store imagination metadata in P2P network
84
+ */
85
+ storeImagination(imagination: ImaginationMetadata & {
86
+ is_public?: boolean;
87
+ }): Promise<string>;
88
+ /**
89
+ * Retrieve imagination from P2P network by ID
90
+ */
91
+ getImagination(id: string): Promise<ImaginationMetadata | null>;
92
+ /**
93
+ * Get imagination by CID
94
+ */
95
+ getImaginationByCID(cid: string): Promise<ImaginationMetadata | null>;
96
+ /**
97
+ * List all imaginations for a user
98
+ */
99
+ listImaginations(creatorMid?: string): Promise<ImaginationMetadata[]>;
100
+ /**
101
+ * Fallback method to list imaginations from localStorage
102
+ */
103
+ private listImaginationsFromLocalStorage;
104
+ /**
105
+ * Retrieve file from Magma network
106
+ */
107
+ getFile(cid: string): Promise<Blob | null>;
108
+ /**
109
+ * Helper to convert ArrayBuffer to base64
110
+ */
111
+ private arrayBufferToBase64;
112
+ }
113
+ /**
114
+ * Factory function to create a client
115
+ */
116
+ declare function createMagmaClient(config?: MagmaClientConfig): MagmaClient;
117
+ /**
118
+ * Default singleton instance
119
+ */
120
+ declare const magmaClient: MagmaClient;
121
+
122
+ /**
123
+ * MCPClient - Model Context Protocol client
124
+ *
125
+ * Simple MCP client for communicating with magmanode MCP services
126
+ */
127
+
128
+ declare class MCPClient {
129
+ private baseUrl;
130
+ private timeout;
131
+ private sessions;
132
+ constructor(config?: MCPSessionConfig);
133
+ /**
134
+ * Create a new MCP session
135
+ */
136
+ createSession(agentId?: string): Promise<MCPSession>;
137
+ /**
138
+ * Get session by ID
139
+ */
140
+ getSession(sessionId: string): MCPSession | undefined;
141
+ /**
142
+ * Close a session
143
+ */
144
+ closeSession(sessionId: string): Promise<void>;
145
+ /**
146
+ * Send a message to an MCP session
147
+ */
148
+ sendMessage(sessionId: string, message: string): Promise<unknown>;
149
+ /**
150
+ * Call an MCP tool
151
+ */
152
+ callTool(sessionId: string, toolName: string, args?: Record<string, unknown>): Promise<MCPToolResult>;
153
+ /**
154
+ * List available tools for a session
155
+ */
156
+ listTools(sessionId: string): Promise<string[]>;
157
+ /**
158
+ * Get all active sessions
159
+ */
160
+ getActiveSessions(): MCPSession[];
161
+ /**
162
+ * Close all sessions
163
+ */
164
+ closeAllSessions(): Promise<void>;
165
+ }
166
+ /**
167
+ * Factory function to create a client
168
+ */
169
+ declare function createMCPClient(config?: MCPSessionConfig): MCPClient;
170
+ /**
171
+ * Default singleton instance
172
+ */
173
+ declare const mcpClient: MCPClient;
174
+
175
+ /**
176
+ * Social Network Client
177
+ * Client for interacting with the P2P social network API
178
+ */
179
+
180
+ declare class SocialClient {
181
+ private baseUrl;
182
+ constructor(config?: SocialClientConfig);
183
+ private get socialUrl();
184
+ /**
185
+ * Fetch feed with pagination
186
+ */
187
+ getFeed(options?: {
188
+ page?: number;
189
+ limit?: number;
190
+ mediaType?: MediaType;
191
+ }): Promise<FeedResponse>;
192
+ /**
193
+ * Fetch a single post by ID
194
+ */
195
+ getPost(postId: string): Promise<PostResponse>;
196
+ /**
197
+ * Fetch comments for a post
198
+ */
199
+ getComments(postId: string): Promise<CommentsResponse>;
200
+ /**
201
+ * Fetch remixes for a post
202
+ */
203
+ getRemixes(postId: string): Promise<RemixesResponse>;
204
+ /**
205
+ * Check if a user has liked a post
206
+ */
207
+ checkLike(postId: string, userMid: string): Promise<LikeCheckResponse>;
208
+ /**
209
+ * Like a post
210
+ */
211
+ likePost(postId: string, userMid: string): Promise<LikeResponse>;
212
+ /**
213
+ * Unlike a post
214
+ */
215
+ unlikePost(postId: string, userMid: string): Promise<LikeResponse>;
216
+ /**
217
+ * Add a comment to a post
218
+ */
219
+ addComment(postId: string, userMid: string, content: string): Promise<CommentResponse>;
220
+ /**
221
+ * Create a new post
222
+ */
223
+ createPost(input: CreatePostInput): Promise<CreatePostResponse>;
224
+ /**
225
+ * Track a view on a post
226
+ */
227
+ trackView(postId: string, userMid?: string): Promise<void>;
228
+ /**
229
+ * Track a play on audio/video post
230
+ */
231
+ trackPlay(postId: string, userMid?: string): Promise<void>;
232
+ /**
233
+ * Get user profile by MID
234
+ */
235
+ getProfile(mid: string): Promise<ProfileResponse | null>;
236
+ }
237
+ /**
238
+ * Create a SocialClient instance
239
+ */
240
+ declare function createSocialClient(config?: SocialClientConfig): SocialClient;
241
+ /**
242
+ * Default social client instance
243
+ */
244
+ declare const socialClient: SocialClient;
245
+
246
+ /**
247
+ * Agents Client
248
+ * Client for interacting with the agents API
249
+ */
250
+
251
+ declare class AgentsClient {
252
+ private baseUrl;
253
+ private useCpxApi;
254
+ constructor(config?: AgentsClientConfig);
255
+ private get agentsUrl();
256
+ /**
257
+ * List all agents
258
+ */
259
+ list(options?: {
260
+ userMid?: string;
261
+ }): Promise<AgentsListResponse>;
262
+ /**
263
+ * Get an agent by ID
264
+ */
265
+ get(id: string): Promise<Agent>;
266
+ /**
267
+ * Create a new agent
268
+ */
269
+ create(input: AgentCreateInput): Promise<AgentResponse>;
270
+ /**
271
+ * Update an agent
272
+ */
273
+ update(id: string, input: AgentUpdateInput): Promise<AgentResponse>;
274
+ /**
275
+ * Delete an agent
276
+ */
277
+ delete(id: string): Promise<{
278
+ success: boolean;
279
+ }>;
280
+ /**
281
+ * Enable an agent
282
+ */
283
+ enable(id: string): Promise<AgentResponse>;
284
+ /**
285
+ * Disable an agent
286
+ */
287
+ disable(id: string): Promise<AgentResponse>;
288
+ /**
289
+ * Execute an agent
290
+ */
291
+ execute(id: string, request?: AgentExecuteRequest): Promise<AgentExecuteResponse>;
292
+ /**
293
+ * Create agent from prompt (AI-generated)
294
+ */
295
+ createFromPrompt(input: AgentFromPromptInput): Promise<AgentResponse>;
296
+ }
297
+ /**
298
+ * Create an AgentsClient instance
299
+ */
300
+ declare function createAgentsClient(config?: AgentsClientConfig): AgentsClient;
301
+ /**
302
+ * Default agents client instance
303
+ */
304
+ declare const agentsClient: AgentsClient;
305
+
306
+ /**
307
+ * Widgets Client
308
+ * Client for interacting with the widgets API
309
+ */
310
+
311
+ declare class WidgetsClient {
312
+ private baseUrl;
313
+ constructor(config?: WidgetsClientConfig);
314
+ private get widgetsUrl();
315
+ /**
316
+ * List all widgets
317
+ */
318
+ list(options?: {
319
+ scope?: 'public' | 'private';
320
+ creatorMid?: string;
321
+ }): Promise<WidgetsListResponse>;
322
+ /**
323
+ * Get a widget by ID
324
+ */
325
+ get(id: string): Promise<Widget>;
326
+ /**
327
+ * Create a new widget
328
+ */
329
+ create(input: WidgetCreateInput): Promise<WidgetResponse>;
330
+ /**
331
+ * Update a widget
332
+ */
333
+ update(id: string, input: WidgetUpdateInput): Promise<WidgetResponse>;
334
+ /**
335
+ * Delete a widget
336
+ */
337
+ delete(id: string): Promise<{
338
+ success: boolean;
339
+ }>;
340
+ /**
341
+ * Get system prompt for widgets
342
+ */
343
+ getSystemPrompt(): Promise<WidgetSystemPromptResponse>;
344
+ /**
345
+ * Track widget usage
346
+ */
347
+ trackUsage(id: string): Promise<void>;
348
+ }
349
+ /**
350
+ * Create a WidgetsClient instance
351
+ */
352
+ declare function createWidgetsClient(config?: WidgetsClientConfig): WidgetsClient;
353
+ /**
354
+ * Default widgets client instance
355
+ */
356
+ declare const widgetsClient: WidgetsClient;
357
+
358
+ /**
359
+ * User Client
360
+ * Client for interacting with user profile API
361
+ */
362
+
363
+ declare class UserClient {
364
+ private baseUrl;
365
+ constructor(config?: UserClientConfig);
366
+ private get userUrl();
367
+ /**
368
+ * Get user profile by MID
369
+ */
370
+ getProfile(mid: string): Promise<UserProfile | null>;
371
+ /**
372
+ * Update user profile
373
+ */
374
+ updateProfile(mid: string, input: UserProfileUpdateInput): Promise<UserProfileResponse>;
375
+ }
376
+ /**
377
+ * Create a UserClient instance
378
+ */
379
+ declare function createUserClient(config?: UserClientConfig): UserClient;
380
+ /**
381
+ * Default user client instance
382
+ */
383
+ declare const userClient: UserClient;
384
+
385
+ /**
386
+ * Files Client
387
+ * Client for file upload operations
388
+ */
389
+
390
+ declare class FilesClient {
391
+ private baseUrl;
392
+ constructor(config?: FilesClientConfig);
393
+ private get filesUrl();
394
+ /**
395
+ * Upload a file
396
+ */
397
+ upload(file: File | Blob, filename?: string): Promise<FileUploadResponse>;
398
+ /**
399
+ * Upload a file from URL
400
+ */
401
+ uploadFromUrl(url: string): Promise<FileUploadResponse>;
402
+ /**
403
+ * Get file URL by CID
404
+ */
405
+ getFileUrl(cid: string): string;
406
+ }
407
+ /**
408
+ * Create a FilesClient instance
409
+ */
410
+ declare function createFilesClient(config?: FilesClientConfig): FilesClient;
411
+ /**
412
+ * Default files client instance
413
+ */
414
+ declare const filesClient: FilesClient;
415
+
416
+ /**
417
+ * Skills Client
418
+ *
419
+ * Client for interacting with the Skills API via the Agent Coprocessor
420
+ */
421
+
422
+ declare class SkillsClient {
423
+ private baseUrl;
424
+ private useCpxApi;
425
+ constructor(config?: SkillsClientConfig);
426
+ private get skillsUrl();
427
+ /**
428
+ * List skills
429
+ */
430
+ list(options?: {
431
+ scope?: 'public' | 'private' | 'all';
432
+ creatorMid?: string;
433
+ contentType?: 'code' | 'text' | 'image' | 'video' | 'music' | string;
434
+ precompiled?: boolean;
435
+ }): Promise<SkillsListResponse>;
436
+ /**
437
+ * Get a skill by ID
438
+ */
439
+ get(id: string): Promise<Skill>;
440
+ /**
441
+ * Create a new skill
442
+ */
443
+ create(skill: SkillCreateInput): Promise<SkillResponse>;
444
+ /**
445
+ * Update a skill
446
+ */
447
+ update(id: string, updates: SkillUpdateInput): Promise<SkillResponse>;
448
+ /**
449
+ * Delete a skill
450
+ */
451
+ delete(id: string): Promise<SkillResponse>;
452
+ /**
453
+ * Track skill usage
454
+ */
455
+ trackUsage(id: string): Promise<void>;
456
+ /**
457
+ * Verify skill hash integrity
458
+ */
459
+ verify(id: string): Promise<SkillVerifyResponse>;
460
+ /**
461
+ * Rehash a skill (recompute its hash)
462
+ */
463
+ rehash(id: string): Promise<{
464
+ skillId: string;
465
+ hash: string | null;
466
+ }>;
467
+ /**
468
+ * Rehash all skills
469
+ */
470
+ rehashAll(): Promise<{
471
+ updated: number;
472
+ total: number;
473
+ }>;
474
+ /**
475
+ * Get skill map (JSON format)
476
+ */
477
+ getMap(contentType?: string): Promise<SkillMapResponse>;
478
+ /**
479
+ * Get skill map as system prompt
480
+ */
481
+ getMapPrompt(contentType?: string): Promise<SkillMapPromptResponse>;
482
+ /**
483
+ * Get non-code skill map prompt
484
+ */
485
+ getNonCodeMap(): Promise<SkillMapPromptResponse>;
486
+ /**
487
+ * Get non-code skill summary
488
+ */
489
+ getNonCodeSummary(): Promise<SkillSummaryResponse>;
490
+ }
491
+ declare function createSkillsClient(config?: SkillsClientConfig): SkillsClient;
492
+ declare const skillsClient: SkillsClient;
493
+
494
+ /**
495
+ * Points Client
496
+ *
497
+ * Client for interacting with the Points Coprocessor API.
498
+ * Provides access to the internal reward and reputation framework for GeoffNet.
499
+ */
500
+
501
+ declare class PointsClient {
502
+ private baseUrl;
503
+ constructor(config?: PointsClientConfig);
504
+ private get pointsUrl();
505
+ /**
506
+ * Initialize the default geoffnet domain and contexts.
507
+ * Should only be called once during network bootstrap.
508
+ */
509
+ initNetworkDomain(): Promise<InitNetworkResponse>;
510
+ /**
511
+ * List all context domains
512
+ */
513
+ listDomains(): Promise<DomainsListResponse>;
514
+ /**
515
+ * Get a domain by ID
516
+ */
517
+ getDomain(domainId: string): Promise<ContextDomain | null>;
518
+ /**
519
+ * Create a new context domain.
520
+ * Note: Requires 402 payment for non-default domains.
521
+ */
522
+ createDomain(input: CreateDomainInput): Promise<DomainResponse>;
523
+ /**
524
+ * List all point contexts, optionally filtered by domain
525
+ */
526
+ listContexts(domainId?: string): Promise<ContextsListResponse>;
527
+ /**
528
+ * Get a context by ID
529
+ */
530
+ getContext(contextId: string): Promise<PointContext | null>;
531
+ /**
532
+ * Create a new point context.
533
+ * Note: Requires 402 payment for non-default contexts.
534
+ */
535
+ createContext(input: CreateContextInput): Promise<ContextResponse>;
536
+ /**
537
+ * List delegations with optional filters
538
+ */
539
+ listDelegations(filters?: DelegationFilters): Promise<DelegationsListResponse>;
540
+ /**
541
+ * Create a new delegation
542
+ */
543
+ createDelegation(input: CreateDelegationInput): Promise<DelegationResponse>;
544
+ /**
545
+ * Revoke a delegation
546
+ */
547
+ revokeDelegation(delegationId: string): Promise<{
548
+ success: boolean;
549
+ }>;
550
+ /**
551
+ * Add points (positive or negative) to an MID
552
+ */
553
+ addPoints(input: AddPointsInput): Promise<PointRecordResponse>;
554
+ /**
555
+ * Spend points (settlement via MetaChain)
556
+ */
557
+ spendPoints(input: SpendPointsInput): Promise<PointSpendResponse>;
558
+ /**
559
+ * Get points balance for an MID
560
+ */
561
+ getBalance(mid: string, options?: {
562
+ domainId?: string;
563
+ contextId?: string;
564
+ }): Promise<PointBalance>;
565
+ /**
566
+ * Get points history with optional filters
567
+ */
568
+ getHistory(filters?: HistoryFilters): Promise<HistoryResponse>;
569
+ }
570
+ /**
571
+ * Create a PointsClient instance
572
+ */
573
+ declare function createPointsClient(config?: PointsClientConfig): PointsClient;
574
+ /**
575
+ * Default points client instance
576
+ */
577
+ declare const pointsClient: PointsClient;
578
+
579
+ export { AgentsClient as A, FilesClient as F, MagmaClient as M, PointsClient as P, SocialClient as S, TaskNetworkClient as T, UserClient as U, WidgetsClient as W, type TaskNetworkConfig as a, createMagmaClient as b, createTaskNetworkClient as c, type MagmaClientConfig as d, MCPClient as e, createMCPClient as f, mcpClient as g, createSocialClient as h, createAgentsClient as i, agentsClient as j, createWidgetsClient as k, createUserClient as l, magmaClient as m, createFilesClient as n, filesClient as o, SkillsClient as p, createSkillsClient as q, skillsClient as r, socialClient as s, taskNetworkClient as t, userClient as u, createPointsClient as v, widgetsClient as w, pointsClient as x };