@constal/sdk 6.0.0 → 6.2.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/package.json +1 -1
- package/publish/api.json +13 -1
- package/publish/index.d.ts +168 -18
- package/publish/index.js +93 -20
package/package.json
CHANGED
package/publish/api.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@constal/sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"exports": [
|
|
5
5
|
"AGENT_UI_DEFAULTS",
|
|
6
6
|
"Action",
|
|
@@ -170,6 +170,11 @@
|
|
|
170
170
|
"EvalMode",
|
|
171
171
|
"EvalSubject",
|
|
172
172
|
"EvalSubjectSource",
|
|
173
|
+
"EvalSuiteCase",
|
|
174
|
+
"EvalSuiteCasePage",
|
|
175
|
+
"EvalSuiteCaseScore",
|
|
176
|
+
"EvalSuiteCaseState",
|
|
177
|
+
"EvalSuiteScoreState",
|
|
173
178
|
"EvaluationAnswer",
|
|
174
179
|
"EvaluationAnswerFor",
|
|
175
180
|
"EvaluationAnswers",
|
|
@@ -209,6 +214,7 @@
|
|
|
209
214
|
"Handle",
|
|
210
215
|
"HandleOutcome",
|
|
211
216
|
"Hash",
|
|
217
|
+
"HistoryPage",
|
|
212
218
|
"HistoryView",
|
|
213
219
|
"HmacVerification",
|
|
214
220
|
"IgnoredChannelEvent",
|
|
@@ -234,6 +240,7 @@
|
|
|
234
240
|
"JoinOutcome",
|
|
235
241
|
"JsonScalar",
|
|
236
242
|
"JsonValue",
|
|
243
|
+
"JudgeRubric",
|
|
237
244
|
"LabelRequest",
|
|
238
245
|
"LabelSelector",
|
|
239
246
|
"LabelSelectorOperator",
|
|
@@ -388,6 +395,7 @@
|
|
|
388
395
|
"ScorerApplies",
|
|
389
396
|
"ScorerCRN",
|
|
390
397
|
"ScorerDef",
|
|
398
|
+
"ScorerDraft",
|
|
391
399
|
"ScorerEvaluation",
|
|
392
400
|
"ScorerKind",
|
|
393
401
|
"ScorerRef",
|
|
@@ -421,6 +429,7 @@
|
|
|
421
429
|
"ShareEvaluationRequest",
|
|
422
430
|
"ShareEvaluationVerdict",
|
|
423
431
|
"ShareEvaluationView",
|
|
432
|
+
"ShareHistory",
|
|
424
433
|
"SharePrice",
|
|
425
434
|
"ShareRequest",
|
|
426
435
|
"ShareReviewDecision",
|
|
@@ -439,6 +448,7 @@
|
|
|
439
448
|
"StageOutputSpec",
|
|
440
449
|
"StartTrainingRequest",
|
|
441
450
|
"SteerEvent",
|
|
451
|
+
"StepJournal",
|
|
442
452
|
"SuiteFact",
|
|
443
453
|
"SwallowedYield",
|
|
444
454
|
"TRAINING_PROVIDER_CAPABILITY",
|
|
@@ -573,6 +583,7 @@
|
|
|
573
583
|
"immutableContainerImageReference",
|
|
574
584
|
"integrationEgressPolicy",
|
|
575
585
|
"invocationCredentialUses",
|
|
586
|
+
"judgeAgent",
|
|
576
587
|
"labelSelector",
|
|
577
588
|
"matchesAction",
|
|
578
589
|
"matchesLabelSelector",
|
|
@@ -627,6 +638,7 @@
|
|
|
627
638
|
"scopedCredentialRef",
|
|
628
639
|
"scopedResourceRef",
|
|
629
640
|
"scoreLevel",
|
|
641
|
+
"scorerDraftHash",
|
|
630
642
|
"scorerName",
|
|
631
643
|
"select",
|
|
632
644
|
"selectableResourceLabels",
|
package/publish/index.d.ts
CHANGED
|
@@ -405,7 +405,8 @@ declare function integrationEgressPolicy(value: unknown): IntegrationEgressPolic
|
|
|
405
405
|
|
|
406
406
|
type ScorerKind = "code" | "judge" | "human";
|
|
407
407
|
type ScorerApplies = "turn" | "reply" | "fact" | "trajectory" | "case";
|
|
408
|
-
|
|
408
|
+
/** `recorded` judges each case's captured Run as it ran, without running the Agent. */
|
|
409
|
+
type EvalMode = "fresh" | "replay" | "shadow" | "recorded";
|
|
409
410
|
type VerdictSamplingMode = "gate" | "sample" | "suite" | "label";
|
|
410
411
|
interface ScorerRef {
|
|
411
412
|
crn: ScorerCRN;
|
|
@@ -473,9 +474,10 @@ interface JudgeScorerDefinition {
|
|
|
473
474
|
}
|
|
474
475
|
interface HumanScorerDefinition {
|
|
475
476
|
kind: "human";
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
477
|
+
/** The Channel that also sends each labeling request; null for a Scorer labeled only in the Console Inbox. */
|
|
478
|
+
channel: CRN | null;
|
|
479
|
+
/** Immutable Channel Resource version used to route the labeling wait; null exactly when `channel` is. */
|
|
480
|
+
channelResourceHash: Hash | null;
|
|
479
481
|
schema: object;
|
|
480
482
|
instructionsRef: Ref;
|
|
481
483
|
}
|
|
@@ -488,6 +490,21 @@ interface ScorerDef {
|
|
|
488
490
|
judge?: Omit<JudgeScorerDefinition, "kind">;
|
|
489
491
|
human?: Omit<HumanScorerDefinition, "kind">;
|
|
490
492
|
}
|
|
493
|
+
/** An unsaved code or Judge Scorer: a Scorer definition without its id and version, tested by a recorded Suite. */
|
|
494
|
+
type ScorerDraft = {
|
|
495
|
+
kind: "code";
|
|
496
|
+
applies: ScorerApplies;
|
|
497
|
+
code: Omit<CodeScorerDefinition, "kind">;
|
|
498
|
+
} | {
|
|
499
|
+
kind: "judge";
|
|
500
|
+
applies: ScorerApplies;
|
|
501
|
+
judge: Omit<JudgeScorerDefinition, "kind">;
|
|
502
|
+
};
|
|
503
|
+
/**
|
|
504
|
+
* The hash of what a Scorer judges with: its definition without its id and version. A draft's hash equals the hash of the
|
|
505
|
+
* Scorer saved from it, so a saved Scorer can be shown to be the draft that was tested.
|
|
506
|
+
*/
|
|
507
|
+
declare function scorerDraftHash(definition: ScorerDraft | ScorerDef): Promise<Hash>;
|
|
491
508
|
interface CaseRow {
|
|
492
509
|
caseId: string;
|
|
493
510
|
input: unknown;
|
|
@@ -565,6 +582,8 @@ interface LabelRequest {
|
|
|
565
582
|
subject: EvalSubject;
|
|
566
583
|
scorer: ScorerRef;
|
|
567
584
|
value: unknown;
|
|
585
|
+
/** The answer the labeling form started from, recorded with the label: its evidence is then `{ answer, suggested }`. */
|
|
586
|
+
suggested?: unknown;
|
|
568
587
|
}
|
|
569
588
|
interface RequestLabelRequest {
|
|
570
589
|
/** Caller-stable identity used for the durable wait and idempotent verdict. */
|
|
@@ -572,6 +591,8 @@ interface RequestLabelRequest {
|
|
|
572
591
|
source: EvalSubjectSource;
|
|
573
592
|
subject: EvalSubject;
|
|
574
593
|
scorer: ScorerRef;
|
|
594
|
+
/** A schema-valid answer the labeling form starts from, for example a Judge's `{ score, pass }`. */
|
|
595
|
+
suggested?: unknown;
|
|
575
596
|
timeoutMs?: number;
|
|
576
597
|
}
|
|
577
598
|
interface SuiteFact {
|
|
@@ -649,6 +670,43 @@ interface RunSuiteRequest {
|
|
|
649
670
|
judge: ScorerRef;
|
|
650
671
|
tolerance: number;
|
|
651
672
|
};
|
|
673
|
+
/** Recorded-only: an unsaved Scorer judged with the Suite's Scorers and never recorded; not combined with `calibration`. */
|
|
674
|
+
draft?: ScorerDraft;
|
|
675
|
+
}
|
|
676
|
+
type EvalSuiteCaseState = "pending" | "running" | "scoring" | "completed" | "failed";
|
|
677
|
+
type EvalSuiteScoreState = "pending" | "running" | "completed" | "failed";
|
|
678
|
+
/** One Scorer's result on one judged subject of a Suite. */
|
|
679
|
+
interface EvalSuiteCaseScore {
|
|
680
|
+
/** The saved Scorer's CRN, or `draft:<scorerDraftHash>` for the Suite's draft. */
|
|
681
|
+
scorer: ScorerCRN | `draft:${Hash}`;
|
|
682
|
+
status: EvalSuiteScoreState;
|
|
683
|
+
evaluation: ScorerEvaluation | null;
|
|
684
|
+
error: {
|
|
685
|
+
code: string;
|
|
686
|
+
message: string;
|
|
687
|
+
} | null;
|
|
688
|
+
}
|
|
689
|
+
/** One judged subject of a Suite: a case, or one turn of a recorded Suite's case, and each Scorer's result on it. */
|
|
690
|
+
interface EvalSuiteCase {
|
|
691
|
+
/** The case id, or `<caseId>/<turnPos>` for one turn of a recorded case. */
|
|
692
|
+
case: string;
|
|
693
|
+
/** The Run judged: the Suite's own Run of the case, or the captured Run of a recorded case; null before one exists. */
|
|
694
|
+
source: {
|
|
695
|
+
session: string;
|
|
696
|
+
run: string;
|
|
697
|
+
turn: Hash | null;
|
|
698
|
+
} | null;
|
|
699
|
+
status: EvalSuiteCaseState;
|
|
700
|
+
error: {
|
|
701
|
+
code: string;
|
|
702
|
+
message: string;
|
|
703
|
+
} | null;
|
|
704
|
+
scores: EvalSuiteCaseScore[];
|
|
705
|
+
}
|
|
706
|
+
/** A page of a Suite's judged subjects in case order; `next` continues it. */
|
|
707
|
+
interface EvalSuiteCasePage {
|
|
708
|
+
data: EvalSuiteCase[];
|
|
709
|
+
next: string | null;
|
|
652
710
|
}
|
|
653
711
|
interface JudgeCalibration {
|
|
654
712
|
judge: ScorerRef;
|
|
@@ -2624,8 +2682,23 @@ interface HistoryView {
|
|
|
2624
2682
|
message: unknown;
|
|
2625
2683
|
checkpoint: Fact | null;
|
|
2626
2684
|
facts: Fact[];
|
|
2685
|
+
/** The steers this page holds, oldest first: on the Run's own ledger, those after its checkpoint up to the event head
|
|
2686
|
+
* the view is pinned at. */
|
|
2627
2687
|
steers: SteerEvent[];
|
|
2688
|
+
/** The cursor to the Facts before `facts`, which `page()` reads; null when there are none. */
|
|
2689
|
+
more: string | null;
|
|
2690
|
+
/** The cursor to the steers after `steers`, which `page()` reads; null when there are none. Absent from platforms before
|
|
2691
|
+
* SDK 6.1.0, whose page held at most its oldest 200 steers. */
|
|
2692
|
+
steersMore?: string | null;
|
|
2693
|
+
}
|
|
2694
|
+
/** A page `ctx.ledger.page()` reads: from a `more` cursor the Facts before the last ones read, newest last; from a `steersMore`
|
|
2695
|
+
* cursor the steers after the last ones read, oldest first, with no Facts. */
|
|
2696
|
+
interface HistoryPage {
|
|
2697
|
+
facts: Fact[];
|
|
2628
2698
|
more: string | null;
|
|
2699
|
+
/** Present on a steer page. */
|
|
2700
|
+
steers?: SteerEvent[];
|
|
2701
|
+
steersMore?: string | null;
|
|
2629
2702
|
}
|
|
2630
2703
|
interface RollbackReport {
|
|
2631
2704
|
rollbackId: string;
|
|
@@ -3077,7 +3150,8 @@ interface ReduceFact {
|
|
|
3077
3150
|
stage: StageInfo;
|
|
3078
3151
|
}
|
|
3079
3152
|
type ScopeJournalKind = "turn" | "tool" | "step";
|
|
3080
|
-
|
|
3153
|
+
/** `journal`: what the Agent read of `ctx.journal.paged` at that point, recorded as its `value` so a replay reads the same. */
|
|
3154
|
+
type LocalJournalKind = "clock" | "random" | "score" | "commit" | "await" | "spawn" | "map" | "reduce" | "view" | "page" | "truncate" | "cancel" | "capability" | "schedule" | "journal";
|
|
3081
3155
|
type JournalKind = ScopeJournalKind | LocalJournalKind | "invoke" | "send";
|
|
3082
3156
|
/** Stable identity available to Agent code. Platform execution and deployment
|
|
3083
3157
|
* metadata intentionally remain outside the public Agent context. */
|
|
@@ -3169,6 +3243,22 @@ interface EvaluationRecord<Q extends EvaluationQuestions = EvaluationQuestions>
|
|
|
3169
3243
|
provider: string;
|
|
3170
3244
|
model: string;
|
|
3171
3245
|
}
|
|
3246
|
+
/**
|
|
3247
|
+
* This step's journal at the Agent's current position. Every dispatch of a step carries its journal, and the step replays
|
|
3248
|
+
* it: a durable Agent's journal starts afresh each time `step()` returns, a script Agent's lasts the Run. Once a dispatch
|
|
3249
|
+
* no longer fits one message the rest is stored and read back at every dispatch, so a durable Agent that loops within one
|
|
3250
|
+
* `step()` can return from it once `paged` is true.
|
|
3251
|
+
*
|
|
3252
|
+
* `entries` follows from the Agent's position and reading it records nothing. Reading `paged` journals what it read, so a
|
|
3253
|
+
* replay reads at each point what the live step read there. Read them where everything the step started has been awaited.
|
|
3254
|
+
*/
|
|
3255
|
+
interface StepJournal {
|
|
3256
|
+
/** The entries the step's journal holds at this point. */
|
|
3257
|
+
readonly entries: number;
|
|
3258
|
+
/** True once the step's next dispatch, with its journal and the values its replay reads, would no longer fit one message:
|
|
3259
|
+
* end the step now. */
|
|
3260
|
+
readonly paged: boolean;
|
|
3261
|
+
}
|
|
3172
3262
|
interface Ctx {
|
|
3173
3263
|
turn(spec: TurnSpec): Promise<TurnRecord>;
|
|
3174
3264
|
/** Judge one state with constrained, probabilistic answers instead of a generated turn. Journaled and priced like a model call. */
|
|
@@ -3176,14 +3266,13 @@ interface Ctx {
|
|
|
3176
3266
|
ledger: {
|
|
3177
3267
|
/** `of` names another ledger: `agent:<agent>/session:<session>` (that Session's main ledger, read at its head),
|
|
3178
3268
|
* `agent:<agent>/session:<session>/spawn:<handle>` (a spawned loop's), `memory` or `table:<table>@<branch>`.
|
|
3179
|
-
* Omit it for this Run's own ledger, pinned at dispatch; `session:<id>` is refused.
|
|
3269
|
+
* Omit it for this Run's own ledger, pinned at dispatch; `session:<id>` is refused. Every `history` view is read from
|
|
3270
|
+
* its Session, so it can fail as other ctx requests do. */
|
|
3180
3271
|
view<S = HistoryView>(name?: string, opts?: {
|
|
3181
3272
|
of?: LedgerAddress;
|
|
3182
3273
|
}): Promise<S>;
|
|
3183
|
-
page
|
|
3184
|
-
|
|
3185
|
-
more: string | null;
|
|
3186
|
-
}>;
|
|
3274
|
+
/** The page a view's or page's `more` or `steersMore` cursor names. */
|
|
3275
|
+
page(cursor: string): Promise<HistoryPage>;
|
|
3187
3276
|
branch(at: FactRef): BranchRef;
|
|
3188
3277
|
truncate(to: FactRef): Handle<RollbackReport>;
|
|
3189
3278
|
};
|
|
@@ -3208,6 +3297,8 @@ interface Ctx {
|
|
|
3208
3297
|
invokeAsync<T>(resource: CRN, op: string, args: unknown, opts?: InvokeOpts): InvocationHandle<T>;
|
|
3209
3298
|
request(policy: PolicyCRN, grant: CapabilityGrant): Handle<CapabilityRef>;
|
|
3210
3299
|
analytics: AnalyticsClient;
|
|
3300
|
+
/** This step's journal at the Agent's current position. Undefined where the platform's runtime predates it. */
|
|
3301
|
+
readonly journal?: StepJournal;
|
|
3211
3302
|
run: RunInfo;
|
|
3212
3303
|
}
|
|
3213
3304
|
interface AgentDef<S = unknown> {
|
|
@@ -3902,8 +3993,8 @@ interface ConstalApiError {
|
|
|
3902
3993
|
* management Resource. Keep authorization-only CRN families such as ledger,
|
|
3903
3994
|
* table, and artifact out of this model-facing inventory contract.
|
|
3904
3995
|
*/
|
|
3905
|
-
declare const CONSTAL_API_QUERY_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
3906
|
-
declare const CONSTAL_API_GET_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
3996
|
+
declare const CONSTAL_API_QUERY_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "failure-group", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
3997
|
+
declare const CONSTAL_API_GET_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "failure-group", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
3907
3998
|
declare const CONSTAL_API_MODEL_TOOL_DESCRIPTIONS: {
|
|
3908
3999
|
readonly query: "Query authorized Constal objects with bounded pagination and evidence. Select the exact lower-case singular kind from the schema enum; never pluralize, recase, or substitute an abstract kind. If context supplies platformToolContract.queryScope, copy it unchanged. Otherwise use only an exact namespace allowed by the delegated Run authority, and tenant scope only for an explicitly tenant-wide request. Use catalog-advertised fields and filters; constrained kinds require their advertised filter. Preserve next and evidence completeness.";
|
|
3909
4000
|
readonly get: "Retrieve one exact authorized Constal object or immutable revision. Pass a complete ref unchanged from query, relations, runtime inspection, or a governed receipt; never construct a kind, id, namespace, CRN, hash, or cursor from display text. The schema enum contains every supported addressable kind. For a Run, omit fields for complete diagnosis or request only documented top-level fields, and follow only the returned page cursor.";
|
|
@@ -3959,7 +4050,7 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
|
|
|
3959
4050
|
readonly description: "Query one exact catalog kind. Kind ids are lower-case, singular, and must be selected from the enum; abstract names and pluralizations are invalid.";
|
|
3960
4051
|
readonly properties: {
|
|
3961
4052
|
readonly kind: {
|
|
3962
|
-
readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
4053
|
+
readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "failure-group", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
3963
4054
|
readonly description: "Exact queryable kind. Never guess a kind or change its casing.";
|
|
3964
4055
|
};
|
|
3965
4056
|
readonly scope: {
|
|
@@ -4064,7 +4155,7 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
|
|
|
4064
4155
|
readonly additionalProperties: false;
|
|
4065
4156
|
readonly properties: {
|
|
4066
4157
|
readonly kind: {
|
|
4067
|
-
readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
4158
|
+
readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "failure-group", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
4068
4159
|
readonly description: "Exact lower-case object kind returned by a governed platform result.";
|
|
4069
4160
|
};
|
|
4070
4161
|
readonly id: {
|
|
@@ -4148,7 +4239,7 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
|
|
|
4148
4239
|
readonly additionalProperties: false;
|
|
4149
4240
|
readonly properties: {
|
|
4150
4241
|
readonly kind: {
|
|
4151
|
-
readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
4242
|
+
readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "failure-group", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
|
|
4152
4243
|
readonly description: "Exact lower-case object kind returned by a governed platform result.";
|
|
4153
4244
|
};
|
|
4154
4245
|
readonly id: {
|
|
@@ -4517,6 +4608,13 @@ interface Share {
|
|
|
4517
4608
|
prices: SharePrice[];
|
|
4518
4609
|
/** Required when actions include evaluate; null otherwise. */
|
|
4519
4610
|
evaluation: ShareEvaluation | null;
|
|
4611
|
+
/**
|
|
4612
|
+
* The past Runs the Share also delivers, which the grantor sets: those that ended from `since` until the Share was accepted.
|
|
4613
|
+
* Needs read; null delivers none, and a Share Constal grants has none.
|
|
4614
|
+
*/
|
|
4615
|
+
history: {
|
|
4616
|
+
since: number;
|
|
4617
|
+
} | null;
|
|
4520
4618
|
expiresAt: number | null;
|
|
4521
4619
|
status: "invited" | "active" | "revoked" | "expired";
|
|
4522
4620
|
authorizationSeq: number;
|
|
@@ -4527,7 +4625,35 @@ interface Share {
|
|
|
4527
4625
|
revokedAt: number | null;
|
|
4528
4626
|
}
|
|
4529
4627
|
/** The terms a grantor sets: all it chooses when creating a Share, those that change when updating one. */
|
|
4530
|
-
type ShareRequest = Partial<Pick<Share, "displayName" | "selector" | "actions" | "prices" | "evaluation" | "expiresAt">>;
|
|
4628
|
+
type ShareRequest = Partial<Pick<Share, "displayName" | "selector" | "actions" | "prices" | "evaluation" | "history" | "expiresAt">>;
|
|
4629
|
+
/**
|
|
4630
|
+
* The delivery of a Share's past Runs under one authorizationSeq, which starts once the Share is accepted, or saved, with
|
|
4631
|
+
* `history` set, charged at the Share's prices as live traces are: the Runs it checked, the traces it delivered, and what they
|
|
4632
|
+
* were charged. A change to the Share's terms cancels it (`error.code` `ShareChanged`) and starts one under the new terms; so
|
|
4633
|
+
* do revoking or expiring the Share or removing read (`ShareRevoked`), and turning the grantor's sharing off (`SharingOff`).
|
|
4634
|
+
* The recipient cancelling it leaves `error` null; a running delivery that billing holds back carries `AccountBalanceExceeded`.
|
|
4635
|
+
* Warnings name traces by their pseudonyms.
|
|
4636
|
+
*/
|
|
4637
|
+
interface ShareHistory {
|
|
4638
|
+
id: string;
|
|
4639
|
+
share: string;
|
|
4640
|
+
authorizationSeq: number;
|
|
4641
|
+
state: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
4642
|
+
window: {
|
|
4643
|
+
start: number;
|
|
4644
|
+
end: number;
|
|
4645
|
+
};
|
|
4646
|
+
runs: number;
|
|
4647
|
+
delivered: number;
|
|
4648
|
+
chargeMicroUsd: number;
|
|
4649
|
+
warnings: string[];
|
|
4650
|
+
error: {
|
|
4651
|
+
code: string;
|
|
4652
|
+
message: string;
|
|
4653
|
+
} | null;
|
|
4654
|
+
createdAt: number;
|
|
4655
|
+
updatedAt: number;
|
|
4656
|
+
}
|
|
4531
4657
|
/** A Share's evaluation spec, checked: Resources named in its namespace, at most 32 Scorers, concurrency 1 to 32, a budget. */
|
|
4532
4658
|
declare function shareEvaluation(value: unknown): ShareEvaluation;
|
|
4533
4659
|
/** A Share's ordered price rules, at most 32, each a selector (null matches every trace) and a whole microUsd price. */
|
|
@@ -5143,6 +5269,30 @@ interface CodeScoreResult {
|
|
|
5143
5269
|
declare function codeScorerIR(value: unknown): CodeScorerIR;
|
|
5144
5270
|
declare function evaluateCodeScorer(raw: CodeScorerIR | unknown, subject: unknown): CodeScoreResult;
|
|
5145
5271
|
|
|
5272
|
+
/**
|
|
5273
|
+
* How a Judge judges a value. `instructions` says what a good value is. With `levels`, at least two and ordered from worst to
|
|
5274
|
+
* best, the Judge places the value on them; without levels it answers how likely the value meets the instructions. Each
|
|
5275
|
+
* dimension is judged the same way, on its own.
|
|
5276
|
+
*/
|
|
5277
|
+
interface JudgeRubric {
|
|
5278
|
+
instructions: EvaluationEntry;
|
|
5279
|
+
levels?: EvaluationEntry[];
|
|
5280
|
+
dimensions?: Record<string, {
|
|
5281
|
+
instructions: EvaluationEntry;
|
|
5282
|
+
levels?: EvaluationEntry[];
|
|
5283
|
+
}>;
|
|
5284
|
+
}
|
|
5285
|
+
/**
|
|
5286
|
+
* An Agent that judges with an evaluation Model, for a Judge Scorer whose rubric is a JudgeRubric. Bind its `model` to an
|
|
5287
|
+
* evaluation Model, such as `crn:constal:production:platform:default:model/jev`. Each Run evaluates the judged value against
|
|
5288
|
+
* the rubric and returns `{ score, dimensions, evidence }`: the score and each dimension on the Scorer's scale, and the
|
|
5289
|
+
* evaluation's answers as evidence. The Scorer's threshold decides its pass.
|
|
5290
|
+
*/
|
|
5291
|
+
declare function judgeAgent(input: {
|
|
5292
|
+
id: string;
|
|
5293
|
+
version: string;
|
|
5294
|
+
}): AgentDef;
|
|
5295
|
+
|
|
5146
5296
|
declare function validateJsonSchemaDefinition(schema: unknown, path?: string, depth?: number): string | null;
|
|
5147
5297
|
declare function validateJsonSchema(value: unknown, schema: unknown, path?: string): string | null;
|
|
5148
5298
|
|
|
@@ -5279,5 +5429,5 @@ declare function parseLedgerAddress(value: unknown): LedgerAddressParts | null;
|
|
|
5279
5429
|
/** Formats ledger address parts; throws when a part breaks its id rule. */
|
|
5280
5430
|
declare function formatLedgerAddress(parts: LedgerAddressParts): LedgerAddress;
|
|
5281
5431
|
|
|
5282
|
-
export { AGENT_UI_DEFAULTS, AfterYield, ApiError, CHAT_FORMAT_CAPABILITY, CONSTAL_API_CAPABILITY, CONSTAL_API_GET_KINDS, CONSTAL_API_MODEL_TOOL_DESCRIPTIONS, CONSTAL_API_OPERATIONS, CONSTAL_API_OPERATION_SCHEMAS, CONSTAL_API_QUERY_KINDS, CONSTAL_API_VERSION, CommitConflict, CommitGateRejected, CredentialRevoked, CredentialUnavailable, DATA_SHARE_FEE_BPS, DirectNetworkDenied, EVALUATION_LIMITS, EffectCeilingExceeded, EmptyJoin, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MCP_PROTOCOL_VERSION, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, MODEL_EVALUATION_CAPABILITY, McpClient, NondeterministicReplay, NotAppendOnly, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_CREDENTIAL_BINDING_SCHEMA, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SANDBOX_EGRESS_LIMITS, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TRAINING_RECIPE_DEFAULTS, TerminalIntegrationFailure, ToolUnavailable, UI_ASSET_CONTENT_TYPES, UI_BUNDLE_BOUNDS, UnknownTool, WEB_FETCH_ARGUMENT_SCHEMA, WEB_SEARCH_ARGUMENT_SCHEMA, action, actionPattern, agent, agentLimit, agentResourceBinding, agentSetupMetadata, agentSetupRequirements, agentUiBundleManifest, agentUiDeclaration, all, analyticsEvent, approximateTokens, authProvider, authProviderName, bindingName, bucketFor, canonicalJson, capabilityContractRef, casTool, channel, channelIngressRequest, channelIngressSource, channelSourceEvidence, channelSubscriptionRequest, channelTarget, chatFormat, chatFormatMetadata, chatFormatPin, chatParseInput, chatParsed, chatRenderInput, chatRenderRequest, chatRendering, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, containerImageReference, containerImageSelection, containerImageSource, credentialEvidence, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, credentialSetupState, customerTenantName, cutBatches, cutPartitions, dataShareEarningMicroUsd, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, evaluationArguments, evaluationProtocolRequest, evaluationProtocolResult, formatLedgerAddress, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, immutableContainerImageReference, integrationEgressPolicy, invocationCredentialUses, labelSelector, matchesAction, matchesLabelSelector, matchesResource, mcpToolDescription, mcpToolResult, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelGenerationOptions, modelLimit, modelMessages, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxEgressCredentialRules, normalizeSandboxEgressPolicy, normalizeSandboxLabels, normalizeSandboxNetworkPolicy, normalizeSandboxWorkspacePath, noulDecision, opTool, opTools, parseLedgerAddress, parseResourceName, policy, policyName, race, resolveBindingOwner, resolveContainerImageSource, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, resourceTools, runLabels, sandboxControls, sandboxEgressDecision, sandboxEgressHostMatches, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scoreLevel, scorerName, select, selectableResourceLabels, setupAwait, setupCredentialReceipt, setupPanelProviderIsCrn, setupScreen, setupScreenView, setupSubmission, sha256Hex, shareContributionRequest, shareContributionReview, shareEvaluation, sharePrices, shareRequest, skills, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingCorrection, trainingProvider, trainingProviderMetadata, trainingRecipe, uiAssetContentType, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
|
|
5283
|
-
export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeployPolicy, AgentGovernanceMeter, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelContext, ChannelDeliveryError, ChannelDeliveryEvent, ChannelDeliveryOutcome, ChannelDeliveryReport, ChannelFailure, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, ChatFormatDefinition, ChatFormatMetadata, ChatFormatPin, ChatMessage, ChatParseRequest, ChatParsed, ChatRenderRequest, ChatRendering, ChatSpan, ChatTool, CheckpointDeploymentRequest, CheckpointImportMetadata, CheckpointImportRequest, ChoiceAnswer, ChoiceQuestion, CodeScoreResult, CodeScorerIR, CodeScorerRule, CommitOpts, CompareSuitesRequest, Compensation, ConnectionCancelRequest, ConnectionIdentity, ConnectionOperation, ConnectionRecoveryRequest, ConnectionRecoveryResult, ConnectionRequest, ConnectionUsageReport, ConstalApiApplyRequest, ConstalApiChangePlan, ConstalApiChangePlanRef, ConstalApiChangePlanRequest, ConstalApiChangeReceipt, ConstalApiOperationReceipt, ContainerImageReference, ContainerImageSelection, ContainerImageSource, ContainerRegistryRequest, ContainerRegistryResponse, ControlEvent, Cost, CreateSandboxImageOptions, CreateSandboxOptions, CredentialCRN, CredentialDestroyResult, CredentialEvidence, CredentialInteractionAction, CredentialInteractionAdvanceRequest, CredentialInteractionEvent, CredentialInteractionPrimaryAction, CredentialInteractionProof, CredentialInteractionResult, CredentialInteractionStartRequest, CredentialMaterialRequest, CredentialMintRequest, CredentialMintResult, CredentialProviderCRN, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialSetupState, CredentialUninstallRequest, CredentialUninstallResult, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DataSharingScope, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, EvaluationAnswer, EvaluationAnswerFor, EvaluationAnswers, EvaluationEntry, EvaluationInvocationArgs, EvaluationInvocationResult, EvaluationProtocol, EvaluationQuestion, EvaluationQuestions, EvaluationRecord, EvaluationSpec, EventBase, Fact, FactRef, FileEntry, FixedMemoryStoreRef, FixedModelGatewayRef, FoldFn, GateEvidence, GateResult, GateVerdict, GatewayCancelRequest, GatewayConfigEgressBinding, GatewayContext, GatewayCredentialSlotSetup, GatewayDefinition, GatewayDiscoverySetup, GatewayModelOffer, GatewayOperation, GatewayPackage, GatewayPackageMetadata, GatewayRecoveryRequest, GatewayRecoveryResult, GatewayRequest, GovernanceContractRef, Handle, HandleOutcome, Hash, HistoryView, HmacVerification, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationAttachment, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationLifecycle, IntegrationReleaseContext, IntegrationSecret, IntegrationState, InvocationCredentialUse, InvocationHandle, InvokableKind, InvokeOpts, JoinOutcome, JsonScalar, JsonValue, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerAddressParts, LedgerEvent, ListSchedulesOptions, LoadedSkill, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, McpClientOptions, McpClientState, McpMessageTransport, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCacheHint, ModelCompletion, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGenerationOptions, ModelGovernanceControls, ModelGovernanceMeter, ModelHistoryMessage, ModelHistoryToolCall, ModelInvocationArgs, ModelInvocationResult, ModelProtocolRequestOptions, ModelTechnicalCapabilities, ModelTool, NormalizedModelGatewayConfig, NoulAnswer, NoulQuestion, Out, Over, PartitionFn, PartitionSpec, Partitioning, PolicyCRN, PolicyConstraint, PolicyContextValue, PolicyDefinition, PolicyInput, PolicyInvocationOrigin, PolicyOutcome, Principal, PrincipalKind, Provenance, RawModelProtocol, Recovery, ReduceFact, ReduceOpts, Ref, RequestLabelRequest, ResourceContractRef, ResourceControlsConstraint, ResourceCredentialBinding, ResourceDependencyRef, ResourceKind, ResourceName, ResourceNameParts, ResourceNeed, ResourcePattern, ResourceSelector, RollbackReport, RunIdentityView, RunInfo, RunReport, RunStatusDetail, RunSuiteRequest, Sandbox, SandboxCommandCollectionError, SandboxCommandExecution, SandboxCommandResult, SandboxEgressCredentialRule, SandboxEgressPolicy, SandboxEgressRule, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxLabels, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, SandboxProcess, SandboxProcessCredentials, SandboxProcessIoOperation, SandboxProcessOperation, SandboxProcessReadInput, SandboxProcessReadResult, SandboxProcessStatus, SandboxProcessWriteResult, SandboxReadFileOptions, SandboxReadFileResult, SandboxWorkspace, SandboxWriteFileResult, Schedule, ScheduleCancellation, ScheduleDuration, ScheduleMissed, ScheduleOccurrence, ScheduleOccurrencePage, ScheduleOptions, SchedulePage, ScheduleState, ScheduleTarget, ScheduleTiming, ScheduleTrigger, ScheduleWhen, ScopedBindingKey, ScopedCredentialRef, ScopedMemoryStoreRef, ScopedModelGatewayRef, ScopedResourceRef, ScoreAnswer, ScoreQuestion, ScoreRequest, ScorerApplies, ScorerCRN, ScorerDef, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupCredentialReceipt, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, Share, ShareAction, ShareContribution, ShareContributionImport, ShareContributionRequest, ShareContributionReview, ShareContributionReviewRequest, ShareContributionStatus, ShareEvaluation, ShareEvaluationPin, ShareEvaluationRequest, ShareEvaluationVerdict, ShareEvaluationView, SharePrice, ShareRequest, ShareReviewDecision, Skill, SkillDescription, SkillLibrary, SkillSource, SortField, SpawnAttenuation, SpawnBudget, SpawnHandle, SpawnOpts, SqlFold, StageInfo, StageOutputSpec, StartTrainingRequest, SteerEvent, SuiteFact, TableAggregate, TableDescribeArgs, TableFilter, TableFilterOperation, TableOrder, TableQueryArgs, TableQueryPlan, TableQueryResult, TableScalar, TableSnapshotDescription, Task, Tier, Tool, ToolCallRecord, TrainingCorrection, TrainingJobFact, TrainingJobReference, TrainingJobState, TrainingJobStatus, TrainingMethod, TrainingModelOffer, TrainingPreparation, TrainingProviderDefinition, TrainingProviderMetadata, TrainingProviderPin, TrainingRecipe, TrainingResumePoint, TrainingStep, TrainingUsageUnits, TurnDraft, TurnGate, TurnHistoryMessage, TurnRecord, TurnSpec, UiAccess, UiBundle, UiBundleManifest, UiCRN, UiCapability, UiExecution, UiGovernanceMeter, UiHandler, UiResource, UiRuntimeContext, UiSource, UiSqlResult, UiState, UpstreamPayer, Verdict, VerdictSamplingMode, ViewDef, WaitResolvedEvent };
|
|
5432
|
+
export { AGENT_UI_DEFAULTS, AfterYield, ApiError, CHAT_FORMAT_CAPABILITY, CONSTAL_API_CAPABILITY, CONSTAL_API_GET_KINDS, CONSTAL_API_MODEL_TOOL_DESCRIPTIONS, CONSTAL_API_OPERATIONS, CONSTAL_API_OPERATION_SCHEMAS, CONSTAL_API_QUERY_KINDS, CONSTAL_API_VERSION, CommitConflict, CommitGateRejected, CredentialRevoked, CredentialUnavailable, DATA_SHARE_FEE_BPS, DirectNetworkDenied, EVALUATION_LIMITS, EffectCeilingExceeded, EmptyJoin, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MCP_PROTOCOL_VERSION, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, MODEL_EVALUATION_CAPABILITY, McpClient, NondeterministicReplay, NotAppendOnly, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_CREDENTIAL_BINDING_SCHEMA, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SANDBOX_EGRESS_LIMITS, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TRAINING_RECIPE_DEFAULTS, TerminalIntegrationFailure, ToolUnavailable, UI_ASSET_CONTENT_TYPES, UI_BUNDLE_BOUNDS, UnknownTool, WEB_FETCH_ARGUMENT_SCHEMA, WEB_SEARCH_ARGUMENT_SCHEMA, action, actionPattern, agent, agentLimit, agentResourceBinding, agentSetupMetadata, agentSetupRequirements, agentUiBundleManifest, agentUiDeclaration, all, analyticsEvent, approximateTokens, authProvider, authProviderName, bindingName, bucketFor, canonicalJson, capabilityContractRef, casTool, channel, channelIngressRequest, channelIngressSource, channelSourceEvidence, channelSubscriptionRequest, channelTarget, chatFormat, chatFormatMetadata, chatFormatPin, chatParseInput, chatParsed, chatRenderInput, chatRenderRequest, chatRendering, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, containerImageReference, containerImageSelection, containerImageSource, credentialEvidence, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, credentialSetupState, customerTenantName, cutBatches, cutPartitions, dataShareEarningMicroUsd, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, evaluationArguments, evaluationProtocolRequest, evaluationProtocolResult, formatLedgerAddress, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, immutableContainerImageReference, integrationEgressPolicy, invocationCredentialUses, judgeAgent, labelSelector, matchesAction, matchesLabelSelector, matchesResource, mcpToolDescription, mcpToolResult, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelGenerationOptions, modelLimit, modelMessages, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxEgressCredentialRules, normalizeSandboxEgressPolicy, normalizeSandboxLabels, normalizeSandboxNetworkPolicy, normalizeSandboxWorkspacePath, noulDecision, opTool, opTools, parseLedgerAddress, parseResourceName, policy, policyName, race, resolveBindingOwner, resolveContainerImageSource, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, resourceTools, runLabels, sandboxControls, sandboxEgressDecision, sandboxEgressHostMatches, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scoreLevel, scorerDraftHash, scorerName, select, selectableResourceLabels, setupAwait, setupCredentialReceipt, setupPanelProviderIsCrn, setupScreen, setupScreenView, setupSubmission, sha256Hex, shareContributionRequest, shareContributionReview, shareEvaluation, sharePrices, shareRequest, skills, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingCorrection, trainingProvider, trainingProviderMetadata, trainingRecipe, uiAssetContentType, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
|
|
5433
|
+
export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeployPolicy, AgentGovernanceMeter, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelContext, ChannelDeliveryError, ChannelDeliveryEvent, ChannelDeliveryOutcome, ChannelDeliveryReport, ChannelFailure, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, ChatFormatDefinition, ChatFormatMetadata, ChatFormatPin, ChatMessage, ChatParseRequest, ChatParsed, ChatRenderRequest, ChatRendering, ChatSpan, ChatTool, CheckpointDeploymentRequest, CheckpointImportMetadata, CheckpointImportRequest, ChoiceAnswer, ChoiceQuestion, CodeScoreResult, CodeScorerIR, CodeScorerRule, CommitOpts, CompareSuitesRequest, Compensation, ConnectionCancelRequest, ConnectionIdentity, ConnectionOperation, ConnectionRecoveryRequest, ConnectionRecoveryResult, ConnectionRequest, ConnectionUsageReport, ConstalApiApplyRequest, ConstalApiChangePlan, ConstalApiChangePlanRef, ConstalApiChangePlanRequest, ConstalApiChangeReceipt, ConstalApiOperationReceipt, ContainerImageReference, ContainerImageSelection, ContainerImageSource, ContainerRegistryRequest, ContainerRegistryResponse, ControlEvent, Cost, CreateSandboxImageOptions, CreateSandboxOptions, CredentialCRN, CredentialDestroyResult, CredentialEvidence, CredentialInteractionAction, CredentialInteractionAdvanceRequest, CredentialInteractionEvent, CredentialInteractionPrimaryAction, CredentialInteractionProof, CredentialInteractionResult, CredentialInteractionStartRequest, CredentialMaterialRequest, CredentialMintRequest, CredentialMintResult, CredentialProviderCRN, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialSetupState, CredentialUninstallRequest, CredentialUninstallResult, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DataSharingScope, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, EvalSuiteCase, EvalSuiteCasePage, EvalSuiteCaseScore, EvalSuiteCaseState, EvalSuiteScoreState, EvaluationAnswer, EvaluationAnswerFor, EvaluationAnswers, EvaluationEntry, EvaluationInvocationArgs, EvaluationInvocationResult, EvaluationProtocol, EvaluationQuestion, EvaluationQuestions, EvaluationRecord, EvaluationSpec, EventBase, Fact, FactRef, FileEntry, FixedMemoryStoreRef, FixedModelGatewayRef, FoldFn, GateEvidence, GateResult, GateVerdict, GatewayCancelRequest, GatewayConfigEgressBinding, GatewayContext, GatewayCredentialSlotSetup, GatewayDefinition, GatewayDiscoverySetup, GatewayModelOffer, GatewayOperation, GatewayPackage, GatewayPackageMetadata, GatewayRecoveryRequest, GatewayRecoveryResult, GatewayRequest, GovernanceContractRef, Handle, HandleOutcome, Hash, HistoryPage, HistoryView, HmacVerification, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationAttachment, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationLifecycle, IntegrationReleaseContext, IntegrationSecret, IntegrationState, InvocationCredentialUse, InvocationHandle, InvokableKind, InvokeOpts, JoinOutcome, JsonScalar, JsonValue, JudgeRubric, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerAddressParts, LedgerEvent, ListSchedulesOptions, LoadedSkill, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, McpClientOptions, McpClientState, McpMessageTransport, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCacheHint, ModelCompletion, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGenerationOptions, ModelGovernanceControls, ModelGovernanceMeter, ModelHistoryMessage, ModelHistoryToolCall, ModelInvocationArgs, ModelInvocationResult, ModelProtocolRequestOptions, ModelTechnicalCapabilities, ModelTool, NormalizedModelGatewayConfig, NoulAnswer, NoulQuestion, Out, Over, PartitionFn, PartitionSpec, Partitioning, PolicyCRN, PolicyConstraint, PolicyContextValue, PolicyDefinition, PolicyInput, PolicyInvocationOrigin, PolicyOutcome, Principal, PrincipalKind, Provenance, RawModelProtocol, Recovery, ReduceFact, ReduceOpts, Ref, RequestLabelRequest, ResourceContractRef, ResourceControlsConstraint, ResourceCredentialBinding, ResourceDependencyRef, ResourceKind, ResourceName, ResourceNameParts, ResourceNeed, ResourcePattern, ResourceSelector, RollbackReport, RunIdentityView, RunInfo, RunReport, RunStatusDetail, RunSuiteRequest, Sandbox, SandboxCommandCollectionError, SandboxCommandExecution, SandboxCommandResult, SandboxEgressCredentialRule, SandboxEgressPolicy, SandboxEgressRule, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxLabels, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, SandboxProcess, SandboxProcessCredentials, SandboxProcessIoOperation, SandboxProcessOperation, SandboxProcessReadInput, SandboxProcessReadResult, SandboxProcessStatus, SandboxProcessWriteResult, SandboxReadFileOptions, SandboxReadFileResult, SandboxWorkspace, SandboxWriteFileResult, Schedule, ScheduleCancellation, ScheduleDuration, ScheduleMissed, ScheduleOccurrence, ScheduleOccurrencePage, ScheduleOptions, SchedulePage, ScheduleState, ScheduleTarget, ScheduleTiming, ScheduleTrigger, ScheduleWhen, ScopedBindingKey, ScopedCredentialRef, ScopedMemoryStoreRef, ScopedModelGatewayRef, ScopedResourceRef, ScoreAnswer, ScoreQuestion, ScoreRequest, ScorerApplies, ScorerCRN, ScorerDef, ScorerDraft, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupCredentialReceipt, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, Share, ShareAction, ShareContribution, ShareContributionImport, ShareContributionRequest, ShareContributionReview, ShareContributionReviewRequest, ShareContributionStatus, ShareEvaluation, ShareEvaluationPin, ShareEvaluationRequest, ShareEvaluationVerdict, ShareEvaluationView, ShareHistory, SharePrice, ShareRequest, ShareReviewDecision, Skill, SkillDescription, SkillLibrary, SkillSource, SortField, SpawnAttenuation, SpawnBudget, SpawnHandle, SpawnOpts, SqlFold, StageInfo, StageOutputSpec, StartTrainingRequest, SteerEvent, StepJournal, SuiteFact, TableAggregate, TableDescribeArgs, TableFilter, TableFilterOperation, TableOrder, TableQueryArgs, TableQueryPlan, TableQueryResult, TableScalar, TableSnapshotDescription, Task, Tier, Tool, ToolCallRecord, TrainingCorrection, TrainingJobFact, TrainingJobReference, TrainingJobState, TrainingJobStatus, TrainingMethod, TrainingModelOffer, TrainingPreparation, TrainingProviderDefinition, TrainingProviderMetadata, TrainingProviderPin, TrainingRecipe, TrainingResumePoint, TrainingStep, TrainingUsageUnits, TurnDraft, TurnGate, TurnHistoryMessage, TurnRecord, TurnSpec, UiAccess, UiBundle, UiBundleManifest, UiCRN, UiCapability, UiExecution, UiGovernanceMeter, UiHandler, UiResource, UiRuntimeContext, UiSource, UiSqlResult, UiState, UpstreamPayer, Verdict, VerdictSamplingMode, ViewDef, WaitResolvedEvent };
|
package/publish/index.js
CHANGED
|
@@ -81,8 +81,8 @@ function canonicalJson(value) {
|
|
|
81
81
|
if (typeof value === "string") return JSON.stringify(value);
|
|
82
82
|
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
83
83
|
if (typeof value === "object") {
|
|
84
|
-
const
|
|
85
|
-
return `{${Object.keys(
|
|
84
|
+
const record14 = value;
|
|
85
|
+
return `{${Object.keys(record14).sort().filter((key) => record14[key] !== void 0).map((key) => `${JSON.stringify(key)}:${canonicalJson(record14[key])}`).join(",")}}`;
|
|
86
86
|
}
|
|
87
87
|
throw new TypeError(`canonical JSON does not support ${typeof value}`);
|
|
88
88
|
}
|
|
@@ -408,21 +408,21 @@ function validateJsonSchema(value, schema, path = "$") {
|
|
|
408
408
|
if (typeof rule.multipleOf === "number" && Math.abs(value / rule.multipleOf - Math.round(value / rule.multipleOf)) > Number.EPSILON * 8) return `${path} is not a multiple`;
|
|
409
409
|
}
|
|
410
410
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
411
|
-
const
|
|
412
|
-
for (const key of Array.isArray(rule.required) ? rule.required : []) if (typeof key === "string" && !(key in
|
|
411
|
+
const record14 = value;
|
|
412
|
+
for (const key of Array.isArray(rule.required) ? rule.required : []) if (typeof key === "string" && !(key in record14)) return `${path}.${key} is required`;
|
|
413
413
|
const properties = rule.properties && typeof rule.properties === "object" && !Array.isArray(rule.properties) ? rule.properties : {};
|
|
414
|
-
if (typeof rule.minProperties === "number" && Object.keys(
|
|
415
|
-
if (typeof rule.maxProperties === "number" && Object.keys(
|
|
414
|
+
if (typeof rule.minProperties === "number" && Object.keys(record14).length < rule.minProperties) return `${path} has too few properties`;
|
|
415
|
+
if (typeof rule.maxProperties === "number" && Object.keys(record14).length > rule.maxProperties) return `${path} has too many properties`;
|
|
416
416
|
if (rule.additionalProperties === false) {
|
|
417
|
-
const extra = Object.keys(
|
|
417
|
+
const extra = Object.keys(record14).find((key) => !(key in properties));
|
|
418
418
|
if (extra) return `${path}.${extra} is not allowed`;
|
|
419
419
|
}
|
|
420
|
-
for (const [key, child] of Object.entries(properties)) if (key in
|
|
421
|
-
const error = validateJsonSchema(
|
|
420
|
+
for (const [key, child] of Object.entries(properties)) if (key in record14) {
|
|
421
|
+
const error = validateJsonSchema(record14[key], child, `${path}.${key}`);
|
|
422
422
|
if (error) return error;
|
|
423
423
|
}
|
|
424
|
-
if (rule.additionalProperties && typeof rule.additionalProperties === "object") for (const key of Object.keys(
|
|
425
|
-
const error = validateJsonSchema(
|
|
424
|
+
if (rule.additionalProperties && typeof rule.additionalProperties === "object") for (const key of Object.keys(record14).filter((candidate) => !(candidate in properties))) {
|
|
425
|
+
const error = validateJsonSchema(record14[key], rule.additionalProperties, `${path}.${key}`);
|
|
426
426
|
if (error) return error;
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -1892,6 +1892,7 @@ var CONSTAL_API_QUERY_KINDS = [
|
|
|
1892
1892
|
"eval-suite",
|
|
1893
1893
|
"eval-baseline",
|
|
1894
1894
|
"eval-schedule",
|
|
1895
|
+
"failure-group",
|
|
1895
1896
|
"training-job",
|
|
1896
1897
|
"checkpoint",
|
|
1897
1898
|
"training-provider",
|
|
@@ -2307,7 +2308,7 @@ async function evaluatePolicyDefinition(definition, input) {
|
|
|
2307
2308
|
|
|
2308
2309
|
// packages/sdk/src/data-sharing.ts
|
|
2309
2310
|
var ACTIONS = ["read", "evaluate", "contribute"];
|
|
2310
|
-
var TERMS = /* @__PURE__ */ new Set(["displayName", "selector", "actions", "prices", "evaluation", "expiresAt"]);
|
|
2311
|
+
var TERMS = /* @__PURE__ */ new Set(["displayName", "selector", "actions", "prices", "evaluation", "history", "expiresAt"]);
|
|
2311
2312
|
var EVALUATION = ["namespace", "agent", "dataset", "scorers", "concurrency", "budgetMicroUsd"];
|
|
2312
2313
|
function record5(value) {
|
|
2313
2314
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -2381,6 +2382,13 @@ function shareRequest(value) {
|
|
|
2381
2382
|
}
|
|
2382
2383
|
if (Object.hasOwn(source, "prices")) terms.prices = sharePrices(source.prices);
|
|
2383
2384
|
if (Object.hasOwn(source, "evaluation")) terms.evaluation = source.evaluation === null ? null : shareEvaluation(source.evaluation);
|
|
2385
|
+
if (Object.hasOwn(source, "history")) {
|
|
2386
|
+
const history = record5(source.history);
|
|
2387
|
+
if (source.history !== null && (!history || Object.keys(history).some((key) => key !== "since") || !Number.isSafeInteger(history.since) || history.since <= 0)) {
|
|
2388
|
+
throw new TypeError("Share history must be null or { since: a time in milliseconds }");
|
|
2389
|
+
}
|
|
2390
|
+
terms.history = history ? { since: history.since } : null;
|
|
2391
|
+
}
|
|
2384
2392
|
if (Object.hasOwn(source, "expiresAt")) {
|
|
2385
2393
|
if (source.expiresAt !== null && (!Number.isSafeInteger(source.expiresAt) || source.expiresAt <= 0)) {
|
|
2386
2394
|
throw new TypeError("Share expiresAt must be null or a time in milliseconds");
|
|
@@ -3024,9 +3032,9 @@ function modelHistoryMessages(value) {
|
|
|
3024
3032
|
if (!open2.done) throw new TypeError(`model history Tool call ${open2.value} has no tool message answering it before message ${index}`);
|
|
3025
3033
|
if (source.role === "user" || source.toolCalls === void 0) return { role: source.role, content: source.content };
|
|
3026
3034
|
if (!Array.isArray(source.toolCalls)) throw new TypeError(`${at} toolCalls must be an array`);
|
|
3027
|
-
const toolCalls = source.toolCalls.map((call,
|
|
3035
|
+
const toolCalls = source.toolCalls.map((call, position2) => {
|
|
3028
3036
|
const entry2 = record7(call);
|
|
3029
|
-
if (!entry2 || !nonempty(entry2.id) || !nonempty(entry2.name)) throw new TypeError(`${at} Tool call ${
|
|
3037
|
+
if (!entry2 || !nonempty(entry2.id) || !nonempty(entry2.name)) throw new TypeError(`${at} Tool call ${position2} needs an id and a name`);
|
|
3030
3038
|
if (ids.has(entry2.id)) throw new TypeError(`${at} repeats Tool call id ${entry2.id}`);
|
|
3031
3039
|
try {
|
|
3032
3040
|
canonicalJson(entry2.args);
|
|
@@ -3090,7 +3098,7 @@ ${message2.content}`;
|
|
|
3090
3098
|
}
|
|
3091
3099
|
return merged;
|
|
3092
3100
|
}
|
|
3093
|
-
function openAiMessage(message2, options) {
|
|
3101
|
+
function openAiMessage(message2, options = {}) {
|
|
3094
3102
|
if (message2.role === "tool") return {
|
|
3095
3103
|
role: "tool",
|
|
3096
3104
|
tool_call_id: message2.toolCallId,
|
|
@@ -3330,7 +3338,7 @@ function chatMessage(value, index) {
|
|
|
3330
3338
|
if (source.role === "user" && exactKeys3(source, ["role", "content"])) return source;
|
|
3331
3339
|
if (source.role === "tool" && typeof source.toolCallId === "string" && source.toolCallId && (source.isError === void 0 || typeof source.isError === "boolean") && exactKeys3(source, ["role", "toolCallId", "content"], ["isError"])) return source;
|
|
3332
3340
|
if (source.role === "assistant" && exactKeys3(source, ["role", "content"], ["toolCalls", "reasoning"]) && (source.reasoning === void 0 || typeof source.reasoning === "string") && (source.toolCalls === void 0 || Array.isArray(source.toolCalls))) {
|
|
3333
|
-
source.toolCalls?.forEach((call,
|
|
3341
|
+
source.toolCalls?.forEach((call, position2) => toolCall(call, `${field2} Tool call ${position2}`));
|
|
3334
3342
|
return source;
|
|
3335
3343
|
}
|
|
3336
3344
|
throw new TypeError(`${field2} is invalid`);
|
|
@@ -3346,8 +3354,8 @@ function chatRenderInput(value) {
|
|
|
3346
3354
|
if (!tool || typeof tool.name !== "string" || !tool.name || typeof tool.description !== "string" || !record8(tool.schema) || !jsonValue(tool.schema) || !exactKeys3(tool, ["name", "description", "schema"])) throw new TypeError(`chat Tool ${index} is invalid`);
|
|
3347
3355
|
});
|
|
3348
3356
|
if (source.toolChoice === "required" && source.tools.length === 0) throw new TypeError("required Tool choice needs at least one offered Tool");
|
|
3349
|
-
source.train.forEach((index,
|
|
3350
|
-
if (!Number.isSafeInteger(index) || index < 0 || index >= messages.length || messages[index].role !== "assistant" ||
|
|
3357
|
+
source.train.forEach((index, position2) => {
|
|
3358
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= messages.length || messages[index].role !== "assistant" || position2 > 0 && index <= source.train[position2 - 1]) {
|
|
3351
3359
|
throw new TypeError("chat render request trains only assistant messages, in ascending order");
|
|
3352
3360
|
}
|
|
3353
3361
|
});
|
|
@@ -4876,11 +4884,74 @@ function evaluateCodeScorer(raw, subject) {
|
|
|
4876
4884
|
};
|
|
4877
4885
|
}
|
|
4878
4886
|
|
|
4887
|
+
// packages/sdk/src/evals.ts
|
|
4888
|
+
async function scorerDraftHash(definition) {
|
|
4889
|
+
const { id: _id, version: _version, ...draft } = definition;
|
|
4890
|
+
return hash("constal/scorer-draft/v1", draft);
|
|
4891
|
+
}
|
|
4892
|
+
|
|
4893
|
+
// packages/sdk/src/judge.ts
|
|
4894
|
+
function record13(value) {
|
|
4895
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
4896
|
+
}
|
|
4897
|
+
function question2(criterion, field2) {
|
|
4898
|
+
const source = record13(criterion);
|
|
4899
|
+
if (!source || source.instructions === void 0 || Object.keys(source).some((key) => key !== "instructions" && key !== "levels") || source.levels !== void 0 && (!Array.isArray(source.levels) || source.levels.length < 2)) {
|
|
4900
|
+
throw new TypeError(`${field2} is { instructions, levels? } with at least two levels`);
|
|
4901
|
+
}
|
|
4902
|
+
const instructions = source.instructions;
|
|
4903
|
+
return source.levels === void 0 ? { type: "noul", instructions } : { type: "score", instructions, criteria: source.levels };
|
|
4904
|
+
}
|
|
4905
|
+
function position(answer2, asked) {
|
|
4906
|
+
if (answer2.type === "noul") return answer2.noul;
|
|
4907
|
+
if (answer2.type === "score" && asked.type === "score") return answer2.score / (asked.criteria.length - 1);
|
|
4908
|
+
throw new TypeError("evaluation answer does not match its rubric question");
|
|
4909
|
+
}
|
|
4910
|
+
function judged(message2) {
|
|
4911
|
+
const body = record13(message2);
|
|
4912
|
+
const state = body?.kind === "eval-judge" ? body.value : body?.task === "evaluate" ? { case: body.case, output: body.output } : void 0;
|
|
4913
|
+
const scale = record13(body?.scale);
|
|
4914
|
+
if (!body || state === void 0 || typeof scale?.min !== "number" || typeof scale.max !== "number" || !Number.isFinite(scale.min) || !Number.isFinite(scale.max) || scale.min >= scale.max) {
|
|
4915
|
+
throw new TypeError('a Judge is given { kind: "eval-judge", rubric, scale, value } or { task: "evaluate", rubric, scale, case, output }');
|
|
4916
|
+
}
|
|
4917
|
+
return { rubric: body.rubric, scale: { min: scale.min, max: scale.max }, state };
|
|
4918
|
+
}
|
|
4919
|
+
function judgeAgent(input) {
|
|
4920
|
+
return agent({
|
|
4921
|
+
id: input.id,
|
|
4922
|
+
version: input.version,
|
|
4923
|
+
async onMessage(message2, ctx) {
|
|
4924
|
+
const { rubric, scale, state } = judged(message2);
|
|
4925
|
+
const source = record13(rubric);
|
|
4926
|
+
const dimensions = source?.dimensions === void 0 ? {} : record13(source.dimensions);
|
|
4927
|
+
if (!source || !dimensions || Object.keys(source).some((key) => !["instructions", "levels", "dimensions"].includes(key))) {
|
|
4928
|
+
throw new TypeError("a Judge rubric is { instructions, levels?, dimensions? }");
|
|
4929
|
+
}
|
|
4930
|
+
const questions = { score: question2({
|
|
4931
|
+
instructions: source.instructions,
|
|
4932
|
+
...source.levels === void 0 ? {} : { levels: source.levels }
|
|
4933
|
+
}, "the rubric") };
|
|
4934
|
+
for (const [name, criterion] of Object.entries(dimensions)) questions[`dimension:${name}`] = question2(criterion, `rubric dimension ${name}`);
|
|
4935
|
+
const { answers, model } = await ctx.evaluate({ state, questions });
|
|
4936
|
+
const onScale = (id2) => Math.min(scale.max, Math.max(
|
|
4937
|
+
scale.min,
|
|
4938
|
+
scale.min + position(answers[id2], questions[id2]) * (scale.max - scale.min)
|
|
4939
|
+
));
|
|
4940
|
+
const names = Object.keys(dimensions);
|
|
4941
|
+
return {
|
|
4942
|
+
score: onScale("score"),
|
|
4943
|
+
dimensions: names.length === 0 ? null : Object.fromEntries(names.map((name) => [name, onScale(`dimension:${name}`)])),
|
|
4944
|
+
evidence: { model, answers }
|
|
4945
|
+
};
|
|
4946
|
+
}
|
|
4947
|
+
});
|
|
4948
|
+
}
|
|
4949
|
+
|
|
4879
4950
|
// packages/sdk/src/errors.ts
|
|
4880
4951
|
var GateExhausted = class extends Error {
|
|
4881
|
-
constructor(
|
|
4952
|
+
constructor(record14) {
|
|
4882
4953
|
super("turn gate exhausted");
|
|
4883
|
-
this.record =
|
|
4954
|
+
this.record = record14;
|
|
4884
4955
|
this.name = "GateExhausted";
|
|
4885
4956
|
}
|
|
4886
4957
|
record;
|
|
@@ -5213,6 +5284,7 @@ export {
|
|
|
5213
5284
|
immutableContainerImageReference,
|
|
5214
5285
|
integrationEgressPolicy,
|
|
5215
5286
|
invocationCredentialUses,
|
|
5287
|
+
judgeAgent,
|
|
5216
5288
|
labelSelector,
|
|
5217
5289
|
matchesAction,
|
|
5218
5290
|
matchesLabelSelector,
|
|
@@ -5267,6 +5339,7 @@ export {
|
|
|
5267
5339
|
scopedCredentialRef,
|
|
5268
5340
|
scopedResourceRef,
|
|
5269
5341
|
scoreLevel,
|
|
5342
|
+
scorerDraftHash,
|
|
5270
5343
|
scorerName,
|
|
5271
5344
|
select,
|
|
5272
5345
|
selectableResourceLabels,
|