@arcforge/types 2.0.59
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/package.json +29 -0
- package/src/bench/aggregate.ts +67 -0
- package/src/bench/artifact.ts +39 -0
- package/src/bench/bench.ts +62 -0
- package/src/bench/contribution.ts +40 -0
- package/src/bench/dimension.ts +15 -0
- package/src/bench/execution.ts +76 -0
- package/src/bench/factor.ts +69 -0
- package/src/bench/index.ts +108 -0
- package/src/bench/manifest.ts +49 -0
- package/src/bench/measurement.ts +41 -0
- package/src/bench/observation.ts +42 -0
- package/src/bench/protocol.ts +21 -0
- package/src/bench/result.ts +32 -0
- package/src/bench/value.ts +7 -0
- package/src/bench/workspace.ts +76 -0
- package/src/blueprint.ts +125 -0
- package/src/capsule-config.ts +111 -0
- package/src/cognet/blueprint.ts +38 -0
- package/src/cognet/cognet.ts +69 -0
- package/src/cognet/hooks.ts +43 -0
- package/src/cognet/index.ts +3 -0
- package/src/config.ts +72 -0
- package/src/define.ts +184 -0
- package/src/deploy.ts +54 -0
- package/src/engine.ts +254 -0
- package/src/error.ts +88 -0
- package/src/handle.ts +137 -0
- package/src/hooks.ts +31 -0
- package/src/http.ts +49 -0
- package/src/index.ts +23 -0
- package/src/kernel/abi.ts +244 -0
- package/src/kernel/index.ts +2 -0
- package/src/middleware.ts +7 -0
- package/src/module.ts +193 -0
- package/src/plugin.ts +9 -0
- package/src/policy.ts +89 -0
- package/src/prompts.ts +25 -0
- package/src/route.ts +15 -0
- package/src/scope.ts +29 -0
- package/src/scripts.ts +21 -0
- package/src/session/envelope.ts +61 -0
- package/src/session/events/activity.ts +77 -0
- package/src/session/events/bench.ts +49 -0
- package/src/session/events/capsule.ts +114 -0
- package/src/session/events/cognet.ts +51 -0
- package/src/session/events/engine.ts +46 -0
- package/src/session/events/entries.ts +66 -0
- package/src/session/events/kernel.ts +44 -0
- package/src/session/events/log.ts +27 -0
- package/src/session/events/runtime.ts +76 -0
- package/src/session/events/stdio/output.ts +94 -0
- package/src/session/events/stdio/shared.ts +50 -0
- package/src/session/events/stdio/stimuli.ts +110 -0
- package/src/session/events/test.ts +52 -0
- package/src/session/index.ts +40 -0
- package/src/session/session.ts +107 -0
- package/src/tools.ts +54 -0
- package/tsconfig.base.json +14 -0
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arcforge/types",
|
|
3
|
+
"version": "2.0.59",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts",
|
|
9
|
+
"./session": "./src/session/index.ts",
|
|
10
|
+
"./tsconfig.base.json": "./tsconfig.base.json"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"src",
|
|
14
|
+
"tsconfig.base.json"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"deploy": "bun publish --access public",
|
|
18
|
+
"deploy:patch": "npm version patch && bun publish --access public",
|
|
19
|
+
"deploy:minor": "npm version minor && bun publish --access public",
|
|
20
|
+
"deploy:major": "npm version major && bun publish --access public"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"h3": "^1.13.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/bun": "latest",
|
|
27
|
+
"typescript": "^5"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { BenchCell } from "./factor"
|
|
2
|
+
import type { BenchMeasurementWeighting } from "./measurement"
|
|
3
|
+
|
|
4
|
+
export type BenchConfidenceInterval = {
|
|
5
|
+
level: number
|
|
6
|
+
low: number
|
|
7
|
+
high: number
|
|
8
|
+
method: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type BenchNumericSummary = {
|
|
12
|
+
kind: "number"
|
|
13
|
+
samples: number
|
|
14
|
+
mean: number
|
|
15
|
+
median: number
|
|
16
|
+
standardDeviation: number
|
|
17
|
+
min: number
|
|
18
|
+
max: number
|
|
19
|
+
percentiles: Record<string, number>
|
|
20
|
+
confidence?: BenchConfidenceInterval
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type BenchBooleanSummary = {
|
|
24
|
+
kind: "boolean"
|
|
25
|
+
samples: number
|
|
26
|
+
true: number
|
|
27
|
+
false: number
|
|
28
|
+
rate: number
|
|
29
|
+
confidence?: BenchConfidenceInterval
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type BenchCategorySummary = {
|
|
33
|
+
kind: "category"
|
|
34
|
+
samples: number
|
|
35
|
+
counts: Record<string, number>
|
|
36
|
+
proportions: Record<string, number>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type BenchTextSummary = { kind: "text"; samples: number }
|
|
40
|
+
export type BenchMeasurementSummary =
|
|
41
|
+
| BenchNumericSummary
|
|
42
|
+
| BenchBooleanSummary
|
|
43
|
+
| BenchCategorySummary
|
|
44
|
+
| BenchTextSummary
|
|
45
|
+
|
|
46
|
+
export type BenchAggregateScope = {
|
|
47
|
+
cell?: BenchCell
|
|
48
|
+
testId?: string
|
|
49
|
+
caseId?: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Derived projection over one run or a compatible collective cohort. */
|
|
53
|
+
export type BenchAggregate = {
|
|
54
|
+
scope: BenchAggregateScope
|
|
55
|
+
weighting: BenchMeasurementWeighting
|
|
56
|
+
runs: number
|
|
57
|
+
contributors: number
|
|
58
|
+
trials: number
|
|
59
|
+
outcomes: { passed: number; failed: number; skipped: number; todo: number }
|
|
60
|
+
measurements: Record<string, BenchMeasurementSummary>
|
|
61
|
+
physics: {
|
|
62
|
+
meanDurationMs: number
|
|
63
|
+
totalCostUsd?: number
|
|
64
|
+
meanCostUsd?: number
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BenchExecutionContext } from "./execution"
|
|
2
|
+
import type { BenchHash, BenchValue } from "./value"
|
|
3
|
+
|
|
4
|
+
export type BenchArtifactRole = "evidence" | "output" | "replay" | "report"
|
|
5
|
+
|
|
6
|
+
export type BenchArtifactDefinition = {
|
|
7
|
+
id: string
|
|
8
|
+
label: string
|
|
9
|
+
description: string
|
|
10
|
+
role?: BenchArtifactRole
|
|
11
|
+
mediaTypes?: string[]
|
|
12
|
+
/** URI identifying the artifact body's semantic schema. */
|
|
13
|
+
schema?: string
|
|
14
|
+
}
|
|
15
|
+
/** Runtime input. The harness persists content and emits a portable reference. */
|
|
16
|
+
export type BenchArtifactInput = {
|
|
17
|
+
mediaType: string
|
|
18
|
+
role?: BenchArtifactRole
|
|
19
|
+
schema?: string
|
|
20
|
+
content: string | Uint8Array | BenchValue
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Content-addressed evidence; charts are projections, never stored artifacts. */
|
|
24
|
+
export type BenchArtifactRef = {
|
|
25
|
+
id: string
|
|
26
|
+
definitionId: string
|
|
27
|
+
label?: string
|
|
28
|
+
description?: string
|
|
29
|
+
role: BenchArtifactRole
|
|
30
|
+
owner?: "benchmark" | "framework"
|
|
31
|
+
display?: "hidden" | "default"
|
|
32
|
+
mediaType: string
|
|
33
|
+
schema?: string
|
|
34
|
+
hash: BenchHash
|
|
35
|
+
bytes: number
|
|
36
|
+
ref: string
|
|
37
|
+
context: BenchExecutionContext
|
|
38
|
+
createdAt: string
|
|
39
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { BenchArtifactDefinition, BenchArtifactInput } from "./artifact"
|
|
2
|
+
import type { BenchDimensionDefinition, BenchDimensionValue } from "./dimension"
|
|
3
|
+
import type { BenchCell } from "./factor"
|
|
4
|
+
import type { BenchFactor } from "./factor"
|
|
5
|
+
import type { BenchMeasurementDefinition } from "./measurement"
|
|
6
|
+
import type { BenchObservationIndex } from "./observation"
|
|
7
|
+
import type { BenchResolvedWorkspaceDefinition, BenchWorkspaceDefinition } from "./workspace"
|
|
8
|
+
|
|
9
|
+
export type BenchNormalizedConfig = Omit<BenchConfig, "factors" | "trials" | "tests" | "measurements" | "dimensions" | "artifacts" | "workspace"> & {
|
|
10
|
+
identity: { name: string; version: string }
|
|
11
|
+
factors: BenchFactor[]
|
|
12
|
+
trials: number
|
|
13
|
+
tests: string[]
|
|
14
|
+
measurements: BenchMeasurementDefinition[]
|
|
15
|
+
dimensions: BenchDimensionDefinition[]
|
|
16
|
+
artifacts: BenchArtifactDefinition[]
|
|
17
|
+
workspace: BenchResolvedWorkspaceDefinition
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type BenchObserveOptions = {
|
|
21
|
+
dimensions?: Record<string, BenchDimensionValue>
|
|
22
|
+
at?: BenchObservationIndex
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type BenchAttachOptions = {
|
|
26
|
+
mediaType?: string
|
|
27
|
+
role?: BenchArtifactInput["role"]
|
|
28
|
+
schema?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Public authoring handle. Generated declarations narrow its string IDs and values. */
|
|
32
|
+
export type BenchHandle = {
|
|
33
|
+
readonly workspace: string
|
|
34
|
+
factor<T = unknown>(id: string): T
|
|
35
|
+
observe(measurementId: string, value: number | boolean | string, options?: BenchObserveOptions): void
|
|
36
|
+
attach(definitionId: string, content: unknown, options?: BenchAttachOptions): Promise<void>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Published benchmark contract. Native Bun test files define its executable cases. */
|
|
40
|
+
export type BenchConfig = {
|
|
41
|
+
description: string
|
|
42
|
+
workspace?: BenchWorkspaceDefinition
|
|
43
|
+
factors?: BenchFactor[]
|
|
44
|
+
/** Repetitions per test × cell. Defaults to one. */
|
|
45
|
+
trials?: number
|
|
46
|
+
/** Native Bun test globs. Defaults to benchmark files beneath tests/. */
|
|
47
|
+
tests?: string[]
|
|
48
|
+
measurements?: BenchMeasurementDefinition[]
|
|
49
|
+
dimensions?: BenchDimensionDefinition[]
|
|
50
|
+
artifacts?: BenchArtifactDefinition[]
|
|
51
|
+
budget?: { perTrial?: string; total?: string }
|
|
52
|
+
}
|
|
53
|
+
export type BenchDefinition = { _kind: "bench"; config: BenchConfig }
|
|
54
|
+
|
|
55
|
+
/** Ambient author API installed by the bench preload for the active Bun test. */
|
|
56
|
+
export type BenchContext = BenchHandle & {
|
|
57
|
+
readonly runId: string
|
|
58
|
+
readonly cell: BenchCell
|
|
59
|
+
readonly trial: number
|
|
60
|
+
readonly attempt: number
|
|
61
|
+
readonly workdir: string
|
|
62
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BenchAggregate } from "./aggregate"
|
|
2
|
+
import type { BenchResolvedFactor } from "./factor"
|
|
3
|
+
import type { BenchRunResult } from "./result"
|
|
4
|
+
import type { BenchHash } from "./value"
|
|
5
|
+
|
|
6
|
+
export type BenchResultTier = "reported" | "auditable" | "verified"
|
|
7
|
+
|
|
8
|
+
/** Exact comparability boundary used before results enter a shared aggregate. */
|
|
9
|
+
export type BenchCohortKey = {
|
|
10
|
+
benchHash: BenchHash
|
|
11
|
+
schemaHash: BenchHash
|
|
12
|
+
caseSetPin: BenchHash
|
|
13
|
+
controlledFactors: BenchResolvedFactor[]
|
|
14
|
+
harnessCompatibility: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type BenchSubmission = {
|
|
18
|
+
id: string
|
|
19
|
+
tier: BenchResultTier
|
|
20
|
+
contributor: { id: string }
|
|
21
|
+
result: BenchRunResult
|
|
22
|
+
hashes: { manifest: BenchHash; observations: BenchHash; result: BenchHash }
|
|
23
|
+
signature?: { algorithm: string; keyId: string; value: string }
|
|
24
|
+
submittedAt: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type BenchSubmissionInclusion =
|
|
28
|
+
| { status: "accepted"; cohortId: string }
|
|
29
|
+
| { status: "excluded"; reasons: string[] }
|
|
30
|
+
| { status: "quarantined"; reasons: string[] }
|
|
31
|
+
|
|
32
|
+
export type BenchCollectiveAggregate = {
|
|
33
|
+
id: string
|
|
34
|
+
cohort: BenchCohortKey
|
|
35
|
+
tier: BenchResultTier
|
|
36
|
+
submissions: { accepted: number; excluded: number; contributors: number }
|
|
37
|
+
aggregates: BenchAggregate[]
|
|
38
|
+
generatedAt: string
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type BenchDimensionValue = string | number | boolean
|
|
2
|
+
|
|
3
|
+
export type BenchDimensionDefinition = {
|
|
4
|
+
id: string
|
|
5
|
+
label: string
|
|
6
|
+
description?: string
|
|
7
|
+
/** High-cardinality dimensions are excluded from default groupings. */
|
|
8
|
+
cardinality?: "low" | "high"
|
|
9
|
+
value:
|
|
10
|
+
| { kind: "string" }
|
|
11
|
+
| { kind: "number" }
|
|
12
|
+
| { kind: "boolean" }
|
|
13
|
+
| { kind: "category"; values: string[]; open?: boolean }
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { BenchCell } from "./factor"
|
|
2
|
+
|
|
3
|
+
export type BenchTestStatus = "passed" | "failed" | "skipped" | "todo"
|
|
4
|
+
|
|
5
|
+
export type BenchTestRef = {
|
|
6
|
+
id: string
|
|
7
|
+
file: string
|
|
8
|
+
suite: string[]
|
|
9
|
+
name: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Optional author-defined case beneath a native Bun test. */
|
|
13
|
+
export type BenchCaseRef = {
|
|
14
|
+
id: string
|
|
15
|
+
testId: string
|
|
16
|
+
label?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type BenchSessionRole = "subject" | "assessor"
|
|
20
|
+
export type BenchSessionRef = {
|
|
21
|
+
agentId: string
|
|
22
|
+
sessionId: string
|
|
23
|
+
role: BenchSessionRole
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type BenchExecutionContext = {
|
|
27
|
+
runId: string
|
|
28
|
+
cellId: string
|
|
29
|
+
testId?: string
|
|
30
|
+
caseId?: string
|
|
31
|
+
trial?: number
|
|
32
|
+
attempt?: number
|
|
33
|
+
sessionId?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type BenchResourceUsage = {
|
|
37
|
+
durationMs: number
|
|
38
|
+
tokens: { input: number; output: number }
|
|
39
|
+
/** Absent when any participating engine cannot be priced. */
|
|
40
|
+
costUsd?: number
|
|
41
|
+
engineCalls: number
|
|
42
|
+
toolCalls: number
|
|
43
|
+
errors: number
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Assessor usage is isolated so judge cost cannot distort subject performance. */
|
|
47
|
+
export type BenchPhysics = {
|
|
48
|
+
subject: BenchResourceUsage
|
|
49
|
+
assessor?: BenchResourceUsage
|
|
50
|
+
harness: { durationMs: number }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type BenchFaultCode = "boot" | "timeout" | "budget" | "cancelled" | "process" | "protocol"
|
|
54
|
+
export type BenchFault = {
|
|
55
|
+
code: BenchFaultCode
|
|
56
|
+
message: string
|
|
57
|
+
stack?: string
|
|
58
|
+
context: BenchExecutionContext
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type BenchTrialRecord = {
|
|
62
|
+
id: string
|
|
63
|
+
test: BenchTestRef
|
|
64
|
+
case?: BenchCaseRef
|
|
65
|
+
cell: BenchCell
|
|
66
|
+
trial: number
|
|
67
|
+
attempt: number
|
|
68
|
+
status: BenchTestStatus
|
|
69
|
+
error?: { message: string; stack?: string }
|
|
70
|
+
physics: BenchPhysics
|
|
71
|
+
sessions: BenchSessionRef[]
|
|
72
|
+
observationIds: string[]
|
|
73
|
+
artifactIds: string[]
|
|
74
|
+
fault?: BenchFault
|
|
75
|
+
}
|
|
76
|
+
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { EngineRef } from "../engine"
|
|
2
|
+
import type { BenchValue } from "./value"
|
|
3
|
+
|
|
4
|
+
export type BenchFactorKind =
|
|
5
|
+
| "agent"
|
|
6
|
+
| "model"
|
|
7
|
+
| "cognet"
|
|
8
|
+
| "dataset"
|
|
9
|
+
| "toolset"
|
|
10
|
+
| "environment"
|
|
11
|
+
| "judge"
|
|
12
|
+
| "value"
|
|
13
|
+
|
|
14
|
+
export type BenchFactorRole = "subject" | "control" | "input" | "assessor"
|
|
15
|
+
|
|
16
|
+
export type BenchFactorValue<T> = {
|
|
17
|
+
/** Stable within the factor; used in cell identities. */
|
|
18
|
+
id: string
|
|
19
|
+
label?: string
|
|
20
|
+
description?: string
|
|
21
|
+
value: T
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type Factor<K extends BenchFactorKind, T> = {
|
|
25
|
+
id: string
|
|
26
|
+
label: string
|
|
27
|
+
description?: string
|
|
28
|
+
kind: K
|
|
29
|
+
role: BenchFactorRole
|
|
30
|
+
/** One value is a held constant; two or more form a matrix axis. */
|
|
31
|
+
values: BenchFactorValue<T>[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type BenchFactor =
|
|
35
|
+
| Factor<"agent", { ref: string }>
|
|
36
|
+
| Factor<"model", { engine: EngineRef }>
|
|
37
|
+
| Factor<"cognet", { ref: string }>
|
|
38
|
+
| Factor<"dataset", { ref: string; split?: string }>
|
|
39
|
+
| Factor<"toolset", { refs: string[] }>
|
|
40
|
+
| Factor<"environment", { env: Record<string, string> }>
|
|
41
|
+
| Factor<"judge", { ref: string; rubric?: string }>
|
|
42
|
+
| Factor<"value", BenchValue>
|
|
43
|
+
|
|
44
|
+
export type BenchFactorSelection = {
|
|
45
|
+
factorId: string
|
|
46
|
+
kind: BenchFactorKind
|
|
47
|
+
valueId: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** A raw Cartesian coordinate before values are resolved and pinned. */
|
|
51
|
+
export type BenchCoordinate = {
|
|
52
|
+
id: string
|
|
53
|
+
factors: BenchFactorSelection[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Manifest-safe identity of a selected value. Secret values are never included. */
|
|
57
|
+
export type BenchResolvedFactor = BenchFactorSelection & {
|
|
58
|
+
role: BenchFactorRole
|
|
59
|
+
label: string
|
|
60
|
+
/** Immutable registry version, content hash, or canonical value hash. */
|
|
61
|
+
pin: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** One fully resolved coordinate, including both swept and constant factors. */
|
|
65
|
+
export type BenchCell = {
|
|
66
|
+
id: string
|
|
67
|
+
factors: BenchResolvedFactor[]
|
|
68
|
+
}
|
|
69
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export type { BenchScalar, BenchValue, BenchHash } from "./value"
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
BenchWorkspaceSource,
|
|
5
|
+
BenchWorkspaceRetention,
|
|
6
|
+
BenchWorkspaceDefinition,
|
|
7
|
+
BenchResolvedWorkspaceDefinition,
|
|
8
|
+
BenchWorkspaceTemplate,
|
|
9
|
+
BenchWorkspaceInstance,
|
|
10
|
+
BenchWorkspaceFileState,
|
|
11
|
+
BenchWorkspaceChange,
|
|
12
|
+
BenchWorkspaceResult,
|
|
13
|
+
} from "./workspace"
|
|
14
|
+
|
|
15
|
+
export type {
|
|
16
|
+
BenchFactorKind,
|
|
17
|
+
BenchFactorRole,
|
|
18
|
+
BenchFactorValue,
|
|
19
|
+
BenchFactor,
|
|
20
|
+
BenchFactorSelection,
|
|
21
|
+
BenchCoordinate,
|
|
22
|
+
BenchResolvedFactor,
|
|
23
|
+
BenchCell,
|
|
24
|
+
} from "./factor"
|
|
25
|
+
|
|
26
|
+
export type { BenchDimensionValue, BenchDimensionDefinition } from "./dimension"
|
|
27
|
+
|
|
28
|
+
export type {
|
|
29
|
+
BenchMeasurementValueDefinition,
|
|
30
|
+
BenchMeasurementObjective,
|
|
31
|
+
BenchMeasurementReducer,
|
|
32
|
+
BenchMeasurementWeighting,
|
|
33
|
+
BenchMeasurementGrain,
|
|
34
|
+
BenchMissingPolicy,
|
|
35
|
+
BenchMeasurementDefinition,
|
|
36
|
+
} from "./measurement"
|
|
37
|
+
|
|
38
|
+
export type {
|
|
39
|
+
BenchArtifactRole,
|
|
40
|
+
BenchArtifactDefinition,
|
|
41
|
+
BenchArtifactInput,
|
|
42
|
+
BenchArtifactRef,
|
|
43
|
+
} from "./artifact"
|
|
44
|
+
|
|
45
|
+
export type {
|
|
46
|
+
BenchConfig,
|
|
47
|
+
BenchNormalizedConfig,
|
|
48
|
+
BenchDefinition,
|
|
49
|
+
BenchContext,
|
|
50
|
+
BenchHandle,
|
|
51
|
+
BenchObserveOptions,
|
|
52
|
+
BenchAttachOptions,
|
|
53
|
+
} from "./bench"
|
|
54
|
+
|
|
55
|
+
export type {
|
|
56
|
+
BenchTestStatus,
|
|
57
|
+
BenchTestRef,
|
|
58
|
+
BenchCaseRef,
|
|
59
|
+
BenchSessionRole,
|
|
60
|
+
BenchSessionRef,
|
|
61
|
+
BenchExecutionContext,
|
|
62
|
+
BenchResourceUsage,
|
|
63
|
+
BenchPhysics,
|
|
64
|
+
BenchFaultCode,
|
|
65
|
+
BenchFault,
|
|
66
|
+
BenchTrialRecord,
|
|
67
|
+
} from "./execution"
|
|
68
|
+
|
|
69
|
+
export type {
|
|
70
|
+
BenchObservedValue,
|
|
71
|
+
BenchObservationIndex,
|
|
72
|
+
BenchObservationProducer,
|
|
73
|
+
BenchObservationPayload,
|
|
74
|
+
BenchObservation,
|
|
75
|
+
BenchMissingReason,
|
|
76
|
+
BenchMeasurementState,
|
|
77
|
+
} from "./observation"
|
|
78
|
+
|
|
79
|
+
export { BENCH_PROTOCOL } from "./protocol"
|
|
80
|
+
export type { BenchProtocolVersions, BenchHarnessIdentity } from "./protocol"
|
|
81
|
+
|
|
82
|
+
export type {
|
|
83
|
+
BenchIdentity,
|
|
84
|
+
BenchSchemaSnapshot,
|
|
85
|
+
BenchFactorSnapshot,
|
|
86
|
+
BenchRunManifest,
|
|
87
|
+
} from "./manifest"
|
|
88
|
+
|
|
89
|
+
export type { BenchCoverageMissingReason, BenchCoverage, BenchRunResult } from "./result"
|
|
90
|
+
|
|
91
|
+
export type {
|
|
92
|
+
BenchConfidenceInterval,
|
|
93
|
+
BenchNumericSummary,
|
|
94
|
+
BenchBooleanSummary,
|
|
95
|
+
BenchCategorySummary,
|
|
96
|
+
BenchTextSummary,
|
|
97
|
+
BenchMeasurementSummary,
|
|
98
|
+
BenchAggregateScope,
|
|
99
|
+
BenchAggregate,
|
|
100
|
+
} from "./aggregate"
|
|
101
|
+
|
|
102
|
+
export type {
|
|
103
|
+
BenchResultTier,
|
|
104
|
+
BenchCohortKey,
|
|
105
|
+
BenchSubmission,
|
|
106
|
+
BenchSubmissionInclusion,
|
|
107
|
+
BenchCollectiveAggregate,
|
|
108
|
+
} from "./contribution"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { BenchArtifactDefinition } from "./artifact"
|
|
2
|
+
import type { BenchDimensionDefinition } from "./dimension"
|
|
3
|
+
import type { BenchCaseRef, BenchTestRef } from "./execution"
|
|
4
|
+
import type { BenchCell, BenchFactorKind, BenchFactorRole } from "./factor"
|
|
5
|
+
import type { BenchMeasurementDefinition } from "./measurement"
|
|
6
|
+
import type { BenchHarnessIdentity, BenchProtocolVersions } from "./protocol"
|
|
7
|
+
import type { BenchHash } from "./value"
|
|
8
|
+
import type { BenchWorkspaceTemplate } from "./workspace"
|
|
9
|
+
|
|
10
|
+
export type BenchIdentity = {
|
|
11
|
+
ref: string
|
|
12
|
+
name: string
|
|
13
|
+
version: string
|
|
14
|
+
hash: BenchHash
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type BenchSchemaSnapshot = {
|
|
18
|
+
hash: BenchHash
|
|
19
|
+
measurements: BenchMeasurementDefinition[]
|
|
20
|
+
dimensions: BenchDimensionDefinition[]
|
|
21
|
+
artifacts: BenchArtifactDefinition[]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type BenchFactorSnapshot = {
|
|
25
|
+
id: string
|
|
26
|
+
label: string
|
|
27
|
+
kind: BenchFactorKind
|
|
28
|
+
role: BenchFactorRole
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Layer-two reproducibility record. A result without this is not comparable. */
|
|
32
|
+
export type BenchRunManifest = {
|
|
33
|
+
runId: string
|
|
34
|
+
bench: BenchIdentity
|
|
35
|
+
protocols: BenchProtocolVersions
|
|
36
|
+
schema: BenchSchemaSnapshot
|
|
37
|
+
factors: BenchFactorSnapshot[]
|
|
38
|
+
cells: BenchCell[]
|
|
39
|
+
trials: number
|
|
40
|
+
tests: BenchTestRef[]
|
|
41
|
+
cases: BenchCaseRef[]
|
|
42
|
+
/** Pins discovery and filtering of the case set independently of source. */
|
|
43
|
+
caseSetPin: BenchHash
|
|
44
|
+
harness: BenchHarnessIdentity
|
|
45
|
+
workspace: BenchWorkspaceTemplate
|
|
46
|
+
startedAt: string
|
|
47
|
+
completedAt?: string
|
|
48
|
+
runner?: { id: string; environment?: string }
|
|
49
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type BenchMeasurementValueDefinition =
|
|
2
|
+
| { kind: "number"; unit?: string; integer?: boolean; domain?: { min?: number; max?: number } }
|
|
3
|
+
| { kind: "boolean" }
|
|
4
|
+
| { kind: "category"; values?: string[]; open?: boolean }
|
|
5
|
+
| { kind: "text" }
|
|
6
|
+
|
|
7
|
+
export type BenchMeasurementObjective =
|
|
8
|
+
| "maximize"
|
|
9
|
+
| "minimize"
|
|
10
|
+
| { target: number }
|
|
11
|
+
| { range: { min: number; max: number } }
|
|
12
|
+
|
|
13
|
+
export type BenchMeasurementReducer =
|
|
14
|
+
| "mean"
|
|
15
|
+
| "median"
|
|
16
|
+
| "min"
|
|
17
|
+
| "max"
|
|
18
|
+
| "sum"
|
|
19
|
+
| "rate"
|
|
20
|
+
| "count"
|
|
21
|
+
| "last"
|
|
22
|
+
| "auc"
|
|
23
|
+
|
|
24
|
+
export type BenchMeasurementWeighting = "observation" | "case" | "trial" | "run" | "contributor"
|
|
25
|
+
export type BenchMeasurementGrain = "run" | "case" | "trial" | "step" | "session"
|
|
26
|
+
export type BenchMissingPolicy = "exclude" | "fail" | "zero"
|
|
27
|
+
|
|
28
|
+
/** Semantic measurement contract. Presentation is derived from this schema. */
|
|
29
|
+
export type BenchMeasurementDefinition = {
|
|
30
|
+
id: string
|
|
31
|
+
label: string
|
|
32
|
+
description: string
|
|
33
|
+
value: BenchMeasurementValueDefinition
|
|
34
|
+
objective?: BenchMeasurementObjective
|
|
35
|
+
aggregate?: BenchMeasurementReducer
|
|
36
|
+
weighting?: BenchMeasurementWeighting
|
|
37
|
+
grain?: BenchMeasurementGrain
|
|
38
|
+
required?: boolean
|
|
39
|
+
missing?: BenchMissingPolicy
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BenchDimensionValue } from "./dimension"
|
|
2
|
+
import type { BenchExecutionContext } from "./execution"
|
|
3
|
+
|
|
4
|
+
export type BenchObservedValue =
|
|
5
|
+
| { kind: "number"; value: number }
|
|
6
|
+
| { kind: "boolean"; value: boolean }
|
|
7
|
+
| { kind: "category"; value: string }
|
|
8
|
+
| { kind: "text"; value: string }
|
|
9
|
+
|
|
10
|
+
export type BenchObservationIndex = {
|
|
11
|
+
step?: number
|
|
12
|
+
elapsedMs?: number
|
|
13
|
+
timestamp?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type BenchObservationProducer =
|
|
17
|
+
| { kind: "harness" }
|
|
18
|
+
| { kind: "benchmark"; sourceHash: string }
|
|
19
|
+
| { kind: "session"; sessionId: string }
|
|
20
|
+
| { kind: "judge"; ref: string; pin: string; sessionId?: string }
|
|
21
|
+
|
|
22
|
+
export type BenchObservationPayload = {
|
|
23
|
+
measurementId: string
|
|
24
|
+
value: BenchObservedValue
|
|
25
|
+
dimensions?: Record<string, BenchDimensionValue>
|
|
26
|
+
index?: BenchObservationIndex
|
|
27
|
+
producer: BenchObservationProducer
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Immutable, long-form measurement — the canonical analytical record. */
|
|
31
|
+
export type BenchObservation = BenchObservationPayload & {
|
|
32
|
+
id: string
|
|
33
|
+
time: string
|
|
34
|
+
context: BenchExecutionContext
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type BenchMissingReason = "not_emitted" | "fault" | "cancelled" | "filtered"
|
|
38
|
+
export type BenchMeasurementState =
|
|
39
|
+
| { kind: "observed"; observationId: string }
|
|
40
|
+
| { kind: "missing"; reason: BenchMissingReason }
|
|
41
|
+
| { kind: "invalid"; reason: string; observationId?: string }
|
|
42
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type BenchProtocolVersions = {
|
|
2
|
+
events: string
|
|
3
|
+
manifest: string
|
|
4
|
+
observations: string
|
|
5
|
+
artifacts: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type BenchHarnessIdentity = {
|
|
9
|
+
name: string
|
|
10
|
+
version: string
|
|
11
|
+
runtime: string
|
|
12
|
+
bun: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const BENCH_PROTOCOL = {
|
|
16
|
+
events: "1.0.0",
|
|
17
|
+
manifest: "1.0.0",
|
|
18
|
+
observations: "1.0.0",
|
|
19
|
+
artifacts: "1.0.0",
|
|
20
|
+
} as const satisfies BenchProtocolVersions
|
|
21
|
+
|