@primo-ai/sdk 0.1.3 → 0.1.4
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/index.d.ts +44 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -106,11 +106,11 @@ export interface IterationRegion {
|
|
|
106
106
|
loopDirective?: LoopDirective;
|
|
107
107
|
/** AI SDK fullStream yielding text-delta, tool-call, finish-step, error events. */
|
|
108
108
|
fullStream?: AsyncIterable<unknown>;
|
|
109
|
-
usagePromise?: Promise<TokenUsage>;
|
|
109
|
+
usagePromise?: Promise<TokenUsage | null>;
|
|
110
110
|
/** Promise resolving to reasoning text from the model (e.g. DeepSeek reasoning_content). */
|
|
111
111
|
reasoningPromise?: Promise<string | undefined>;
|
|
112
112
|
response?: string;
|
|
113
|
-
tokenUsage?: TokenUsage;
|
|
113
|
+
tokenUsage?: TokenUsage | null;
|
|
114
114
|
/** Tool calls extracted from the LLM response by PipelineRunner stream consumption. */
|
|
115
115
|
pendingToolCalls?: ToolCall[];
|
|
116
116
|
/** Reasoning content from thinking-mode models (e.g. DeepSeek). Must be passed back on subsequent turns. */
|
|
@@ -156,7 +156,13 @@ export interface SuspensionSignal {
|
|
|
156
156
|
checkpoint: PipelineCheckpoint;
|
|
157
157
|
expiresAt?: string;
|
|
158
158
|
}
|
|
159
|
-
export
|
|
159
|
+
export interface ErrorResult {
|
|
160
|
+
type: 'error';
|
|
161
|
+
error: Error;
|
|
162
|
+
stage: StageName;
|
|
163
|
+
recoverable?: boolean;
|
|
164
|
+
}
|
|
165
|
+
export type ProcessorResult = PipelineContext | AbortSignal | SuspensionSignal | ErrorResult;
|
|
160
166
|
export interface Processor {
|
|
161
167
|
stage: StageName;
|
|
162
168
|
execute(context: PipelineContext): Promise<ProcessorResult>;
|
|
@@ -282,6 +288,34 @@ export type StreamEvent = {
|
|
|
282
288
|
suspensionId: string;
|
|
283
289
|
reason: string;
|
|
284
290
|
checkpoint: PipelineCheckpoint;
|
|
291
|
+
} | {
|
|
292
|
+
type: 'error';
|
|
293
|
+
error: Error;
|
|
294
|
+
stage: StageName;
|
|
295
|
+
recoverable?: boolean;
|
|
296
|
+
};
|
|
297
|
+
export type ServerStreamEvent = StreamEvent | {
|
|
298
|
+
type: 'session.started';
|
|
299
|
+
sessionId: string;
|
|
300
|
+
} | {
|
|
301
|
+
type: 'session.completed';
|
|
302
|
+
sessionId: string;
|
|
303
|
+
tokenUsage: TokenUsage;
|
|
304
|
+
} | {
|
|
305
|
+
type: 'session.aborted';
|
|
306
|
+
sessionId: string;
|
|
307
|
+
} | {
|
|
308
|
+
type: 'permission.request';
|
|
309
|
+
sessionId: string;
|
|
310
|
+
permissionId: string;
|
|
311
|
+
toolName: string;
|
|
312
|
+
args: Record<string, unknown>;
|
|
313
|
+
reason: string;
|
|
314
|
+
} | {
|
|
315
|
+
type: 'permission.resolved';
|
|
316
|
+
sessionId: string;
|
|
317
|
+
permissionId: string;
|
|
318
|
+
decision: 'allow' | 'deny';
|
|
285
319
|
};
|
|
286
320
|
export type EventType = 'agent:start' | 'agent:end' | 'tool:before' | 'tool:after' | string;
|
|
287
321
|
export type HookPoint = 'agent.start' | 'agent.end' | 'stage.before' | 'stage.after' | 'llm.before' | 'llm.after' | 'tool.before' | 'tool.after' | 'iteration.end' | 'error';
|
|
@@ -483,7 +517,7 @@ export interface HarnessConfig {
|
|
|
483
517
|
facts: string[] | ((ctx: PipelineContext) => string[] | Promise<string[]>);
|
|
484
518
|
};
|
|
485
519
|
}
|
|
486
|
-
export type SessionStatus = 'active' | 'completed' | 'suspended' | 'error';
|
|
520
|
+
export type SessionStatus = 'active' | 'completed' | 'suspended' | 'cancelled' | 'error';
|
|
487
521
|
export interface SessionRecord {
|
|
488
522
|
sessionId: string;
|
|
489
523
|
parentSessionId?: string;
|
|
@@ -507,6 +541,12 @@ export interface SessionStorage {
|
|
|
507
541
|
status?: SessionStatus;
|
|
508
542
|
}): Promise<SessionRecord[]>;
|
|
509
543
|
updateMeta(sessionId: string, meta: Partial<SessionRecord>): Promise<void>;
|
|
544
|
+
get(sessionId: string): Promise<SessionRecord | undefined>;
|
|
545
|
+
delete(sessionId: string): Promise<void>;
|
|
546
|
+
getMessages(sessionId: string, options?: {
|
|
547
|
+
limit?: number;
|
|
548
|
+
before?: string;
|
|
549
|
+
}): Promise<Message[]>;
|
|
510
550
|
}
|
|
511
551
|
export interface CheckpointStore<T = unknown> {
|
|
512
552
|
save(sessionId: string, data: T): Promise<void>;
|