@forbocai/core 0.5.6 → 0.5.8
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/ans104-QFXL554Z.mjs +190 -0
- package/dist/chunk-M3F3ED7H.mjs +83 -0
- package/dist/index.d.mts +131 -259
- package/dist/index.d.ts +131 -259
- package/dist/index.js +341 -941
- package/dist/index.mjs +262 -715
- package/dist/soul-QXKV5H2R.mjs +20 -0
- package/package.json +2 -7
package/dist/index.d.mts
CHANGED
|
@@ -20,7 +20,7 @@ interface CortexStatus {
|
|
|
20
20
|
engine: 'mock' | 'remote' | 'node-llama-cpp' | 'web-llm';
|
|
21
21
|
}
|
|
22
22
|
interface ICortex {
|
|
23
|
-
init(): Promise<CortexStatus>;
|
|
23
|
+
init(onProgress?: (progress: number) => void): Promise<CortexStatus>;
|
|
24
24
|
complete(prompt: string, options?: CompletionOptions): Promise<string>;
|
|
25
25
|
completeStream(prompt: string, options?: CompletionOptions): AsyncGenerator<string>;
|
|
26
26
|
}
|
|
@@ -49,12 +49,22 @@ interface AgentConfig {
|
|
|
49
49
|
persona: string;
|
|
50
50
|
initialState?: Partial<AgentState>;
|
|
51
51
|
apiUrl?: string;
|
|
52
|
+
apiKey?: string;
|
|
52
53
|
}
|
|
53
54
|
interface AgentResponse {
|
|
54
55
|
dialogue: string;
|
|
55
56
|
action?: AgentAction;
|
|
56
57
|
thought?: string;
|
|
57
58
|
}
|
|
59
|
+
/** Dialogue Request (Full API-side logic) */
|
|
60
|
+
interface DialogueRequest {
|
|
61
|
+
diagMessage: string;
|
|
62
|
+
diagContext?: Array<[string, string]>;
|
|
63
|
+
}
|
|
64
|
+
/** Dialogue Response (Full API-side logic) */
|
|
65
|
+
interface DialogueResponse {
|
|
66
|
+
diagReply: string;
|
|
67
|
+
}
|
|
58
68
|
interface MemoryItem {
|
|
59
69
|
id: string;
|
|
60
70
|
text: string;
|
|
@@ -100,6 +110,20 @@ interface RecalledMemory {
|
|
|
100
110
|
importance: number;
|
|
101
111
|
similarity?: number;
|
|
102
112
|
}
|
|
113
|
+
/** Speak Request (Simple Dialogue) */
|
|
114
|
+
interface SpeakRequest {
|
|
115
|
+
speakMessage: string;
|
|
116
|
+
speakContext?: Record<string, unknown>;
|
|
117
|
+
speakAgentState: Record<string, unknown>;
|
|
118
|
+
}
|
|
119
|
+
/** Speak Response (Simple Dialogue) */
|
|
120
|
+
interface SpeakResponse {
|
|
121
|
+
speakReply: string;
|
|
122
|
+
speakHistory: Array<{
|
|
123
|
+
role: string;
|
|
124
|
+
content: string;
|
|
125
|
+
}>;
|
|
126
|
+
}
|
|
103
127
|
/** Step 5: API → SDK. API returns full SLM prompt + constraints. */
|
|
104
128
|
interface ContextResponse {
|
|
105
129
|
prompt: string;
|
|
@@ -142,12 +166,21 @@ interface ValidationResult {
|
|
|
142
166
|
reason?: string;
|
|
143
167
|
correctedAction?: AgentAction;
|
|
144
168
|
}
|
|
145
|
-
interface
|
|
169
|
+
interface BridgeRule {
|
|
170
|
+
ruleName: string;
|
|
171
|
+
ruleDescription: string;
|
|
172
|
+
ruleActionTypes: string[];
|
|
173
|
+
}
|
|
174
|
+
interface DirectiveRuleSet {
|
|
175
|
+
rulesetId: string;
|
|
176
|
+
rulesetRules: BridgeRule[];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @deprecated Use BridgeRule for data-only rules.
|
|
180
|
+
* Local validation execution is no longer supported in the SDK ("API is The Law").
|
|
181
|
+
*/
|
|
182
|
+
interface ValidationRule extends BridgeRule {
|
|
146
183
|
id: string;
|
|
147
|
-
name: string;
|
|
148
|
-
description: string;
|
|
149
|
-
actionTypes: string[];
|
|
150
|
-
validate: (action: AgentAction, context: ValidationContext) => ValidationResult;
|
|
151
184
|
}
|
|
152
185
|
interface Soul {
|
|
153
186
|
id: string;
|
|
@@ -158,72 +191,53 @@ interface Soul {
|
|
|
158
191
|
state: AgentState;
|
|
159
192
|
signature?: string;
|
|
160
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Soul configuration (Thin Client)
|
|
196
|
+
*/
|
|
197
|
+
interface SoulConfig {
|
|
198
|
+
apiUrl?: string;
|
|
199
|
+
gatewayUrl?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Soul export result
|
|
203
|
+
*/
|
|
204
|
+
interface SoulExportResult {
|
|
205
|
+
txId: string;
|
|
206
|
+
url: string;
|
|
207
|
+
soul: Soul;
|
|
208
|
+
}
|
|
161
209
|
|
|
162
210
|
/**
|
|
163
211
|
* Interface for Agent operations
|
|
164
212
|
*/
|
|
165
213
|
interface IAgent {
|
|
166
|
-
/**
|
|
167
|
-
* Processes an input string with optional context to generate a response.
|
|
168
|
-
* Follows the multi-round protocol: directive → context → verdict.
|
|
169
|
-
* @param input - The input string from the user or system.
|
|
170
|
-
* @param context - Optional context data to influence the agent's response.
|
|
171
|
-
* @returns A promise that resolves to the agent's response.
|
|
172
|
-
*/
|
|
173
214
|
process(input: string, context?: Record<string, unknown>): Promise<AgentResponse>;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
* @returns The current AgentState.
|
|
177
|
-
*/
|
|
215
|
+
speak(message: string, context?: Record<string, unknown>): Promise<string>;
|
|
216
|
+
reply(message: string, context?: Record<string, unknown>): Promise<string>;
|
|
178
217
|
getState(): AgentState;
|
|
179
|
-
/**
|
|
180
|
-
* Updates the agent's state.
|
|
181
|
-
* @param newState - The new state to set.
|
|
182
|
-
*/
|
|
183
218
|
setState(newState: AgentState): void;
|
|
184
|
-
|
|
185
|
-
* Exports the agent's data to a Soul object.
|
|
186
|
-
* @returns A promise resolving to the Soul representation of the agent.
|
|
187
|
-
*/
|
|
219
|
+
dialogue(message: string, context?: Array<[string, string]>): Promise<string>;
|
|
188
220
|
export(): Promise<Soul>;
|
|
221
|
+
exportSoul(config?: SoulConfig): Promise<SoulExportResult>;
|
|
189
222
|
}
|
|
190
223
|
/**
|
|
191
224
|
* Pure function to create initial agent state
|
|
192
|
-
* @param partial - Optional partial state to initialize with.
|
|
193
|
-
* @returns The initialized AgentState.
|
|
194
225
|
*/
|
|
195
226
|
declare const createInitialState: (partial?: Partial<AgentState>) => AgentState;
|
|
196
227
|
/**
|
|
197
228
|
* Pure function to update agent state
|
|
198
|
-
* Returns new state without mutating original
|
|
199
|
-
* @param currentState - The current state of the agent.
|
|
200
|
-
* @param updates - The updates to apply to the state.
|
|
201
|
-
* @returns A new AgentState object with the updates applied.
|
|
202
229
|
*/
|
|
203
230
|
declare const updateAgentState: (currentState: AgentState, updates: Partial<AgentState>) => AgentState;
|
|
204
231
|
/**
|
|
205
232
|
* Pure function to export agent to Soul
|
|
206
|
-
* @param agentId - The ID of the agent.
|
|
207
|
-
* @param name - The name of the agent.
|
|
208
|
-
* @param persona - The persona description of the agent.
|
|
209
|
-
* @param state - The current state of the agent.
|
|
210
|
-
* @param memories - The list of memories associated with the agent.
|
|
211
|
-
* @returns A Soul object representing the agent.
|
|
212
233
|
*/
|
|
213
234
|
declare const exportToSoul: (agentId: string, name: string, persona: string, state: AgentState, memories: MemoryItem[]) => Soul;
|
|
214
235
|
/**
|
|
215
236
|
* Factory function to create Agent (Functional/Closure based)
|
|
216
|
-
* Implements the multi-round protocol where the SDK is a dumb executor.
|
|
217
|
-
* @param config - The configuration object for creating the agent.
|
|
218
|
-
* @returns An instance of IAgent.
|
|
219
237
|
*/
|
|
220
238
|
declare const createAgent: (config: AgentConfig) => IAgent;
|
|
221
239
|
/**
|
|
222
240
|
* Pure function to import Agent from Soul
|
|
223
|
-
* @param soul - The Soul object to import from.
|
|
224
|
-
* @param cortex - The Cortex instance for the agent.
|
|
225
|
-
* @param memory - Optional memory instance.
|
|
226
|
-
* @returns An instantiated IAgent.
|
|
227
241
|
*/
|
|
228
242
|
declare const fromSoul: (soul: Soul, cortex: ICortex, memory?: IMemory | null) => Promise<IAgent>;
|
|
229
243
|
|
|
@@ -231,103 +245,43 @@ declare const fromSoul: (soul: Soul, cortex: ICortex, memory?: IMemory | null) =
|
|
|
231
245
|
* Bridge configuration
|
|
232
246
|
*/
|
|
233
247
|
interface BridgeConfig {
|
|
234
|
-
/** Base URL for the API. */
|
|
235
248
|
apiUrl?: string;
|
|
236
|
-
|
|
237
|
-
strictMode?: boolean;
|
|
238
|
-
/** Custom validation rules to apply. */
|
|
239
|
-
customRules?: ValidationRule[];
|
|
249
|
+
agentId?: string;
|
|
240
250
|
}
|
|
241
251
|
/**
|
|
242
252
|
* Interface for Bridge operations
|
|
243
253
|
*/
|
|
244
254
|
interface IBridge {
|
|
245
255
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* @param context - Optional validation context.
|
|
249
|
-
* @returns A promise that resolves to the validation result.
|
|
256
|
+
* Validate an action against the API.
|
|
257
|
+
* If agentId is provided in config, uses agent-scoped validation.
|
|
250
258
|
*/
|
|
251
259
|
validate(action: AgentAction, context?: ValidationContext): Promise<ValidationResult>;
|
|
252
260
|
/**
|
|
253
|
-
*
|
|
254
|
-
* @param rule - The rule to register.
|
|
255
|
-
*/
|
|
256
|
-
registerRule(rule: ValidationRule): void;
|
|
257
|
-
/**
|
|
258
|
-
* Lists all registered validation rules.
|
|
259
|
-
* @returns An array of ValidationRule objects.
|
|
261
|
+
* List all rulesets currently registered on the API.
|
|
260
262
|
*/
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Removes a validation rule by its ID.
|
|
264
|
-
* @param ruleId - The ID of the rule to remove.
|
|
265
|
-
* @returns True if the rule was removed, false otherwise.
|
|
266
|
-
*/
|
|
267
|
-
removeRule(ruleId: string): boolean;
|
|
263
|
+
listRulesets(): Promise<DirectiveRuleSet[]>;
|
|
268
264
|
}
|
|
269
265
|
/**
|
|
270
|
-
* Factory function to create Bridge instance
|
|
271
|
-
*
|
|
272
|
-
* @returns An instance of IBridge.
|
|
266
|
+
* Factory function to create Bridge instance
|
|
267
|
+
* All validation logic now resides on the server ("API is The Law").
|
|
273
268
|
*/
|
|
274
269
|
declare const createBridge: (config?: BridgeConfig) => IBridge;
|
|
275
270
|
/**
|
|
276
|
-
*
|
|
277
|
-
* @
|
|
278
|
-
* @param rules - The list of rules to validate against.
|
|
279
|
-
* @param context - Optional validation context.
|
|
280
|
-
* @returns The result of the validation.
|
|
271
|
+
* Standalone validation helper (deprecated locally, calls API)
|
|
272
|
+
* @deprecated Use createBridge(config).validate(action, context)
|
|
281
273
|
*/
|
|
282
|
-
declare const validateAction: (action: AgentAction,
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Soul export configuration
|
|
286
|
-
*/
|
|
287
|
-
interface SoulExportConfig {
|
|
288
|
-
/** Include memories in export */
|
|
289
|
-
includeMemories?: boolean;
|
|
290
|
-
/** Arweave wallet JWK (object or JSON string) for direct uploads */
|
|
291
|
-
walletJwk?: Record<string, unknown> | string;
|
|
292
|
-
/** Deprecated: use walletJwk */
|
|
293
|
-
privateKey?: Record<string, unknown> | string;
|
|
294
|
-
/** Bundler URL for ANS-104 data item uploads */
|
|
295
|
-
bundlerUrl?: string;
|
|
296
|
-
/** Gateway URL for read access (default: https://arweave.net) */
|
|
297
|
-
gatewayUrl?: string;
|
|
298
|
-
}
|
|
274
|
+
declare const validateAction: (action: AgentAction, context?: ValidationContext, config?: BridgeConfig) => Promise<ValidationResult>;
|
|
299
275
|
/**
|
|
300
|
-
*
|
|
301
|
-
*/
|
|
302
|
-
interface SoulExportResult {
|
|
303
|
-
/** Arweave data item ID (TXID) */
|
|
304
|
-
txId: string;
|
|
305
|
-
/** Gateway URL to access the soul. */
|
|
306
|
-
url: string;
|
|
307
|
-
/** The exported Soul object. */
|
|
308
|
-
soul: Soul;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Soul import configuration
|
|
276
|
+
* Register a server-side rule preset for an agent session.
|
|
312
277
|
*/
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
gatewayUrl?: string;
|
|
316
|
-
}
|
|
278
|
+
declare const loadPreset: (presetName: string, apiUrl?: string) => Promise<DirectiveRuleSet>;
|
|
279
|
+
|
|
317
280
|
/**
|
|
318
281
|
* Interface for Soul operations
|
|
319
282
|
*/
|
|
320
283
|
interface ISoul {
|
|
321
|
-
|
|
322
|
-
* Exports the Soul to Arweave.
|
|
323
|
-
* @param config - Export configuration.
|
|
324
|
-
* @returns A promise resolving to the export result.
|
|
325
|
-
*/
|
|
326
|
-
export(config?: SoulExportConfig): Promise<SoulExportResult>;
|
|
327
|
-
/**
|
|
328
|
-
* Returns the raw Soul data object.
|
|
329
|
-
* @returns The Soul object.
|
|
330
|
-
*/
|
|
284
|
+
export(config?: SoulConfig): Promise<SoulExportResult>;
|
|
331
285
|
toJSON(): Soul;
|
|
332
286
|
}
|
|
333
287
|
/**
|
|
@@ -343,31 +297,18 @@ declare const serializeSoul: (soul: Soul) => string;
|
|
|
343
297
|
*/
|
|
344
298
|
declare const deserializeSoul: (json: string) => Soul;
|
|
345
299
|
/**
|
|
346
|
-
*
|
|
300
|
+
* Export agent Soul to Arweave via API
|
|
347
301
|
*/
|
|
348
|
-
declare const
|
|
302
|
+
declare const exportSoul: (agentId: string, _soul: Soul, // Soul data is derived from agent state on the API
|
|
303
|
+
config?: SoulConfig) => Promise<SoulExportResult>;
|
|
349
304
|
/**
|
|
350
|
-
*
|
|
305
|
+
* Import Soul from Arweave by TXID via API
|
|
351
306
|
*/
|
|
352
|
-
declare const
|
|
307
|
+
declare const importSoulFromArweave: (txId: string, config?: SoulConfig) => Promise<Soul>;
|
|
353
308
|
/**
|
|
354
|
-
*
|
|
309
|
+
* Get list of all exported Souls from the API
|
|
355
310
|
*/
|
|
356
|
-
declare const
|
|
357
|
-
/**
|
|
358
|
-
* Soul entry in the listing
|
|
359
|
-
*/
|
|
360
|
-
interface SoulListEntry {
|
|
361
|
-
txId: string;
|
|
362
|
-
name: string;
|
|
363
|
-
agentId?: string;
|
|
364
|
-
exportedAt: string;
|
|
365
|
-
url: string;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Get list of all exported Souls
|
|
369
|
-
*/
|
|
370
|
-
declare const getSoulList: (limit?: number, apiUrl?: string) => Promise<SoulListEntry[]>;
|
|
311
|
+
declare const getSoulList: (limit?: number, apiUrl?: string) => Promise<any[]>;
|
|
371
312
|
/**
|
|
372
313
|
* Factory function to create Soul instance
|
|
373
314
|
*/
|
|
@@ -384,108 +325,59 @@ declare const validateSoul: (soul: Soul) => {
|
|
|
384
325
|
* Ghost test configuration
|
|
385
326
|
*/
|
|
386
327
|
interface GhostConfig {
|
|
387
|
-
/** API URL for ghost orchestration */
|
|
388
328
|
apiUrl?: string;
|
|
389
|
-
/** Test suite to run */
|
|
390
329
|
testSuite: 'exploration' | 'combat' | 'dialogue' | 'pathfinding' | 'full';
|
|
391
|
-
/** Maximum duration in seconds */
|
|
392
330
|
duration: number;
|
|
393
|
-
/** Capture screenshots on failure */
|
|
394
331
|
captureScreenshots?: boolean;
|
|
395
|
-
/** Custom test parameters */
|
|
396
332
|
params?: Record<string, unknown>;
|
|
397
333
|
}
|
|
398
334
|
/**
|
|
399
335
|
* Ghost session status
|
|
400
336
|
*/
|
|
401
337
|
interface GhostStatus {
|
|
402
|
-
/** The unique ID of the session. */
|
|
403
338
|
sessionId: string;
|
|
404
|
-
/** The current status of the session. */
|
|
405
339
|
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
406
|
-
/** Progress percentage (0-100). */
|
|
407
340
|
progress: number;
|
|
408
|
-
/** ISO timestamp when the session started. */
|
|
409
341
|
startedAt: string;
|
|
410
|
-
/** Duration in seconds elapsed. */
|
|
411
342
|
duration: number;
|
|
412
|
-
/** Number of errors encountered. */
|
|
413
343
|
errors: number;
|
|
414
344
|
}
|
|
415
345
|
/**
|
|
416
346
|
* Individual test result
|
|
417
347
|
*/
|
|
418
348
|
interface GhostTestResult {
|
|
419
|
-
/** Name of the test case. */
|
|
420
349
|
name: string;
|
|
421
|
-
/** Whether the test passed. */
|
|
422
350
|
passed: boolean;
|
|
423
|
-
/** Duration of the test in milliseconds. */
|
|
424
351
|
duration: number;
|
|
425
|
-
/** Error message if the test failed. */
|
|
426
352
|
error?: string;
|
|
427
|
-
/** URL or path to a screenshot if captured. */
|
|
428
353
|
screenshot?: string;
|
|
429
354
|
}
|
|
430
355
|
/**
|
|
431
356
|
* Complete session results
|
|
432
357
|
*/
|
|
433
358
|
interface GhostResults {
|
|
434
|
-
/** The session ID. */
|
|
435
359
|
sessionId: string;
|
|
436
|
-
/** Total number of tests run. */
|
|
437
360
|
totalTests: number;
|
|
438
|
-
/** Number of passed tests. */
|
|
439
361
|
passed: number;
|
|
440
|
-
/** Number of failed tests. */
|
|
441
362
|
failed: number;
|
|
442
|
-
/** Number of skipped tests. */
|
|
443
363
|
skipped: number;
|
|
444
|
-
/** Total duration in milliseconds. */
|
|
445
364
|
duration: number;
|
|
446
|
-
/** List of individual test results. */
|
|
447
365
|
tests: GhostTestResult[];
|
|
448
|
-
/** Code/Feature coverage (0.0-1.0). */
|
|
449
366
|
coverage: number;
|
|
450
|
-
/** Additional metrics collected during the session. */
|
|
451
367
|
metrics: Record<string, number>;
|
|
452
368
|
}
|
|
453
369
|
/**
|
|
454
370
|
* Interface for Ghost operations
|
|
455
371
|
*/
|
|
456
372
|
interface IGhost {
|
|
457
|
-
/**
|
|
458
|
-
* Starts a Ghost session.
|
|
459
|
-
* @returns A promise resolving to the session ID.
|
|
460
|
-
*/
|
|
461
373
|
run(): Promise<string>;
|
|
462
|
-
/**
|
|
463
|
-
* Gets the current status of the session.
|
|
464
|
-
* @returns A promise resolving to the GhostStatus.
|
|
465
|
-
*/
|
|
466
374
|
status(): Promise<GhostStatus>;
|
|
467
|
-
/**
|
|
468
|
-
* Gets the results of the session.
|
|
469
|
-
* @returns A promise resolving to the GhostResults.
|
|
470
|
-
*/
|
|
471
375
|
results(): Promise<GhostResults>;
|
|
472
|
-
/**
|
|
473
|
-
* Stops the current session.
|
|
474
|
-
*/
|
|
475
376
|
stop(): Promise<void>;
|
|
476
|
-
/**
|
|
477
|
-
* Waits for the session to complete.
|
|
478
|
-
* @param pollIntervalMs - Polling interval in milliseconds.
|
|
479
|
-
* @param timeoutMs - Timeout in milliseconds.
|
|
480
|
-
* @param onProgress - Optional callback for progress updates.
|
|
481
|
-
* @returns A promise resolving to the GhostResults.
|
|
482
|
-
*/
|
|
483
377
|
waitForCompletion(pollIntervalMs?: number, timeoutMs?: number, onProgress?: (status: GhostStatus) => void): Promise<GhostResults>;
|
|
484
378
|
}
|
|
485
379
|
/**
|
|
486
380
|
* Start a Ghost testing session
|
|
487
|
-
* @param config - The configuration for the Ghost session.
|
|
488
|
-
* @returns A promise resolving to an object containing the session ID and initial status.
|
|
489
381
|
*/
|
|
490
382
|
declare const startGhostSession: (config: GhostConfig) => Promise<{
|
|
491
383
|
sessionId: string;
|
|
@@ -493,40 +385,24 @@ declare const startGhostSession: (config: GhostConfig) => Promise<{
|
|
|
493
385
|
}>;
|
|
494
386
|
/**
|
|
495
387
|
* Get Ghost session status
|
|
496
|
-
* @param sessionId - The ID of the session to check.
|
|
497
|
-
* @param apiUrl - Optional API URL override.
|
|
498
|
-
* @returns A promise resolving to the GhostStatus.
|
|
499
388
|
*/
|
|
500
389
|
declare const getGhostStatus: (sessionId: string, apiUrl?: string) => Promise<GhostStatus>;
|
|
501
390
|
/**
|
|
502
391
|
* Get Ghost session results
|
|
503
|
-
* @param sessionId - The ID of the session to retrieve results for.
|
|
504
|
-
* @param apiUrl - Optional API URL override.
|
|
505
|
-
* @returns A promise resolving to the GhostResults.
|
|
506
392
|
*/
|
|
507
393
|
declare const getGhostResults: (sessionId: string, apiUrl?: string) => Promise<GhostResults>;
|
|
508
394
|
/**
|
|
509
395
|
* Poll Ghost session until completion
|
|
510
|
-
* @param sessionId - The ID of the session to wait for.
|
|
511
|
-
* @param pollIntervalMs - Polling interval in milliseconds.
|
|
512
|
-
* @param timeoutMs - Timeout in milliseconds.
|
|
513
|
-
* @param apiUrl - Optional API URL override.
|
|
514
|
-
* @param onProgress - Optional callback for progress updates.
|
|
515
|
-
* @returns A promise resolving to the GhostResults upon completion.
|
|
516
396
|
*/
|
|
517
397
|
declare const waitForGhostCompletion: (sessionId: string, pollIntervalMs?: number, timeoutMs?: number, apiUrl?: string, onProgress?: (status: GhostStatus) => void) => Promise<GhostResults>;
|
|
518
398
|
/**
|
|
519
399
|
* Stop a running Ghost session
|
|
520
|
-
* @param sessionId - The ID of the session to stop.
|
|
521
|
-
* @param apiUrl - Optional API URL override.
|
|
522
|
-
* @returns A promise resolving to the stop status.
|
|
523
400
|
*/
|
|
524
401
|
declare const stopGhostSession: (sessionId: string, apiUrl?: string) => Promise<{
|
|
525
402
|
stopped: boolean;
|
|
526
|
-
status: string;
|
|
527
403
|
}>;
|
|
528
404
|
/**
|
|
529
|
-
*
|
|
405
|
+
* Ghost session history entry
|
|
530
406
|
*/
|
|
531
407
|
interface GhostHistoryEntry {
|
|
532
408
|
sessionId: string;
|
|
@@ -538,15 +414,10 @@ interface GhostHistoryEntry {
|
|
|
538
414
|
}
|
|
539
415
|
/**
|
|
540
416
|
* Get Ghost session history
|
|
541
|
-
* @param limit - Max number of entries to retrieve.
|
|
542
|
-
* @param apiUrl - Optional API URL override.
|
|
543
|
-
* @returns A promise resolving to an array of GhostHistoryEntry.
|
|
544
417
|
*/
|
|
545
418
|
declare const getGhostHistory: (limit?: number, apiUrl?: string) => Promise<GhostHistoryEntry[]>;
|
|
546
419
|
/**
|
|
547
420
|
* Factory function to create Ghost session (Functional/Closure based)
|
|
548
|
-
* @param config - The configuration for the Ghost session.
|
|
549
|
-
* @returns An instance of IGhost.
|
|
550
421
|
*/
|
|
551
422
|
declare const createGhost: (config: GhostConfig) => IGhost;
|
|
552
423
|
|
|
@@ -554,57 +425,58 @@ declare const createGhost: (config: GhostConfig) => IGhost;
|
|
|
554
425
|
* Creates a remote Cortex instance that proxies inference to the ForbocAI API.
|
|
555
426
|
* This is environment-agnostic as it only uses the standard fetch API.
|
|
556
427
|
*/
|
|
557
|
-
declare const createRemoteCortex: (apiUrl: string, cortexId?: string) => ICortex;
|
|
428
|
+
declare const createRemoteCortex: (apiUrl: string, cortexId?: string, apiKey?: string) => ICortex;
|
|
558
429
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
declare const
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
declare const
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
declare const socialRules: ValidationRule[];
|
|
589
|
-
declare const puzzleRules: ValidationRule[];
|
|
430
|
+
/**
|
|
431
|
+
* Consume an async token stream, calling `onChunk` for each token.
|
|
432
|
+
* Useful for rendering typewriter effects in UI.
|
|
433
|
+
*/
|
|
434
|
+
declare const streamToCallback: (stream: AsyncGenerator<string, void, unknown>, onChunk: (chunk: string) => void) => Promise<void>;
|
|
435
|
+
/**
|
|
436
|
+
* Consume an async token stream and return the full accumulated string.
|
|
437
|
+
*/
|
|
438
|
+
declare const streamToString: (stream: AsyncGenerator<string, void, unknown>) => Promise<string>;
|
|
439
|
+
/**
|
|
440
|
+
* Stream tokens from a cortex directly to a callback.
|
|
441
|
+
* Convenience wrapper combining cortex.completeStream + streamToCallback.
|
|
442
|
+
*/
|
|
443
|
+
declare const streamFromCortex: (cortex: ICortex, prompt: string, onChunk: (chunk: string) => void, options?: {
|
|
444
|
+
temperature?: number;
|
|
445
|
+
maxTokens?: number;
|
|
446
|
+
stop?: string[];
|
|
447
|
+
}) => Promise<string>;
|
|
448
|
+
/**
|
|
449
|
+
* Stream tokens from a cortex with a delay between tokens (for typewriter pacing).
|
|
450
|
+
*
|
|
451
|
+
* @param delayMs - Milliseconds to wait between tokens (default: 30ms)
|
|
452
|
+
*/
|
|
453
|
+
declare const streamFromCortexWithDelay: (cortex: ICortex, prompt: string, onChunk: (chunk: string) => void, options?: {
|
|
454
|
+
temperature?: number;
|
|
455
|
+
maxTokens?: number;
|
|
456
|
+
stop?: string[];
|
|
457
|
+
delayMs?: number;
|
|
458
|
+
}) => Promise<string>;
|
|
590
459
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
declare const
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
declare const
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Pure Functional Utilities for ForbocAI SDK
|
|
462
|
+
*/
|
|
463
|
+
/**
|
|
464
|
+
* Delay execution for a specified number of milliseconds.
|
|
465
|
+
*/
|
|
466
|
+
declare const delay: (ms: number) => Promise<void>;
|
|
467
|
+
/**
|
|
468
|
+
* Functional pipe for chaining functions.
|
|
469
|
+
*/
|
|
470
|
+
declare const pipe: <T>(...fns: Array<(arg: T) => T>) => (initialValue: T) => T;
|
|
471
|
+
/**
|
|
472
|
+
* Closure-based memoization for async functions (single value cache).
|
|
473
|
+
*/
|
|
474
|
+
declare const memoiseAsync: <T>(fn: () => Promise<T>) => () => Promise<T>;
|
|
475
|
+
/**
|
|
476
|
+
* Closure-based memoization for sync functions (single value cache).
|
|
477
|
+
*/
|
|
478
|
+
declare const memoise: <T>(fn: () => T) => () => T;
|
|
607
479
|
|
|
608
|
-
declare const SDK_VERSION = "0.5.
|
|
480
|
+
declare const SDK_VERSION = "0.5.7";
|
|
609
481
|
|
|
610
|
-
export { type AgentAction, type AgentConfig, type AgentResponse, type AgentState, type BridgeConfig, type CompletionOptions, type ContextRequest, type ContextResponse, type CortexConfig, type CortexStatus, type DirectiveRequest, type DirectiveResponse, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostStatus, type GhostTestResult, type IAgent, type IBridge, type ICortex, type IGhost, type IMemory, type ISoul, type MemoryItem, type MemoryRecallInstruction, type MemoryStoreInstruction, type PromptConstraints, type RecalledMemory, SDK_VERSION, type Soul, type
|
|
482
|
+
export { type AgentAction, type AgentConfig, type AgentResponse, type AgentState, type BridgeConfig, type BridgeRule, type CompletionOptions, type ContextRequest, type ContextResponse, type CortexConfig, type CortexStatus, type DialogueRequest, type DialogueResponse, type DirectiveRequest, type DirectiveResponse, type DirectiveRuleSet, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostStatus, type GhostTestResult, type IAgent, type IBridge, type ICortex, type IGhost, type IMemory, type ISoul, type MemoryItem, type MemoryRecallInstruction, type MemoryStoreInstruction, type PromptConstraints, type RecalledMemory, SDK_VERSION, type Soul, type SoulConfig, type SoulExportResult, type SpeakRequest, type SpeakResponse, type ValidationContext, type ValidationResult, type ValidationRule, type VerdictRequest, type VerdictResponse, createAgent, createBridge, createGhost, createInitialState, createRemoteCortex, createSoul, createSoulInstance, delay, deserializeSoul, exportSoul, exportToSoul, fromSoul, getGhostHistory, getGhostResults, getGhostStatus, getSoulList, importSoulFromArweave, loadPreset, memoise, memoiseAsync, pipe, serializeSoul, startGhostSession, stopGhostSession, streamFromCortex, streamFromCortexWithDelay, streamToCallback, streamToString, updateAgentState, validateAction, validateSoul, waitForGhostCompletion };
|