anpord 0.1.13 → 0.1.17
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 +1 -1
- package/dist/api-context.cjs +18 -0
- package/dist/api-context.d.cts +8 -0
- package/dist/api-context.d.mts +8 -0
- package/dist/api-context.mjs +17 -0
- package/dist/api-mocks-BXZmPUwV.d.cts +101 -0
- package/dist/api-mocks-BXZmPUwV.d.mts +101 -0
- package/dist/api-mocks-CuVw86Qw.cjs +68 -0
- package/dist/api-mocks-wNUnpzJf.mjs +33 -0
- package/dist/api-runtime.cjs +4 -0
- package/dist/api-runtime.d.cts +13 -0
- package/dist/api-runtime.d.mts +13 -0
- package/dist/api-runtime.mjs +2 -0
- package/dist/api.cjs +5 -0
- package/dist/api.d.cts +4 -0
- package/dist/api.d.mts +4 -0
- package/dist/api.mjs +2 -0
- package/dist/bin.cjs +8 -8
- package/dist/bin.mjs +6 -6
- package/dist/cli-runtime.cjs +9 -26
- package/dist/cli-runtime.mjs +5 -22
- package/dist/{client-BirFO3jz.d.cts → client-BVoIRPot.d.cts} +1082 -1082
- package/dist/{client-BfdjFtlV.mjs → client-DE3YNtWc.mjs} +3 -90
- package/dist/{client-C-P2I00z.cjs → client-DziJjMFh.cjs} +4 -91
- package/dist/{client-BgRs8JvW.d.mts → client-_OgJhHpJ.d.mts} +1083 -1083
- package/dist/{compiler-D96wI7UP.mjs → compiler-C62ss3a4.mjs} +161 -61
- package/dist/{compiler-uwb1pkdK.cjs → compiler-CYwJNlT4.cjs} +202 -72
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/define-NZvmQuIv.d.cts +34 -0
- package/dist/define-NZvmQuIv.d.mts +34 -0
- package/dist/{eval-judges-DPPUftbh.d.cts → eval-judges-0FkhUOIB.d.cts} +2 -2
- package/dist/{eval-judges-DPPUftbh.d.mts → eval-judges-0FkhUOIB.d.mts} +2 -2
- package/dist/{eval-judges-BkmiVLLq.cjs → eval-judges-1zF4PVqV.cjs} +1 -1
- package/dist/{eval-judges-CwTvTq7N.mjs → eval-judges-Bee_ABJt.mjs} +1 -1
- package/dist/{eval-validations-_MlnQ_uv.cjs → eval-validations-BdlPhudg.cjs} +8 -2
- package/dist/{eval-validations-BRdoZrTQ.mjs → eval-validations-BvX9dkYh.mjs} +3 -3
- package/dist/eval.cjs +4 -1
- package/dist/eval.d.cts +275 -25
- package/dist/eval.d.mts +275 -25
- package/dist/eval.mjs +2 -2
- package/dist/{evals-B6aT3xgH.d.cts → evals-CFxc4IrF.d.cts} +124 -124
- package/dist/{evals-B6aT3xgH.d.mts → evals-CFxc4IrF.d.mts} +124 -124
- package/dist/{evals-DouMsrsM.cjs → evals-api-CqhPZCr5.cjs} +104 -73
- package/dist/{evals-Dcc_x6jW.mjs → evals-api-CsdU741J.mjs} +96 -5
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +12 -8
- package/dist/index.d.mts +13 -9
- package/dist/index.mjs +7 -7
- package/dist/mcp-runtime.cjs +9 -18
- package/dist/mcp-runtime.mjs +5 -14
- package/dist/mock-journal-Bnaozlx4.cjs +39 -0
- package/dist/mock-journal-rbsXfDRs.mjs +22 -0
- package/dist/runtime-CXcsGvwP.cjs +292 -0
- package/dist/runtime-DDUrsAI-.mjs +269 -0
- package/dist/source.d.cts +1 -1
- package/dist/source.d.mts +1 -1
- package/dist/{types-Codjaq-o.d.mts → types-BjQf9IIi.d.mts} +21 -11
- package/dist/{types-ISsteq95.d.cts → types-C2nRDJ95.d.cts} +20 -10
- package/dist/validator-runtime.cjs +6 -1
- package/dist/validator-runtime.d.cts +1 -1
- package/dist/validator-runtime.d.mts +1 -1
- package/dist/validator-runtime.mjs +6 -1
- package/dist/validators.cjs +1 -1
- package/dist/validators.d.cts +1 -1
- package/dist/validators.d.mts +1 -1
- package/dist/validators.mjs +1 -1
- package/package.json +21 -1
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ const correctness = judge({
|
|
|
93
93
|
name: "correctness",
|
|
94
94
|
harness: "codex",
|
|
95
95
|
model: "gpt-5.6-sol",
|
|
96
|
-
|
|
96
|
+
prompt: "The answer matches the reference without inventing facts.",
|
|
97
97
|
expected: "Ada",
|
|
98
98
|
choices: { correct: 1, incorrect: 0 },
|
|
99
99
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_api_mocks = require("./api-mocks-CuVw86Qw.cjs");
|
|
3
|
+
let effect = require("effect");
|
|
4
|
+
let node_fs_promises = require("node:fs/promises");
|
|
5
|
+
//#region src/mock-api/context.ts
|
|
6
|
+
const apiContext = {
|
|
7
|
+
url: async (name) => {
|
|
8
|
+
const api = effect.Schema.decodeUnknownSync(effect.Schema.parseJson(require_api_mocks.ApiManifest))(await (0, node_fs_promises.readFile)(require_api_mocks.API_MANIFEST, "utf8")).find((entry) => entry.name === name);
|
|
9
|
+
if (api === void 0) throw new Error(`API mock not configured: ${name}`);
|
|
10
|
+
return api.url;
|
|
11
|
+
},
|
|
12
|
+
calls: async (name) => {
|
|
13
|
+
const text = await (0, node_fs_promises.readFile)(require_api_mocks.API_JOURNAL, "utf8");
|
|
14
|
+
return text.trim() === "" ? [] : text.trim().split("\n").map((line) => effect.Schema.decodeUnknownSync(effect.Schema.parseJson(require_api_mocks.ApiCall))(line)).filter((call) => name === void 0 || call.api === name);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.apiContext = apiContext;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-BXZmPUwV.cjs";
|
|
2
|
+
//#region src/mock-api/context.d.ts
|
|
3
|
+
declare const apiContext: {
|
|
4
|
+
url: (name: string) => Promise<string>;
|
|
5
|
+
calls: (name?: string) => Promise<readonly ApiCall[]>;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { apiContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-BXZmPUwV.mjs";
|
|
2
|
+
//#region src/mock-api/context.d.ts
|
|
3
|
+
declare const apiContext: {
|
|
4
|
+
url: (name: string) => Promise<string>;
|
|
5
|
+
calls: (name?: string) => Promise<readonly ApiCall[]>;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { apiContext };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a as ApiCall, n as API_MANIFEST, o as ApiManifest, t as API_JOURNAL } from "./api-mocks-wNUnpzJf.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
//#region src/mock-api/context.ts
|
|
5
|
+
const apiContext = {
|
|
6
|
+
url: async (name) => {
|
|
7
|
+
const api = Schema.decodeUnknownSync(Schema.parseJson(ApiManifest))(await readFile(API_MANIFEST, "utf8")).find((entry) => entry.name === name);
|
|
8
|
+
if (api === void 0) throw new Error(`API mock not configured: ${name}`);
|
|
9
|
+
return api.url;
|
|
10
|
+
},
|
|
11
|
+
calls: async (name) => {
|
|
12
|
+
const text = await readFile(API_JOURNAL, "utf8");
|
|
13
|
+
return text.trim() === "" ? [] : text.trim().split("\n").map((line) => Schema.decodeUnknownSync(Schema.parseJson(ApiCall))(line)).filter((call) => name === void 0 || call.api === name);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { apiContext };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
//#region ../schema/src/domain/api-mocks.d.ts
|
|
3
|
+
declare const ApiCall_base: Schema.Class<ApiCall, {
|
|
4
|
+
api: typeof Schema.String;
|
|
5
|
+
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
6
|
+
method: typeof Schema.String;
|
|
7
|
+
path: typeof Schema.String;
|
|
8
|
+
matched: typeof Schema.Boolean;
|
|
9
|
+
startedAt: typeof Schema.Number;
|
|
10
|
+
durationMs: Schema.refine<number, typeof Schema.NonNegative>;
|
|
11
|
+
input: Schema.Struct<{
|
|
12
|
+
text: Schema.filter<typeof Schema.String>;
|
|
13
|
+
format: Schema.Literal<["text", "json"]>;
|
|
14
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
15
|
+
truncated: typeof Schema.Boolean;
|
|
16
|
+
}>;
|
|
17
|
+
output: Schema.Struct<{
|
|
18
|
+
text: Schema.filter<typeof Schema.String>;
|
|
19
|
+
format: Schema.Literal<["text", "json"]>;
|
|
20
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
21
|
+
truncated: typeof Schema.Boolean;
|
|
22
|
+
}>;
|
|
23
|
+
status: typeof Schema.Int;
|
|
24
|
+
error: Schema.NullOr<Schema.filter<typeof Schema.String>>;
|
|
25
|
+
logs: Schema.filter<Schema.Array$<Schema.Struct<{
|
|
26
|
+
text: Schema.filter<typeof Schema.String>;
|
|
27
|
+
format: Schema.Literal<["text", "json"]>;
|
|
28
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
29
|
+
truncated: typeof Schema.Boolean;
|
|
30
|
+
}>>>;
|
|
31
|
+
}, Schema.Struct.Encoded<{
|
|
32
|
+
api: typeof Schema.String;
|
|
33
|
+
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
34
|
+
method: typeof Schema.String;
|
|
35
|
+
path: typeof Schema.String;
|
|
36
|
+
matched: typeof Schema.Boolean;
|
|
37
|
+
startedAt: typeof Schema.Number;
|
|
38
|
+
durationMs: Schema.refine<number, typeof Schema.NonNegative>;
|
|
39
|
+
input: Schema.Struct<{
|
|
40
|
+
text: Schema.filter<typeof Schema.String>;
|
|
41
|
+
format: Schema.Literal<["text", "json"]>;
|
|
42
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
43
|
+
truncated: typeof Schema.Boolean;
|
|
44
|
+
}>;
|
|
45
|
+
output: Schema.Struct<{
|
|
46
|
+
text: Schema.filter<typeof Schema.String>;
|
|
47
|
+
format: Schema.Literal<["text", "json"]>;
|
|
48
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
49
|
+
truncated: typeof Schema.Boolean;
|
|
50
|
+
}>;
|
|
51
|
+
status: typeof Schema.Int;
|
|
52
|
+
error: Schema.NullOr<Schema.filter<typeof Schema.String>>;
|
|
53
|
+
logs: Schema.filter<Schema.Array$<Schema.Struct<{
|
|
54
|
+
text: Schema.filter<typeof Schema.String>;
|
|
55
|
+
format: Schema.Literal<["text", "json"]>;
|
|
56
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
57
|
+
truncated: typeof Schema.Boolean;
|
|
58
|
+
}>>>;
|
|
59
|
+
}>, never, {
|
|
60
|
+
readonly api: string;
|
|
61
|
+
} & {
|
|
62
|
+
readonly path: string;
|
|
63
|
+
} & {
|
|
64
|
+
readonly index: number;
|
|
65
|
+
} & {
|
|
66
|
+
readonly error: string | null;
|
|
67
|
+
} & {
|
|
68
|
+
readonly output: {
|
|
69
|
+
readonly format: "text" | "json";
|
|
70
|
+
readonly truncated: boolean;
|
|
71
|
+
readonly text: string;
|
|
72
|
+
readonly state: "captured" | "disabled" | "unavailable";
|
|
73
|
+
};
|
|
74
|
+
} & {
|
|
75
|
+
readonly input: {
|
|
76
|
+
readonly format: "text" | "json";
|
|
77
|
+
readonly truncated: boolean;
|
|
78
|
+
readonly text: string;
|
|
79
|
+
readonly state: "captured" | "disabled" | "unavailable";
|
|
80
|
+
};
|
|
81
|
+
} & {
|
|
82
|
+
readonly startedAt: number;
|
|
83
|
+
} & {
|
|
84
|
+
readonly status: number;
|
|
85
|
+
} & {
|
|
86
|
+
readonly durationMs: number;
|
|
87
|
+
} & {
|
|
88
|
+
readonly method: string;
|
|
89
|
+
} & {
|
|
90
|
+
readonly logs: readonly {
|
|
91
|
+
readonly format: "text" | "json";
|
|
92
|
+
readonly truncated: boolean;
|
|
93
|
+
readonly text: string;
|
|
94
|
+
readonly state: "captured" | "disabled" | "unavailable";
|
|
95
|
+
}[];
|
|
96
|
+
} & {
|
|
97
|
+
readonly matched: boolean;
|
|
98
|
+
}, {}, {}>;
|
|
99
|
+
declare class ApiCall extends ApiCall_base {}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { ApiCall as t };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
//#region ../schema/src/domain/api-mocks.d.ts
|
|
3
|
+
declare const ApiCall_base: Schema.Class<ApiCall, {
|
|
4
|
+
api: typeof Schema.String;
|
|
5
|
+
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
6
|
+
method: typeof Schema.String;
|
|
7
|
+
path: typeof Schema.String;
|
|
8
|
+
matched: typeof Schema.Boolean;
|
|
9
|
+
startedAt: typeof Schema.Number;
|
|
10
|
+
durationMs: Schema.refine<number, typeof Schema.NonNegative>;
|
|
11
|
+
input: Schema.Struct<{
|
|
12
|
+
text: Schema.filter<typeof Schema.String>;
|
|
13
|
+
format: Schema.Literal<["text", "json"]>;
|
|
14
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
15
|
+
truncated: typeof Schema.Boolean;
|
|
16
|
+
}>;
|
|
17
|
+
output: Schema.Struct<{
|
|
18
|
+
text: Schema.filter<typeof Schema.String>;
|
|
19
|
+
format: Schema.Literal<["text", "json"]>;
|
|
20
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
21
|
+
truncated: typeof Schema.Boolean;
|
|
22
|
+
}>;
|
|
23
|
+
status: typeof Schema.Int;
|
|
24
|
+
error: Schema.NullOr<Schema.filter<typeof Schema.String>>;
|
|
25
|
+
logs: Schema.filter<Schema.Array$<Schema.Struct<{
|
|
26
|
+
text: Schema.filter<typeof Schema.String>;
|
|
27
|
+
format: Schema.Literal<["text", "json"]>;
|
|
28
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
29
|
+
truncated: typeof Schema.Boolean;
|
|
30
|
+
}>>>;
|
|
31
|
+
}, Schema.Struct.Encoded<{
|
|
32
|
+
api: typeof Schema.String;
|
|
33
|
+
index: Schema.refine<number, typeof Schema.NonNegative>;
|
|
34
|
+
method: typeof Schema.String;
|
|
35
|
+
path: typeof Schema.String;
|
|
36
|
+
matched: typeof Schema.Boolean;
|
|
37
|
+
startedAt: typeof Schema.Number;
|
|
38
|
+
durationMs: Schema.refine<number, typeof Schema.NonNegative>;
|
|
39
|
+
input: Schema.Struct<{
|
|
40
|
+
text: Schema.filter<typeof Schema.String>;
|
|
41
|
+
format: Schema.Literal<["text", "json"]>;
|
|
42
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
43
|
+
truncated: typeof Schema.Boolean;
|
|
44
|
+
}>;
|
|
45
|
+
output: Schema.Struct<{
|
|
46
|
+
text: Schema.filter<typeof Schema.String>;
|
|
47
|
+
format: Schema.Literal<["text", "json"]>;
|
|
48
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
49
|
+
truncated: typeof Schema.Boolean;
|
|
50
|
+
}>;
|
|
51
|
+
status: typeof Schema.Int;
|
|
52
|
+
error: Schema.NullOr<Schema.filter<typeof Schema.String>>;
|
|
53
|
+
logs: Schema.filter<Schema.Array$<Schema.Struct<{
|
|
54
|
+
text: Schema.filter<typeof Schema.String>;
|
|
55
|
+
format: Schema.Literal<["text", "json"]>;
|
|
56
|
+
state: Schema.Literal<["captured", "disabled", "unavailable"]>;
|
|
57
|
+
truncated: typeof Schema.Boolean;
|
|
58
|
+
}>>>;
|
|
59
|
+
}>, never, {
|
|
60
|
+
readonly api: string;
|
|
61
|
+
} & {
|
|
62
|
+
readonly path: string;
|
|
63
|
+
} & {
|
|
64
|
+
readonly index: number;
|
|
65
|
+
} & {
|
|
66
|
+
readonly error: string | null;
|
|
67
|
+
} & {
|
|
68
|
+
readonly output: {
|
|
69
|
+
readonly format: "text" | "json";
|
|
70
|
+
readonly truncated: boolean;
|
|
71
|
+
readonly text: string;
|
|
72
|
+
readonly state: "captured" | "disabled" | "unavailable";
|
|
73
|
+
};
|
|
74
|
+
} & {
|
|
75
|
+
readonly input: {
|
|
76
|
+
readonly format: "text" | "json";
|
|
77
|
+
readonly truncated: boolean;
|
|
78
|
+
readonly text: string;
|
|
79
|
+
readonly state: "captured" | "disabled" | "unavailable";
|
|
80
|
+
};
|
|
81
|
+
} & {
|
|
82
|
+
readonly startedAt: number;
|
|
83
|
+
} & {
|
|
84
|
+
readonly status: number;
|
|
85
|
+
} & {
|
|
86
|
+
readonly durationMs: number;
|
|
87
|
+
} & {
|
|
88
|
+
readonly method: string;
|
|
89
|
+
} & {
|
|
90
|
+
readonly logs: readonly {
|
|
91
|
+
readonly format: "text" | "json";
|
|
92
|
+
readonly truncated: boolean;
|
|
93
|
+
readonly text: string;
|
|
94
|
+
readonly state: "captured" | "disabled" | "unavailable";
|
|
95
|
+
}[];
|
|
96
|
+
} & {
|
|
97
|
+
readonly matched: boolean;
|
|
98
|
+
}, {}, {}>;
|
|
99
|
+
declare class ApiCall extends ApiCall_base {}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { ApiCall as t };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const require_eval_validations = require("./eval-validations-BdlPhudg.cjs");
|
|
2
|
+
let effect = require("effect");
|
|
3
|
+
//#region ../schema/src/domain/api-mocks.ts
|
|
4
|
+
const API_PROGRAM = "workspace/.anpord/api/program.json";
|
|
5
|
+
const API_MANIFEST = ".anpord/api/manifest.json";
|
|
6
|
+
const API_JOURNAL = ".anpord/api/calls.jsonl";
|
|
7
|
+
const API_READY = "ANPORD_API_READY=";
|
|
8
|
+
effect.Schema.Struct({ entry: effect.Schema.Literal(".anpord/api/server.mjs") });
|
|
9
|
+
const ApiManifest = effect.Schema.Array(effect.Schema.Struct({
|
|
10
|
+
name: effect.Schema.String,
|
|
11
|
+
url: effect.Schema.String,
|
|
12
|
+
endpoints: effect.Schema.Array(effect.Schema.Struct({
|
|
13
|
+
method: effect.Schema.String,
|
|
14
|
+
path: effect.Schema.String,
|
|
15
|
+
description: effect.Schema.optional(effect.Schema.String)
|
|
16
|
+
}))
|
|
17
|
+
}));
|
|
18
|
+
var ApiCall = class extends effect.Schema.Class("ApiCall")({
|
|
19
|
+
api: effect.Schema.String,
|
|
20
|
+
index: effect.Schema.NonNegativeInt,
|
|
21
|
+
method: effect.Schema.String,
|
|
22
|
+
path: effect.Schema.String,
|
|
23
|
+
matched: effect.Schema.Boolean,
|
|
24
|
+
startedAt: effect.Schema.Number,
|
|
25
|
+
durationMs: effect.Schema.NonNegativeInt,
|
|
26
|
+
input: require_eval_validations.ValidationValue,
|
|
27
|
+
output: require_eval_validations.ValidationValue,
|
|
28
|
+
status: effect.Schema.Int,
|
|
29
|
+
error: effect.Schema.NullOr(effect.Schema.String.pipe(effect.Schema.maxLength(2e3))),
|
|
30
|
+
logs: effect.Schema.Array(require_eval_validations.ValidationValue).pipe(effect.Schema.maxItems(64))
|
|
31
|
+
}) {};
|
|
32
|
+
//#endregion
|
|
33
|
+
Object.defineProperty(exports, "API_JOURNAL", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return API_JOURNAL;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "API_MANIFEST", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function() {
|
|
42
|
+
return API_MANIFEST;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "API_PROGRAM", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function() {
|
|
48
|
+
return API_PROGRAM;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "API_READY", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function() {
|
|
54
|
+
return API_READY;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "ApiCall", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function() {
|
|
60
|
+
return ApiCall;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "ApiManifest", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function() {
|
|
66
|
+
return ApiManifest;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { r as ValidationValue } from "./eval-validations-BvX9dkYh.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
//#region ../schema/src/domain/api-mocks.ts
|
|
4
|
+
const API_PROGRAM = "workspace/.anpord/api/program.json";
|
|
5
|
+
const API_MANIFEST = ".anpord/api/manifest.json";
|
|
6
|
+
const API_JOURNAL = ".anpord/api/calls.jsonl";
|
|
7
|
+
const API_READY = "ANPORD_API_READY=";
|
|
8
|
+
Schema.Struct({ entry: Schema.Literal(".anpord/api/server.mjs") });
|
|
9
|
+
const ApiManifest = Schema.Array(Schema.Struct({
|
|
10
|
+
name: Schema.String,
|
|
11
|
+
url: Schema.String,
|
|
12
|
+
endpoints: Schema.Array(Schema.Struct({
|
|
13
|
+
method: Schema.String,
|
|
14
|
+
path: Schema.String,
|
|
15
|
+
description: Schema.optional(Schema.String)
|
|
16
|
+
}))
|
|
17
|
+
}));
|
|
18
|
+
var ApiCall = class extends Schema.Class("ApiCall")({
|
|
19
|
+
api: Schema.String,
|
|
20
|
+
index: Schema.NonNegativeInt,
|
|
21
|
+
method: Schema.String,
|
|
22
|
+
path: Schema.String,
|
|
23
|
+
matched: Schema.Boolean,
|
|
24
|
+
startedAt: Schema.Number,
|
|
25
|
+
durationMs: Schema.NonNegativeInt,
|
|
26
|
+
input: ValidationValue,
|
|
27
|
+
output: ValidationValue,
|
|
28
|
+
status: Schema.Int,
|
|
29
|
+
error: Schema.NullOr(Schema.String.pipe(Schema.maxLength(2e3))),
|
|
30
|
+
logs: Schema.Array(ValidationValue).pipe(Schema.maxItems(64))
|
|
31
|
+
}) {};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ApiCall as a, API_READY as i, API_MANIFEST as n, ApiManifest as o, API_PROGRAM as r, API_JOURNAL as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-BXZmPUwV.cjs";
|
|
2
|
+
import { t as ApiDefinition } from "./define-NZvmQuIv.cjs";
|
|
3
|
+
//#region src/mock-api/runtime.d.ts
|
|
4
|
+
declare const withApi: <A>({ api, run }: {
|
|
5
|
+
readonly api: ApiDefinition;
|
|
6
|
+
readonly run: (context: {
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly calls: () => Promise<readonly ApiCall[]>;
|
|
9
|
+
}) => Promise<A>;
|
|
10
|
+
}) => Promise<A>;
|
|
11
|
+
declare const runApiServers: (definitions: readonly ApiDefinition[]) => void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { runApiServers, withApi };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-BXZmPUwV.mjs";
|
|
2
|
+
import { t as ApiDefinition } from "./define-NZvmQuIv.mjs";
|
|
3
|
+
//#region src/mock-api/runtime.d.ts
|
|
4
|
+
declare const withApi: <A>({ api, run }: {
|
|
5
|
+
readonly api: ApiDefinition;
|
|
6
|
+
readonly run: (context: {
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly calls: () => Promise<readonly ApiCall[]>;
|
|
9
|
+
}) => Promise<A>;
|
|
10
|
+
}) => Promise<A>;
|
|
11
|
+
declare const runApiServers: (definitions: readonly ApiDefinition[]) => void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { runApiServers, withApi };
|
package/dist/api.cjs
ADDED
package/dist/api.d.cts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-BXZmPUwV.cjs";
|
|
2
|
+
import { a as endpoint, i as api, n as ApiHandlerContext, r as EndpointDefinition, t as ApiDefinition } from "./define-NZvmQuIv.cjs";
|
|
3
|
+
import { withApi } from "./api-runtime.cjs";
|
|
4
|
+
export { type ApiCall, type ApiDefinition, type ApiHandlerContext, type EndpointDefinition, api, endpoint, withApi };
|
package/dist/api.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { t as ApiCall } from "./api-mocks-BXZmPUwV.mjs";
|
|
2
|
+
import { a as endpoint, i as api, n as ApiHandlerContext, r as EndpointDefinition, t as ApiDefinition } from "./define-NZvmQuIv.mjs";
|
|
3
|
+
import { withApi } from "./api-runtime.mjs";
|
|
4
|
+
export { type ApiCall, type ApiDefinition, type ApiHandlerContext, type EndpointDefinition, api, endpoint, withApi };
|
package/dist/api.mjs
ADDED
package/dist/bin.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_client = require("./client-
|
|
3
|
-
const
|
|
2
|
+
const require_client = require("./client-DziJjMFh.cjs");
|
|
3
|
+
const require_evals_api = require("./evals-api-CqhPZCr5.cjs");
|
|
4
4
|
const require_errors = require("./errors-BX1wry8K.cjs");
|
|
5
5
|
const require_config = require("./config.cjs");
|
|
6
|
-
const require_compiler = require("./compiler-
|
|
7
|
-
let
|
|
6
|
+
const require_compiler = require("./compiler-CYwJNlT4.cjs");
|
|
7
|
+
let effect = require("effect");
|
|
8
8
|
let _effect_platform = require("@effect/platform");
|
|
9
|
+
let _effect_cli = require("@effect/cli");
|
|
9
10
|
let _effect_platform_node = require("@effect/platform-node");
|
|
10
|
-
let effect = require("effect");
|
|
11
11
|
let yaml = require("yaml");
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version$1 = "0.1.
|
|
13
|
+
var version$1 = "0.1.17";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region ../template/src/extract.ts
|
|
16
16
|
/** Reads escapes too, so text the renderer leaves literal is never reported as
|
|
@@ -531,7 +531,7 @@ const importEval = _effect_cli.Command.make("import", {
|
|
|
531
531
|
const EvalOutcome = effect.Schema.Struct({
|
|
532
532
|
file: effect.Schema.String,
|
|
533
533
|
problems: effect.Schema.Array(effect.Schema.String),
|
|
534
|
-
run: effect.Schema.NullOr(
|
|
534
|
+
run: effect.Schema.NullOr(require_evals_api.EvalRun),
|
|
535
535
|
runId: effect.Schema.NullOr(effect.Schema.String)
|
|
536
536
|
});
|
|
537
537
|
effect.Schema.Struct({
|
|
@@ -657,7 +657,7 @@ const evalTrigger = effect.Effect.gen(function* () {
|
|
|
657
657
|
const runId = yield* effect.Config.string("GITHUB_RUN_ID");
|
|
658
658
|
const attempt = yield* effect.Config.string("GITHUB_RUN_ATTEMPT").pipe(effect.Config.withDefault("1"));
|
|
659
659
|
const server = yield* effect.Config.string("GITHUB_SERVER_URL").pipe(effect.Config.withDefault("https://github.com"));
|
|
660
|
-
return yield* effect.Schema.decodeUnknown(
|
|
660
|
+
return yield* effect.Schema.decodeUnknown(require_evals_api.EvalTrigger)({
|
|
661
661
|
source: "ci",
|
|
662
662
|
url: `${server}/${repository}/actions/runs/${runId}/attempts/${attempt}`
|
|
663
663
|
});
|
package/dist/bin.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as ChannelName, o as PromptId, s as VersionNumber, t as AnpordApi } from "./client-
|
|
3
|
-
import {
|
|
2
|
+
import { a as ChannelName, o as PromptId, s as VersionNumber, t as AnpordApi } from "./client-DE3YNtWc.mjs";
|
|
3
|
+
import { f as EvalTrigger, i as EvalRun } from "./evals-api-CsdU741J.mjs";
|
|
4
4
|
import { i as tokenMatcher, r as asAnpordError } from "./errors-B0YknR5V.mjs";
|
|
5
5
|
import { ClientLayer, webUrlConfig } from "./config.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { i as compileEvalEffect } from "./compiler-C62ss3a4.mjs";
|
|
7
|
+
import { Cause, Clock, Config, Console, Data, Duration, Effect, Layer, Option, ParseResult, Redacted, Ref, Schema } from "effect";
|
|
8
8
|
import { FetchHttpClient, FileSystem, HttpClient, HttpClientError, HttpClientRequest } from "@effect/platform";
|
|
9
|
+
import { Args, Command, Options } from "@effect/cli";
|
|
9
10
|
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
10
|
-
import { Cause, Clock, Config, Console, Data, Duration, Effect, Layer, Option, ParseResult, Redacted, Ref, Schema } from "effect";
|
|
11
11
|
import { parseDocument } from "yaml";
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version$1 = "0.1.
|
|
13
|
+
var version$1 = "0.1.17";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region ../template/src/extract.ts
|
|
16
16
|
/** Reads escapes too, so text the renderer leaves literal is never reported as
|
package/dist/cli-runtime.cjs
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_define = require("./define-CHx2lRp5.cjs");
|
|
3
|
+
const require_mock_journal = require("./mock-journal-Bnaozlx4.cjs");
|
|
3
4
|
let effect = require("effect");
|
|
4
|
-
let node_path = require("node:path");
|
|
5
|
-
let node_fs_promises = require("node:fs/promises");
|
|
6
5
|
//#region src/mock-cli/runtime.ts
|
|
7
6
|
const JOURNAL = ".anpord/cli-calls.jsonl";
|
|
8
|
-
const errorOf = (cause) => cause instanceof Error ? cause : new Error(String(cause));
|
|
9
|
-
const decode = (schema, value) => effect.Effect.tryPromise({
|
|
10
|
-
catch: errorOf,
|
|
11
|
-
try: async () => {
|
|
12
|
-
const result = await schema["~standard"].validate(value);
|
|
13
|
-
if (result.issues !== void 0) throw new Error(result.issues.map(({ message }) => message).join("; "));
|
|
14
|
-
return result.value;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
const append = (path, call) => effect.Effect.tryPromise({
|
|
18
|
-
catch: errorOf,
|
|
19
|
-
try: async () => {
|
|
20
|
-
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(path), { recursive: true });
|
|
21
|
-
await (0, node_fs_promises.appendFile)(path, `${JSON.stringify(call)}\n`);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
7
|
const commandHelp = (definition, item) => {
|
|
25
8
|
const options = Object.entries(item.options).map(([key, option]) => ` ${require_define.optionName(key, option)}${option.type === "string" ? " <value>" : ""}${option.description ? ` ${option.description}` : ""}`);
|
|
26
9
|
return [
|
|
@@ -88,15 +71,15 @@ const executeCli = (definition, args, journal = JOURNAL) => effect.Effect.gen(fu
|
|
|
88
71
|
let input = {};
|
|
89
72
|
return yield* effect.Effect.gen(function* () {
|
|
90
73
|
input = yield* effect.Effect.try({
|
|
91
|
-
catch: errorOf,
|
|
74
|
+
catch: require_mock_journal.errorOf,
|
|
92
75
|
try: () => parseOptions(item, rest)
|
|
93
76
|
});
|
|
94
|
-
const decoded = yield*
|
|
77
|
+
const decoded = yield* require_mock_journal.decodeStandard(item.inputSchema, input);
|
|
95
78
|
const output = yield* effect.Effect.tryPromise({
|
|
96
|
-
catch: errorOf,
|
|
79
|
+
catch: require_mock_journal.errorOf,
|
|
97
80
|
try: () => Promise.resolve(item.handler(decoded, { signal: new AbortController().signal }))
|
|
98
|
-
}).pipe(effect.Effect.flatMap((value) =>
|
|
99
|
-
yield*
|
|
81
|
+
}).pipe(effect.Effect.flatMap((value) => require_mock_journal.decodeStandard(item.outputSchema, value)));
|
|
82
|
+
yield* require_mock_journal.appendCall(journal, {
|
|
100
83
|
cli: definition.path,
|
|
101
84
|
command: item.path.join(" "),
|
|
102
85
|
input: decoded,
|
|
@@ -107,14 +90,14 @@ const executeCli = (definition, args, journal = JOURNAL) => effect.Effect.gen(fu
|
|
|
107
90
|
stderr: "",
|
|
108
91
|
stdout: `${JSON.stringify(output, null, 2) ?? String(output)}\n`
|
|
109
92
|
};
|
|
110
|
-
}).pipe(effect.Effect.catchAll((cause) =>
|
|
93
|
+
}).pipe(effect.Effect.catchAll((cause) => require_mock_journal.appendCall(journal, {
|
|
111
94
|
cli: definition.path,
|
|
112
95
|
command: item.path.join(" "),
|
|
113
|
-
error: errorOf(cause).message,
|
|
96
|
+
error: require_mock_journal.errorOf(cause).message,
|
|
114
97
|
input
|
|
115
98
|
}).pipe(effect.Effect.as({
|
|
116
99
|
exitCode: 1,
|
|
117
|
-
stderr: `${errorOf(cause).message}\n`,
|
|
100
|
+
stderr: `${require_mock_journal.errorOf(cause).message}\n`,
|
|
118
101
|
stdout: ""
|
|
119
102
|
}))));
|
|
120
103
|
}).pipe(effect.Effect.withSpan("CliMock.execute"), effect.Effect.runPromise);
|
package/dist/cli-runtime.mjs
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
import { r as optionName } from "./define-CLhfETBd.mjs";
|
|
2
|
+
import { n as decodeStandard, r as errorOf, t as appendCall } from "./mock-journal-rbsXfDRs.mjs";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { dirname } from "node:path";
|
|
4
|
-
import { appendFile, mkdir } from "node:fs/promises";
|
|
5
4
|
//#region src/mock-cli/runtime.ts
|
|
6
5
|
const JOURNAL = ".anpord/cli-calls.jsonl";
|
|
7
|
-
const errorOf = (cause) => cause instanceof Error ? cause : new Error(String(cause));
|
|
8
|
-
const decode = (schema, value) => Effect.tryPromise({
|
|
9
|
-
catch: errorOf,
|
|
10
|
-
try: async () => {
|
|
11
|
-
const result = await schema["~standard"].validate(value);
|
|
12
|
-
if (result.issues !== void 0) throw new Error(result.issues.map(({ message }) => message).join("; "));
|
|
13
|
-
return result.value;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const append = (path, call) => Effect.tryPromise({
|
|
17
|
-
catch: errorOf,
|
|
18
|
-
try: async () => {
|
|
19
|
-
await mkdir(dirname(path), { recursive: true });
|
|
20
|
-
await appendFile(path, `${JSON.stringify(call)}\n`);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
6
|
const commandHelp = (definition, item) => {
|
|
24
7
|
const options = Object.entries(item.options).map(([key, option]) => ` ${optionName(key, option)}${option.type === "string" ? " <value>" : ""}${option.description ? ` ${option.description}` : ""}`);
|
|
25
8
|
return [
|
|
@@ -90,12 +73,12 @@ const executeCli = (definition, args, journal = JOURNAL) => Effect.gen(function*
|
|
|
90
73
|
catch: errorOf,
|
|
91
74
|
try: () => parseOptions(item, rest)
|
|
92
75
|
});
|
|
93
|
-
const decoded = yield*
|
|
76
|
+
const decoded = yield* decodeStandard(item.inputSchema, input);
|
|
94
77
|
const output = yield* Effect.tryPromise({
|
|
95
78
|
catch: errorOf,
|
|
96
79
|
try: () => Promise.resolve(item.handler(decoded, { signal: new AbortController().signal }))
|
|
97
|
-
}).pipe(Effect.flatMap((value) =>
|
|
98
|
-
yield*
|
|
80
|
+
}).pipe(Effect.flatMap((value) => decodeStandard(item.outputSchema, value)));
|
|
81
|
+
yield* appendCall(journal, {
|
|
99
82
|
cli: definition.path,
|
|
100
83
|
command: item.path.join(" "),
|
|
101
84
|
input: decoded,
|
|
@@ -106,7 +89,7 @@ const executeCli = (definition, args, journal = JOURNAL) => Effect.gen(function*
|
|
|
106
89
|
stderr: "",
|
|
107
90
|
stdout: `${JSON.stringify(output, null, 2) ?? String(output)}\n`
|
|
108
91
|
};
|
|
109
|
-
}).pipe(Effect.catchAll((cause) =>
|
|
92
|
+
}).pipe(Effect.catchAll((cause) => appendCall(journal, {
|
|
110
93
|
cli: definition.path,
|
|
111
94
|
command: item.path.join(" "),
|
|
112
95
|
error: errorOf(cause).message,
|