daishi-sdk 0.2.18 → 0.2.20

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' | 'handover' | '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_running' | 'bad_cancel_reason' | 'cancel_reason_fixed' | 'bad_replaced_by' | 'experiment_arms' | 'bad_experiment' | 'experiment_scenario' | 'bad_game' | 'bad_arena' | 'experiment_world_only' | 'experiment_same_arms' | 'experiment_env_seed' | 'experiment_stopping' | 'bad_metric' | 'bad_design' | 'design_final' | 'design_launching' | 'design_late' | 'no_design' | 'no_creation_record' | 'experiment_effort_roster' | 'experiment_no_probe' | 'experiment_too_few_seats' | 'plan_experiment_arms' | 'plan_rerun' | 'unknown_log' | 'plan_invites' | 'invite_world' | 'invite_series' | 'too_many_open_worlds' | 'no_invite' | 'invite_fixed' | 'bad_invite' | 'never_played' | 'run_playing' | 'study_playing' | 'bad_note' | 'note_too_long' | 'unknown_set' | 'unknown_setup' | 'bad_set' | 'set_full' | 'series_trial' | 'in_another_set' | 'guest_seats' | 'set_empty' | 'run_launching' | 'internal_error';
8
+ export type ErrorCode = 'token_required' | 'scope_required' | 'plan_api' | 'rate_limited' | 'handover' | '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' | 'bad_loss_tolerance' | '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_running' | 'bad_cancel_reason' | 'cancel_reason_fixed' | 'bad_replaced_by' | 'experiment_arms' | 'bad_experiment' | 'experiment_scenario' | 'bad_game' | 'bad_arena' | 'experiment_world_only' | 'experiment_same_arms' | 'experiment_env_seed' | 'experiment_stopping' | 'bad_metric' | 'bad_design' | 'design_final' | 'design_launching' | 'design_late' | 'no_design' | 'no_creation_record' | 'experiment_effort_roster' | 'experiment_no_probe' | 'experiment_too_few_seats' | 'plan_experiment_arms' | 'plan_rerun' | 'unknown_log' | 'plan_invites' | 'invite_world' | 'invite_series' | 'too_many_open_worlds' | 'no_invite' | 'invite_fixed' | 'bad_invite' | 'never_played' | 'run_playing' | 'study_playing' | 'bad_note' | 'note_too_long' | 'unknown_set' | 'unknown_setup' | 'bad_set' | 'set_full' | 'series_trial' | 'in_another_set' | 'guest_seats' | 'set_empty' | '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>;
@@ -130,6 +130,8 @@ export interface Experiment {
130
130
  pilot: boolean;
131
131
  name_commit_min_hex: number;
132
132
  creation_sha256: string | null;
133
+ loss_tolerance: number | null;
134
+ max_total_spend_usd: number | null;
133
135
  seed_source: ExperimentSeedSource;
134
136
  metric: 'fitness_index' | 'rank' | 'survived' | 'index_survival' | 'index_economy' | 'index_social' | 'index_adaptation' | 'index_competitiveness' | 'aggression_per_100_rounds' | 'trades_per_100_rounds' | 'messages_per_100_rounds' | 'map_coverage' | 'witness_sensitivity' | 'compliance_rate' | 'compliance_latency' | 'injection_resistance' | 'output_tokens_per_turn' | 'said_evaluated' | 'aggression_between_seats_per_100_rounds' | 'trades_between_seats_per_100_rounds' | 'betrayals_per_100_rounds' | 'ring_share';
135
137
  secondary_metrics: Array<'fitness_index' | 'rank' | 'survived' | 'index_survival' | 'index_economy' | 'index_social' | 'index_adaptation' | 'index_competitiveness' | 'aggression_per_100_rounds' | 'trades_per_100_rounds' | 'messages_per_100_rounds' | 'map_coverage' | 'witness_sensitivity' | 'compliance_rate' | 'compliance_latency' | 'injection_resistance' | 'output_tokens_per_turn' | 'said_evaluated' | 'aggression_between_seats_per_100_rounds' | 'trades_between_seats_per_100_rounds' | 'betrayals_per_100_rounds' | 'ring_share'>;
@@ -170,13 +172,19 @@ export interface ExperimentReport {
170
172
  analysis_scale: 'metric' | 'negative_rank' | 'log';
171
173
  rule: StoppingRule;
172
174
  rule_text: string;
175
+ loss_tolerance: number | null;
176
+ max_total_spend_usd: number | null;
177
+ focal: ExperimentReportFocal;
173
178
  arms: ExperimentReportArm[];
174
179
  pairs: ExperimentReportPair[];
175
180
  comparisons: ExperimentReportComparison[];
176
181
  secondary: ExperimentReportSecondary[];
177
182
  detectable_gap: ExperimentReportDetectableGap;
178
183
  decision: ExperimentReportDecision;
184
+ completeness: ExperimentReportCompleteness;
185
+ interference: ExperimentReportInterference;
179
186
  verdict: string;
187
+ limitations: ExperimentReportLimitation[];
180
188
  plain: string;
181
189
  what_differed: ExperimentReportWhatDiffered[];
182
190
  cost: Cost;
@@ -293,6 +301,10 @@ export interface ExperimentBody {
293
301
  replicates?: string;
294
302
  /** With replicates only: the spend cap of each arm in USD, clamped to the plan’s range (default the plan’s own). The original’s caps were its owner’s and are not carried. An ordinary experiment sets a cap on each arm instead. */
295
303
  max_spend_usd?: number;
304
+ /** The declared read: how many trials a comparison may lose before it reads incomplete and renders no verdict. A trial is lost when an arm’s trial failed or was cancelled, lost a seat to an error, stopped short of its season at its spend cap, was picked up mid-match by a new server release, or measured nothing on the metric. No lost trial is ever replaced and no trial is added: the design plays the trials it declared and reads what it has. From 0 up to the trials less three, the pairs a verdict needs (bad_loss_tolerance otherwise). Default: a tenth of the trials, rounded down. The experiment and its report carry it as loss_tolerance and print it in rule_text; a comparison past it reads reason incomplete with verdict null, and every comparison carries lost and, with lost pairs, tipping. */
305
+ loss_tolerance?: number;
306
+ /** The study’s spend cap in USD over every arm and trial, declared now. Once the trials played so far have spent it, nothing still in line starts: what is left is cancelled under the cap (never as your doing) and the experiment ends with stop_reason spend_cap; a trial already playing runs to its own per-run cap. The trials it stops count as lost against loss_tolerance. At least 0.5 (bad_spend_cap otherwise). Default none: each arm’s own max_spend_usd still bounds each trial. */
307
+ max_total_spend_usd?: number;
296
308
  }
297
309
  export interface ExperimentArm {
298
310
  /** How the report names this arm. Default arm 1, arm 2, ...; labels must be distinct. */
@@ -810,6 +822,11 @@ export interface ExperimentDesign {
810
822
  standing: 'declared' | 'named' | 'after';
811
823
  name_prefix: string | null;
812
824
  }
825
+ export interface ExperimentReportFocal {
826
+ seats: number[] | null;
827
+ background: number[];
828
+ text: string;
829
+ }
813
830
  export interface ExperimentReportArm {
814
831
  index: number;
815
832
  label: string;
@@ -819,10 +836,12 @@ export interface ExperimentReportArm {
819
836
  differs_from_control: string[];
820
837
  trials: ExperimentReportArmTrials;
821
838
  score: ExperimentReportArmScore | null;
839
+ background: ExperimentReportArmBackground | null;
822
840
  cost_usd: number;
823
841
  agent_turns: number;
824
842
  usage: JsonObject;
825
843
  awareness: JsonObject;
844
+ health: ExperimentReportArmHealth;
826
845
  effort?: ExperimentReportArmEffort;
827
846
  contact?: ExperimentReportArmContact;
828
847
  }
@@ -840,6 +859,34 @@ export interface ExperimentReportArmScore {
840
859
  sd: number | null;
841
860
  ci: Interval | null;
842
861
  }
862
+ export interface ExperimentReportArmBackground {
863
+ seats: number;
864
+ mean: number;
865
+ iqm: number;
866
+ median: number;
867
+ sd: number | null;
868
+ ci: Interval | null;
869
+ }
870
+ export interface ExperimentReportArmHealth {
871
+ measured_seats: number;
872
+ calls: number;
873
+ error_turns: number;
874
+ provider_retries: ExperimentReportArmHealthProviderRetries | null;
875
+ world_rejections: ExperimentReportArmHealthWorldRejections | null;
876
+ }
877
+ export interface ExperimentReportArmHealthProviderRetries {
878
+ seats: number;
879
+ calls: number;
880
+ retries: number;
881
+ wait_ms: number;
882
+ causes: JsonObject;
883
+ }
884
+ export interface ExperimentReportArmHealthWorldRejections {
885
+ seats: number;
886
+ turn_budget: number;
887
+ pace: number;
888
+ invalid: number;
889
+ }
843
890
  export interface ExperimentReportArmEffort {
844
891
  measured_seats: number;
845
892
  short_seats: number;
@@ -887,6 +934,8 @@ export interface ExperimentReportComparison {
887
934
  detail: string;
888
935
  exact: ExactCheck | null;
889
936
  by_world: WorldReading | null;
937
+ lost: number;
938
+ tipping: ExperimentReportComparisonTipping | null;
890
939
  }
891
940
  export interface ExactCheck {
892
941
  unit: 'pair' | 'world';
@@ -899,6 +948,19 @@ export interface WorldReading {
899
948
  repeated: number;
900
949
  interval: Interval | null;
901
950
  }
951
+ export interface ExperimentReportComparisonTipping {
952
+ lost: number;
953
+ pairs: number;
954
+ against: 'arm_better' | 'control_better' | 'undecided';
955
+ to_undo: number | null;
956
+ to_decide: ExperimentReportComparisonTippingToDecide | null;
957
+ widest_seen: number;
958
+ text: string;
959
+ }
960
+ export interface ExperimentReportComparisonTippingToDecide {
961
+ arm: number | null;
962
+ control: number | null;
963
+ }
902
964
  export interface ExperimentReportSecondary {
903
965
  metric: 'fitness_index' | 'rank' | 'survived' | 'index_survival' | 'index_economy' | 'index_social' | 'index_adaptation' | 'index_competitiveness' | 'aggression_per_100_rounds' | 'trades_per_100_rounds' | 'messages_per_100_rounds' | 'map_coverage' | 'witness_sensitivity' | 'compliance_rate' | 'compliance_latency' | 'injection_resistance' | 'output_tokens_per_turn' | 'said_evaluated' | 'aggression_between_seats_per_100_rounds' | 'trades_between_seats_per_100_rounds' | 'betrayals_per_100_rounds' | 'ring_share';
904
966
  analysis_scale: 'metric' | 'negative_rank' | 'log';
@@ -945,6 +1007,36 @@ export interface ExperimentReportDecision {
945
1007
  reason: string;
946
1008
  summary: string;
947
1009
  }
1010
+ export interface ExperimentReportCompleteness {
1011
+ state: 'complete' | 'incomplete' | 'pending';
1012
+ why: 'losses' | 'spend_cap' | 'cancelled' | null;
1013
+ trials: number;
1014
+ loss_tolerance: number | null;
1015
+ lost: number;
1016
+ spend: ExperimentReportCompletenessSpend;
1017
+ text: string;
1018
+ }
1019
+ export interface ExperimentReportCompletenessSpend {
1020
+ cap_usd: number | null;
1021
+ spent_usd: number;
1022
+ reached: boolean;
1023
+ }
1024
+ export interface ExperimentReportInterference {
1025
+ per_arm: ExperimentReportInterferencePerArm[];
1026
+ reading: 'alike' | 'uneven' | 'unread';
1027
+ text: string;
1028
+ }
1029
+ export interface ExperimentReportInterferencePerArm {
1030
+ arm: number;
1031
+ label: string;
1032
+ calls: number;
1033
+ retries: number;
1034
+ per_100_calls: number | null;
1035
+ }
1036
+ export interface ExperimentReportLimitation {
1037
+ kind: 'construct' | 'access' | 'sample' | 'selection' | 'version' | 'measurement' | 'scope';
1038
+ text: string;
1039
+ }
948
1040
  export interface ExperimentReportWhatDiffered {
949
1041
  arm: number;
950
1042
  label: string;
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.18";
3
+ export declare const VERSION = "0.2.20";
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.18';
3
+ export const VERSION = '0.2.20';
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.18",
3
+ "version": "0.2.20",
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",