@openpond/evals 0.11.20 → 0.11.21
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/connected-evidence/collector-coverage-contracts.js +160 -0
- package/dist/connected-evidence/index.js +1 -0
- package/dist/execution-contracts.js +1 -1
- package/dist/javascript-isolate-node.js +2 -1
- package/dist/javascript-isolate-process-source.js +1 -1
- package/dist/javascript-isolate-process.js +2 -1
- package/dist/javascript-isolate.js +2 -1
- package/dist/javascript-verifier-worker-source.js +1 -1
- package/dist/native-conversations/codex-window-inventory.js +97 -0
- package/dist/native-conversations/collector-acquisition.js +149 -0
- package/dist/native-conversations/collector-branches.js +1 -0
- package/dist/native-conversations/collector-calendar-gate.js +19 -0
- package/dist/native-conversations/collector-contracts.js +4 -3
- package/dist/native-conversations/collector-coverage.js +100 -0
- package/dist/native-conversations/collector-cron.js +43 -0
- package/dist/native-conversations/collector-schedule.js +61 -0
- package/dist/native-conversations/collector-service-files.js +51 -0
- package/dist/native-conversations/collector-snapshots.js +70 -0
- package/dist/native-conversations/collector-source-cache.js +41 -0
- package/dist/native-conversations/collector-store.js +43 -8
- package/dist/native-conversations/collector.js +189 -261
- package/dist/native-conversations/history.js +9 -0
- package/dist/native-conversations/index.js +1 -0
- package/dist/native-conversations/location.js +4 -2
- package/dist/native-conversations/supervisor.js +131 -81
- package/dist/sql-execution-node.js +2 -1
- package/dist/tasksets.js +1 -1
- package/dist/types/connected-evidence/collector-coverage-contracts.d.ts +98 -0
- package/dist/types/connected-evidence/collector-coverage-contracts.d.ts.map +1 -0
- package/dist/types/connected-evidence/index.d.ts +1 -0
- package/dist/types/connected-evidence/index.d.ts.map +1 -1
- package/dist/types/javascript-isolate-node.d.ts.map +1 -1
- package/dist/types/javascript-isolate-process.d.ts.map +1 -1
- package/dist/types/javascript-isolate.d.ts.map +1 -1
- package/dist/types/native-conversations/codex-window-inventory.d.ts +12 -0
- package/dist/types/native-conversations/codex-window-inventory.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-acquisition.d.ts +17 -0
- package/dist/types/native-conversations/collector-acquisition.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-branches.d.ts.map +1 -1
- package/dist/types/native-conversations/collector-calendar-gate.d.ts +9 -0
- package/dist/types/native-conversations/collector-calendar-gate.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-contracts.d.ts +41 -5
- package/dist/types/native-conversations/collector-contracts.d.ts.map +1 -1
- package/dist/types/native-conversations/collector-coverage.d.ts +62 -0
- package/dist/types/native-conversations/collector-coverage.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-cron.d.ts +20 -0
- package/dist/types/native-conversations/collector-cron.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-schedule.d.ts +13 -0
- package/dist/types/native-conversations/collector-schedule.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-service-files.d.ts +20 -0
- package/dist/types/native-conversations/collector-service-files.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-snapshots.d.ts +25 -0
- package/dist/types/native-conversations/collector-snapshots.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-source-cache.d.ts +31 -0
- package/dist/types/native-conversations/collector-source-cache.d.ts.map +1 -0
- package/dist/types/native-conversations/collector-store.d.ts +11 -2
- package/dist/types/native-conversations/collector-store.d.ts.map +1 -1
- package/dist/types/native-conversations/collector.d.ts +5 -1
- package/dist/types/native-conversations/collector.d.ts.map +1 -1
- package/dist/types/native-conversations/history.d.ts +7 -0
- package/dist/types/native-conversations/history.d.ts.map +1 -1
- package/dist/types/native-conversations/index.d.ts +1 -0
- package/dist/types/native-conversations/index.d.ts.map +1 -1
- package/dist/types/native-conversations/location.d.ts.map +1 -1
- package/dist/types/native-conversations/supervisor.d.ts +4 -3
- package/dist/types/native-conversations/supervisor.d.ts.map +1 -1
- package/dist/types/sql-execution-node.d.ts.map +1 -1
- package/package.json +3 -2
- package/schemas/learning/v1/package.schema.json +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { contentHash } from "@openpond/harness";
|
|
3
|
+
const Id = z.string().trim().min(1).max(500);
|
|
4
|
+
const Hash = z.string().regex(/^[a-f0-9]{64}$/);
|
|
5
|
+
const Timestamp = z.iso.datetime();
|
|
6
|
+
const Count = z.number().int().nonnegative().max(1_000_000);
|
|
7
|
+
export const CollectorCoverageSessionSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
sourceKeyHash: Hash,
|
|
10
|
+
nativeRevisionHash: Hash.nullable(),
|
|
11
|
+
state: z.enum(["reading", "admitted", "skipped", "failed"]),
|
|
12
|
+
reason: z
|
|
13
|
+
.enum([
|
|
14
|
+
"no_eligible_boundaries",
|
|
15
|
+
"native_session_not_ready",
|
|
16
|
+
"source_read_failed",
|
|
17
|
+
"source_revision_unavailable",
|
|
18
|
+
])
|
|
19
|
+
.nullable(),
|
|
20
|
+
unknownTimeBoundaries: Count,
|
|
21
|
+
normalized: z
|
|
22
|
+
.array(z
|
|
23
|
+
.object({
|
|
24
|
+
sessionHash: Hash,
|
|
25
|
+
boundaries: z
|
|
26
|
+
.array(z
|
|
27
|
+
.object({ id: Id, inputHash: Hash, revisionHash: Hash, occurredAt: Timestamp })
|
|
28
|
+
.strict())
|
|
29
|
+
.max(5_000),
|
|
30
|
+
})
|
|
31
|
+
.strict())
|
|
32
|
+
.max(1_000),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
export const CollectorCoverageManifestSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
schemaVersion: z.literal("openpond.collectorCoverageManifest.v1"),
|
|
38
|
+
jobId: Id,
|
|
39
|
+
connectionId: Id,
|
|
40
|
+
connectionRevision: z.number().int().positive(),
|
|
41
|
+
machineId: Id,
|
|
42
|
+
sourceInstanceId: Id,
|
|
43
|
+
from: Timestamp.nullable(),
|
|
44
|
+
to: Timestamp,
|
|
45
|
+
startedAt: Timestamp,
|
|
46
|
+
finishedAt: Timestamp.nullable(),
|
|
47
|
+
listingComplete: z.boolean(),
|
|
48
|
+
pendingOperations: Count,
|
|
49
|
+
sessions: z.array(CollectorCoverageSessionSchema).max(10_000),
|
|
50
|
+
})
|
|
51
|
+
.strict()
|
|
52
|
+
.superRefine((value, ctx) => {
|
|
53
|
+
if (value.from !== null && Date.parse(value.from) >= Date.parse(value.to))
|
|
54
|
+
ctx.addIssue({
|
|
55
|
+
code: "custom",
|
|
56
|
+
message: "Collector source window is empty.",
|
|
57
|
+
});
|
|
58
|
+
if (value.finishedAt !== null &&
|
|
59
|
+
Date.parse(value.finishedAt) < Date.parse(value.startedAt))
|
|
60
|
+
ctx.addIssue({
|
|
61
|
+
code: "custom",
|
|
62
|
+
message: "Collector finish time precedes its start.",
|
|
63
|
+
});
|
|
64
|
+
if (new Set(value.sessions.map((session) => session.sourceKeyHash)).size !==
|
|
65
|
+
value.sessions.length)
|
|
66
|
+
ctx.addIssue({
|
|
67
|
+
code: "custom",
|
|
68
|
+
message: "Collector source inventory is duplicated.",
|
|
69
|
+
});
|
|
70
|
+
let boundaries = 0;
|
|
71
|
+
for (const session of value.sessions)
|
|
72
|
+
for (const normalized of session.normalized) {
|
|
73
|
+
boundaries += normalized.boundaries.length;
|
|
74
|
+
if (new Set(normalized.boundaries.map((boundary) => boundary.id)).size !==
|
|
75
|
+
normalized.boundaries.length)
|
|
76
|
+
ctx.addIssue({
|
|
77
|
+
code: "custom",
|
|
78
|
+
message: "Normalized source boundaries are duplicated.",
|
|
79
|
+
});
|
|
80
|
+
for (const boundary of normalized.boundaries)
|
|
81
|
+
if (Date.parse(boundary.occurredAt) >= Date.parse(value.to) ||
|
|
82
|
+
(value.from !== null &&
|
|
83
|
+
Date.parse(boundary.occurredAt) < Date.parse(value.from)))
|
|
84
|
+
ctx.addIssue({
|
|
85
|
+
code: "custom",
|
|
86
|
+
message: "Eligible boundary is outside the declared event-time window.",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (boundaries > 20_000)
|
|
90
|
+
ctx.addIssue({
|
|
91
|
+
code: "custom",
|
|
92
|
+
message: "Collector coverage exceeds its bounded boundary inventory.",
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
export const CollectorCoverageSummarySchema = z
|
|
96
|
+
.object({
|
|
97
|
+
jobId: Id,
|
|
98
|
+
manifestHash: Hash,
|
|
99
|
+
sourceInventoryHash: Hash,
|
|
100
|
+
eligibleBoundaryHash: Hash,
|
|
101
|
+
from: Timestamp.nullable(),
|
|
102
|
+
to: Timestamp,
|
|
103
|
+
finishedAt: Timestamp.nullable(),
|
|
104
|
+
conversations: Count,
|
|
105
|
+
eligibleTurns: Count,
|
|
106
|
+
admittedSessions: Count,
|
|
107
|
+
skippedSessions: Count,
|
|
108
|
+
failedSessions: Count,
|
|
109
|
+
unknownTimeBoundaries: Count,
|
|
110
|
+
pendingOperations: Count,
|
|
111
|
+
listingComplete: z.boolean(),
|
|
112
|
+
complete: z.boolean(),
|
|
113
|
+
})
|
|
114
|
+
.strict();
|
|
115
|
+
export function hashCollectorEligibleBoundaries(input) {
|
|
116
|
+
const boundaries = new Map(input.map((boundary) => [
|
|
117
|
+
JSON.stringify([boundary.id, boundary.inputHash, boundary.revisionHash]),
|
|
118
|
+
{ id: boundary.id, inputHash: boundary.inputHash, revisionHash: boundary.revisionHash },
|
|
119
|
+
]));
|
|
120
|
+
const ordered = [...boundaries]
|
|
121
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
122
|
+
.map(([, boundary]) => boundary);
|
|
123
|
+
return { hash: contentHash(ordered), count: ordered.length };
|
|
124
|
+
}
|
|
125
|
+
export function summarizeCollectorCoverage(raw) {
|
|
126
|
+
const manifest = CollectorCoverageManifestSchema.parse(raw);
|
|
127
|
+
const boundaries = hashCollectorEligibleBoundaries(manifest.sessions.flatMap((session) => session.normalized.flatMap((normalized) => normalized.boundaries)));
|
|
128
|
+
const unknownTimeBoundaries = manifest.sessions.reduce((sum, session) => sum + session.unknownTimeBoundaries, 0);
|
|
129
|
+
return CollectorCoverageSummarySchema.parse({
|
|
130
|
+
jobId: manifest.jobId,
|
|
131
|
+
manifestHash: contentHash(manifest),
|
|
132
|
+
sourceInventoryHash: contentHash(manifest.sessions
|
|
133
|
+
.map((session) => ({
|
|
134
|
+
sourceKeyHash: session.sourceKeyHash,
|
|
135
|
+
nativeRevisionHash: session.nativeRevisionHash,
|
|
136
|
+
snapshots: session.normalized.map((normalized) => normalized.sessionHash),
|
|
137
|
+
}))
|
|
138
|
+
.sort((a, b) => a.sourceKeyHash.localeCompare(b.sourceKeyHash))),
|
|
139
|
+
eligibleBoundaryHash: boundaries.hash,
|
|
140
|
+
from: manifest.from,
|
|
141
|
+
to: manifest.to,
|
|
142
|
+
finishedAt: manifest.finishedAt,
|
|
143
|
+
conversations: manifest.sessions.length,
|
|
144
|
+
eligibleTurns: boundaries.count,
|
|
145
|
+
admittedSessions: manifest.sessions.filter((session) => session.state === "admitted").length,
|
|
146
|
+
skippedSessions: manifest.sessions.filter((session) => session.state === "skipped").length,
|
|
147
|
+
failedSessions: manifest.sessions.filter((session) => session.state === "failed").length,
|
|
148
|
+
unknownTimeBoundaries,
|
|
149
|
+
pendingOperations: manifest.pendingOperations,
|
|
150
|
+
listingComplete: manifest.listingComplete,
|
|
151
|
+
complete: manifest.finishedAt !== null &&
|
|
152
|
+
manifest.listingComplete &&
|
|
153
|
+
manifest.pendingOperations === 0 &&
|
|
154
|
+
unknownTimeBoundaries === 0 &&
|
|
155
|
+
manifest.sessions.every((session) => session.nativeRevisionHash !== null &&
|
|
156
|
+
(session.state === "admitted" ||
|
|
157
|
+
(session.state === "skipped" &&
|
|
158
|
+
session.reason === "no_eligible_boundaries"))),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
@@ -83,7 +83,7 @@ export const VerifierSetReleaseContentSchema = z.object({
|
|
|
83
83
|
schemaVersion: z.literal("openpond.verifierSetRelease.v1"),
|
|
84
84
|
id: ReleaseIdSchema,
|
|
85
85
|
revision: z.number().int().positive(),
|
|
86
|
-
graders: z.array(GraderSpecSchema).
|
|
86
|
+
graders: z.array(GraderSpecSchema).max(1_000),
|
|
87
87
|
isolation: z.object({
|
|
88
88
|
processBoundary: z.enum(["same_process", "isolated_process", "container"]),
|
|
89
89
|
networkPolicy: z.literal("none"),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Worker } from "node:worker_threads";
|
|
2
|
-
import { javascriptVerifierWorkerSource } from "./javascript-verifier-worker-source.js";
|
|
3
2
|
import { validateJavaScriptIsolateInput } from "./javascript-isolate.js";
|
|
4
3
|
import { assertBoundedTaskJson } from "./task-schema.js";
|
|
5
4
|
/** Both environment steps and graders settle only after their worker stops. */
|
|
6
5
|
export async function executeJavaScriptIsolateInWorker(input) {
|
|
7
6
|
input.signal?.throwIfAborted();
|
|
8
7
|
validateJavaScriptIsolateInput(input);
|
|
8
|
+
const { javascriptVerifierWorkerSource } = await import("./javascript-verifier-worker-source.js");
|
|
9
|
+
input.signal?.throwIfAborted();
|
|
9
10
|
const signal = input.signal;
|
|
10
11
|
const workerData = { source: input.source, exportName: input.exportName, value: input.value, timeoutMs: input.timeoutMs, maxResultBytes: input.maxResultBytes, deterministic: input.deterministic === true, errorPrefix: input.errorPrefix };
|
|
11
12
|
const error = (suffix) => new Error(`${input.errorPrefix}_${suffix}`);
|