@orkestrel/study 0.0.1 → 0.0.2
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 +47 -6
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +16 -4
- package/dist/src/core/index.d.ts +16 -4
- package/dist/src/core/index.js +48 -8
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +677 -2282
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +154 -446
- package/dist/src/server/index.d.ts +154 -446
- package/dist/src/server/index.js +395 -2007
- package/dist/src/server/index.js.map +1 -1
- package/package.json +15 -6
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
2
|
import type { Dir } from 'node:fs';
|
|
3
3
|
import type { Dirent } from 'node:fs';
|
|
4
|
-
import type { estimateRequest } from '@orkestrel/agent';
|
|
5
4
|
import type { extractTiming } from '@orkestrel/ollama';
|
|
6
5
|
import type { FileHandle } from 'node:fs/promises';
|
|
7
|
-
import type { isAgentError } from '@orkestrel/agent';
|
|
8
6
|
import type { JSONValue } from '@orkestrel/contract';
|
|
9
7
|
import type { LedgerGauge } from '@orkestrel/agent';
|
|
10
8
|
import type { LoadFnOutput } from 'node:module';
|
|
11
9
|
import type { LoadHookContext } from 'node:module';
|
|
12
10
|
import type { LoadHookSync } from 'node:module';
|
|
13
|
-
import type { measureRequest } from '@orkestrel/agent';
|
|
14
11
|
import type { Message } from '@orkestrel/agent';
|
|
15
12
|
import type { OllamaOptions } from '@orkestrel/ollama';
|
|
16
13
|
import type { OllamaTiming } from '@orkestrel/ollama';
|
|
@@ -21,6 +18,44 @@ import type { ProviderResult } from '@orkestrel/agent';
|
|
|
21
18
|
import type { ResolveFnOutput } from 'node:module';
|
|
22
19
|
import type { ResolveHookContext } from 'node:module';
|
|
23
20
|
import type { ResolveHookSync } from 'node:module';
|
|
21
|
+
import type { StudyAdmissionInterface } from '@orkestrel/study';
|
|
22
|
+
import type { StudyAgentDispatch } from '@orkestrel/study';
|
|
23
|
+
import type { StudyAgentReading } from '@orkestrel/study';
|
|
24
|
+
import type { StudyAgentRuntime } from '@orkestrel/study';
|
|
25
|
+
import type { StudyAttempt } from '@orkestrel/study';
|
|
26
|
+
import type { StudyBounds } from '@orkestrel/study';
|
|
27
|
+
import type { StudyCharge } from '@orkestrel/study';
|
|
28
|
+
import type { StudyContext } from '@orkestrel/study';
|
|
29
|
+
import type { StudyControl } from '@orkestrel/study';
|
|
30
|
+
import type { StudyCriterion } from '@orkestrel/study';
|
|
31
|
+
import type { StudyDefinition } from '@orkestrel/study';
|
|
32
|
+
import type { StudyDriverInterface } from '@orkestrel/study';
|
|
33
|
+
import { StudyError } from '@orkestrel/study';
|
|
34
|
+
import type { StudyEvidence } from '@orkestrel/study';
|
|
35
|
+
import type { StudyFailure } from '@orkestrel/study';
|
|
36
|
+
import type { StudyGoal } from '@orkestrel/study';
|
|
37
|
+
import type { StudyGrading } from '@orkestrel/study';
|
|
38
|
+
import type { StudyIdentity } from '@orkestrel/study';
|
|
39
|
+
import type { StudyJudgment } from '@orkestrel/study';
|
|
40
|
+
import type { StudyLabeling } from '@orkestrel/study';
|
|
41
|
+
import type { StudyLatchInterface } from '@orkestrel/study';
|
|
42
|
+
import type { StudyLimit } from '@orkestrel/study';
|
|
43
|
+
import type { StudyManifest } from '@orkestrel/study';
|
|
44
|
+
import type { StudyObservation } from '@orkestrel/study';
|
|
45
|
+
import type { StudyProduct } from '@orkestrel/study';
|
|
46
|
+
import type { StudyProfile } from '@orkestrel/study';
|
|
47
|
+
import type { StudyProvider } from '@orkestrel/study';
|
|
48
|
+
import type { StudyRole } from '@orkestrel/study';
|
|
49
|
+
import type { StudyRoom } from '@orkestrel/study';
|
|
50
|
+
import type { StudyRubric } from '@orkestrel/study';
|
|
51
|
+
import type { StudyScenario } from '@orkestrel/study';
|
|
52
|
+
import type { StudySessionInterface } from '@orkestrel/study';
|
|
53
|
+
import type { StudySinkInterface } from '@orkestrel/study';
|
|
54
|
+
import type { StudyStoreInterface } from '@orkestrel/study';
|
|
55
|
+
import type { StudyTicket } from '@orkestrel/study';
|
|
56
|
+
import type { StudyTrial } from '@orkestrel/study';
|
|
57
|
+
import type { StudyUsage } from '@orkestrel/study';
|
|
58
|
+
import type { ToolCall } from '@orkestrel/tool';
|
|
24
59
|
|
|
25
60
|
/** Bounds all captured input bytes to 128 MiB. */
|
|
26
61
|
export declare const ARTIFACT_BYTES: number;
|
|
@@ -174,6 +209,32 @@ export declare function buildStudyAgentReadings(result: unknown): JSONValue;
|
|
|
174
209
|
*/
|
|
175
210
|
export declare function buildStudyAgentRevision(request: ProviderRequest): string | undefined;
|
|
176
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Builds the JSON evidence form of an Agent tool call the Agent denied before dispatch.
|
|
214
|
+
* @param call - The call received from the admitted Agent
|
|
215
|
+
* @param reason - The denial reason, retained only when it is a string
|
|
216
|
+
* @returns The call identity with the optional string reason
|
|
217
|
+
* @throws StudyError - Thrown with code `FAULT` when the call is malformed
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* buildStudyAgentToolDenial(call, 'refused')
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare function buildStudyAgentToolDenial(call: unknown, reason: unknown): JSONValue;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Builds the JSON evidence form of an Agent tool call and its executed result.
|
|
227
|
+
* @param call - The call received from the admitted Agent
|
|
228
|
+
* @param result - The executed tool result
|
|
229
|
+
* @returns The call identity, owned arguments, success, and owned value or error text
|
|
230
|
+
* @throws StudyError - Thrown with code `FAULT` when the call, result, arguments, or value is malformed
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* buildStudyAgentToolResult(call, { success: true, value: 'stored' })
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
export declare function buildStudyAgentToolResult(call: unknown, result: unknown): JSONValue;
|
|
237
|
+
|
|
177
238
|
/**
|
|
178
239
|
* Declares the pinned serving identities the Ollama transport verifies, keyed by the label their inventory evidence carries.
|
|
179
240
|
* @param provider - Declared serving identities
|
|
@@ -687,6 +748,23 @@ export declare function isStudyTrial(value: unknown): value is StudyTrial;
|
|
|
687
748
|
*/
|
|
688
749
|
export declare function iterateArtifactEntries(handle: Dir): Generator<Dirent, void>;
|
|
689
750
|
|
|
751
|
+
/** Reports whether a caught value is a Node error carrying the given system code.
|
|
752
|
+
* @remarks Requires an `Error` from this realm. Structured cloning, such as a worker's `postMessage`,
|
|
753
|
+
* drops a Node error's system code, so the cloned error does not match.
|
|
754
|
+
* @param value - The caught value.
|
|
755
|
+
* @param code - The system error code to match.
|
|
756
|
+
* @returns True if the value is an Error from this realm carrying the code; false otherwise.
|
|
757
|
+
* @example Match a system error
|
|
758
|
+
* ```ts
|
|
759
|
+
* import { matchesSystemError } from '@orkestrel/study/server'
|
|
760
|
+
*
|
|
761
|
+
* const error = Object.assign(new Error('Missing declaration'), { code: 'ENOENT' })
|
|
762
|
+
* matchesSystemError(error, 'ENOENT') // true
|
|
763
|
+
* matchesSystemError({ code: 'ENOENT' }, 'ENOENT') // false
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
export declare function matchesSystemError(value: unknown, code: string): boolean;
|
|
767
|
+
|
|
690
768
|
/** Parses public command tokens with operation-specific grammar diagnostics.
|
|
691
769
|
* @param arguments_ - Exact command tokens, after the CLI help boundary.
|
|
692
770
|
* @returns The independent operation request.
|
|
@@ -741,6 +819,23 @@ export declare function readStudyAgentMessages(value: unknown): readonly JSONVal
|
|
|
741
819
|
*/
|
|
742
820
|
export declare function readStudyAgentResult(stream: AsyncGenerator<ProviderDelta, ProviderResult>): Promise<ProviderResult>;
|
|
743
821
|
|
|
822
|
+
/**
|
|
823
|
+
* Reads an Agent tool call into a validated envelope from one read of each foreign field.
|
|
824
|
+
* @remarks The returned envelope owns its fields; arguments retain their original record identity.
|
|
825
|
+
* JSON validation and copying belong to the executed-result projection.
|
|
826
|
+
* @param call - The call received from the admitted Agent
|
|
827
|
+
* @returns A fresh ToolCall envelope with the original arguments record
|
|
828
|
+
* @throws StudyError - Thrown with code `FAULT` when a field cannot be read or the envelope is malformed
|
|
829
|
+
* @example Read an Agent tool call
|
|
830
|
+
* ```ts
|
|
831
|
+
* import { readStudyAgentToolCall } from '@orkestrel/study/server'
|
|
832
|
+
*
|
|
833
|
+
* const call = readStudyAgentToolCall({ id: 'c1', name: 'write', arguments: { path: 'note.txt' } })
|
|
834
|
+
* // { id: 'c1', name: 'write', arguments: { path: 'note.txt' } }
|
|
835
|
+
* ```
|
|
836
|
+
*/
|
|
837
|
+
export declare function readStudyAgentToolCall(call: unknown): ToolCall;
|
|
838
|
+
|
|
744
839
|
/**
|
|
745
840
|
* Reads bounded regular-file bytes without following a symbolic link.
|
|
746
841
|
* @param path - The custody file path
|
|
@@ -754,6 +849,39 @@ export declare function readStudyAgentResult(stream: AsyncGenerator<ProviderDelt
|
|
|
754
849
|
*/
|
|
755
850
|
export declare function readStudyBytes(path: string, limit: number): Promise<Uint8Array>;
|
|
756
851
|
|
|
852
|
+
/** Reads a study declaration, its driver's scenarios, and its rubric as the command resolves them.
|
|
853
|
+
* @param root - The consumer root containing the studies directory.
|
|
854
|
+
* @param study - The selected study name.
|
|
855
|
+
* @param signal - Optional cancellation checked between scenario reads.
|
|
856
|
+
* @returns The parsed declaration, driver bundle, ordered scenarios, fixtures, and selected rubric.
|
|
857
|
+
* @throws StudyError - Thrown when declarations are missing, invalid, or incompatible.
|
|
858
|
+
* @example Read a study declaration
|
|
859
|
+
* ```ts
|
|
860
|
+
* import type { StudyDeclaration } from '@orkestrel/study/server'
|
|
861
|
+
* import { readStudyDeclaration } from '@orkestrel/study/server'
|
|
862
|
+
*
|
|
863
|
+
* declare const root: string
|
|
864
|
+
* const declaration: StudyDeclaration = await readStudyDeclaration(root, 'assessment')
|
|
865
|
+
* ```
|
|
866
|
+
*/
|
|
867
|
+
export declare function readStudyDeclaration(root: string, study: string, signal?: AbortSignal): Promise<StudyDeclaration>;
|
|
868
|
+
|
|
869
|
+
/** Reads one declaration file and refuses a missing or linked path with its root-relative path.
|
|
870
|
+
* @param root - The consumer root used to describe a missing or linked declaration.
|
|
871
|
+
* @param path - The already resolved and contained declaration path.
|
|
872
|
+
* @returns The exact declaration bytes under the custody metadata allowance.
|
|
873
|
+
* @throws StudyError - Thrown with code `CONFIG` when the path is missing or linked; other custody refusals retain their codes.
|
|
874
|
+
* @example Read declaration bytes
|
|
875
|
+
* ```ts
|
|
876
|
+
* import { readStudyDeclarationBytes } from '@orkestrel/study/server'
|
|
877
|
+
*
|
|
878
|
+
* declare const root: string
|
|
879
|
+
* declare const path: string
|
|
880
|
+
* await readStudyDeclarationBytes(root, path)
|
|
881
|
+
* ```
|
|
882
|
+
*/
|
|
883
|
+
export declare function readStudyDeclarationBytes(root: string, path: string): Promise<Uint8Array>;
|
|
884
|
+
|
|
757
885
|
/**
|
|
758
886
|
* Reads from an open file handle into a buffer until the buffer is full or the file ends.
|
|
759
887
|
* @param handle - The open file handle to read
|
|
@@ -837,6 +965,20 @@ export declare function readStudyOllamaTiming(extract: StudyOllamaTransportOptio
|
|
|
837
965
|
*/
|
|
838
966
|
export declare function readStudyResult(directory: string): Promise<StudyResultReading>;
|
|
839
967
|
|
|
968
|
+
/** Reads the version of the study package that owns an executable entry.
|
|
969
|
+
* @param entry - The installed runtime's executable entry.
|
|
970
|
+
* @returns The non-empty version declared by the owning study package.
|
|
971
|
+
* @throws StudyError - Thrown when no study package owns the entry or its version is absent or empty.
|
|
972
|
+
* @example Read the installed version
|
|
973
|
+
* ```ts
|
|
974
|
+
* import { readStudyVersion } from '@orkestrel/study/server'
|
|
975
|
+
*
|
|
976
|
+
* declare const entry: string
|
|
977
|
+
* readStudyVersion(entry)
|
|
978
|
+
* ```
|
|
979
|
+
*/
|
|
980
|
+
export declare function readStudyVersion(entry: string): string;
|
|
981
|
+
|
|
840
982
|
/** Enforces captured inventory membership at every synchronous native import edge. */
|
|
841
983
|
export declare class Resolution {
|
|
842
984
|
#private;
|
|
@@ -931,7 +1073,7 @@ export declare const STUDY_COMMAND_DURATION = 86400000;
|
|
|
931
1073
|
export declare const STUDY_COMMAND_GRADER = "consumer-adapter";
|
|
932
1074
|
|
|
933
1075
|
/** 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";
|
|
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";
|
|
935
1077
|
|
|
936
1078
|
/** Names the command route beneath the native supervisor. */
|
|
937
1079
|
export declare const STUDY_COMMAND_OPERATION = "study-command";
|
|
@@ -1010,21 +1152,6 @@ export declare interface StudyAdjudication {
|
|
|
1010
1152
|
readonly evidence: Readonly<Record<string, readonly StudyEvidence[]>>;
|
|
1011
1153
|
}
|
|
1012
1154
|
|
|
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
1155
|
/** Joins each message of a measured request to its origin, one JSON entry per message in order. */
|
|
1029
1156
|
export declare type StudyAgentOriginHandler = (messages: readonly Message[]) => JSONValue;
|
|
1030
1157
|
|
|
@@ -1036,14 +1163,6 @@ export declare interface StudyAgentPlan {
|
|
|
1036
1163
|
readonly workload: AbortController;
|
|
1037
1164
|
}
|
|
1038
1165
|
|
|
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
1166
|
/**
|
|
1048
1167
|
* Declares one scripted reply.
|
|
1049
1168
|
* @remarks
|
|
@@ -1067,19 +1186,6 @@ export declare interface StudyAgentResponse {
|
|
|
1067
1186
|
/** Names the model responsibilities whose requests the trace and summary measure. */
|
|
1068
1187
|
export declare type StudyAgentRole = Extract<StudyRole, 'agent' | 'summary'>;
|
|
1069
1188
|
|
|
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
1189
|
/** Serves declared inert responses through the actual Agent provider boundary. */
|
|
1084
1190
|
export declare class StudyAgentScript implements ProviderInterface {
|
|
1085
1191
|
#private;
|
|
@@ -1311,16 +1417,6 @@ export declare interface StudyArtifactModule {
|
|
|
1311
1417
|
readonly provider: unknown;
|
|
1312
1418
|
}
|
|
1313
1419
|
|
|
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
1420
|
/**
|
|
1325
1421
|
* Holds one failed record the report groups by cause, role, and layer.
|
|
1326
1422
|
* @remarks
|
|
@@ -1334,22 +1430,6 @@ export declare interface StudyAttributionSource {
|
|
|
1334
1430
|
readonly executed: boolean;
|
|
1335
1431
|
}
|
|
1336
1432
|
|
|
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
1433
|
/** Correlates bounded IPC work and rejects every outstanding request on transport failure. */
|
|
1354
1434
|
export declare class StudyChannel {
|
|
1355
1435
|
#private;
|
|
@@ -1381,13 +1461,6 @@ export declare interface StudyChannelOptions {
|
|
|
1381
1461
|
readonly abort: (value: JSONValue) => void;
|
|
1382
1462
|
}
|
|
1383
1463
|
|
|
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
1464
|
/** Dispatches private child routes before the public native supervisor. */
|
|
1392
1465
|
export declare class StudyCLI {
|
|
1393
1466
|
#private;
|
|
@@ -1435,66 +1508,6 @@ export declare interface StudyCommandOptions {
|
|
|
1435
1508
|
/** Names the independently dispatched study command operation. */
|
|
1436
1509
|
export declare type StudyCommandRequest = StudyExecutionRequest | StudyGradeRequest | StudyLabelRequest | StudyReportRequest;
|
|
1437
1510
|
|
|
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
|
-
}
|
|
1497
|
-
|
|
1498
1511
|
/** Holds the evidence sink's shared admission budget. */
|
|
1499
1512
|
export declare interface StudyCustodyBudget {
|
|
1500
1513
|
readonly reserve: (bytes: number) => void;
|
|
@@ -1511,28 +1524,13 @@ export declare interface StudyCustodySinkInterface extends StudySinkInterface {
|
|
|
1511
1524
|
close(): Promise<void>;
|
|
1512
1525
|
}
|
|
1513
1526
|
|
|
1514
|
-
/** Holds
|
|
1515
|
-
declare interface
|
|
1516
|
-
readonly
|
|
1517
|
-
readonly
|
|
1518
|
-
readonly
|
|
1519
|
-
readonly
|
|
1520
|
-
readonly
|
|
1521
|
-
readonly arms: readonly string[];
|
|
1522
|
-
readonly scenarios: readonly string[];
|
|
1523
|
-
readonly order: ReadonlyArray<readonly string[]>;
|
|
1524
|
-
readonly retries: 0;
|
|
1525
|
-
readonly rubric: string;
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
/** Creates isolated domain state through a concrete package consumer. */
|
|
1529
|
-
declare interface StudyDriverInterface {
|
|
1530
|
-
/** Creates fresh domain state for one scheduled trial.
|
|
1531
|
-
* @param trial - The scheduled scenario, arm, and repetition.
|
|
1532
|
-
* @param signal - The caller's cancellation.
|
|
1533
|
-
* @returns The isolated session for this trial.
|
|
1534
|
-
*/
|
|
1535
|
-
open(trial: StudyTrial, signal: AbortSignal): Promise<StudySessionInterface>;
|
|
1527
|
+
/** Holds a parsed study declaration with its driver bundle, scenarios, scenario fixtures, and rubric. */
|
|
1528
|
+
export declare interface StudyDeclaration {
|
|
1529
|
+
readonly bundle: string;
|
|
1530
|
+
readonly definition: StudyDefinition;
|
|
1531
|
+
readonly scenarios: readonly StudyScenario[];
|
|
1532
|
+
readonly fixtures: readonly StudyCommandArtifact[];
|
|
1533
|
+
readonly rubric: StudyRubric;
|
|
1536
1534
|
}
|
|
1537
1535
|
|
|
1538
1536
|
/** Supplies admitted modules and an exclusive scratch parent without grader truth. */
|
|
@@ -1544,29 +1542,6 @@ export declare interface StudyDriverOptions {
|
|
|
1544
1542
|
readonly directory: string;
|
|
1545
1543
|
}
|
|
1546
1544
|
|
|
1547
|
-
/** Reports a study contract or operational failure with a stable code. */
|
|
1548
|
-
declare class StudyError extends Error {
|
|
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;
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
1545
|
/** Retains admitted evidence in order and closes admission before terminal records. */
|
|
1571
1546
|
export declare class StudyEvidenceSink implements StudyCustodySinkInterface {
|
|
1572
1547
|
#private;
|
|
@@ -1608,15 +1583,6 @@ export declare interface StudyExecutionRequest {
|
|
|
1608
1583
|
readonly expected: string | undefined;
|
|
1609
1584
|
}
|
|
1610
1585
|
|
|
1611
|
-
/** Holds an attributable operational fault without awarding a task verdict. */
|
|
1612
|
-
declare interface StudyFailure {
|
|
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;
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
1586
|
/** Holds the exact byte identity of one execution file. */
|
|
1621
1587
|
export declare interface StudyFile {
|
|
1622
1588
|
readonly path: string;
|
|
@@ -1631,12 +1597,6 @@ export declare interface StudyFrame {
|
|
|
1631
1597
|
readonly value: JSONValue;
|
|
1632
1598
|
}
|
|
1633
1599
|
|
|
1634
|
-
/** Holds a declared goal's public input without its grading truth. */
|
|
1635
|
-
declare interface StudyGoal {
|
|
1636
|
-
readonly id: string;
|
|
1637
|
-
readonly input: JSONValue;
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
1600
|
/** Reads one declared target against the consumer's domain predicate. */
|
|
1641
1601
|
export declare type StudyGradeFunction = (target: StudyGradeTarget) => StudyGradeReading;
|
|
1642
1602
|
|
|
@@ -1665,19 +1625,6 @@ export declare interface StudyGradeTarget {
|
|
|
1665
1625
|
readonly evidence: readonly StudyEvidence[];
|
|
1666
1626
|
}
|
|
1667
1627
|
|
|
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
1628
|
/** Holds artifacts already verified inside a selected immutable grading directory. */
|
|
1682
1629
|
export declare interface StudyGradingContext {
|
|
1683
1630
|
readonly grading: StudyGrading;
|
|
@@ -1720,16 +1667,6 @@ export declare interface StudyGradingStoreOptions {
|
|
|
1720
1667
|
readonly packet?: StudyPacketBundle;
|
|
1721
1668
|
}
|
|
1722
1669
|
|
|
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
1670
|
/** Holds inspected execution metadata that is never gradeable before sealing. */
|
|
1734
1671
|
export declare interface StudyInterruptedResult {
|
|
1735
1672
|
readonly status: 'interrupted';
|
|
@@ -1738,26 +1675,6 @@ export declare interface StudyInterruptedResult {
|
|
|
1738
1675
|
readonly attempts: readonly StudyAttempt[];
|
|
1739
1676
|
}
|
|
1740
1677
|
|
|
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
1678
|
/** Holds an imported-label grading request. */
|
|
1762
1679
|
export declare interface StudyLabelRequest {
|
|
1763
1680
|
readonly command: 'label';
|
|
@@ -1766,19 +1683,6 @@ export declare interface StudyLabelRequest {
|
|
|
1766
1683
|
readonly labels: string;
|
|
1767
1684
|
}
|
|
1768
1685
|
|
|
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
1686
|
/** Supervises finite command trees and binds offline check to execution. */
|
|
1783
1687
|
export declare class StudyLauncher {
|
|
1784
1688
|
#private;
|
|
@@ -1805,53 +1709,9 @@ export declare interface StudyLaunchResult {
|
|
|
1805
1709
|
readonly output: string;
|
|
1806
1710
|
}
|
|
1807
1711
|
|
|
1808
|
-
/**
|
|
1809
|
-
* Names the ceiling that stopped a run.
|
|
1810
|
-
* @remarks
|
|
1811
|
-
* `scope` is a limit Study declares: the calls, tokens, bytes, or duration of a request, goal,
|
|
1812
|
-
* trial, series, or operation, the product output allowance, and a provider's declared byte bound.
|
|
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.
|
|
1817
|
-
*/
|
|
1818
|
-
declare type StudyLayer = 'scope' | 'window' | 'custody' | 'meter' | 'budget' | 'model';
|
|
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;
|
|
1825
|
-
readonly bytes: number;
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
/** Holds the execution declaration sealed before any trial begins. */
|
|
1829
|
-
declare interface StudyManifest {
|
|
1830
|
-
readonly id: string;
|
|
1831
|
-
readonly created: string;
|
|
1832
|
-
readonly definition: StudyDefinition;
|
|
1833
|
-
readonly scenarios: readonly StudyScenario[];
|
|
1834
|
-
readonly identity: StudyIdentity;
|
|
1835
|
-
readonly schedule: readonly StudyTrial[];
|
|
1836
|
-
readonly bounds: StudyBounds;
|
|
1837
|
-
readonly qualification: string | undefined;
|
|
1838
|
-
readonly host: Readonly<Record<string, string>>;
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
1712
|
/** Handles validated transport requests at their owning domain boundary. */
|
|
1842
1713
|
export declare type StudyMessageHandler = (operation: StudyOperation, value: JSONValue) => Promise<JSONValue>;
|
|
1843
1714
|
|
|
1844
|
-
/** Holds the retained outcome of a scheduled goal. */
|
|
1845
|
-
declare interface StudyObservation {
|
|
1846
|
-
readonly goal: string;
|
|
1847
|
-
readonly product: StudyProduct | undefined;
|
|
1848
|
-
readonly failure: StudyFailure | undefined;
|
|
1849
|
-
readonly usage: readonly StudyUsage[];
|
|
1850
|
-
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
1715
|
/** Holds one active goal's accounting and attribution. */
|
|
1856
1716
|
export declare interface StudyOllamaActivity {
|
|
1857
1717
|
readonly goal: string;
|
|
@@ -2066,7 +1926,7 @@ export declare interface StudyParentTicket {
|
|
|
2066
1926
|
|
|
2067
1927
|
/** Holds checked public declarations and reproducible executable identities. */
|
|
2068
1928
|
export declare interface StudyPreparation {
|
|
2069
|
-
readonly
|
|
1929
|
+
readonly bundle: string;
|
|
2070
1930
|
readonly definition: StudyDefinition;
|
|
2071
1931
|
readonly scenarios: readonly StudyScenario[];
|
|
2072
1932
|
readonly rubric: StudyRubric;
|
|
@@ -2153,46 +2013,6 @@ export declare interface StudyProcessSessionOptions extends StudyProcessOptions
|
|
|
2153
2013
|
readonly signal: AbortSignal;
|
|
2154
2014
|
}
|
|
2155
2015
|
|
|
2156
|
-
/** Holds observed output and partial completion, never self-awarded success. */
|
|
2157
|
-
declare interface StudyProduct {
|
|
2158
|
-
readonly value: JSONValue;
|
|
2159
|
-
readonly partial: boolean;
|
|
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
|
-
};
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
/** Names the evidence a study can establish. */
|
|
2194
|
-
declare type StudyPurpose = 'mechanism' | 'quality' | 'capacity';
|
|
2195
|
-
|
|
2196
2016
|
/** Cites a retained trial file, or one evidence row of it by its zero-based position. */
|
|
2197
2017
|
export declare interface StudyReference {
|
|
2198
2018
|
readonly file: StudyReferenceFile;
|
|
@@ -2343,31 +2163,6 @@ export declare interface StudyResultStoreOptions {
|
|
|
2343
2163
|
readonly manifest: StudyManifest;
|
|
2344
2164
|
}
|
|
2345
2165
|
|
|
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
2166
|
/** Holds a complete execution inventory and its deterministic identity. */
|
|
2372
2167
|
export declare interface StudySeal {
|
|
2373
2168
|
readonly result: string;
|
|
@@ -2384,59 +2179,6 @@ export declare interface StudySealedResult {
|
|
|
2384
2179
|
readonly seal: StudySeal;
|
|
2385
2180
|
}
|
|
2386
2181
|
|
|
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
2182
|
/** Bounds adapter evaluation by an independent native parent timer. */
|
|
2441
2183
|
export declare class StudyTask {
|
|
2442
2184
|
#private;
|
|
@@ -2483,46 +2225,12 @@ export declare class StudyTaskWorker {
|
|
|
2483
2225
|
execute(): Promise<void>;
|
|
2484
2226
|
}
|
|
2485
2227
|
|
|
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
2228
|
/** Holds the trial sink's admitted writes and terminal lifecycle. */
|
|
2512
2229
|
export declare interface StudyTrialCustody {
|
|
2513
2230
|
readonly sink: StudyCustodySinkInterface;
|
|
2514
2231
|
readonly terminal: Promise<void> | undefined;
|
|
2515
2232
|
}
|
|
2516
2233
|
|
|
2517
|
-
/** Holds actual request measurements; absent token usage remains unknown. */
|
|
2518
|
-
declare interface StudyUsage {
|
|
2519
|
-
readonly role: StudyRole;
|
|
2520
|
-
readonly calls: number;
|
|
2521
|
-
readonly tokens: number | undefined;
|
|
2522
|
-
readonly bytes: number | undefined;
|
|
2523
|
-
readonly duration: number;
|
|
2524
|
-
}
|
|
2525
|
-
|
|
2526
2234
|
/** Holds declarations for domain validation before agent, subject or provider execution. */
|
|
2527
2235
|
export declare interface StudyValidation {
|
|
2528
2236
|
readonly definition: StudyDefinition;
|