runbios-mcp 0.6.5-rc.412 → 0.6.6-dev.413

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/server.js CHANGED
@@ -306,7 +306,7 @@ function trainingSeqLengthSchema() {
306
306
  // Reuse this exact schema for preflight and create. The helper beneath it
307
307
  // performs the source-dependent checks that a flat MCP input schema cannot.
308
308
  const deploymentCreateToolSchema = {
309
- name: z.string().min(1).max(255).describe("Deployment display name."),
309
+ name: z.string().min(1).max(255).describe("Human-readable name to give the new dedicated deployment. It appears in the workspace deployment list and can be used to search that list."),
310
310
  source_type: z
311
311
  .enum(DEPLOYMENT_SOURCE_TYPES)
312
312
  .describe("Deploy a completed training checkpoint or a base model from the catalog."),
@@ -756,7 +756,7 @@ export function loopSwitchedOffUpdateShape() {
756
756
  pipeline_id: z.string().describe("The pipeline's id (rule_id), from loop_list_pipelines"),
757
757
  workspace_id: z.string().optional().describe("The workspace the pipeline belongs to. Omit to use the key's own workspace."),
758
758
  enabled: z.literal(false).describe("false: switch the pipeline off. Nothing else is accepted while the Conscious Loop is switched off."),
759
- expected_revision: z.number().int().min(0).optional().describe("The revision you read"),
759
+ expected_revision: z.number().int().min(0).optional().describe("Revision number from loop_get_pipeline for this pipeline. Send it to prevent an edit based on stale settings. After REVISION_MISMATCH, read the pipeline again."),
760
760
  };
761
761
  }
762
762
  /* ─── Server setup ─── */
@@ -838,6 +838,10 @@ launchGates = resolveLaunchGates(), allowedTools, consoleUpload = false) {
838
838
  const m = /^\s*([0-9]*\.?[0-9]+)\s*[bB]?\s*$/.exec(v);
839
839
  return m ? m[1] : v;
840
840
  }
