daishi-sdk 0.2.18 → 0.2.19

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,12 +172,16 @@ 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;
173
177
  arms: ExperimentReportArm[];
174
178
  pairs: ExperimentReportPair[];
175
179
  comparisons: ExperimentReportComparison[];
176
180
  secondary: ExperimentReportSecondary[];
177
181
  detectable_gap: ExperimentReportDetectableGap;
178
182
  decision: ExperimentReportDecision;
183
+ completeness: ExperimentReportCompleteness;
184
+ interference: ExperimentReportInterference;
179
185
  verdict: string;
180
186
  plain: string;
181
187
  what_differed: ExperimentReportWhatDiffered[];
@@ -293,6 +299,10 @@ export interface ExperimentBody {
293
299
  replicates?: string;
294
300
  /** 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
301
  max_spend_usd?: number;
302
+ /** 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. */
303
+ loss_tolerance?: number;
304
+ /** 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. */
305
+ max_total_spend_usd?: number;
296
306
  }
297
307
  export interface ExperimentArm {
298
308
  /** How the report names this arm. Default arm 1, arm 2, ...; labels must be distinct. */
@@ -823,6 +833,7 @@ export interface ExperimentReportArm {
823
833
  agent_turns: number;
824
834
  usage: JsonObject;
825
835
  awareness: JsonObject;
836
+ health: ExperimentReportArmHealth;
826
837
  effort?: ExperimentReportArmEffort;
827
838
  contact?: ExperimentReportArmContact;
828
839
  }
@@ -840,6 +851,26 @@ export interface ExperimentReportArmScore {
840
851
  sd: number | null;
841
852
  ci: Interval | null;
842
853
  }
854
+ export interface ExperimentReportArmHealth {
855
+ measured_seats: number;
856
+ calls: number;
857
+ error_turns: number;
858
+ provider_retries: ExperimentReportArmHealthProviderRetries | null;
859
+ world_rejections: ExperimentReportArmHealthWorldRejections | null;
860
+ }
861
+ export interface ExperimentReportArmHealthProviderRetries {
862
+ seats: number;
863
+ calls: number;
864
+ retries: number;
865
+ wait_ms: number;
866
+ causes: JsonObject;
867
+ }
868
+ export interface ExperimentReportArmHealthWorldRejections {
869
+ seats: number;
870
+ turn_budget: number;
871
+ pace: number;
872
+ invalid: number;
873
+ }
843
874
  export interface ExperimentReportArmEffort {
844
875
  measured_seats: number;
845
876
  short_seats: number;
@@ -887,6 +918,8 @@ export interface ExperimentReportComparison {
887
918
  detail: string;
888
919
  exact: ExactCheck | null;
889
920
  by_world: WorldReading | null;
921
+ lost: number;
922
+ tipping: ExperimentReportComparisonTipping | null;
890
923
  }
891
924
  export interface ExactCheck {
892
925
  unit: 'pair' | 'world';
@@ -899,6 +932,19 @@ export interface WorldReading {
899
932
  repeated: number;
900
933
  interval: Interval | null;
901
934
  }
935
+ export interface ExperimentReportComparisonTipping {
936
+ lost: number;
937
+ pairs: number;
938
+ against: 'arm_better' | 'control_better' | 'undecided';
939
+ to_undo: number | null;
940
+ to_decide: ExperimentReportComparisonTippingToDecide | null;
941
+ widest_seen: number;
942
+ text: string;
943
+ }
944
+ export interface ExperimentReportComparisonTippingToDecide {
945
+ arm: number | null;
946
+ control: number | null;
947
+ }
902
948
  export interface ExperimentReportSecondary {
903
949
  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
950
  analysis_scale: 'metric' | 'negative_rank' | 'log';
@@ -945,6 +991,32 @@ export interface ExperimentReportDecision {
945
991
  reason: string;
946
992
  summary: string;
947
993
  }
994
+ export interface ExperimentReportCompleteness {
995
+ state: 'complete' | 'incomplete' | 'pending';
996
+ why: 'losses' | 'spend_cap' | 'cancelled' | null;
997
+ trials: number;
998
+ loss_tolerance: number | null;
999
+ lost: number;
1000
+ spend: ExperimentReportCompletenessSpend;
1001
+ text: string;
1002
+ }
1003
+ export interface ExperimentReportCompletenessSpend {
1004
+ cap_usd: number | null;
1005
+ spent_usd: number;
1006
+ reached: boolean;
1007
+ }
1008
+ export interface ExperimentReportInterference {
1009
+ per_arm: ExperimentReportInterferencePerArm[];
1010
+ reading: 'alike' | 'uneven' | 'unread';
1011
+ text: string;
1012
+ }
1013
+ export interface ExperimentReportInterferencePerArm {
1014
+ arm: number;
1015
+ label: string;
1016
+ calls: number;
1017
+ retries: number;
1018
+ per_100_calls: number | null;
1019
+ }
948
1020
  export interface ExperimentReportWhatDiffered {
949
1021
  arm: number;
950
1022
  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.19";
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.19';
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.19",
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",