@stigmer/eval-runtime 0.0.0-stage → 3.41.1-dev.20261011143907.gb2e0845f35f1

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/try-stop.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * How a run says the platform stopped it for one of a plugin-eval try's own
3
+ * reasons, in words a person reads on the run and the eval parses back.
4
+ *
5
+ * A run's status names no termination reason: a stopped run carries one
6
+ * error sentence. The runner writes these sentences with
7
+ * {@link formatTryStop} and the eval's case workflow reads them with
8
+ * {@link parseTryStop}, so the wording lives once, here, rather than as a
9
+ * literal each side copies. A typed reason belongs to the run's event log
10
+ * when it carries one; until then this pair is the contract.
11
+ *
12
+ * The stops:
13
+ * - `cost-limit`: the run's cost cap. Not an eval stop alone (any run has
14
+ * a cap), but the eval tells a try stopped at its own share by it.
15
+ * - `scaffold-failed`: the case's scaffold script exited non-zero or ran
16
+ * past its limit, before the agent started. The try scores 0 with the
17
+ * error "scaffold failed: <detail>", as the format scores it.
18
+ * - `mock-aborted`: a mock stopped the run: its input guard was violated,
19
+ * its agent ended the run, or the agent mocks' call budget ran out. The
20
+ * try scores 0 with no error, reported as aborted.
21
+ */
22
+ /** A try's own stop, as both sides read it. */
23
+ export type TryStop = {
24
+ readonly kind: "cost-limit";
25
+ readonly estimatedCostUsd: number;
26
+ readonly maxCostUsd: number;
27
+ } | {
28
+ readonly kind: "scaffold-failed";
29
+ readonly detail: string;
30
+ } | {
31
+ readonly kind: "mock-aborted";
32
+ readonly server: string;
33
+ readonly tool: string;
34
+ readonly reason: string;
35
+ };
36
+ /**
37
+ * The leading words of a cost-cap stop. Kept stable: a client may tell
38
+ * this stop from the others by them.
39
+ */
40
+ export declare const COST_LIMIT_ERROR_PREFIX = "Agent reached the cost limit";
41
+ /** The run error for a try's stop. */
42
+ export declare function formatTryStop(stop: TryStop): string;
43
+ /**
44
+ * The try stop a run error names, or `undefined` for any other error. A
45
+ * cost-limit stop's amounts are read when present and 0 otherwise; the
46
+ * eval compares the run's own estimate, not these.
47
+ */
48
+ export declare function parseTryStop(error: string): TryStop | undefined;
49
+ //# sourceMappingURL=try-stop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"try-stop.d.ts","sourceRoot":"","sources":["src/try-stop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC/F;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/G;;;GAGG;AACH,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AAKtE,sCAAsC;AACtC,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAanD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAqB/D"}
package/try-stop.js ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * How a run says the platform stopped it for one of a plugin-eval try's own
3
+ * reasons, in words a person reads on the run and the eval parses back.
4
+ *
5
+ * A run's status names no termination reason: a stopped run carries one
6
+ * error sentence. The runner writes these sentences with
7
+ * {@link formatTryStop} and the eval's case workflow reads them with
8
+ * {@link parseTryStop}, so the wording lives once, here, rather than as a
9
+ * literal each side copies. A typed reason belongs to the run's event log
10
+ * when it carries one; until then this pair is the contract.
11
+ *
12
+ * The stops:
13
+ * - `cost-limit`: the run's cost cap. Not an eval stop alone (any run has
14
+ * a cap), but the eval tells a try stopped at its own share by it.
15
+ * - `scaffold-failed`: the case's scaffold script exited non-zero or ran
16
+ * past its limit, before the agent started. The try scores 0 with the
17
+ * error "scaffold failed: <detail>", as the format scores it.
18
+ * - `mock-aborted`: a mock stopped the run: its input guard was violated,
19
+ * its agent ended the run, or the agent mocks' call budget ran out. The
20
+ * try scores 0 with no error, reported as aborted.
21
+ */
22
+ /**
23
+ * The leading words of a cost-cap stop. Kept stable: a client may tell
24
+ * this stop from the others by them.
25
+ */
26
+ export const COST_LIMIT_ERROR_PREFIX = "Agent reached the cost limit";
27
+ const SCAFFOLD_PREFIX = "The eval case's scaffold failed: ";
28
+ const MOCK_PREFIX = "A mock stopped the run: ";
29
+ /** The run error for a try's stop. */
30
+ export function formatTryStop(stop) {
31
+ switch (stop.kind) {
32
+ case "cost-limit":
33
+ return (`${COST_LIMIT_ERROR_PREFIX} for this message ` +
34
+ `(~$${stop.estimatedCostUsd.toFixed(4)} of the $${stop.maxCostUsd.toFixed(2)} budget). ` +
35
+ `Send another message to continue.`);
36
+ case "scaffold-failed":
37
+ return `${SCAFFOLD_PREFIX}${oneLine(stop.detail)}`;
38
+ case "mock-aborted":
39
+ return `${MOCK_PREFIX}server ${JSON.stringify(stop.server)}, tool ${JSON.stringify(stop.tool)}: ${oneLine(stop.reason)}`;
40
+ }
41
+ }
42
+ /**
43
+ * The try stop a run error names, or `undefined` for any other error. A
44
+ * cost-limit stop's amounts are read when present and 0 otherwise; the
45
+ * eval compares the run's own estimate, not these.
46
+ */
47
+ export function parseTryStop(error) {
48
+ if (error.startsWith(COST_LIMIT_ERROR_PREFIX)) {
49
+ const amounts = /\(~\$([0-9.]+) of the \$([0-9.]+) budget\)/.exec(error);
50
+ return {
51
+ kind: "cost-limit",
52
+ estimatedCostUsd: Number(amounts?.[1] ?? 0),
53
+ maxCostUsd: Number(amounts?.[2] ?? 0),
54
+ };
55
+ }
56
+ if (error.startsWith(SCAFFOLD_PREFIX)) {
57
+ return { kind: "scaffold-failed", detail: error.slice(SCAFFOLD_PREFIX.length) };
58
+ }
59
+ if (error.startsWith(MOCK_PREFIX)) {
60
+ const parts = /^server ("(?:[^"\\]|\\.)*"), tool ("(?:[^"\\]|\\.)*"): ([\s\S]*)$/.exec(error.slice(MOCK_PREFIX.length));
61
+ if (parts === null)
62
+ return undefined;
63
+ const server = unquoted(parts[1] ?? '""');
64
+ const tool = unquoted(parts[2] ?? '""');
65
+ if (server === undefined || tool === undefined)
66
+ return undefined;
67
+ return { kind: "mock-aborted", server, tool, reason: parts[3] ?? "" };
68
+ }
69
+ return undefined;
70
+ }
71
+ /** A JSON string literal's value, or `undefined` for an escape JSON refuses. */
72
+ function unquoted(literal) {
73
+ try {
74
+ return JSON.parse(literal);
75
+ }
76
+ catch {
77
+ return undefined;
78
+ }
79
+ }
80
+ /** A detail on one line, so the sentence stays one. */
81
+ function oneLine(text) {
82
+ return text.replace(/\s*[\r\n]+\s*/g, " ").trim();
83
+ }
84
+ //# sourceMappingURL=try-stop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"try-stop.js","sourceRoot":"","sources":["src/try-stop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAEtE,MAAM,eAAe,GAAG,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,0BAA0B,CAAC;AAE/C,sCAAsC;AACtC,MAAM,UAAU,aAAa,CAAC,IAAa;IACzC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,YAAY;YACf,OAAO,CACL,GAAG,uBAAuB,oBAAoB;gBAC9C,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,UAAU,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,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QACjE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,gFAAgF;AAChF,SAAS,QAAQ,CAAC,OAAe;IAC/B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,uDAAuD;AACvD,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACpD,CAAC"}
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.