841
+ const workspaceDeploymentId = z.string().describe("ID of the dedicated deployment in the current workspace. Use the supplied deployment ID or find it with list_inferences. If create_inference returned a booking handle, poll get_inference_booking for the deployment first.");
842
+ const workspaceJobId = z.string().describe("Identifier of the training run in the current workspace. Use the supplied job ID, the ID returned by create_training_job, or find the run by name with list_training_jobs.");
843
+ const workspaceDatasetId = z.string().describe("ID of the workspace dataset. Use the supplied dataset ID or find it with list_datasets. Use status='all' when locating a dataset that may still be processing or may have failed validation.");
844
+ const jobCheckpointId = z.string().describe("Identifier of the saved model version returned by get_training_checkpoints for this job_id. Match the intended step or best/final flag in that list and pass its checkpoint ID.");
841
845
  const datasetMixingSchema = z.object({
842
846
  mode: z.enum(["sequential", "shuffle", "interleave", "phased"]).describe("How to combine the selected datasets. Use phased to apply different sampling weights over successive portions of training."),
843
847
  seed: z.number().int().min(Number.MIN_SAFE_INTEGER).max(Number.MAX_SAFE_INTEGER).optional().describe("Integer seed for reproducible ordering and sampling."),
@@ -853,7 +857,7 @@ launchGates = resolveLaunchGates(), allowedTools, consoleUpload = false) {
853
857
  // a new LoRA on top of earlier LoRA versions of the same base, oldest first.
854
858
  const startFromSchema = z.object({
855
859
  adapters: z.array(z.object({
856
- job_id: z.string().min(1).describe("The earlier training job"),
860
+ job_id: z.string().min(1).describe("Training job ID from list_training_jobs for the earlier LoRA run that produced this adapter. Its base model and revision must match this new run."),
857
861
  checkpoint_id: z.string().min(1).describe("Its adapter checkpoint, from get_training_checkpoints (format adapter)"),
858
862
  })).min(1).max(64).describe("1 to 64 adapter checkpoints of earlier completed or stopped LoRA jobs in this workspace, on the same model and revision, OLDEST FIRST: the order they are merged into the base. Each earlier job must itself have started from exactly the adapters before it."),
859
863
  export_merged: z.boolean().optional().describe("Also save the base, the adapters and this job's adapter merged into one model: a checkpoint of format merged, which is what deploys (the job's own adapters are refused with CHAINED_ADAPTER_NOT_DEPLOYABLE)."),
@@ -868,7 +872,7 @@ launchGates = resolveLaunchGates(), allowedTools, consoleUpload = false) {
868
872
  dataset_sampling_strategy: z.enum(["first", "random"]).optional().describe("How sampled rows are chosen: 'first' (default) keeps the first N rows in file order (a curriculum); 'random' draws a seeded uniform sample kept in file order."),
869
873
  epochs: z.number().positive().max(1000).optional().describe("Number of training epochs. Governs the full run when max_steps is omitted (the default)."),
870
874
  max_steps: z.number().int().min(1).max(10_000_000).optional().describe("Optional hard step cap that overrides epochs. Omit for no cap and all configured epochs; setting less than one epoch intentionally trains only part of the data."),
871
- learning_rate: z.number().positive().max(1).optional().describe("Learning rate."),
875
+ learning_rate: z.number().positive().max(1).optional().describe("Base optimizer step size for updating model weights during training. Supply a value greater than 0 and at most 1, or omit it to use the training default."),
872
876
  max_seq_length: trainingSeqLengthSchema(),
873
877
  lora_rank: z.number().int().min(1).max(4096).optional().describe("Rank of the low-rank adapter matrices when training with LoRA or QLoRA."),
874
878
  lora_alpha: z.number().positive().max(1_000_000).optional().describe("Adapter scaling parameter for LoRA or QLoRA. Use the model recommendation unless a particular scale is needed."),
@@ -877,7 +881,7 @@ launchGates = resolveLaunchGates(), allowedTools, consoleUpload = false) {
877
881
  scheduler: z
878
882
  .enum(["linear", "cosine", "cosine_with_restarts", "polynomial", "constant", "constant_with_warmup"])
879
883
  .optional()
880
- .describe("Learning-rate scheduler."),
884
+ .describe("How the optimizer changes the learning rate over the run. For example, cosine decays it along a cosine curve and constant keeps it fixed."),
881
885
  job_name: z.string().max(255).optional().describe("Human-readable name that identifies this run in the workspace's training history."),
882
886
  eval_split_ratio: z.number().min(0).max(0.99).optional().describe("Fraction of the training data to reserve for validation. Omit when supplying separate evaluation datasets."),
883
887
  validation_rows: z.number().int().min(0).max(50_000_000).optional()
@@ -1849,7 +1853,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1849
1853
  model_revision: z.string().optional().describe("Pinned model commit, branch or tag; the answer returns the exact immutable revision."),
1850
1854
  integration_id: z.string().optional().describe("Connected Hugging Face integration for gated model sizing."),
1851
1855
  adapter: z.enum(TRAINING_ADAPTERS).optional().describe("Adapter type (default: 'lora')."),
1852
- method: z.enum(["sft", "pt"]).optional().describe("Canonical training method."),
1856
+ method: z.enum(["sft", "pt"]).optional().describe("Training objective to size resources for. Choose sft for supervised fine-tuning on examples or pt for continued pretraining on text."),
1853
1857
  model_params_b: z.number().positive().optional().describe("Optional total-parameter hint in billions."),
1854
1858
  model_active_params_b: z
1855
1859
  .number()
@@ -1873,7 +1877,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1873
1877
  gpu_type: z.string().describe("GPU type from get_recommended_gpu (e.g., 'B300_288GB')"),
1874
1878
  gpu_count: z.number().int().min(1).max(8).optional().describe("GPUs you intend to book (default 1)."),
1875
1879
  adapter: z.enum(TRAINING_ADAPTERS).optional().describe("Adapter type (default: 'lora')."),
1876
- method: z.enum(["sft", "pt"]).optional().describe("Canonical training method (default: 'sft')."),
1880
+ method: z.enum(["sft", "pt"]).optional().describe("Training objective for the estimate. Use sft for supervised fine-tuning on examples (default) or pt for continued pretraining on text."),
1877
1881
  max_length: z.number().int().min(128).max(262144).optional().describe("Training sequence length (default 2048)."),
1878
1882
  num_train_epochs: z.number().positive().optional().describe("Epochs, for the wall-clock estimate."),
1879
1883
  max_steps: z.number().int().positive().optional().describe("Step cap, if you set one."),
@@ -2182,7 +2186,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2182
2186
  /* ══════════════════════════════════════════════════════════════════════════ */
2183
2187
  /* TOOL: get_inference_status */
2184
2188
  /* ══════════════════════════════════════════════════════════════════════════ */
2185
- server.tool("get_inference_status", "Read durable deployment status, desired state, loading progress, endpoint, errors, selected GPU/price cap, queue entry/expiry, notification summary, and wallet-authorization state. Also returns status_summary: the lifecycle phase, the GPU (count x SKU), whether the endpoint may be used, and the queue/GPU state, derived from this same response so a field that is null before the pod reports is not mistaken for 'no GPU' or 'no phase'. A queue deadline keeps status=failed for filter compatibility and sets status_reason/error_code=queue_expired. Treat queued_capacity as waiting and report the endpoint live only when status_summary.endpoint_usable is true. The derived serving settings (serving_mode, model_task, supports_images, context_length) are reported here too — they are platform-chosen, never caller-chosen.", { deployment_id: z.string().describe("Deployment ID.") }, async ({ deployment_id }) => {
2189
+ server.tool("get_inference_status", "Read durable deployment status, desired state, loading progress, endpoint, errors, selected GPU/price cap, queue entry/expiry, notification summary, and wallet-authorization state. Also returns status_summary: the lifecycle phase, the GPU (count x SKU), whether the endpoint may be used, and the queue/GPU state, derived from this same response so a field that is null before the pod reports is not mistaken for 'no GPU' or 'no phase'. A queue deadline keeps status=failed for filter compatibility and sets status_reason/error_code=queue_expired. Treat queued_capacity as waiting and report the endpoint live only when status_summary.endpoint_usable is true. The derived serving settings (serving_mode, model_task, supports_images, context_length) are reported here too — they are platform-chosen, never caller-chosen.", { deployment_id: workspaceDeploymentId }, async ({ deployment_id }) => {
2186
2190
  validateId(deployment_id, "deployment_id");
2187
2191
  const data = await client.api(`/api/inference/${deployment_id}`);
2188
2192
  // Same raw-text class as the training job detail (top-level last_error and
@@ -2199,7 +2203,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2199
2203
  /* TOOL: get_inference_metrics */
2200
2204
  /* ══════════════════════════════════════════════════════════════════════════ */
2201
2205
  server.tool("get_inference_metrics", "Read serving metrics for a deployment: request counts, prompt/generation token totals, cache hit rate, time to first token, inter-token latency, throughput, GPU utilization and memory, KV cache usage, and a recent time series. Counters are lifetime totals; the time series reflects the selected window. Responses are served from a short cache; zeros are real measurements, not missing data.", {
2202
- deployment_id: z.string().describe("Deployment ID."),
2206
+ deployment_id: workspaceDeploymentId,
2203
2207
  window: z
2204
2208
  .enum(["1h", "24h", "7d", "30d"])
2205
2209
  .optional()
@@ -2217,7 +2221,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2217
2221
  /* TOOL: get_inference_notifications */
2218
2222
  /* ══════════════════════════════════════════════════════════════════════════ */
2219
2223
  server.tool("get_inference_notifications", "Read the durable lifecycle-email history for a deployment. States are pending, sending, delivered, or dead_letter. Dead letters retain the bounded retry count and last error; deployment status remains authoritative even when email delivery fails.", {
2220
- deployment_id: z.string().describe("Deployment ID."),
2224
+ deployment_id: workspaceDeploymentId,
2221
2225
  limit: z.number().int().min(1).max(100).optional().describe("Newest rows to return (default 50, maximum 100)."),
2222
2226
  }, async ({ deployment_id, limit }) => {
2223
2227
  validateId(deployment_id, "deployment_id");
@@ -2232,7 +2236,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2232
2236
  /* TOOL: update_inference_policy */
2233
2237
  /* ══════════════════════════════════════════════════════════════════════════ */
2234
2238
  server.tool("update_inference_policy", "Update explicit capacity-queue consent or the maximum accepted total hourly GPU price. A cap below the current price is rejected. This call does not silently choose another GPU.", {
2235
- deployment_id: z.string().describe("Deployment ID."),
2239
+ deployment_id: workspaceDeploymentId,
2236
2240
  allow_capacity_queue: z.boolean().optional().describe("Explicit permission to wait for capacity and provision later under the accepted price cap."),
2237
2241
  max_price_hour_cents: priceCapSchema(false),
2238
2242
  }, async ({ deployment_id, allow_capacity_queue, max_price_hour_cents }) => {
@@ -2246,7 +2250,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2246
2250
  /* ══════════════════════════════════════════════════════════════════════════ */
2247
2251
  /* TOOL: stop_inference */
2248
2252
  /* ══════════════════════════════════════════════════════════════════════════ */
2249
- server.tool("stop_inference", "Stop a deployment and release GPU capacity plus its wallet authorization. The acknowledgement means the durable stop workflow was accepted; poll get_inference_status until stopped or failed.", { deployment_id: z.string().describe("Deployment ID.") }, async ({ deployment_id }) => {
2253
+ server.tool("stop_inference", "Stop a deployment and release GPU capacity plus its wallet authorization. The acknowledgement means the durable stop workflow was accepted; poll get_inference_status until stopped or failed.", { deployment_id: workspaceDeploymentId }, async ({ deployment_id }) => {
2250
2254
  validateId(deployment_id, "deployment_id");
2251
2255
  const data = await client.api(`/api/inference/${deployment_id}/stop`, { method: "POST" });
2252
2256
  return json(data);
@@ -2254,7 +2258,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2254
2258
  /* ══════════════════════════════════════════════════════════════════════════ */
2255
2259
  /* TOOL: resume_inference */
2256
2260
  /* ══════════════════════════════════════════════════════════════════════════ */
2257
- server.tool("resume_inference", "Atomically resume a stopped deployment. Exactly one concurrent caller can claim the lifecycle generation. The control plane revalidates the saved GPU price cap and wallet authorization before provisioning; capacity may queue only when the saved queue consent allows it.", { deployment_id: z.string().describe("Deployment ID.") }, async ({ deployment_id }) => {
2261
+ server.tool("resume_inference", "Atomically resume a stopped deployment. Exactly one concurrent caller can claim the lifecycle generation. The control plane revalidates the saved GPU price cap and wallet authorization before provisioning; capacity may queue only when the saved queue consent allows it.", { deployment_id: workspaceDeploymentId }, async ({ deployment_id }) => {
2258
2262
  validateId(deployment_id, "deployment_id");
2259
2263
  const data = await client.api(`/api/inference/${deployment_id}/resume`, { method: "POST" });
2260
2264
  return json(data);
@@ -2262,7 +2266,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2262
2266
  /* ══════════════════════════════════════════════════════════════════════════ */
2263
2267
  /* TOOL: restart_inference */
2264
2268
  /* ══════════════════════════════════════════════════════════════════════════ */
2265
- server.tool("restart_inference", "Claim one fenced restart generation. A same-config running deployment restarts in place and never silently releases its GPU for a replacement when the platform cannot confirm that restart. Pending configuration changes and failed/crash-loop recovery explicitly provision a replacement. Poll status because the acknowledgement is not endpoint readiness.", { deployment_id: z.string().describe("Deployment ID.") }, async ({ deployment_id }) => {
2269
+ server.tool("restart_inference", "Claim one fenced restart generation. A same-config running deployment restarts in place and never silently releases its GPU for a replacement when the platform cannot confirm that restart. Pending configuration changes and failed/crash-loop recovery explicitly provision a replacement. Poll status because the acknowledgement is not endpoint readiness.", { deployment_id: workspaceDeploymentId }, async ({ deployment_id }) => {
2266
2270
  validateId(deployment_id, "deployment_id");
2267
2271
  const data = await client.api(`/api/inference/${deployment_id}/restart`, { method: "POST" });
2268
2272
  return json(data);
@@ -2270,7 +2274,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2270
2274
  /* ══════════════════════════════════════════════════════════════════════════ */
2271
2275
  /* TOOL: delete_inference */
2272
2276
  /* ══════════════════════════════════════════════════════════════════════════ */
2273
- server.tool("delete_inference", "Permanently delete a serving deployment. The control plane first verifies infrastructure teardown and records retryable orphan cleanup if needed, then releases/refunds the generation-scoped wallet authorization. This cannot be undone.", { deployment_id: z.string().describe("Deployment ID.") }, async ({ deployment_id }) => {
2277
+ server.tool("delete_inference", "Permanently delete a serving deployment. The control plane first verifies infrastructure teardown and records retryable orphan cleanup if needed, then releases/refunds the generation-scoped wallet authorization. This cannot be undone.", { deployment_id: workspaceDeploymentId }, async ({ deployment_id }) => {
2274
2278
  validateId(deployment_id, "deployment_id");
2275
2279
  const data = await client.api(`/api/inference/${deployment_id}`, { method: "DELETE" });
2276
2280
  return json(data);
@@ -2350,7 +2354,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2350
2354
  /* TOOL: preview_dataset */
2351
2355
  /* ══════════════════════════════════════════════════════════════════════════ */
2352
2356
  server.tool("preview_dataset", "Read one page of dataset rows to inspect columns, content and training format. The first page is the default. Pass next_page as page to continue.", {
2353
- dataset_id: z.string().describe("Dataset ID (e.g., 'ds_abc123')"),
2357
+ dataset_id: workspaceDatasetId,
2354
2358
  rows: z.number().int().min(1).max(50).optional().describe("Rows per page (default: 10, max: 50)"),
2355
2359
  page: z.number().int().min(1).optional().describe("1-based page of rows. Read later pages with next_page; never claim a page is the whole dataset."),
2356
2360
  }, async ({ dataset_id, rows, page }) => {
@@ -2369,14 +2373,14 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2369
2373
  /* TOOL: delete_dataset */
2370
2374
  /* ══════════════════════════════════════════════════════════════════════════ */
2371
2375
  server.tool("delete_dataset", "Permanently delete a dataset from your workspace. This cannot be undone. Active training jobs using this dataset are not affected.", {
2372
- dataset_id: z.string().describe("Dataset ID to delete"),
2376
+ dataset_id: workspaceDatasetId,
2373
2377
  }, async ({ dataset_id }) => {
2374
2378
  validateId(dataset_id, "dataset_id");
2375
2379
  await client.api(`/api/datasets/${dataset_id}`, { method: "DELETE" });
2376
2380
  return result(`Dataset ${dataset_id} deleted successfully.`);
2377
2381
  });
2378
2382
  server.tool("update_dataset_column_mapping", "Replace a dataset's source-to-canonical column mapping and revalidate it immediately. Use only mappings returned or required by preview/status guidance; this mutates dataset metadata but not source bytes.", {
2379
- dataset_id: z.string().describe("Dataset ID"),
2383
+ dataset_id: workspaceDatasetId,
2380
2384
  column_mapping: z.record(z.string(), z.enum([
2381
2385
  "messages", "conversations", "instruction", "input", "output", "context", "system",
2382
2386
  "prompt", "completion", "query", "response", "question", "answer", "problem", "solution",
@@ -2388,16 +2392,16 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2388
2392
  method: "PATCH", body: column_mapping,
2389
2393
  }));
2390
2394
  });
2391
- server.tool("revalidate_dataset", "Re-run validation for an existing dataset against its pinned source and current mapping. This does not advance a Hugging Face revision; use update_dataset_source for that explicit operation.", { dataset_id: z.string().describe("Dataset ID") }, async ({ dataset_id }) => {
2395
+ server.tool("revalidate_dataset", "Re-run validation for an existing dataset against its pinned source and current mapping. This does not advance a Hugging Face revision; use update_dataset_source for that explicit operation.", { dataset_id: workspaceDatasetId }, async ({ dataset_id }) => {
2392
2396
  validateId(dataset_id, "dataset_id");
2393
2397
  return json(await client.api(`/api/datasets/${dataset_id}/revalidate`, { method: "POST" }));
2394
2398
  });
2395
- server.tool("update_dataset_source", "Explicitly check a reference-mode Hugging Face dataset's source head and adopt its newer immutable revision only when validation succeeds and the dataset type is unchanged. Stored uploads are immutable and return an unchanged verdict.", { dataset_id: z.string().describe("Dataset ID") }, async ({ dataset_id }) => {
2399
+ server.tool("update_dataset_source", "Explicitly check a reference-mode Hugging Face dataset's source head and adopt its newer immutable revision only when validation succeeds and the dataset type is unchanged. Stored uploads are immutable and return an unchanged verdict.", { dataset_id: workspaceDatasetId }, async ({ dataset_id }) => {
2396
2400
  validateId(dataset_id, "dataset_id");
2397
2401
  return json(await client.api(`/api/datasets/${dataset_id}/update-source`, { method: "POST" }));
2398
2402
  });
2399
2403
  server.tool("set_dataset_integration", "Re-point a Hugging Face dataset at another connected integration when source access changes, or pass null to detach it. Revalidate afterwards before using the dataset for training.", {
2400
- dataset_id: z.string().describe("Dataset ID"),
2404
+ dataset_id: workspaceDatasetId,
2401
2405
  integration_id: z.string().nullable().describe("Connected integration ID, or null to detach"),
2402
2406
  }, async ({ dataset_id, integration_id }) => {
2403
2407
  validateId(dataset_id, "dataset_id");
@@ -2656,7 +2660,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2656
2660
  /* TOOL: get_training_status */
2657
2661
  /* ══════════════════════════════════════════════════════════════════════════ */
2658
2662
  server.tool("get_training_status", "Read one training job’s lifecycle, configuration and step_progress. Report completed_steps against planned_steps and percent_of_plan. A completed job can finish below its plan. Report early stopping only when stop_reason is early_stopping. A null plan, percentage or reason is unknown. Use get_training_metrics for loss and learning rate. While the job runs, progress_summary shows the current phase and available counts, rate and ETA. An ETA scoped to until_training covers preparation. An interrupted job may be resumable from its last checkpoint.", {
2659
- job_id: z.string().describe("Training job ID (e.g., 'job_abc123')"),
2663
+ job_id: workspaceJobId,
2660
2664
  }, async ({ job_id }) => {
2661
2665
  validateId(job_id, "job_id");
2662
2666
  const data = await client.api(`/api/training/jobs/${job_id}`);
@@ -2670,7 +2674,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2670
2674
  /* TOOL: get_training_metrics */
2671
2675
  /* ══════════════════════════════════════════════════════════════════════════ */
2672
2676
  server.tool("get_training_metrics", "Get a bounded, model-readable training report. run_context.step_progress reports completed steps against the same recorded plan as get_training_status, with a null plan or stop reason when unknown. The default summary returns one semantic record per observed metric (latest, average, min/max, change, optimization goal and best step) for loss, validation loss, learning rate and other recorded training metrics. detail='series' adds a uniformly sampled curve for graph/shape analysis; detail='raw' returns bounded original rows. Missing measurements stay null. Prefer summary first, then request series only for metrics whose shape needs inspection.", {
2673
- job_id: z.string().describe("Training job ID"),
2677
+ job_id: workspaceJobId,
2674
2678
  detail: z.enum(["summary", "series", "raw"]).optional().describe("Response detail. Defaults to summary; series/raw are bounded by max_points."),
2675
2679
  max_points: z.number().int().min(1).max(500).optional().describe("Maximum series rows for detail=series/raw (series default 200, raw default 500)."),
2676
2680
  }, async ({ job_id, detail, max_points }) => {
@@ -2687,7 +2691,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2687
2691
  /* TOOL: get_training_logs */
2688
2692
  /* ══════════════════════════════════════════════════════════════════════════ */
2689
2693
  server.tool("get_training_logs", "Get structured recent training log entries (level, message, timestamp). Results are newest first and bounded by tail. Not available when managed_training is enabled (the platform runs the machines): use get_training_status for progress and get_training_metrics for loss, eval loss, gradient norm and accuracy.", {
2690
- job_id: z.string().describe("Training job ID"),
2694
+ job_id: workspaceJobId,
2691
2695
  tail: z
2692
2696
  .number()
2693
2697
  .int()
@@ -2721,7 +2725,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2721
2725
  /* TOOL: stop_training_job */
2722
2726
  /* ══════════════════════════════════════════════════════════════════════════ */
2723
2727
  server.tool("stop_training_job", "Request a durable stop for an active training job. The acknowledgement means the stop workflow was accepted; checkpoint preservation and resumability are reported by later job/checkpoint state, not promised by this call.", {
2724
- job_id: z.string().describe("Training job ID to stop"),
2728
+ job_id: workspaceJobId,
2725
2729
  keep_data: z.boolean().optional().describe("Attempt to preserve checkpoint/output data (default: true)."),
2726
2730
  }, async ({ job_id, keep_data }) => {
2727
2731
  validateId(job_id, "job_id");
@@ -2735,7 +2739,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2735
2739
  /* TOOL: save_training_checkpoint */
2736
2740
  /* ══════════════════════════════════════════════════════════════════════════ */
2737
2741
  server.tool("save_training_checkpoint", "Ask a running training job to save its current step now. The trainer saves after the step it is on and uploads that checkpoint right away; it appears in get_training_checkpoints once the upload completes. Kept until the job ends, when only the best and the final checkpoint remain. Refused (409) when the job is not training.", {
2738
- job_id: z.string().describe("Training job ID"),
2742
+ job_id: workspaceJobId,
2739
2743
  }, async ({ job_id }) => {
2740
2744
  validateId(job_id, "job_id");
2741
2745
  const data = await client.api(`/api/training/jobs/${job_id}/checkpoints/save`, { method: "POST" });
@@ -2745,7 +2749,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2745
2749
  /* TOOL: resume_training_job */
2746
2750
  /* ══════════════════════════════════════════════════════════════════════════ */
2747
2751
  server.tool("resume_training_job", "Resume a stopped or 'interrupted' training job from its latest checkpoint when the server reports it as resumable. 'interrupted' is the self-heal rest state a started job enters after losing its pod (billing already stopped, distinct from 'failed'). Resume re-books on secured capacity before reporting resumed (book-before-reveal still applies). The response identifies the job; exact optimizer/epoch continuation depends on the checkpoint manifest and is not assumed by this tool.", {
2748
- job_id: z.string().describe("Training job ID to resume"),
2752
+ job_id: workspaceJobId,
2749
2753
  idempotency_key: z
2750
2754
  .string()
2751
2755
  .min(8)
@@ -2765,7 +2769,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2765
2769
  /* TOOL: get_training_checkpoints */
2766
2770
  /* ══════════════════════════════════════════════════════════════════════════ */
2767
2771
  server.tool("get_training_checkpoints", "List recorded checkpoints for a training job. Returns checkpoint identity, step/epoch, size, final/best flags and format: adapter (LoRA weights), full (a full model) or merged (the standalone model a job trained with start_from exported: the base with every earlier version and its own adapter merged into one; its step is the adapter step it was merged from). A start_from job's own adapters cannot be deployed: preflight_inference and create_inference answer 400 CHAINED_ADAPTER_NOT_DEPLOYABLE, so deploy its merged checkpoint instead. Use get_checkpoint_download_manifest for file URLs; this list does not fabricate loss, eval metrics, or download URLs.", {
2768
- job_id: z.string().describe("Training job ID"),
2772
+ job_id: workspaceJobId,
2769
2773
  }, async ({ job_id }) => {
2770
2774
  validateId(job_id, "job_id");
2771
2775
  const data = await client.api(`/api/training/jobs/${job_id}/checkpoints`);
@@ -2775,8 +2779,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2775
2779
  /* TOOL: get_checkpoint_download_manifest */
2776
2780
  /* ══════════════════════════════════════════════════════════════════════════ */
2777
2781
  server.tool("get_checkpoint_download_manifest", "Get file names, sizes, expires_at and signed Run BiOS download URLs for a saved checkpoint or final model. The complete manifest includes zip_url when a ZIP is available. Each link lasts 15 minutes and requires the issuing user and workspace on each request. Use the same signed-in session or training:read API credential. Call this tool again to renew an expired link before resuming a file. The workspace must allow weight downloads (MODEL_DOWNLOAD_NOT_ENABLED).", {
2778
- job_id: z.string().describe("Training job ID"),
2779
- checkpoint_id: z.string().describe("Checkpoint ID from get_training_checkpoints"),
2782
+ job_id: workspaceJobId,
2783
+ checkpoint_id: jobCheckpointId,
2780
2784
  file: z.string().min(1).optional().describe("Exact file name from the checkpoint manifest. Omit to list all files and request the available ZIP."),
2781
2785
  }, async ({ job_id, checkpoint_id, file }) => {
2782
2786
  validateId(job_id, "job_id");
@@ -2788,8 +2792,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2788
2792
  /* TOOL: delete_training_checkpoint */
2789
2793
  /* ══════════════════════════════════════════════════════════════════════════ */
2790
2794
  server.tool("delete_training_checkpoint", "Delete a checkpoint after the API verifies ownership. This is destructive and can remove the ability to deploy or resume from that checkpoint.", {
2791
- job_id: z.string().describe("Training job ID"),
2792
- checkpoint_id: z.string().describe("Checkpoint ID"),
2795
+ job_id: workspaceJobId,
2796
+ checkpoint_id: jobCheckpointId,
2793
2797
  }, async ({ job_id, checkpoint_id }) => {
2794
2798
  validateId(job_id, "job_id");
2795
2799
  validateId(checkpoint_id, "checkpoint_id");
@@ -2802,7 +2806,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2802
2806
  /* TOOL: get_training_evals */
2803
2807
  /* ══════════════════════════════════════════════════════════════════════════ */
2804
2808
  server.tool("get_training_evals", "Read evaluation results for the selected workspace training job. Use this for benchmark scores, evaluation metrics and quality assessments computed during or after training. Use get_training_metrics for the training loss curve and get_training_status for lifecycle progress.", {
2805
- job_id: z.string().describe("Training job ID"),
2809
+ job_id: workspaceJobId,
2806
2810
  }, async ({ job_id }) => {
2807
2811
  validateId(job_id, "job_id");
2808
2812
  const data = await client.api(`/api/training/jobs/${job_id}/evals`);
@@ -3314,7 +3318,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3314
3318
  schedule: z.object({
3315
3319
  every: z.enum(["day", "week"]).describe("Repeat the training schedule each day or each week."),
3316
3320
  weekday: z.number().int().min(0).max(6).optional().describe("0 is Sunday. Required for 'week'; leave it out for 'day'."),
3317
- hour_utc: z.number().int().min(0).max(23).describe("The UTC hour"),
3321
+ hour_utc: z.number().int().min(0).max(23).describe("Hour of the scheduled training window, 0 through 23 in UTC. Convert the user's local time to UTC and use the corresponding UTC weekday for a weekly schedule."),
3318
3322
  }).nullable().optional().describe("Also wait for this time. Training starts only when BOTH the platform's fixed sample minimum and the schedule are met. null trains as soon as the minimum is met."),
3319
3323
  }).strict().optional().describe("When to train, beyond the platform's fixed sample minimum: only a schedule. There is no min_samples: the minimums are fixed (loop_list_models floors) and cannot be set."),
3320
3324
  promotion: z.object({
@@ -3361,7 +3365,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3361
3365
  server.tool("loop_update_pipeline", "Edit a pipeline: its name, use case, model, second model, tags, datasets, conditions, the judge's scoring of unreviewed samples (auto_scoring), when to train, the automatic test's share, how a new version goes live, version limit, or switch it off and on. Send ONLY what changes: datasets [] takes every dataset off, conditions null clears them, and a change to either applies from the next training (nothing is trained again; versions already made keep what they learned); an absent key leaves it alone, and null clears max_versions (no limit), challenger_model (no second model), train_when.schedule (train as soon as the minimum is met), training (every training setting back to automatic) or one key inside training (that setting back to automatic). A change to the training settings applies from the next training; 422 TRAINING_SETTING_OUT_OF_RANGE names the field and its range. Saving is the authorization, as on a create: a change that makes trainings cost more (a bigger model, switching it back on, turning auto_scoring back on) is SPEND CONSENT, so say so first. A larger automatic-test share is not SPEND CONSENT (nothing is asked again and the limits do not move), and what it changes depends on how many are kept aside: while fewer than floors.held_back.scored_rows (1,500) are, each training can score more of them, paid from the wallet; once that many are, a larger share scores nothing more and costs nothing more, and only keeps more new samples out of training, for good; and a share that still comes to the floor of floors.held_back.min_rows (100) changes nothing. Say whichever applies, never that a raise always costs more. Pass expected_revision (the pipeline's revision as you read it) to be refused REVISION_MISMATCH rather than overwrite someone else's edit; REVISION_MISMATCH also comes back, sent or not, when the pipeline changed while the edit was being saved (a version went live, which can change its models): nothing was saved, so read it again and redo the edit. A model change while a training is running is refused RUN_ACTIVE. 409 NOT_A_SIMPLE_PIPELINE: this pipeline was created before pipelines had tags, a use case or a second model, so those three cannot be edited; everything else can. Every other refusal is loop_create_pipeline's, with the same meaning.", {
3362
3366
  pipeline_id: z.string().describe("The pipeline's id (rule_id), from loop_list_pipelines"),
3363
3367
  ...pipelineInputShape,
3364
- expected_revision: z.number().int().min(0).optional().describe("The revision you read"),
3368
+ expected_revision: z.number().int().min(0).optional().describe("Revision number from loop_get_pipeline for this pipeline. Send it to prevent an edit based on stale settings. After REVISION_MISMATCH, read the pipeline again."),
3365
3369
  }, async ({ pipeline_id, ...body }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}`, {
3366
3370
  method: "PUT",
3367
3371
  body,
@@ -3446,7 +3450,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3446
3450
  dataset_id: z.string().describe("The dataset's id, from loop_list_datasets"),
3447
3451
  name: z.string().min(1).max(80).optional().describe("Updated display name for this dataset."),
3448
3452
  ...datasetConditionsShape,
3449
- expected_revision: z.number().int().min(1).optional().describe("The revision you read"),
3453
+ expected_revision: z.number().int().min(1).optional().describe("Revision number from loop_get_dataset for this dataset. Send it to prevent an edit based on stale settings. After REVISION_MISMATCH, read the dataset again."),
3450
3454
  }, async ({ dataset_id, ...body }) => json(await client.api(`/api/loop/datasets/${encodeURIComponent(dataset_id)}`, {
3451
3455
  method: "PUT",
3452
3456
  body,
@@ -3517,15 +3521,15 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3517
3521
  })));
3518
3522
  server.tool("loop_compare_versions", "A pipeline's versions side by side: each version's result against what it was tested against (the live version then, or the original model before v1) and its score on every benchmark, each with the share of questions each side passed (candidate_pass_rate for the version, incumbent_pass_rate for what it was tested against; score 0.70 or more), with comparable flags. Pass a and b (VERSION numbers, e.g. 1 and 5) for those two and a difference per benchmark; a benchmark attached after a version is not_measured for it, never a zero. Each benchmark says how it scores an answer (check: judge or exact). Compare only scores marked comparable. Each version also says promoted_at, is_live, rolled_back, model_id and model_role (main or second), cost_cents, cost_up_to and gpu_seconds (its training's, as its entry in the list of trainings says them), train_rows, learned_new (the samples it learned that the versions it builds on had not: new plus carried from trainings that did not become a version; null on an older training), compared_with_version and compared_with (what its automatic test asked as the opponent), and holdout.common_pass_rate with holdout.common_rows: how much of common_set -- the samples kept aside for the automatic test before the first tested version (common_set.from), each once, read from stored answers graded against the same right answer -- it got right. common_rows is how many of the set that version's test graded: a sample deleted or past its retention before a later version's test was never asked by it, so say each version's own common_rows unless every version's equals common_set.rows. Use common_pass_rate for 'how has it grown from v1 to now'; each version's own candidate_pass_rate was measured on its own test and is not one line across versions. Each version says whether it was tested (tested): nothing untested goes live any more, and false marks an older version that went live before that held.", {
3519
3523
  pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3520
- a: z.number().int().min(1).optional().describe("A version number"),
3521
- b: z.number().int().min(1).optional().describe("Another version number"),
3524
+ a: z.number().int().min(1).optional().describe("Baseline version number from loop_get_pipeline for this pipeline. Send both a and b for a pairwise comparison, or omit both to list every version."),
3525
+ b: z.number().int().min(1).optional().describe("Version number from loop_get_pipeline to compare against a. For comparable benchmarks the reported difference is b minus a."),
3522
3526
  }, async ({ pipeline_id, a, b }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/versions/compare`, {
3523
3527
  params: { a: a?.toString(), b: b?.toString() },
3524
3528
  })));
3525
3529
  server.tool("loop_compare_attempts", "Any two trainings of a pipeline side by side, whether they went live or not -- the one to use for 'why was training #8 not better than #7' or the second model's training against the main model's training whose samples it learned from. a and b are run ids (attempts[].run_id from loop_get_pipeline), two different trainings of this pipeline. Each side has its outcome, decision, its 'lineage' (what it was built on and learned from: 'training #3 builds on v1 and learned 2,000 samples' beside 'training #4 builds on v2 and learned 1,000' is often the difference that matters) and automatic-test numbers against what it was tested against on its day (the live version then, or the original model before v1), with the share each side passed (score 0.70 or more); never subtract two trainings' win_rate figures, the versions they were tested against differ. benchmarks lists every benchmark both were tested on, with delta (b minus a) only where comparable, why otherwise. shared_sample counts the automatic-test questions both were scored on and how many b scored higher, lower or the same on (by the tie band: 0.02 or more above counts as higher; less than 0.02 apart is about the same): these are two absolute scores, not a reading of one answer against the other. shared_sample.a and .b are each training's mean and pass rate over those same questions -- the like-for-like figures, which may be subtracted; each side's 'holdout' numbers are over its own automatic test, which grows between trainings, so do not subtract those. When shared_sample.comparable is false the two were scored differently (another judge model, holdout.judge_model, or another rubric) or how one was scored was not recorded (an older training that froze no rubric is never taken to match): say why in its words, and never read a direction off them. A question whose right answer changed between the two trainings has direction null and says why (answer_changed counts them); so does one where it is not known whether both were scored against the same right answer, because one was compared before that was recorded (answer_unknown counts them; never read those as unchanged or as changed). items is one page of them, numbers and ids only: read an answer with loop_list_evaluation_items on that side's holdout.evaluation_id. filter narrows items and total to one direction, and is refused when the two are not comparable.", {
3526
3530
  pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3527
- a: z.string().describe("The first training's run id"),
3528
- b: z.string().describe("The second training's run id; directions say b against a"),
3531
+ a: z.string().describe("Training to use as the baseline. Use its attempts[].run_id from loop_get_pipeline for this pipeline."),
3532
+ b: z.string().describe("Use a different attempts[].run_id from the same pipeline. Results describe how this training scored compared with a."),
3529
3533
  filter: z.enum(["higher", "lower", "same"]).optional().describe("Only the conversations where b scored higher, lower, or the same"),
3530
3534
  limit: z.number().int().min(1).max(200).optional().describe("Conversations per page, 50 when absent"),
3531
3535
  offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),