runbios-mcp 0.6.6-rc.415 → 0.7.0-dev.417

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +5 -3
  3. package/dist/api-client.d.ts.map +1 -1
  4. package/dist/api-client.js +14 -0
  5. package/dist/api-client.js.map +1 -1
  6. package/dist/assistant/approval.d.ts +3 -1
  7. package/dist/assistant/approval.d.ts.map +1 -1
  8. package/dist/assistant/approval.js +8 -3
  9. package/dist/assistant/approval.js.map +1 -1
  10. package/dist/assistant/training-funding.d.ts +23 -0
  11. package/dist/assistant/training-funding.d.ts.map +1 -0
  12. package/dist/assistant/training-funding.js +65 -0
  13. package/dist/assistant/training-funding.js.map +1 -0
  14. package/dist/config.d.ts +1 -1
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +1 -1
  17. package/dist/config.js.map +1 -1
  18. package/dist/http/assistant.d.ts.map +1 -1
  19. package/dist/http/assistant.js +97 -29
  20. package/dist/http/assistant.js.map +1 -1
  21. package/dist/http/metadata.js +1 -1
  22. package/dist/http/metadata.js.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/server.d.ts.map +1 -1
  26. package/dist/server.js +23 -11
  27. package/dist/server.js.map +1 -1
  28. package/dist/training-contract.d.ts +2 -0
  29. package/dist/training-contract.d.ts.map +1 -1
  30. package/dist/training-contract.js +4 -0
  31. package/dist/training-contract.js.map +1 -1
  32. package/dist/version.d.ts +1 -1
  33. package/dist/version.d.ts.map +1 -1
  34. package/dist/version.js +1 -1
  35. package/dist/version.js.map +1 -1
  36. package/dist/workspace-guidance.d.ts.map +1 -1
  37. package/dist/workspace-guidance.js +2 -1
  38. package/dist/workspace-guidance.js.map +1 -1
  39. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -839,6 +839,8 @@ launchGates = resolveLaunchGates(), allowedTools, consoleUpload = false) {
839
839
  return m ? m[1] : v;
840
840
  }
841
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 approvedFundingQuoteId = z.string().regex(/^[a-f0-9]{64}$/).optional().describe("Copy funding_quote_id from the managed create or resume quote whose terms the user approved. It binds the workspace, training request, billing mode and prices. A changed quote requires fresh approval.");
843
+ const approvedReservationCents = z.number().int().nonnegative().optional().describe("Maximum refundable wallet reservation the user explicitly approved for this specific operation, in whole USD cents. Show the current quote first. Check the quoted amount for this operation before starting a customer-funded run.");
842
844
  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
845
  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
846
  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.");
