niceeval 0.14.4-canary.67 → 0.15.0
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/INDEX.md +2 -2
- package/dist/adapter.cjs +162 -14
- package/dist/adapter.cjs.map +1 -1
- package/dist/adapter.d.cts +82 -17
- package/dist/adapter.d.mts +82 -17
- package/dist/adapter.d.ts +82 -17
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +2 -1
- package/dist/agents/index.d.mts +2 -1
- package/dist/agents/index.d.ts +2 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +32 -12
- package/dist/assertions/api.d.mts +32 -12
- package/dist/assertions/api.d.ts +32 -12
- package/dist/assertions/runtime.cjs +4 -1
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/coordination/platform/node-process-identity.cjs +99 -21
- package/dist/coordination/platform/node-process-identity.cjs.map +1 -1
- package/dist/coordination/platform/node-process-identity.d.cts +17 -1
- package/dist/coordination/platform/node-process-identity.d.mts +17 -1
- package/dist/coordination/platform/node-process-identity.d.ts +17 -1
- package/dist/coordination/platform/node-process-identity.js +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/record/sqlite/current-schema.cjs +437 -5
- package/dist/record/sqlite/current-schema.cjs.map +1 -1
- package/dist/record/sqlite/current-schema.d.cts +4 -4
- package/dist/record/sqlite/current-schema.d.mts +4 -4
- package/dist/record/sqlite/current-schema.d.ts +4 -4
- package/dist/record/sqlite/schema.d.cts +1 -1
- package/dist/record/sqlite/schema.d.mts +1 -1
- package/dist/record/sqlite/schema.d.ts +1 -1
- package/dist/runner/attempt-resources.cjs +2 -1
- package/dist/runner/attempt-resources.cjs.map +1 -1
- package/dist/runner/attempt-resources.d.cts +2 -1
- package/dist/runner/attempt-resources.d.mts +2 -1
- package/dist/runner/attempt-resources.d.ts +2 -1
- package/dist/runner/attempt.cjs +7 -3
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/node-process-identity.js +2 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2 -1
- package/dist/types.d.mts +2 -1
- package/dist/types.d.ts +2 -1
- package/dist/view/function-runtime.mjs +528 -29
- package/docs-site/zh/reference/define-agent.mdx +125 -3
- package/docs-site/zh/troubleshooting/debugging.mdx +2 -0
- package/docs-site/zh/tutorials/custom-application.mdx +87 -17
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +1 -1
- package/docs-site/zh/tutorials/viewing-results.mdx +2 -1
- package/package.json +1 -1
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeProcessIdentity = makeProcessIdentity;
|
|
3
4
|
exports.currentProcessOwnerIdentity = currentProcessOwnerIdentity;
|
|
4
5
|
exports.exactProcessState = exactProcessState;
|
|
6
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
7
|
const node_crypto_1 = require("node:crypto");
|
|
6
8
|
const node_fs_1 = require("node:fs");
|
|
7
9
|
const node_os_1 = require("node:os");
|
|
8
|
-
|
|
10
|
+
const PROCESS_SESSION_ID = `process-session-v1:${(0, node_crypto_1.randomUUID)()}`;
|
|
11
|
+
function errnoCode(cause) {
|
|
12
|
+
return typeof cause === "object" && cause !== null ? Reflect.get(cause, "code") : undefined;
|
|
13
|
+
}
|
|
14
|
+
function linuxProcessStartOf(pid) {
|
|
9
15
|
const stat = (0, node_fs_1.readFileSync)(`/proc/${pid}/stat`, "utf8");
|
|
10
16
|
const commandEnd = stat.lastIndexOf(")");
|
|
11
17
|
if (commandEnd < 0)
|
|
@@ -16,34 +22,106 @@ function processStartOf(pid) {
|
|
|
16
22
|
throw new Error(`Could not decode process start for pid ${pid}.`);
|
|
17
23
|
return processStart;
|
|
18
24
|
}
|
|
19
|
-
function
|
|
25
|
+
function linuxBootId() {
|
|
20
26
|
const value = (0, node_fs_1.readFileSync)("/proc/sys/kernel/random/boot_id", "utf8").trim();
|
|
21
27
|
if (value.length === 0)
|
|
22
28
|
throw new Error("The local Linux boot ID is empty.");
|
|
23
29
|
return value;
|
|
24
30
|
}
|
|
31
|
+
function darwinBootSessionUuid() {
|
|
32
|
+
return (0, node_child_process_1.execFileSync)("/usr/sbin/sysctl", ["-n", "kern.bootsessionuuid"], {
|
|
33
|
+
encoding: "utf8",
|
|
34
|
+
env: { LANG: "C", LC_ALL: "C", TZ: "UTC" },
|
|
35
|
+
maxBuffer: 4096,
|
|
36
|
+
timeout: 1000,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function validatedDarwinBootId(readBootSessionUuid) {
|
|
40
|
+
const value = readBootSessionUuid().trim();
|
|
41
|
+
if (!/^[0-9A-F]{8}(?:-[0-9A-F]{4}){3}-[0-9A-F]{12}$/iu.test(value)) {
|
|
42
|
+
throw new Error("The local Darwin boot session UUID is unavailable or malformed.");
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
/** @internal Keeps trust classification separate from the live OS observation boundary. */
|
|
47
|
+
function makeProcessIdentity(runtime) {
|
|
48
|
+
const current = (ownerId) => {
|
|
49
|
+
if (runtime.platform !== "linux" && runtime.platform !== "darwin") {
|
|
50
|
+
throw new Error(`Process identity is unsupported on ${runtime.platform}.`);
|
|
51
|
+
}
|
|
52
|
+
const bootId = runtime.platform === "linux"
|
|
53
|
+
? runtime.linuxBootId()
|
|
54
|
+
: validatedDarwinBootId(runtime.darwinBootSessionUuid);
|
|
55
|
+
const processStart = runtime.platform === "linux"
|
|
56
|
+
? runtime.linuxProcessStartOf(runtime.pid)
|
|
57
|
+
: runtime.processSessionId;
|
|
58
|
+
return Object.freeze({ ownerId, host: runtime.host(), pid: runtime.pid, bootId, processStart });
|
|
59
|
+
};
|
|
60
|
+
const exactState = (owner) => {
|
|
61
|
+
if (owner.host !== runtime.host())
|
|
62
|
+
return "unknown";
|
|
63
|
+
if (runtime.platform === "linux") {
|
|
64
|
+
let localBootId;
|
|
65
|
+
try {
|
|
66
|
+
localBootId = runtime.linuxBootId();
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return "unknown";
|
|
70
|
+
}
|
|
71
|
+
if (owner.bootId !== localBootId)
|
|
72
|
+
return "dead";
|
|
73
|
+
try {
|
|
74
|
+
const processStart = runtime.linuxProcessStartOf(owner.pid);
|
|
75
|
+
return processStart === owner.processStart ? "alive" : "unknown";
|
|
76
|
+
}
|
|
77
|
+
catch (cause) {
|
|
78
|
+
return errnoCode(cause) === "ENOENT" ? "dead" : "unknown";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (runtime.platform !== "darwin")
|
|
82
|
+
return "unknown";
|
|
83
|
+
let localBootId;
|
|
84
|
+
try {
|
|
85
|
+
localBootId = validatedDarwinBootId(runtime.darwinBootSessionUuid);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return "unknown";
|
|
89
|
+
}
|
|
90
|
+
if (owner.bootId !== localBootId)
|
|
91
|
+
return "dead";
|
|
92
|
+
if (!Number.isSafeInteger(owner.pid) || owner.pid <= 0)
|
|
93
|
+
return "unknown";
|
|
94
|
+
// A per-process nonce proves only this exact process. It is intentionally
|
|
95
|
+
// opaque to other processes rather than weakening PID reuse protection.
|
|
96
|
+
if (owner.pid === runtime.pid && owner.processStart === runtime.processSessionId)
|
|
97
|
+
return "alive";
|
|
98
|
+
try {
|
|
99
|
+
runtime.signalZero(owner.pid);
|
|
100
|
+
// macOS `ps lstart` is second-granularity presentation data. A present PID
|
|
101
|
+
// therefore cannot prove that the durable owner, rather than a reuse, lives.
|
|
102
|
+
return "unknown";
|
|
103
|
+
}
|
|
104
|
+
catch (cause) {
|
|
105
|
+
return errnoCode(cause) === "ESRCH" ? "dead" : "unknown";
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
return Object.freeze({ current, exactState });
|
|
109
|
+
}
|
|
110
|
+
const liveProcessIdentity = makeProcessIdentity({
|
|
111
|
+
platform: process.platform,
|
|
112
|
+
pid: process.pid,
|
|
113
|
+
processSessionId: PROCESS_SESSION_ID,
|
|
114
|
+
host: node_os_1.hostname,
|
|
115
|
+
linuxBootId,
|
|
116
|
+
linuxProcessStartOf,
|
|
117
|
+
darwinBootSessionUuid,
|
|
118
|
+
signalZero: (pid) => process.kill(pid, 0),
|
|
119
|
+
});
|
|
25
120
|
function currentProcessOwnerIdentity(ownerId = `owner_${(0, node_crypto_1.randomUUID)()}`) {
|
|
26
|
-
return
|
|
121
|
+
return liveProcessIdentity.current(ownerId);
|
|
27
122
|
}
|
|
28
123
|
/** Remote owners, read failures, and PID reuse deliberately fail closed. */
|
|
29
124
|
function exactProcessState(owner) {
|
|
30
|
-
|
|
31
|
-
return "unknown";
|
|
32
|
-
let localBootId;
|
|
33
|
-
try {
|
|
34
|
-
localBootId = bootId();
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return "unknown";
|
|
38
|
-
}
|
|
39
|
-
if (owner.bootId !== localBootId)
|
|
40
|
-
return "dead";
|
|
41
|
-
try {
|
|
42
|
-
return processStartOf(owner.pid) === owner.processStart ? "alive" : "unknown";
|
|
43
|
-
}
|
|
44
|
-
catch (cause) {
|
|
45
|
-
const code = typeof cause === "object" && cause !== null ? Reflect.get(cause, "code") : undefined;
|
|
46
|
-
return code === "ENOENT" ? "dead" : "unknown";
|
|
47
|
-
}
|
|
125
|
+
return liveProcessIdentity.exactState(owner);
|
|
48
126
|
}
|
|
49
127
|
//# sourceMappingURL=node-process-identity.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-process-identity.js","sourceRoot":"","sources":["node-process-identity.ts"],"names":[],"mappings":";;AAqBA,kEAEC;AAGD,8CAmBC;AA7CD,6CAAyC;AACzC,qCAAuC;AACvC,qCAAmC;AAEnC,SAAS,cAAc,CAAC,GAAW;IAC/B,MAAM,IA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AA,kBAAQ,GAAE;QACzB,OAAO,SAAS,CAAC;IACrB,IAAI,WAAmB,CAAC;IACxB,IAAI,CAAC;QACD,WAAW,GAAG,MAAM,EAAE,CAAC;IAC3B,CAAC;IACD,MAAM,CAAC;QACH,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,WAAW;QAC5B,OAAO,MAAM,CAAC;IAClB,IAAI,CAAC;QACD,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;AACL,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { readFileSync } from \"node:fs\";\nimport { hostname } from \"node:os\";\nimport type { ProcessOwnerIdentity } from \"./sqlite-coordination.ts\";\nfunction processStartOf(pid: number): string {\n const stat = readFileSync(`/proc/${pid}/stat`, \"utf8\");\n const commandEnd = stat.lastIndexOf(\")\");\n if (commandEnd < 0)\n throw new Error(`Could not decode /proc/${pid}/stat.`);\n const fieldsAfterCommand = stat.slice(commandEnd + 2).trim().split(/\\s+/u);\n const processStart = fieldsAfterCommand[19];\n if (processStart === undefined || !/^\\d+$/u.test(processStart))\n throw new Error(`Could not decode process start for pid ${pid}.`);\n return processStart;\n}\nfunction bootId(): string {\n const value = readFileSync(\"/proc/sys/kernel/random/boot_id\", \"utf8\").trim();\n if (value.length === 0)\n throw new Error(\"The local Linux boot ID is empty.\");\n return value;\n}\nexport function currentProcessOwnerIdentity(ownerId = `owner_${randomUUID()}`): ProcessOwnerIdentity {\n return Object.freeze({ ownerId, host: hostname(), pid: process.pid, bootId: bootId(), processStart: processStartOf(process.pid) });\n}\nexport type ExactProcessState = \"alive\" | \"dead\" | \"unknown\";\n/** Remote owners, read failures, and PID reuse deliberately fail closed. */\nexport function exactProcessState(owner: ProcessOwnerIdentity): ExactProcessState {\n if (owner.host !== hostname())\n return \"unknown\";\n let localBootId: string;\n try {\n localBootId = bootId();\n }\n catch {\n return \"unknown\";\n }\n if (owner.bootId !== localBootId)\n return \"dead\";\n try {\n return processStartOf(owner.pid) === owner.processStart ? \"alive\" : \"unknown\";\n }\n catch (cause) {\n const code = typeof cause === \"object\" && cause !== null ? Reflect.get(cause, \"code\") : undefined;\n return code === \"ENOENT\" ? \"dead\" : \"unknown\";\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-process-identity.js","sourceRoot":"","sources":["node-process-identity.ts"],"names":[],"mappings":";;AAsDA,kDAiEC;AAWD,kEAEC;AAED,8CAEC;AAxID,2DAAkD;AAClD,6CAAyC;AACzC,qCAAuC;AACvC,qCAAmC;AAEnC,MAAM,kBAAkB,GAAG,sBAAsB,IAAA,wBAAU,GAAE,EAAE,CAAC;AAChE,SAAS,SAAS,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAChG,CAAC;AACD,SAAS,mBAAmB,CAAC,GAAW;IACpC,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAC,SAAS,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,UAAU,GAAG,CAAC;QACd,MAAM,IAAI,KAAK,CAA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IACF,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;AAClD,CAAC;AACD,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,gBAAgB,EAAE,kBAAkB;IACpC,IAAI,EAAE,kBAAQ;IACd,WAAW;IACX,mBAAmB;IACnB,qBAAqB;IACrB,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;CAC5C,CAAC,CAAC;AACH,SAAgB,2BAA2B,CAAC,OAAO,GAAG,SAAS,IAAA,wBAAU,GAAE,EAAE;IACzE,OAAO,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC;AACD,4EAA4E;AAC5E,SAAgB,iBAAiB,CAAC,KAA2B;IACzD,OAAO,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { readFileSync } from \"node:fs\";\nimport { hostname } from \"node:os\";\nimport type { ProcessOwnerIdentity } from \"./sqlite-coordination.ts\";\nconst PROCESS_SESSION_ID = `process-session-v1:${randomUUID()}`;\nfunction errnoCode(cause: unknown): unknown {\n return typeof cause === \"object\" && cause !== null ? Reflect.get(cause, \"code\") : undefined;\n}\nfunction linuxProcessStartOf(pid: number): string {\n const stat = readFileSync(`/proc/${pid}/stat`, \"utf8\");\n const commandEnd = stat.lastIndexOf(\")\");\n if (commandEnd < 0)\n throw new Error(`Could not decode /proc/${pid}/stat.`);\n const fieldsAfterCommand = stat.slice(commandEnd + 2).trim().split(/\\s+/u);\n const processStart = fieldsAfterCommand[19];\n if (processStart === undefined || !/^\\d+$/u.test(processStart))\n throw new Error(`Could not decode process start for pid ${pid}.`);\n return processStart;\n}\nfunction linuxBootId(): string {\n const value = readFileSync(\"/proc/sys/kernel/random/boot_id\", \"utf8\").trim();\n if (value.length === 0)\n throw new Error(\"The local Linux boot ID is empty.\");\n return value;\n}\nfunction darwinBootSessionUuid(): string {\n return execFileSync(\"/usr/sbin/sysctl\", [\"-n\", \"kern.bootsessionuuid\"], {\n encoding: \"utf8\",\n env: { LANG: \"C\", LC_ALL: \"C\", TZ: \"UTC\" },\n maxBuffer: 4096,\n timeout: 1000,\n });\n}\nfunction validatedDarwinBootId(readBootSessionUuid: () => string): string {\n const value = readBootSessionUuid().trim();\n if (!/^[0-9A-F]{8}(?:-[0-9A-F]{4}){3}-[0-9A-F]{12}$/iu.test(value)) {\n throw new Error(\"The local Darwin boot session UUID is unavailable or malformed.\");\n }\n return value;\n}\nexport type ExactProcessState = \"alive\" | \"dead\" | \"unknown\";\n/** @internal Injectable operating-system boundary for deterministic classification tests. */\nexport interface ProcessIdentityRuntime {\n readonly platform: NodeJS.Platform;\n readonly pid: number;\n readonly processSessionId: string;\n readonly host: () => string;\n readonly linuxBootId: () => string;\n readonly linuxProcessStartOf: (pid: number) => string;\n readonly darwinBootSessionUuid: () => string;\n readonly signalZero: (pid: number) => void;\n}\n/** @internal Keeps trust classification separate from the live OS observation boundary. */\nexport function makeProcessIdentity(runtime: ProcessIdentityRuntime): Readonly<{\n current: (ownerId: string) => ProcessOwnerIdentity;\n exactState: (owner: ProcessOwnerIdentity) => ExactProcessState;\n}> {\n const current = (ownerId: string): ProcessOwnerIdentity => {\n if (runtime.platform !== \"linux\" && runtime.platform !== \"darwin\") {\n throw new Error(`Process identity is unsupported on ${runtime.platform}.`);\n }\n const bootId = runtime.platform === \"linux\"\n ? runtime.linuxBootId()\n : validatedDarwinBootId(runtime.darwinBootSessionUuid);\n const processStart = runtime.platform === \"linux\"\n ? runtime.linuxProcessStartOf(runtime.pid)\n : runtime.processSessionId;\n return Object.freeze({ ownerId, host: runtime.host(), pid: runtime.pid, bootId, processStart });\n };\n const exactState = (owner: ProcessOwnerIdentity): ExactProcessState => {\n if (owner.host !== runtime.host())\n return \"unknown\";\n if (runtime.platform === \"linux\") {\n let localBootId: string;\n try {\n localBootId = runtime.linuxBootId();\n }\n catch {\n return \"unknown\";\n }\n if (owner.bootId !== localBootId)\n return \"dead\";\n try {\n const processStart = runtime.linuxProcessStartOf(owner.pid);\n return processStart === owner.processStart ? \"alive\" : \"unknown\";\n }\n catch (cause) {\n return errnoCode(cause) === \"ENOENT\" ? \"dead\" : \"unknown\";\n }\n }\n if (runtime.platform !== \"darwin\")\n return \"unknown\";\n let localBootId: string;\n try {\n localBootId = validatedDarwinBootId(runtime.darwinBootSessionUuid);\n }\n catch {\n return \"unknown\";\n }\n if (owner.bootId !== localBootId)\n return \"dead\";\n if (!Number.isSafeInteger(owner.pid) || owner.pid <= 0)\n return \"unknown\";\n // A per-process nonce proves only this exact process. It is intentionally\n // opaque to other processes rather than weakening PID reuse protection.\n if (owner.pid === runtime.pid && owner.processStart === runtime.processSessionId)\n return \"alive\";\n try {\n runtime.signalZero(owner.pid);\n // macOS `ps lstart` is second-granularity presentation data. A present PID\n // therefore cannot prove that the durable owner, rather than a reuse, lives.\n return \"unknown\";\n }\n catch (cause) {\n return errnoCode(cause) === \"ESRCH\" ? \"dead\" : \"unknown\";\n }\n };\n return Object.freeze({ current, exactState });\n}\nconst liveProcessIdentity = makeProcessIdentity({\n platform: process.platform,\n pid: process.pid,\n processSessionId: PROCESS_SESSION_ID,\n host: hostname,\n linuxBootId,\n linuxProcessStartOf,\n darwinBootSessionUuid,\n signalZero: (pid) => process.kill(pid, 0),\n});\nexport function currentProcessOwnerIdentity(ownerId = `owner_${randomUUID()}`): ProcessOwnerIdentity {\n return liveProcessIdentity.current(ownerId);\n}\n/** Remote owners, read failures, and PID reuse deliberately fail closed. */\nexport function exactProcessState(owner: ProcessOwnerIdentity): ExactProcessState {\n return liveProcessIdentity.exactState(owner);\n}\n"]}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import type { ProcessOwnerIdentity } from "./sqlite-coordination.cjs";
|
|
2
|
-
export declare function currentProcessOwnerIdentity(ownerId?: string): ProcessOwnerIdentity;
|
|
3
2
|
export type ExactProcessState = "alive" | "dead" | "unknown";
|
|
3
|
+
/** @internal Injectable operating-system boundary for deterministic classification tests. */
|
|
4
|
+
export interface ProcessIdentityRuntime {
|
|
5
|
+
readonly platform: NodeJS.Platform;
|
|
6
|
+
readonly pid: number;
|
|
7
|
+
readonly processSessionId: string;
|
|
8
|
+
readonly host: () => string;
|
|
9
|
+
readonly linuxBootId: () => string;
|
|
10
|
+
readonly linuxProcessStartOf: (pid: number) => string;
|
|
11
|
+
readonly darwinBootSessionUuid: () => string;
|
|
12
|
+
readonly signalZero: (pid: number) => void;
|
|
13
|
+
}
|
|
14
|
+
/** @internal Keeps trust classification separate from the live OS observation boundary. */
|
|
15
|
+
export declare function makeProcessIdentity(runtime: ProcessIdentityRuntime): Readonly<{
|
|
16
|
+
current: (ownerId: string) => ProcessOwnerIdentity;
|
|
17
|
+
exactState: (owner: ProcessOwnerIdentity) => ExactProcessState;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function currentProcessOwnerIdentity(ownerId?: string): ProcessOwnerIdentity;
|
|
4
20
|
/** Remote owners, read failures, and PID reuse deliberately fail closed. */
|
|
5
21
|
export declare function exactProcessState(owner: ProcessOwnerIdentity): ExactProcessState;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import type { ProcessOwnerIdentity } from "./sqlite-coordination.mjs";
|
|
2
|
-
export declare function currentProcessOwnerIdentity(ownerId?: string): ProcessOwnerIdentity;
|
|
3
2
|
export type ExactProcessState = "alive" | "dead" | "unknown";
|
|
3
|
+
/** @internal Injectable operating-system boundary for deterministic classification tests. */
|
|
4
|
+
export interface ProcessIdentityRuntime {
|
|
5
|
+
readonly platform: NodeJS.Platform;
|
|
6
|
+
readonly pid: number;
|
|
7
|
+
readonly processSessionId: string;
|
|
8
|
+
readonly host: () => string;
|
|
9
|
+
readonly linuxBootId: () => string;
|
|
10
|
+
readonly linuxProcessStartOf: (pid: number) => string;
|
|
11
|
+
readonly darwinBootSessionUuid: () => string;
|
|
12
|
+
readonly signalZero: (pid: number) => void;
|
|
13
|
+
}
|
|
14
|
+
/** @internal Keeps trust classification separate from the live OS observation boundary. */
|
|
15
|
+
export declare function makeProcessIdentity(runtime: ProcessIdentityRuntime): Readonly<{
|
|
16
|
+
current: (ownerId: string) => ProcessOwnerIdentity;
|
|
17
|
+
exactState: (owner: ProcessOwnerIdentity) => ExactProcessState;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function currentProcessOwnerIdentity(ownerId?: string): ProcessOwnerIdentity;
|
|
4
20
|
/** Remote owners, read failures, and PID reuse deliberately fail closed. */
|
|
5
21
|
export declare function exactProcessState(owner: ProcessOwnerIdentity): ExactProcessState;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import type { ProcessOwnerIdentity } from "./sqlite-coordination.js";
|
|
2
|
-
export declare function currentProcessOwnerIdentity(ownerId?: string): ProcessOwnerIdentity;
|
|
3
2
|
export type ExactProcessState = "alive" | "dead" | "unknown";
|
|
3
|
+
/** @internal Injectable operating-system boundary for deterministic classification tests. */
|
|
4
|
+
export interface ProcessIdentityRuntime {
|
|
5
|
+
readonly platform: NodeJS.Platform;
|
|
6
|
+
readonly pid: number;
|
|
7
|
+
readonly processSessionId: string;
|
|
8
|
+
readonly host: () => string;
|
|
9
|
+
readonly linuxBootId: () => string;
|
|
10
|
+
readonly linuxProcessStartOf: (pid: number) => string;
|
|
11
|
+
readonly darwinBootSessionUuid: () => string;
|
|
12
|
+
readonly signalZero: (pid: number) => void;
|
|
13
|
+
}
|
|
14
|
+
/** @internal Keeps trust classification separate from the live OS observation boundary. */
|
|
15
|
+
export declare function makeProcessIdentity(runtime: ProcessIdentityRuntime): Readonly<{
|
|
16
|
+
current: (ownerId: string) => ProcessOwnerIdentity;
|
|
17
|
+
exactState: (owner: ProcessOwnerIdentity) => ExactProcessState;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function currentProcessOwnerIdentity(ownerId?: string): ProcessOwnerIdentity;
|
|
4
20
|
/** Remote owners, read failures, and PID reuse deliberately fail closed. */
|
|
5
21
|
export declare function exactProcessState(owner: ProcessOwnerIdentity): ExactProcessState;
|
|
@@ -5,4 +5,6 @@ const __niceevalExport0 = __niceevalCanonical["currentProcessOwnerIdentity"];
|
|
|
5
5
|
export { __niceevalExport0 as currentProcessOwnerIdentity };
|
|
6
6
|
const __niceevalExport1 = __niceevalCanonical["exactProcessState"];
|
|
7
7
|
export { __niceevalExport1 as exactProcessState };
|
|
8
|
+
const __niceevalExport2 = __niceevalCanonical["makeProcessIdentity"];
|
|
9
|
+
export { __niceevalExport2 as makeProcessIdentity };
|
|
8
10
|
//# sourceMappingURL=node-process-identity.js.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,uEAAuE;AACvE,yCAA2G;AAAlG,uGAAA,UAAU,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AACrF,2CAAoE;AAA3D,2GAAA,aAAa,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AAC7C,kDAAoD;AAA3C,uGAAA,WAAW,OAAA;AAEpB,kDAAyD;AAAhD,4GAAA,gBAAgB,OAAA;AAGzB,0EAA6J;AAApJ,2HAAA,mBAAmB,OAAA;AAG5B,qCAA8D;AAArD,qGAAA,UAAU,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,wGAAA,aAAa,OAAA;AAC1C,6CAA6C;AAC7C,6EAA6E;AAC7E,8DAAiG;AAAxF,wHAAA,oBAAoB,OAAA;AAAE,kHAAA,cAAc,OAAA;AAAE,kHAAA,cAAc,OAAA;AAK7D,kEAA4H;AAAnH,2GAAA,OAAO,OAAA;AAAE,8GAAA,UAAU,OAAA;AAAE,gHAAA,YAAY,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["// niceeval 公开导出(import { … } from \"niceeval\")。\n// Agent/Adapter 相关见 \"niceeval/adapter\";Sandbox 相关见 \"niceeval/sandbox\"。\nexport { defineEval, defineScoreEval, defineEvalGroup, defineConfig, defineExperiment } from \"./define.ts\";\nexport { defineAdapter, defineAdapterContract } from \"./adapter.ts\";\nexport { defineJudge } from \"./assertions/judge.ts\";\nexport type { JudgeAnchor, JudgeDefinition, JudgeOptions } from \"./assertions/judge.ts\";\nexport { defineScoreMatch } from \"./assertions/match.ts\";\nexport type { ManagedScoreMatchOptions, ScoreMatch, ScoreMatchAnchor, ScoreMatchContext, ScoreMatchLlmFailure, ScoreMatchResult } from \"./assertions/match.ts\";\nexport type { AssertionEntryId } from \"./assertions/identity.ts\";\nexport { readScoreMatchAudit, type ScoreMatchAudit, type ScoreMatchAuditEnvelope, type ScoreMatchAuditReadResult, } from \"./assertions/score-match-audit.ts\";\nexport type { AgentSendWindowIdentity, AgentWorkspaceDiffEndpoint, AgentWorkspaceDiffHunks, AgentWorkspaceDiffPolicy, AgentWorkspaceDiff, AgentWorkspaceDiffWindow, AgentWorkspaceDiffWindowChange, } from \"./assertions/workspace-diff.ts\";\nexport type { PostRunBooleanAssertionHandle } from \"./assertions/api.ts\";\nexport { requireEnv, getEnv, stripComments } from \"./util.ts\";\n// 执行失败分类:抛出点糖衣类(声明死因波及多远)+ 结构守卫。判据、分类链与止损语义见\n// docs/feature/error-classification/README.md;`niceeval/adapter` 复导出同一份词表类型。\nexport { ExperimentFatalError, EvalFatalError, failureClassOf } from \"./shared/failure-class.ts\";\n// 类型(eval 作者会用到;跑哪个 agent / 用哪个 sandbox 见对应子路径)\nexport type { StreamEvent, ToolName, JsonValue, JsonMatch, Usage, Turn, EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, TurnInput, InputFile, AnswerValue, InputResponse, RespondAnswer, TurnHandle, SessionHandle, TestContext, ScoreTestContext, Verdict, EvalAuthorFields, EvalInput, ScoreEvalInput, EvalDefinition, AnyEvalDefinition, EvalGroupMember, EvalGroupInput, EvalGroupDefinition, EvaluationKind, EvalDescriptor, ExperimentAuthorFields, SharedStateConfig, ExperimentInput, ExperimentDefinition, ExperimentHook, ExperimentHookContext, Config, LocalizedText, JudgeConfig, Reporter, ReporterEvent, EvalResult, AcceptedDifference, AcceptedResult, RetryAttemptRecord, InvocationSummary, InvocationShape, DiagnosticRecord, ExperimentRunInfo, SandboxRunInfo, ScriptResult, CommandResult, InputRequest, InputRequestFilter, O11ySummary, TraceSpan, SpanKind, DerivedFacts, FailureClass, FailureScope, AttemptFailureInfo, AttemptFailureClassifier, ExternalCause, ExternalCauseFact, ExternalCauseLink, ExternalCauseScalar, } from \"./types.ts\";\nexport type { Adapter, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from \"./adapter.ts\";\nexport type { ParsedTranscript } from \"./o11y/parsers/index.ts\";\nexport { closeQA, factuality, faithfulness, instructionFollowing, pairwisePreference } from \"./assertions/judge-presets.ts\";\nexport type { CloseQAMaterial, JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from \"./assertions/judge-presets.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,uEAAuE;AACvE,yCAA2G;AAAlG,uGAAA,UAAU,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AACrF,2CAAoE;AAA3D,2GAAA,aAAa,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AAC7C,kDAAoD;AAA3C,uGAAA,WAAW,OAAA;AAEpB,kDAAyD;AAAhD,4GAAA,gBAAgB,OAAA;AAGzB,0EAA6J;AAApJ,2HAAA,mBAAmB,OAAA;AAG5B,qCAA8D;AAArD,qGAAA,UAAU,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,wGAAA,aAAa,OAAA;AAC1C,6CAA6C;AAC7C,6EAA6E;AAC7E,8DAAiG;AAAxF,wHAAA,oBAAoB,OAAA;AAAE,kHAAA,cAAc,OAAA;AAAE,kHAAA,cAAc,OAAA;AAK7D,kEAA4H;AAAnH,2GAAA,OAAO,OAAA;AAAE,8GAAA,UAAU,OAAA;AAAE,gHAAA,YAAY,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["// niceeval 公开导出(import { … } from \"niceeval\")。\n// Agent/Adapter 相关见 \"niceeval/adapter\";Sandbox 相关见 \"niceeval/sandbox\"。\nexport { defineEval, defineScoreEval, defineEvalGroup, defineConfig, defineExperiment } from \"./define.ts\";\nexport { defineAdapter, defineAdapterContract } from \"./adapter.ts\";\nexport { defineJudge } from \"./assertions/judge.ts\";\nexport type { JudgeAnchor, JudgeDefinition, JudgeOptions } from \"./assertions/judge.ts\";\nexport { defineScoreMatch } from \"./assertions/match.ts\";\nexport type { ManagedScoreMatchOptions, ScoreMatch, ScoreMatchAnchor, ScoreMatchContext, ScoreMatchLlmFailure, ScoreMatchResult } from \"./assertions/match.ts\";\nexport type { AssertionEntryId } from \"./assertions/identity.ts\";\nexport { readScoreMatchAudit, type ScoreMatchAudit, type ScoreMatchAuditEnvelope, type ScoreMatchAuditReadResult, } from \"./assertions/score-match-audit.ts\";\nexport type { AgentSendWindowIdentity, AgentWorkspaceDiffEndpoint, AgentWorkspaceDiffHunks, AgentWorkspaceDiffPolicy, AgentWorkspaceDiff, AgentWorkspaceDiffWindow, AgentWorkspaceDiffWindowChange, } from \"./assertions/workspace-diff.ts\";\nexport type { AssertionCheck, PolymorphicBooleanAssertionHandle, PolymorphicMeasurementAssertionHandle, PostRunBooleanAssertionHandle, } from \"./assertions/api.ts\";\nexport { requireEnv, getEnv, stripComments } from \"./util.ts\";\n// 执行失败分类:抛出点糖衣类(声明死因波及多远)+ 结构守卫。判据、分类链与止损语义见\n// docs/feature/error-classification/README.md;`niceeval/adapter` 复导出同一份词表类型。\nexport { ExperimentFatalError, EvalFatalError, failureClassOf } from \"./shared/failure-class.ts\";\n// 类型(eval 作者会用到;跑哪个 agent / 用哪个 sandbox 见对应子路径)\nexport type { StreamEvent, ToolName, JsonValue, JsonMatch, Usage, Turn, EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, TurnInput, InputFile, AnswerValue, InputResponse, RespondAnswer, TurnHandle, SessionHandle, TestContext, ScoreTestContext, Verdict, EvalAuthorFields, EvalInput, ScoreEvalInput, EvalDefinition, AnyEvalDefinition, EvalGroupMember, EvalGroupInput, EvalGroupDefinition, EvaluationKind, EvalDescriptor, ExperimentAuthorFields, SharedStateConfig, ExperimentInput, ExperimentDefinition, ExperimentHook, ExperimentHookContext, Config, LocalizedText, JudgeConfig, Reporter, ReporterEvent, EvalResult, AcceptedDifference, AcceptedResult, RetryAttemptRecord, InvocationSummary, InvocationShape, DiagnosticRecord, ExperimentRunInfo, SandboxRunInfo, ScriptResult, CommandResult, InputRequest, InputRequestFilter, O11ySummary, TraceSpan, SpanKind, DerivedFacts, FailureClass, FailureScope, AttemptFailureInfo, AttemptFailureClassifier, ExternalCause, ExternalCauseFact, ExternalCauseLink, ExternalCauseScalar, } from \"./types.ts\";\nexport type { Adapter, AdapterAssertionsFactory, AdapterAssertionsFactoryContext, AdapterCleanupContext, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from \"./adapter.ts\";\nexport type { ParsedTranscript } from \"./o11y/parsers/index.ts\";\nexport { closeQA, factuality, faithfulness, instructionFollowing, pairwisePreference } from \"./assertions/judge-presets.ts\";\nexport type { CloseQAMaterial, JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from \"./assertions/judge-presets.ts\";\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -7,11 +7,11 @@ export type { ManagedScoreMatchOptions, ScoreMatch, ScoreMatchAnchor, ScoreMatch
|
|
|
7
7
|
export type { AssertionEntryId } from "./assertions/identity.cjs";
|
|
8
8
|
export { readScoreMatchAudit, type ScoreMatchAudit, type ScoreMatchAuditEnvelope, type ScoreMatchAuditReadResult, } from "./assertions/score-match-audit.cjs";
|
|
9
9
|
export type { AgentSendWindowIdentity, AgentWorkspaceDiffEndpoint, AgentWorkspaceDiffHunks, AgentWorkspaceDiffPolicy, AgentWorkspaceDiff, AgentWorkspaceDiffWindow, AgentWorkspaceDiffWindowChange, } from "./assertions/workspace-diff.cjs";
|
|
10
|
-
export type { PostRunBooleanAssertionHandle } from "./assertions/api.cjs";
|
|
10
|
+
export type { AssertionCheck, PolymorphicBooleanAssertionHandle, PolymorphicMeasurementAssertionHandle, PostRunBooleanAssertionHandle, } from "./assertions/api.cjs";
|
|
11
11
|
export { requireEnv, getEnv, stripComments } from "./util.cjs";
|
|
12
12
|
export { ExperimentFatalError, EvalFatalError, failureClassOf } from "./shared/failure-class.cjs";
|
|
13
13
|
export type { StreamEvent, ToolName, JsonValue, JsonMatch, Usage, Turn, EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, TurnInput, InputFile, AnswerValue, InputResponse, RespondAnswer, TurnHandle, SessionHandle, TestContext, ScoreTestContext, Verdict, EvalAuthorFields, EvalInput, ScoreEvalInput, EvalDefinition, AnyEvalDefinition, EvalGroupMember, EvalGroupInput, EvalGroupDefinition, EvaluationKind, EvalDescriptor, ExperimentAuthorFields, SharedStateConfig, ExperimentInput, ExperimentDefinition, ExperimentHook, ExperimentHookContext, Config, LocalizedText, JudgeConfig, Reporter, ReporterEvent, EvalResult, AcceptedDifference, AcceptedResult, RetryAttemptRecord, InvocationSummary, InvocationShape, DiagnosticRecord, ExperimentRunInfo, SandboxRunInfo, ScriptResult, CommandResult, InputRequest, InputRequestFilter, O11ySummary, TraceSpan, SpanKind, DerivedFacts, FailureClass, FailureScope, AttemptFailureInfo, AttemptFailureClassifier, ExternalCause, ExternalCauseFact, ExternalCauseLink, ExternalCauseScalar, } from "./types.cjs";
|
|
14
|
-
export type { Adapter, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from "./adapter.cjs";
|
|
14
|
+
export type { Adapter, AdapterAssertionsFactory, AdapterAssertionsFactoryContext, AdapterCleanupContext, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from "./adapter.cjs";
|
|
15
15
|
export type { ParsedTranscript } from "./o11y/parsers/index.cjs";
|
|
16
16
|
export { closeQA, factuality, faithfulness, instructionFollowing, pairwisePreference } from "./assertions/judge-presets.cjs";
|
|
17
17
|
export type { CloseQAMaterial, JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from "./assertions/judge-presets.cjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -7,11 +7,11 @@ export type { ManagedScoreMatchOptions, ScoreMatch, ScoreMatchAnchor, ScoreMatch
|
|
|
7
7
|
export type { AssertionEntryId } from "./assertions/identity.mjs";
|
|
8
8
|
export { readScoreMatchAudit, type ScoreMatchAudit, type ScoreMatchAuditEnvelope, type ScoreMatchAuditReadResult, } from "./assertions/score-match-audit.mjs";
|
|
9
9
|
export type { AgentSendWindowIdentity, AgentWorkspaceDiffEndpoint, AgentWorkspaceDiffHunks, AgentWorkspaceDiffPolicy, AgentWorkspaceDiff, AgentWorkspaceDiffWindow, AgentWorkspaceDiffWindowChange, } from "./assertions/workspace-diff.mjs";
|
|
10
|
-
export type { PostRunBooleanAssertionHandle } from "./assertions/api.mjs";
|
|
10
|
+
export type { AssertionCheck, PolymorphicBooleanAssertionHandle, PolymorphicMeasurementAssertionHandle, PostRunBooleanAssertionHandle, } from "./assertions/api.mjs";
|
|
11
11
|
export { requireEnv, getEnv, stripComments } from "./util.mjs";
|
|
12
12
|
export { ExperimentFatalError, EvalFatalError, failureClassOf } from "./shared/failure-class.mjs";
|
|
13
13
|
export type { StreamEvent, ToolName, JsonValue, JsonMatch, Usage, Turn, EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, TurnInput, InputFile, AnswerValue, InputResponse, RespondAnswer, TurnHandle, SessionHandle, TestContext, ScoreTestContext, Verdict, EvalAuthorFields, EvalInput, ScoreEvalInput, EvalDefinition, AnyEvalDefinition, EvalGroupMember, EvalGroupInput, EvalGroupDefinition, EvaluationKind, EvalDescriptor, ExperimentAuthorFields, SharedStateConfig, ExperimentInput, ExperimentDefinition, ExperimentHook, ExperimentHookContext, Config, LocalizedText, JudgeConfig, Reporter, ReporterEvent, EvalResult, AcceptedDifference, AcceptedResult, RetryAttemptRecord, InvocationSummary, InvocationShape, DiagnosticRecord, ExperimentRunInfo, SandboxRunInfo, ScriptResult, CommandResult, InputRequest, InputRequestFilter, O11ySummary, TraceSpan, SpanKind, DerivedFacts, FailureClass, FailureScope, AttemptFailureInfo, AttemptFailureClassifier, ExternalCause, ExternalCauseFact, ExternalCauseLink, ExternalCauseScalar, } from "./types.mjs";
|
|
14
|
-
export type { Adapter, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from "./adapter.mjs";
|
|
14
|
+
export type { Adapter, AdapterAssertionsFactory, AdapterAssertionsFactoryContext, AdapterCleanupContext, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from "./adapter.mjs";
|
|
15
15
|
export type { ParsedTranscript } from "./o11y/parsers/index.mjs";
|
|
16
16
|
export { closeQA, factuality, faithfulness, instructionFollowing, pairwisePreference } from "./assertions/judge-presets.mjs";
|
|
17
17
|
export type { CloseQAMaterial, JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from "./assertions/judge-presets.mjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ export type { ManagedScoreMatchOptions, ScoreMatch, ScoreMatchAnchor, ScoreMatch
|
|
|
7
7
|
export type { AssertionEntryId } from "./assertions/identity.js";
|
|
8
8
|
export { readScoreMatchAudit, type ScoreMatchAudit, type ScoreMatchAuditEnvelope, type ScoreMatchAuditReadResult, } from "./assertions/score-match-audit.js";
|
|
9
9
|
export type { AgentSendWindowIdentity, AgentWorkspaceDiffEndpoint, AgentWorkspaceDiffHunks, AgentWorkspaceDiffPolicy, AgentWorkspaceDiff, AgentWorkspaceDiffWindow, AgentWorkspaceDiffWindowChange, } from "./assertions/workspace-diff.js";
|
|
10
|
-
export type { PostRunBooleanAssertionHandle } from "./assertions/api.js";
|
|
10
|
+
export type { AssertionCheck, PolymorphicBooleanAssertionHandle, PolymorphicMeasurementAssertionHandle, PostRunBooleanAssertionHandle, } from "./assertions/api.js";
|
|
11
11
|
export { requireEnv, getEnv, stripComments } from "./util.js";
|
|
12
12
|
export { ExperimentFatalError, EvalFatalError, failureClassOf } from "./shared/failure-class.js";
|
|
13
13
|
export type { StreamEvent, ToolName, JsonValue, JsonMatch, Usage, Turn, EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, TurnInput, InputFile, AnswerValue, InputResponse, RespondAnswer, TurnHandle, SessionHandle, TestContext, ScoreTestContext, Verdict, EvalAuthorFields, EvalInput, ScoreEvalInput, EvalDefinition, AnyEvalDefinition, EvalGroupMember, EvalGroupInput, EvalGroupDefinition, EvaluationKind, EvalDescriptor, ExperimentAuthorFields, SharedStateConfig, ExperimentInput, ExperimentDefinition, ExperimentHook, ExperimentHookContext, Config, LocalizedText, JudgeConfig, Reporter, ReporterEvent, EvalResult, AcceptedDifference, AcceptedResult, RetryAttemptRecord, InvocationSummary, InvocationShape, DiagnosticRecord, ExperimentRunInfo, SandboxRunInfo, ScriptResult, CommandResult, InputRequest, InputRequestFilter, O11ySummary, TraceSpan, SpanKind, DerivedFacts, FailureClass, FailureScope, AttemptFailureInfo, AttemptFailureClassifier, ExternalCause, ExternalCauseFact, ExternalCauseLink, ExternalCauseScalar, } from "./types.js";
|
|
14
|
-
export type { Adapter, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from "./adapter.js";
|
|
14
|
+
export type { Adapter, AdapterAssertionsFactory, AdapterAssertionsFactoryContext, AdapterCleanupContext, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from "./adapter.js";
|
|
15
15
|
export type { ParsedTranscript } from "./o11y/parsers/index.js";
|
|
16
16
|
export { closeQA, factuality, faithfulness, instructionFollowing, pairwisePreference } from "./assertions/judge-presets.js";
|
|
17
17
|
export type { CloseQAMaterial, JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from "./assertions/judge-presets.js";
|