runbios-sdk 0.2.1-dev.120 → 0.2.1-dev.126

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-dev.120";
39
+ export declare const VERSION = "0.2.1-dev.126";
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-dev.120';
39
+ export const VERSION = '0.2.1-dev.126';
40
40
  export class RunBiOS {
41
41
  /** Search models, fetch configs, check adapter compatibility. */
42
42
  models;
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../client.js';
2
- import type { LoopTrace, LoopTraceListResponse, LoopTraceListParams, LoopCaptureParams, LoopCaptureResult, LoopImportParams, LoopImportResult, LoopSignal, LoopSignalParams, LoopCandidate, LoopCandidateParams, LoopGrader, LoopGraderParams, LoopLabel, LoopLabelCount, LoopGradeResult, LoopDataset, LoopDatasetListParams, LoopDatasetItem, LoopDatasetCreateParams, LoopConfig, LoopConfigParams, LoopStats, LoopJudge, LoopJudgeParams, LoopJudgeRun, LoopJudgeWork, LoopJudgeVerdict, LoopJudgeVerdictResult } from '../types.js';
2
+ import type { LoopTrace, LoopTraceListResponse, LoopTraceListParams, LoopCaptureParams, LoopCaptureResult, LoopImportParams, LoopImportResult, LoopSignal, LoopSignalParams, LoopCandidate, LoopCandidateParams, LoopGrader, LoopGraderParams, LoopLabel, LoopLabelCount, LoopGradeResult, LoopDataset, LoopDatasetListParams, LoopDatasetItem, LoopDatasetCreateParams, LoopConfig, LoopConfigParams, LoopBuildRule, LoopBuildRuleParams, LoopStats, LoopJudge, LoopJudgeParams, LoopJudgeRun, LoopJudgeWork, LoopJudgeVerdict, LoopJudgeVerdictResult } from '../types.js';
3
3
  /**
4
4
  * The Conscious Loop -- capture what your model was asked and answered, record
5
5
  * whether it was right, and turn those judgements into training data.
@@ -238,6 +238,32 @@ export declare class Loop {
238
238
  */
239
239
  createDataset(params: LoopDatasetCreateParams): Promise<LoopDataset>;
240
240
  /** List training sets, newest first. */
241
+ /**
242
+ * Stand up a rule that builds a set whenever enough new work exists.
243
+ *
244
+ * The manual path asks somebody to notice that enough conversations have
245
+ * been reviewed, remember which filters describe the slice they want, and
246
+ * press build — every time. A rule is that instruction, stored.
247
+ *
248
+ * `spec` is the same selection `createDataset` takes and is replayed
249
+ * verbatim, so an automatic set is identical to a hand-made one.
250
+ *
251
+ * `min_new_rows` counts only work reviewed SINCE THE LAST BUILD. Counting
252
+ * the whole corpus would fire the rule every interval forever, because a
253
+ * total that has crossed a threshold stays across it.
254
+ */
255
+ createBuildRule(params: LoopBuildRuleParams): Promise<LoopBuildRule>;
256
+ /**
257
+ * Every build rule, with what each one last did and why.
258
+ *
259
+ * `last_reason` is the field worth reading: a rule quiet because it is
260
+ * waiting looks exactly like one quiet because it is broken.
261
+ */
262
+ listBuildRules(): Promise<LoopBuildRule[]>;
263
+ /** Stop a standing build rule. Sets it already produced are untouched. */
264
+ deleteBuildRule(id: string): Promise<{
265
+ deleted: boolean;
266
+ }>;
241
267
  listDatasets(params?: LoopDatasetListParams): Promise<LoopDataset[]>;
242
268
  /** Read one training set and its curation report. */
243
269
  getDataset(id: string): Promise<LoopDataset>;
@@ -113,6 +113,10 @@ export class Loop {
113
113
  if (k && v)
114
114
  q.append('attr', `${k}:${v}`);
115
115
  }
116
+ if (params.model)
117
+ q.set('model', params.model);
118
+ if (params.origin)
119
+ q.set('origin', params.origin);
116
120
  if (params.unlabelled)
117
121
  q.set('unlabelled', 'true');
118
122
  if (params.limit != null)
@@ -309,6 +313,39 @@ export class Loop {
309
313
  return res.dataset;
310
314
  }
311
315
  /** List training sets, newest first. */
316
+ // ── build rules ───────────────────────────────────────────────────────
317
+ /**
318
+ * Stand up a rule that builds a set whenever enough new work exists.
319
+ *
320
+ * The manual path asks somebody to notice that enough conversations have
321
+ * been reviewed, remember which filters describe the slice they want, and
322
+ * press build — every time. A rule is that instruction, stored.
323
+ *
324
+ * `spec` is the same selection `createDataset` takes and is replayed
325
+ * verbatim, so an automatic set is identical to a hand-made one.
326
+ *
327
+ * `min_new_rows` counts only work reviewed SINCE THE LAST BUILD. Counting
328
+ * the whole corpus would fire the rule every interval forever, because a
329
+ * total that has crossed a threshold stays across it.
330
+ */
331
+ async createBuildRule(params) {
332
+ const res = await this._http.fetchPost('/api/loop/build-rules', params);
333
+ return res.rule;
334
+ }
335
+ /**
336
+ * Every build rule, with what each one last did and why.
337
+ *
338
+ * `last_reason` is the field worth reading: a rule quiet because it is
339
+ * waiting looks exactly like one quiet because it is broken.
340
+ */
341
+ async listBuildRules() {
342
+ const res = await this._http.fetchGet('/api/loop/build-rules');
343
+ return res.rules ?? [];
344
+ }
345
+ /** Stop a standing build rule. Sets it already produced are untouched. */
346
+ async deleteBuildRule(id) {
347
+ return this._http.fetchDelete(`/api/loop/build-rules/${encodeURIComponent(id)}`);
348
+ }
312
349
  async listDatasets(params = {}) {
313
350
  const q = new URLSearchParams();
314
351
  if (params.method)
@@ -69,6 +69,10 @@ function buildTrainingRequest(params) {
69
69
  body.network_volume_id = params.networkVolumeId;
70
70
  if (params.datasetSampleLimits !== undefined)
71
71
  body.dataset_sample_limits = params.datasetSampleLimits;
72
+ if (params.datasetSampling !== undefined)
73
+ body.dataset_sampling = params.datasetSampling;
74
+ if (params.datasetSamplingStrategy !== undefined)
75
+ body.dataset_sampling_strategy = params.datasetSamplingStrategy;
72
76
  if (params.datasetMixing !== undefined)
73
77
  body.dataset_mixing = params.datasetMixing;
74
78
  if (params.mixing !== undefined)
package/dist/types.d.ts CHANGED
@@ -548,6 +548,21 @@ export interface TrainingCreateParams {
548
548
  * large dataset without importing a trimmed copy.
549
549
  */
550
550
  datasetSampleLimits?: Record<string, number>;
551
+ /**
552
+ * Per-dataset sampling (key = a dataset ID from datasetIds): exactly one of
553
+ * `rows` or `percent` (of the dataset's usable rows for this method). Asking
554
+ * for more than the dataset holds uses every usable row and the run says
555
+ * so. Resolved to a row count identically by preflight and create, recorded
556
+ * in the mix manifest, and reproduced exactly on resume.
557
+ */
558
+ datasetSampling?: Record<string, DatasetSampling>;
559
+ /**
560
+ * How sampled rows are chosen: `first` (default) keeps the first N usable
561
+ * rows in file order -- what a curriculum wants; `random` draws a seeded
562
+ * uniform sample of the usable rows (kept in file order, seed = the mixing
563
+ * plan's seed, so a resume draws the same rows).
564
+ */
565
+ datasetSamplingStrategy?: 'first' | 'random';
551
566
  /** Training method. */
552
567
  method: TrainingMethod;
553
568
  /** Adapter type. */
@@ -1211,6 +1226,12 @@ export interface GPUPricingResponse {
1211
1226
  stale?: boolean;
1212
1227
  stale_message?: string;
1213
1228
  }
1229
+ /** One dataset's sampling request: exactly one of rows or percent. */
1230
+ export interface DatasetSampling {
1231
+ rows?: number;
1232
+ /** Percent (0-100) of the dataset's usable rows for the training method. */
1233
+ percent?: number;
1234
+ }
1214
1235
  /** Parameters understood by the authenticated training GPU-options endpoint. */
1215
1236
  export interface GPUOptionsParams {
1216
1237
  modelId: string;
@@ -2286,6 +2307,10 @@ export interface LoopTraceListParams {
2286
2307
  unlabelled?: boolean;
2287
2308
  limit?: number;
2288
2309
  offset?: number;
2310
+ /** Only what ONE model answered — the filter distillation is made of. */
2311
+ model?: string;
2312
+ /** `captured` (our model's own behaviour) or `imported` (a file somebody brought). */
2313
+ origin?: 'captured' | 'imported';
2289
2314
  }
2290
2315
  export interface LoopTraceListResponse {
2291
2316
  traces: LoopTrace[];
@@ -2314,6 +2339,10 @@ export interface LoopDatasetCreateParams {
2314
2339
  attributes?: Record<string, string>;
2315
2340
  /** Only the conversations nobody has described yet. */
2316
2341
  unlabelled?: boolean;
2342
+ /** Only what ONE model answered — the filter distillation is made of. */
2343
+ model?: string;
2344
+ /** `captured` (our model's own behaviour) or `imported` (a file somebody brought). */
2345
+ origin?: 'captured' | 'imported';
2317
2346
  }
2318
2347
  export interface LoopDataset {
2319
2348
  id: string;
@@ -2357,12 +2386,54 @@ export interface LoopConfig {
2357
2386
  enabled_by: string | null;
2358
2387
  enabled_at: string | null;
2359
2388
  updated_at: string;
2389
+ auto_grade: boolean;
2390
+ }
2391
+ export interface LoopBuildRuleParams {
2392
+ name: string;
2393
+ method: string;
2394
+ /**
2395
+ * How many rows reviewed SINCE THE LAST BUILD must exist before this fires
2396
+ * again. Minimum 10. Counting the whole corpus instead would fire the rule
2397
+ * every interval forever, because a total that has crossed a threshold stays
2398
+ * across it.
2399
+ */
2400
+ min_new_rows?: number;
2401
+ enabled?: boolean;
2402
+ /** The same selection `createDataset` takes, replayed verbatim. */
2403
+ spec?: LoopDatasetCreateParams;
2404
+ }
2405
+ export interface LoopBuildRule {
2406
+ id: string;
2407
+ workspace_id: string;
2408
+ name: string;
2409
+ method: string;
2410
+ spec: Record<string, unknown>;
2411
+ min_new_rows: number;
2412
+ enabled: boolean;
2413
+ last_built_at: string | null;
2414
+ last_dataset_id: string | null;
2415
+ /**
2416
+ * Why the rule did not fire last time it was checked. A rule quiet because
2417
+ * it is waiting looks exactly like one quiet because it is broken; this is
2418
+ * the difference.
2419
+ */
2420
+ last_reason: string | null;
2421
+ last_checked_at: string | null;
2422
+ created_by: string | null;
2423
+ created_at: string;
2424
+ updated_at: string;
2360
2425
  }
2361
2426
  export interface LoopConfigParams {
2362
2427
  enabled: boolean;
2363
2428
  retention_days?: number;
2364
2429
  /** Deterministic per conversation, so turns are never split. 0 < rate <= 1. */
2365
2430
  sample_rate?: number;
2431
+ /**
2432
+ * Continuous rule-based scoring for this source. OMITTED MEANS UNCHANGED:
2433
+ * a caller saving retention must not switch grading off for a workspace
2434
+ * that turned it on.
2435
+ */
2436
+ auto_grade?: boolean;
2366
2437
  }
2367
2438
  /** One thing a judge scores, separately from the others. */
2368
2439
  export interface LoopJudgeDimension {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runbios-sdk",
3
- "version": "0.2.1-dev.120",
3
+ "version": "0.2.1-dev.126",
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",