runbios-sdk 0.2.1-rc.130 → 0.2.1-rc.138

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/dist/index.d.ts CHANGED
@@ -36,7 +36,7 @@ import { Loop } from './resources/loop.js';
36
36
  * SDK version. Sent as part of the User-Agent header.
37
37
  * Must match package.json "version" -- enforced by a contract test.
38
38
  */
39
- export declare const VERSION = "0.2.1-rc.130";
39
+ export declare const VERSION = "0.2.1-rc.138";
40
40
  export declare class RunBiOS {
41
41
  /** Search models, fetch configs, check adapter compatibility. */
42
42
  readonly models: Models;
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import { Loop } from './resources/loop.js';
36
36
  * SDK version. Sent as part of the User-Agent header.
37
37
  * Must match package.json "version" -- enforced by a contract test.
38
38
  */
39
- export const VERSION = '0.2.1-rc.130';
39
+ export const VERSION = '0.2.1-rc.138';
40
40
  export class RunBiOS {
41
41
  /** Search models, fetch configs, check adapter compatibility. */
42
42
  models;
@@ -312,6 +312,13 @@ export declare class Loop {
312
312
  * twice the weight, and the combined score is the weighted mean over the
313
313
  * rules that actually applied.
314
314
  *
315
+ * `matches_gold` needs no `expected`: it compares each answer to the gold
316
+ * answer recorded on that same conversation, or the human correction when
317
+ * there is no gold, and scores sampled alternatives against the same gold.
318
+ * A conversation with neither is skipped, not failed, so one rule checks
319
+ * every labelled question without punishing the unlabelled ones. An
320
+ * optional `tolerance` widens the match when both sides are bare numbers.
321
+ *
315
322
  * A caution worth knowing before you write a set: a rule made only of
316
323
  * `forbidden` phrases is satisfied VACUOUSLY by an answer that says nothing.
317
324
  * Pair it with a `required` phrase, or you are rewarding silence.
@@ -408,15 +415,27 @@ export declare class Loop {
408
415
  */
409
416
  agentStatus(): Promise<LoopAgentStatus>;
410
417
  /**
411
- * Turn the agent on: mints the workspace's managed serverless key. After
412
- * this, automatic judges and sample runs make model calls billed to the
418
+ * Turn the agent on: mints the workspace's managed serverless key and
419
+ * resumes the automatic judges a previous turn-off paused. After this,
420
+ * automatic judges and sample runs make model calls billed to the
413
421
  * workspace. Idempotent.
422
+ *
423
+ * `monthly_spend_cap_cents` caps what that key may spend on model calls in
424
+ * a calendar month. Omitted = no cap on a fresh key, and an existing cap is
425
+ * left as it is; sent while the agent is already on, it moves the cap on
426
+ * the existing key without minting a new one. When the cap is reached the
427
+ * agent's model calls are refused until next month and its runs pause with
428
+ * that reason.
414
429
  */
415
- enableAgent(): Promise<LoopAgentCredential>;
430
+ enableAgent(opts?: {
431
+ monthly_spend_cap_cents?: number;
432
+ }): Promise<LoopAgentCredential>;
416
433
  /**
417
- * Turn the agent off: revokes its key and sets every automatic judge back to
418
- * manual. Open runs stop where they are and continue if it is turned back
419
- * on. Nothing already scored or written is removed.
434
+ * Turn the agent off: revokes its key and pauses every automatic judge in
435
+ * the workspace (`judges_paused`; each judge shows `auto_paused`). Turning
436
+ * it back on resumes exactly those judges. Open runs stop where they are
437
+ * and continue if it is turned back on. Nothing already scored or written
438
+ * is removed.
420
439
  */
421
440
  disableAgent(): Promise<{
422
441
  revoked: boolean;
@@ -417,6 +417,13 @@ export class Loop {
417
417
  * twice the weight, and the combined score is the weighted mean over the
418
418
  * rules that actually applied.
419
419
  *
420
+ * `matches_gold` needs no `expected`: it compares each answer to the gold
421
+ * answer recorded on that same conversation, or the human correction when
422
+ * there is no gold, and scores sampled alternatives against the same gold.
423
+ * A conversation with neither is skipped, not failed, so one rule checks
424
+ * every labelled question without punishing the unlabelled ones. An
425
+ * optional `tolerance` widens the match when both sides are bare numbers.
426
+ *
420
427
  * A caution worth knowing before you write a set: a rule made only of
421
428
  * `forbidden` phrases is satisfied VACUOUSLY by an answer that says nothing.
422
429
  * Pair it with a `required` phrase, or you are rewarding silence.
@@ -579,18 +586,31 @@ export class Loop {
579
586
  return this._http.fetchGet('/api/loop/agent');
580
587
  }
581
588
  /**
582
- * Turn the agent on: mints the workspace's managed serverless key. After
583
- * this, automatic judges and sample runs make model calls billed to the
589
+ * Turn the agent on: mints the workspace's managed serverless key and
590
+ * resumes the automatic judges a previous turn-off paused. After this,
591
+ * automatic judges and sample runs make model calls billed to the
584
592
  * workspace. Idempotent.
593
+ *
594
+ * `monthly_spend_cap_cents` caps what that key may spend on model calls in
595
+ * a calendar month. Omitted = no cap on a fresh key, and an existing cap is
596
+ * left as it is; sent while the agent is already on, it moves the cap on
597
+ * the existing key without minting a new one. When the cap is reached the
598
+ * agent's model calls are refused until next month and its runs pause with
599
+ * that reason.
585
600
  */
586
- async enableAgent() {
587
- const res = await this._http.fetchPost('/api/loop/agent', {});
601
+ async enableAgent(opts = {}) {
602
+ const body = {};
603
+ if (opts.monthly_spend_cap_cents != null)
604
+ body.monthly_spend_cap_cents = opts.monthly_spend_cap_cents;
605
+ const res = await this._http.fetchPost('/api/loop/agent', body);
588
606
  return res.credential;
589
607
  }
590
608
  /**
591
- * Turn the agent off: revokes its key and sets every automatic judge back to
592
- * manual. Open runs stop where they are and continue if it is turned back
593
- * on. Nothing already scored or written is removed.
609
+ * Turn the agent off: revokes its key and pauses every automatic judge in
610
+ * the workspace (`judges_paused`; each judge shows `auto_paused`). Turning
611
+ * it back on resumes exactly those judges. Open runs stop where they are
612
+ * and continue if it is turned back on. Nothing already scored or written
613
+ * is removed.
594
614
  */
595
615
  async disableAgent() {
596
616
  return this._http.fetchDelete('/api/loop/agent');
package/dist/types.d.ts CHANGED
@@ -701,6 +701,13 @@ export interface TrainingJob {
701
701
  status: TrainingJobStatus;
702
702
  error_message?: string | null;
703
703
  error_code?: string | null;
704
+ /**
705
+ * Who ended a `stopped` run: `user` (Stop button, API, queue cancel) or
706
+ * `platform` (wallet exhausted, account block). Empty when the run is not
707
+ * stopped, or was stopped before this was recorded. A `failed` run is a
708
+ * different fact and never carries a stop origin.
709
+ */
710
+ stop_origin?: 'user' | 'platform' | '';
704
711
  current_step?: number;
705
712
  total_steps?: number;
706
713
  current_loss?: number | null;
@@ -2236,10 +2243,27 @@ export interface LoopImportResult {
2236
2243
  */
2237
2244
  reviewed: number;
2238
2245
  needs_review: number;
2246
+ /**
2247
+ * How many rows could not be READ as a conversation. The file's shape is
2248
+ * wrong, and changing the file is what fixes it.
2249
+ */
2239
2250
  refused: number;
2251
+ /**
2252
+ * How many rows were understood and then could not be stored. Counted apart
2253
+ * from `refused`, because the two are different claims and rewriting a file
2254
+ * that was already correct fixes nothing. A call with any of these fails
2255
+ * rather than succeeding, and the failure carries these same fields.
2256
+ */
2257
+ not_saved?: number;
2240
2258
  /** How many rows of each recognised shape, so a mis-shaped file is visible. */
2241
2259
  by_shape: Record<string, number>;
2242
2260
  refused_why: Record<string, number>;
2261
+ /**
2262
+ * The conversations this call created, in file order. Without them a caller
2263
+ * whose import half-failed has a number and no way to reach what landed: no
2264
+ * way to label it, review it, or delete it and start again.
2265
+ */
2266
+ trace_ids?: string[];
2243
2267
  notes: string[];
2244
2268
  }
2245
2269
  export interface LoopSignal {
@@ -2520,6 +2544,13 @@ export interface LoopAgentCredential {
2520
2544
  last_used_at: string | null;
2521
2545
  last_error: string | null;
2522
2546
  revoked_at: string | null;
2547
+ /**
2548
+ * The most the agent's key may spend on model calls in a calendar month,
2549
+ * in cents. `null` = no cap (the default): the agent can spend up to the
2550
+ * workspace's serverless balance. Once reached, the agent's model calls
2551
+ * are refused until next month and its runs pause with that reason.
2552
+ */
2553
+ monthly_spend_cap_cents: number | null;
2523
2554
  }
2524
2555
  export interface LoopAgentStatus {
2525
2556
  /** An agent can exist in this environment at all. */
@@ -2658,8 +2689,16 @@ export interface LoopCandidate {
2658
2689
  metadata: Record<string, unknown>;
2659
2690
  created_at: string;
2660
2691
  }
2661
- /** The deterministic checks a grader can perform. */
2662
- export type LoopGraderKind = 'exact_match' | 'contains' | 'regex' | 'json_valid' | 'numeric' | 'tool_called';
2692
+ /**
2693
+ * The deterministic checks a grader can perform.
2694
+ *
2695
+ * `matches_gold` is the one kind with no expected value of its own: it
2696
+ * compares each answer to the gold answer recorded on that same conversation
2697
+ * (or the human correction when there is no gold), scores sampled
2698
+ * alternatives against the same gold, and is NOT APPLIED to a conversation
2699
+ * that carries neither, so it never marks down an unlabelled answer.
2700
+ */
2701
+ export type LoopGraderKind = 'matches_gold' | 'exact_match' | 'contains' | 'regex' | 'json_valid' | 'numeric' | 'tool_called';
2663
2702
  export interface LoopGraderConfig {
2664
2703
  expected?: string;
2665
2704
  /** Every phrase that must appear. */
@@ -2669,7 +2708,10 @@ export interface LoopGraderConfig {
2669
2708
  pattern?: string;
2670
2709
  /** Keys the answer must carry, for `json_valid`. */
2671
2710
  keys?: string[];
2672
- /** How far from `expected` still counts, for `numeric`. */
2711
+ /**
2712
+ * How far from `expected` still counts, for `numeric`. For `matches_gold`,
2713
+ * how far from the gold answer still counts when both are bare numbers.
2714
+ */
2673
2715
  tolerance?: number;
2674
2716
  /** The function that must have been called, for `tool_called`. */
2675
2717
  function?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runbios-sdk",
3
- "version": "0.2.1-rc.130",
3
+ "version": "0.2.1-rc.138",
4
4
  "description": "Official TypeScript SDK for the Run BiOS training and deployment platform API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",