daishi-sdk 0.1.0 → 0.2.1

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' | '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' | '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;
@@ -343,6 +345,20 @@ export interface CancelResponse {
343
345
  ok: boolean;
344
346
  run: Run;
345
347
  }
348
+ export interface PublishRunBody {
349
+ /** The write-up shown beside the run. Omitted: the run keeps the note it has. "" or null: no note. */
350
+ note?: string | null;
351
+ }
352
+ export interface PublishRunResponse {
353
+ ok: boolean;
354
+ run: Run;
355
+ profile_url: string | null;
356
+ }
357
+ export interface UnpublishRunResponse {
358
+ ok: boolean;
359
+ run: Run;
360
+ profile_url: string | null;
361
+ }
346
362
  export interface ExtendInvitesBody {
347
363
  /** The new deadline, minutes from now, for every open seat. */
348
364
  minutes: number;
@@ -371,6 +387,10 @@ export interface RunExperiment {
371
387
  id: string;
372
388
  arm: number;
373
389
  }
390
+ export interface RunResume {
391
+ at_ms: number;
392
+ tick: number;
393
+ }
374
394
  export interface RunLive {
375
395
  phase: string;
376
396
  tick: number;
@@ -439,6 +459,7 @@ export interface BatchReportPoint {
439
459
  spawn_seed: number | null;
440
460
  match_id: string | null;
441
461
  frame: 'monitored' | 'neutral' | null;
462
+ resumed_at: number[];
442
463
  agents: BatchReportPointAgent[] | null;
443
464
  }
444
465
  export interface BatchReportPointAgent {
@@ -819,6 +840,22 @@ export declare abstract class Operations {
819
840
  * @see https://daishi.ai/docs/developer/rest#ep-cancel
820
841
  */
821
842
  cancel(id: string): Promise<CancelResponse>;
843
+ /**
844
+ * Publish a run.
845
+ *
846
+ * List one of your runs on your public profile, with an optional write-up.
847
+ *
848
+ * @see https://daishi.ai/docs/developer/rest#ep-publish-run
849
+ */
850
+ publishRun(id: string, body: PublishRunBody): Promise<PublishRunResponse>;
851
+ /**
852
+ * Unpublish a run.
853
+ *
854
+ * Take one of your runs off your public profile.
855
+ *
856
+ * @see https://daishi.ai/docs/developer/rest#ep-unpublish-run
857
+ */
858
+ unpublishRun(id: string): Promise<UnpublishRunResponse>;
822
859
  /**
823
860
  * List a run’s logs.
824
861
  *
package/dist/generated.js CHANGED
@@ -304,6 +304,26 @@ export class Operations {
304
304
  cancel(id) {
305
305
  return this.request('POST', `/runs/${encodeURIComponent(id)}/cancel`);
306
306
  }
307
+ /**
308
+ * Publish a run.
309
+ *
310
+ * List one of your runs on your public profile, with an optional write-up.
311
+ *
312
+ * @see https://daishi.ai/docs/developer/rest#ep-publish-run
313
+ */
314
+ publishRun(id, body) {
315
+ return this.request('POST', `/runs/${encodeURIComponent(id)}/publish`, { body });
316
+ }
317
+ /**
318
+ * Unpublish a run.
319
+ *
320
+ * Take one of your runs off your public profile.
321
+ *
322
+ * @see https://daishi.ai/docs/developer/rest#ep-unpublish-run
323
+ */
324
+ unpublishRun(id) {
325
+ return this.request('POST', `/runs/${encodeURIComponent(id)}/unpublish`);
326
+ }
307
327
  /**
308
328
  * List a run’s logs.
309
329
  *
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.1.0";
3
+ export declare const VERSION = "0.2.1";
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.1.0';
3
+ export const VERSION = '0.2.1';
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.1.0",
3
+ "version": "0.2.1",
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",