anpord 0.1.28 → 0.1.29
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/api-context.cjs +1 -1
- package/dist/api-context.d.cts +1 -1
- package/dist/api-context.d.mts +1 -1
- package/dist/api-context.mjs +1 -1
- package/dist/{api-mocks-CBa3MWVP.d.cts → api-mocks-Bp5izg-M.d.cts} +3 -3
- package/dist/{api-mocks-CBa3MWVP.d.mts → api-mocks-Bp5izg-M.d.mts} +3 -3
- package/dist/{api-mocks-DH1C7any.mjs → api-mocks-DDs4SgSW.mjs} +33 -3
- package/dist/{api-mocks-BsUGpsim.cjs → api-mocks-p7nRxMS0.cjs} +44 -2
- package/dist/api-runtime.cjs +1 -1
- package/dist/api-runtime.d.cts +1 -1
- package/dist/api-runtime.d.mts +1 -1
- package/dist/api-runtime.mjs +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.mjs +1 -1
- package/dist/bin.cjs +61 -14
- package/dist/bin.mjs +61 -14
- package/dist/cli-runtime.cjs +1 -1
- package/dist/cli-runtime.mjs +1 -1
- package/dist/{compiler-DKWUVkxB.cjs → compiler-8DrTWGac.cjs} +1 -1
- package/dist/{compiler-DDc7Towh.mjs → compiler-dmc6AOx6.mjs} +1 -1
- package/dist/{errors-D1L76YFH.cjs → errors-C1vD70D6.cjs} +3 -2
- package/dist/{errors-DaYv6_WJ.mjs → errors-H6woEW0d.mjs} +3 -2
- package/dist/{eval-definition-CuuketNm.d.cts → eval-definition-Cs6o8JLJ.d.cts} +14 -14
- package/dist/{eval-definition-CuuketNm.d.mts → eval-definition-Cs6o8JLJ.d.mts} +14 -14
- package/dist/eval.cjs +1 -1
- package/dist/eval.d.cts +2 -2
- package/dist/eval.d.mts +2 -2
- package/dist/eval.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +338 -331
- package/dist/index.d.mts +338 -331
- package/dist/index.mjs +2 -2
- package/dist/mcp-runtime.cjs +1 -1
- package/dist/mcp-runtime.mjs +1 -1
- package/dist/{runtime-CjDUik7_.mjs → runtime-DxvthKib.mjs} +1 -1
- package/dist/{runtime-BcX6BpI5.cjs → runtime-V4yw0sb-.cjs} +1 -1
- package/dist/source.d.cts +1 -1
- package/dist/source.d.mts +1 -1
- package/dist/{types-CwZvwO-F.d.mts → types-CZqrXnhd.d.mts} +7 -7
- package/dist/{types-7YOtajZL.d.cts → types-D1BHBwZd.d.cts} +7 -7
- package/dist/validator-runtime.cjs +1 -1
- package/dist/validator-runtime.d.cts +1 -1
- package/dist/validator-runtime.d.mts +1 -1
- package/dist/validator-runtime.mjs +1 -1
- package/package.json +1 -1
package/dist/api-context.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_api_mocks = require("./api-mocks-
|
|
2
|
+
const require_api_mocks = require("./api-mocks-p7nRxMS0.cjs");
|
|
3
3
|
let effect = require("effect");
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
5
5
|
//#region src/mock-api/context.ts
|
package/dist/api-context.d.cts
CHANGED
package/dist/api-context.d.mts
CHANGED
package/dist/api-context.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as API_MANIFEST, o as ApiCall, s as ApiManifest, t as API_JOURNAL } from "./api-mocks-
|
|
1
|
+
import { n as API_MANIFEST, o as ApiCall, s as ApiManifest, t as API_JOURNAL } from "./api-mocks-DDs4SgSW.mjs";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
//#region src/mock-api/context.ts
|
|
@@ -11,7 +11,7 @@ declare const ValidationCall: Schema.Struct<{
|
|
|
11
11
|
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
12
12
|
method: Schema.Literal<["answer", "transcript", "turns", "readText", "exists", "exec", "cli.calls", "api.calls", "api.url", "mcp.calls"]>;
|
|
13
13
|
startedAt: typeof Schema.Number;
|
|
14
|
-
durationMs: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative
|
|
14
|
+
durationMs: Schema.NullOr<Schema.transform<typeof Schema.Number, Schema.refine<number, typeof Schema.NonNegative>>>;
|
|
15
15
|
input: Schema.Struct<{
|
|
16
16
|
text: Schema.filter<typeof Schema.String>;
|
|
17
17
|
format: Schema.Literal<["text", "json"]>;
|
|
@@ -39,7 +39,7 @@ declare const EvalValidation: Schema.Struct<{
|
|
|
39
39
|
kind: Schema.Literal<["code", "judge", "command"]>;
|
|
40
40
|
status: Schema.Literal<["queued", "running", "passed", "failed", "error", "skipped"]>;
|
|
41
41
|
startedAt: Schema.NullOr<typeof Schema.Number>;
|
|
42
|
-
durationMs: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative
|
|
42
|
+
durationMs: Schema.NullOr<Schema.transform<typeof Schema.Number, Schema.refine<number, typeof Schema.NonNegative>>>;
|
|
43
43
|
message: Schema.filter<typeof Schema.String>;
|
|
44
44
|
exitCode: Schema.NullOr<typeof Schema.Int>;
|
|
45
45
|
truncated: typeof Schema.Boolean;
|
|
@@ -91,7 +91,7 @@ declare const EvalValidation: Schema.Struct<{
|
|
|
91
91
|
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
92
92
|
method: Schema.Literal<["answer", "transcript", "turns", "readText", "exists", "exec", "cli.calls", "api.calls", "api.url", "mcp.calls"]>;
|
|
93
93
|
startedAt: typeof Schema.Number;
|
|
94
|
-
durationMs: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative
|
|
94
|
+
durationMs: Schema.NullOr<Schema.transform<typeof Schema.Number, Schema.refine<number, typeof Schema.NonNegative>>>;
|
|
95
95
|
input: Schema.Struct<{
|
|
96
96
|
text: Schema.filter<typeof Schema.String>;
|
|
97
97
|
format: Schema.Literal<["text", "json"]>;
|
|
@@ -11,7 +11,7 @@ declare const ValidationCall: Schema.Struct<{
|
|
|
11
11
|
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
12
12
|
method: Schema.Literal<["answer", "transcript", "turns", "readText", "exists", "exec", "cli.calls", "api.calls", "api.url", "mcp.calls"]>;
|
|
13
13
|
startedAt: typeof Schema.Number;
|
|
14
|
-
durationMs: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative
|
|
14
|
+
durationMs: Schema.NullOr<Schema.transform<typeof Schema.Number, Schema.refine<number, typeof Schema.NonNegative>>>;
|
|
15
15
|
input: Schema.Struct<{
|
|
16
16
|
text: Schema.filter<typeof Schema.String>;
|
|
17
17
|
format: Schema.Literal<["text", "json"]>;
|
|
@@ -39,7 +39,7 @@ declare const EvalValidation: Schema.Struct<{
|
|
|
39
39
|
kind: Schema.Literal<["code", "judge", "command"]>;
|
|
40
40
|
status: Schema.Literal<["queued", "running", "passed", "failed", "error", "skipped"]>;
|
|
41
41
|
startedAt: Schema.NullOr<typeof Schema.Number>;
|
|
42
|
-
durationMs: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative
|
|
42
|
+
durationMs: Schema.NullOr<Schema.transform<typeof Schema.Number, Schema.refine<number, typeof Schema.NonNegative>>>;
|
|
43
43
|
message: Schema.filter<typeof Schema.String>;
|
|
44
44
|
exitCode: Schema.NullOr<typeof Schema.Int>;
|
|
45
45
|
truncated: typeof Schema.Boolean;
|
|
@@ -91,7 +91,7 @@ declare const EvalValidation: Schema.Struct<{
|
|
|
91
91
|
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
92
92
|
method: Schema.Literal<["answer", "transcript", "turns", "readText", "exists", "exec", "cli.calls", "api.calls", "api.url", "mcp.calls"]>;
|
|
93
93
|
startedAt: typeof Schema.Number;
|
|
94
|
-
durationMs: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative
|
|
94
|
+
durationMs: Schema.NullOr<Schema.transform<typeof Schema.Number, Schema.refine<number, typeof Schema.NonNegative>>>;
|
|
95
95
|
input: Schema.Struct<{
|
|
96
96
|
text: Schema.filter<typeof Schema.String>;
|
|
97
97
|
format: Schema.Literal<["text", "json"]>;
|
|
@@ -35,6 +35,12 @@ const REPORTED_LIMITS = {
|
|
|
35
35
|
budget: 192e3,
|
|
36
36
|
text: 64e3
|
|
37
37
|
};
|
|
38
|
+
const DurationMs = Schema.transform(Schema.Number, Schema.NonNegativeInt, {
|
|
39
|
+
decode: (value) => Math.max(0, Math.round(value)),
|
|
40
|
+
encode: (value) => value,
|
|
41
|
+
strict: true
|
|
42
|
+
});
|
|
43
|
+
const validationDuration = (startedAt, finished) => startedAt === null ? null : Math.max(0, Math.round(finished - startedAt));
|
|
38
44
|
const valueWithin = (limit) => Schema.Struct({
|
|
39
45
|
text: Schema.String.pipe(Schema.maxLength(limit)),
|
|
40
46
|
format: Schema.Literal("text", "json"),
|
|
@@ -45,7 +51,7 @@ const callOf = (value) => Schema.Struct({
|
|
|
45
51
|
index: Schema.NonNegativeInt,
|
|
46
52
|
method: Schema.Literal("answer", "transcript", "turns", "readText", "exists", "exec", "cli.calls", "api.calls", "api.url", "mcp.calls"),
|
|
47
53
|
startedAt: Schema.Number,
|
|
48
|
-
durationMs: Schema.NullOr(
|
|
54
|
+
durationMs: Schema.NullOr(DurationMs),
|
|
49
55
|
input: value,
|
|
50
56
|
output: value,
|
|
51
57
|
error: Schema.NullOr(value)
|
|
@@ -57,7 +63,7 @@ const validationOf = (value, call) => Schema.Struct({
|
|
|
57
63
|
kind: Schema.Literal("code", "judge", "command"),
|
|
58
64
|
status: Schema.Literal("queued", "running", "passed", "failed", "error", "skipped"),
|
|
59
65
|
startedAt: Schema.NullOr(Schema.Number),
|
|
60
|
-
durationMs: Schema.NullOr(
|
|
66
|
+
durationMs: Schema.NullOr(DurationMs),
|
|
61
67
|
message: Schema.String.pipe(Schema.maxLength(2e3)),
|
|
62
68
|
exitCode: Schema.NullOr(Schema.Int),
|
|
63
69
|
truncated: Schema.Boolean,
|
|
@@ -100,6 +106,30 @@ const unavailableValue = {
|
|
|
100
106
|
state: "unavailable",
|
|
101
107
|
truncated: false
|
|
102
108
|
};
|
|
109
|
+
const withoutText = (value) => value.text === "" ? value : {
|
|
110
|
+
...unavailableValue,
|
|
111
|
+
format: value.format,
|
|
112
|
+
truncated: true
|
|
113
|
+
};
|
|
114
|
+
const orNull = (value) => value === null ? null : withoutText(value);
|
|
115
|
+
const validationWithoutEvidence = (value) => ({
|
|
116
|
+
...value,
|
|
117
|
+
calls: value.calls.map((call) => ({
|
|
118
|
+
...call,
|
|
119
|
+
error: orNull(call.error),
|
|
120
|
+
input: withoutText(call.input),
|
|
121
|
+
output: withoutText(call.output)
|
|
122
|
+
})),
|
|
123
|
+
error: orNull(value.error),
|
|
124
|
+
input: withoutText(value.input),
|
|
125
|
+
logs: value.logs.map((log) => ({
|
|
126
|
+
...log,
|
|
127
|
+
value: withoutText(log.value)
|
|
128
|
+
})),
|
|
129
|
+
output: withoutText(value.output),
|
|
130
|
+
truncated: true,
|
|
131
|
+
...value.metadata === void 0 ? {} : { metadata: withoutText(value.metadata) }
|
|
132
|
+
});
|
|
103
133
|
const validationCapture = (enabled = true, secrets = [], limits = EVIDENCE_LIMITS) => {
|
|
104
134
|
let remaining = limits.budget;
|
|
105
135
|
return (value, format = "json") => {
|
|
@@ -182,4 +212,4 @@ var ApiCall = class extends Schema.Class("ApiCall")({
|
|
|
182
212
|
logs: Schema.Array(ReportedValue).pipe(Schema.maxItems(64))
|
|
183
213
|
}) {};
|
|
184
214
|
//#endregion
|
|
185
|
-
export { unavailableValue as _, API_REPORTED_LIMITS as a,
|
|
215
|
+
export { redactSecrets as C, validationWithoutEvidence as S, unavailableValue as _, API_REPORTED_LIMITS as a, validationExecution as b, ApiProgram as c, EVIDENCE_LIMITS as d, EvalValidations as f, VALIDATION_TEXT_LIMIT as g, VALIDATION_FRAME as h, API_READY as i, CLI_JOURNAL as l, ReportedValidation as m, API_MANIFEST as n, ApiCall as o, REPORTED_LIMITS as p, API_PROGRAM as r, ApiManifest as s, API_JOURNAL as t, MCP_JOURNAL as u, validationCapture as v, validationSnapshot as x, validationDuration as y };
|
|
@@ -35,6 +35,12 @@ const REPORTED_LIMITS = {
|
|
|
35
35
|
budget: 192e3,
|
|
36
36
|
text: 64e3
|
|
37
37
|
};
|
|
38
|
+
const DurationMs = effect.Schema.transform(effect.Schema.Number, effect.Schema.NonNegativeInt, {
|
|
39
|
+
decode: (value) => Math.max(0, Math.round(value)),
|
|
40
|
+
encode: (value) => value,
|
|
41
|
+
strict: true
|
|
42
|
+
});
|
|
43
|
+
const validationDuration = (startedAt, finished) => startedAt === null ? null : Math.max(0, Math.round(finished - startedAt));
|
|
38
44
|
const valueWithin = (limit) => effect.Schema.Struct({
|
|
39
45
|
text: effect.Schema.String.pipe(effect.Schema.maxLength(limit)),
|
|
40
46
|
format: effect.Schema.Literal("text", "json"),
|
|
@@ -45,7 +51,7 @@ const callOf = (value) => effect.Schema.Struct({
|
|
|
45
51
|
index: effect.Schema.NonNegativeInt,
|
|
46
52
|
method: effect.Schema.Literal("answer", "transcript", "turns", "readText", "exists", "exec", "cli.calls", "api.calls", "api.url", "mcp.calls"),
|
|
47
53
|
startedAt: effect.Schema.Number,
|
|
48
|
-
durationMs: effect.Schema.NullOr(
|
|
54
|
+
durationMs: effect.Schema.NullOr(DurationMs),
|
|
49
55
|
input: value,
|
|
50
56
|
output: value,
|
|
51
57
|
error: effect.Schema.NullOr(value)
|
|
@@ -57,7 +63,7 @@ const validationOf = (value, call) => effect.Schema.Struct({
|
|
|
57
63
|
kind: effect.Schema.Literal("code", "judge", "command"),
|
|
58
64
|
status: effect.Schema.Literal("queued", "running", "passed", "failed", "error", "skipped"),
|
|
59
65
|
startedAt: effect.Schema.NullOr(effect.Schema.Number),
|
|
60
|
-
durationMs: effect.Schema.NullOr(
|
|
66
|
+
durationMs: effect.Schema.NullOr(DurationMs),
|
|
61
67
|
message: effect.Schema.String.pipe(effect.Schema.maxLength(2e3)),
|
|
62
68
|
exitCode: effect.Schema.NullOr(effect.Schema.Int),
|
|
63
69
|
truncated: effect.Schema.Boolean,
|
|
@@ -100,6 +106,30 @@ const unavailableValue = {
|
|
|
100
106
|
state: "unavailable",
|
|
101
107
|
truncated: false
|
|
102
108
|
};
|
|
109
|
+
const withoutText = (value) => value.text === "" ? value : {
|
|
110
|
+
...unavailableValue,
|
|
111
|
+
format: value.format,
|
|
112
|
+
truncated: true
|
|
113
|
+
};
|
|
114
|
+
const orNull = (value) => value === null ? null : withoutText(value);
|
|
115
|
+
const validationWithoutEvidence = (value) => ({
|
|
116
|
+
...value,
|
|
117
|
+
calls: value.calls.map((call) => ({
|
|
118
|
+
...call,
|
|
119
|
+
error: orNull(call.error),
|
|
120
|
+
input: withoutText(call.input),
|
|
121
|
+
output: withoutText(call.output)
|
|
122
|
+
})),
|
|
123
|
+
error: orNull(value.error),
|
|
124
|
+
input: withoutText(value.input),
|
|
125
|
+
logs: value.logs.map((log) => ({
|
|
126
|
+
...log,
|
|
127
|
+
value: withoutText(log.value)
|
|
128
|
+
})),
|
|
129
|
+
output: withoutText(value.output),
|
|
130
|
+
truncated: true,
|
|
131
|
+
...value.metadata === void 0 ? {} : { metadata: withoutText(value.metadata) }
|
|
132
|
+
});
|
|
103
133
|
const validationCapture = (enabled = true, secrets = [], limits = EVIDENCE_LIMITS) => {
|
|
104
134
|
let remaining = limits.budget;
|
|
105
135
|
return (value, format = "json") => {
|
|
@@ -296,6 +326,12 @@ Object.defineProperty(exports, "validationCapture", {
|
|
|
296
326
|
return validationCapture;
|
|
297
327
|
}
|
|
298
328
|
});
|
|
329
|
+
Object.defineProperty(exports, "validationDuration", {
|
|
330
|
+
enumerable: true,
|
|
331
|
+
get: function() {
|
|
332
|
+
return validationDuration;
|
|
333
|
+
}
|
|
334
|
+
});
|
|
299
335
|
Object.defineProperty(exports, "validationExecution", {
|
|
300
336
|
enumerable: true,
|
|
301
337
|
get: function() {
|
|
@@ -308,3 +344,9 @@ Object.defineProperty(exports, "validationSnapshot", {
|
|
|
308
344
|
return validationSnapshot;
|
|
309
345
|
}
|
|
310
346
|
});
|
|
347
|
+
Object.defineProperty(exports, "validationWithoutEvidence", {
|
|
348
|
+
enumerable: true,
|
|
349
|
+
get: function() {
|
|
350
|
+
return validationWithoutEvidence;
|
|
351
|
+
}
|
|
352
|
+
});
|
package/dist/api-runtime.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_runtime = require("./runtime-
|
|
2
|
+
const require_runtime = require("./runtime-V4yw0sb-.cjs");
|
|
3
3
|
exports.runApiServers = require_runtime.runApiServers;
|
|
4
4
|
exports.withApi = require_runtime.withApi;
|
package/dist/api-runtime.d.cts
CHANGED
package/dist/api-runtime.d.mts
CHANGED
package/dist/api-runtime.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as withApi, t as runApiServers } from "./runtime-
|
|
1
|
+
import { n as withApi, t as runApiServers } from "./runtime-DxvthKib.mjs";
|
|
2
2
|
export { runApiServers, withApi };
|
package/dist/api.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_runtime = require("./runtime-
|
|
2
|
+
const require_runtime = require("./runtime-V4yw0sb-.cjs");
|
|
3
3
|
exports.api = require_runtime.api;
|
|
4
4
|
exports.endpoint = require_runtime.endpoint;
|
|
5
5
|
exports.withApi = require_runtime.withApi;
|
package/dist/api.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ApiCall } from "./api-mocks-
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-Bp5izg-M.cjs";
|
|
2
2
|
import { a as endpoint, i as api, n as ApiHandlerContext, r as EndpointDefinition, t as ApiDefinition } from "./define-NZvmQuIv.cjs";
|
|
3
3
|
import { withApi } from "./api-runtime.cjs";
|
|
4
4
|
export { type ApiCall, type ApiDefinition, type ApiHandlerContext, type EndpointDefinition, api, endpoint, withApi };
|
package/dist/api.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ApiCall } from "./api-mocks-
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-Bp5izg-M.mjs";
|
|
2
2
|
import { a as endpoint, i as api, n as ApiHandlerContext, r as EndpointDefinition, t as ApiDefinition } from "./define-NZvmQuIv.mjs";
|
|
3
3
|
import { withApi } from "./api-runtime.mjs";
|
|
4
4
|
export { type ApiCall, type ApiDefinition, type ApiHandlerContext, type EndpointDefinition, api, endpoint, withApi };
|
package/dist/api.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as endpoint, n as withApi, r as api } from "./runtime-
|
|
1
|
+
import { i as endpoint, n as withApi, r as api } from "./runtime-DxvthKib.mjs";
|
|
2
2
|
export { api, endpoint, withApi };
|
package/dist/bin.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_eval_judges = require("./eval-judges-CO0ds-HQ.cjs");
|
|
3
|
-
const require_api_mocks = require("./api-mocks-
|
|
4
|
-
const require_errors = require("./errors-
|
|
5
|
-
const require_compiler = require("./compiler-
|
|
3
|
+
const require_api_mocks = require("./api-mocks-p7nRxMS0.cjs");
|
|
4
|
+
const require_errors = require("./errors-C1vD70D6.cjs");
|
|
5
|
+
const require_compiler = require("./compiler-8DrTWGac.cjs");
|
|
6
6
|
const require_eval_turns = require("./eval-turns-B9dd8Vfb.cjs");
|
|
7
7
|
const require_sandbox_env = require("./sandbox-env-B8cLIcku.cjs");
|
|
8
8
|
let effect = require("effect");
|
|
@@ -17,7 +17,7 @@ let node_os = require("node:os");
|
|
|
17
17
|
let node_child_process = require("node:child_process");
|
|
18
18
|
let node_crypto = require("node:crypto");
|
|
19
19
|
//#region package.json
|
|
20
|
-
var version$1 = "0.1.
|
|
20
|
+
var version$1 = "0.1.29";
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region ../template/src/extract.ts
|
|
23
23
|
/** Reads escapes too, so text the renderer leaves literal is never reported as
|
|
@@ -1795,6 +1795,21 @@ const profileOfRequest = (profile) => profile === void 0 ? null : {
|
|
|
1795
1795
|
//#endregion
|
|
1796
1796
|
//#region ../eval/src/domain/journal-entries.ts
|
|
1797
1797
|
const JOURNAL_OUTPUT_LIMIT = 4e3;
|
|
1798
|
+
const cut = (text) => text.length > JOURNAL_OUTPUT_LIMIT ? `${text.slice(0, JOURNAL_OUTPUT_LIMIT)}\n[the rest was cut before this was sent, ${text.length} characters in all]` : text;
|
|
1799
|
+
const cutIfPresent = (text) => text === void 0 ? text : cut(text);
|
|
1800
|
+
const cutToJournal = (event) => {
|
|
1801
|
+
if (event._tag === "Command") return {
|
|
1802
|
+
...event,
|
|
1803
|
+
output: cut(event.output)
|
|
1804
|
+
};
|
|
1805
|
+
if (event._tag === "ToolCall") return {
|
|
1806
|
+
...event,
|
|
1807
|
+
error: cutIfPresent(event.error),
|
|
1808
|
+
input: cut(event.input),
|
|
1809
|
+
output: cutIfPresent(event.output)
|
|
1810
|
+
};
|
|
1811
|
+
return event;
|
|
1812
|
+
};
|
|
1798
1813
|
const millisOrNull = (at) => at ?? null;
|
|
1799
1814
|
const asEntries = (event) => {
|
|
1800
1815
|
if (event._tag === "Command") return [{
|
|
@@ -3968,6 +3983,10 @@ const TRANSCRIPT_PATH = (home) => `${home}/.anpord-transcript.txt`;
|
|
|
3968
3983
|
const TURNS_PATH = (home) => `${home}/.anpord-turns.json`;
|
|
3969
3984
|
//#endregion
|
|
3970
3985
|
//#region ../eval/src/domain/journal.ts
|
|
3986
|
+
const relativeToWorkspace = (workspace, events) => events.map((event) => event._tag === "FileChange" ? {
|
|
3987
|
+
...event,
|
|
3988
|
+
paths: event.paths.map((path) => node_path.posix.isAbsolute(path) ? node_path.posix.relative(workspace, path) : path)
|
|
3989
|
+
} : event);
|
|
3971
3990
|
const commandsIn = (events) => events.filter((event) => event._tag === "Command").length;
|
|
3972
3991
|
const filesIn = (events) => [...new Set(events.flatMap((event) => event._tag === "FileChange" ? event.paths : []))];
|
|
3973
3992
|
const failedCommandsIn = (events) => events.filter((event) => event._tag === "Command" && event.exitCode !== null && event.exitCode !== 0).length;
|
|
@@ -4118,7 +4137,7 @@ const completeValidations = (records, message, finished, error, exitCode) => {
|
|
|
4118
4137
|
exitCode,
|
|
4119
4138
|
message: message ?? "Validator did not return a complete result",
|
|
4120
4139
|
error: record.error ?? error,
|
|
4121
|
-
durationMs: record.startedAt
|
|
4140
|
+
durationMs: require_api_mocks.validationDuration(record.startedAt, finished)
|
|
4122
4141
|
};
|
|
4123
4142
|
if (record.status === "queued" || record.status === "running") return {
|
|
4124
4143
|
...record,
|
|
@@ -4135,7 +4154,7 @@ const legacyValidation = (record, execution, finished, capture) => {
|
|
|
4135
4154
|
status: raw === null ? "error" : resultStatus(raw.passed),
|
|
4136
4155
|
message: (raw?.message ?? (raw === null ? "Validator returned no valid result" : "")).slice(0, 2e3),
|
|
4137
4156
|
output: raw === null ? record.output : capture(raw),
|
|
4138
|
-
durationMs:
|
|
4157
|
+
durationMs: require_api_mocks.validationDuration(record.startedAt ?? finished, finished),
|
|
4139
4158
|
exitCode: execution.exitCode,
|
|
4140
4159
|
logs: [{
|
|
4141
4160
|
index: 0,
|
|
@@ -5496,7 +5515,7 @@ const AgentTrialLive = effect.Layer.effect(AgentTrial, effect.Effect.gen(functio
|
|
|
5496
5515
|
const apiEvents = yield* api.collect();
|
|
5497
5516
|
yield* effect.Stream.fromIterable(apiEvents).pipe(sink.through, effect.Stream.runDrain);
|
|
5498
5517
|
yield* api.check;
|
|
5499
|
-
const events = [...conversation.events, ...apiEvents];
|
|
5518
|
+
const events = relativeToWorkspace(request.workspace, [...conversation.events, ...apiEvents]);
|
|
5500
5519
|
const modelFinished = yield* effect.Clock.currentTimeMillis;
|
|
5501
5520
|
const artifacts = yield* captureArtifacts(sandbox, request.workspace, filesIn(events), secrets);
|
|
5502
5521
|
const scored = yield* scorer.score({
|
|
@@ -5876,7 +5895,7 @@ const brokenBy = (cause, durationMs, events) => ({
|
|
|
5876
5895
|
timedOut: effect.Option.exists(effect.Cause.failureOption(cause), (error) => error instanceof TrialTimedOut)
|
|
5877
5896
|
});
|
|
5878
5897
|
const reportRequest = (result, ordinal, runId) => result.kind === "scored" ? { payload: {
|
|
5879
|
-
events: result.events,
|
|
5898
|
+
events: result.events.map(cutToJournal),
|
|
5880
5899
|
ordinal,
|
|
5881
5900
|
outcome: result.outcome,
|
|
5882
5901
|
runId,
|
|
@@ -5884,7 +5903,7 @@ const reportRequest = (result, ordinal, runId) => result.kind === "scored" ? { p
|
|
|
5884
5903
|
usage: result.usage,
|
|
5885
5904
|
userSpend: result.userSpend
|
|
5886
5905
|
} } : { payload: {
|
|
5887
|
-
events: result.events,
|
|
5906
|
+
events: result.events.map(cutToJournal),
|
|
5888
5907
|
failure: result.reason,
|
|
5889
5908
|
ordinal,
|
|
5890
5909
|
runId,
|
|
@@ -5903,7 +5922,7 @@ const UNSCORED = {
|
|
|
5903
5922
|
voidFields: []
|
|
5904
5923
|
};
|
|
5905
5924
|
const unscoredForOlderServer = (result, ordinal, runId) => ({ payload: {
|
|
5906
|
-
events: result.events,
|
|
5925
|
+
events: result.events.map(cutToJournal),
|
|
5907
5926
|
ordinal,
|
|
5908
5927
|
outcome: UNSCORED,
|
|
5909
5928
|
runId,
|
|
@@ -5911,6 +5930,17 @@ const unscoredForOlderServer = (result, ordinal, runId) => ({ payload: {
|
|
|
5911
5930
|
usage: null,
|
|
5912
5931
|
userSpend: null
|
|
5913
5932
|
} });
|
|
5933
|
+
const withoutJournal = (result) => ({
|
|
5934
|
+
...result,
|
|
5935
|
+
events: []
|
|
5936
|
+
});
|
|
5937
|
+
const withoutEvidence = (result) => result.kind === "scored" ? {
|
|
5938
|
+
...result,
|
|
5939
|
+
outcome: {
|
|
5940
|
+
...result.outcome,
|
|
5941
|
+
validations: result.outcome.validations.map(require_api_mocks.validationWithoutEvidence)
|
|
5942
|
+
}
|
|
5943
|
+
} : result;
|
|
5914
5944
|
const verdictOf = (result) => result.kind === "scored" ? result.outcome : {
|
|
5915
5945
|
failure: result.reason,
|
|
5916
5946
|
status: result.timedOut ? "timed out" : "void",
|
|
@@ -5936,6 +5966,10 @@ const labelOfRequest = (variant) => formatVariant({
|
|
|
5936
5966
|
model: variant.model,
|
|
5937
5967
|
profile: variant.profile?.name ?? null
|
|
5938
5968
|
});
|
|
5969
|
+
const casesAtOnce = effect.Config.string("EVAL_LOCAL_CASES_AT_ONCE").pipe(effect.Config.withDefault("1"), effect.Config.map((value) => value === "unbounded" ? "unbounded" : Number.parseInt(value, 10)), effect.Config.validate({
|
|
5970
|
+
message: "EVAL_LOCAL_CASES_AT_ONCE must be a positive number or unbounded",
|
|
5971
|
+
validation: (value) => value === "unbounded" || value > 0
|
|
5972
|
+
}));
|
|
5939
5973
|
const localConfig = effect.ConfigProvider.fromEnv().pipe(effect.ConfigProvider.orElse(() => effect.ConfigProvider.fromMap(/* @__PURE__ */ new Map([["ANPORD_LOCAL_SANDBOX", "true"]]))));
|
|
5940
5974
|
const printed = (lines) => lines.length === 0 ? effect.Effect.void : note(lines.join("\n"));
|
|
5941
5975
|
const runVariant = (request, variant, transcript, options) => effect.Effect.gen(function* () {
|
|
@@ -5998,7 +6032,7 @@ const runVariant = (request, variant, transcript, options) => effect.Effect.gen(
|
|
|
5998
6032
|
variant: label
|
|
5999
6033
|
});
|
|
6000
6034
|
});
|
|
6001
|
-
return yield* effect.Effect.forEach(request.cases.flatMap((subject) => ordinals.map((ordinal) => [subject, ordinal])), ([subject, ordinal]) => attempt(subject, ordinal), { concurrency:
|
|
6035
|
+
return yield* effect.Effect.forEach(request.cases.flatMap((subject) => ordinals.map((ordinal) => [subject, ordinal])), ([subject, ordinal]) => attempt(subject, ordinal), { concurrency: yield* casesAtOnce });
|
|
6002
6036
|
}).pipe(effect.Effect.provide(options.credentials === void 0 || options.credentials.size === 0 ? EvalLocalLive : evalLocalWith(credentialResolverFrom(options.credentials))), effect.Effect.scoped);
|
|
6003
6037
|
const runLocally = (request, options = {}) => effect.Effect.gen(function* () {
|
|
6004
6038
|
const transcript = yield* makeTranscriber(stderrStyle());
|
|
@@ -6267,9 +6301,19 @@ const untilClosed = (batchId) => require_errors.AnpordApi.pipe(effect.Effect.fla
|
|
|
6267
6301
|
const refused = require_errors.asAnpordError(error);
|
|
6268
6302
|
return refused.status === CLOSED_BATCH ? effect.Effect.fail(new BatchClosed({ message: refused.message })) : effect.Effect.void;
|
|
6269
6303
|
}), effect.Effect.repeat(effect.Schedule.spaced(LOCAL_BEAT_EVERY)), effect.Effect.zipRight(effect.Effect.never));
|
|
6270
|
-
const
|
|
6304
|
+
const TOO_LARGE = 413;
|
|
6305
|
+
const tooLarge = (error) => _effect_platform.HttpClientError.isHttpClientError(error) && error._tag === "ResponseError" && error.response.status === TOO_LARGE;
|
|
6306
|
+
const SHRUNK = [{
|
|
6307
|
+
gaveUp: "its journal",
|
|
6308
|
+
shrink: withoutJournal
|
|
6309
|
+
}, {
|
|
6310
|
+
gaveUp: "its journal or the evidence its checks captured",
|
|
6311
|
+
shrink: (result) => withoutEvidence(withoutJournal(result))
|
|
6312
|
+
}];
|
|
6313
|
+
const reportTrial = (api, result, ordinal, runId, trial) => {
|
|
6271
6314
|
const send = (request) => retryTransient(api.runner.report(request));
|
|
6272
|
-
|
|
6315
|
+
const sendTrial = (sent) => send(reportRequest(sent, ordinal, runId)).pipe(effect.Effect.catchTag("HttpApiDecodeError", (refused) => sent.kind === "broken" ? send(unscoredForOlderServer(sent, ordinal, runId)) : effect.Effect.fail(refused)));
|
|
6316
|
+
return SHRUNK.reduce((attempt, rung) => attempt.pipe(effect.Effect.catchIf(tooLarge, () => sendTrial(rung.shrink(result)).pipe(effect.Effect.zipRight(note(`A trial of ${trial} was too large for Anpord to take, so its verdict was recorded without ${rung.gaveUp}.`))))), sendTrial(result));
|
|
6273
6317
|
};
|
|
6274
6318
|
const recordInto = (label, request, ui, started) => effect.Effect.gen(function* () {
|
|
6275
6319
|
const api = yield* require_errors.AnpordApi;
|
|
@@ -6282,7 +6326,10 @@ const recordInto = (label, request, ui, started) => effect.Effect.gen(function*
|
|
|
6282
6326
|
return {
|
|
6283
6327
|
cases: yield* runLocally(request, {
|
|
6284
6328
|
credentials: leases,
|
|
6285
|
-
onTrial: (slot, result, ordinal) =>
|
|
6329
|
+
onTrial: (slot, result, ordinal) => {
|
|
6330
|
+
const trial = `${slot.caseId} on ${labelOfRequest(slot.variant)}`;
|
|
6331
|
+
return reportTrial(api, result, ordinal, runIdOf(slot), trial).pipe(effect.Effect.catchAll((error) => note(`A trial of ${trial} was not recorded, so it shows as void. ${require_errors.asAnpordError(error).message}`)));
|
|
6332
|
+
}
|
|
6286
6333
|
}),
|
|
6287
6334
|
costs: yield* finishBatch(started.id),
|
|
6288
6335
|
link: effect.Option.some(link)
|
package/dist/bin.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { i as HarnessUsage, r as HarnessEvent } from "./eval-judges-DVxvZQl5.mjs";
|
|
3
|
-
import { b as
|
|
4
|
-
import { C as VersionNumber, S as PromptId, _ as EvalHarness, a as apiKeyConfig, b as Permission, c as AnpordApi, d as IdempotencyKey, g as EvalBatch, i as ClientLayer, o as webUrlConfig, p as WEB_ORIGIN, r as asAnpordError, s as tokenMatcher, u as neverAnswered, v as isSettledTrial, x as ChannelName, y as COST_COMPONENT_LABELS } from "./errors-
|
|
5
|
-
import { f as DEFAULT_TIMEOUT_MS$1, o as EvalSandbox, p as EvalCaseId, r as compileEvalEffect, u as EvalTrigger } from "./compiler-
|
|
3
|
+
import { C as redactSecrets, S as validationWithoutEvidence, b as validationExecution, c as ApiProgram, d as EVIDENCE_LIMITS, g as VALIDATION_TEXT_LIMIT, h as VALIDATION_FRAME, i as API_READY, m as ReportedValidation, o as ApiCall, r as API_PROGRAM, s as ApiManifest, t as API_JOURNAL, v as validationCapture, x as validationSnapshot, y as validationDuration } from "./api-mocks-DDs4SgSW.mjs";
|
|
4
|
+
import { C as VersionNumber, S as PromptId, _ as EvalHarness, a as apiKeyConfig, b as Permission, c as AnpordApi, d as IdempotencyKey, g as EvalBatch, i as ClientLayer, o as webUrlConfig, p as WEB_ORIGIN, r as asAnpordError, s as tokenMatcher, u as neverAnswered, v as isSettledTrial, x as ChannelName, y as COST_COMPONENT_LABELS } from "./errors-H6woEW0d.mjs";
|
|
5
|
+
import { f as DEFAULT_TIMEOUT_MS$1, o as EvalSandbox, p as EvalCaseId, r as compileEvalEffect, u as EvalTrigger } from "./compiler-dmc6AOx6.mjs";
|
|
6
6
|
import { t as DEFAULT_USER_MODEL } from "./eval-turns-JXtnOI0D.mjs";
|
|
7
7
|
import { a as TRANSCRIPT_ENV, i as PREPARE_VALUE_ENV, n as CACHE_RESTORED_ENV, o as TURNS_ENV, r as PREPARE_RESULT_MARKER, t as ANSWER_ENV } from "./sandbox-env-s-smXj2C.mjs";
|
|
8
8
|
import { Array as Array$1, Cause, Chunk, Clock, Config, ConfigProvider, Console, Context, Data, Deferred, Duration, Effect, Either, Exit, Fiber, JSONSchema, Layer, Option, ParseResult, Predicate, Random, Redacted, Ref, Schedule, ScheduleDecision, Schema, Scope, Stream, pipe } from "effect";
|
|
@@ -17,7 +17,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
17
17
|
import { spawn } from "node:child_process";
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
19
19
|
//#region package.json
|
|
20
|
-
var version$1 = "0.1.
|
|
20
|
+
var version$1 = "0.1.29";
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region ../template/src/extract.ts
|
|
23
23
|
/** Reads escapes too, so text the renderer leaves literal is never reported as
|
|
@@ -1795,6 +1795,21 @@ const profileOfRequest = (profile) => profile === void 0 ? null : {
|
|
|
1795
1795
|
//#endregion
|
|
1796
1796
|
//#region ../eval/src/domain/journal-entries.ts
|
|
1797
1797
|
const JOURNAL_OUTPUT_LIMIT = 4e3;
|
|
1798
|
+
const cut = (text) => text.length > JOURNAL_OUTPUT_LIMIT ? `${text.slice(0, JOURNAL_OUTPUT_LIMIT)}\n[the rest was cut before this was sent, ${text.length} characters in all]` : text;
|
|
1799
|
+
const cutIfPresent = (text) => text === void 0 ? text : cut(text);
|
|
1800
|
+
const cutToJournal = (event) => {
|
|
1801
|
+
if (event._tag === "Command") return {
|
|
1802
|
+
...event,
|
|
1803
|
+
output: cut(event.output)
|
|
1804
|
+
};
|
|
1805
|
+
if (event._tag === "ToolCall") return {
|
|
1806
|
+
...event,
|
|
1807
|
+
error: cutIfPresent(event.error),
|
|
1808
|
+
input: cut(event.input),
|
|
1809
|
+
output: cutIfPresent(event.output)
|
|
1810
|
+
};
|
|
1811
|
+
return event;
|
|
1812
|
+
};
|
|
1798
1813
|
const millisOrNull = (at) => at ?? null;
|
|
1799
1814
|
const asEntries = (event) => {
|
|
1800
1815
|
if (event._tag === "Command") return [{
|
|
@@ -3968,6 +3983,10 @@ const TRANSCRIPT_PATH = (home) => `${home}/.anpord-transcript.txt`;
|
|
|
3968
3983
|
const TURNS_PATH = (home) => `${home}/.anpord-turns.json`;
|
|
3969
3984
|
//#endregion
|
|
3970
3985
|
//#region ../eval/src/domain/journal.ts
|
|
3986
|
+
const relativeToWorkspace = (workspace, events) => events.map((event) => event._tag === "FileChange" ? {
|
|
3987
|
+
...event,
|
|
3988
|
+
paths: event.paths.map((path) => posix.isAbsolute(path) ? posix.relative(workspace, path) : path)
|
|
3989
|
+
} : event);
|
|
3971
3990
|
const commandsIn = (events) => events.filter((event) => event._tag === "Command").length;
|
|
3972
3991
|
const filesIn = (events) => [...new Set(events.flatMap((event) => event._tag === "FileChange" ? event.paths : []))];
|
|
3973
3992
|
const failedCommandsIn = (events) => events.filter((event) => event._tag === "Command" && event.exitCode !== null && event.exitCode !== 0).length;
|
|
@@ -4118,7 +4137,7 @@ const completeValidations = (records, message, finished, error, exitCode) => {
|
|
|
4118
4137
|
exitCode,
|
|
4119
4138
|
message: message ?? "Validator did not return a complete result",
|
|
4120
4139
|
error: record.error ?? error,
|
|
4121
|
-
durationMs: record.startedAt
|
|
4140
|
+
durationMs: validationDuration(record.startedAt, finished)
|
|
4122
4141
|
};
|
|
4123
4142
|
if (record.status === "queued" || record.status === "running") return {
|
|
4124
4143
|
...record,
|
|
@@ -4135,7 +4154,7 @@ const legacyValidation = (record, execution, finished, capture) => {
|
|
|
4135
4154
|
status: raw === null ? "error" : resultStatus(raw.passed),
|
|
4136
4155
|
message: (raw?.message ?? (raw === null ? "Validator returned no valid result" : "")).slice(0, 2e3),
|
|
4137
4156
|
output: raw === null ? record.output : capture(raw),
|
|
4138
|
-
durationMs:
|
|
4157
|
+
durationMs: validationDuration(record.startedAt ?? finished, finished),
|
|
4139
4158
|
exitCode: execution.exitCode,
|
|
4140
4159
|
logs: [{
|
|
4141
4160
|
index: 0,
|
|
@@ -5496,7 +5515,7 @@ const AgentTrialLive = Layer.effect(AgentTrial, Effect.gen(function* () {
|
|
|
5496
5515
|
const apiEvents = yield* api.collect();
|
|
5497
5516
|
yield* Stream.fromIterable(apiEvents).pipe(sink.through, Stream.runDrain);
|
|
5498
5517
|
yield* api.check;
|
|
5499
|
-
const events = [...conversation.events, ...apiEvents];
|
|
5518
|
+
const events = relativeToWorkspace(request.workspace, [...conversation.events, ...apiEvents]);
|
|
5500
5519
|
const modelFinished = yield* Clock.currentTimeMillis;
|
|
5501
5520
|
const artifacts = yield* captureArtifacts(sandbox, request.workspace, filesIn(events), secrets);
|
|
5502
5521
|
const scored = yield* scorer.score({
|
|
@@ -5876,7 +5895,7 @@ const brokenBy = (cause, durationMs, events) => ({
|
|
|
5876
5895
|
timedOut: Option.exists(Cause.failureOption(cause), (error) => error instanceof TrialTimedOut)
|
|
5877
5896
|
});
|
|
5878
5897
|
const reportRequest = (result, ordinal, runId) => result.kind === "scored" ? { payload: {
|
|
5879
|
-
events: result.events,
|
|
5898
|
+
events: result.events.map(cutToJournal),
|
|
5880
5899
|
ordinal,
|
|
5881
5900
|
outcome: result.outcome,
|
|
5882
5901
|
runId,
|
|
@@ -5884,7 +5903,7 @@ const reportRequest = (result, ordinal, runId) => result.kind === "scored" ? { p
|
|
|
5884
5903
|
usage: result.usage,
|
|
5885
5904
|
userSpend: result.userSpend
|
|
5886
5905
|
} } : { payload: {
|
|
5887
|
-
events: result.events,
|
|
5906
|
+
events: result.events.map(cutToJournal),
|
|
5888
5907
|
failure: result.reason,
|
|
5889
5908
|
ordinal,
|
|
5890
5909
|
runId,
|
|
@@ -5903,7 +5922,7 @@ const UNSCORED = {
|
|
|
5903
5922
|
voidFields: []
|
|
5904
5923
|
};
|
|
5905
5924
|
const unscoredForOlderServer = (result, ordinal, runId) => ({ payload: {
|
|
5906
|
-
events: result.events,
|
|
5925
|
+
events: result.events.map(cutToJournal),
|
|
5907
5926
|
ordinal,
|
|
5908
5927
|
outcome: UNSCORED,
|
|
5909
5928
|
runId,
|
|
@@ -5911,6 +5930,17 @@ const unscoredForOlderServer = (result, ordinal, runId) => ({ payload: {
|
|
|
5911
5930
|
usage: null,
|
|
5912
5931
|
userSpend: null
|
|
5913
5932
|
} });
|
|
5933
|
+
const withoutJournal = (result) => ({
|
|
5934
|
+
...result,
|
|
5935
|
+
events: []
|
|
5936
|
+
});
|
|
5937
|
+
const withoutEvidence = (result) => result.kind === "scored" ? {
|
|
5938
|
+
...result,
|
|
5939
|
+
outcome: {
|
|
5940
|
+
...result.outcome,
|
|
5941
|
+
validations: result.outcome.validations.map(validationWithoutEvidence)
|
|
5942
|
+
}
|
|
5943
|
+
} : result;
|
|
5914
5944
|
const verdictOf = (result) => result.kind === "scored" ? result.outcome : {
|
|
5915
5945
|
failure: result.reason,
|
|
5916
5946
|
status: result.timedOut ? "timed out" : "void",
|
|
@@ -5936,6 +5966,10 @@ const labelOfRequest = (variant) => formatVariant({
|
|
|
5936
5966
|
model: variant.model,
|
|
5937
5967
|
profile: variant.profile?.name ?? null
|
|
5938
5968
|
});
|
|
5969
|
+
const casesAtOnce = Config.string("EVAL_LOCAL_CASES_AT_ONCE").pipe(Config.withDefault("1"), Config.map((value) => value === "unbounded" ? "unbounded" : Number.parseInt(value, 10)), Config.validate({
|
|
5970
|
+
message: "EVAL_LOCAL_CASES_AT_ONCE must be a positive number or unbounded",
|
|
5971
|
+
validation: (value) => value === "unbounded" || value > 0
|
|
5972
|
+
}));
|
|
5939
5973
|
const localConfig = ConfigProvider.fromEnv().pipe(ConfigProvider.orElse(() => ConfigProvider.fromMap(/* @__PURE__ */ new Map([["ANPORD_LOCAL_SANDBOX", "true"]]))));
|
|
5940
5974
|
const printed = (lines) => lines.length === 0 ? Effect.void : note(lines.join("\n"));
|
|
5941
5975
|
const runVariant = (request, variant, transcript, options) => Effect.gen(function* () {
|
|
@@ -5998,7 +6032,7 @@ const runVariant = (request, variant, transcript, options) => Effect.gen(functio
|
|
|
5998
6032
|
variant: label
|
|
5999
6033
|
});
|
|
6000
6034
|
});
|
|
6001
|
-
return yield* Effect.forEach(request.cases.flatMap((subject) => ordinals.map((ordinal) => [subject, ordinal])), ([subject, ordinal]) => attempt(subject, ordinal), { concurrency:
|
|
6035
|
+
return yield* Effect.forEach(request.cases.flatMap((subject) => ordinals.map((ordinal) => [subject, ordinal])), ([subject, ordinal]) => attempt(subject, ordinal), { concurrency: yield* casesAtOnce });
|
|
6002
6036
|
}).pipe(Effect.provide(options.credentials === void 0 || options.credentials.size === 0 ? EvalLocalLive : evalLocalWith(credentialResolverFrom(options.credentials))), Effect.scoped);
|
|
6003
6037
|
const runLocally = (request, options = {}) => Effect.gen(function* () {
|
|
6004
6038
|
const transcript = yield* makeTranscriber(stderrStyle());
|
|
@@ -6267,9 +6301,19 @@ const untilClosed = (batchId) => AnpordApi.pipe(Effect.flatMap((api) => api.runn
|
|
|
6267
6301
|
const refused = asAnpordError(error);
|
|
6268
6302
|
return refused.status === CLOSED_BATCH ? Effect.fail(new BatchClosed({ message: refused.message })) : Effect.void;
|
|
6269
6303
|
}), Effect.repeat(Schedule.spaced(LOCAL_BEAT_EVERY)), Effect.zipRight(Effect.never));
|
|
6270
|
-
const
|
|
6304
|
+
const TOO_LARGE = 413;
|
|
6305
|
+
const tooLarge = (error) => HttpClientError.isHttpClientError(error) && error._tag === "ResponseError" && error.response.status === TOO_LARGE;
|
|
6306
|
+
const SHRUNK = [{
|
|
6307
|
+
gaveUp: "its journal",
|
|
6308
|
+
shrink: withoutJournal
|
|
6309
|
+
}, {
|
|
6310
|
+
gaveUp: "its journal or the evidence its checks captured",
|
|
6311
|
+
shrink: (result) => withoutEvidence(withoutJournal(result))
|
|
6312
|
+
}];
|
|
6313
|
+
const reportTrial = (api, result, ordinal, runId, trial) => {
|
|
6271
6314
|
const send = (request) => retryTransient(api.runner.report(request));
|
|
6272
|
-
|
|
6315
|
+
const sendTrial = (sent) => send(reportRequest(sent, ordinal, runId)).pipe(Effect.catchTag("HttpApiDecodeError", (refused) => sent.kind === "broken" ? send(unscoredForOlderServer(sent, ordinal, runId)) : Effect.fail(refused)));
|
|
6316
|
+
return SHRUNK.reduce((attempt, rung) => attempt.pipe(Effect.catchIf(tooLarge, () => sendTrial(rung.shrink(result)).pipe(Effect.zipRight(note(`A trial of ${trial} was too large for Anpord to take, so its verdict was recorded without ${rung.gaveUp}.`))))), sendTrial(result));
|
|
6273
6317
|
};
|
|
6274
6318
|
const recordInto = (label, request, ui, started) => Effect.gen(function* () {
|
|
6275
6319
|
const api = yield* AnpordApi;
|
|
@@ -6282,7 +6326,10 @@ const recordInto = (label, request, ui, started) => Effect.gen(function* () {
|
|
|
6282
6326
|
return {
|
|
6283
6327
|
cases: yield* runLocally(request, {
|
|
6284
6328
|
credentials: leases,
|
|
6285
|
-
onTrial: (slot, result, ordinal) =>
|
|
6329
|
+
onTrial: (slot, result, ordinal) => {
|
|
6330
|
+
const trial = `${slot.caseId} on ${labelOfRequest(slot.variant)}`;
|
|
6331
|
+
return reportTrial(api, result, ordinal, runIdOf(slot), trial).pipe(Effect.catchAll((error) => note(`A trial of ${trial} was not recorded, so it shows as void. ${asAnpordError(error).message}`)));
|
|
6332
|
+
}
|
|
6286
6333
|
}),
|
|
6287
6334
|
costs: yield* finishBatch(started.id),
|
|
6288
6335
|
link: Option.some(link)
|