@orkestrel/study 0.0.2 → 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/dist/src/core/index.cjs +61 -16
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +67 -8
- package/dist/src/core/index.d.ts +67 -8
- package/dist/src/core/index.js +61 -18
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +2879 -928
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +874 -15
- package/dist/src/server/index.d.ts +874 -15
- package/dist/src/server/index.js +2838 -934
- package/dist/src/server/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,3 +1,4 @@
|
|
|
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';
|
|
@@ -9,6 +10,8 @@ import type { LoadFnOutput } from 'node:module';
|
|
|
9
10
|
import type { LoadHookContext } from 'node:module';
|
|
10
11
|
import type { LoadHookSync } from 'node:module';
|
|
11
12
|
import type { Message } from '@orkestrel/agent';
|
|
13
|
+
import type { OllamaDaemonIdentity } from '@orkestrel/ollama/server';
|
|
14
|
+
import type { OllamaDaemonInterface } from '@orkestrel/ollama/server';
|
|
12
15
|
import type { OllamaOptions } from '@orkestrel/ollama';
|
|
13
16
|
import type { OllamaTiming } from '@orkestrel/ollama';
|
|
14
17
|
import type { ProviderDelta } from '@orkestrel/agent';
|
|
@@ -45,6 +48,7 @@ import type { StudyObservation } from '@orkestrel/study';
|
|
|
45
48
|
import type { StudyProduct } from '@orkestrel/study';
|
|
46
49
|
import type { StudyProfile } from '@orkestrel/study';
|
|
47
50
|
import type { StudyProvider } from '@orkestrel/study';
|
|
51
|
+
import type { StudyRecord } from '@orkestrel/study';
|
|
48
52
|
import type { StudyRole } from '@orkestrel/study';
|
|
49
53
|
import type { StudyRoom } from '@orkestrel/study';
|
|
50
54
|
import type { StudyRubric } from '@orkestrel/study';
|
|
@@ -63,6 +67,12 @@ export declare const ARTIFACT_BYTES: number;
|
|
|
63
67
|
/** Bounds directory nesting below each selected root. */
|
|
64
68
|
export declare const ARTIFACT_DEPTH = 64;
|
|
65
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
|
+
|
|
66
76
|
/** Bounds one captured input file to 16 MiB. */
|
|
67
77
|
export declare const ARTIFACT_FILE_BYTES: number;
|
|
68
78
|
|
|
@@ -75,15 +85,34 @@ export declare const ARTIFACT_ROOTS = 128;
|
|
|
75
85
|
/** Bounds all visited directory entries, including ignored assets. */
|
|
76
86
|
export declare const ARTIFACT_VISITS = 32768;
|
|
77
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
|
+
|
|
78
103
|
/** Reports an invalid or drifted artifact inventory. */
|
|
79
104
|
export declare class ArtifactError extends Error {
|
|
80
|
-
readonly code:
|
|
105
|
+
readonly code: ArtifactErrorCode;
|
|
81
106
|
/** Records the refused artifact boundary.
|
|
82
107
|
* @param message - The specific refusal.
|
|
108
|
+
* @param code - The refused boundary. Default: ARTIFACT.
|
|
83
109
|
*/
|
|
84
|
-
constructor(message: string);
|
|
110
|
+
constructor(message: string, code?: ArtifactErrorCode);
|
|
85
111
|
}
|
|
86
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
|
+
|
|
87
116
|
/** Records the exact bytes admitted at one absolute file path. */
|
|
88
117
|
export declare interface ArtifactFile {
|
|
89
118
|
readonly path: string;
|
|
@@ -110,14 +139,16 @@ export declare interface ArtifactInventory {
|
|
|
110
139
|
readonly source?: ArtifactSourceOptions;
|
|
111
140
|
readonly instrument?: string;
|
|
112
141
|
readonly files: readonly ArtifactFile[];
|
|
142
|
+
/** Binds explicit custody-only selections independently of executable entries. */
|
|
143
|
+
readonly assets?: readonly string[];
|
|
113
144
|
}
|
|
114
145
|
|
|
115
146
|
/** Captures built ESM and a separate strip-only consumer adapter in a fresh worker.
|
|
116
147
|
* @remarks
|
|
117
|
-
* Loads trusted code
|
|
148
|
+
* Loads trusted code without sandboxing untrusted code. Native process APIs, eval and external
|
|
118
149
|
* services are not replayed. One inventory may load per process; terminate it afterwards.
|
|
119
150
|
*/
|
|
120
|
-
export declare class ArtifactLoader {
|
|
151
|
+
export declare class ArtifactLoader implements ArtifactLoaderInterface {
|
|
121
152
|
#private;
|
|
122
153
|
/** Captures selections without reading or executing selected modules.
|
|
123
154
|
* @param options - Canonical built selections and optional consumer source selection.
|
|
@@ -138,6 +169,43 @@ export declare class ArtifactLoader {
|
|
|
138
169
|
* @throws Thrown for drift, unsupported edges, evaluation failures, or a reused worker.
|
|
139
170
|
*/
|
|
140
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>;
|
|
141
209
|
}
|
|
142
210
|
|
|
143
211
|
/** Selects built packages and an optional separate consumer source graph. */
|
|
@@ -149,11 +217,23 @@ export declare interface ArtifactLoaderOptions {
|
|
|
149
217
|
readonly instrument?: string;
|
|
150
218
|
/** Refuses these built files at every import edge; the inventory identity is unchanged. */
|
|
151
219
|
readonly excluded?: readonly string[];
|
|
220
|
+
/** Admits explicitly selected canonical regular files without granting import eligibility. */
|
|
221
|
+
readonly assets?: readonly string[];
|
|
152
222
|
}
|
|
153
223
|
|
|
154
224
|
/** Names Node's synchronous loading continuation. */
|
|
155
225
|
export declare type ArtifactLoadHandler = Parameters<LoadHookSync>[2];
|
|
156
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
|
+
|
|
157
237
|
/** Records the identity declared by an admitted package manifest. */
|
|
158
238
|
export declare interface ArtifactPackage {
|
|
159
239
|
readonly root: string;
|
|
@@ -178,7 +258,7 @@ export declare interface ArtifactSource extends ArtifactFile {
|
|
|
178
258
|
}
|
|
179
259
|
|
|
180
260
|
/** Selects a consumer-owned executable source directory and its exact adapter entry.
|
|
181
|
-
* @remarks Source JSON assets are not
|
|
261
|
+
* @remarks Source JSON assets are not executable imports; explicitly selected assets retain custody only.
|
|
182
262
|
*/
|
|
183
263
|
export declare interface ArtifactSourceOptions {
|
|
184
264
|
readonly root: string;
|
|
@@ -235,6 +315,18 @@ export declare function buildStudyAgentToolDenial(call: unknown, reason: unknown
|
|
|
235
315
|
*/
|
|
236
316
|
export declare function buildStudyAgentToolResult(call: unknown, result: unknown): JSONValue;
|
|
237
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
|
+
|
|
238
330
|
/**
|
|
239
331
|
* Declares the pinned serving identities the Ollama transport verifies, keyed by the label their inventory evidence carries.
|
|
240
332
|
* @param provider - Declared serving identities
|
|
@@ -285,8 +377,8 @@ export declare function buildStudyOllamaTiming(timing: OllamaTiming | undefined)
|
|
|
285
377
|
* Builds a frozen owned copy of transport configuration that later caller mutation cannot reach.
|
|
286
378
|
* @remarks
|
|
287
379
|
* Every caller member is read once, outer fields before nested data. Every nested data object is
|
|
288
|
-
* copied and frozen; the caller's objects are never frozen. The cancellation signal
|
|
289
|
-
* 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.
|
|
290
382
|
* @param options - The caller's transport configuration
|
|
291
383
|
* @returns The owned configuration, not yet validated
|
|
292
384
|
*/
|
|
@@ -373,6 +465,14 @@ export declare function collectStudyEntries(profile: StudyProfile): readonly str
|
|
|
373
465
|
*/
|
|
374
466
|
export declare function collectStudyEvidence(result: StudySealedResult): Promise<Readonly<Record<string, readonly StudyEvidence[]>>>;
|
|
375
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
|
+
|
|
376
476
|
/**
|
|
377
477
|
* Groups failed records by cause, role, and layer, each group carrying its source readings.
|
|
378
478
|
* @remarks
|
|
@@ -565,12 +665,40 @@ export declare function gradeStudyEvidence(input: StudyAdjudication, grade: Stud
|
|
|
565
665
|
*/
|
|
566
666
|
export declare function hashStudyBytes(input: string | Uint8Array): string;
|
|
567
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
|
+
|
|
568
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.
|
|
569
679
|
* @param value - The caught value.
|
|
570
680
|
* @returns True if the value is an artifact error; false otherwise.
|
|
571
681
|
*/
|
|
572
682
|
export declare function isArtifactError(value: unknown): value is ArtifactError;
|
|
573
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
|
+
|
|
574
702
|
/** Checks whether a factory returned the complete consumer adapter contract.
|
|
575
703
|
* @param value - The unknown factory result.
|
|
576
704
|
* @returns True if validation, construction, and grading are callable; false otherwise.
|
|
@@ -605,6 +733,12 @@ export declare function isStudyAgentResponse(value: unknown): value is StudyAgen
|
|
|
605
733
|
*/
|
|
606
734
|
export declare function isStudyCharge(value: unknown): value is StudyCharge;
|
|
607
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
|
+
|
|
608
742
|
/**
|
|
609
743
|
* Checks whether an attempt terminally accounts for the exact scheduled goal horizon.
|
|
610
744
|
* @param value - The candidate attempt
|
|
@@ -718,6 +852,48 @@ export declare function isStudyCustodyTrial(value: unknown): value is StudyTrial
|
|
|
718
852
|
*/
|
|
719
853
|
export declare function isStudyEvidence(value: unknown): value is StudyEvidence;
|
|
720
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
|
+
|
|
721
897
|
/** Checks the complete transport envelope before domain handling.
|
|
722
898
|
* @param value - Native IPC decoded value.
|
|
723
899
|
* @returns True if the envelope is bounded in shape and JSON-compatible; false otherwise.
|
|
@@ -730,12 +906,42 @@ export declare function isStudyFrame(value: unknown): value is StudyFrame;
|
|
|
730
906
|
*/
|
|
731
907
|
export declare function isStudyIdentity(value: unknown): value is StudyIdentity;
|
|
732
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
|
+
|
|
733
933
|
/** Checks operational failure attribution arriving over IPC.
|
|
734
934
|
* @param value - Decoded failure value.
|
|
735
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.
|
|
736
936
|
*/
|
|
737
937
|
export declare function isStudyProcessFailure(value: unknown): value is StudyFailure;
|
|
738
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
|
+
|
|
739
945
|
/** Checks a fresh trial's declared identifiers.
|
|
740
946
|
* @param value - Decoded trial.
|
|
741
947
|
* @returns True if every identifier and repetition is valid; false otherwise.
|
|
@@ -748,6 +954,12 @@ export declare function isStudyTrial(value: unknown): value is StudyTrial;
|
|
|
748
954
|
*/
|
|
749
955
|
export declare function iterateArtifactEntries(handle: Dir): Generator<Dirent, void>;
|
|
750
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
|
+
|
|
751
963
|
/** Reports whether a caught value is a Node error carrying the given system code.
|
|
752
964
|
* @remarks Requires an `Error` from this realm. Structured cloning, such as a worker's `postMessage`,
|
|
753
965
|
* drops a Node error's system code, so the cloned error does not match.
|
|
@@ -778,6 +990,12 @@ export declare function matchesSystemError(value: unknown, code: string): boolea
|
|
|
778
990
|
*/
|
|
779
991
|
export declare function parseStudyArguments(arguments_: readonly string[]): StudyCommandRequest;
|
|
780
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
|
+
|
|
781
999
|
/** Reads a bounded regular file only through its canonical absolute path.
|
|
782
1000
|
* @param path - The absolute path to inspect.
|
|
783
1001
|
* @param maximum - The remaining capture budget; Default: 16 MiB.
|
|
@@ -794,6 +1012,13 @@ export declare function readArtifact(path: string, maximum?: number): ArtifactSo
|
|
|
794
1012
|
*/
|
|
795
1013
|
export declare function readArtifactBytes(descriptor: number, target: Buffer, offset?: number): Buffer;
|
|
796
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
|
+
|
|
797
1022
|
/** Reads a complete adapter from an admitted module namespace.
|
|
798
1023
|
* @param namespace - The captured consumer module.
|
|
799
1024
|
* @returns The validated adapter instance.
|
|
@@ -849,6 +1074,13 @@ export declare function readStudyAgentToolCall(call: unknown): ToolCall;
|
|
|
849
1074
|
*/
|
|
850
1075
|
export declare function readStudyBytes(path: string, limit: number): Promise<Uint8Array>;
|
|
851
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
|
+
|
|
852
1084
|
/** Reads a study declaration, its driver's scenarios, and its rubric as the command resolves them.
|
|
853
1085
|
* @param root - The consumer root containing the studies directory.
|
|
854
1086
|
* @param study - The selected study name.
|
|
@@ -882,6 +1114,20 @@ export declare function readStudyDeclaration(root: string, study: string, signal
|
|
|
882
1114
|
*/
|
|
883
1115
|
export declare function readStudyDeclarationBytes(root: string, path: string): Promise<Uint8Array>;
|
|
884
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
|
+
|
|
885
1131
|
/**
|
|
886
1132
|
* Reads from an open file handle into a buffer until the buffer is full or the file ends.
|
|
887
1133
|
* @param handle - The open file handle to read
|
|
@@ -953,6 +1199,28 @@ export declare function readStudyOllamaTerminal(value: unknown, request: StudyOl
|
|
|
953
1199
|
*/
|
|
954
1200
|
export declare function readStudyOllamaTiming(extract: StudyOllamaTransportOptions['timing'], record: Readonly<Record<string, unknown>>): OllamaTiming | undefined;
|
|
955
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
|
+
|
|
956
1224
|
/**
|
|
957
1225
|
* Inspects custody bytes offline and verifies complete execution before grading.
|
|
958
1226
|
* @param directory - The result directory
|
|
@@ -965,6 +1233,15 @@ export declare function readStudyOllamaTiming(extract: StudyOllamaTransportOptio
|
|
|
965
1233
|
*/
|
|
966
1234
|
export declare function readStudyResult(directory: string): Promise<StudyResultReading>;
|
|
967
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
|
+
|
|
968
1245
|
/** Reads the version of the study package that owns an executable entry.
|
|
969
1246
|
* @param entry - The installed runtime's executable entry.
|
|
970
1247
|
* @returns The non-empty version declared by the owning study package.
|
|
@@ -979,6 +1256,14 @@ export declare function readStudyResult(directory: string): Promise<StudyResultR
|
|
|
979
1256
|
*/
|
|
980
1257
|
export declare function readStudyVersion(entry: string): string;
|
|
981
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
|
+
|
|
982
1267
|
/** Enforces captured inventory membership at every synchronous native import edge. */
|
|
983
1268
|
export declare class Resolution {
|
|
984
1269
|
#private;
|
|
@@ -1002,6 +1287,21 @@ export declare class Resolution {
|
|
|
1002
1287
|
load(href: string, context: LoadHookContext, next: ArtifactLoadHandler): LoadFnOutput;
|
|
1003
1288
|
}
|
|
1004
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
|
+
|
|
1005
1305
|
/**
|
|
1006
1306
|
* Resolves the content a scripted response serves, from its declaration or from a prior tool message.
|
|
1007
1307
|
* @param request - The projected actual request messages
|
|
@@ -1011,6 +1311,14 @@ export declare class Resolution {
|
|
|
1011
1311
|
*/
|
|
1012
1312
|
export declare function resolveStudyAgentContent(request: readonly JSONValue[], response: StudyAgentResponse): string;
|
|
1013
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
|
+
|
|
1014
1322
|
/** Resolves the actual host package from its trusted executable entry.
|
|
1015
1323
|
* @param entry - The runtime's own executable, never a consumer-supplied module.
|
|
1016
1324
|
* @returns The canonical study package root.
|
|
@@ -1034,13 +1342,14 @@ export declare function resolveStudyPath(directory: string, path: string): strin
|
|
|
1034
1342
|
* Resolves the execution profile's caller-selected built artifact paths.
|
|
1035
1343
|
* @param root - The repository root
|
|
1036
1344
|
* @param profile - The validated source profile
|
|
1345
|
+
* @param closure - The optional verified physical forest used to relocate executable selections
|
|
1037
1346
|
* @returns The reproducible resolved execution profile
|
|
1038
1347
|
* @example
|
|
1039
1348
|
* ```ts
|
|
1040
1349
|
* resolveStudyProfile(root, profile)
|
|
1041
1350
|
* ```
|
|
1042
1351
|
*/
|
|
1043
|
-
export declare function resolveStudyProfile(root: string, profile: StudyProfile): StudyProfile;
|
|
1352
|
+
export declare function resolveStudyProfile(root: string, profile: StudyProfile, closure?: ArtifactClosure): StudyProfile;
|
|
1044
1353
|
|
|
1045
1354
|
/**
|
|
1046
1355
|
* Scans regular execution files while refusing unknown directories and linked paths.
|
|
@@ -1064,7 +1373,7 @@ export declare function scanStudyExecution(directory: string, manifest: StudyMan
|
|
|
1064
1373
|
* @returns The admitted files in read order: this directory's files, then each admitted subdirectory's, last listed first
|
|
1065
1374
|
* @throws StudyError - Thrown when the tree holds a link, an unknown directory or file, or a file beyond the remaining allowance
|
|
1066
1375
|
*/
|
|
1067
|
-
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[]>;
|
|
1068
1377
|
|
|
1069
1378
|
/** Caps declared execution duration at the native supervisor's host ceiling. */
|
|
1070
1379
|
export declare const STUDY_COMMAND_DURATION = 86400000;
|
|
@@ -1073,7 +1382,7 @@ export declare const STUDY_COMMAND_DURATION = 86400000;
|
|
|
1073
1382
|
export declare const STUDY_COMMAND_GRADER = "consumer-adapter";
|
|
1074
1383
|
|
|
1075
1384
|
/** Defines the complete public CLI reference shared by help and grammar diagnostics. */
|
|
1076
|
-
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\nstudy --version\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";
|
|
1077
1386
|
|
|
1078
1387
|
/** Names the command route beneath the native supervisor. */
|
|
1079
1388
|
export declare const STUDY_COMMAND_OPERATION = "study-command";
|
|
@@ -1408,6 +1717,8 @@ export declare interface StudyArtifactLoaderOptions {
|
|
|
1408
1717
|
readonly root: string;
|
|
1409
1718
|
readonly profile: StudyProfile;
|
|
1410
1719
|
readonly adapter: string;
|
|
1720
|
+
/** Selects relocated captured bytes and their checked identity instead of original paths. */
|
|
1721
|
+
readonly closure?: StudyClosure;
|
|
1411
1722
|
}
|
|
1412
1723
|
|
|
1413
1724
|
/** Holds actual namespaces loaded only during worker execution. */
|
|
@@ -1475,6 +1786,26 @@ export declare class StudyCLI {
|
|
|
1475
1786
|
execute(arguments_: readonly string[]): Promise<number>;
|
|
1476
1787
|
}
|
|
1477
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
|
+
|
|
1478
1809
|
/** Executes validated study operations with execution and grading custody kept independent. */
|
|
1479
1810
|
export declare class StudyCommand {
|
|
1480
1811
|
#private;
|
|
@@ -1506,7 +1837,7 @@ export declare interface StudyCommandOptions {
|
|
|
1506
1837
|
}
|
|
1507
1838
|
|
|
1508
1839
|
/** Names the independently dispatched study command operation. */
|
|
1509
|
-
export declare type StudyCommandRequest = StudyExecutionRequest | StudyGradeRequest | StudyLabelRequest | StudyReportRequest;
|
|
1840
|
+
export declare type StudyCommandRequest = StudyExecutionRequest | StudyFreezeRequest | StudyGradeRequest | StudyLabelRequest | StudyReportRequest;
|
|
1510
1841
|
|
|
1511
1842
|
/** Holds the evidence sink's shared admission budget. */
|
|
1512
1843
|
export declare interface StudyCustodyBudget {
|
|
@@ -1524,6 +1855,78 @@ export declare interface StudyCustodySinkInterface extends StudySinkInterface {
|
|
|
1524
1855
|
close(): Promise<void>;
|
|
1525
1856
|
}
|
|
1526
1857
|
|
|
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>;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
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.
|
|
1907
|
+
*/
|
|
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
|
+
|
|
1527
1930
|
/** Holds a parsed study declaration with its driver bundle, scenarios, scenario fixtures, and rubric. */
|
|
1528
1931
|
export declare interface StudyDeclaration {
|
|
1529
1932
|
readonly bundle: string;
|
|
@@ -1540,6 +1943,10 @@ export declare interface StudyDriverOptions {
|
|
|
1540
1943
|
readonly provider: unknown;
|
|
1541
1944
|
readonly profile: StudyProfile;
|
|
1542
1945
|
readonly directory: string;
|
|
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;
|
|
1543
1950
|
}
|
|
1544
1951
|
|
|
1545
1952
|
/** Retains admitted evidence in order and closes admission before terminal records. */
|
|
@@ -1573,6 +1980,183 @@ export declare interface StudyEvidenceSinkOptions {
|
|
|
1573
1980
|
readonly budget: StudyCustodyBudget;
|
|
1574
1981
|
}
|
|
1575
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
|
+
|
|
1576
2160
|
/** Holds a checked execution selection with optional output custody. */
|
|
1577
2161
|
export declare interface StudyExecutionRequest {
|
|
1578
2162
|
readonly command: 'check' | 'execute';
|
|
@@ -1581,6 +2165,10 @@ export declare interface StudyExecutionRequest {
|
|
|
1581
2165
|
/** Selects an absolute output or a portable path contained by the consumer root. */
|
|
1582
2166
|
readonly out: string | undefined;
|
|
1583
2167
|
readonly expected: string | 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;
|
|
1584
2172
|
}
|
|
1585
2173
|
|
|
1586
2174
|
/** Holds the exact byte identity of one execution file. */
|
|
@@ -1597,6 +2185,15 @@ export declare interface StudyFrame {
|
|
|
1597
2185
|
readonly value: JSONValue;
|
|
1598
2186
|
}
|
|
1599
2187
|
|
|
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;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
1600
2197
|
/** Reads one declared target against the consumer's domain predicate. */
|
|
1601
2198
|
export declare type StudyGradeFunction = (target: StudyGradeTarget) => StudyGradeReading;
|
|
1602
2199
|
|
|
@@ -1716,10 +2313,60 @@ export declare type StudyMessageHandler = (operation: StudyOperation, value: JSO
|
|
|
1716
2313
|
export declare interface StudyOllamaActivity {
|
|
1717
2314
|
readonly goal: string;
|
|
1718
2315
|
readonly context: StudyContext;
|
|
1719
|
-
/** Holds the
|
|
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. */
|
|
1720
2317
|
readonly checkpoint: JSONValue | undefined;
|
|
1721
2318
|
}
|
|
1722
2319
|
|
|
2320
|
+
/** Declares a captured request's positive safe byte length without predicting its content.
|
|
2321
|
+
* @remarks
|
|
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.
|
|
2324
|
+
*/
|
|
2325
|
+
export declare interface StudyOllamaCaptureStep extends StudyOllamaStepIdentity {
|
|
2326
|
+
readonly admission: 'capture';
|
|
2327
|
+
readonly bytes: number;
|
|
2328
|
+
readonly body?: never;
|
|
2329
|
+
readonly input?: never;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
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;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
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>;
|
|
2357
|
+
|
|
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;
|
|
2367
|
+
readonly duration: number;
|
|
2368
|
+
}
|
|
2369
|
+
|
|
1723
2370
|
/** Pins one served model identity the inventory verifies. */
|
|
1724
2371
|
export declare interface StudyOllamaModel {
|
|
1725
2372
|
readonly name: string;
|
|
@@ -1754,6 +2401,79 @@ export declare interface StudyOllamaPolicy {
|
|
|
1754
2401
|
readonly length: boolean;
|
|
1755
2402
|
}
|
|
1756
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
|
+
|
|
1757
2477
|
/** Holds validated wire dispatch facts without retaining payload text. */
|
|
1758
2478
|
export declare interface StudyOllamaRequest {
|
|
1759
2479
|
readonly role: StudyRole;
|
|
@@ -1788,6 +2508,27 @@ export declare interface StudyOllamaSnapshot {
|
|
|
1788
2508
|
readonly dispatch: StudyAgentDispatch | undefined;
|
|
1789
2509
|
}
|
|
1790
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
|
+
|
|
1791
2532
|
/** Holds a validated terminal's finish reason and actual usage, unknown when unreported. */
|
|
1792
2533
|
export declare interface StudyOllamaTerminal {
|
|
1793
2534
|
readonly prompt: number | undefined;
|
|
@@ -1849,21 +2590,44 @@ export declare class StudyOllamaTransport implements StudyLatchInterface {
|
|
|
1849
2590
|
* the served identities, keyed by the label their inventory evidence carries. `roles` declares the
|
|
1850
2591
|
* wire policy of every model role the consumer dispatches; an undeclared role is refused.
|
|
1851
2592
|
* `signal` cancels all work. `observe`: if `true`, existing evidence rows gain passive timing and
|
|
1852
|
-
* 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.
|
|
1853
2597
|
*/
|
|
1854
2598
|
export declare interface StudyOllamaTransportOptions {
|
|
1855
2599
|
readonly url: string;
|
|
1856
2600
|
readonly room: Pick<StudyRoom, 'context' | 'safety'>;
|
|
1857
2601
|
readonly limit: Pick<StudyLimit, 'duration' | 'bytes'>;
|
|
1858
2602
|
readonly models: Readonly<Record<string, StudyOllamaModel>>;
|
|
1859
|
-
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
|
+
};
|
|
1860
2607
|
readonly signal: AbortSignal;
|
|
1861
2608
|
readonly observe: boolean;
|
|
1862
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;
|
|
1863
2619
|
}
|
|
1864
2620
|
|
|
1865
2621
|
/** Tracks one owned HTTP response until its end or cancellation. */
|
|
1866
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;
|
|
1867
2631
|
readonly activity: StudyOllamaActivity;
|
|
1868
2632
|
readonly request: StudyOllamaRequest;
|
|
1869
2633
|
readonly ticket: StudyTicket;
|
|
@@ -1934,6 +2698,8 @@ export declare interface StudyPreparation {
|
|
|
1934
2698
|
readonly identity: StudyIdentity;
|
|
1935
2699
|
readonly artifacts: StudyArtifactLoader;
|
|
1936
2700
|
readonly source: string;
|
|
2701
|
+
/** Carries the verified closure publication when preparation uses relocated inputs. */
|
|
2702
|
+
readonly closure?: StudyClosure;
|
|
1937
2703
|
}
|
|
1938
2704
|
|
|
1939
2705
|
/** Opens one fresh native child for each scheduled trial. */
|
|
@@ -1942,7 +2708,7 @@ export declare class StudyProcessDriver implements StudyDriverInterface {
|
|
|
1942
2708
|
/** Owns immutable resolved launch settings.
|
|
1943
2709
|
* @param options - Built entry, admitted identities and exclusive scratch parent.
|
|
1944
2710
|
*/
|
|
1945
|
-
constructor(options:
|
|
2711
|
+
constructor(options: StudyProcessDriverOptions);
|
|
1946
2712
|
/** Opens isolated child state and waits for its verified readiness.
|
|
1947
2713
|
* @param trial - The public scheduled trial.
|
|
1948
2714
|
* @param signal - Authoritative parent cancellation.
|
|
@@ -1951,6 +2717,11 @@ export declare class StudyProcessDriver implements StudyDriverInterface {
|
|
|
1951
2717
|
open(trial: StudyTrial, signal: AbortSignal): Promise<StudySessionInterface>;
|
|
1952
2718
|
}
|
|
1953
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
|
+
|
|
1954
2725
|
/** Holds one goal's parent context and the worker admission sequence it issues while the goal runs.
|
|
1955
2726
|
* @example Issue worker admissions in sequence
|
|
1956
2727
|
* ```ts
|
|
@@ -1986,6 +2757,10 @@ export declare interface StudyProcessOptions extends StudyArtifactLoaderOptions
|
|
|
1986
2757
|
readonly identity: StudyIdentity;
|
|
1987
2758
|
readonly driver: string;
|
|
1988
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;
|
|
1989
2764
|
}
|
|
1990
2765
|
|
|
1991
2766
|
/** Keeps admission and evidence custody in the parent of one fresh trial process. */
|
|
@@ -2013,6 +2788,12 @@ export declare interface StudyProcessSessionOptions extends StudyProcessOptions
|
|
|
2013
2788
|
readonly signal: AbortSignal;
|
|
2014
2789
|
}
|
|
2015
2790
|
|
|
2791
|
+
/** Holds a strictly verified successful request and response pair. */
|
|
2792
|
+
export declare interface StudyRecordedExchange {
|
|
2793
|
+
readonly attempt: StudyExchangeAttempt;
|
|
2794
|
+
readonly response: StudyExchangeResponse;
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2016
2797
|
/** Cites a retained trial file, or one evidence row of it by its zero-based position. */
|
|
2017
2798
|
export declare interface StudyReference {
|
|
2018
2799
|
readonly file: StudyReferenceFile;
|
|
@@ -2123,6 +2904,11 @@ export declare class StudyResultStore implements StudyResultStoreInterface {
|
|
|
2123
2904
|
* @throws StudyError - Thrown when creation repeats or custody bounds are exceeded
|
|
2124
2905
|
*/
|
|
2125
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>;
|
|
2126
2912
|
/**
|
|
2127
2913
|
* Exclusively creates the evidence sink for an exact scheduled trial.
|
|
2128
2914
|
* @param trial - The scheduled trajectory
|
|
@@ -2155,6 +2941,11 @@ export declare interface StudyResultStoreInterface extends StudyStoreInterface {
|
|
|
2155
2941
|
* @returns The synchronized execution seal.
|
|
2156
2942
|
*/
|
|
2157
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>;
|
|
2158
2949
|
}
|
|
2159
2950
|
|
|
2160
2951
|
/** Holds the inert execution store configuration. */
|
|
@@ -2201,6 +2992,8 @@ export declare interface StudyTaskOptions {
|
|
|
2201
2992
|
readonly adapter: string;
|
|
2202
2993
|
readonly roots: readonly string[];
|
|
2203
2994
|
readonly duration?: number;
|
|
2995
|
+
/** Binds fresh adapter validation to the already verified relocated selection. */
|
|
2996
|
+
readonly closure?: StudyClosure;
|
|
2204
2997
|
}
|
|
2205
2998
|
|
|
2206
2999
|
/** Carries only declarations or sealed evidence to an adapter child. */
|
|
@@ -2231,6 +3024,20 @@ export declare interface StudyTrialCustody {
|
|
|
2231
3024
|
readonly terminal: Promise<void> | undefined;
|
|
2232
3025
|
}
|
|
2233
3026
|
|
|
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>;
|
|
3040
|
+
|
|
2234
3041
|
/** Holds declarations for domain validation before agent, subject or provider execution. */
|
|
2235
3042
|
export declare interface StudyValidation {
|
|
2236
3043
|
readonly definition: StudyDefinition;
|
|
@@ -2282,6 +3089,33 @@ export declare function translateStudyPacketLabeling(result: StudySealedResult,
|
|
|
2282
3089
|
*/
|
|
2283
3090
|
export declare function validateStudyEvidenceBytes(bytes: Uint8Array, manifest: StudyManifest, trial: string): void;
|
|
2284
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
|
+
|
|
2285
3119
|
/**
|
|
2286
3120
|
* Checks terminal policy after the actual wire cost has been retained.
|
|
2287
3121
|
* @param terminal - The valid terminal facts
|
|
@@ -2301,6 +3135,13 @@ export declare function validateStudyOllamaCompletion(terminal: StudyOllamaTermi
|
|
|
2301
3135
|
*/
|
|
2302
3136
|
export declare function validateStudyOllamaInventory(value: unknown, models: StudyOllamaTransportOptions['models']): void;
|
|
2303
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
|
+
|
|
2304
3145
|
/**
|
|
2305
3146
|
* Validates declared role policies against the pinned inventory before any dispatch.
|
|
2306
3147
|
* @param roles - The declared wire policy of each model role
|
|
@@ -2310,6 +3151,16 @@ export declare function validateStudyOllamaInventory(value: unknown, models: Stu
|
|
|
2310
3151
|
*/
|
|
2311
3152
|
export declare function validateStudyOllamaRoles(roles: StudyOllamaTransportOptions['roles'], models: StudyOllamaTransportOptions['models']): void;
|
|
2312
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
|
+
|
|
2313
3164
|
/** Refuses a profile that omits the actual host runtime's declared dependency bytes.
|
|
2314
3165
|
* @param instrument - The canonical package owning the trusted runtime entry.
|
|
2315
3166
|
* @param roots - Explicitly admitted package roots, including the instrument.
|
|
@@ -2328,6 +3179,14 @@ export declare function validateStudyRuntime(instrument: string, roots: readonly
|
|
|
2328
3179
|
*/
|
|
2329
3180
|
export declare function valueToWire(value: unknown): JSONValue;
|
|
2330
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
|
+
|
|
2331
3190
|
/**
|
|
2332
3191
|
* Writes an exclusive regular record and synchronizes it before reporting success.
|
|
2333
3192
|
* @param path - The new custody path
|