daishi-sdk 0.2.0 → 0.2.2

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.
@@ -5,7 +5,7 @@ export type JsonObject = {
5
5
  /** The API version these types describe. */
6
6
  export declare const API_VERSION = "1.0.0";
7
7
  /** Every error code the API documents. */
8
- export type ErrorCode = 'token_required' | 'scope_required' | 'plan_api' | 'rate_limited' | 'bad_request' | 'bad_scenario' | 'bad_replicates' | 'profile_required' | 'bad_season_ticks' | 'bad_frame' | 'bad_env' | 'too_many_scenarios' | 'unknown_scenario' | 'bad_skill' | 'too_many_skills' | 'unknown_skill' | 'bad_roster' | 'bad_model' | 'bad_name' | 'bad_provider' | 'provider_key_required' | 'openrouter_key_required' | 'openrouter_balance_low' | 'billing_frozen' | 'email_unverified' | 'bad_trials' | 'bad_spend_cap' | 'plan_seats' | 'plan_ticks' | 'plan_series' | 'plan_quota' | 'too_many_runs' | 'run_history_full' | 'seed_not_allowed' | 'unknown_run' | 'unknown_batch' | 'unknown_experiment' | 'experiment_trial' | 'experiment_not_running' | 'experiment_arms' | 'bad_experiment' | 'experiment_scenario' | 'experiment_world_only' | 'experiment_env_seed' | 'experiment_stopping' | 'bad_metric' | 'plan_experiment_arms' | 'unknown_log' | 'plan_invites' | 'invite_world' | 'invite_series' | 'too_many_open_worlds' | 'no_invite' | 'invite_fixed' | 'bad_invite' | 'never_played' | 'run_playing' | 'bad_note' | 'note_too_long' | 'run_launching' | 'internal_error';
8
+ export type ErrorCode = 'token_required' | 'scope_required' | 'plan_api' | 'rate_limited' | 'bad_request' | 'bad_scenario' | 'bad_replicates' | 'profile_required' | 'bad_season_ticks' | 'bad_frame' | 'bad_env' | 'too_many_scenarios' | 'unknown_scenario' | 'bad_skill' | 'too_many_skills' | 'unknown_skill' | 'bad_roster' | 'bad_model' | 'bad_name' | 'bad_provider' | 'provider_key_required' | 'openrouter_key_required' | 'openrouter_balance_low' | 'billing_frozen' | 'email_unverified' | 'bad_trials' | 'bad_spend_cap' | 'plan_seats' | 'plan_ticks' | 'plan_series' | 'plan_quota' | 'too_many_runs' | 'run_history_full' | 'seed_not_allowed' | 'unknown_run' | 'unknown_batch' | 'unknown_experiment' | 'experiment_trial' | 'experiment_not_running' | 'experiment_arms' | 'bad_experiment' | 'experiment_scenario' | 'experiment_world_only' | 'experiment_env_seed' | 'experiment_stopping' | 'bad_metric' | 'experiment_effort_roster' | 'plan_experiment_arms' | 'unknown_log' | 'plan_invites' | 'invite_world' | 'invite_series' | 'too_many_open_worlds' | 'no_invite' | 'invite_fixed' | 'bad_invite' | 'never_played' | 'run_playing' | 'bad_note' | 'note_too_long' | 'run_launching' | 'internal_error';
9
9
  export type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
10
10
  export interface RequestParts {
11
11
  query?: Record<string, string | number | boolean | undefined | null>;
@@ -19,7 +19,7 @@ export interface ErrorBody {
19
19
  /** On 401 and 403: where the developer docs are. */
20
20
  docs?: string;
21
21
  }
22
- /** A run record. Null fields fill in as the run launches, plays and ends. */
22
+ /** A run record. Null fields fill in as the run launches, plays and ends. `resumes` lists every time a new server release picked the run up mid-match (oldest first, with the round the world was at): the world and the meter carried over, each seat’s own memory of the earlier rounds did not, so a resumed run is a different condition from one played in one release; the match archive carries the same list under `config.run.resumes`, a series report counts such trials and an experiment keeps them out of its pairs. */
23
23
  export interface Run {
24
24
  run_id: string;
25
25
  name: string;
@@ -48,6 +48,7 @@ export interface Run {
48
48
  created_at_ms: number;
49
49
  started_at_ms: number | null;
50
50
  ended_at_ms: number | null;
51
+ resumes: RunResume[];
51
52
  priority: number;
52
53
  max_spend_usd: number | null;
53
54
  spend_usd: number;
@@ -102,6 +103,7 @@ export interface BatchReport {
102
103
  trials: number;
103
104
  finished: number;
104
105
  failed: number;
106
+ resumed: number;
105
107
  scored: number;
106
108
  unscored: number;
107
109
  pending: number;
@@ -122,7 +124,8 @@ export interface Experiment {
122
124
  scenario_id: string;
123
125
  trials: number;
124
126
  seed_mode: 'vary' | 'pinned';
125
- metric: 'fitness_index' | 'rank' | 'survived';
127
+ metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
128
+ secondary_metrics: Array<'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn'>;
126
129
  rule: StoppingRule;
127
130
  arms: ExperimentArmView[];
128
131
  created_at_ms: number;
@@ -143,13 +146,14 @@ export interface ExperimentReport {
143
146
  scenario_id: string;
144
147
  trials: number;
145
148
  seed_mode: 'vary' | 'pinned';
146
- metric: 'fitness_index' | 'rank' | 'survived';
147
- analysis_scale: 'metric' | 'negative_rank';
149
+ metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
150
+ analysis_scale: 'metric' | 'negative_rank' | 'log';
148
151
  rule: StoppingRule;
149
152
  rule_text: string;
150
153
  arms: ExperimentReportArm[];
151
154
  pairs: ExperimentReportPair[];
152
155
  comparisons: ExperimentReportComparison[];
156
+ secondary: ExperimentReportSecondary[];
153
157
  detectable_gap: ExperimentReportDetectableGap;
154
158
  decision: ExperimentReportDecision;
155
159
  verdict: string;
@@ -220,8 +224,10 @@ export interface ExperimentBody {
220
224
  name?: string;
221
225
  /** vary (default): each trial its own world; pinned: one world for every trial, only the layout varies. A saved scenario that pins its own seed needs pinned; a scenario that draws its worlds from a seed pool refuses it (trial i plays the pool’s world for that trial in every arm, and the pool’s eight worlds come round again from trial nine). A scenario with one fixed world (the lab scenarios) plays it on every trial: its experiment is pinned by default and refuses vary. */
222
226
  seed_mode?: 'vary' | 'pinned';
223
- /** The per-trial score the arms are compared on, the mean over the arm’s roster seats: the Fitness Index (default), the rank in the field (lower is better, and the report compares on the negative rank so a positive difference always favors the arm), or the share of seats that survived. */
224
- metric?: 'fitness_index' | 'rank' | 'survived';
227
+ /** The per-trial score the arms are compared on, the mean over the arm’s roster seats: the Fitness Index (default), the rank in the field (lower is better, and the report compares on the negative rank so a positive difference always favors the arm), the share of seats that survived, or output tokens per play turn. Output per turn is how much each model generated per turn of play, thinking included (the exit interview and the debrief are not play turns); it compares each model with itself, so every arm must field the same model in the same seat as the control, and it is analyzed on the log scale, the difference read as a percent change. It has no better side: the verdict says which arm generated more. A seat that missed more than a tenth of the rounds is left out of a trial in every arm, and a guest seat is never measured. */
228
+ metric?: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
229
+ /** Outcomes reported beside metric, declared now and never changed: any of the metric’s values except the metric itself, each at most once. Each is read on the same pairs with the same rule at the same level, and none stops anything; when a comparison stops, its secondaries take their reading on the pairs it stopped on. Output per turn here holds the arms to the same models in the same seats, as it does as the metric. Default none. */
230
+ secondary_metrics?: Array<'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn'>;
225
231
  /** anytime: an anytime-valid 95% confidence sequence on the paired difference, checked after every trial from the tenth on, stopping as soon as it excludes zero or at the last trial; it needs more than 10 trials per arm and is the default above that. fixed: one look at the last trial; the default at 10 or fewer. With more than two arms the level is split across the comparisons against the control. */
226
232
  stopping?: 'anytime' | 'fixed';
227
233
  /** Anytime rule only: also stop, undecided, once the whole interval lies within plus or minus this on the metric’s scale, so the gap, if any, is smaller than this. */
@@ -385,6 +391,10 @@ export interface RunExperiment {
385
391
  id: string;
386
392
  arm: number;
387
393
  }
394
+ export interface RunResume {
395
+ at_ms: number;
396
+ tick: number;
397
+ }
388
398
  export interface RunLive {
389
399
  phase: string;
390
400
  tick: number;
@@ -453,6 +463,7 @@ export interface BatchReportPoint {
453
463
  spawn_seed: number | null;
454
464
  match_id: string | null;
455
465
  frame: 'monitored' | 'neutral' | null;
466
+ resumed_at: number[];
456
467
  agents: BatchReportPointAgent[] | null;
457
468
  }
458
469
  export interface BatchReportPointAgent {
@@ -499,6 +510,7 @@ export interface ExperimentReportArm {
499
510
  agent_turns: number;
500
511
  usage: JsonObject;
501
512
  awareness: JsonObject;
513
+ effort?: ExperimentReportArmEffort;
502
514
  }
503
515
  export interface ExperimentReportArmTrials {
504
516
  finished: number;
@@ -514,6 +526,20 @@ export interface ExperimentReportArmScore {
514
526
  sd: number | null;
515
527
  ci: Interval | null;
516
528
  }
529
+ export interface ExperimentReportArmEffort {
530
+ measured_seats: number;
531
+ short_seats: number;
532
+ unmeasured_seats: number;
533
+ models: ExperimentReportArmEffortModel[];
534
+ }
535
+ export interface ExperimentReportArmEffortModel {
536
+ model: string;
537
+ seats: number;
538
+ output_per_turn: number;
539
+ thinking_per_turn: number | null;
540
+ truncated_share: number;
541
+ served_by: JsonObject;
542
+ }
517
543
  export interface ExperimentReportPair {
518
544
  trial: number;
519
545
  seed: number | null;
@@ -531,8 +557,28 @@ export interface ExperimentReportComparison {
531
557
  alpha: number;
532
558
  stop: boolean;
533
559
  reason: string;
534
- verdict: 'arm_better' | 'control_better' | 'undecided' | null;
560
+ verdict: 'arm_better' | 'control_better' | 'arm_higher' | 'control_higher' | 'undecided' | null;
561
+ interval: Interval | null;
562
+ detail: string;
563
+ }
564
+ export interface ExperimentReportSecondary {
565
+ metric: 'fitness_index' | 'rank' | 'survived' | 'output_tokens_per_turn';
566
+ analysis_scale: 'metric' | 'negative_rank' | 'log';
567
+ pairs: ExperimentReportSecondaryPair[];
568
+ comparisons: ExperimentReportSecondaryComparison[];
569
+ }
570
+ export interface ExperimentReportSecondaryPair {
571
+ trial: number;
572
+ values: Array<number | null>;
573
+ excluded: boolean;
574
+ }
575
+ export interface ExperimentReportSecondaryComparison {
576
+ arm: number;
577
+ control: number;
578
+ n: number;
579
+ mean_diff: number | null;
535
580
  interval: Interval | null;
581
+ reading: 'arm_better' | 'control_better' | 'arm_higher' | 'control_higher' | 'undecided' | null;
536
582
  detail: string;
537
583
  }
538
584
  export interface ExperimentReportDetectableGap {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Operations, type ErrorCode, type GetBatchResponse, type GetExperimentResponse, type GetRunResponse, type Method, type RequestParts } from './generated.js';
2
2
  export * from './generated.js';
3
- export declare const VERSION = "0.2.0";
3
+ export declare const VERSION = "0.2.2";
4
4
  export declare const DEFAULT_BASE_URL = "https://daishi.ai/api/v1";
5
5
  export interface DaishiOptions {
6
6
  /** A Studio access token (`dsk_...`). Default: the `DAISHI_TOKEN` environment variable. */
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Operations } from './generated.js';
2
2
  export * from './generated.js';
3
- export const VERSION = '0.2.0';
3
+ export const VERSION = '0.2.2';
4
4
  export const DEFAULT_BASE_URL = 'https://daishi.ai/api/v1';
5
5
  /** A refusal from the API, or a transport failure after the retries ran out. */
6
6
  export class DaishiError extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daishi-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Typed client for the Daishi Studio API: scenarios, runs, series batches and paired experiments, with retries and waiting helpers.",
5
5
  "keywords": [
6
6
  "daishi",