@runtypelabs/sdk 5.8.1 → 5.9.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/dist/index.cjs +5 -1
- package/dist/index.d.cts +57 -3
- package/dist/index.d.ts +57 -3
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2283,12 +2283,16 @@ function judge(criteria, opts) {
|
|
|
2283
2283
|
if (typeof criteria !== "string" || criteria.trim().length === 0) {
|
|
2284
2284
|
throw new Error("judge() requires non-empty criteria");
|
|
2285
2285
|
}
|
|
2286
|
+
if (opts?.judgeFlowId !== void 0 && opts.judgeFlowId.trim().length === 0) {
|
|
2287
|
+
throw new Error("judge() requires a non-empty judgeFlowId when one is provided");
|
|
2288
|
+
}
|
|
2286
2289
|
return gradeable({
|
|
2287
2290
|
kind: "ai",
|
|
2288
2291
|
criteria,
|
|
2289
2292
|
...opts?.preset ? { preset: opts.preset } : {},
|
|
2290
2293
|
...opts?.useExpected ? { useExpected: true } : {},
|
|
2291
2294
|
...opts?.model ? { model: opts.model } : {},
|
|
2295
|
+
...opts?.judgeFlowId ? { judgeFlowId: opts.judgeFlowId } : {},
|
|
2292
2296
|
...opts?.threshold !== void 0 ? { threshold: opts.threshold } : {}
|
|
2293
2297
|
});
|
|
2294
2298
|
}
|
|
@@ -6395,7 +6399,7 @@ var Runtype = class {
|
|
|
6395
6399
|
|
|
6396
6400
|
// src/version.ts
|
|
6397
6401
|
var FALLBACK_VERSION = "0.0.0";
|
|
6398
|
-
var SDK_VERSION = "5.
|
|
6402
|
+
var SDK_VERSION = "5.9.0".length > 0 ? "5.9.0" : FALLBACK_VERSION;
|
|
6399
6403
|
var RUNTYPE_CLIENT_KIND = "sdk";
|
|
6400
6404
|
var SDK_USER_AGENT = `runtype-sdk/${SDK_VERSION} (typescript)`;
|
|
6401
6405
|
|
package/dist/index.d.cts
CHANGED
|
@@ -18404,6 +18404,8 @@ interface paths {
|
|
|
18404
18404
|
content: {
|
|
18405
18405
|
"application/json": {
|
|
18406
18406
|
data: {
|
|
18407
|
+
/** @description True when historical (R2 SQL) logs were unavailable and only recent hot-tier entries are included. Absent on healthy responses. */
|
|
18408
|
+
degraded?: boolean;
|
|
18407
18409
|
entries: {
|
|
18408
18410
|
[key: string]: unknown;
|
|
18409
18411
|
}[];
|
|
@@ -18582,6 +18584,8 @@ interface paths {
|
|
|
18582
18584
|
byType: {
|
|
18583
18585
|
[key: string]: number;
|
|
18584
18586
|
};
|
|
18587
|
+
/** @description True when historical (R2 SQL) counts were unavailable and stats cover only the recent hot-tier window. Absent on healthy responses. */
|
|
18588
|
+
degraded?: boolean;
|
|
18585
18589
|
histogram: {
|
|
18586
18590
|
bucket: string;
|
|
18587
18591
|
count: number;
|
|
@@ -38717,6 +38721,12 @@ interface components {
|
|
|
38717
38721
|
caseId: string | null;
|
|
38718
38722
|
name: string;
|
|
38719
38723
|
outcomes: {
|
|
38724
|
+
/** @description AI graders only: transcript entries the verdict rests on — indices into the run's trace steps (message) or tool calls (tool_call). */
|
|
38725
|
+
evidence?: {
|
|
38726
|
+
index: number;
|
|
38727
|
+
/** @enum {string} */
|
|
38728
|
+
kind: "message" | "tool_call";
|
|
38729
|
+
}[];
|
|
38720
38730
|
graderIndex: number;
|
|
38721
38731
|
kind: string;
|
|
38722
38732
|
passed: boolean;
|
|
@@ -38727,6 +38737,11 @@ interface components {
|
|
|
38727
38737
|
* @enum {string}
|
|
38728
38738
|
*/
|
|
38729
38739
|
severity?: "gate" | "soft";
|
|
38740
|
+
/**
|
|
38741
|
+
* @description AI graders only: the judge's binary verdict. insufficient_evidence means the judge declined to guess; it renders as a warning and never fails the case.
|
|
38742
|
+
* @enum {string}
|
|
38743
|
+
*/
|
|
38744
|
+
verdict?: "pass" | "fail" | "insufficient_evidence";
|
|
38730
38745
|
}[];
|
|
38731
38746
|
/** @description Truncated snapshot of the output that was graded (2000 chars max). */
|
|
38732
38747
|
outputExcerpt: string;
|
|
@@ -39836,6 +39851,12 @@ interface components {
|
|
|
39836
39851
|
errored: boolean;
|
|
39837
39852
|
name: string;
|
|
39838
39853
|
outcomes: {
|
|
39854
|
+
/** @description AI graders only: transcript entries the verdict rests on — indices into the run's trace steps (message) or tool calls (tool_call). */
|
|
39855
|
+
evidence?: {
|
|
39856
|
+
index: number;
|
|
39857
|
+
/** @enum {string} */
|
|
39858
|
+
kind: "message" | "tool_call";
|
|
39859
|
+
}[];
|
|
39839
39860
|
graderIndex: number;
|
|
39840
39861
|
kind: string;
|
|
39841
39862
|
passed: boolean;
|
|
@@ -39846,6 +39867,11 @@ interface components {
|
|
|
39846
39867
|
* @enum {string}
|
|
39847
39868
|
*/
|
|
39848
39869
|
severity?: "gate" | "soft";
|
|
39870
|
+
/**
|
|
39871
|
+
* @description AI graders only: the judge's binary verdict. insufficient_evidence means the judge declined to guess; it renders as a warning and never fails the case.
|
|
39872
|
+
* @enum {string}
|
|
39873
|
+
*/
|
|
39874
|
+
verdict?: "pass" | "fail" | "insufficient_evidence";
|
|
39849
39875
|
}[];
|
|
39850
39876
|
outputExcerpt: string;
|
|
39851
39877
|
passed: boolean;
|
|
@@ -42396,6 +42422,8 @@ interface LogQueryResult {
|
|
|
42396
42422
|
cursor: string | null;
|
|
42397
42423
|
hasMore: boolean;
|
|
42398
42424
|
};
|
|
42425
|
+
/** True when historical (R2 SQL) logs were unavailable and only recent hot-tier entries are included. */
|
|
42426
|
+
degraded?: boolean;
|
|
42399
42427
|
}
|
|
42400
42428
|
/** Logs are wrapped in a `{ success, data }` envelope by the API. */
|
|
42401
42429
|
interface LogQueryResponse {
|
|
@@ -42414,6 +42442,8 @@ interface LogStatsResult {
|
|
|
42414
42442
|
count: number;
|
|
42415
42443
|
errors: number;
|
|
42416
42444
|
}>;
|
|
42445
|
+
/** True when historical (R2 SQL) counts were unavailable and stats cover only the recent hot-tier window. */
|
|
42446
|
+
degraded?: boolean;
|
|
42417
42447
|
}
|
|
42418
42448
|
interface LogStatsResponse {
|
|
42419
42449
|
success: boolean;
|
|
@@ -42621,8 +42651,17 @@ interface AIGrader {
|
|
|
42621
42651
|
criteria: string;
|
|
42622
42652
|
/** Reference-guided when the case has `expected`. */
|
|
42623
42653
|
useExpected?: boolean;
|
|
42624
|
-
/** Defaults to a cheap routed model at execution time. */
|
|
42654
|
+
/** Defaults to a cheap routed model at execution time. Ignored when `judgeFlowId` is set. */
|
|
42625
42655
|
model?: string;
|
|
42656
|
+
/**
|
|
42657
|
+
* Custom judge flow: your flow (by id) runs as the judge instead of the
|
|
42658
|
+
* platform judge prompt. It receives `criteria`, `caseName`, `expected`, and
|
|
42659
|
+
* `transcript` as inputs and must output the platform verdict JSON
|
|
42660
|
+
* (`{"reasoning", "verdict": "pass"|"fail"|"insufficient_evidence", "evidence"}`).
|
|
42661
|
+
* A miswired flow (missing, failing, or returning malformed output) resolves
|
|
42662
|
+
* to an insufficient-evidence warning with the error, never a verdict.
|
|
42663
|
+
*/
|
|
42664
|
+
judgeFlowId?: string;
|
|
42626
42665
|
/** Pass cutoff on the 1-5 judge scale (default 4 server-side). Set via `.atLeast(n)`. */
|
|
42627
42666
|
threshold?: number;
|
|
42628
42667
|
/** Hard gate (default) vs soft. Set via `.gate()` / `.soft()`. */
|
|
@@ -42717,6 +42756,7 @@ declare function cost(maxUsd: number): Gradeable<CheckGrader>;
|
|
|
42717
42756
|
declare function judge(criteria: string, opts?: {
|
|
42718
42757
|
useExpected?: boolean;
|
|
42719
42758
|
model?: string;
|
|
42759
|
+
judgeFlowId?: string;
|
|
42720
42760
|
threshold?: number;
|
|
42721
42761
|
preset?: BuiltInGraderId;
|
|
42722
42762
|
}): Gradeable<AIGrader>;
|
|
@@ -42852,10 +42892,24 @@ interface GraderOutcome {
|
|
|
42852
42892
|
passed: boolean;
|
|
42853
42893
|
/** The grader's severity (absent ⇒ gate). A soft miss only fails under `--strict`. */
|
|
42854
42894
|
severity?: GraderSeverity;
|
|
42855
|
-
/** 0..1 for scaled graders (AI graders normalize their 1-5 to 0..1). */
|
|
42895
|
+
/** 0..1 for scaled graders (AI graders normalize their 1-5 to 0..1). Absent for `insufficient_evidence`. */
|
|
42856
42896
|
score?: number;
|
|
42857
|
-
/** AI-grader verdict, or a check's human-readable reason. */
|
|
42897
|
+
/** AI-grader reasoning (critique-before-verdict), or a check's human-readable reason. */
|
|
42858
42898
|
reasoning?: string;
|
|
42899
|
+
/**
|
|
42900
|
+
* AI graders only: the trajectory judge's binary verdict.
|
|
42901
|
+
* `insufficient_evidence` means the judge declined to guess — it renders as
|
|
42902
|
+
* a warning and never fails the case.
|
|
42903
|
+
*/
|
|
42904
|
+
verdict?: 'pass' | 'fail' | 'insufficient_evidence';
|
|
42905
|
+
/**
|
|
42906
|
+
* AI graders only: transcript entries the verdict rests on — indices into
|
|
42907
|
+
* the run's trace steps (`message`) or tool calls (`tool_call`).
|
|
42908
|
+
*/
|
|
42909
|
+
evidence?: Array<{
|
|
42910
|
+
kind: 'message' | 'tool_call';
|
|
42911
|
+
index: number;
|
|
42912
|
+
}>;
|
|
42859
42913
|
}
|
|
42860
42914
|
/** One case's run result: pass/fail plus each grader's outcome. */
|
|
42861
42915
|
interface RunEvalCaseResult {
|
package/dist/index.d.ts
CHANGED
|
@@ -18404,6 +18404,8 @@ interface paths {
|
|
|
18404
18404
|
content: {
|
|
18405
18405
|
"application/json": {
|
|
18406
18406
|
data: {
|
|
18407
|
+
/** @description True when historical (R2 SQL) logs were unavailable and only recent hot-tier entries are included. Absent on healthy responses. */
|
|
18408
|
+
degraded?: boolean;
|
|
18407
18409
|
entries: {
|
|
18408
18410
|
[key: string]: unknown;
|
|
18409
18411
|
}[];
|
|
@@ -18582,6 +18584,8 @@ interface paths {
|
|
|
18582
18584
|
byType: {
|
|
18583
18585
|
[key: string]: number;
|
|
18584
18586
|
};
|
|
18587
|
+
/** @description True when historical (R2 SQL) counts were unavailable and stats cover only the recent hot-tier window. Absent on healthy responses. */
|
|
18588
|
+
degraded?: boolean;
|
|
18585
18589
|
histogram: {
|
|
18586
18590
|
bucket: string;
|
|
18587
18591
|
count: number;
|
|
@@ -38717,6 +38721,12 @@ interface components {
|
|
|
38717
38721
|
caseId: string | null;
|
|
38718
38722
|
name: string;
|
|
38719
38723
|
outcomes: {
|
|
38724
|
+
/** @description AI graders only: transcript entries the verdict rests on — indices into the run's trace steps (message) or tool calls (tool_call). */
|
|
38725
|
+
evidence?: {
|
|
38726
|
+
index: number;
|
|
38727
|
+
/** @enum {string} */
|
|
38728
|
+
kind: "message" | "tool_call";
|
|
38729
|
+
}[];
|
|
38720
38730
|
graderIndex: number;
|
|
38721
38731
|
kind: string;
|
|
38722
38732
|
passed: boolean;
|
|
@@ -38727,6 +38737,11 @@ interface components {
|
|
|
38727
38737
|
* @enum {string}
|
|
38728
38738
|
*/
|
|
38729
38739
|
severity?: "gate" | "soft";
|
|
38740
|
+
/**
|
|
38741
|
+
* @description AI graders only: the judge's binary verdict. insufficient_evidence means the judge declined to guess; it renders as a warning and never fails the case.
|
|
38742
|
+
* @enum {string}
|
|
38743
|
+
*/
|
|
38744
|
+
verdict?: "pass" | "fail" | "insufficient_evidence";
|
|
38730
38745
|
}[];
|
|
38731
38746
|
/** @description Truncated snapshot of the output that was graded (2000 chars max). */
|
|
38732
38747
|
outputExcerpt: string;
|
|
@@ -39836,6 +39851,12 @@ interface components {
|
|
|
39836
39851
|
errored: boolean;
|
|
39837
39852
|
name: string;
|
|
39838
39853
|
outcomes: {
|
|
39854
|
+
/** @description AI graders only: transcript entries the verdict rests on — indices into the run's trace steps (message) or tool calls (tool_call). */
|
|
39855
|
+
evidence?: {
|
|
39856
|
+
index: number;
|
|
39857
|
+
/** @enum {string} */
|
|
39858
|
+
kind: "message" | "tool_call";
|
|
39859
|
+
}[];
|
|
39839
39860
|
graderIndex: number;
|
|
39840
39861
|
kind: string;
|
|
39841
39862
|
passed: boolean;
|
|
@@ -39846,6 +39867,11 @@ interface components {
|
|
|
39846
39867
|
* @enum {string}
|
|
39847
39868
|
*/
|
|
39848
39869
|
severity?: "gate" | "soft";
|
|
39870
|
+
/**
|
|
39871
|
+
* @description AI graders only: the judge's binary verdict. insufficient_evidence means the judge declined to guess; it renders as a warning and never fails the case.
|
|
39872
|
+
* @enum {string}
|
|
39873
|
+
*/
|
|
39874
|
+
verdict?: "pass" | "fail" | "insufficient_evidence";
|
|
39849
39875
|
}[];
|
|
39850
39876
|
outputExcerpt: string;
|
|
39851
39877
|
passed: boolean;
|
|
@@ -42396,6 +42422,8 @@ interface LogQueryResult {
|
|
|
42396
42422
|
cursor: string | null;
|
|
42397
42423
|
hasMore: boolean;
|
|
42398
42424
|
};
|
|
42425
|
+
/** True when historical (R2 SQL) logs were unavailable and only recent hot-tier entries are included. */
|
|
42426
|
+
degraded?: boolean;
|
|
42399
42427
|
}
|
|
42400
42428
|
/** Logs are wrapped in a `{ success, data }` envelope by the API. */
|
|
42401
42429
|
interface LogQueryResponse {
|
|
@@ -42414,6 +42442,8 @@ interface LogStatsResult {
|
|
|
42414
42442
|
count: number;
|
|
42415
42443
|
errors: number;
|
|
42416
42444
|
}>;
|
|
42445
|
+
/** True when historical (R2 SQL) counts were unavailable and stats cover only the recent hot-tier window. */
|
|
42446
|
+
degraded?: boolean;
|
|
42417
42447
|
}
|
|
42418
42448
|
interface LogStatsResponse {
|
|
42419
42449
|
success: boolean;
|
|
@@ -42621,8 +42651,17 @@ interface AIGrader {
|
|
|
42621
42651
|
criteria: string;
|
|
42622
42652
|
/** Reference-guided when the case has `expected`. */
|
|
42623
42653
|
useExpected?: boolean;
|
|
42624
|
-
/** Defaults to a cheap routed model at execution time. */
|
|
42654
|
+
/** Defaults to a cheap routed model at execution time. Ignored when `judgeFlowId` is set. */
|
|
42625
42655
|
model?: string;
|
|
42656
|
+
/**
|
|
42657
|
+
* Custom judge flow: your flow (by id) runs as the judge instead of the
|
|
42658
|
+
* platform judge prompt. It receives `criteria`, `caseName`, `expected`, and
|
|
42659
|
+
* `transcript` as inputs and must output the platform verdict JSON
|
|
42660
|
+
* (`{"reasoning", "verdict": "pass"|"fail"|"insufficient_evidence", "evidence"}`).
|
|
42661
|
+
* A miswired flow (missing, failing, or returning malformed output) resolves
|
|
42662
|
+
* to an insufficient-evidence warning with the error, never a verdict.
|
|
42663
|
+
*/
|
|
42664
|
+
judgeFlowId?: string;
|
|
42626
42665
|
/** Pass cutoff on the 1-5 judge scale (default 4 server-side). Set via `.atLeast(n)`. */
|
|
42627
42666
|
threshold?: number;
|
|
42628
42667
|
/** Hard gate (default) vs soft. Set via `.gate()` / `.soft()`. */
|
|
@@ -42717,6 +42756,7 @@ declare function cost(maxUsd: number): Gradeable<CheckGrader>;
|
|
|
42717
42756
|
declare function judge(criteria: string, opts?: {
|
|
42718
42757
|
useExpected?: boolean;
|
|
42719
42758
|
model?: string;
|
|
42759
|
+
judgeFlowId?: string;
|
|
42720
42760
|
threshold?: number;
|
|
42721
42761
|
preset?: BuiltInGraderId;
|
|
42722
42762
|
}): Gradeable<AIGrader>;
|
|
@@ -42852,10 +42892,24 @@ interface GraderOutcome {
|
|
|
42852
42892
|
passed: boolean;
|
|
42853
42893
|
/** The grader's severity (absent ⇒ gate). A soft miss only fails under `--strict`. */
|
|
42854
42894
|
severity?: GraderSeverity;
|
|
42855
|
-
/** 0..1 for scaled graders (AI graders normalize their 1-5 to 0..1). */
|
|
42895
|
+
/** 0..1 for scaled graders (AI graders normalize their 1-5 to 0..1). Absent for `insufficient_evidence`. */
|
|
42856
42896
|
score?: number;
|
|
42857
|
-
/** AI-grader verdict, or a check's human-readable reason. */
|
|
42897
|
+
/** AI-grader reasoning (critique-before-verdict), or a check's human-readable reason. */
|
|
42858
42898
|
reasoning?: string;
|
|
42899
|
+
/**
|
|
42900
|
+
* AI graders only: the trajectory judge's binary verdict.
|
|
42901
|
+
* `insufficient_evidence` means the judge declined to guess — it renders as
|
|
42902
|
+
* a warning and never fails the case.
|
|
42903
|
+
*/
|
|
42904
|
+
verdict?: 'pass' | 'fail' | 'insufficient_evidence';
|
|
42905
|
+
/**
|
|
42906
|
+
* AI graders only: transcript entries the verdict rests on — indices into
|
|
42907
|
+
* the run's trace steps (`message`) or tool calls (`tool_call`).
|
|
42908
|
+
*/
|
|
42909
|
+
evidence?: Array<{
|
|
42910
|
+
kind: 'message' | 'tool_call';
|
|
42911
|
+
index: number;
|
|
42912
|
+
}>;
|
|
42859
42913
|
}
|
|
42860
42914
|
/** One case's run result: pass/fail plus each grader's outcome. */
|
|
42861
42915
|
interface RunEvalCaseResult {
|
package/dist/index.mjs
CHANGED
|
@@ -2096,12 +2096,16 @@ function judge(criteria, opts) {
|
|
|
2096
2096
|
if (typeof criteria !== "string" || criteria.trim().length === 0) {
|
|
2097
2097
|
throw new Error("judge() requires non-empty criteria");
|
|
2098
2098
|
}
|
|
2099
|
+
if (opts?.judgeFlowId !== void 0 && opts.judgeFlowId.trim().length === 0) {
|
|
2100
|
+
throw new Error("judge() requires a non-empty judgeFlowId when one is provided");
|
|
2101
|
+
}
|
|
2099
2102
|
return gradeable({
|
|
2100
2103
|
kind: "ai",
|
|
2101
2104
|
criteria,
|
|
2102
2105
|
...opts?.preset ? { preset: opts.preset } : {},
|
|
2103
2106
|
...opts?.useExpected ? { useExpected: true } : {},
|
|
2104
2107
|
...opts?.model ? { model: opts.model } : {},
|
|
2108
|
+
...opts?.judgeFlowId ? { judgeFlowId: opts.judgeFlowId } : {},
|
|
2105
2109
|
...opts?.threshold !== void 0 ? { threshold: opts.threshold } : {}
|
|
2106
2110
|
});
|
|
2107
2111
|
}
|
|
@@ -6208,7 +6212,7 @@ var Runtype = class {
|
|
|
6208
6212
|
|
|
6209
6213
|
// src/version.ts
|
|
6210
6214
|
var FALLBACK_VERSION = "0.0.0";
|
|
6211
|
-
var SDK_VERSION = "5.
|
|
6215
|
+
var SDK_VERSION = "5.9.0".length > 0 ? "5.9.0" : FALLBACK_VERSION;
|
|
6212
6216
|
var RUNTYPE_CLIENT_KIND = "sdk";
|
|
6213
6217
|
var SDK_USER_AGENT = `runtype-sdk/${SDK_VERSION} (typescript)`;
|
|
6214
6218
|
|
package/package.json
CHANGED