@@ -1049,7 +1051,7 @@ ${names.filter(name => !name.startsWith(LOOP_TOOL_PREFIX)).map(name => "- " + na
1049
1051
 
1050
1052
  ${gatedSurfaces.join(" and ")} ${gatedSurfaces.length > 1 ? "are" : "is"} not available in this build yet — the creation tools are not registered, so no tool call (and no workaround) can start one today. Do not retry or search for one.
1051
1053
 
1052
- What still works: every read and lifecycle tool for existing datasets and training jobs (list_datasets, get_dataset_status, preview_dataset, update_dataset_column_mapping, revalidate_dataset, update_dataset_source, set_dataset_integration, delete_dataset, list_training_jobs, get_training_status, get_training_metrics, get_training_logs, get_training_evals, stop_training_job, resume_training_job, get_training_checkpoints, save_training_checkpoint, get_checkpoint_download_manifest, delete_training_checkpoint), and the full inference surface (preflight_inference, create_inference, get_inference_status, chat_with_inference, message_with_inference, complete_with_inference, embed_with_inference, rerank_with_inference).`;
1054
+ What still works: every read and lifecycle tool for existing datasets and training jobs (list_datasets, get_dataset_status, preview_dataset, update_dataset_column_mapping, revalidate_dataset, update_dataset_source, set_dataset_integration, delete_dataset, list_training_jobs, get_training_status, get_training_metrics, get_training_logs, get_training_evals, stop_training_job, get_training_resume_quote, resume_training_job, get_training_checkpoints, save_training_checkpoint, get_checkpoint_download_manifest, delete_training_checkpoint), and the full inference surface (preflight_inference, create_inference, get_inference_status, chat_with_inference, message_with_inference, complete_with_inference, embed_with_inference, rerank_with_inference).`;
1053
1055
  const gatedOverview = `# Run BiOS Platform
1054
1056
 
1055
1057
  Run BiOS has TWO inference products. Choosing the right one is step zero; they are not two names for the same operation.
@@ -1120,7 +1122,7 @@ get_inference_status instead of asserting them.
1120
1122
  11. preflight_training_job - Validate a proposed job payload (no side effects)
1121
1123
  12. list_training_jobs / get_training_status - Monitor existing jobs
1122
1124
  13. get_training_metrics / get_training_evals / get_training_logs - Loss curves, benchmarks, logs
1123
- 14. stop_training_job / resume_training_job / save_training_checkpoint - Control existing jobs; save the current step on request
1125
+ 14. stop_training_job / get_training_resume_quote / resume_training_job / save_training_checkpoint - Control existing jobs; save the current step on request
1124
1126
  15. get_training_checkpoints / get_checkpoint_download_manifest / delete_training_checkpoint - Checkpoint access
1125
1127
 
1126
1128
  ## Inference MCP Tools
@@ -1229,7 +1231,7 @@ get_inference_status instead of asserting them.
1229
1231
  18. get_training_metrics - View loss curves and eval results
1230
1232
  19. get_training_evals - Review benchmark scores and quality assessments
1231
1233
  20. get_training_logs - Read training output logs
1232
- 21. stop_training_job / resume_training_job / save_training_checkpoint - Control running jobs; save the current step on request
1234
+ 21. stop_training_job / get_training_resume_quote / resume_training_job / save_training_checkpoint - Control running jobs; save the current step on request
1233
1235
  22. get_training_checkpoints - Access saved model checkpoints
1234
1236
  23. get_checkpoint_download_manifest - Per-file download URLs for a checkpoint (only where model weight downloads are enabled for the workspace)
1235
1237
  24. delete_training_checkpoint - Remove a checkpoint you no longer need
@@ -1276,17 +1278,17 @@ Option B: Import from HuggingFace — call import_huggingface_dataset with a rep
1276
1278
  Dataset upload accepts one file type: JSONL. SFT rows may use messages, conversations, instruction/output, prompt/completion, query/response, input/output, question/answer, or problem/solution. CPT rows require a non-empty text field. Preference, reward, KTO, GRPO, PPO, and GKD datasets are refused while those training methods are unavailable.
1277
1279
 
1278
1280
  ### Managed training (check first)
1279
- Call get_training_capabilities. If its features list has managed_training enabled, the platform chooses the hardware: do NOT choose or send a GPU, GPU count, per-device batch, gradient accumulation, recompute level, checkpoint count or price cap -- they are ignored (preflight warns FIELD_IGNORED). Call get_managed_training_options for the model, method and adapter, and offer only what it returns: the context length (max_length, one of 2048-131072), precision (bf16 or fp8) and optimizer state (optim: adamw_torch_fused = 16-bit, adamw_8bit = 8-bit). Send only: model, method (sft/cpt), adapter (lora/qlora/full), dataset(s), max_length, precision, optim, learning_rate, lr_scheduler_type, warmup_ratio, weight_decay, epochs or max_steps, lora_rank (8-64), lora_alpha, and optionally validation_rows (0 turns validation off) and early_stopping_patience. On preflight_training_job and create_training_job these are the inputs max_seq_length, precision, optim, scheduler, validation_rows. Validation rows must be between 100 (or 5% of the rows when that is under 100) and 40% of the training rows; unset, the job holds out 5% capped at 1,000 rows, and preflight returns the exact rows and range in validation. Unset, the schedule is cosine; it keeps its best (lowest validation loss) and latest checkpoints, is charged per trained token only, and waits unbilled in the queue, first come first served, when no training resources are free (the customer is emailed when it starts and may cancel it while queued). Training logs and system metrics (memory, MFU, throughput) are not available to the customer: report progress from get_training_status and training metrics from get_training_metrics. Samples longer than max_length lose their oldest turns, never the answer; image samples that do not fit are skipped. Preflight returns the placement validity and, when token_billing is enabled, an estimate (estimated tokens and cost at the model's per-token price; the charge is the exact tokens trained). Customers never see hardware; do not describe GPUs to them.
1281
+ Call get_training_capabilities. If its features list has managed_training enabled, the platform chooses the hardware: do NOT choose or send a GPU, GPU count, per-device batch, gradient accumulation, recompute level, checkpoint count or hourly hardware price cap -- they are ignored (preflight warns FIELD_IGNORED). Call get_managed_training_options for the model, method and adapter, and offer only what it returns: the context length (max_length, one of 2048-131072), precision (bf16 or fp8) and optimizer state (optim: adamw_torch_fused = 16-bit, adamw_8bit = 8-bit). Send only: model, method (sft/cpt), adapter (lora/qlora/full), dataset(s), max_length, precision, optim, learning_rate, lr_scheduler_type, warmup_ratio, weight_decay, epochs or max_steps, lora_rank (8-64), lora_alpha, and optionally validation_rows (0 turns validation off) and early_stopping_patience. On preflight_training_job and create_training_job these are the inputs max_seq_length, precision, optim, scheduler, validation_rows. Validation rows must be between 100 (or 5% of the rows when that is under 100) and 40% of the training rows; unset, the job holds out 5% capped at 1,000 rows, and preflight returns the exact rows and range in validation. Unset, the schedule is cosine; it keeps its best (lowest validation loss) and latest checkpoints, is charged per trained token only, and waits unbilled in the queue, first come first served, when no training resources are free (the customer is emailed when it starts and may cancel it while queued). Training logs and system metrics (memory, MFU, throughput) are not available to the customer: report progress from get_training_status and training metrics from get_training_metrics. Samples longer than max_length lose their oldest turns, never the answer; image samples that do not fit are skipped. Preflight returns the placement validity and, when token_billing is enabled, an estimate (estimated tokens and cost at the model's per-token price; the charge is the exact tokens trained). Customers never see hardware; do not describe GPUs to them.
1280
1282
 
1281
1283
  ### Step 4: Preflight
1282
- Call preflight_training_job with the model, dataset(s), method, adapter and training settings. It returns valid, the validation rows and their allowed range, warnings and the per-token cost estimate. Show the estimate to the user before creating.
1284
+ Call preflight_training_job with the model, dataset(s), method, adapter and training settings. It returns valid, the validation rows and their allowed range, warnings and the per-token cost estimate. Show both the estimated token charge and the maximum refundable wallet reservation. Ask for approval of those terms for this job.
1283
1285
 
1284
1286
  ### Step 5: Create the training job
1285
- Call create_training_job with the same request. The job is placed on tested machines; when none is free it is queued (first come first served, unbilled) and starts automatically. The user is emailed when it starts and can cancel at any time with stop_training_job.
1287
+ Call create_training_job with the same request and the approved managed wallet limit and quote ID in approved_reservation_cents and approved_funding_quote_id. The job is placed on tested machines; when none is free it is queued (first come first served, unbilled) and starts automatically. The user is emailed when it starts and can cancel at any time with stop_training_job.
1286
1288
 
1287
1289
  ### Step 6: Monitor progress
1288
1290
  Call get_training_status for progress (queued, getting ready, downloading the model, preparing data, training step N of M, saving). Call get_training_metrics for loss, eval loss, gradient norm, token accuracy, learning rate and tokens trained. The job keeps two checkpoints: the best (lowest validation loss) and the last.
1289
- If a started job loses its training resources it rests at 'interrupted' (nothing is charged for that) -- call resume_training_job to continue from the last checkpoint.
1291
+ If a started job loses its training resources it rests at 'interrupted' (nothing is charged for that) -- read get_training_resume_quote, then obtain fresh approval before using resume_training_job to continue from its checkpoint.
1290
1292
 
1291
1293
  ### Tips
1292
1294
  - Start with LoRA, not full fine-tune — it's 10x faster and 5x cheaper
@@ -2562,7 +2564,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2562
2564
  ...(params.eval_dataset_ids ? { eval_dataset_ids: await Promise.all(params.eval_dataset_ids.map((ref) => resolveDatasetRef(ref, "eval_dataset_ids"))) } : {}),
2563
2565
  };
2564
2566
  }
2565
- server.tool("preflight_training_job", "Validate and canonicalize a proposed training job without creating a job or charging the wallet. You choose the model, adapter, datasets and training settings; the platform chooses the machines, batch and memory settings from tested setups. Returns dataset compatibility, the per-token cost estimate, the validation rows it will hold out (and their allowed range), warnings (FIELD_IGNORED for anything the platform sets) and a request hash.", {
2567
+ server.tool("preflight_training_job", "Validate and canonicalize a proposed training job without creating a job or charging the wallet. You choose the model, adapter, datasets and training settings; the platform chooses the machines, batch and memory settings from tested setups. Returns dataset compatibility, billing_mode, the token cost estimate and maximum refundable wallet reservation for managed training, the validation rows it will hold out (and their allowed range), warnings (FIELD_IGNORED for anything the platform sets) and a request hash.", {
2566
2568
  model: z.string().describe("Base model id from the Run BiOS catalog (e.g., 'meta-llama/Llama-3.1-8B-Instruct'). Must be hosted on Run BiOS — pick from list_models/search_models. Training always starts from a catalog base model; start_from (where enabled) adds earlier LoRA versions of that same base on top of it, and training from any other fine-tuned model is not supported."),
2567
2569
  model_revision: z.string().max(256).optional().describe("Requested model branch, tag, or commit. Copy the exact 40-hex value returned in canonical_request into create."),
2568
2570
  dataset_id: z.string().optional().describe("Dataset id from list_datasets. An exact, unique dataset name is also accepted and resolved to its id."),
@@ -2591,8 +2593,10 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2591
2593
  // server-side (403 TRAINING_COMING_SOON before any billing or booking) as the
2592
2594
  // authority. At launch the flag opens and the registration returns verbatim.
2593
2595
  if (!launchGates.training) {
2594
- server.tool("create_training_job", "Create a training job with the same request preflight_training_job validated. The platform places it on tested machines; when none is free it waits in the queue (first come first served, unbilled, expires after seven days), starts automatically and emails the user when it starts. It is charged for the exact tokens it trained. Report progress from get_training_status and training metrics from get_training_metrics; cancel any time with stop_training_job. Reuse one idempotency key after timeouts.", {
2596
+ server.tool("create_training_job", "Create a training job after preflight_training_job and explicit approval of the estimated token charge and refundable wallet reservation. Pass its funding_quote_id as approved_funding_quote_id together with the approved_reservation_cents. If terms change, show the new quote and ask again. The platform places it on tested machines; when none is free it waits in the queue (first come first served, unbilled, expires after seven days), starts automatically and emails the user when it starts. It is charged for the exact tokens it trained. Report progress from get_training_status and training metrics from get_training_metrics; cancel any time with stop_training_job. Reuse one idempotency key after timeouts.", {
2595
2597
  model: z.string().describe("Base model id from the Run BiOS catalog (e.g., 'meta-llama/Llama-3.1-8B-Instruct'). Must be hosted on Run BiOS — pick from list_models/search_models. Training always starts from a catalog base model; start_from (where enabled) adds earlier LoRA versions of that same base on top of it, and training from any other fine-tuned model is not supported."),
2598
+ approved_reservation_cents: approvedReservationCents,
2599
+ approved_funding_quote_id: approvedFundingQuoteId,
2596
2600
  model_revision: z.string().max(256).optional().describe("Exact model_revision from preflight canonical_request; a branch or tag is accepted but resolved again before any paid mutation."),
2597
2601
  idempotency_key: z
2598
2602
  .string()
@@ -2748,8 +2752,14 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2748
2752
  /* ══════════════════════════════════════════════════════════════════════════ */
2749
2753
  /* TOOL: resume_training_job */
2750
2754
  /* ══════════════════════════════════════════════════════════════════════════ */
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.", {
2755
+ server.tool("get_training_resume_quote", "Check the current cost of continuing a stopped or interrupted workspace training job from its checkpoint. This read returns its billing mode and, for managed runs, the maximum refundable wallet reservation in USD cents. Use it before asking the user to approve a resume. It starts no job and reserves no funds.", { job_id: workspaceJobId }, async ({ job_id }) => {
2756
+ validateId(job_id, "job_id");
2757
+ return json(await client.api(`/api/training/jobs/${job_id}/resume/quote`));
2758
+ });
2759
+ server.tool("resume_training_job", "Start a new training job from a stopped or interrupted job's latest resumable checkpoint. First read get_training_resume_quote. For managed training, show the estimate and refundable wallet reservation and obtain fresh approval before passing approved_reservation_cents and approved_funding_quote_id from that decision. Reuse an idempotency key only for the same approved attempt. The response identifies the new job. Exact optimizer and epoch continuation depends on the checkpoint manifest.", {
2752
2760
  job_id: workspaceJobId,
2761
+ approved_reservation_cents: approvedReservationCents,
2762
+ approved_funding_quote_id: approvedFundingQuoteId,
2753
2763
  idempotency_key: z
2754
2764
  .string()
2755
2765
  .min(8)
@@ -2757,10 +2767,12 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2757
2767
  .regex(/^[A-Za-z0-9._:-]+$/)
2758
2768
  .optional()
2759
2769
  .describe("Stable retry key. Reuse it after a timeout; omit to generate one for this tool call."),
2760
- }, async ({ job_id, idempotency_key }) => {
2770
+ }, async ({ job_id, idempotency_key, approved_reservation_cents, approved_funding_quote_id }) => {
2761
2771
  validateId(job_id, "job_id");
2762
2772
  const data = await client.api(`/api/training/jobs/${job_id}/resume`, {
2763
2773
  method: "POST",
2774
+ body: approved_reservation_cents === undefined && approved_funding_quote_id === undefined
2775
+ ? undefined : { approved_reservation_cents, approved_funding_quote_id },
2764
2776
  headers: { "Idempotency-Key": idempotency_key ?? randomUUID() },
2765
2777
  });
2766
2778
  return json(data);