@rivus/runtime 0.16.6 → 0.18.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/LICENSE +674 -21
- package/README.md +21 -0
- package/dist/acp.d.ts +7 -92
- package/dist/acp.js +298 -249
- package/dist/chunks/agent-loop.d.ts +143 -95
- package/dist/chunks/agent-user-input.js +109 -0
- package/dist/chunks/rivus-runtime-tool.d.ts +104 -4
- package/dist/chunks/{tool-input-digest.js → tool-risk-policy.js} +7 -14
- package/dist/chunks/user-input-xml.js +224 -0
- package/dist/index.d.ts +107 -823
- package/dist/index.js +242 -705
- package/dist/pi.d.ts +62 -332
- package/dist/pi.js +547 -546
- package/package.json +12 -11
- package/dist/chunks/agent-loop.js +0 -164
package/dist/pi.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as AgentLoopInput, p as SessionKey, t as AgentLoop } from "./chunks/agent-loop.js";
|
|
2
|
+
import { A as RivusMemoryScope, B as RivusToolRisk, C as NormalizedAgentInvocation, D as AgentModelContentObserver, I as RivusToolGrantSet, K as RegisteredRivusSkill, Q as ModelReference, U as RunAdmission, Y as ModelBinding, Z as ModelChangeRuntimePort, a as ToolBroker, j as RivusResolvedToolDescriptor, r as RivusRuntimeToolId } from "./chunks/rivus-runtime-tool.js";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
import { TSchema } from "typebox";
|
|
5
|
-
|
|
6
5
|
//#region src/adapters/pi/config/pi-model-overrides.d.ts
|
|
7
6
|
interface PiModelDefinitionBase {
|
|
8
7
|
readonly api: string;
|
|
@@ -22,28 +21,12 @@ interface PiModelDefinitionBase {
|
|
|
22
21
|
readonly samplingParams?: Readonly<Record<string, unknown>>;
|
|
23
22
|
readonly thinkingLevelMap?: Readonly<Partial<Record<string, string | null>>>;
|
|
24
23
|
}
|
|
25
|
-
interface PiDeclarativeModelDefinition extends PiModelDefinitionBase {
|
|
26
|
-
readonly input: ReadonlyArray<"image" | "text">;
|
|
27
|
-
}
|
|
28
24
|
interface MergePiProviderBaseUrlOverrideOptions {
|
|
29
25
|
readonly baseUrl: string;
|
|
30
26
|
readonly filePath: string;
|
|
31
27
|
readonly provider: string;
|
|
32
28
|
}
|
|
33
|
-
declare function mergePiProviderBaseUrlOverride(options: MergePiProviderBaseUrlOverrideOptions): Promise<void>;
|
|
34
|
-
interface MergePiProviderModelDeclarationOptions {
|
|
35
|
-
readonly filePath: string;
|
|
36
|
-
readonly model: PiDeclarativeModelDefinition;
|
|
37
|
-
readonly provider: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Persist one complete custom model definition in models.json.
|
|
41
|
-
*
|
|
42
|
-
* Pi composes these definitions with its built-in provider metadata. Keeping the
|
|
43
|
-
* complete definition here is deliberate: a missing SDK catalog entry must be
|
|
44
|
-
* represented by its exact server id, never by a fuzzy or legacy alias.
|
|
45
|
-
*/
|
|
46
|
-
declare function mergePiProviderModelDeclaration(options: MergePiProviderModelDeclarationOptions): Promise<void>;
|
|
29
|
+
export declare function mergePiProviderBaseUrlOverride(options: MergePiProviderBaseUrlOverrideOptions): Promise<void>;
|
|
47
30
|
//#endregion
|
|
48
31
|
//#region src/adapters/pi/execution/pi-agent-loop.d.ts
|
|
49
32
|
type PiAgentSessionEvent = PiMessageStartEvent | PiMessageUpdateEvent | PiMessageEndEvent | PiToolExecutionStartEvent | PiToolExecutionUpdateEvent | PiToolExecutionEndEvent | {
|
|
@@ -109,20 +92,33 @@ interface PiSessionManager {
|
|
|
109
92
|
interface PiAgentSession {
|
|
110
93
|
abort?: () => Promise<void> | void;
|
|
111
94
|
/** Native queue operations required when the loop opts into steering. */
|
|
112
|
-
steer?(text: string): Promise<void> | void;
|
|
95
|
+
steer?(text: string, images?: ReadonlyArray<PiImageInput>): Promise<void> | void;
|
|
113
96
|
readonly isStreaming?: boolean;
|
|
97
|
+
/** The SDK's active model capability declaration, when exposed by the session. */
|
|
98
|
+
readonly model?: {
|
|
99
|
+
readonly input?: ReadonlyArray<"image" | "text">;
|
|
100
|
+
} | undefined;
|
|
114
101
|
clearQueue?(): unknown;
|
|
115
102
|
setModel?(model: unknown): Promise<void> | void;
|
|
116
103
|
setThinkingLevel?(level: string): void;
|
|
117
104
|
waitForIdle?(): Promise<void>;
|
|
118
105
|
reload?(): Promise<void> | void;
|
|
119
106
|
readonly sessionManager?: PiSessionManager;
|
|
120
|
-
prompt(text: string): Promise<void>;
|
|
107
|
+
prompt(text: string, options?: PiPromptOptions): Promise<void>;
|
|
121
108
|
readonly state?: unknown;
|
|
122
109
|
subscribe(listener: (event: PiAgentSessionEvent) => void): () => void;
|
|
123
110
|
dispose?: () => Promise<void> | void;
|
|
124
111
|
}
|
|
125
|
-
interface
|
|
112
|
+
interface PiImageInput {
|
|
113
|
+
readonly type: "image";
|
|
114
|
+
readonly data: string;
|
|
115
|
+
readonly mimeType: string;
|
|
116
|
+
}
|
|
117
|
+
interface PiPromptOptions {
|
|
118
|
+
readonly images?: ReadonlyArray<PiImageInput>;
|
|
119
|
+
readonly streamingBehavior?: "steer" | "followUp";
|
|
120
|
+
}
|
|
121
|
+
interface PiAgentSessionHandle {
|
|
126
122
|
readonly activate?: (input: AgentLoopInput) => Promise<void> | void;
|
|
127
123
|
/** Revoke per-Run authority after the SDK prompt and cancellation have settled. */
|
|
128
124
|
readonly deactivate?: () => Promise<void> | void;
|
|
@@ -130,50 +126,35 @@ interface PiAgentSessionHandle$1 {
|
|
|
130
126
|
readonly preparePrompt?: (input: AgentLoopInput) => Promise<string> | string;
|
|
131
127
|
readonly refreshResources?: () => Promise<void> | void;
|
|
132
128
|
readonly resolveToolName?: (toolName: string) => string;
|
|
129
|
+
/** Provider capability selected from the active model, not from the input adapter. */
|
|
130
|
+
readonly supportsImages?: boolean;
|
|
131
|
+
/** Replace the active run input when a structured steering delivery is accepted. */
|
|
132
|
+
readonly updateInput?: (input: AgentLoopInput) => Promise<void> | void;
|
|
133
133
|
readonly session: PiAgentSession;
|
|
134
134
|
}
|
|
135
|
-
interface PiAgentLoopOptions
|
|
135
|
+
interface PiAgentLoopOptions {
|
|
136
136
|
/** Enable only for sessions providing native steer, isStreaming and clearQueue. */
|
|
137
137
|
readonly supportsSteering?: boolean;
|
|
138
138
|
readonly disposeSessionAfterRun?: boolean;
|
|
139
139
|
readonly modelContentObserver?: AgentModelContentObserver;
|
|
140
140
|
/** Home-wide admission fence acquired before a session/model is resolved. */
|
|
141
141
|
readonly runBoundary?: Pick<RunAdmission, "acquireRun">;
|
|
142
|
-
readonly resolveSession: (input: AgentLoopInput) => Promise<PiAgentSessionHandle
|
|
142
|
+
readonly resolveSession: (input: AgentLoopInput) => Promise<PiAgentSessionHandle> | PiAgentSessionHandle;
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
readonly session: PiAgentSession;
|
|
146
|
-
}
|
|
147
|
-
interface PiSdkAgentLoopOptions<TSessionOptions = unknown> {
|
|
148
|
-
readonly supportsSteering?: boolean;
|
|
149
|
-
readonly createAgentSession: (options: TSessionOptions | undefined) => Promise<PiCreateAgentSessionResult> | PiCreateAgentSessionResult;
|
|
150
|
-
readonly sessionOptions?: TSessionOptions;
|
|
151
|
-
}
|
|
152
|
-
declare function createPiAgentLoop$1(options: PiAgentLoopOptions$1): AgentLoop;
|
|
153
|
-
declare function createPiSdkAgentLoop$1<TSessionOptions = unknown>(options: PiSdkAgentLoopOptions<TSessionOptions>): AgentLoop;
|
|
154
|
-
//#endregion
|
|
155
|
-
//#region src/adapters/pi/execution/pi-session-prompts.d.ts
|
|
156
|
-
interface PiSessionPromptOptions {
|
|
157
|
-
readonly input: AgentLoopInput;
|
|
158
|
-
readonly handle: PiAgentSessionHandle$1;
|
|
159
|
-
readonly supportsSteering: boolean;
|
|
160
|
-
readonly abort: () => Promise<void>;
|
|
161
|
-
}
|
|
162
|
-
/** One ordinary prompt writer, with ordered native steering while that prompt is streaming. */
|
|
163
|
-
declare function runPiSessionPrompts(options: PiSessionPromptOptions): Promise<void>;
|
|
144
|
+
export declare function createPiAgentLoop(options: PiAgentLoopOptions): AgentLoop;
|
|
164
145
|
//#endregion
|
|
165
146
|
//#region src/adapters/pi/execution/pi-session-registry.d.ts
|
|
166
|
-
interface PiSessionRegistryOptions
|
|
167
|
-
readonly createSession: (input: AgentLoopInput) => Promise<PiAgentSessionHandle
|
|
147
|
+
interface PiSessionRegistryOptions {
|
|
148
|
+
readonly createSession: (input: AgentLoopInput) => Promise<PiAgentSessionHandle> | PiAgentSessionHandle;
|
|
168
149
|
}
|
|
169
|
-
interface PiSessionRegistry
|
|
170
|
-
list(): Promise<ReadonlyArray<PiAgentSessionHandle
|
|
171
|
-
resolve(input: AgentLoopInput): Promise<PiAgentSessionHandle
|
|
150
|
+
interface PiSessionRegistry {
|
|
151
|
+
list(): Promise<ReadonlyArray<PiAgentSessionHandle>>;
|
|
152
|
+
resolve(input: AgentLoopInput): Promise<PiAgentSessionHandle>;
|
|
172
153
|
size(): number;
|
|
173
154
|
dispose(sessionKey: SessionKey): Promise<void>;
|
|
174
155
|
disposeAll(): Promise<void>;
|
|
175
156
|
}
|
|
176
|
-
declare function createPiSessionRegistry
|
|
157
|
+
export declare function createPiSessionRegistry(options: PiSessionRegistryOptions): PiSessionRegistry;
|
|
177
158
|
//#endregion
|
|
178
159
|
//#region src/adapters/pi/model-management/pi-model-resolution.d.ts
|
|
179
160
|
/**
|
|
@@ -300,137 +281,21 @@ interface EnsurePiModelOptions extends ResolvePiModelOptions {
|
|
|
300
281
|
readonly modelsPath: string;
|
|
301
282
|
readonly signal?: AbortSignal;
|
|
302
283
|
}
|
|
303
|
-
interface ResolvedPiModel {
|
|
304
|
-
readonly binding: ModelBinding;
|
|
305
|
-
readonly model: PiModel;
|
|
306
|
-
}
|
|
307
|
-
declare class PiModelResolutionError extends Error {
|
|
308
|
-
readonly name = "PiModelResolutionError";
|
|
309
|
-
readonly code: "model_change_provider_unsupported" | "model_change_target_unsupported";
|
|
310
|
-
readonly resolutionCode: "invalid-reference" | "provider-unknown" | "model-unknown";
|
|
311
|
-
constructor(resolutionCode: PiModelResolutionError["resolutionCode"], message: string);
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Resolve one exact provider/model pair from the installed Pi model runtime.
|
|
315
|
-
*
|
|
316
|
-
* Model aliases and fuzzy matches are intentionally excluded here. Natural-language
|
|
317
|
-
* interpretation belongs to the application/Agent; the activation boundary must bind
|
|
318
|
-
* to the exact model that the SDK can actually construct.
|
|
319
|
-
*/
|
|
320
|
-
declare function resolvePiModel(options: ResolvePiModelOptions): PiModel;
|
|
321
284
|
/**
|
|
322
285
|
* Ensure metadata for an exact model id that is absent from the installed SDK
|
|
323
286
|
* catalog, then recompose the provider from models.json. Phase 1 only ships the
|
|
324
287
|
* verified DeepSeek declaration required by the management contract; all other
|
|
325
288
|
* unknown ids fail closed and must be supplied by a future explicit catalog path.
|
|
326
289
|
*/
|
|
327
|
-
declare function ensurePiModel(options: EnsurePiModelOptions): Promise<PiModel>;
|
|
328
|
-
declare function resolvePiModelBinding(options: {
|
|
329
|
-
readonly bindingRevision: string;
|
|
330
|
-
readonly modelRuntime: PiModelRuntimePort;
|
|
331
|
-
readonly target: ModelReference;
|
|
332
|
-
}): ResolvedPiModel;
|
|
333
|
-
interface RefreshPiModelCatalogOptions {
|
|
334
|
-
readonly allowNetwork?: boolean;
|
|
335
|
-
readonly provider?: string;
|
|
336
|
-
readonly signal?: AbortSignal;
|
|
337
|
-
}
|
|
338
|
-
interface RefreshPiModelCatalogResult {
|
|
339
|
-
readonly errors: ReadonlyMap<string, Error>;
|
|
340
|
-
readonly refreshedProviders: ReadonlyArray<string>;
|
|
341
|
-
}
|
|
342
|
-
/** Refresh installed SDK metadata, retaining the SDK's persisted declarative catalog. */
|
|
343
|
-
declare function refreshPiModelCatalog(modelRuntime: PiModelRuntimePort, options?: RefreshPiModelCatalogOptions): Promise<RefreshPiModelCatalogResult>;
|
|
344
|
-
declare function samePiProvider(left: ModelReference, right: ModelReference): boolean;
|
|
290
|
+
export declare function ensurePiModel(options: EnsurePiModelOptions): Promise<PiModel>;
|
|
345
291
|
//#endregion
|
|
346
292
|
//#region src/adapters/pi/model-management/pi-model-probe.d.ts
|
|
347
|
-
declare const PI_MODEL_PROBE_TOOL_NAME = "rivus_model_management_probe";
|
|
348
|
-
declare const PI_MODEL_PROBE_TOOL_RESULT = "RIVUS_MODEL_PROBE_TOOL_OK";
|
|
349
|
-
declare const PI_MODEL_PROBE_FOLLOWUP_RESULT = "RIVUS_MODEL_PROBE_FOLLOWUP_OK";
|
|
350
|
-
interface PiModelProbeBudget {
|
|
351
|
-
readonly deadlineAt: string;
|
|
352
|
-
readonly reservePaidCall: (input: {
|
|
353
|
-
readonly kind: ModelChangePaidCallKind;
|
|
354
|
-
readonly maxOutputTokens?: number;
|
|
355
|
-
}) => Effect.Effect<ModelChangeBudgetReservation, unknown>;
|
|
356
|
-
readonly settlePaidCall: (input: {
|
|
357
|
-
readonly outcome: "known" | "unknown";
|
|
358
|
-
readonly outputTokens: number;
|
|
359
|
-
readonly reservation: ModelChangeBudgetReservation;
|
|
360
|
-
}) => Effect.Effect<void, unknown>;
|
|
361
|
-
}
|
|
362
|
-
interface PiModelProbeOptions {
|
|
363
|
-
readonly budget: PiModelProbeBudget;
|
|
364
|
-
readonly model: PiModel;
|
|
365
|
-
readonly modelRuntime: PiModelRuntimePort;
|
|
366
|
-
readonly signal?: AbortSignal;
|
|
367
|
-
readonly thinkingLevel: PiThinkingLevel;
|
|
368
|
-
}
|
|
369
293
|
type PiThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
370
|
-
interface PiModelProbeTurn {
|
|
371
|
-
readonly assistant: {
|
|
372
|
-
readonly content: ReadonlyArray<unknown>;
|
|
373
|
-
readonly model: string;
|
|
374
|
-
readonly provider: string;
|
|
375
|
-
readonly stopReason: string;
|
|
376
|
-
readonly usage: Readonly<Record<string, unknown>>;
|
|
377
|
-
};
|
|
378
|
-
readonly kind: "initial" | "tool-result" | "follow-up";
|
|
379
|
-
readonly reservationId: string;
|
|
380
|
-
readonly toolResult?: {
|
|
381
|
-
readonly content: string;
|
|
382
|
-
readonly toolCallId: string;
|
|
383
|
-
readonly toolName: string;
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
interface PiModelProbeResult {
|
|
387
|
-
readonly assistantThinkingBlocks: number;
|
|
388
|
-
readonly followupText: string;
|
|
389
|
-
readonly model: {
|
|
390
|
-
readonly id: string;
|
|
391
|
-
readonly provider: string;
|
|
392
|
-
};
|
|
393
|
-
readonly outputTokens: number;
|
|
394
|
-
readonly passed: true;
|
|
395
|
-
readonly thinkingLevel: PiThinkingLevel;
|
|
396
|
-
readonly toolResultText: string;
|
|
397
|
-
readonly toolCallId: string;
|
|
398
|
-
readonly toolName: typeof PI_MODEL_PROBE_TOOL_NAME;
|
|
399
|
-
readonly transcript: ReadonlyArray<PiModelProbeTurn>;
|
|
400
|
-
}
|
|
401
|
-
interface PiModelCanaryOptions {
|
|
402
|
-
readonly budget: PiModelProbeBudget;
|
|
403
|
-
readonly kind: Extract<ModelChangePaidCallKind, "activation" | "restore">;
|
|
404
|
-
readonly model: PiModel;
|
|
405
|
-
readonly modelRuntime: PiModelRuntimePort;
|
|
406
|
-
readonly signal?: AbortSignal;
|
|
407
|
-
readonly thinkingLevel: PiThinkingLevel;
|
|
408
|
-
}
|
|
409
|
-
interface PiModelCanaryResult {
|
|
410
|
-
readonly assistant: PiModelProbeTurn["assistant"];
|
|
411
|
-
readonly outputTokens: number;
|
|
412
|
-
}
|
|
413
|
-
declare class PiModelProbeError extends Error {
|
|
414
|
-
readonly name = "PiModelProbeError";
|
|
415
|
-
readonly code: "model_change_deadline_exceeded" | "model_change_probe_failed";
|
|
416
|
-
readonly outcome: "known" | "unknown";
|
|
417
|
-
constructor(message: string, outcome: "known" | "unknown", options?: ErrorOptions, code?: PiModelProbeError["code"]);
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Exercise a candidate through the same Pi model runtime used by business runs.
|
|
421
|
-
* The probe builds an in-memory synthetic context, performs an actual streamed
|
|
422
|
-
* tool call, feeds the real fixed tool result into a second streamed request, and
|
|
423
|
-
* then sends a separate follow-up request. It never loads a persisted transcript
|
|
424
|
-
* or exposes business tools.
|
|
425
|
-
*/
|
|
426
|
-
declare function probePiModel(options: PiModelProbeOptions): Effect.Effect<PiModelProbeResult, unknown>;
|
|
427
|
-
/** Run one bounded, synthetic request for activation/recovery canaries. */
|
|
428
|
-
declare function runPiModelCanary(options: PiModelCanaryOptions): Effect.Effect<PiModelCanaryResult, unknown>;
|
|
429
294
|
//#endregion
|
|
430
295
|
//#region src/adapters/pi/model-management/pi-model-runtime.d.ts
|
|
431
296
|
/** Minimal session collection needed by model changes; compatibility registries can implement it directly. */
|
|
432
297
|
interface PiModelSessionRegistry {
|
|
433
|
-
readonly list: () => Promise<ReadonlyArray<Pick<PiAgentSessionHandle
|
|
298
|
+
readonly list: () => Promise<ReadonlyArray<Pick<PiAgentSessionHandle, "refreshResources" | "session">>>;
|
|
434
299
|
}
|
|
435
300
|
interface CreatePiModelRuntimeOptions {
|
|
436
301
|
readonly initial?: {
|
|
@@ -464,15 +329,6 @@ interface PiModelRuntime extends ModelChangeRuntimePort {
|
|
|
464
329
|
readonly signal?: AbortSignal;
|
|
465
330
|
}) => Effect.Effect<void, unknown>;
|
|
466
331
|
}
|
|
467
|
-
declare class PiModelRuntimeMutationUnknownError extends Error {
|
|
468
|
-
readonly name = "PiModelRuntimeMutationUnknownError";
|
|
469
|
-
readonly outcome: "unknown";
|
|
470
|
-
constructor(message: string, options?: ErrorOptions);
|
|
471
|
-
}
|
|
472
|
-
declare class PiModelTargetCompatibilityError extends Error {
|
|
473
|
-
readonly name = "PiModelTargetCompatibilityError";
|
|
474
|
-
readonly code: "model_change_target_unsupported";
|
|
475
|
-
}
|
|
476
332
|
/**
|
|
477
333
|
* Adapter around Pi's live AgentSession instances.
|
|
478
334
|
*
|
|
@@ -482,31 +338,7 @@ declare class PiModelTargetCompatibilityError extends Error {
|
|
|
482
338
|
* survive the switch. Disposing cached sessions would silently create a new
|
|
483
339
|
* transcript on the next Run and is therefore intentionally unsupported here.
|
|
484
340
|
*/
|
|
485
|
-
declare function createPiModelRuntime(options: CreatePiModelRuntimeOptions): PiModelRuntime;
|
|
486
|
-
//#endregion
|
|
487
|
-
//#region src/adapters/pi/model-management/pi-history-compatibility.d.ts
|
|
488
|
-
interface PiHistoryCompatibility {
|
|
489
|
-
readonly assistantThinkingBlocks: number;
|
|
490
|
-
readonly assistantToolCalls: number;
|
|
491
|
-
readonly compatible: true;
|
|
492
|
-
readonly imageBlocks: number;
|
|
493
|
-
readonly messageCount: number;
|
|
494
|
-
readonly toolResults: number;
|
|
495
|
-
}
|
|
496
|
-
declare class PiHistoryCompatibilityError extends Error {
|
|
497
|
-
readonly name = "PiHistoryCompatibilityError";
|
|
498
|
-
readonly code: "model_change_history_incompatible";
|
|
499
|
-
readonly messageIndex: number;
|
|
500
|
-
constructor(message: string, messageIndex: number);
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* Check the structural parts of a persisted Pi transcript that providers need for
|
|
504
|
-
* the next request. The transcript is never returned or copied; only counts are
|
|
505
|
-
* exposed for diagnostics. This deliberately rejects orphaned tool calls/results
|
|
506
|
-
* instead of deleting or rewriting history during a model change.
|
|
507
|
-
*/
|
|
508
|
-
declare function inspectPiSessionHistory(sessionManager: PiSessionManager): PiHistoryCompatibility;
|
|
509
|
-
declare function assertPiSessionHistoryCompatible(sessionManager: PiSessionManager): PiHistoryCompatibility;
|
|
341
|
+
export declare function createPiModelRuntime(options: CreatePiModelRuntimeOptions): PiModelRuntime;
|
|
510
342
|
//#endregion
|
|
511
343
|
//#region src/adapters/pi/runtime/pi-session-resources.d.ts
|
|
512
344
|
interface CreatePiSessionResourcesOptions {
|
|
@@ -532,7 +364,7 @@ type BoundPiSessionOptions<Options extends object> = Omit<Options, "agentDir" |
|
|
|
532
364
|
readonly agentDir: string;
|
|
533
365
|
readonly cwd: string;
|
|
534
366
|
};
|
|
535
|
-
declare function createPiSessionResources(options: CreatePiSessionResourcesOptions): Promise<PiSessionResources>;
|
|
367
|
+
export declare function createPiSessionResources(options: CreatePiSessionResourcesOptions): Promise<PiSessionResources>;
|
|
536
368
|
//#endregion
|
|
537
369
|
//#region src/adapters/pi/tool-execution/pi-tool-definition.d.ts
|
|
538
370
|
type PiToolContent = {
|
|
@@ -606,39 +438,12 @@ interface PiAssembly {
|
|
|
606
438
|
readonly resolveThinkingLevel: (provider?: string, modelId?: string) => PiThinkingLevel | undefined;
|
|
607
439
|
readonly dispose: () => Promise<void>;
|
|
608
440
|
}
|
|
609
|
-
declare function createPiAssembly(options: PiAssemblyOptions): Promise<PiAssembly>;
|
|
441
|
+
export declare function createPiAssembly(options: PiAssemblyOptions): Promise<PiAssembly>;
|
|
610
442
|
//#endregion
|
|
611
443
|
//#region src/adapters/pi/skills/pi-skill-catalog.d.ts
|
|
612
|
-
|
|
613
|
-
readonly name: string;
|
|
614
|
-
}
|
|
615
|
-
interface PiSkillCatalogDiagnostic {
|
|
616
|
-
readonly message: string;
|
|
617
|
-
readonly path?: string;
|
|
618
|
-
readonly type: "warning" | "error" | "collision";
|
|
619
|
-
}
|
|
620
|
-
declare class InvalidPiSkillCatalog extends Error {
|
|
621
|
-
readonly name = "InvalidPiSkillCatalog";
|
|
622
|
-
}
|
|
623
|
-
declare function validatePiSkillCatalog(input: {
|
|
624
|
-
readonly diagnostics: ReadonlyArray<PiSkillCatalogDiagnostic>;
|
|
625
|
-
readonly skills: ReadonlyArray<PiSkillCatalogEntry>;
|
|
626
|
-
}): ReadonlySet<string>;
|
|
627
|
-
declare function validatePiSkillCommand(text: string, skillNames: ReadonlySet<string>): void;
|
|
628
|
-
//#endregion
|
|
629
|
-
//#region src/adapters/pi/skills/pi-skill-sources.d.ts
|
|
630
|
-
declare class InvalidPiSkillSource extends Error {
|
|
631
|
-
readonly name = "InvalidPiSkillSource";
|
|
632
|
-
}
|
|
633
|
-
interface ResolvePiSkillSourcesOptions {
|
|
634
|
-
readonly agentDir: string;
|
|
635
|
-
readonly homeDirectory: string;
|
|
636
|
-
readonly projectSkillPaths?: ReadonlyArray<string>;
|
|
637
|
-
}
|
|
638
|
-
declare function resolvePiSkillSources(options: ResolvePiSkillSourcesOptions): Promise<ReadonlyArray<string>>;
|
|
444
|
+
export declare function validatePiSkillCommand(text: string, skillNames: ReadonlySet<string>): void;
|
|
639
445
|
//#endregion
|
|
640
446
|
//#region src/adapters/pi/skills/pi-skill-tool.d.ts
|
|
641
|
-
declare const PI_SKILL_READER_TOOL_NAME = "rivus_read_skill";
|
|
642
447
|
interface PiSkillReadDetails {
|
|
643
448
|
readonly contentLength: number;
|
|
644
449
|
readonly digest: string;
|
|
@@ -650,62 +455,45 @@ interface PiSkillRuntime {
|
|
|
650
455
|
readonly prompt: string;
|
|
651
456
|
readonly tool?: PiToolDefinition<PiSkillReadDetails>;
|
|
652
457
|
}
|
|
653
|
-
declare function createPiSkillRuntime(skills: ReadonlyArray<RegisteredRivusSkill>): PiSkillRuntime;
|
|
458
|
+
export declare function createPiSkillRuntime(skills: ReadonlyArray<RegisteredRivusSkill>): PiSkillRuntime;
|
|
654
459
|
//#endregion
|
|
655
460
|
//#region src/adapters/pi/skills/pi-skill-read-tool.d.ts
|
|
656
|
-
declare
|
|
657
|
-
readonly name = "ProjectSkillReadDenied";
|
|
658
|
-
}
|
|
659
|
-
declare function createPiSkillReadTool(options: {
|
|
660
|
-
readonly cwd: string;
|
|
661
|
-
readonly skillPaths: ReadonlyArray<string>;
|
|
662
|
-
}): PiToolDefinition;
|
|
663
|
-
declare const createPiProjectSkillReadTool: typeof createPiSkillReadTool;
|
|
664
|
-
declare function createPiSkillReadTools(options: {
|
|
461
|
+
export declare function createPiSkillReadTools(options: {
|
|
665
462
|
readonly cwd: string;
|
|
666
463
|
readonly runtimeToolIds: ReadonlyArray<RivusRuntimeToolId>;
|
|
667
464
|
readonly skillPaths: ReadonlyArray<string>;
|
|
668
465
|
}): PiToolDefinition[];
|
|
669
466
|
//#endregion
|
|
670
|
-
//#region src/adapters/pi/skills/project-skill-catalog.d.ts
|
|
671
|
-
interface ProjectSkillCatalogEntry {
|
|
672
|
-
readonly name: string;
|
|
673
|
-
}
|
|
674
|
-
interface ProjectSkillCatalogDiagnostic {
|
|
675
|
-
readonly message: string;
|
|
676
|
-
readonly path?: string;
|
|
677
|
-
readonly type: "warning" | "error" | "collision";
|
|
678
|
-
}
|
|
679
|
-
declare class InvalidProjectSkillCatalog extends Error {
|
|
680
|
-
readonly name = "InvalidProjectSkillCatalog";
|
|
681
|
-
}
|
|
682
|
-
declare function validateProjectSkillCatalog(input: {
|
|
683
|
-
readonly diagnostics: ReadonlyArray<ProjectSkillCatalogDiagnostic>;
|
|
684
|
-
readonly skills: ReadonlyArray<ProjectSkillCatalogEntry>;
|
|
685
|
-
}): ReadonlySet<string>;
|
|
686
|
-
declare function validateProjectSkillCommand(text: string, skillNames: ReadonlySet<string>): void;
|
|
687
|
-
//#endregion
|
|
688
467
|
//#region src/adapters/pi/tool-execution/pi-bash-tool-options.d.ts
|
|
689
468
|
interface PiBashSpawnContext {
|
|
690
469
|
command: string;
|
|
691
470
|
cwd: string;
|
|
692
471
|
env: Record<string, string | undefined>;
|
|
693
472
|
}
|
|
473
|
+
interface PiBashRecoveryContext {
|
|
474
|
+
readonly args: Record<string, unknown>;
|
|
475
|
+
readonly signal?: AbortSignal;
|
|
476
|
+
readonly context?: unknown;
|
|
477
|
+
}
|
|
694
478
|
/** Rivus's Bash configuration boundary, independent of provider UI/model types. */
|
|
695
479
|
interface PiBashToolOptions {
|
|
696
480
|
commandPrefix?: string;
|
|
481
|
+
/**
|
|
482
|
+
* When present, invocations are offered to the run-scoped recovery
|
|
483
|
+
* boundary. The callback returns undefined for ordinary commands, allowing
|
|
484
|
+
* the existing business shell to execute them. Reserved attachment actions
|
|
485
|
+
* are never sent to the shell, including after their binding is gone.
|
|
486
|
+
*/
|
|
487
|
+
recovery?: (input: PiBashRecoveryContext) => Promise<PiToolResult | undefined>;
|
|
697
488
|
shellPath?: string;
|
|
698
489
|
spawnHook?: (context: PiBashSpawnContext) => PiBashSpawnContext;
|
|
699
490
|
}
|
|
700
491
|
//#endregion
|
|
701
492
|
//#region src/adapters/pi/tool-execution/pi-bash-tool.d.ts
|
|
702
493
|
/** Keep Pi's native execution, rendering and abort cleanup with a bounded default. */
|
|
703
|
-
declare function createPiBashTool(cwd: string, options?: PiBashToolOptions): PiToolDefinition;
|
|
494
|
+
export declare function createPiBashTool(cwd: string, options?: PiBashToolOptions): PiToolDefinition;
|
|
704
495
|
//#endregion
|
|
705
496
|
//#region src/adapters/pi/tool-execution/pi-tool-proxy.d.ts
|
|
706
|
-
interface ToolBroker$1 {
|
|
707
|
-
execute(request: ToolExecutionRequest): Promise<unknown>;
|
|
708
|
-
}
|
|
709
497
|
interface PiToolApprovalRequest {
|
|
710
498
|
readonly agentId: string;
|
|
711
499
|
readonly allowedActorOpenIds: ReadonlyArray<string>;
|
|
@@ -725,26 +513,26 @@ interface PiToolApprovalRequest {
|
|
|
725
513
|
readonly toolVersion: string;
|
|
726
514
|
}
|
|
727
515
|
interface PiToolApprovalGateway {
|
|
728
|
-
requestApproval(request: PiToolApprovalRequest):
|
|
516
|
+
requestApproval(request: PiToolApprovalRequest): Effect.Effect<void, unknown>;
|
|
729
517
|
}
|
|
730
|
-
interface PiToolProxyOptions
|
|
518
|
+
interface PiToolProxyOptions {
|
|
731
519
|
readonly agentId: string;
|
|
732
520
|
readonly approvals: PiToolApprovalGateway;
|
|
733
|
-
readonly broker: ToolBroker
|
|
521
|
+
readonly broker: ToolBroker;
|
|
734
522
|
readonly getActiveInput: () => AgentLoopInput | undefined;
|
|
735
523
|
readonly instanceId: string;
|
|
736
524
|
readonly memoryScopes?: ReadonlyArray<RivusMemoryScope>;
|
|
737
525
|
readonly toolGrantSet: RivusToolGrantSet;
|
|
738
526
|
readonly tools: ReadonlyArray<RivusResolvedToolDescriptor>;
|
|
739
527
|
}
|
|
740
|
-
declare function createPiToolProxyDefinitions
|
|
741
|
-
declare function createPiToolNameResolver
|
|
528
|
+
export declare function createPiToolProxyDefinitions(options: PiToolProxyOptions): PiToolDefinition[];
|
|
529
|
+
export declare function createPiToolNameResolver(tools: ReadonlyArray<Pick<RivusResolvedToolDescriptor, "id">>): (toolName: string) => string;
|
|
742
530
|
//#endregion
|
|
743
531
|
//#region src/adapters/pi/tool-execution/pi-session-tools.d.ts
|
|
744
532
|
interface PiNamedTool {
|
|
745
533
|
readonly name: string;
|
|
746
534
|
}
|
|
747
|
-
declare function resolvePiSessionToolNames(runtimeToolIds: ReadonlyArray<RivusRuntimeToolId>, customTools: ReadonlyArray<PiNamedTool>): ReadonlyArray<string>;
|
|
535
|
+
export declare function resolvePiSessionToolNames(runtimeToolIds: ReadonlyArray<RivusRuntimeToolId>, customTools: ReadonlyArray<PiNamedTool>): ReadonlyArray<string>;
|
|
748
536
|
//#endregion
|
|
749
537
|
//#region src/adapters/pi/tool-execution/pi-managed-run-binding.d.ts
|
|
750
538
|
/**
|
|
@@ -772,69 +560,11 @@ interface PiManagedRunBindingOptions {
|
|
|
772
560
|
readonly cwd: string;
|
|
773
561
|
readonly provider: PiManagedRunProvider;
|
|
774
562
|
}
|
|
775
|
-
declare function createPiManagedRunBinding(options: PiManagedRunBindingOptions): {
|
|
563
|
+
export declare function createPiManagedRunBinding(options: PiManagedRunBindingOptions): {
|
|
776
564
|
readonly activate: (run: PiManagedRunInput) => void;
|
|
777
565
|
readonly deactivate: () => void;
|
|
778
566
|
readonly tool: PiToolDefinition;
|
|
779
567
|
};
|
|
780
568
|
//#endregion
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
readonly session: PiAgentSession;
|
|
784
|
-
readonly resolveToolName?: (toolName: string) => string;
|
|
785
|
-
readonly preparePrompt?: (input: AgentLoopInput$1) => Promise<string> | string;
|
|
786
|
-
readonly dispose?: () => Promise<void> | void;
|
|
787
|
-
readonly activate?: (input: AgentLoopInput$1) => Promise<void> | void;
|
|
788
|
-
readonly deactivate?: () => Promise<void> | void;
|
|
789
|
-
readonly refreshResources?: () => Promise<void> | void;
|
|
790
|
-
}
|
|
791
|
-
interface PiAgentLoopOptions {
|
|
792
|
-
readonly supportsSteering?: boolean;
|
|
793
|
-
readonly resolveSession: (input: AgentLoopInput$1) => Promise<PiAgentSessionHandle> | PiAgentSessionHandle;
|
|
794
|
-
readonly modelContentObserver?: AgentModelContentObserver;
|
|
795
|
-
readonly disposeSessionAfterRun?: boolean;
|
|
796
|
-
readonly runBoundary?: {
|
|
797
|
-
readonly acquireRun: (input?: {
|
|
798
|
-
readonly deadlineAt?: string;
|
|
799
|
-
readonly signal?: AbortSignal;
|
|
800
|
-
}) => Effect.Effect<{
|
|
801
|
-
readonly release: () => void;
|
|
802
|
-
}, unknown>;
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
declare function createPiAgentLoop(options: PiAgentLoopOptions): AgentLoop$1;
|
|
806
|
-
declare function createPiSdkAgentLoop<TSessionOptions = unknown>(options: PiSdkAgentLoopOptions<TSessionOptions>): AgentLoop$1;
|
|
807
|
-
declare function toEffectPiAgentSessionHandle(handle: PiAgentSessionHandle): PiAgentSessionHandle$1;
|
|
808
|
-
declare function fromEffectPiAgentSessionHandle(handle: PiAgentSessionHandle$1): PiAgentSessionHandle;
|
|
809
|
-
//#endregion
|
|
810
|
-
//#region src/adapters/compatibility/agent-execution/pi/pi-session-registry.d.ts
|
|
811
|
-
interface PiSessionRegistryOptions {
|
|
812
|
-
readonly createSession: (input: AgentLoopInput$1) => Promise<PiAgentSessionHandle> | PiAgentSessionHandle;
|
|
813
|
-
}
|
|
814
|
-
interface PiSessionRegistry {
|
|
815
|
-
disposeAll(): Promise<void>;
|
|
816
|
-
dispose(sessionKey: SessionKey): Promise<void>;
|
|
817
|
-
list(): Promise<ReadonlyArray<PiAgentSessionHandle>>;
|
|
818
|
-
size(): number;
|
|
819
|
-
resolve(input: AgentLoopInput$1): Promise<PiAgentSessionHandle>;
|
|
820
|
-
}
|
|
821
|
-
declare function createPiSessionRegistry(options: PiSessionRegistryOptions): PiSessionRegistry;
|
|
822
|
-
//#endregion
|
|
823
|
-
//#region src/adapters/compatibility/agent-execution/pi/pi-tool-proxy.d.ts
|
|
824
|
-
interface ToolBroker {
|
|
825
|
-
execute(request: ToolExecutionRequest): Promise<unknown>;
|
|
826
|
-
}
|
|
827
|
-
interface PiToolProxyOptions {
|
|
828
|
-
readonly agentId: string;
|
|
829
|
-
readonly instanceId: string;
|
|
830
|
-
readonly tools: ReadonlyArray<RivusResolvedToolDescriptor>;
|
|
831
|
-
readonly toolGrantSet: RivusToolGrantSet;
|
|
832
|
-
readonly broker: ToolBroker;
|
|
833
|
-
readonly approvals: PiToolApprovalGateway;
|
|
834
|
-
readonly getActiveInput: () => AgentLoopInput$1 | undefined;
|
|
835
|
-
readonly memoryScopes?: ReadonlyArray<RivusMemoryScope>;
|
|
836
|
-
}
|
|
837
|
-
declare function createPiToolProxyDefinitions(options: PiToolProxyOptions): PiToolDefinition[];
|
|
838
|
-
declare function createPiToolNameResolver(tools: ReadonlyArray<Pick<RivusResolvedToolDescriptor, "id">>): (toolName: string) => string;
|
|
839
|
-
//#endregion
|
|
840
|
-
export { type CreatePiModelRuntimeOptions, type CreatePiSessionResourcesOptions, type EnsurePiModelOptions, InvalidPiSkillCatalog, InvalidPiSkillSource, InvalidProjectSkillCatalog, type PiAgentLoopOptions as LegacyPiAgentLoopOptions, type PiAgentSessionHandle as LegacyPiAgentSessionHandle, type PiSdkAgentLoopOptions as LegacyPiSdkAgentLoopOptions, type PiSdkAgentLoopOptions, type PiSessionRegistry as LegacyPiSessionRegistry, type PiSessionRegistryOptions as LegacyPiSessionRegistryOptions, type PiToolApprovalGateway as LegacyPiToolApprovalGateway, type PiToolApprovalGateway, type PiToolApprovalRequest as LegacyPiToolApprovalRequest, type PiToolApprovalRequest, type PiToolProxyOptions as LegacyPiToolProxyOptions, type MergePiProviderBaseUrlOverrideOptions, type MergePiProviderModelDeclarationOptions, PI_MODEL_PROBE_FOLLOWUP_RESULT, PI_MODEL_PROBE_TOOL_NAME, PI_MODEL_PROBE_TOOL_RESULT, PI_SKILL_READER_TOOL_NAME, type PiAgentLoopOptions$1 as PiAgentLoopOptions, type PiAgentSession, type PiAgentSessionEvent, type PiAgentSessionHandle$1 as PiAgentSessionHandle, type PiAssembly, type PiAssemblyOptions, type PiAssemblySessionOptions, type PiAssemblySessionResult, type PiBashToolOptions, type PiCreateAgentSessionResult, type PiDeclarativeModelDefinition, type PiHistoryCompatibility, PiHistoryCompatibilityError, type PiManagedRunBindingOptions, type PiManagedRunInput, type PiManagedRunProvider, type PiManagedRunProviderResult, type PiMessageEndEvent, type PiMessageStartEvent, type PiMessageUpdateEvent, type PiModel, type PiModelCanaryOptions, type PiModelCanaryResult, type PiModelContext, type PiModelProbeBudget, PiModelProbeError, type PiModelProbeOptions, type PiModelProbeResult, type PiModelProbeTurn, PiModelResolutionError, type PiModelRuntime, PiModelRuntimeMutationUnknownError, type PiModelRuntimePort, type PiModelSessionRegistry, type PiModelStream, type PiModelStreamOptions, PiModelTargetCompatibilityError, type PiNamedTool, type PiSessionContext, type PiSessionManager, type PiSessionRegistry$1 as PiSessionRegistry, type PiSessionRegistryOptions$1 as PiSessionRegistryOptions, type PiSessionResources, type PiSkillCatalogDiagnostic, type PiSkillCatalogEntry, type PiSkillReadDetails, type PiSkillRuntime, type PiThinkingLevel, type PiToolContent, type PiToolDefinition, type PiToolExecutionEndEvent, type PiToolExecutionStartEvent, type PiToolExecutionUpdateEvent, type PiToolProxyOptions$1 as PiToolProxyOptions, type PiToolResult, type ProjectSkillCatalogDiagnostic, type ProjectSkillCatalogEntry, ProjectSkillReadDenied, type RefreshPiModelCatalogOptions, type RefreshPiModelCatalogResult, type ResolvePiModelOptions, type ResolvePiSkillSourcesOptions, type ResolvedPiModel, assertPiSessionHistoryCompatible, createPiAgentLoop as createLegacyPiAgentLoop, createPiSdkAgentLoop as createLegacyPiSdkAgentLoop, createPiSessionRegistry as createLegacyPiSessionRegistry, createPiToolNameResolver as createLegacyPiToolNameResolver, createPiToolProxyDefinitions as createLegacyPiToolProxyDefinitions, createPiAgentLoop$1 as createPiAgentLoop, createPiAssembly, createPiBashTool, createPiManagedRunBinding, createPiModelRuntime, createPiProjectSkillReadTool, createPiSdkAgentLoop$1 as createPiSdkAgentLoop, createPiSessionRegistry$1 as createPiSessionRegistry, createPiSessionResources, createPiSkillReadTool, createPiSkillReadTools, createPiSkillRuntime, createPiToolNameResolver$1 as createPiToolNameResolver, createPiToolProxyDefinitions$1 as createPiToolProxyDefinitions, ensurePiModel, fromEffectPiAgentSessionHandle as fromEffectLegacyPiAgentSessionHandle, inspectPiSessionHistory, mergePiProviderBaseUrlOverride, mergePiProviderModelDeclaration, probePiModel, refreshPiModelCatalog, resolvePiModel, resolvePiModelBinding, resolvePiSessionToolNames, resolvePiSkillSources, runPiModelCanary, runPiSessionPrompts, samePiProvider, toEffectPiAgentSessionHandle as toEffectLegacyPiAgentSessionHandle, validatePiSkillCatalog, validatePiSkillCommand, validateProjectSkillCatalog, validateProjectSkillCommand };
|
|
569
|
+
export type { PiAssembly, PiBashRecoveryContext, PiManagedRunInput, PiManagedRunProvider, PiManagedRunProviderResult, PiModel, PiThinkingLevel, PiToolApprovalGateway };
|
|
570
|
+
export {};
|