@orkestrel/study 0.0.1 → 0.0.3
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/README.md +63 -1
- package/dist/bin/main.js +2 -5399
- package/dist/bin/main.js.map +1 -1
- package/dist/src/core/index.cjs +105 -19
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +83 -12
- package/dist/src/core/index.d.ts +83 -12
- package/dist/src/core/index.js +104 -21
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +3941 -3595
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +1018 -451
- package/dist/src/server/index.d.ts +1018 -451
- package/dist/src/server/index.js +3115 -2823
- package/dist/src/server/index.js.map +1 -1
- package/package.json +18 -9
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import type { BigIntStats } from 'node:fs';
|
|
1
2
|
import type { ChildProcess } from 'node:child_process';
|
|
2
3
|
import type { Dir } from 'node:fs';
|
|
3
4
|
import type { Dirent } from 'node:fs';
|
|
4
|
-
import type { estimateRequest } from '@orkestrel/agent';
|
|
5
5
|
import type { extractTiming } from '@orkestrel/ollama';
|
|
6
6
|
import type { FileHandle } from 'node:fs/promises';
|
|
7
|
-
import type { isAgentError } from '@orkestrel/agent';
|
|
8
7
|
import type { JSONValue } from '@orkestrel/contract';
|
|
9
8
|
import type { LedgerGauge } from '@orkestrel/agent';
|
|
10
9
|
import type { LoadFnOutput } from 'node:module';
|
|
11
10
|
import type { LoadHookContext } from 'node:module';
|
|
12
11
|
import type { LoadHookSync } from 'node:module';
|
|
13
|
-
import type { measureRequest } from '@orkestrel/agent';
|
|
14
12
|
import type { Message } from '@orkestrel/agent';
|
|
13
|
+
import type { OllamaDaemonIdentity } from '@orkestrel/ollama/server';
|
|
14
|
+
import type { OllamaDaemonInterface } from '@orkestrel/ollama/server';
|
|
15
15
|
import type { OllamaOptions } from '@orkestrel/ollama';
|
|
16
16
|
import type { OllamaTiming } from '@orkestrel/ollama';
|
|
17
17
|
import type { ProviderDelta } from '@orkestrel/agent';
|
|
@@ -21,6 +21,45 @@ import type { ProviderResult } from '@orkestrel/agent';
|
|
|
21
21
|
import type { ResolveFnOutput } from 'node:module';
|
|
22
22
|
import type { ResolveHookContext } from 'node:module';
|
|
23
23
|
import type { ResolveHookSync } from 'node:module';
|
|
24
|
+
import type { StudyAdmissionInterface } from '@orkestrel/study';
|
|
25
|
+
import type { StudyAgentDispatch } from '@orkestrel/study';
|
|
26
|
+
import type { StudyAgentReading } from '@orkestrel/study';
|
|
27
|
+
import type { StudyAgentRuntime } from '@orkestrel/study';
|
|
28
|
+
import type { StudyAttempt } from '@orkestrel/study';
|
|
29
|
+
import type { StudyBounds } from '@orkestrel/study';
|
|
30
|
+
import type { StudyCharge } from '@orkestrel/study';
|
|
31
|
+
import type { StudyContext } from '@orkestrel/study';
|
|
32
|
+
import type { StudyControl } from '@orkestrel/study';
|
|
33
|
+
import type { StudyCriterion } from '@orkestrel/study';
|
|
34
|
+
import type { StudyDefinition } from '@orkestrel/study';
|
|
35
|
+
import type { StudyDriverInterface } from '@orkestrel/study';
|
|
36
|
+
import { StudyError } from '@orkestrel/study';
|
|
37
|
+
import type { StudyEvidence } from '@orkestrel/study';
|
|
38
|
+
import type { StudyFailure } from '@orkestrel/study';
|
|
39
|
+
import type { StudyGoal } from '@orkestrel/study';
|
|
40
|
+
import type { StudyGrading } from '@orkestrel/study';
|
|
41
|
+
import type { StudyIdentity } from '@orkestrel/study';
|
|
42
|
+
import type { StudyJudgment } from '@orkestrel/study';
|
|
43
|
+
import type { StudyLabeling } from '@orkestrel/study';
|
|
44
|
+
import type { StudyLatchInterface } from '@orkestrel/study';
|
|
45
|
+
import type { StudyLimit } from '@orkestrel/study';
|
|
46
|
+
import type { StudyManifest } from '@orkestrel/study';
|
|
47
|
+
import type { StudyObservation } from '@orkestrel/study';
|
|
48
|
+
import type { StudyProduct } from '@orkestrel/study';
|
|
49
|
+
import type { StudyProfile } from '@orkestrel/study';
|
|
50
|
+
import type { StudyProvider } from '@orkestrel/study';
|
|
51
|
+
import type { StudyRecord } from '@orkestrel/study';
|
|
52
|
+
import type { StudyRole } from '@orkestrel/study';
|
|
53
|
+
import type { StudyRoom } from '@orkestrel/study';
|
|
54
|
+
import type { StudyRubric } from '@orkestrel/study';
|
|
55
|
+
import type { StudyScenario } from '@orkestrel/study';
|
|
56
|
+
import type { StudySessionInterface } from '@orkestrel/study';
|
|
57
|
+
import type { StudySinkInterface } from '@orkestrel/study';
|
|
58
|
+
import type { StudyStoreInterface } from '@orkestrel/study';
|
|
59
|
+
import type { StudyTicket } from '@orkestrel/study';
|
|
60
|
+
import type { StudyTrial } from '@orkestrel/study';
|
|
61
|
+
import type { StudyUsage } from '@orkestrel/study';
|
|
62
|
+
import type { ToolCall } from '@orkestrel/tool';
|
|
24
63
|
|
|
25
64
|
/** Bounds all captured input bytes to 128 MiB. */
|
|
26
65
|
export declare const ARTIFACT_BYTES: number;
|
|
@@ -28,6 +67,12 @@ export declare const ARTIFACT_BYTES: number;
|
|
|
28
67
|
/** Bounds directory nesting below each selected root. */
|
|
29
68
|
export declare const ARTIFACT_DEPTH = 64;
|
|
30
69
|
|
|
70
|
+
/** Marks artifact errors across module formats and installations. */
|
|
71
|
+
export declare const ARTIFACT_ERROR_BRAND: unique symbol;
|
|
72
|
+
|
|
73
|
+
/** Lists the artifact refusal codes. */
|
|
74
|
+
export declare const ARTIFACT_ERROR_CODES: readonly ArtifactErrorCode[];
|
|
75
|
+
|
|
31
76
|
/** Bounds one captured input file to 16 MiB. */
|
|
32
77
|
export declare const ARTIFACT_FILE_BYTES: number;
|
|
33
78
|
|
|
@@ -40,15 +85,34 @@ export declare const ARTIFACT_ROOTS = 128;
|
|
|
40
85
|
/** Bounds all visited directory entries, including ignored assets. */
|
|
41
86
|
export declare const ARTIFACT_VISITS = 32768;
|
|
42
87
|
|
|
88
|
+
/** Binds a verified physical forest to its relocated selections and complete membership.
|
|
89
|
+
* @remarks
|
|
90
|
+
* Digest hashes sorted member keys, digests, sizes, and package roots relative to destination
|
|
91
|
+
* with their names and versions. Source paths and destination are excluded from that digest.
|
|
92
|
+
* Options contains canonical destination paths and preserves nested node_modules and distinct
|
|
93
|
+
* physical copies of one package. Members include non-entry dependencies and explicit assets.
|
|
94
|
+
* This value proves copying and verification, not successful adapter validation or publication.
|
|
95
|
+
*/
|
|
96
|
+
export declare interface ArtifactClosure {
|
|
97
|
+
readonly destination: string;
|
|
98
|
+
readonly digest: string;
|
|
99
|
+
readonly options: ArtifactLoaderOptions;
|
|
100
|
+
readonly members: readonly ArtifactMember[];
|
|
101
|
+
}
|
|
102
|
+
|
|
43
103
|
/** Reports an invalid or drifted artifact inventory. */
|
|
44
104
|
export declare class ArtifactError extends Error {
|
|
45
|
-
readonly code:
|
|
105
|
+
readonly code: ArtifactErrorCode;
|
|
46
106
|
/** Records the refused artifact boundary.
|
|
47
107
|
* @param message - The specific refusal.
|
|
108
|
+
* @param code - The refused boundary. Default: ARTIFACT.
|
|
48
109
|
*/
|
|
49
|
-
constructor(message: string);
|
|
110
|
+
constructor(message: string, code?: ArtifactErrorCode);
|
|
50
111
|
}
|
|
51
112
|
|
|
113
|
+
/** Names the refused boundary of a captured or materialized artifact graph. */
|
|
114
|
+
export declare type ArtifactErrorCode = 'ARTIFACT' | 'TRAVERSAL' | 'REDIRECT' | 'ALIAS' | 'NAME' | 'DUPLICATE' | 'OCCUPIED' | 'OVERLAP' | 'STALE' | 'VOLUME' | 'DRIFT' | 'LIMIT';
|
|
115
|
+
|
|
52
116
|
/** Records the exact bytes admitted at one absolute file path. */
|
|
53
117
|
export declare interface ArtifactFile {
|
|
54
118
|
readonly path: string;
|
|
@@ -75,14 +139,16 @@ export declare interface ArtifactInventory {
|
|
|
75
139
|
readonly source?: ArtifactSourceOptions;
|
|
76
140
|
readonly instrument?: string;
|
|
77
141
|
readonly files: readonly ArtifactFile[];
|
|
142
|
+
/** Binds explicit custody-only selections independently of executable entries. */
|
|
143
|
+
readonly assets?: readonly string[];
|
|
78
144
|
}
|
|
79
145
|
|
|
80
146
|
/** Captures built ESM and a separate strip-only consumer adapter in a fresh worker.
|
|
81
147
|
* @remarks
|
|
82
|
-
* Loads trusted code
|
|
148
|
+
* Loads trusted code without sandboxing untrusted code. Native process APIs, eval and external
|
|
83
149
|
* services are not replayed. One inventory may load per process; terminate it afterwards.
|
|
84
150
|
*/
|
|
85
|
-
export declare class ArtifactLoader {
|
|
151
|
+
export declare class ArtifactLoader implements ArtifactLoaderInterface {
|
|
86
152
|
#private;
|
|
87
153
|
/** Captures selections without reading or executing selected modules.
|
|
88
154
|
* @param options - Canonical built selections and optional consumer source selection.
|
|
@@ -103,6 +169,43 @@ export declare class ArtifactLoader {
|
|
|
103
169
|
* @throws Thrown for drift, unsupported edges, evaluation failures, or a reused worker.
|
|
104
170
|
*/
|
|
105
171
|
load(entry: string): Promise<unknown>;
|
|
172
|
+
/** Copies the inspected physical forest into an exclusive absent destination.
|
|
173
|
+
* @param destination - The canonical absent absolute directory under an existing physical parent.
|
|
174
|
+
* @returns The independently verified copied membership and relocated selections.
|
|
175
|
+
* @throws ArtifactError - Thrown at the refused path, stale-source, volume, or drift boundary.
|
|
176
|
+
*/
|
|
177
|
+
materialize(destination: string): Promise<ArtifactClosure>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Captures, verifies, loads, and materializes one admitted physical artifact graph. */
|
|
181
|
+
export declare interface ArtifactLoaderInterface {
|
|
182
|
+
/** Captures the complete admitted population without evaluating modules.
|
|
183
|
+
* @returns The immutable inventory and runtime identity.
|
|
184
|
+
*/
|
|
185
|
+
inspect(): ArtifactInventory;
|
|
186
|
+
/** Refuses changed bytes or membership after inspection.
|
|
187
|
+
* @returns Nothing when the inspected population still matches.
|
|
188
|
+
*/
|
|
189
|
+
verify(): void;
|
|
190
|
+
/** Loads an admitted entry through captured-byte hooks in a fresh process.
|
|
191
|
+
* @param entry - The canonical selected module path.
|
|
192
|
+
* @returns The actual module namespace.
|
|
193
|
+
*/
|
|
194
|
+
load(entry: string): Promise<unknown>;
|
|
195
|
+
/** Copies the inspected physical forest into an exclusive absent destination.
|
|
196
|
+
* @remarks
|
|
197
|
+
* Preserves relative resolution and duplicate package copies. Refuses different source or
|
|
198
|
+
* destination volumes, overlapping or occupied destinations, redirected ancestors, aliases, unsafe names,
|
|
199
|
+
* duplicate keys, traversal, and stale source references before copying through them. Applies
|
|
200
|
+
* the aggregate ARTIFACT limits to the whole population, verifies source before and after copy,
|
|
201
|
+
* and independently verifies destination bytes and membership before returning. Separate path
|
|
202
|
+
* checks and reads do not establish an atomic snapshot or concurrent hardlink-race resistance.
|
|
203
|
+
* This operation writes no completion marker; freeze validates in a fresh captured child first.
|
|
204
|
+
* @param destination - The absolute absent directory under an existing physical parent.
|
|
205
|
+
* @returns The verified relocation and complete physical membership.
|
|
206
|
+
* @throws ArtifactError - Thrown with the refused boundary's ArtifactErrorCode.
|
|
207
|
+
*/
|
|
208
|
+
materialize(destination: string): Promise<ArtifactClosure>;
|
|
106
209
|
}
|
|
107
210
|
|
|
108
211
|
/** Selects built packages and an optional separate consumer source graph. */
|
|
@@ -114,11 +217,23 @@ export declare interface ArtifactLoaderOptions {
|
|
|
114
217
|
readonly instrument?: string;
|
|
115
218
|
/** Refuses these built files at every import edge; the inventory identity is unchanged. */
|
|
116
219
|
readonly excluded?: readonly string[];
|
|
220
|
+
/** Admits explicitly selected canonical regular files without granting import eligibility. */
|
|
221
|
+
readonly assets?: readonly string[];
|
|
117
222
|
}
|
|
118
223
|
|
|
119
224
|
/** Names Node's synchronous loading continuation. */
|
|
120
225
|
export declare type ArtifactLoadHandler = Parameters<LoadHookSync>[2];
|
|
121
226
|
|
|
227
|
+
/** Maps one admitted physical file to its exact bytes inside a materialized forest. */
|
|
228
|
+
export declare interface ArtifactMember {
|
|
229
|
+
/** Names the canonical source path retained as provenance, never used for relocated loading. */
|
|
230
|
+
readonly source: string;
|
|
231
|
+
/** Names a portable slash-separated key relative to the closure destination. */
|
|
232
|
+
readonly key: string;
|
|
233
|
+
readonly digest: string;
|
|
234
|
+
readonly size: number;
|
|
235
|
+
}
|
|
236
|
+
|
|
122
237
|
/** Records the identity declared by an admitted package manifest. */
|
|
123
238
|
export declare interface ArtifactPackage {
|
|
124
239
|
readonly root: string;
|
|
@@ -143,7 +258,7 @@ export declare interface ArtifactSource extends ArtifactFile {
|
|
|
143
258
|
}
|
|
144
259
|
|
|
145
260
|
/** Selects a consumer-owned executable source directory and its exact adapter entry.
|
|
146
|
-
* @remarks Source JSON assets are not
|
|
261
|
+
* @remarks Source JSON assets are not executable imports; explicitly selected assets retain custody only.
|
|
147
262
|
*/
|
|
148
263
|
export declare interface ArtifactSourceOptions {
|
|
149
264
|
readonly root: string;
|
|
@@ -174,6 +289,44 @@ export declare function buildStudyAgentReadings(result: unknown): JSONValue;
|
|
|
174
289
|
*/
|
|
175
290
|
export declare function buildStudyAgentRevision(request: ProviderRequest): string | undefined;
|
|
176
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Builds the JSON evidence form of an Agent tool call the Agent denied before dispatch.
|
|
294
|
+
* @param call - The call received from the admitted Agent
|
|
295
|
+
* @param reason - The denial reason, retained only when it is a string
|
|
296
|
+
* @returns The call identity with the optional string reason
|
|
297
|
+
* @throws StudyError - Thrown with code `FAULT` when the call is malformed
|
|
298
|
+
* @example
|
|
299
|
+
* ```ts
|
|
300
|
+
* buildStudyAgentToolDenial(call, 'refused')
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
export declare function buildStudyAgentToolDenial(call: unknown, reason: unknown): JSONValue;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Builds the JSON evidence form of an Agent tool call and its executed result.
|
|
307
|
+
* @param call - The call received from the admitted Agent
|
|
308
|
+
* @param result - The executed tool result
|
|
309
|
+
* @returns The call identity, owned arguments, success, and owned value or error text
|
|
310
|
+
* @throws StudyError - Thrown with code `FAULT` when the call, result, arguments, or value is malformed
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* buildStudyAgentToolResult(call, { success: true, value: 'stored' })
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
export declare function buildStudyAgentToolResult(call: unknown, result: unknown): JSONValue;
|
|
317
|
+
|
|
318
|
+
/** Projects the declaration onto its complete ordered HTTP identity population.
|
|
319
|
+
* @param declaration - The validated opening row.
|
|
320
|
+
* @returns Maintenance, preflight, model and postflight identities in declaration order.
|
|
321
|
+
*/
|
|
322
|
+
export declare function buildStudyExchangeSequence(declaration: StudyExchangeDeclaration): readonly StudyExchangeIdentity[];
|
|
323
|
+
|
|
324
|
+
/** Encodes exact application bytes with their decoded size and SHA-256 identity.
|
|
325
|
+
* @param bytes - The request or response application bytes.
|
|
326
|
+
* @returns Canonical base64 and the independent byte receipt.
|
|
327
|
+
*/
|
|
328
|
+
export declare function buildStudyOllamaBytes(bytes: Uint8Array): StudyExchangeBytes;
|
|
329
|
+
|
|
177
330
|
/**
|
|
178
331
|
* Declares the pinned serving identities the Ollama transport verifies, keyed by the label their inventory evidence carries.
|
|
179
332
|
* @param provider - Declared serving identities
|
|
@@ -224,8 +377,8 @@ export declare function buildStudyOllamaTiming(timing: OllamaTiming | undefined)
|
|
|
224
377
|
* Builds a frozen owned copy of transport configuration that later caller mutation cannot reach.
|
|
225
378
|
* @remarks
|
|
226
379
|
* Every caller member is read once, outer fields before nested data. Every nested data object is
|
|
227
|
-
* copied and frozen; the caller's objects are never frozen. The cancellation signal
|
|
228
|
-
* extractor keep their live identity.
|
|
380
|
+
* copied and frozen; the caller's objects are never frozen. The cancellation signal, timing
|
|
381
|
+
* extractor, and fetch collaborator keep their live identity.
|
|
229
382
|
* @param options - The caller's transport configuration
|
|
230
383
|
* @returns The owned configuration, not yet validated
|
|
231
384
|
*/
|
|
@@ -312,6 +465,14 @@ export declare function collectStudyEntries(profile: StudyProfile): readonly str
|
|
|
312
465
|
*/
|
|
313
466
|
export declare function collectStudyEvidence(result: StudySealedResult): Promise<Readonly<Record<string, readonly StudyEvidence[]>>>;
|
|
314
467
|
|
|
468
|
+
/** Computes a destination-independent digest of members and relative package identities.
|
|
469
|
+
* @param members - Complete copied membership, with source provenance excluded from identity.
|
|
470
|
+
* @param packages - Package identities with relocated roots.
|
|
471
|
+
* @param destination - The common destination directory.
|
|
472
|
+
* @returns The portable SHA-256 identity.
|
|
473
|
+
*/
|
|
474
|
+
export declare function computeArtifactClosureDigest(members: readonly ArtifactMember[], packages: readonly ArtifactPackage[], destination: string): string;
|
|
475
|
+
|
|
315
476
|
/**
|
|
316
477
|
* Groups failed records by cause, role, and layer, each group carrying its source readings.
|
|
317
478
|
* @remarks
|
|
@@ -504,12 +665,40 @@ export declare function gradeStudyEvidence(input: StudyAdjudication, grade: Stud
|
|
|
504
665
|
*/
|
|
505
666
|
export declare function hashStudyBytes(input: string | Uint8Array): string;
|
|
506
667
|
|
|
668
|
+
/** Checks a bounded materialization record before any path is used.
|
|
669
|
+
* @param value - The decoded record.
|
|
670
|
+
* @returns True if its selections and member records have the declared shapes; false otherwise.
|
|
671
|
+
*/
|
|
672
|
+
export declare function isArtifactClosure(value: unknown): value is ArtifactClosure;
|
|
673
|
+
|
|
507
674
|
/** Narrows a caught value to an artifact refusal.
|
|
675
|
+
* @remarks
|
|
676
|
+
* Recognizes subclasses and other module copies by an own identity brand and valid members.
|
|
677
|
+
* The brand is a recognition marker. A transparent proxy, a look-alike without the brand,
|
|
678
|
+
* throwing accessors, and revoked proxies return false.
|
|
508
679
|
* @param value - The caught value.
|
|
509
680
|
* @returns True if the value is an artifact error; false otherwise.
|
|
510
681
|
*/
|
|
511
682
|
export declare function isArtifactError(value: unknown): value is ArtifactError;
|
|
512
683
|
|
|
684
|
+
/** Checks whether a key names portable, non-credential members within a closure.
|
|
685
|
+
* @param value - The untrusted slash-separated key.
|
|
686
|
+
* @returns True if every segment is safe and contained; false otherwise.
|
|
687
|
+
*/
|
|
688
|
+
export declare function isArtifactKey(value: unknown): value is string;
|
|
689
|
+
|
|
690
|
+
/** Checks the bounded loader selections retained in a publication.
|
|
691
|
+
* @param value - The decoded selections.
|
|
692
|
+
* @returns True if required selections and optional groups have their declared shapes; false otherwise.
|
|
693
|
+
*/
|
|
694
|
+
export declare function isArtifactLoaderOptions(value: unknown): value is ArtifactLoaderOptions;
|
|
695
|
+
|
|
696
|
+
/** Checks the exact file identity and provenance of a closure member.
|
|
697
|
+
* @param value - The decoded member.
|
|
698
|
+
* @returns True if the member has a safe key, source, digest and bounded size; false otherwise.
|
|
699
|
+
*/
|
|
700
|
+
export declare function isArtifactMember(value: unknown): value is ArtifactMember;
|
|
701
|
+
|
|
513
702
|
/** Checks whether a factory returned the complete consumer adapter contract.
|
|
514
703
|
* @param value - The unknown factory result.
|
|
515
704
|
* @returns True if validation, construction, and grading are callable; false otherwise.
|
|
@@ -544,6 +733,12 @@ export declare function isStudyAgentResponse(value: unknown): value is StudyAgen
|
|
|
544
733
|
*/
|
|
545
734
|
export declare function isStudyCharge(value: unknown): value is StudyCharge;
|
|
546
735
|
|
|
736
|
+
/** Checks a closure publication before using its command inputs.
|
|
737
|
+
* @param value - The decoded closure.json value.
|
|
738
|
+
* @returns True if relocation, selectors, and both identities are declared; false otherwise.
|
|
739
|
+
*/
|
|
740
|
+
export declare function isStudyClosure(value: unknown): value is StudyClosure;
|
|
741
|
+
|
|
547
742
|
/**
|
|
548
743
|
* Checks whether an attempt terminally accounts for the exact scheduled goal horizon.
|
|
549
744
|
* @param value - The candidate attempt
|
|
@@ -657,6 +852,48 @@ export declare function isStudyCustodyTrial(value: unknown): value is StudyTrial
|
|
|
657
852
|
*/
|
|
658
853
|
export declare function isStudyEvidence(value: unknown): value is StudyEvidence;
|
|
659
854
|
|
|
855
|
+
/** Checks whether encoded body bytes have their exact canonical base64 and SHA-256 identity.
|
|
856
|
+
* @param value - The candidate byte envelope.
|
|
857
|
+
* @returns True if decoded length and digest match; false otherwise.
|
|
858
|
+
*/
|
|
859
|
+
export declare function isStudyExchangeBytes(value: unknown): value is StudyExchangeBytes;
|
|
860
|
+
|
|
861
|
+
/** Checks whether the opening row declares a finite ordered procedure and serving identities.
|
|
862
|
+
* @param value - The candidate declaration.
|
|
863
|
+
* @returns True if all declared populations are valid; false otherwise.
|
|
864
|
+
*/
|
|
865
|
+
export declare function isStudyExchangeDeclaration(value: unknown): value is StudyExchangeDeclaration;
|
|
866
|
+
|
|
867
|
+
/** Checks whether a worker destination has an absolute sidecar path and finite reservation.
|
|
868
|
+
* @param value - The decoded destination.
|
|
869
|
+
* @returns True if its path, allowance and optional retained identity are valid; false otherwise.
|
|
870
|
+
*/
|
|
871
|
+
export declare function isStudyExchangeDestination(value: unknown): value is StudyExchangeDestination;
|
|
872
|
+
|
|
873
|
+
/** Checks whether a history has verified row shapes before its complete relational validation.
|
|
874
|
+
* @param value - The candidate history.
|
|
875
|
+
* @returns True if its envelopes and rows have valid types; false otherwise.
|
|
876
|
+
*/
|
|
877
|
+
export declare function isStudyExchangeHistory(value: unknown): value is StudyExchangeHistory;
|
|
878
|
+
|
|
879
|
+
/** Checks whether an exchange carries an admissible ordered HTTP identity.
|
|
880
|
+
* @param value - The candidate identity.
|
|
881
|
+
* @returns True if identity and stage fields are valid; false otherwise.
|
|
882
|
+
*/
|
|
883
|
+
export declare function isStudyExchangeIdentity(value: unknown): value is StudyExchangeIdentity;
|
|
884
|
+
|
|
885
|
+
/** Checks whether a retained reply describes bounded successful application bytes and chunks.
|
|
886
|
+
* @param value - The candidate reply.
|
|
887
|
+
* @returns True if status, selected headers and chunk lengths are valid; false otherwise.
|
|
888
|
+
*/
|
|
889
|
+
export declare function isStudyExchangeReply(value: unknown): value is StudyExchangeReply;
|
|
890
|
+
|
|
891
|
+
/** Checks whether a sidecar row has exactly its declared fields and verified byte identities.
|
|
892
|
+
* @param value - The candidate row.
|
|
893
|
+
* @returns True if the row belongs to the closed sidecar grammar; false otherwise.
|
|
894
|
+
*/
|
|
895
|
+
export declare function isStudyExchangeRow(value: unknown): value is StudyExchangeRow;
|
|
896
|
+
|
|
660
897
|
/** Checks the complete transport envelope before domain handling.
|
|
661
898
|
* @param value - Native IPC decoded value.
|
|
662
899
|
* @returns True if the envelope is bounded in shape and JSON-compatible; false otherwise.
|
|
@@ -669,12 +906,42 @@ export declare function isStudyFrame(value: unknown): value is StudyFrame;
|
|
|
669
906
|
*/
|
|
670
907
|
export declare function isStudyIdentity(value: unknown): value is StudyIdentity;
|
|
671
908
|
|
|
909
|
+
/** Checks whether a value declares independent positive metadata allowances.
|
|
910
|
+
* @param value - The untrusted metadata declaration.
|
|
911
|
+
* @returns True if the declaration has positive safe calls and bytes and finite duration; false otherwise.
|
|
912
|
+
*/
|
|
913
|
+
export declare function isStudyOllamaMetadata(value: unknown): value is StudyOllamaMetadata;
|
|
914
|
+
|
|
915
|
+
/** Checks whether a value pins a served model name and SHA-256 digest.
|
|
916
|
+
* @param value - The untrusted model pin.
|
|
917
|
+
* @returns True if the value declares a nonempty name and lowercase SHA-256 digest; false otherwise.
|
|
918
|
+
*/
|
|
919
|
+
export declare function isStudyOllamaModel(value: unknown): value is StudyOllamaModel;
|
|
920
|
+
|
|
921
|
+
/** Checks whether a value declares a complete finite model-generation policy.
|
|
922
|
+
* @param value - The untrusted role policy.
|
|
923
|
+
* @returns True if every policy member and output allowance is valid; false otherwise.
|
|
924
|
+
*/
|
|
925
|
+
export declare function isStudyOllamaPolicy(value: unknown): value is StudyOllamaPolicy;
|
|
926
|
+
|
|
927
|
+
/** Checks whether a value declares exclusive exact or capture admission with a valid receipt.
|
|
928
|
+
* @param value - The untrusted ordered step.
|
|
929
|
+
* @returns True if identity, policy, admission shape and exact receipt are valid; false otherwise.
|
|
930
|
+
*/
|
|
931
|
+
export declare function isStudyOllamaStep(value: unknown): value is StudyOllamaStep;
|
|
932
|
+
|
|
672
933
|
/** Checks operational failure attribution arriving over IPC.
|
|
673
934
|
* @param value - Decoded failure value.
|
|
674
935
|
* @returns True if the failure carries a known cause, an optional role, and an optional stop that satisfies `isStudyStop` on a `capacity` or `deadline` cause; false otherwise.
|
|
675
936
|
*/
|
|
676
937
|
export declare function isStudyProcessFailure(value: unknown): value is StudyFailure;
|
|
677
938
|
|
|
939
|
+
/** Checks whether replay explicitly selects a sealed directory and per-trial prefix counts.
|
|
940
|
+
* @param value - The decoded replay selection.
|
|
941
|
+
* @returns True if result, offline and every prefix are declared; false otherwise.
|
|
942
|
+
*/
|
|
943
|
+
export declare function isStudyReplaySelection(value: unknown): value is StudyOllamaReplaySelection;
|
|
944
|
+
|
|
678
945
|
/** Checks a fresh trial's declared identifiers.
|
|
679
946
|
* @param value - Decoded trial.
|
|
680
947
|
* @returns True if every identifier and repetition is valid; false otherwise.
|
|
@@ -687,6 +954,29 @@ export declare function isStudyTrial(value: unknown): value is StudyTrial;
|
|
|
687
954
|
*/
|
|
688
955
|
export declare function iterateArtifactEntries(handle: Dir): Generator<Dirent, void>;
|
|
689
956
|
|
|
957
|
+
/** Checks whether a portable segment identifies credentials.
|
|
958
|
+
* @param value - One untrusted path segment.
|
|
959
|
+
* @returns True if the segment has a credential filename; false otherwise.
|
|
960
|
+
*/
|
|
961
|
+
export declare function matchesArtifactCredential(value: string): boolean;
|
|
962
|
+
|
|
963
|
+
/** Reports whether a caught value is a Node error carrying the given system code.
|
|
964
|
+
* @remarks Requires an `Error` from this realm. Structured cloning, such as a worker's `postMessage`,
|
|
965
|
+
* drops a Node error's system code, so the cloned error does not match.
|
|
966
|
+
* @param value - The caught value.
|
|
967
|
+
* @param code - The system error code to match.
|
|
968
|
+
* @returns True if the value is an Error from this realm carrying the code; false otherwise.
|
|
969
|
+
* @example Match a system error
|
|
970
|
+
* ```ts
|
|
971
|
+
* import { matchesSystemError } from '@orkestrel/study/server'
|
|
972
|
+
*
|
|
973
|
+
* const error = Object.assign(new Error('Missing declaration'), { code: 'ENOENT' })
|
|
974
|
+
* matchesSystemError(error, 'ENOENT') // true
|
|
975
|
+
* matchesSystemError({ code: 'ENOENT' }, 'ENOENT') // false
|
|
976
|
+
* ```
|
|
977
|
+
*/
|
|
978
|
+
export declare function matchesSystemError(value: unknown, code: string): boolean;
|
|
979
|
+
|
|
690
980
|
/** Parses public command tokens with operation-specific grammar diagnostics.
|
|
691
981
|
* @param arguments_ - Exact command tokens, after the CLI help boundary.
|
|
692
982
|
* @returns The independent operation request.
|
|
@@ -700,6 +990,12 @@ export declare function iterateArtifactEntries(handle: Dir): Generator<Dirent, v
|
|
|
700
990
|
*/
|
|
701
991
|
export declare function parseStudyArguments(arguments_: readonly string[]): StudyCommandRequest;
|
|
702
992
|
|
|
993
|
+
/** Projects only the repeated identity fields of a retained HTTP exchange.
|
|
994
|
+
* @param identity - The row whose body and lifecycle fields are omitted.
|
|
995
|
+
* @returns The identity repeated by its attempt and terminal.
|
|
996
|
+
*/
|
|
997
|
+
export declare function projectStudyExchangeIdentity(identity: StudyExchangeIdentity): StudyExchangeIdentity;
|
|
998
|
+
|
|
703
999
|
/** Reads a bounded regular file only through its canonical absolute path.
|
|
704
1000
|
* @param path - The absolute path to inspect.
|
|
705
1001
|
* @param maximum - The remaining capture budget; Default: 16 MiB.
|
|
@@ -716,6 +1012,13 @@ export declare function readArtifact(path: string, maximum?: number): ArtifactSo
|
|
|
716
1012
|
*/
|
|
717
1013
|
export declare function readArtifactBytes(descriptor: number, target: Buffer, offset?: number): Buffer;
|
|
718
1014
|
|
|
1015
|
+
/** Checks every existing physical ancestor before using a canonical absolute path.
|
|
1016
|
+
* @param path - The existing absolute file or directory.
|
|
1017
|
+
* @returns Its physical filesystem metadata.
|
|
1018
|
+
* @throws ArtifactError - Thrown for traversal, unsafe names, aliases or redirects before reading bytes.
|
|
1019
|
+
*/
|
|
1020
|
+
export declare function readArtifactPhysical(path: string): BigIntStats;
|
|
1021
|
+
|
|
719
1022
|
/** Reads a complete adapter from an admitted module namespace.
|
|
720
1023
|
* @param namespace - The captured consumer module.
|
|
721
1024
|
* @returns The validated adapter instance.
|
|
@@ -741,6 +1044,23 @@ export declare function readStudyAgentMessages(value: unknown): readonly JSONVal
|
|
|
741
1044
|
*/
|
|
742
1045
|
export declare function readStudyAgentResult(stream: AsyncGenerator<ProviderDelta, ProviderResult>): Promise<ProviderResult>;
|
|
743
1046
|
|
|
1047
|
+
/**
|
|
1048
|
+
* Reads an Agent tool call into a validated envelope from one read of each foreign field.
|
|
1049
|
+
* @remarks The returned envelope owns its fields; arguments retain their original record identity.
|
|
1050
|
+
* JSON validation and copying belong to the executed-result projection.
|
|
1051
|
+
* @param call - The call received from the admitted Agent
|
|
1052
|
+
* @returns A fresh ToolCall envelope with the original arguments record
|
|
1053
|
+
* @throws StudyError - Thrown with code `FAULT` when a field cannot be read or the envelope is malformed
|
|
1054
|
+
* @example Read an Agent tool call
|
|
1055
|
+
* ```ts
|
|
1056
|
+
* import { readStudyAgentToolCall } from '@orkestrel/study/server'
|
|
1057
|
+
*
|
|
1058
|
+
* const call = readStudyAgentToolCall({ id: 'c1', name: 'write', arguments: { path: 'note.txt' } })
|
|
1059
|
+
* // { id: 'c1', name: 'write', arguments: { path: 'note.txt' } }
|
|
1060
|
+
* ```
|
|
1061
|
+
*/
|
|
1062
|
+
export declare function readStudyAgentToolCall(call: unknown): ToolCall;
|
|
1063
|
+
|
|
744
1064
|
/**
|
|
745
1065
|
* Reads bounded regular-file bytes without following a symbolic link.
|
|
746
1066
|
* @param path - The custody file path
|
|
@@ -754,6 +1074,60 @@ export declare function readStudyAgentResult(stream: AsyncGenerator<ProviderDelt
|
|
|
754
1074
|
*/
|
|
755
1075
|
export declare function readStudyBytes(path: string, limit: number): Promise<Uint8Array>;
|
|
756
1076
|
|
|
1077
|
+
/** Reads and independently verifies an exclusively published closure.
|
|
1078
|
+
* @param directory - The canonical closure destination.
|
|
1079
|
+
* @returns The verified publication and its copied physical forest.
|
|
1080
|
+
* @throws StudyError - Thrown when publication or its command inputs are invalid.
|
|
1081
|
+
*/
|
|
1082
|
+
export declare function readStudyClosure(directory: string): StudyClosure;
|
|
1083
|
+
|
|
1084
|
+
/** Reads a study declaration, its driver's scenarios, and its rubric as the command resolves them.
|
|
1085
|
+
* @param root - The consumer root containing the studies directory.
|
|
1086
|
+
* @param study - The selected study name.
|
|
1087
|
+
* @param signal - Optional cancellation checked between scenario reads.
|
|
1088
|
+
* @returns The parsed declaration, driver bundle, ordered scenarios, fixtures, and selected rubric.
|
|
1089
|
+
* @throws StudyError - Thrown when declarations are missing, invalid, or incompatible.
|
|
1090
|
+
* @example Read a study declaration
|
|
1091
|
+
* ```ts
|
|
1092
|
+
* import type { StudyDeclaration } from '@orkestrel/study/server'
|
|
1093
|
+
* import { readStudyDeclaration } from '@orkestrel/study/server'
|
|
1094
|
+
*
|
|
1095
|
+
* declare const root: string
|
|
1096
|
+
* const declaration: StudyDeclaration = await readStudyDeclaration(root, 'assessment')
|
|
1097
|
+
* ```
|
|
1098
|
+
*/
|
|
1099
|
+
export declare function readStudyDeclaration(root: string, study: string, signal?: AbortSignal): Promise<StudyDeclaration>;
|
|
1100
|
+
|
|
1101
|
+
/** Reads one declaration file and refuses a missing or linked path with its root-relative path.
|
|
1102
|
+
* @param root - The consumer root used to describe a missing or linked declaration.
|
|
1103
|
+
* @param path - The already resolved and contained declaration path.
|
|
1104
|
+
* @returns The exact declaration bytes under the custody metadata allowance.
|
|
1105
|
+
* @throws StudyError - Thrown with code `CONFIG` when the path is missing or linked; other custody refusals retain their codes.
|
|
1106
|
+
* @example Read declaration bytes
|
|
1107
|
+
* ```ts
|
|
1108
|
+
* import { readStudyDeclarationBytes } from '@orkestrel/study/server'
|
|
1109
|
+
*
|
|
1110
|
+
* declare const root: string
|
|
1111
|
+
* declare const path: string
|
|
1112
|
+
* await readStudyDeclarationBytes(root, path)
|
|
1113
|
+
* ```
|
|
1114
|
+
*/
|
|
1115
|
+
export declare function readStudyDeclarationBytes(root: string, path: string): Promise<Uint8Array>;
|
|
1116
|
+
|
|
1117
|
+
/** Reads strict complete LF-framed exchange rows with verified bodies and declaration joins.
|
|
1118
|
+
* @param bytes - The bounded retained sidecar bytes.
|
|
1119
|
+
* @param complete - If true, requires completion; if false, admits a verified unfinished prefix.
|
|
1120
|
+
* @returns Owned rows in physical order.
|
|
1121
|
+
*/
|
|
1122
|
+
export declare function readStudyExchangeRows(bytes: Uint8Array, complete?: boolean): readonly StudyExchangeRow[];
|
|
1123
|
+
|
|
1124
|
+
/** Reads a sealed trial's exact complete exchange history after reverifying its entire result.
|
|
1125
|
+
* @param result - The sealed execution selected for replay.
|
|
1126
|
+
* @param trial - The scheduled trial id.
|
|
1127
|
+
* @returns Complete ordered request and response pairs with their verified file and seal identities.
|
|
1128
|
+
*/
|
|
1129
|
+
export declare function readStudyExchanges(result: StudySealedResult, trial: string): Promise<StudyExchangeHistory>;
|
|
1130
|
+
|
|
757
1131
|
/**
|
|
758
1132
|
* Reads from an open file handle into a buffer until the buffer is full or the file ends.
|
|
759
1133
|
* @param handle - The open file handle to read
|
|
@@ -825,6 +1199,28 @@ export declare function readStudyOllamaTerminal(value: unknown, request: StudyOl
|
|
|
825
1199
|
*/
|
|
826
1200
|
export declare function readStudyOllamaTiming(extract: StudyOllamaTransportOptions['timing'], record: Readonly<Record<string, unknown>>): OllamaTiming | undefined;
|
|
827
1201
|
|
|
1202
|
+
/** Validates parent preparation output without permitting a destination or allowance substitution.
|
|
1203
|
+
* @param original - The parent-reserved destination, or undefined without recording.
|
|
1204
|
+
* @param prepared - The callback's retained destination.
|
|
1205
|
+
* @returns The validated destination for the worker.
|
|
1206
|
+
*/
|
|
1207
|
+
export declare function readStudyPreparedDestination(original: StudyExchangeDestination | undefined, prepared: StudyExchangeDestination | undefined): StudyExchangeDestination | undefined;
|
|
1208
|
+
|
|
1209
|
+
/** Reads the executing profile's explicit recording declarations before a worker starts.
|
|
1210
|
+
* @param profile - The validated executing profile.
|
|
1211
|
+
* @param trial - The scheduled trial identity.
|
|
1212
|
+
* @returns A validated opening row, with no inferred metadata or replay allowance.
|
|
1213
|
+
*/
|
|
1214
|
+
export declare function readStudyRecordingDeclaration(profile: StudyProfile, trial: StudyTrial): StudyExchangeDeclaration;
|
|
1215
|
+
|
|
1216
|
+
/** Rechecks the sealed source and this trial's prefix under the executing profile declaration.
|
|
1217
|
+
* @param selection - The explicit sealed source and offline behavior.
|
|
1218
|
+
* @param profile - The executing profile, whose bounds remain authoritative.
|
|
1219
|
+
* @param trial - The trial whose history must be present.
|
|
1220
|
+
* @returns Complete verified history before any dependent sender or worker starts.
|
|
1221
|
+
*/
|
|
1222
|
+
export declare function readStudyReplayHistory(selection: StudyOllamaReplaySelection, profile: StudyProfile, trial: StudyTrial): Promise<StudyExchangeHistory>;
|
|
1223
|
+
|
|
828
1224
|
/**
|
|
829
1225
|
* Inspects custody bytes offline and verifies complete execution before grading.
|
|
830
1226
|
* @param directory - The result directory
|
|
@@ -837,6 +1233,37 @@ export declare function readStudyOllamaTiming(extract: StudyOllamaTransportOptio
|
|
|
837
1233
|
*/
|
|
838
1234
|
export declare function readStudyResult(directory: string): Promise<StudyResultReading>;
|
|
839
1235
|
|
|
1236
|
+
/** Reads and joins a complete trial sidecar before or after sealing.
|
|
1237
|
+
* @param directory - The result directory.
|
|
1238
|
+
* @param manifest - The verified manifest declaring recording and bounds.
|
|
1239
|
+
* @param trial - The exact scheduled trial id.
|
|
1240
|
+
* @param file - The inventory identity read for this sidecar.
|
|
1241
|
+
* @returns Complete rows after byte, declaration and evidence joins.
|
|
1242
|
+
*/
|
|
1243
|
+
export declare function readStudyTrialExchanges(directory: string, manifest: StudyManifest, trial: string, file: StudyFile): Promise<readonly StudyExchangeRow[]>;
|
|
1244
|
+
|
|
1245
|
+
/** Reads the version of the study package that owns an executable entry.
|
|
1246
|
+
* @param entry - The installed runtime's executable entry.
|
|
1247
|
+
* @returns The non-empty version declared by the owning study package.
|
|
1248
|
+
* @throws StudyError - Thrown when no study package owns the entry or its version is absent or empty.
|
|
1249
|
+
* @example Read the installed version
|
|
1250
|
+
* ```ts
|
|
1251
|
+
* import { readStudyVersion } from '@orkestrel/study/server'
|
|
1252
|
+
*
|
|
1253
|
+
* declare const entry: string
|
|
1254
|
+
* readStudyVersion(entry)
|
|
1255
|
+
* ```
|
|
1256
|
+
*/
|
|
1257
|
+
export declare function readStudyVersion(entry: string): string;
|
|
1258
|
+
|
|
1259
|
+
/** Relocates an original path through a closure's retained physical forest.
|
|
1260
|
+
* @param closure - The verified closure record.
|
|
1261
|
+
* @param path - An original member or ancestor within its forest.
|
|
1262
|
+
* @returns The corresponding destination path.
|
|
1263
|
+
* @throws ArtifactError - Thrown when provenance or containment is inconsistent.
|
|
1264
|
+
*/
|
|
1265
|
+
export declare function relocateArtifactPath(closure: ArtifactClosure, path: string): string;
|
|
1266
|
+
|
|
840
1267
|
/** Enforces captured inventory membership at every synchronous native import edge. */
|
|
841
1268
|
export declare class Resolution {
|
|
842
1269
|
#private;
|
|
@@ -860,6 +1287,21 @@ export declare class Resolution {
|
|
|
860
1287
|
load(href: string, context: LoadHookContext, next: ArtifactLoadHandler): LoadFnOutput;
|
|
861
1288
|
}
|
|
862
1289
|
|
|
1290
|
+
/** Finds the common physical parent that preserves every selected path's relative resolution.
|
|
1291
|
+
* @param paths - Existing absolute members or selected roots on one volume.
|
|
1292
|
+
* @returns Their common ancestor directory.
|
|
1293
|
+
* @throws ArtifactError - Thrown when selections span volumes or contain no files.
|
|
1294
|
+
*/
|
|
1295
|
+
export declare function resolveArtifactBase(paths: readonly string[]): string;
|
|
1296
|
+
|
|
1297
|
+
/** Resolves a portable member key without traversing outside its destination.
|
|
1298
|
+
* @param destination - The canonical absolute destination.
|
|
1299
|
+
* @param key - The slash-separated member key.
|
|
1300
|
+
* @returns The contained host path.
|
|
1301
|
+
* @throws ArtifactError - Thrown for traversal or an unsafe name.
|
|
1302
|
+
*/
|
|
1303
|
+
export declare function resolveArtifactMember(destination: string, key: string): string;
|
|
1304
|
+
|
|
863
1305
|
/**
|
|
864
1306
|
* Resolves the content a scripted response serves, from its declaration or from a prior tool message.
|
|
865
1307
|
* @param request - The projected actual request messages
|
|
@@ -869,6 +1311,14 @@ export declare class Resolution {
|
|
|
869
1311
|
*/
|
|
870
1312
|
export declare function resolveStudyAgentContent(request: readonly JSONValue[], response: StudyAgentResponse): string;
|
|
871
1313
|
|
|
1314
|
+
/** Resolves a profile path through a retained physical relocation when selected.
|
|
1315
|
+
* @param root - The active consumer root.
|
|
1316
|
+
* @param path - The profile's absolute or consumer-relative selection.
|
|
1317
|
+
* @param closure - The optional verified physical forest.
|
|
1318
|
+
* @returns The active canonical selection.
|
|
1319
|
+
*/
|
|
1320
|
+
export declare function resolveStudyClosurePath(root: string, path: string, closure?: ArtifactClosure): string;
|
|
1321
|
+
|
|
872
1322
|
/** Resolves the actual host package from its trusted executable entry.
|
|
873
1323
|
* @param entry - The runtime's own executable, never a consumer-supplied module.
|
|
874
1324
|
* @returns The canonical study package root.
|
|
@@ -892,13 +1342,14 @@ export declare function resolveStudyPath(directory: string, path: string): strin
|
|
|
892
1342
|
* Resolves the execution profile's caller-selected built artifact paths.
|
|
893
1343
|
* @param root - The repository root
|
|
894
1344
|
* @param profile - The validated source profile
|
|
1345
|
+
* @param closure - The optional verified physical forest used to relocate executable selections
|
|
895
1346
|
* @returns The reproducible resolved execution profile
|
|
896
1347
|
* @example
|
|
897
1348
|
* ```ts
|
|
898
1349
|
* resolveStudyProfile(root, profile)
|
|
899
1350
|
* ```
|
|
900
1351
|
*/
|
|
901
|
-
export declare function resolveStudyProfile(root: string, profile: StudyProfile): StudyProfile;
|
|
1352
|
+
export declare function resolveStudyProfile(root: string, profile: StudyProfile, closure?: ArtifactClosure): StudyProfile;
|
|
902
1353
|
|
|
903
1354
|
/**
|
|
904
1355
|
* Scans regular execution files while refusing unknown directories and linked paths.
|
|
@@ -922,7 +1373,7 @@ export declare function scanStudyExecution(directory: string, manifest: StudyMan
|
|
|
922
1373
|
* @returns The admitted files in read order: this directory's files, then each admitted subdirectory's, last listed first
|
|
923
1374
|
* @throws StudyError - Thrown when the tree holds a link, an unknown directory or file, or a file beyond the remaining allowance
|
|
924
1375
|
*/
|
|
925
|
-
export declare function scanStudyTree(directory: string, prefix: string, known: ReadonlySet<string>, allowance: number): Promise<readonly StudyFile[]>;
|
|
1376
|
+
export declare function scanStudyTree(directory: string, prefix: string, known: ReadonlySet<string>, allowance: number, recording?: boolean): Promise<readonly StudyFile[]>;
|
|
926
1377
|
|
|
927
1378
|
/** Caps declared execution duration at the native supervisor's host ceiling. */
|
|
928
1379
|
export declare const STUDY_COMMAND_DURATION = 86400000;
|
|
@@ -931,7 +1382,7 @@ export declare const STUDY_COMMAND_DURATION = 86400000;
|
|
|
931
1382
|
export declare const STUDY_COMMAND_GRADER = "consumer-adapter";
|
|
932
1383
|
|
|
933
1384
|
/** Defines the complete public CLI reference shared by help and grammar diagnostics. */
|
|
934
|
-
export declare const STUDY_COMMAND_HELP = "study check <study> [--profile <name>]\nstudy execute <study> [--profile <name>] [--out <path>] [--expected <sha256>]\nstudy grade <result> --rubric <path>\nstudy label <result> --grading <sha256> --labels <path>\nstudy report <result> --grading <sha256>\nstudy --help\n\nProfiles default to local. Flags require values and may appear only once.\nResults default to tmp/studies/<result>; scratch also uses tmp/studies.\nA result is its id under tmp/studies, a root-relative path, or an absolute path.\nRelative paths, including --out, must stay inside the consumer working directory.\nOutput directories must be new; existing results are never overwritten.\n--expected pins the fingerprint returned by check. --grading selects an exact grading.\n--rubric selects independent criteria. --labels imports caller-supplied semantic labels.\nSuccess writes one JSON document; next contains suggested argv, never executed automatically.\ncheck, grade, label and report have a fixed allowance of 60 seconds.\nexecute checks first, then uses the declared series duration plus 15 seconds for cleanup.\nExit codes: 0 success, 64 invalid input, 124 deadline, 130 interruption, 1 operational failure.\n";
|
|
1385
|
+
export declare const STUDY_COMMAND_HELP = "study check <study> [--profile <name>] [--closure <directory>]\nstudy freeze <study> --profile <name> --to <directory>\nstudy execute <study> [--profile <name>] [--out <path>] [--expected <sha256>] [--closure <directory>] [--replay <result> --prefix <JSON trial counts> --offline <true|false>]\nstudy grade <result> --rubric <path>\nstudy label <result> --grading <sha256> --labels <path>\nstudy report <result> --grading <sha256>\nstudy --help\nstudy --version\n\nProfiles default to local; freeze requires --profile. Flags require values and may appear only once.\nResults default to tmp/studies/<result>; scratch also uses tmp/studies.\nA result is its id under tmp/studies, a root-relative path, or an absolute path.\nRelative paths, including --out, must stay inside the consumer working directory.\nOutput directories must be new; existing results are never overwritten.\n--expected pins the fingerprint returned by check. --grading selects an exact grading.\n--rubric selects independent criteria. --labels imports caller-supplied semantic labels.\n--closure selects retained artifacts. Replay requires explicit prefix counts and offline behavior.\nSuccess writes one JSON document; next contains suggested argv, never executed automatically.\ncheck, freeze, grade, label and report have a fixed allowance of 60 seconds.\nexecute checks first, then uses the declared series duration plus 15 seconds for cleanup.\nExit codes: 0 success, 64 invalid input, 124 deadline, 130 interruption, 1 operational failure.\n";
|
|
935
1386
|
|
|
936
1387
|
/** Names the command route beneath the native supervisor. */
|
|
937
1388
|
export declare const STUDY_COMMAND_OPERATION = "study-command";
|
|
@@ -1010,21 +1461,6 @@ export declare interface StudyAdjudication {
|
|
|
1010
1461
|
readonly evidence: Readonly<Record<string, readonly StudyEvidence[]>>;
|
|
1011
1462
|
}
|
|
1012
1463
|
|
|
1013
|
-
/** Admits requests against enclosing limits before an adapter dispatches them. */
|
|
1014
|
-
declare interface StudyAdmissionInterface {
|
|
1015
|
-
readonly signal: AbortSignal;
|
|
1016
|
-
readonly usage: readonly StudyUsage[];
|
|
1017
|
-
/** Resolves admission before dispatch; local meters may return the ticket synchronously. */
|
|
1018
|
-
admit(charge: StudyCharge): StudyTicket | Promise<StudyTicket>;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
/** Holds the trial-local canonical dispatch identity a wire request joins to. */
|
|
1022
|
-
declare interface StudyAgentDispatch {
|
|
1023
|
-
readonly id: number;
|
|
1024
|
-
/** Holds the SHA-256 revision of the canonical request, or undefined when it could not be rendered. */
|
|
1025
|
-
readonly revision: string | undefined;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
1464
|
/** Joins each message of a measured request to its origin, one JSON entry per message in order. */
|
|
1029
1465
|
export declare type StudyAgentOriginHandler = (messages: readonly Message[]) => JSONValue;
|
|
1030
1466
|
|
|
@@ -1036,14 +1472,6 @@ export declare interface StudyAgentPlan {
|
|
|
1036
1472
|
readonly workload: AbortController;
|
|
1037
1473
|
}
|
|
1038
1474
|
|
|
1039
|
-
/** Holds one dispatched request's explicit size reading. */
|
|
1040
|
-
declare interface StudyAgentReading {
|
|
1041
|
-
/** Holds the runtime's estimate of the complete pre-encoding request. */
|
|
1042
|
-
readonly estimate: number;
|
|
1043
|
-
/** Holds the gauge projection of that estimate; undefined when no gauge applies. */
|
|
1044
|
-
readonly projected: number | undefined;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
1475
|
/**
|
|
1048
1476
|
* Declares one scripted reply.
|
|
1049
1477
|
* @remarks
|
|
@@ -1067,19 +1495,6 @@ export declare interface StudyAgentResponse {
|
|
|
1067
1495
|
/** Names the model responsibilities whose requests the trace and summary measure. */
|
|
1068
1496
|
export declare type StudyAgentRole = Extract<StudyRole, 'agent' | 'summary'>;
|
|
1069
1497
|
|
|
1070
|
-
/**
|
|
1071
|
-
* Holds the admitted Agent namespace capabilities the shared instrumentation invokes.
|
|
1072
|
-
* @remarks
|
|
1073
|
-
* Each member has the exact signature of the export of the same name in the selected Agent
|
|
1074
|
-
* runtime. The consumer supplies the admitted namespace; the instrumentation never imports a
|
|
1075
|
-
* runtime value from an installed Agent copy. No Ledger capability is required.
|
|
1076
|
-
*/
|
|
1077
|
-
declare interface StudyAgentRuntime {
|
|
1078
|
-
readonly estimateRequest: typeof estimateRequest;
|
|
1079
|
-
readonly measureRequest: typeof measureRequest;
|
|
1080
|
-
readonly isAgentError: typeof isAgentError;
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
1498
|
/** Serves declared inert responses through the actual Agent provider boundary. */
|
|
1084
1499
|
export declare class StudyAgentScript implements ProviderInterface {
|
|
1085
1500
|
#private;
|
|
@@ -1302,6 +1717,8 @@ export declare interface StudyArtifactLoaderOptions {
|
|
|
1302
1717
|
readonly root: string;
|
|
1303
1718
|
readonly profile: StudyProfile;
|
|
1304
1719
|
readonly adapter: string;
|
|
1720
|
+
/** Selects relocated captured bytes and their checked identity instead of original paths. */
|
|
1721
|
+
readonly closure?: StudyClosure;
|
|
1305
1722
|
}
|
|
1306
1723
|
|
|
1307
1724
|
/** Holds actual namespaces loaded only during worker execution. */
|
|
@@ -1311,16 +1728,6 @@ export declare interface StudyArtifactModule {
|
|
|
1311
1728
|
readonly provider: unknown;
|
|
1312
1729
|
}
|
|
1313
1730
|
|
|
1314
|
-
/** Holds a terminal trial record, including goals never dispatched. */
|
|
1315
|
-
declare interface StudyAttempt {
|
|
1316
|
-
readonly trial: StudyTrial;
|
|
1317
|
-
readonly observations: readonly StudyObservation[];
|
|
1318
|
-
readonly failure: StudyFailure | undefined;
|
|
1319
|
-
readonly duration: number;
|
|
1320
|
-
/** Records whether the trial entered execution without an inherited terminal series failure, including failures before the driver opened; not a claim that the driver was opened. */
|
|
1321
|
-
readonly executed: boolean;
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
1731
|
/**
|
|
1325
1732
|
* Holds one failed record the report groups by cause, role, and layer.
|
|
1326
1733
|
* @remarks
|
|
@@ -1334,22 +1741,6 @@ export declare interface StudyAttributionSource {
|
|
|
1334
1741
|
readonly executed: boolean;
|
|
1335
1742
|
}
|
|
1336
1743
|
|
|
1337
|
-
/** Holds nested execution allowances; each request also has a deadline. */
|
|
1338
|
-
declare interface StudyBounds {
|
|
1339
|
-
readonly request: StudyLimit;
|
|
1340
|
-
readonly goal: StudyLimit;
|
|
1341
|
-
readonly trial: StudyLimit;
|
|
1342
|
-
readonly series: StudyLimit;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* Names an operational ending separately from task achievement.
|
|
1347
|
-
* @remarks
|
|
1348
|
-
* `content` means a request completed but its consumer refused the content as unusable. It
|
|
1349
|
-
* claims no model or decoder cause and grades no semantic quality.
|
|
1350
|
-
*/
|
|
1351
|
-
declare type StudyCause = 'capacity' | 'infrastructure' | 'deadline' | 'interrupted' | 'content';
|
|
1352
|
-
|
|
1353
1744
|
/** Correlates bounded IPC work and rejects every outstanding request on transport failure. */
|
|
1354
1745
|
export declare class StudyChannel {
|
|
1355
1746
|
#private;
|
|
@@ -1381,13 +1772,6 @@ export declare interface StudyChannelOptions {
|
|
|
1381
1772
|
readonly abort: (value: JSONValue) => void;
|
|
1382
1773
|
}
|
|
1383
1774
|
|
|
1384
|
-
/** Holds a request's pre-dispatch upper bounds. */
|
|
1385
|
-
declare interface StudyCharge {
|
|
1386
|
-
readonly role: StudyRole;
|
|
1387
|
-
readonly tokens: number;
|
|
1388
|
-
readonly bytes: number;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
1775
|
/** Dispatches private child routes before the public native supervisor. */
|
|
1392
1776
|
export declare class StudyCLI {
|
|
1393
1777
|
#private;
|
|
@@ -1402,6 +1786,26 @@ export declare class StudyCLI {
|
|
|
1402
1786
|
execute(arguments_: readonly string[]): Promise<number>;
|
|
1403
1787
|
}
|
|
1404
1788
|
|
|
1789
|
+
/** Publishes a validated closure with relocated command inputs and execution provenance.
|
|
1790
|
+
* @remarks
|
|
1791
|
+
* Freeze writes this value as closure.json exclusively only after a fresh captured check and
|
|
1792
|
+
* verification of both source and destination. Root and entry are relocated canonical paths;
|
|
1793
|
+
* target and profile retain their command selectors. Source is the pre-copy execution identity,
|
|
1794
|
+
* identity is the checked relocated identity, and fingerprint is the relocated check result.
|
|
1795
|
+
* Closure.json is a publication marker outside the copied-member census, never an admitted
|
|
1796
|
+
* executable or source asset. Its sole permitted presence must not hide any other addition.
|
|
1797
|
+
*/
|
|
1798
|
+
export declare interface StudyClosure {
|
|
1799
|
+
readonly closure: ArtifactClosure;
|
|
1800
|
+
readonly root: string;
|
|
1801
|
+
readonly entry: string;
|
|
1802
|
+
readonly target: string;
|
|
1803
|
+
readonly profile: string;
|
|
1804
|
+
readonly source: StudyIdentity;
|
|
1805
|
+
readonly identity: StudyIdentity;
|
|
1806
|
+
readonly fingerprint: string;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1405
1809
|
/** Executes validated study operations with execution and grading custody kept independent. */
|
|
1406
1810
|
export declare class StudyCommand {
|
|
1407
1811
|
#private;
|
|
@@ -1433,67 +1837,7 @@ export declare interface StudyCommandOptions {
|
|
|
1433
1837
|
}
|
|
1434
1838
|
|
|
1435
1839
|
/** Names the independently dispatched study command operation. */
|
|
1436
|
-
export declare type StudyCommandRequest = StudyExecutionRequest | StudyGradeRequest | StudyLabelRequest | StudyReportRequest;
|
|
1437
|
-
|
|
1438
|
-
/** Holds the resources visible to one running goal. */
|
|
1439
|
-
declare interface StudyContext {
|
|
1440
|
-
readonly signal: AbortSignal;
|
|
1441
|
-
readonly meter: StudyAdmissionInterface;
|
|
1442
|
-
readonly evidence: StudySinkInterface;
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
/** Retains the first operational failure while bounding asynchronous waits. */
|
|
1446
|
-
declare class StudyControl implements StudyControlInterface {
|
|
1447
|
-
#private;
|
|
1448
|
-
/** Links cancellation to the caller without assigning it a task verdict.
|
|
1449
|
-
* @param signal - Optional parent cancellation.
|
|
1450
|
-
*/
|
|
1451
|
-
constructor(signal?: AbortSignal);
|
|
1452
|
-
get signal(): AbortSignal;
|
|
1453
|
-
get failure(): StudyFailure | undefined;
|
|
1454
|
-
/** Latches an operational failure and cancels all linked work.
|
|
1455
|
-
* @param failure - The first attribution to preserve.
|
|
1456
|
-
*/
|
|
1457
|
-
fail(failure: StudyFailure): void;
|
|
1458
|
-
/** Races work against cancellation and removes its listener after either ending.
|
|
1459
|
-
* @param work - Already-started work whose rejection remains observed after cancellation.
|
|
1460
|
-
* @returns The work's result if it settles before cancellation.
|
|
1461
|
-
* @throws Thrown with the retained operational attribution when cancelled.
|
|
1462
|
-
*/
|
|
1463
|
-
wait<T>(work: PromiseLike<T>): Promise<T>;
|
|
1464
|
-
/** Removes the lifecycle listener without changing the retained failure. */
|
|
1465
|
-
close(): void;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
/** Owns the first operational failure and cancellation of enclosing work. */
|
|
1469
|
-
declare interface StudyControlInterface {
|
|
1470
|
-
readonly signal: AbortSignal;
|
|
1471
|
-
readonly failure: StudyFailure | undefined;
|
|
1472
|
-
/** Latches an operational failure and cancels all linked work.
|
|
1473
|
-
* @param failure - The first attribution to preserve.
|
|
1474
|
-
* @returns Nothing after failure propagation.
|
|
1475
|
-
*/
|
|
1476
|
-
fail(failure: StudyFailure): void;
|
|
1477
|
-
/** Races work against cancellation and removes its listener after either ending.
|
|
1478
|
-
* @param work - Work whose late rejection remains observed.
|
|
1479
|
-
* @returns The result when work settles before cancellation.
|
|
1480
|
-
*/
|
|
1481
|
-
wait<T>(work: PromiseLike<T>): Promise<T>;
|
|
1482
|
-
/** Removes the lifecycle listener without changing the retained failure.
|
|
1483
|
-
* @returns Nothing after listener release.
|
|
1484
|
-
*/
|
|
1485
|
-
close(): void;
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
/** Holds a grader-owned criterion outside the driver's public input. */
|
|
1489
|
-
declare interface StudyCriterion {
|
|
1490
|
-
readonly id: string;
|
|
1491
|
-
readonly scenario: string;
|
|
1492
|
-
readonly goal: string;
|
|
1493
|
-
readonly method: 'state' | 'trace' | 'semantic';
|
|
1494
|
-
readonly critical: boolean;
|
|
1495
|
-
readonly assertion: JSONValue;
|
|
1496
|
-
}
|
|
1840
|
+
export declare type StudyCommandRequest = StudyExecutionRequest | StudyFreezeRequest | StudyGradeRequest | StudyLabelRequest | StudyReportRequest;
|
|
1497
1841
|
|
|
1498
1842
|
/** Holds the evidence sink's shared admission budget. */
|
|
1499
1843
|
export declare interface StudyCustodyBudget {
|
|
@@ -1511,28 +1855,85 @@ export declare interface StudyCustodySinkInterface extends StudySinkInterface {
|
|
|
1511
1855
|
close(): Promise<void>;
|
|
1512
1856
|
}
|
|
1513
1857
|
|
|
1514
|
-
/**
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1858
|
+
/** Owns the declared daemon and its serial trial preparation through permanent cleanup.
|
|
1859
|
+
* @example
|
|
1860
|
+
* ```ts
|
|
1861
|
+
* const session = new StudyDaemonSession(options)
|
|
1862
|
+
* try { await session.start() } finally { await session.stop() }
|
|
1863
|
+
* ```
|
|
1864
|
+
*/
|
|
1865
|
+
export declare class StudyDaemonSession {
|
|
1866
|
+
#private;
|
|
1867
|
+
/** Captures resolved declarations without loading the daemon runtime.
|
|
1868
|
+
* @param options - The execution profile, scenarios, workspace, and cancellation.
|
|
1869
|
+
*/
|
|
1870
|
+
constructor(options: StudyDaemonSessionOptions);
|
|
1871
|
+
/** Starts the daemon and returns its verified execution provenance.
|
|
1872
|
+
* @returns The executable, endpoint, owned pid, and model receipt.
|
|
1873
|
+
*/
|
|
1874
|
+
start(): Promise<OllamaDaemonIdentity>;
|
|
1875
|
+
/** Unloads the declared population before opening one trial worker.
|
|
1876
|
+
* @param trial - The scheduled trial.
|
|
1877
|
+
* @param signal - The trial's cancellation.
|
|
1878
|
+
* @param destination - The optional reserved recording destination.
|
|
1879
|
+
* @returns The unchanged destination with its verified maintenance prefix when recording.
|
|
1880
|
+
*/
|
|
1881
|
+
prepare(trial: StudyTrial, signal: AbortSignal, destination?: StudyExchangeDestination): Promise<StudyExchangeDestination | undefined>;
|
|
1882
|
+
/** Stops and joins the owned tree and refuses an unconfirmed cleanup.
|
|
1883
|
+
* @returns Completion after daemon and emitter teardown.
|
|
1884
|
+
*/
|
|
1885
|
+
stop(): Promise<void>;
|
|
1526
1886
|
}
|
|
1527
1887
|
|
|
1528
|
-
/**
|
|
1529
|
-
declare interface
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1888
|
+
/** Supplies the resolved provider, trial population, workspace, and execution cancellation. */
|
|
1889
|
+
export declare interface StudyDaemonSessionOptions {
|
|
1890
|
+
readonly profile: StudyProfile;
|
|
1891
|
+
readonly scenarios: readonly StudyScenario[];
|
|
1892
|
+
readonly workspace: string;
|
|
1893
|
+
readonly signal: AbortSignal;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/** Records one trial's daemon maintenance before handing its verified prefix to a worker.
|
|
1897
|
+
* @example
|
|
1898
|
+
* ```ts
|
|
1899
|
+
* const trial = new StudyDaemonTrial(options)
|
|
1900
|
+
* await trial.execute(daemon)
|
|
1901
|
+
* ```
|
|
1902
|
+
*/
|
|
1903
|
+
export declare class StudyDaemonTrial {
|
|
1904
|
+
#private;
|
|
1905
|
+
/** Owns the declaration and reserved destination for one preparation.
|
|
1906
|
+
* @param options - The immutable trial declaration, destination, and cancellation.
|
|
1534
1907
|
*/
|
|
1535
|
-
|
|
1908
|
+
constructor(options: StudyDaemonTrialOptions);
|
|
1909
|
+
/** Unloads declared models, drains the journal, and returns its exact retained identity.
|
|
1910
|
+
* @remarks The daemon's unload sender must call this instance's fetch method. Startup metadata must forward without recording.
|
|
1911
|
+
* @param daemon - The verified execution-owned daemon.
|
|
1912
|
+
* @returns The original destination with its closed maintenance prefix identity.
|
|
1913
|
+
*/
|
|
1914
|
+
execute(daemon: OllamaDaemonInterface): Promise<StudyExchangeDestination>;
|
|
1915
|
+
/** Retains each request before sending and preserves the sender's native response chunks.
|
|
1916
|
+
* @param input - The daemon's exact HTTP input.
|
|
1917
|
+
* @param init - The daemon's method, body, redirect policy, and cancellation.
|
|
1918
|
+
* @returns An unread response carrying the same body bytes for daemon validation.
|
|
1919
|
+
*/
|
|
1920
|
+
fetch(input: Parameters<typeof globalThis.fetch>[0], init?: RequestInit): Promise<Response>;
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
/** Supplies one reserved sidecar and its complete maintenance declaration. */
|
|
1924
|
+
export declare interface StudyDaemonTrialOptions {
|
|
1925
|
+
readonly destination: StudyExchangeDestination;
|
|
1926
|
+
readonly declaration: StudyExchangeDeclaration;
|
|
1927
|
+
readonly signal: AbortSignal;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
/** Holds a parsed study declaration with its driver bundle, scenarios, scenario fixtures, and rubric. */
|
|
1931
|
+
export declare interface StudyDeclaration {
|
|
1932
|
+
readonly bundle: string;
|
|
1933
|
+
readonly definition: StudyDefinition;
|
|
1934
|
+
readonly scenarios: readonly StudyScenario[];
|
|
1935
|
+
readonly fixtures: readonly StudyCommandArtifact[];
|
|
1936
|
+
readonly rubric: StudyRubric;
|
|
1536
1937
|
}
|
|
1537
1938
|
|
|
1538
1939
|
/** Supplies admitted modules and an exclusive scratch parent without grader truth. */
|
|
@@ -1542,29 +1943,10 @@ export declare interface StudyDriverOptions {
|
|
|
1542
1943
|
readonly provider: unknown;
|
|
1543
1944
|
readonly profile: StudyProfile;
|
|
1544
1945
|
readonly directory: string;
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
/**
|
|
1548
|
-
|
|
1549
|
-
readonly code: StudyErrorCode;
|
|
1550
|
-
readonly failure: StudyFailure | undefined;
|
|
1551
|
-
/**
|
|
1552
|
-
* Records the failing boundary and optional operational attribution.
|
|
1553
|
-
* @param code - The machine-readable boundary
|
|
1554
|
-
* @param message - The specific failure
|
|
1555
|
-
* @param failure - The optional operational reading
|
|
1556
|
-
*/
|
|
1557
|
-
constructor(code: StudyErrorCode, message: string, failure?: StudyFailure);
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
/** Names malformed configuration, evidence, custody and operational failures. */
|
|
1561
|
-
declare type StudyErrorCode = 'CONFIG' | 'EVIDENCE' | 'CUSTODY' | 'CAPACITY' | 'FAULT' | 'DEADLINE';
|
|
1562
|
-
|
|
1563
|
-
/** Holds append-only domain evidence in a JSON-compatible form. */
|
|
1564
|
-
declare interface StudyEvidence {
|
|
1565
|
-
readonly event: string;
|
|
1566
|
-
readonly goal: string;
|
|
1567
|
-
readonly value: JSONValue;
|
|
1946
|
+
/** Supplies the worker-owned sidecar sink whenever the profile declares recording. */
|
|
1947
|
+
readonly exchanges?: StudyExchangeSinkInterface;
|
|
1948
|
+
/** Supplies verified replay whose fetch is passed to the transport inside this worker. */
|
|
1949
|
+
readonly replay?: StudyOllamaReplayInterface;
|
|
1568
1950
|
}
|
|
1569
1951
|
|
|
1570
1952
|
/** Retains admitted evidence in order and closes admission before terminal records. */
|
|
@@ -1598,6 +1980,183 @@ export declare interface StudyEvidenceSinkOptions {
|
|
|
1598
1980
|
readonly budget: StudyCustodyBudget;
|
|
1599
1981
|
}
|
|
1600
1982
|
|
|
1983
|
+
/** Retains admitted request bytes durably before the corresponding send begins. */
|
|
1984
|
+
export declare interface StudyExchangeAttempt extends StudyExchangeIdentity, StudyExchangeBytes {
|
|
1985
|
+
readonly phase: 'attempt';
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
/** Retains an application HTTP body's exact bytes independently of text decoding.
|
|
1989
|
+
* @remarks
|
|
1990
|
+
* Body is canonical base64, digest is lowercase SHA-256 of decoded bytes, and size is their safe
|
|
1991
|
+
* byte count. An empty body has size zero and the digest of empty bytes. This representation
|
|
1992
|
+
* retains no TLS records or HTTP transfer framing.
|
|
1993
|
+
*/
|
|
1994
|
+
export declare interface StudyExchangeBytes {
|
|
1995
|
+
readonly body: string;
|
|
1996
|
+
readonly digest: string;
|
|
1997
|
+
readonly size: number;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
/** Closes a sidecar after the declared procedure and postflight have fully completed.
|
|
2001
|
+
* @remarks
|
|
2002
|
+
* Count equals the complete HTTP exchange population. This final row is forbidden after a
|
|
2003
|
+
* failed attempt, while a request or append is pending, or before all declared steps and both
|
|
2004
|
+
* verification passes finish. The strict reader joins it to evidence before sealing.
|
|
2005
|
+
*/
|
|
2006
|
+
export declare interface StudyExchangeCompletion {
|
|
2007
|
+
readonly phase: 'complete';
|
|
2008
|
+
readonly count: number;
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
/** Declares the complete trial procedure before any exchange attempt is appended.
|
|
2012
|
+
* @remarks
|
|
2013
|
+
* This is the first sidecar row. Version and models pin both verification passes. Procedure
|
|
2014
|
+
* contains every model step in order. Metadata declares an independent budget. Maintenance
|
|
2015
|
+
* declares each model to unload before preflight; it is empty when no daemon is owned.
|
|
2016
|
+
* Preflight and postflight each require version, tags, and one show per distinct model, in
|
|
2017
|
+
* that order. No model attempt precedes preflight or follows postflight.
|
|
2018
|
+
*/
|
|
2019
|
+
export declare interface StudyExchangeDeclaration {
|
|
2020
|
+
readonly phase: 'declaration';
|
|
2021
|
+
readonly trial: string;
|
|
2022
|
+
readonly version: string;
|
|
2023
|
+
readonly models: Readonly<Record<string, StudyOllamaModel>>;
|
|
2024
|
+
readonly metadata: StudyOllamaMetadata;
|
|
2025
|
+
readonly procedure: readonly StudyOllamaStep[];
|
|
2026
|
+
readonly maintenance: readonly StudyOllamaModel[];
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
/** Holds the parent-reserved destination of one trial's exchange sidecar.
|
|
2030
|
+
* @remarks
|
|
2031
|
+
* Path is absolute and ends in execution/trials/<trial>/exchanges.jsonl. The parent reserves
|
|
2032
|
+
* record.bytes against series custody before the worker starts. Without retained, the worker
|
|
2033
|
+
* opens the absent file exclusively. With retained, staging has closed a declaration and
|
|
2034
|
+
* maintenance prefix; the worker verifies that file identity and resumes appending after it.
|
|
2035
|
+
* Only file identities and declarations cross IPC, never a sidecar's recorded bodies.
|
|
2036
|
+
*/
|
|
2037
|
+
export declare interface StudyExchangeDestination {
|
|
2038
|
+
readonly path: string;
|
|
2039
|
+
readonly record: StudyRecord;
|
|
2040
|
+
readonly retained?: StudyFile;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
/** Retains an attempted exchange's failure and any bounded response bytes already observed.
|
|
2044
|
+
* @remarks
|
|
2045
|
+
* Response is absent when no reply arrived or its bytes did not fit the sidecar allowance; the
|
|
2046
|
+
* reason names which. A retained response may contain an incomplete body. Failure
|
|
2047
|
+
* preserves admitted charges and never invents completion, usage, or a successful terminal.
|
|
2048
|
+
*/
|
|
2049
|
+
export declare interface StudyExchangeFailure extends StudyExchangeIdentity {
|
|
2050
|
+
readonly phase: 'failure';
|
|
2051
|
+
readonly reason: string;
|
|
2052
|
+
readonly response?: StudyExchangeReply;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
/** Binds complete ordered exchanges to a verified sealed sidecar and its declaration.
|
|
2056
|
+
* @remarks
|
|
2057
|
+
* The strict reader verifies the seal and file digest, declared byte allowance, complete LF
|
|
2058
|
+
* rows, declaration and completion, every request/response byte digest and size, contiguous
|
|
2059
|
+
* order, stages, and the exact evidence-ordinal join before returning. Duplicate, orphaned,
|
|
2060
|
+
* reordered, partial, failed, or unsealed histories refuse with CUSTODY. File names the exact
|
|
2061
|
+
* member in the result seal; seal is that seal's id. An interface value alone is not proof of
|
|
2062
|
+
* provenance, so a replay constructor validates these invariants again before dependent work.
|
|
2063
|
+
*/
|
|
2064
|
+
export declare interface StudyExchangeHistory {
|
|
2065
|
+
readonly seal: string;
|
|
2066
|
+
readonly file: StudyFile;
|
|
2067
|
+
readonly declaration: StudyExchangeDeclaration;
|
|
2068
|
+
readonly exchanges: readonly StudyRecordedExchange[];
|
|
2069
|
+
readonly completion: StudyExchangeCompletion;
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
/** Binds one HTTP exchange to its trial-local position and declared execution stage.
|
|
2073
|
+
* @remarks
|
|
2074
|
+
* Ordinal is contiguous and one-based across all HTTP exchanges, including metadata and
|
|
2075
|
+
* maintenance. Step is present only for execution and names the model procedure's ordinal.
|
|
2076
|
+
* Goal names the declared goal whose evidence joins the exchange; pre-trial maintenance uses
|
|
2077
|
+
* the trial's first declared goal. Path excludes origin, query, and fragment. Every attempt and
|
|
2078
|
+
* terminal repeats this identity exactly, and dispatch and wire evidence retain ordinal even
|
|
2079
|
+
* when passive observation is disabled.
|
|
2080
|
+
*/
|
|
2081
|
+
export declare interface StudyExchangeIdentity {
|
|
2082
|
+
readonly ordinal: number;
|
|
2083
|
+
readonly goal: string;
|
|
2084
|
+
readonly role: StudyRole;
|
|
2085
|
+
readonly path: '/api/chat' | '/api/generate' | '/api/version' | '/api/tags' | '/api/show';
|
|
2086
|
+
readonly method: 'GET' | 'POST';
|
|
2087
|
+
readonly stage: StudyOllamaStage;
|
|
2088
|
+
readonly step?: number;
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
/** Retains response status, headers, and original application-body chunk lengths.
|
|
2092
|
+
* @remarks
|
|
2093
|
+
* Headers are ordered name/value pairs restricted to content-type and content-encoding; their
|
|
2094
|
+
* encoded representation consumes the sidecar allowance. Chunks contains positive safe byte
|
|
2095
|
+
* lengths whose sum equals size. Body retains the bytes fetch exposed before text decoding,
|
|
2096
|
+
* so replay must not apply the original content encoding again.
|
|
2097
|
+
*/
|
|
2098
|
+
export declare interface StudyExchangeReply extends StudyExchangeBytes {
|
|
2099
|
+
readonly status: number;
|
|
2100
|
+
readonly headers: ReadonlyArray<readonly [string, string]>;
|
|
2101
|
+
readonly chunks: readonly number[];
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
/** Retains a fully consumed response only after status and terminal validation succeed. */
|
|
2105
|
+
export declare interface StudyExchangeResponse extends StudyExchangeIdentity, StudyExchangeReply {
|
|
2106
|
+
readonly phase: 'response';
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
/** Names every admitted row of the bounded per-trial exchange sidecar. */
|
|
2110
|
+
export declare type StudyExchangeRow = StudyExchangeDeclaration | StudyExchangeAttempt | StudyExchangeResponse | StudyExchangeFailure | StudyExchangeCompletion;
|
|
2111
|
+
|
|
2112
|
+
/** Retains ordered exchange rows under a parent-reserved serialized byte allowance. */
|
|
2113
|
+
export declare class StudyExchangeSink implements StudyExchangeSinkInterface {
|
|
2114
|
+
#private;
|
|
2115
|
+
/** Owns the descriptor and restores a verified prefix without rewriting it.
|
|
2116
|
+
* @param options - The exclusive descriptor, byte bound and optional retained rows.
|
|
2117
|
+
*/
|
|
2118
|
+
constructor(options: StudyExchangeSinkOptions);
|
|
2119
|
+
/** Holds the next contiguous one-based HTTP ordinal, including the retained prefix. */
|
|
2120
|
+
get next(): number;
|
|
2121
|
+
/** Appends one owned row after validating order and reserving its complete serialized size.
|
|
2122
|
+
* @param row - The next declaration, attempt, terminal or completion.
|
|
2123
|
+
* @returns Completion after synchronized retention; callers await each append before proceeding.
|
|
2124
|
+
*/
|
|
2125
|
+
append(row: StudyExchangeRow): Promise<void>;
|
|
2126
|
+
/** Closes admission, drains accepted writes and synchronizes the owned descriptor.
|
|
2127
|
+
* @returns Completion after descriptor release, with a retained refusal propagated.
|
|
2128
|
+
*/
|
|
2129
|
+
close(): Promise<void>;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
/** Owns serialized exchange appends under a reserved trial byte allowance.
|
|
2133
|
+
* @remarks
|
|
2134
|
+
* Reserves bounded terminal-failure space before admitting an attempt, accounts JSON framing and
|
|
2135
|
+
* base64 expansion before accepting bytes, and bounds pending append work through backpressure.
|
|
2136
|
+
* The first custody refusal remains latched and prevents completion even if the caller catches it.
|
|
2137
|
+
*/
|
|
2138
|
+
export declare interface StudyExchangeSinkInterface {
|
|
2139
|
+
/** Holds the next contiguous one-based HTTP ordinal, derived from every accepted row, including a retained prefix. */
|
|
2140
|
+
readonly next: number;
|
|
2141
|
+
/** Appends one validated row after reserving its complete serialized size.
|
|
2142
|
+
* @param row - The next declaration, attempt, terminal, or completion in strict order.
|
|
2143
|
+
* @returns Completion after the bytes are retained; a refusal stays latched.
|
|
2144
|
+
*/
|
|
2145
|
+
append(row: StudyExchangeRow): Promise<void>;
|
|
2146
|
+
/** Closes admission and synchronizes all admitted writes without inventing completion.
|
|
2147
|
+
* @returns Completion after the descriptor closes, including on interrupted histories.
|
|
2148
|
+
*/
|
|
2149
|
+
close(): Promise<void>;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
/** Supplies an exclusive sidecar descriptor and its parent-reserved byte allowance. */
|
|
2153
|
+
export declare interface StudyExchangeSinkOptions {
|
|
2154
|
+
readonly file: FileHandle;
|
|
2155
|
+
readonly record: StudyRecord;
|
|
2156
|
+
/** Restores append state from a strictly verified prefix on the owned descriptor, without rewriting it. */
|
|
2157
|
+
readonly retained?: readonly StudyExchangeRow[];
|
|
2158
|
+
}
|
|
2159
|
+
|
|
1601
2160
|
/** Holds a checked execution selection with optional output custody. */
|
|
1602
2161
|
export declare interface StudyExecutionRequest {
|
|
1603
2162
|
readonly command: 'check' | 'execute';
|
|
@@ -1606,15 +2165,10 @@ export declare interface StudyExecutionRequest {
|
|
|
1606
2165
|
/** Selects an absolute output or a portable path contained by the consumer root. */
|
|
1607
2166
|
readonly out: string | undefined;
|
|
1608
2167
|
readonly expected: string | undefined;
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
/**
|
|
1612
|
-
|
|
1613
|
-
readonly cause: StudyCause;
|
|
1614
|
-
readonly message: string;
|
|
1615
|
-
readonly role: StudyRole | undefined;
|
|
1616
|
-
/** Names the ceiling that stopped the run; undefined for a failure no ceiling caused, and for a record sealed before this member existed. */
|
|
1617
|
-
readonly stop: StudyStop | undefined;
|
|
2168
|
+
/** Selects a published closure directory, reverified before captured validation and execution. */
|
|
2169
|
+
readonly closure?: string;
|
|
2170
|
+
/** Selects sealed exchanges and explicit trial prefixes before any dependent worker or daemon. */
|
|
2171
|
+
readonly replay?: StudyOllamaReplaySelection;
|
|
1618
2172
|
}
|
|
1619
2173
|
|
|
1620
2174
|
/** Holds the exact byte identity of one execution file. */
|
|
@@ -1631,10 +2185,13 @@ export declare interface StudyFrame {
|
|
|
1631
2185
|
readonly value: JSONValue;
|
|
1632
2186
|
}
|
|
1633
2187
|
|
|
1634
|
-
/**
|
|
1635
|
-
declare interface
|
|
1636
|
-
readonly
|
|
1637
|
-
readonly
|
|
2188
|
+
/** Requests exclusive materialization and captured validation before publishing closure.json. */
|
|
2189
|
+
export declare interface StudyFreezeRequest {
|
|
2190
|
+
readonly command: 'freeze';
|
|
2191
|
+
readonly target: string;
|
|
2192
|
+
readonly profile: string;
|
|
2193
|
+
/** Names the absent absolute destination supplied by --to. */
|
|
2194
|
+
readonly destination: string;
|
|
1638
2195
|
}
|
|
1639
2196
|
|
|
1640
2197
|
/** Reads one declared target against the consumer's domain predicate. */
|
|
@@ -1665,19 +2222,6 @@ export declare interface StudyGradeTarget {
|
|
|
1665
2222
|
readonly evidence: readonly StudyEvidence[];
|
|
1666
2223
|
}
|
|
1667
2224
|
|
|
1668
|
-
/** Holds a grading identity that cannot replace or mutate execution bytes. */
|
|
1669
|
-
declare interface StudyGrading {
|
|
1670
|
-
readonly result: string;
|
|
1671
|
-
readonly rubric: string;
|
|
1672
|
-
readonly grader: string;
|
|
1673
|
-
readonly instrument: string;
|
|
1674
|
-
readonly attempts: readonly string[];
|
|
1675
|
-
readonly labels: string | undefined;
|
|
1676
|
-
/** Binds the retained public packet and private mapping when semantic criteria exist. */
|
|
1677
|
-
readonly packet?: string;
|
|
1678
|
-
readonly judgments: readonly StudyJudgment[];
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
2225
|
/** Holds artifacts already verified inside a selected immutable grading directory. */
|
|
1682
2226
|
export declare interface StudyGradingContext {
|
|
1683
2227
|
readonly grading: StudyGrading;
|
|
@@ -1720,16 +2264,6 @@ export declare interface StudyGradingStoreOptions {
|
|
|
1720
2264
|
readonly packet?: StudyPacketBundle;
|
|
1721
2265
|
}
|
|
1722
2266
|
|
|
1723
|
-
/** Holds byte identities that qualification and comparisons must agree on. */
|
|
1724
|
-
declare interface StudyIdentity {
|
|
1725
|
-
readonly agent: string;
|
|
1726
|
-
readonly subject: string;
|
|
1727
|
-
readonly provider: string | undefined;
|
|
1728
|
-
readonly instrument: string;
|
|
1729
|
-
readonly fixtures: string;
|
|
1730
|
-
readonly profile: string;
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
2267
|
/** Holds inspected execution metadata that is never gradeable before sealing. */
|
|
1734
2268
|
export declare interface StudyInterruptedResult {
|
|
1735
2269
|
readonly status: 'interrupted';
|
|
@@ -1738,26 +2272,6 @@ export declare interface StudyInterruptedResult {
|
|
|
1738
2272
|
readonly attempts: readonly StudyAttempt[];
|
|
1739
2273
|
}
|
|
1740
2274
|
|
|
1741
|
-
/** Holds an evidence-backed verdict; missing evidence stays unknown. */
|
|
1742
|
-
declare interface StudyJudgment {
|
|
1743
|
-
readonly trial: string;
|
|
1744
|
-
readonly criterion: string;
|
|
1745
|
-
readonly verdict: 'achieved' | 'unsuccessful' | 'unknown';
|
|
1746
|
-
readonly method: 'state' | 'trace' | 'human' | 'model';
|
|
1747
|
-
readonly reason: string;
|
|
1748
|
-
readonly references: readonly string[];
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
/** Holds imported semantic judgments and their accountable origin. */
|
|
1752
|
-
declare interface StudyLabeling {
|
|
1753
|
-
readonly packet: string;
|
|
1754
|
-
readonly labeler: string;
|
|
1755
|
-
readonly version: string;
|
|
1756
|
-
readonly created: string;
|
|
1757
|
-
readonly usage: readonly StudyUsage[];
|
|
1758
|
-
readonly judgments: readonly StudyJudgment[];
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
2275
|
/** Holds an imported-label grading request. */
|
|
1762
2276
|
export declare interface StudyLabelRequest {
|
|
1763
2277
|
readonly command: 'label';
|
|
@@ -1766,19 +2280,6 @@ export declare interface StudyLabelRequest {
|
|
|
1766
2280
|
readonly labels: string;
|
|
1767
2281
|
}
|
|
1768
2282
|
|
|
1769
|
-
/** Retains the first operational failure of instrumented work and refuses work after it. */
|
|
1770
|
-
declare interface StudyLatchInterface {
|
|
1771
|
-
/** Refuses work after a retained failure or cancellation.
|
|
1772
|
-
* @returns Nothing when work may continue.
|
|
1773
|
-
*/
|
|
1774
|
-
check(): void;
|
|
1775
|
-
/** Retains an operational failure even when an enclosing runtime catches it.
|
|
1776
|
-
* @param error - The observed failure; an earlier retained failure keeps its identity, and a branded `BudgetError` can retain nothing because Agent reports that stop in its own result.
|
|
1777
|
-
* @returns Nothing after retention.
|
|
1778
|
-
*/
|
|
1779
|
-
fail(error: unknown): void;
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
2283
|
/** Supervises finite command trees and binds offline check to execution. */
|
|
1783
2284
|
export declare class StudyLauncher {
|
|
1784
2285
|
#private;
|
|
@@ -1805,59 +2306,65 @@ export declare interface StudyLaunchResult {
|
|
|
1805
2306
|
readonly output: string;
|
|
1806
2307
|
}
|
|
1807
2308
|
|
|
1808
|
-
/**
|
|
1809
|
-
|
|
2309
|
+
/** Handles validated transport requests at their owning domain boundary. */
|
|
2310
|
+
export declare type StudyMessageHandler = (operation: StudyOperation, value: JSONValue) => Promise<JSONValue>;
|
|
2311
|
+
|
|
2312
|
+
/** Holds one active goal's accounting and attribution. */
|
|
2313
|
+
export declare interface StudyOllamaActivity {
|
|
2314
|
+
readonly goal: string;
|
|
2315
|
+
readonly context: StudyContext;
|
|
2316
|
+
/** Holds the public view retained with the goal's first observed dispatch; undefined omits that view and observed request bodies independently of exchange recording. */
|
|
2317
|
+
readonly checkpoint: JSONValue | undefined;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
/** Declares a captured request's positive safe byte length without predicting its content.
|
|
1810
2321
|
* @remarks
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
1813
|
-
* `window` is a prompt room. `custody` is an evidence allowance. `meter`, `budget`, and `model`
|
|
1814
|
-
* mirror the `layer` of the `AgentStop` type from `@orkestrel/agent`: the run's estimate allowance,
|
|
1815
|
-
* any other budget, and the model's own token limit, which also names the daemon's context and
|
|
1816
|
-
* output caps.
|
|
2322
|
+
* Body and input are forbidden own members, including explicit undefined at runtime. Capture
|
|
2323
|
+
* proves declared identity, policy, and encoded length; it makes no content-fidelity claim.
|
|
1817
2324
|
*/
|
|
1818
|
-
declare
|
|
1819
|
-
|
|
1820
|
-
/** Holds finite allowances in milliseconds, calls, tokens and bytes. */
|
|
1821
|
-
declare interface StudyLimit {
|
|
1822
|
-
readonly duration: number;
|
|
1823
|
-
readonly calls: number;
|
|
1824
|
-
readonly tokens: number;
|
|
2325
|
+
export declare interface StudyOllamaCaptureStep extends StudyOllamaStepIdentity {
|
|
2326
|
+
readonly admission: 'capture';
|
|
1825
2327
|
readonly bytes: number;
|
|
2328
|
+
readonly body?: never;
|
|
2329
|
+
readonly input?: never;
|
|
1826
2330
|
}
|
|
1827
2331
|
|
|
1828
|
-
/**
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
readonly
|
|
1836
|
-
readonly
|
|
1837
|
-
readonly
|
|
1838
|
-
readonly
|
|
2332
|
+
/** Declares an exact UTF-8 request body and its SHA-256 input receipt.
|
|
2333
|
+
* @remarks
|
|
2334
|
+
* Body is compared byte for byte, never as parsed JSON or by length alone. Input is a SHA-256
|
|
2335
|
+
* receipt of the encoded body, verified before execution rather than trusted in place of bytes.
|
|
2336
|
+
* Encoded length is derived from body, so an independent bytes declaration is forbidden.
|
|
2337
|
+
*/
|
|
2338
|
+
export declare interface StudyOllamaExactStep extends StudyOllamaStepIdentity {
|
|
2339
|
+
readonly admission: 'exact';
|
|
2340
|
+
readonly body: string;
|
|
2341
|
+
readonly input: string;
|
|
2342
|
+
readonly bytes?: never;
|
|
1839
2343
|
}
|
|
1840
2344
|
|
|
1841
|
-
/**
|
|
1842
|
-
|
|
2345
|
+
/**
|
|
2346
|
+
* Sends one validated, admitted request under its Study role and returns the native response.
|
|
2347
|
+
* @remarks
|
|
2348
|
+
* Study owns response validation, cancellation, accounting, and the failure latch. The collaborator
|
|
2349
|
+
* receives the validated URL, encoded body, headers, bounded signal, and redirect policy;
|
|
2350
|
+
* it never settles a Study ticket.
|
|
2351
|
+
* @param role - The validated transport role, independent of the model name
|
|
2352
|
+
* @param input - The validated request URL
|
|
2353
|
+
* @param init - The owned request settings with the bounded signal and `redirect: 'error'`
|
|
2354
|
+
* @returns The native response Study reads and accounts
|
|
2355
|
+
*/
|
|
2356
|
+
export declare type StudyOllamaFetchFunction = (role: StudyRole, input: string | URL, init: RequestInit) => Promise<Response>;
|
|
1843
2357
|
|
|
1844
|
-
/**
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
2358
|
+
/** Bounds metadata calls, encoded bytes, and elapsed milliseconds outside model quotas.
|
|
2359
|
+
* @remarks
|
|
2360
|
+
* Each allowance is positive and finite; calls and bytes are safe integers. This budget covers
|
|
2361
|
+
* both verification passes across a trial and has no model-meter parent. The enclosing wall
|
|
2362
|
+
* deadline and sidecar custody budget still apply. No default is inferred from model limits.
|
|
2363
|
+
*/
|
|
2364
|
+
export declare interface StudyOllamaMetadata {
|
|
2365
|
+
readonly calls: number;
|
|
2366
|
+
readonly bytes: number;
|
|
1850
2367
|
readonly duration: number;
|
|
1851
|
-
/** Records whether the engine dispatched the goal to the session; never inferred from product, usage, duration or failure. */
|
|
1852
|
-
readonly executed: boolean;
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
/** Holds one active goal's accounting and attribution. */
|
|
1856
|
-
export declare interface StudyOllamaActivity {
|
|
1857
|
-
readonly goal: string;
|
|
1858
|
-
readonly context: StudyContext;
|
|
1859
|
-
/** Holds the owned public view retained with the goal's first model dispatch; undefined retains neither it nor request bodies. */
|
|
1860
|
-
readonly checkpoint: JSONValue | undefined;
|
|
1861
2368
|
}
|
|
1862
2369
|
|
|
1863
2370
|
/** Pins one served model identity the inventory verifies. */
|
|
@@ -1894,6 +2401,79 @@ export declare interface StudyOllamaPolicy {
|
|
|
1894
2401
|
readonly length: boolean;
|
|
1895
2402
|
}
|
|
1896
2403
|
|
|
2404
|
+
/** Answers declared HTTP prefixes from complete ordered recorded application bytes. */
|
|
2405
|
+
export declare class StudyOllamaReplay implements StudyOllamaReplayInterface {
|
|
2406
|
+
#private;
|
|
2407
|
+
/** Owns and revalidates the complete selected history before any sender can be reached.
|
|
2408
|
+
* @param options - Verified history, explicit prefix, executing origin and independent bounds.
|
|
2409
|
+
*/
|
|
2410
|
+
constructor(options: StudyOllamaReplayOptions);
|
|
2411
|
+
/** Holds exact recorded bodies for model requests inside the declared prefix. */
|
|
2412
|
+
get procedure(): readonly StudyOllamaStep[];
|
|
2413
|
+
/** Supplies recorded native responses, forwarding only after the exact declared prefix.
|
|
2414
|
+
* @param role - The validated Study responsibility.
|
|
2415
|
+
* @param input - The executing origin and exact route.
|
|
2416
|
+
* @param init - The method, encoded body and bounded signal.
|
|
2417
|
+
* @returns The recorded response or the explicit live collaborator's response.
|
|
2418
|
+
*/
|
|
2419
|
+
readonly fetch: StudyOllamaFetchFunction;
|
|
2420
|
+
/** Refuses a mismatch, an unread response or an incompletely consumed prefix. */
|
|
2421
|
+
check(): void;
|
|
2422
|
+
/** Closes admission and cancels retained replay responses.
|
|
2423
|
+
* @returns Completion after pending sends and owned readers settle.
|
|
2424
|
+
*/
|
|
2425
|
+
close(): Promise<void>;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
/** Answers an exact recorded prefix through the role-aware transport collaborator. */
|
|
2429
|
+
export declare interface StudyOllamaReplayInterface {
|
|
2430
|
+
/** Holds model steps with recorded prefix bodies projected to exact admission. */
|
|
2431
|
+
readonly procedure: readonly StudyOllamaStep[];
|
|
2432
|
+
/** Supplies native responses over retained bytes without settling a Study ticket. */
|
|
2433
|
+
readonly fetch: StudyOllamaFetchFunction;
|
|
2434
|
+
/** Refuses a latched mismatch, an unread response, or an incompletely consumed prefix.
|
|
2435
|
+
* @returns Nothing after the complete declared prefix has been consumed.
|
|
2436
|
+
*/
|
|
2437
|
+
check(): void;
|
|
2438
|
+
/** Closes admission and cancels or drains owned response readers.
|
|
2439
|
+
* @returns Completion after all replay resources are released.
|
|
2440
|
+
*/
|
|
2441
|
+
close(): Promise<void>;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
/** Configures exact recorded replies and optional live continuation after a declared prefix.
|
|
2445
|
+
* @remarks
|
|
2446
|
+
* History must come from the strict sealed sidecar reader and be checked completely before
|
|
2447
|
+
* construction, including declarations, byte digests, order, evidence joins, and completion.
|
|
2448
|
+
* Url pins the executing origin. Prefix counts complete HTTP exchanges, not JSONL rows. Limit
|
|
2449
|
+
* bounds replay work independently of recorded timing. Without fetch, the prefix must consume
|
|
2450
|
+
* the entire history and all later requests refuse; no native sender or daemon is created.
|
|
2451
|
+
* With fetch, only requests after the prefix are forwarded. A prefix mismatch never forwards.
|
|
2452
|
+
*/
|
|
2453
|
+
export declare interface StudyOllamaReplayOptions {
|
|
2454
|
+
readonly history: StudyExchangeHistory;
|
|
2455
|
+
readonly url: string;
|
|
2456
|
+
readonly prefix: number;
|
|
2457
|
+
readonly limit: StudyOllamaMetadata;
|
|
2458
|
+
readonly signal: AbortSignal;
|
|
2459
|
+
readonly fetch?: StudyOllamaFetchFunction;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
/** Selects a sealed recording and an explicit replay prefix for every scheduled trial.
|
|
2463
|
+
* @remarks
|
|
2464
|
+
* Result names a sealed result directory. Prefix maps each trial id to its positive safe count
|
|
2465
|
+
* of complete HTTP exchanges, including metadata and maintenance; each prefix ends at an
|
|
2466
|
+
* exchange boundary. Offline true requires the complete recorded population and forbids daemon
|
|
2467
|
+
* startup or a live sender. Offline false permits live continuation only after that prefix.
|
|
2468
|
+
* A changed request inside the prefix always refuses. Replay uses the executing profile's
|
|
2469
|
+
* bounds, never the recorded execution's elapsed-time allowance.
|
|
2470
|
+
*/
|
|
2471
|
+
export declare interface StudyOllamaReplaySelection {
|
|
2472
|
+
readonly result: string;
|
|
2473
|
+
readonly prefix: Readonly<Record<string, number>>;
|
|
2474
|
+
readonly offline: boolean;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
1897
2477
|
/** Holds validated wire dispatch facts without retaining payload text. */
|
|
1898
2478
|
export declare interface StudyOllamaRequest {
|
|
1899
2479
|
readonly role: StudyRole;
|
|
@@ -1928,6 +2508,27 @@ export declare interface StudyOllamaSnapshot {
|
|
|
1928
2508
|
readonly dispatch: StudyAgentDispatch | undefined;
|
|
1929
2509
|
}
|
|
1930
2510
|
|
|
2511
|
+
/** Names the ordered verification, model work, and daemon maintenance stages. */
|
|
2512
|
+
export declare type StudyOllamaStage = 'preflight' | 'execution' | 'postflight' | 'maintenance';
|
|
2513
|
+
|
|
2514
|
+
/** Separates exact request admission from length-declared capture admission. */
|
|
2515
|
+
export declare type StudyOllamaStep = StudyOllamaExactStep | StudyOllamaCaptureStep;
|
|
2516
|
+
|
|
2517
|
+
/** Declares an ordered model request's goal, responsibility, route, and wire policy.
|
|
2518
|
+
* @remarks
|
|
2519
|
+
* Ordinal is a positive, contiguous, one-based position among declared model steps in a trial.
|
|
2520
|
+
* Metadata and maintenance have their own sidecar ordinals and consume no model-step position.
|
|
2521
|
+
* Path is /api/chat for agent or summary and /api/generate for judge. Goal must be a declared
|
|
2522
|
+
* member of the trial. Policy is checked before body collection and again before sending.
|
|
2523
|
+
*/
|
|
2524
|
+
export declare interface StudyOllamaStepIdentity {
|
|
2525
|
+
readonly ordinal: number;
|
|
2526
|
+
readonly goal: string;
|
|
2527
|
+
readonly role: StudyOllamaRole;
|
|
2528
|
+
readonly path: '/api/chat' | '/api/generate';
|
|
2529
|
+
readonly policy: StudyOllamaPolicy;
|
|
2530
|
+
}
|
|
2531
|
+
|
|
1931
2532
|
/** Holds a validated terminal's finish reason and actual usage, unknown when unreported. */
|
|
1932
2533
|
export declare interface StudyOllamaTerminal {
|
|
1933
2534
|
readonly prompt: number | undefined;
|
|
@@ -1989,21 +2590,44 @@ export declare class StudyOllamaTransport implements StudyLatchInterface {
|
|
|
1989
2590
|
* the served identities, keyed by the label their inventory evidence carries. `roles` declares the
|
|
1990
2591
|
* wire policy of every model role the consumer dispatches; an undeclared role is refused.
|
|
1991
2592
|
* `signal` cancels all work. `observe`: if `true`, existing evidence rows gain passive timing and
|
|
1992
|
-
* correlation fields; if `false`,
|
|
2593
|
+
* correlation fields; if `false`, passive fields are absent. Recording always retains exchange
|
|
2594
|
+
* ordinals and raw bytes independently of observation. `timing` extracts daemon timing; the selected Ollama runtime supplies the extractor and the transport imports none.
|
|
2595
|
+
* `fetch` optionally sends the validated request under its role. Default: native fetch. Study keeps
|
|
2596
|
+
* response validation and accounting; the collaborator returns a native response and settles no ticket.
|
|
1993
2597
|
*/
|
|
1994
2598
|
export declare interface StudyOllamaTransportOptions {
|
|
1995
2599
|
readonly url: string;
|
|
1996
2600
|
readonly room: Pick<StudyRoom, 'context' | 'safety'>;
|
|
1997
2601
|
readonly limit: Pick<StudyLimit, 'duration' | 'bytes'>;
|
|
1998
2602
|
readonly models: Readonly<Record<string, StudyOllamaModel>>;
|
|
1999
|
-
readonly roles: Readonly<Partial<Record<StudyOllamaRole, StudyOllamaPolicy
|
|
2603
|
+
readonly roles: Readonly<Partial<Record<StudyOllamaRole, StudyOllamaPolicy>>> & {
|
|
2604
|
+
/** Forbids a model-generation policy for daemon maintenance. */
|
|
2605
|
+
readonly maintenance?: never;
|
|
2606
|
+
};
|
|
2000
2607
|
readonly signal: AbortSignal;
|
|
2001
2608
|
readonly observe: boolean;
|
|
2002
2609
|
readonly timing: typeof extractTiming;
|
|
2610
|
+
readonly fetch?: StudyOllamaFetchFunction | undefined;
|
|
2611
|
+
/** Bounds both metadata passes independently of every model quota. */
|
|
2612
|
+
readonly metadata: StudyOllamaMetadata;
|
|
2613
|
+
/** Pins GET /api/version before and after model execution; required with recording. */
|
|
2614
|
+
readonly version?: string;
|
|
2615
|
+
/** Declares every ordered model step; present together with exchanges and version. */
|
|
2616
|
+
readonly procedure?: readonly StudyOllamaStep[];
|
|
2617
|
+
/** Retains exact bytes regardless of observe or checkpoint; present together with procedure. */
|
|
2618
|
+
readonly exchanges?: StudyExchangeSinkInterface;
|
|
2003
2619
|
}
|
|
2004
2620
|
|
|
2005
2621
|
/** Tracks one owned HTTP response until its end or cancellation. */
|
|
2006
2622
|
export declare interface StudyOllamaWire {
|
|
2623
|
+
/** Holds the admission registry key until this exchange settles. */
|
|
2624
|
+
readonly slot: symbol;
|
|
2625
|
+
/** Holds the sidecar identity when recording is declared. */
|
|
2626
|
+
readonly identity: StudyExchangeIdentity | undefined;
|
|
2627
|
+
/** Holds bounded reply headers in native iteration order. */
|
|
2628
|
+
readonly headers: ReadonlyArray<readonly [string, string]>;
|
|
2629
|
+
/** Holds the combined request and response byte ceiling admitted for this exchange. */
|
|
2630
|
+
readonly ceiling: number;
|
|
2007
2631
|
readonly activity: StudyOllamaActivity;
|
|
2008
2632
|
readonly request: StudyOllamaRequest;
|
|
2009
2633
|
readonly ticket: StudyTicket;
|
|
@@ -2066,7 +2690,7 @@ export declare interface StudyParentTicket {
|
|
|
2066
2690
|
|
|
2067
2691
|
/** Holds checked public declarations and reproducible executable identities. */
|
|
2068
2692
|
export declare interface StudyPreparation {
|
|
2069
|
-
readonly
|
|
2693
|
+
readonly bundle: string;
|
|
2070
2694
|
readonly definition: StudyDefinition;
|
|
2071
2695
|
readonly scenarios: readonly StudyScenario[];
|
|
2072
2696
|
readonly rubric: StudyRubric;
|
|
@@ -2074,6 +2698,8 @@ export declare interface StudyPreparation {
|
|
|
2074
2698
|
readonly identity: StudyIdentity;
|
|
2075
2699
|
readonly artifacts: StudyArtifactLoader;
|
|
2076
2700
|
readonly source: string;
|
|
2701
|
+
/** Carries the verified closure publication when preparation uses relocated inputs. */
|
|
2702
|
+
readonly closure?: StudyClosure;
|
|
2077
2703
|
}
|
|
2078
2704
|
|
|
2079
2705
|
/** Opens one fresh native child for each scheduled trial. */
|
|
@@ -2082,7 +2708,7 @@ export declare class StudyProcessDriver implements StudyDriverInterface {
|
|
|
2082
2708
|
/** Owns immutable resolved launch settings.
|
|
2083
2709
|
* @param options - Built entry, admitted identities and exclusive scratch parent.
|
|
2084
2710
|
*/
|
|
2085
|
-
constructor(options:
|
|
2711
|
+
constructor(options: StudyProcessDriverOptions);
|
|
2086
2712
|
/** Opens isolated child state and waits for its verified readiness.
|
|
2087
2713
|
* @param trial - The public scheduled trial.
|
|
2088
2714
|
* @param signal - Authoritative parent cancellation.
|
|
@@ -2091,6 +2717,11 @@ export declare class StudyProcessDriver implements StudyDriverInterface {
|
|
|
2091
2717
|
open(trial: StudyTrial, signal: AbortSignal): Promise<StudySessionInterface>;
|
|
2092
2718
|
}
|
|
2093
2719
|
|
|
2720
|
+
/** Supplies parent-only trial preparation separately from serializable worker options. */
|
|
2721
|
+
export declare interface StudyProcessDriverOptions extends StudyProcessOptions {
|
|
2722
|
+
readonly prepare?: StudyTrialPreparationFunction;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2094
2725
|
/** Holds one goal's parent context and the worker admission sequence it issues while the goal runs.
|
|
2095
2726
|
* @example Issue worker admissions in sequence
|
|
2096
2727
|
* ```ts
|
|
@@ -2126,6 +2757,10 @@ export declare interface StudyProcessOptions extends StudyArtifactLoaderOptions
|
|
|
2126
2757
|
readonly identity: StudyIdentity;
|
|
2127
2758
|
readonly driver: string;
|
|
2128
2759
|
readonly directory: string;
|
|
2760
|
+
/** Names parent-reserved sidecars by scheduled trial; no recorded bodies cross IPC. */
|
|
2761
|
+
readonly exchanges?: Readonly<Record<string, StudyExchangeDestination>>;
|
|
2762
|
+
/** Carries sealed source selection; each fresh worker rechecks its own trial's file. */
|
|
2763
|
+
readonly replay?: StudyOllamaReplaySelection;
|
|
2129
2764
|
}
|
|
2130
2765
|
|
|
2131
2766
|
/** Keeps admission and evidence custody in the parent of one fresh trial process. */
|
|
@@ -2153,46 +2788,12 @@ export declare interface StudyProcessSessionOptions extends StudyProcessOptions
|
|
|
2153
2788
|
readonly signal: AbortSignal;
|
|
2154
2789
|
}
|
|
2155
2790
|
|
|
2156
|
-
/** Holds
|
|
2157
|
-
declare interface
|
|
2158
|
-
readonly
|
|
2159
|
-
readonly
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
/** Holds execution settings independently of scenario and grading declarations. */
|
|
2163
|
-
declare interface StudyProfile {
|
|
2164
|
-
readonly name: string;
|
|
2165
|
-
/** Selects the Agent runtime entry, independently of the package under study. */
|
|
2166
|
-
readonly agent: string;
|
|
2167
|
-
/** Selects the entry of the package under study; it can equal the Agent entry. */
|
|
2168
|
-
readonly subject: string;
|
|
2169
|
-
readonly roots: readonly string[];
|
|
2170
|
-
readonly bounds: StudyBounds;
|
|
2171
|
-
readonly room: StudyRoom;
|
|
2172
|
-
readonly provider: StudyProvider | undefined;
|
|
2173
|
-
readonly qualification: string | undefined;
|
|
2174
|
-
/** Holds driver-owned JSON; the driver owns its interpretation and Study only validates and owns the object. */
|
|
2175
|
-
readonly settings: Readonly<Record<string, JSONValue>> | undefined;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
/** Holds caller-selected provider artifacts and model identities. */
|
|
2179
|
-
declare interface StudyProvider {
|
|
2180
|
-
readonly entry: string;
|
|
2181
|
-
readonly url: string;
|
|
2182
|
-
readonly model: string;
|
|
2183
|
-
/** Names the judge model; declared together with its digest or both absent. */
|
|
2184
|
-
readonly judge: string | undefined;
|
|
2185
|
-
/** Pins the serving inventory independently of mutable model names. */
|
|
2186
|
-
readonly digest: {
|
|
2187
|
-
readonly model: string;
|
|
2188
|
-
/** Pins the judge model; declared together with its name or both absent. */
|
|
2189
|
-
readonly judge: string | undefined;
|
|
2190
|
-
};
|
|
2791
|
+
/** Holds a strictly verified successful request and response pair. */
|
|
2792
|
+
export declare interface StudyRecordedExchange {
|
|
2793
|
+
readonly attempt: StudyExchangeAttempt;
|
|
2794
|
+
readonly response: StudyExchangeResponse;
|
|
2191
2795
|
}
|
|
2192
2796
|
|
|
2193
|
-
/** Names the evidence a study can establish. */
|
|
2194
|
-
declare type StudyPurpose = 'mechanism' | 'quality' | 'capacity';
|
|
2195
|
-
|
|
2196
2797
|
/** Cites a retained trial file, or one evidence row of it by its zero-based position. */
|
|
2197
2798
|
export declare interface StudyReference {
|
|
2198
2799
|
readonly file: StudyReferenceFile;
|
|
@@ -2303,6 +2904,11 @@ export declare class StudyResultStore implements StudyResultStoreInterface {
|
|
|
2303
2904
|
* @throws StudyError - Thrown when creation repeats or custody bounds are exceeded
|
|
2304
2905
|
*/
|
|
2305
2906
|
create(): Promise<void>;
|
|
2907
|
+
/** Reserves a trial's entire exchange allowance before any worker starts.
|
|
2908
|
+
* @param trial - The exact scheduled trial whose manifest declares recording.
|
|
2909
|
+
* @returns Its exclusive sidecar destination, without creating the trial directory.
|
|
2910
|
+
*/
|
|
2911
|
+
exchanges(trial: StudyTrial): Promise<StudyExchangeDestination>;
|
|
2306
2912
|
/**
|
|
2307
2913
|
* Exclusively creates the evidence sink for an exact scheduled trial.
|
|
2308
2914
|
* @param trial - The scheduled trajectory
|
|
@@ -2335,6 +2941,11 @@ export declare interface StudyResultStoreInterface extends StudyStoreInterface {
|
|
|
2335
2941
|
* @returns The synchronized execution seal.
|
|
2336
2942
|
*/
|
|
2337
2943
|
seal(): Promise<StudySeal>;
|
|
2944
|
+
/** Reserves a declared trial's sidecar allowance and returns its exclusive write destination.
|
|
2945
|
+
* @param trial - A scheduled trial whose recording declaration is present.
|
|
2946
|
+
* @returns The destination after reserving its complete allowance from series custody.
|
|
2947
|
+
*/
|
|
2948
|
+
exchanges(trial: StudyTrial): Promise<StudyExchangeDestination>;
|
|
2338
2949
|
}
|
|
2339
2950
|
|
|
2340
2951
|
/** Holds the inert execution store configuration. */
|
|
@@ -2343,31 +2954,6 @@ export declare interface StudyResultStoreOptions {
|
|
|
2343
2954
|
readonly manifest: StudyManifest;
|
|
2344
2955
|
}
|
|
2345
2956
|
|
|
2346
|
-
/** Names a request's measured responsibility. */
|
|
2347
|
-
declare type StudyRole = 'agent' | 'judge' | 'summary' | 'metadata' | 'tool';
|
|
2348
|
-
|
|
2349
|
-
/** Holds the model context and generation allowance as separate measurements. */
|
|
2350
|
-
declare interface StudyRoom {
|
|
2351
|
-
readonly context: number;
|
|
2352
|
-
readonly output: number;
|
|
2353
|
-
readonly safety: number;
|
|
2354
|
-
/** Declares the recap allowance; absent when the workflow produces no recap. */
|
|
2355
|
-
readonly recap: number | undefined;
|
|
2356
|
-
readonly think: boolean;
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
|
-
/** Holds a versioned grading declaration independently of execution. */
|
|
2360
|
-
declare interface StudyRubric {
|
|
2361
|
-
readonly version: string;
|
|
2362
|
-
readonly criteria: readonly StudyCriterion[];
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
/** Holds ordered goals sharing state within an isolated trial. */
|
|
2366
|
-
declare interface StudyScenario {
|
|
2367
|
-
readonly id: string;
|
|
2368
|
-
readonly goals: readonly StudyGoal[];
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2371
2957
|
/** Holds a complete execution inventory and its deterministic identity. */
|
|
2372
2958
|
export declare interface StudySeal {
|
|
2373
2959
|
readonly result: string;
|
|
@@ -2384,59 +2970,6 @@ export declare interface StudySealedResult {
|
|
|
2384
2970
|
readonly seal: StudySeal;
|
|
2385
2971
|
}
|
|
2386
2972
|
|
|
2387
|
-
/** Owns domain state across a trial and releases it before the next trial. */
|
|
2388
|
-
declare interface StudySessionInterface {
|
|
2389
|
-
/** Executes one public goal against the trial's retained domain state.
|
|
2390
|
-
* @param goal - The declared public input.
|
|
2391
|
-
* @param context - Cancellation, borrowed admission, and evidence custody.
|
|
2392
|
-
* @returns The observed product without a task verdict.
|
|
2393
|
-
*/
|
|
2394
|
-
execute(goal: StudyGoal, context: StudyContext): Promise<StudyProduct>;
|
|
2395
|
-
/** Releases the trial's domain resources.
|
|
2396
|
-
* @returns A promise that resolves after release.
|
|
2397
|
-
*/
|
|
2398
|
-
close(): Promise<void>;
|
|
2399
|
-
}
|
|
2400
|
-
|
|
2401
|
-
/** Holds an evidence sink whose implementation owns byte limits and custody. */
|
|
2402
|
-
declare interface StudySinkInterface {
|
|
2403
|
-
/** Appends bounded domain evidence to the owned execution record.
|
|
2404
|
-
* @param evidence - The public evidence for a declared goal.
|
|
2405
|
-
* @returns A promise that resolves when custody accepts the bytes.
|
|
2406
|
-
*/
|
|
2407
|
-
append(evidence: StudyEvidence): Promise<void>;
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
/**
|
|
2411
|
-
* Holds the ceiling that stopped a run and the readings it crossed.
|
|
2412
|
-
* @remarks
|
|
2413
|
-
* `id` names the ceiling: a Study label and quantity such as `Goal tokens`, an Agent budget's trace
|
|
2414
|
-
* id, or the provider option that capped the model such as `num_predict`. `max` is the ceiling and
|
|
2415
|
-
* `consumed` the tally at the crossing, the refused charge included; each is undefined when its
|
|
2416
|
-
* source reports none. On the `model` layer `max` is the cap and `consumed` the completion or prompt.
|
|
2417
|
-
* Finite foreign readings retain their source values, including negative and fractional values.
|
|
2418
|
-
*/
|
|
2419
|
-
declare interface StudyStop {
|
|
2420
|
-
readonly layer: StudyLayer;
|
|
2421
|
-
readonly id: string;
|
|
2422
|
-
readonly max: number | undefined;
|
|
2423
|
-
readonly consumed: number | undefined;
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
/** Appends terminal records without overwriting a prior attempt. */
|
|
2427
|
-
declare interface StudyStoreInterface {
|
|
2428
|
-
/** Opens append-only evidence custody for one scheduled trial.
|
|
2429
|
-
* @param trial - The exact scheduled trial.
|
|
2430
|
-
* @returns The borrowed evidence sink.
|
|
2431
|
-
*/
|
|
2432
|
-
start(trial: StudyTrial): Promise<StudySinkInterface>;
|
|
2433
|
-
/** Retains the terminal record for one scheduled trial.
|
|
2434
|
-
* @param attempt - The complete scheduled goal horizon.
|
|
2435
|
-
* @returns A promise that resolves after custody retains the record.
|
|
2436
|
-
*/
|
|
2437
|
-
finish(attempt: StudyAttempt): Promise<void>;
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
2973
|
/** Bounds adapter evaluation by an independent native parent timer. */
|
|
2441
2974
|
export declare class StudyTask {
|
|
2442
2975
|
#private;
|
|
@@ -2459,6 +2992,8 @@ export declare interface StudyTaskOptions {
|
|
|
2459
2992
|
readonly adapter: string;
|
|
2460
2993
|
readonly roots: readonly string[];
|
|
2461
2994
|
readonly duration?: number;
|
|
2995
|
+
/** Binds fresh adapter validation to the already verified relocated selection. */
|
|
2996
|
+
readonly closure?: StudyClosure;
|
|
2462
2997
|
}
|
|
2463
2998
|
|
|
2464
2999
|
/** Carries only declarations or sealed evidence to an adapter child. */
|
|
@@ -2483,45 +3018,25 @@ export declare class StudyTaskWorker {
|
|
|
2483
3018
|
execute(): Promise<void>;
|
|
2484
3019
|
}
|
|
2485
3020
|
|
|
2486
|
-
/** Holds one admitted request until its actual charge is recorded. */
|
|
2487
|
-
declare interface StudyTicket {
|
|
2488
|
-
readonly signal: AbortSignal;
|
|
2489
|
-
/** Reports whether this ticket already recorded its own settlement; an aborted signal does not establish it. */
|
|
2490
|
-
readonly settled: boolean;
|
|
2491
|
-
/** Records actual measurements for one admitted request.
|
|
2492
|
-
* @param usage - The request's measured charges.
|
|
2493
|
-
* @returns Nothing after settlement.
|
|
2494
|
-
*/
|
|
2495
|
-
finish(usage: StudyUsage): void;
|
|
2496
|
-
/** Records an attributable failure for one admitted request.
|
|
2497
|
-
* @param failure - The retained operational attribution.
|
|
2498
|
-
* @returns Nothing after failure propagation.
|
|
2499
|
-
*/
|
|
2500
|
-
fail(failure: StudyFailure): void;
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
/** Holds a scheduled trajectory, with a fresh state for each repetition and arm. */
|
|
2504
|
-
declare interface StudyTrial {
|
|
2505
|
-
readonly id: string;
|
|
2506
|
-
readonly scenario: string;
|
|
2507
|
-
readonly arm: string;
|
|
2508
|
-
readonly repetition: number;
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
3021
|
/** Holds the trial sink's admitted writes and terminal lifecycle. */
|
|
2512
3022
|
export declare interface StudyTrialCustody {
|
|
2513
3023
|
readonly sink: StudyCustodySinkInterface;
|
|
2514
3024
|
readonly terminal: Promise<void> | undefined;
|
|
2515
3025
|
}
|
|
2516
3026
|
|
|
2517
|
-
/**
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
3027
|
+
/** Prepares one trial's external resources before its worker starts.
|
|
3028
|
+
* @remarks
|
|
3029
|
+
* The execution owns daemon start and stop. This callback performs the declared pre-trial
|
|
3030
|
+
* unload and closes any maintenance prefix before returning its retained file identity.
|
|
3031
|
+
* A returned destination must preserve the supplied path and record allowance. The driver
|
|
3032
|
+
* awaits it before constructing the session and never serializes this callback over IPC.
|
|
3033
|
+
* Offline replay supplies no callback and starts no external resource.
|
|
3034
|
+
* @param trial - The exact scheduled trial about to open.
|
|
3035
|
+
* @param signal - The enclosing execution cancellation.
|
|
3036
|
+
* @param exchanges - The parent-reserved sidecar destination, when recording is declared.
|
|
3037
|
+
* @returns The same destination with verified maintenance-prefix identity, or undefined without recording.
|
|
3038
|
+
*/
|
|
3039
|
+
export declare type StudyTrialPreparationFunction = (trial: StudyTrial, signal: AbortSignal, exchanges: StudyExchangeDestination | undefined) => Promise<StudyExchangeDestination | undefined>;
|
|
2525
3040
|
|
|
2526
3041
|
/** Holds declarations for domain validation before agent, subject or provider execution. */
|
|
2527
3042
|
export declare interface StudyValidation {
|
|
@@ -2574,6 +3089,33 @@ export declare function translateStudyPacketLabeling(result: StudySealedResult,
|
|
|
2574
3089
|
*/
|
|
2575
3090
|
export declare function validateStudyEvidenceBytes(bytes: Uint8Array, manifest: StudyManifest, trial: string): void;
|
|
2576
3091
|
|
|
3092
|
+
/** Joins recorded exchanges to exactly one dispatch and wire evidence identity per ordinal.
|
|
3093
|
+
* @param rows - The complete successful sidecar rows.
|
|
3094
|
+
* @param evidence - The validated trial evidence rows.
|
|
3095
|
+
* @returns Nothing when all retained exchange identities have exact evidence counterparts.
|
|
3096
|
+
*/
|
|
3097
|
+
export declare function validateStudyExchangeEvidence(rows: readonly StudyExchangeRow[], evidence: readonly StudyEvidence[]): void;
|
|
3098
|
+
|
|
3099
|
+
/** Validates complete history envelopes again before a replay may perform dependent work.
|
|
3100
|
+
* @param history - The strict-reader result, treated as untrusted at this boundary.
|
|
3101
|
+
* @returns Nothing after complete row, file and declaration verification.
|
|
3102
|
+
*/
|
|
3103
|
+
export declare function validateStudyExchangeHistory(history: StudyExchangeHistory): void;
|
|
3104
|
+
|
|
3105
|
+
/** Validates the exact declaration order and request bytes of an admitted exchange.
|
|
3106
|
+
* @param declaration - The complete opening procedure.
|
|
3107
|
+
* @param request - The admitted request to join.
|
|
3108
|
+
* @returns Nothing after identity, exact-body or capture-length validation.
|
|
3109
|
+
*/
|
|
3110
|
+
export declare function validateStudyExchangeRequest(declaration: StudyExchangeDeclaration, request: StudyExchangeAttempt): void;
|
|
3111
|
+
|
|
3112
|
+
/** Validates a serialized journal prefix or its complete successful population.
|
|
3113
|
+
* @param rows - The owned rows in physical append order.
|
|
3114
|
+
* @param complete - If true, requires successful completion; if false, admits an unfinished prefix.
|
|
3115
|
+
* @returns Nothing when every row joins its preceding attempt and declared sequence.
|
|
3116
|
+
*/
|
|
3117
|
+
export declare function validateStudyExchangeRows(rows: readonly StudyExchangeRow[], complete?: boolean): void;
|
|
3118
|
+
|
|
2577
3119
|
/**
|
|
2578
3120
|
* Checks terminal policy after the actual wire cost has been retained.
|
|
2579
3121
|
* @param terminal - The valid terminal facts
|
|
@@ -2593,6 +3135,13 @@ export declare function validateStudyOllamaCompletion(terminal: StudyOllamaTermi
|
|
|
2593
3135
|
*/
|
|
2594
3136
|
export declare function validateStudyOllamaInventory(value: unknown, models: StudyOllamaTransportOptions['models']): void;
|
|
2595
3137
|
|
|
3138
|
+
/** Validates independent metadata bounds and the complete optional recording group.
|
|
3139
|
+
* @param options - The owned transport configuration.
|
|
3140
|
+
* @returns Nothing when declarations are executable.
|
|
3141
|
+
* @throws StudyError - Thrown with CONFIG for invalid bounds, groups, identities or ordered policies.
|
|
3142
|
+
*/
|
|
3143
|
+
export declare function validateStudyOllamaRecording(options: StudyOllamaTransportOptions): void;
|
|
3144
|
+
|
|
2596
3145
|
/**
|
|
2597
3146
|
* Validates declared role policies against the pinned inventory before any dispatch.
|
|
2598
3147
|
* @param roles - The declared wire policy of each model role
|
|
@@ -2602,6 +3151,16 @@ export declare function validateStudyOllamaInventory(value: unknown, models: Stu
|
|
|
2602
3151
|
*/
|
|
2603
3152
|
export declare function validateStudyOllamaRoles(roles: StudyOllamaTransportOptions['roles'], models: StudyOllamaTransportOptions['models']): void;
|
|
2604
3153
|
|
|
3154
|
+
/** Admits one model request against its next exact or capture declaration.
|
|
3155
|
+
* @param step - The next model step, absent after the procedure ends.
|
|
3156
|
+
* @param goal - The bound goal identity.
|
|
3157
|
+
* @param request - The independently validated request policy and byte length.
|
|
3158
|
+
* @param body - The owned encoded request body.
|
|
3159
|
+
* @returns Nothing when identity, policy and bytes match the declaration.
|
|
3160
|
+
* @throws StudyError - Thrown with FAULT before sending any mismatched request.
|
|
3161
|
+
*/
|
|
3162
|
+
export declare function validateStudyOllamaStep(step: StudyOllamaStep | undefined, goal: string, request: StudyOllamaRequest, body: RequestInit['body']): void;
|
|
3163
|
+
|
|
2605
3164
|
/** Refuses a profile that omits the actual host runtime's declared dependency bytes.
|
|
2606
3165
|
* @param instrument - The canonical package owning the trusted runtime entry.
|
|
2607
3166
|
* @param roots - Explicitly admitted package roots, including the instrument.
|
|
@@ -2620,6 +3179,14 @@ export declare function validateStudyRuntime(instrument: string, roots: readonly
|
|
|
2620
3179
|
*/
|
|
2621
3180
|
export declare function valueToWire(value: unknown): JSONValue;
|
|
2622
3181
|
|
|
3182
|
+
/** Verifies complete copied membership, path safety, exact bytes, and portable identity.
|
|
3183
|
+
* @param closure - The materialization record to verify independently.
|
|
3184
|
+
* @param published - If true, permits the root publication marker; if false, refuses every extra file. Default: false.
|
|
3185
|
+
* @returns Nothing when the entire forest matches.
|
|
3186
|
+
* @throws ArtifactError - Thrown for malformed records, changed membership, bytes, or physical paths.
|
|
3187
|
+
*/
|
|
3188
|
+
export declare function verifyArtifactClosure(closure: ArtifactClosure, published?: boolean): void;
|
|
3189
|
+
|
|
2623
3190
|
/**
|
|
2624
3191
|
* Writes an exclusive regular record and synchronizes it before reporting success.
|
|
2625
3192
|
* @param path - The new custody path
|