apheris-foundry-cli 2.2.0__tar.gz → 2.3.0__tar.gz

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 (66) hide show
  1. {apheris_foundry_cli-2.2.0/src/apheris_foundry_cli.egg-info → apheris_foundry_cli-2.3.0}/PKG-INFO +63 -2
  2. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/README.md +62 -1
  3. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/pyproject.toml +1 -1
  4. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0/src/apheris_foundry_cli.egg-info}/PKG-INFO +63 -2
  5. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/SOURCES.txt +2 -0
  6. apheris_foundry_cli-2.3.0/src/apherisfold_cli/commands/docs.py +105 -0
  7. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/hub_requests.py +21 -0
  8. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/main.py +11 -4
  9. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/skills/apheris-foundry-hub/SKILL.md +35 -0
  10. apheris_foundry_cli-2.3.0/src/apherisfold_cli/version.py +1 -0
  11. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_cli.py +39 -0
  12. apheris_foundry_cli-2.3.0/tests/test_docs.py +102 -0
  13. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_documents.py +64 -1
  14. apheris_foundry_cli-2.2.0/src/apherisfold_cli/version.py +0 -1
  15. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/LICENSE +0 -0
  16. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/setup.cfg +0 -0
  17. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/dependency_links.txt +0 -0
  18. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/entry_points.txt +0 -0
  19. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/requires.txt +0 -0
  20. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/top_level.txt +0 -0
  21. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/__init__.py +0 -0
  22. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/__init__.py +0 -0
  23. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/compounds.py +0 -0
  24. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/foundry.py +0 -0
  25. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/login.py +0 -0
  26. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/settings.py +0 -0
  27. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/skills.py +0 -0
  28. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/weights.py +0 -0
  29. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/__init__.py +0 -0
  30. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/auth.py +0 -0
  31. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/config.py +0 -0
  32. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/context.py +0 -0
  33. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/documents.py +0 -0
  34. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/errors.py +0 -0
  35. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/input_archive.py +0 -0
  36. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/io.py +0 -0
  37. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/limits.py +0 -0
  38. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/login_profiles.py +0 -0
  39. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/msa.py +0 -0
  40. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/pubchem.py +0 -0
  41. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/render.py +0 -0
  42. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/result_artifacts.py +0 -0
  43. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/transient.py +0 -0
  44. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/handlers.py +0 -0
  45. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_auth.py +0 -0
  46. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_auth_lifecycle.py +0 -0
  47. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_benchmark_examples.py +0 -0
  48. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_config.py +0 -0
  49. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_dry_run_guard.py +0 -0
  50. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_foundry_helpers.py +0 -0
  51. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_foundry_warnings.py +0 -0
  52. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_handlers.py +0 -0
  53. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_hub_requests.py +0 -0
  54. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_input_archive.py +0 -0
  55. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_io.py +0 -0
  56. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_jobs_metadata.py +0 -0
  57. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_jobs_update.py +0 -0
  58. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_login_callback.py +0 -0
  59. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_main.py +0 -0
  60. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_model_discovery.py +0 -0
  61. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_msa.py +0 -0
  62. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_pubchem.py +0 -0
  63. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_render.py +0 -0
  64. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_result_artifacts.py +0 -0
  65. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_skills.py +0 -0
  66. {apheris_foundry_cli-2.2.0 → apheris_foundry_cli-2.3.0}/tests/test_weights.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apheris-foundry-cli
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Command-line interface for Apheris Foundry workflows.
5
5
  Author: Apheris
6
6
  License-Expression: LicenseRef-Apheris-Foundry-Software-License
@@ -367,7 +367,68 @@ apheris-foundry jobs get --help
367
367
 
368
368
  `--name` optionally names the run. Omitted or blank names submit an unnamed run.
369
369
 
370
- `--model-params` accepts an inline JSON object or a JSON/YAML parameter file. Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml` filename with `@` to load the object from that file. Before submitting the run, the CLI retrieves the selected model version, weight, and capability schema from Hub and validates the object. Use `workflows models` to discover available model IDs and weights.
370
+ ### Choosing how to pass settings
371
+
372
+ Workflow instructions describe the configuration and its meaning; the CLI maps
373
+ that configuration to submission options:
374
+
375
+ | Configuration | CLI option | Where to find accepted values |
376
+ | --- | --- | --- |
377
+ | Model and weight selection | `--model <id> --weight <version-or-enabled-id>` | `workflows models --workflow <id> --json` |
378
+ | Top-level workflow setting | Repeat `--param name=value` | `workflows get --workflow <id> --json` and the workflow docs |
379
+ | Model-parameter object, when the workflow supports it | `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml` | The selected task's parameter schema and workflow restrictions |
380
+ | Input data or a workflow-specific configuration file | `--input <file-or-folder>` | The workflow's input contract and preparation instructions |
381
+
382
+ Read `workflows docs --workflow <id>` and the workflow skill for supported model
383
+ parameters, restrictions and defaults. Model parameters configure how the model
384
+ runs and which outputs it writes. In model discovery, `modelParamsTask` identifies the entry in
385
+ `schemas.tasks[]` whose `parameters` defines field types, enums and constraints. A task
386
+ schema can include fields controlled by the workflow or unsupported by that
387
+ workflow; it is not a promise that every field works as a model override.
388
+ The same model can support different overrides in different workflows.
389
+
390
+ `--model-params` accepts an inline JSON object or a JSON/YAML parameter file.
391
+ Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml`
392
+ filename with `@` to load the object from that file. The CLI retrieves the
393
+ selected model and validates the object against its parameter schema before
394
+ submission. Hub validates declared task-parameter objects before staging a run;
395
+ the workflow also enforces its implementation restrictions. Keep exact field
396
+ names and JSON types, such as `true` rather than `"true"`, and pass only intended
397
+ overrides. Task-schema defaults can differ from workflow defaults, so do not
398
+ copy every schema default into the object.
399
+
400
+ Model task schemas retain their required fields. Hub's `modelParamsSuppliedFields`
401
+ identifies the fields supplied by the workflow; only those may be omitted despite
402
+ being required by the task. Structural fine-tuning requires a positive integer
403
+ `max_steps` inside `--model-params`, for example `'{"max_steps":5000}'`.
404
+ There is no implicit 1,000-step workflow default or unlimited sentinel. Hub also
405
+ checks required fields when the whole model parameter object is omitted.
406
+
407
+ For example, benchmark's batch size is a workflow setting, while its seed and
408
+ detailed-score preference are model parameters:
409
+
410
+ ```bash
411
+ apheris-foundry workflows run --workflow benchmark --input prepared-benchmark/ \
412
+ --model openfold3 \
413
+ --param batchSize=5 \
414
+ --model-params '{"seeds":[42],"write_detailed_scores":true}'
415
+ ```
416
+
417
+ Structural fine-tuning uses the same model-parameter option for its training
418
+ task. Dataset preparation is a separate task configured through `datasetParams`:
419
+
420
+ ```bash
421
+ apheris-foundry workflows run --workflow structural-finetune --input prepared-training/ \
422
+ --model-params '{"max_steps":5000,"learning_rate":0.001}' \
423
+ --param 'datasetParams={"validation_failures":"ignore"}'
424
+ ```
425
+
426
+ Check that the deployed workflow supports these fields before submission.
427
+ The detailed-score preference belongs only in the model-parameter object.
428
+ Do not flatten a model field into `--param write_detailed_scores=false`, pass raw
429
+ `--param modelParams=...`, or translate an uploaded config file's keys into
430
+ flags. Use the route the selected workflow documents; `--help` describes the
431
+ installed CLI syntax.
371
432
 
372
433
  ### YAML model parameters
373
434
 
@@ -341,7 +341,68 @@ apheris-foundry jobs get --help
341
341
 
342
342
  `--name` optionally names the run. Omitted or blank names submit an unnamed run.
343
343
 
344
- `--model-params` accepts an inline JSON object or a JSON/YAML parameter file. Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml` filename with `@` to load the object from that file. Before submitting the run, the CLI retrieves the selected model version, weight, and capability schema from Hub and validates the object. Use `workflows models` to discover available model IDs and weights.
344
+ ### Choosing how to pass settings
345
+
346
+ Workflow instructions describe the configuration and its meaning; the CLI maps
347
+ that configuration to submission options:
348
+
349
+ | Configuration | CLI option | Where to find accepted values |
350
+ | --- | --- | --- |
351
+ | Model and weight selection | `--model <id> --weight <version-or-enabled-id>` | `workflows models --workflow <id> --json` |
352
+ | Top-level workflow setting | Repeat `--param name=value` | `workflows get --workflow <id> --json` and the workflow docs |
353
+ | Model-parameter object, when the workflow supports it | `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml` | The selected task's parameter schema and workflow restrictions |
354
+ | Input data or a workflow-specific configuration file | `--input <file-or-folder>` | The workflow's input contract and preparation instructions |
355
+
356
+ Read `workflows docs --workflow <id>` and the workflow skill for supported model
357
+ parameters, restrictions and defaults. Model parameters configure how the model
358
+ runs and which outputs it writes. In model discovery, `modelParamsTask` identifies the entry in
359
+ `schemas.tasks[]` whose `parameters` defines field types, enums and constraints. A task
360
+ schema can include fields controlled by the workflow or unsupported by that
361
+ workflow; it is not a promise that every field works as a model override.
362
+ The same model can support different overrides in different workflows.
363
+
364
+ `--model-params` accepts an inline JSON object or a JSON/YAML parameter file.
365
+ Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml`
366
+ filename with `@` to load the object from that file. The CLI retrieves the
367
+ selected model and validates the object against its parameter schema before
368
+ submission. Hub validates declared task-parameter objects before staging a run;
369
+ the workflow also enforces its implementation restrictions. Keep exact field
370
+ names and JSON types, such as `true` rather than `"true"`, and pass only intended
371
+ overrides. Task-schema defaults can differ from workflow defaults, so do not
372
+ copy every schema default into the object.
373
+
374
+ Model task schemas retain their required fields. Hub's `modelParamsSuppliedFields`
375
+ identifies the fields supplied by the workflow; only those may be omitted despite
376
+ being required by the task. Structural fine-tuning requires a positive integer
377
+ `max_steps` inside `--model-params`, for example `'{"max_steps":5000}'`.
378
+ There is no implicit 1,000-step workflow default or unlimited sentinel. Hub also
379
+ checks required fields when the whole model parameter object is omitted.
380
+
381
+ For example, benchmark's batch size is a workflow setting, while its seed and
382
+ detailed-score preference are model parameters:
383
+
384
+ ```bash
385
+ apheris-foundry workflows run --workflow benchmark --input prepared-benchmark/ \
386
+ --model openfold3 \
387
+ --param batchSize=5 \
388
+ --model-params '{"seeds":[42],"write_detailed_scores":true}'
389
+ ```
390
+
391
+ Structural fine-tuning uses the same model-parameter option for its training
392
+ task. Dataset preparation is a separate task configured through `datasetParams`:
393
+
394
+ ```bash
395
+ apheris-foundry workflows run --workflow structural-finetune --input prepared-training/ \
396
+ --model-params '{"max_steps":5000,"learning_rate":0.001}' \
397
+ --param 'datasetParams={"validation_failures":"ignore"}'
398
+ ```
399
+
400
+ Check that the deployed workflow supports these fields before submission.
401
+ The detailed-score preference belongs only in the model-parameter object.
402
+ Do not flatten a model field into `--param write_detailed_scores=false`, pass raw
403
+ `--param modelParams=...`, or translate an uploaded config file's keys into
404
+ flags. Use the route the selected workflow documents; `--help` describes the
405
+ installed CLI syntax.
345
406
 
346
407
  ### YAML model parameters
347
408
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "apheris-foundry-cli"
7
- version = "2.2.0"
7
+ version = "2.3.0"
8
8
  description = "Command-line interface for Apheris Foundry workflows."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apheris-foundry-cli
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Command-line interface for Apheris Foundry workflows.
5
5
  Author: Apheris
6
6
  License-Expression: LicenseRef-Apheris-Foundry-Software-License
@@ -367,7 +367,68 @@ apheris-foundry jobs get --help
367
367
 
368
368
  `--name` optionally names the run. Omitted or blank names submit an unnamed run.
369
369
 
370
- `--model-params` accepts an inline JSON object or a JSON/YAML parameter file. Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml` filename with `@` to load the object from that file. Before submitting the run, the CLI retrieves the selected model version, weight, and capability schema from Hub and validates the object. Use `workflows models` to discover available model IDs and weights.
370
+ ### Choosing how to pass settings
371
+
372
+ Workflow instructions describe the configuration and its meaning; the CLI maps
373
+ that configuration to submission options:
374
+
375
+ | Configuration | CLI option | Where to find accepted values |
376
+ | --- | --- | --- |
377
+ | Model and weight selection | `--model <id> --weight <version-or-enabled-id>` | `workflows models --workflow <id> --json` |
378
+ | Top-level workflow setting | Repeat `--param name=value` | `workflows get --workflow <id> --json` and the workflow docs |
379
+ | Model-parameter object, when the workflow supports it | `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml` | The selected task's parameter schema and workflow restrictions |
380
+ | Input data or a workflow-specific configuration file | `--input <file-or-folder>` | The workflow's input contract and preparation instructions |
381
+
382
+ Read `workflows docs --workflow <id>` and the workflow skill for supported model
383
+ parameters, restrictions and defaults. Model parameters configure how the model
384
+ runs and which outputs it writes. In model discovery, `modelParamsTask` identifies the entry in
385
+ `schemas.tasks[]` whose `parameters` defines field types, enums and constraints. A task
386
+ schema can include fields controlled by the workflow or unsupported by that
387
+ workflow; it is not a promise that every field works as a model override.
388
+ The same model can support different overrides in different workflows.
389
+
390
+ `--model-params` accepts an inline JSON object or a JSON/YAML parameter file.
391
+ Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml`
392
+ filename with `@` to load the object from that file. The CLI retrieves the
393
+ selected model and validates the object against its parameter schema before
394
+ submission. Hub validates declared task-parameter objects before staging a run;
395
+ the workflow also enforces its implementation restrictions. Keep exact field
396
+ names and JSON types, such as `true` rather than `"true"`, and pass only intended
397
+ overrides. Task-schema defaults can differ from workflow defaults, so do not
398
+ copy every schema default into the object.
399
+
400
+ Model task schemas retain their required fields. Hub's `modelParamsSuppliedFields`
401
+ identifies the fields supplied by the workflow; only those may be omitted despite
402
+ being required by the task. Structural fine-tuning requires a positive integer
403
+ `max_steps` inside `--model-params`, for example `'{"max_steps":5000}'`.
404
+ There is no implicit 1,000-step workflow default or unlimited sentinel. Hub also
405
+ checks required fields when the whole model parameter object is omitted.
406
+
407
+ For example, benchmark's batch size is a workflow setting, while its seed and
408
+ detailed-score preference are model parameters:
409
+
410
+ ```bash
411
+ apheris-foundry workflows run --workflow benchmark --input prepared-benchmark/ \
412
+ --model openfold3 \
413
+ --param batchSize=5 \
414
+ --model-params '{"seeds":[42],"write_detailed_scores":true}'
415
+ ```
416
+
417
+ Structural fine-tuning uses the same model-parameter option for its training
418
+ task. Dataset preparation is a separate task configured through `datasetParams`:
419
+
420
+ ```bash
421
+ apheris-foundry workflows run --workflow structural-finetune --input prepared-training/ \
422
+ --model-params '{"max_steps":5000,"learning_rate":0.001}' \
423
+ --param 'datasetParams={"validation_failures":"ignore"}'
424
+ ```
425
+
426
+ Check that the deployed workflow supports these fields before submission.
427
+ The detailed-score preference belongs only in the model-parameter object.
428
+ Do not flatten a model field into `--param write_detailed_scores=false`, pass raw
429
+ `--param modelParams=...`, or translate an uploaded config file's keys into
430
+ flags. Use the route the selected workflow documents; `--help` describes the
431
+ installed CLI syntax.
371
432
 
372
433
  ### YAML model parameters
373
434
 
@@ -13,6 +13,7 @@ src/apherisfold_cli/main.py
13
13
  src/apherisfold_cli/version.py
14
14
  src/apherisfold_cli/commands/__init__.py
15
15
  src/apherisfold_cli/commands/compounds.py
16
+ src/apherisfold_cli/commands/docs.py
16
17
  src/apherisfold_cli/commands/foundry.py
17
18
  src/apherisfold_cli/commands/login.py
18
19
  src/apherisfold_cli/commands/settings.py
@@ -40,6 +41,7 @@ tests/test_auth_lifecycle.py
40
41
  tests/test_benchmark_examples.py
41
42
  tests/test_cli.py
42
43
  tests/test_config.py
44
+ tests/test_docs.py
43
45
  tests/test_documents.py
44
46
  tests/test_dry_run_guard.py
45
47
  tests/test_foundry_helpers.py
@@ -0,0 +1,105 @@
1
+ """Read the selected Hub's private documentation using its navigation."""
2
+
3
+ import hashlib
4
+ import re
5
+ from typing import Annotated, Any
6
+
7
+ import typer
8
+ from rich import box
9
+ from rich.markdown import Markdown
10
+ from rich.table import Table
11
+ from rich.text import Text
12
+
13
+ from apherisfold_cli.core.errors import EXIT_INPUT_DATA, EXIT_USAGE, CLIError
14
+ from apherisfold_cli.core.hub_requests import get_hub_document, get_hub_documentation_index
15
+ from apherisfold_cli.handlers import run_simple_listing
16
+
17
+ app = typer.Typer(no_args_is_help=True, help="Read private release notes, known issues and guides from your Hub.")
18
+
19
+
20
+ def _invalid() -> CLIError:
21
+ return CLIError(
22
+ code=EXIT_INPUT_DATA, category="input-data", message="Hub returned invalid documentation.", task="docs"
23
+ )
24
+
25
+
26
+ def _pages(entries: Any, depth: int = 0) -> list[dict[str, str]]:
27
+ if not isinstance(entries, list) or not entries or depth > 20:
28
+ raise _invalid()
29
+ pages = []
30
+ for entry in entries:
31
+ if not isinstance(entry, dict) or not isinstance(entry.get("title"), str):
32
+ raise _invalid()
33
+ path = entry.get("path")
34
+ if path is not None:
35
+ if (
36
+ not isinstance(path, str)
37
+ or not path.endswith(".md")
38
+ or any(part in {"", ".", ".."} for part in path.split("/"))
39
+ or any(char in path for char in "\\?#:%")
40
+ ):
41
+ raise _invalid()
42
+ pages.append({"title": entry["title"], "path": path})
43
+ else:
44
+ pages.extend(_pages(entry.get("children"), depth + 1))
45
+ return pages
46
+
47
+
48
+ def _index() -> tuple[dict[str, Any], list[dict[str, str]]]:
49
+ payload = get_hub_documentation_index()
50
+ if not isinstance(payload.get("hubVersion"), str):
51
+ raise _invalid()
52
+ return payload, _pages(payload.get("navigation"))
53
+
54
+
55
+ @app.command("list", help="List the private documents available on the selected Hub.")
56
+ def list_docs(
57
+ json_output: Annotated[bool, typer.Option("--json", help="Return the original navigation as JSON.")] = False,
58
+ ) -> None:
59
+ payload, pages = _index()
60
+ if json_output:
61
+ run_simple_listing(payload=payload)
62
+ return
63
+ table = Table("Document", "Path", box=box.SIMPLE_HEAD)
64
+ for page in pages:
65
+ table.add_row(Text(page["title"]), Text(page["path"]))
66
+ run_simple_listing(payload=payload, renderable_output=table)
67
+
68
+
69
+ @app.command("show", help="Read a document path from 'docs list'. Use --raw to export its original Markdown.")
70
+ def show_doc(
71
+ path: Annotated[str, typer.Argument(help="Document path from docs list.")],
72
+ json_output: Annotated[
73
+ bool, typer.Option("--json", help="Return source Markdown, version and digest as JSON.")
74
+ ] = False,
75
+ raw: Annotated[
76
+ bool, typer.Option("--raw", help="Write exact source Markdown to stdout for offline reading.")
77
+ ] = False,
78
+ ) -> None:
79
+ if raw and json_output:
80
+ raise typer.BadParameter("Use either --raw or --json.")
81
+ _, pages = _index()
82
+ if path not in {page["path"] for page in pages}:
83
+ raise CLIError(
84
+ code=EXIT_USAGE,
85
+ category="usage",
86
+ message="Document is not listed by this Hub. Run 'apheris-foundry docs list'.",
87
+ task="docs.show",
88
+ )
89
+ payload = get_hub_document(path)
90
+ content = payload.get("content")
91
+ if (
92
+ payload.get("path") != path
93
+ or not isinstance(content, str)
94
+ or not content.strip()
95
+ or payload.get("sha256") != hashlib.sha256(content.encode("utf-8")).hexdigest()
96
+ or any(not isinstance(payload.get(key), str) for key in ("hubVersion", "type", "title"))
97
+ ):
98
+ raise _invalid()
99
+ if raw:
100
+ typer.echo(content, nl=False)
101
+ elif json_output:
102
+ run_simple_listing(payload=payload)
103
+ else:
104
+ body = re.sub(r"\A---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\Z)", "", content, count=1)
105
+ run_simple_listing(payload=payload, renderable_output=Markdown(body))
@@ -301,6 +301,27 @@ def get_foundry_workflow_docs(workflow_id: str) -> dict[str, Any]:
301
301
  return _request_json(path=f"/api/v1/foundry/workflows/{encoded}/docs", method="GET", task="foundry.workflows.docs")
302
302
 
303
303
 
304
+ def _request_hub_documentation(path: str, task: str) -> dict[str, Any]:
305
+ try:
306
+ return _request_json(path=path, method="GET", task=task)
307
+ except CLIError as error:
308
+ status = (error.details or {}).get("status_code")
309
+ if status == 404:
310
+ error.message = "This document is unavailable, or the selected Hub does not support private documentation. Check the Hub version and run 'apheris-foundry docs list'."
311
+ elif status in {401, 403}:
312
+ error.message = "Private documentation requires Hub login and access to this deployment. Run 'apheris-foundry login' with an authorized account."
313
+ raise
314
+
315
+
316
+ def get_hub_documentation_index() -> dict[str, Any]:
317
+ return _request_hub_documentation("/api/v1/docs", "docs.list")
318
+
319
+
320
+ def get_hub_document(path: str) -> dict[str, Any]:
321
+ encoded = urllib.parse.quote(path, safe="/")
322
+ return _request_hub_documentation(f"/api/v1/docs/pages/{encoded}", "docs.show")
323
+
324
+
304
325
  def get_foundry_workflow_skill(workflow_id: str) -> dict[str, Any]:
305
326
  encoded = urllib.parse.quote(workflow_id, safe="")
306
327
  return _request_json(path=f"/api/v1/foundry/workflows/{encoded}/skill", method="GET", task="foundry.skills.get")
@@ -19,6 +19,7 @@ from typer.core import TyperGroup
19
19
 
20
20
  from apherisfold_cli.commands import login
21
21
  from apherisfold_cli.commands.compounds import app as compounds_app
22
+ from apherisfold_cli.commands.docs import app as docs_app
22
23
  from apherisfold_cli.commands.foundry import (
23
24
  _DEFAULT_LIST_LIMIT,
24
25
  RESEARCH_PREVIEW_NOTICE,
@@ -123,6 +124,7 @@ app.add_typer(login.app, name="login", help="Log in to a Hub instance or inspect
123
124
  app.add_typer(workflows_app, name="workflows")
124
125
  app.add_typer(jobs_app, name="jobs")
125
126
  app.add_typer(skills_app, name="skills")
127
+ app.add_typer(docs_app, name="docs")
126
128
  app.add_typer(settings_app, name="settings")
127
129
  app.add_typer(weights_app, name="weights")
128
130
  app.add_typer(tools_app, name="tools")
@@ -773,8 +775,11 @@ def _resolve_foundry_model_selection(
773
775
  def _foundry_model_params_schema(model: dict[str, Any]) -> dict[str, Any]:
774
776
  schemas = model.get("schemas")
775
777
  tasks = schemas.get("tasks") if isinstance(schemas, dict) else None
778
+ task_name = model.get("modelParamsTask")
779
+ if not isinstance(task_name, str) or not task_name:
780
+ raise typer.BadParameter("Hub did not declare a modelParams task for the selected model")
776
781
  task = (
777
- next((item for item in tasks if isinstance(item, dict) and item.get("name") == "predict"), None)
782
+ next((item for item in tasks if isinstance(item, dict) and item.get("name") == task_name), None)
778
783
  if isinstance(tasks, list)
779
784
  else None
780
785
  )
@@ -782,9 +787,11 @@ def _foundry_model_params_schema(model: dict[str, Any]) -> dict[str, Any]:
782
787
  properties = parameters.get("properties") if isinstance(parameters, dict) else None
783
788
  if not isinstance(properties, dict):
784
789
  raise typer.BadParameter("Hub did not provide model parameter schema for the selected model")
785
- # These are overrides; the workflow supplies required execution fields.
786
- # Keep definitions so model-published $ref constraints still resolve.
787
- return {**parameters, "required": []}
790
+ # Only fields explicitly supplied by the workflow may be omitted.
791
+ supplied = model.get("modelParamsSuppliedFields", [])
792
+ if not isinstance(supplied, list) or any(not isinstance(field, str) for field in supplied):
793
+ raise typer.BadParameter("Hub provided invalid workflow-supplied model parameter fields")
794
+ return {**parameters, "required": [field for field in parameters.get("required", []) if field not in supplied]}
788
795
 
789
796
 
790
797
  def _generic_input_files(input_paths: list[Path] | None) -> dict[str, str] | None:
@@ -69,6 +69,41 @@ Hub package deployment, not choosing one arbitrarily.
69
69
  actual settings, artifact locations, and limitations; execution success alone
70
70
  does not demonstrate a scientific improvement.
71
71
 
72
+ ### Passing workflow and model settings
73
+
74
+ Translate the selected workflow's client-neutral instructions into the CLI's
75
+ submission options. Discover supported settings with `workflows get` and
76
+ `workflows docs`, and model schemas with `workflows models`, each for the chosen
77
+ workflow. Use command-specific `--help` for the installed syntax.
78
+
79
+ - Select a model and weight with `--model` and `--weight` using catalog values.
80
+ - Pass a top-level workflow setting with `--param name=value`, repeated as needed.
81
+ - When the workflow supports a model-parameter object, pass it with
82
+ `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml`.
83
+ - Stage input manifests and workflow-specific configuration files through
84
+ `--input` as the workflow documents; their keys are not automatically flags.
85
+
86
+ Model parameters configure how the model runs and which outputs it writes.
87
+ Use `modelParamsTask` in model discovery to select the task's parameter schema;
88
+ preserve required fields except those listed in `modelParamsSuppliedFields`.
89
+ Structural fine-tuning requires an explicit positive `max_steps`; omission,
90
+ `null`, zero and negative values are invalid.
91
+ Apply the schema's types and constraints together with the workflow's restrictions. A model schema can advertise workflow-owned or
92
+ unsupported fields; CLI schema validation does not replace workflow validation.
93
+ Preserve field names, JSON booleans, arrays and numbers. Submit only intended
94
+ overrides: copying task-schema defaults can replace different workflow defaults.
95
+
96
+ For example, a documented `write_detailed_scores` model parameter goes inside
97
+ `--model-params '{"write_detailed_scores":true}'`; a documented `batchSize`
98
+ workflow setting uses `--param batchSize=5`. Do not rename fields, flatten model
99
+ fields into `--param`, or pass raw `--param modelParams=...`.
100
+ For structural fine-tuning, training fields such as `max_steps` and
101
+ `learning_rate` go in `--model-params`. Dataset-task overrides use the separate
102
+ workflow parameter, for example `--param 'datasetParams={"validation_failures":"ignore"}'`.
103
+ Hub validates both declared objects before staging a run.
104
+ These examples apply only when the deployed workflow
105
+ supports those settings; discover them before use.
106
+
72
107
  ### Research previews
73
108
 
74
109
  Workflow and model JSON may include `researchPreview: true`. When the selected
@@ -0,0 +1 @@
1
+ __version__ = "2.3.0"
@@ -384,6 +384,8 @@ def hub_api_fixture(monkeypatch):
384
384
  "seeds": [42],
385
385
  }
386
386
  },
387
+ "modelParamsTask": "predict",
388
+ "modelParamsSuppliedFields": ["weights"],
387
389
  "schemas": {
388
390
  "tasks": [
389
391
  {
@@ -415,6 +417,7 @@ def hub_api_fixture(monkeypatch):
415
417
  "type": "array",
416
418
  "items": {"type": "string"},
417
419
  },
420
+ "write_detailed_scores": {"type": "boolean", "default": False},
418
421
  },
419
422
  },
420
423
  }
@@ -852,6 +855,40 @@ def test_foundry_workflows_run_preserves_pocket_example_queries(tmp_path: Path,
852
855
  ]
853
856
 
854
857
 
858
+ @pytest.mark.parametrize("enabled", [True, False])
859
+ @pytest.mark.parametrize("from_file", [True, False])
860
+ def test_foundry_workflows_run_forwards_explicit_detailed_scores(
861
+ tmp_path: Path, hub_api_fixture, enabled: bool, from_file: bool
862
+ ) -> None:
863
+ request = tmp_path / "input.json"
864
+ request.write_text('{"queries": []}', encoding="utf-8")
865
+ model_params = {"num_diffusion_samples": 5, "seeds": [42], "write_detailed_scores": enabled}
866
+ encoded = json.dumps(model_params)
867
+ if from_file:
868
+ params_file = tmp_path / "model-params.json"
869
+ params_file.write_text(encoded, encoding="utf-8")
870
+ encoded = f"@{params_file}"
871
+
872
+ result = runner.invoke(
873
+ app,
874
+ [
875
+ "workflows",
876
+ "run",
877
+ "--workflow",
878
+ "predict",
879
+ "--input",
880
+ str(request),
881
+ "--model",
882
+ "openfold3",
883
+ "--model-params",
884
+ encoded,
885
+ ],
886
+ )
887
+
888
+ assert result.exit_code == 0, result.output
889
+ assert json.loads(hub_api_fixture["create_foundry_run"][0]["params"]["modelParams"]) == model_params
890
+
891
+
855
892
  def test_foundry_workflows_run_loads_model_params_from_json_file(tmp_path: Path, hub_api_fixture) -> None:
856
893
  request = tmp_path / "input.json"
857
894
  request.write_text('{"queries": []}', encoding="utf-8")
@@ -925,6 +962,8 @@ def test_foundry_workflows_run_rejects_missing_input_before_submission(workflow:
925
962
  "models": [
926
963
  {
927
964
  "id": "openfold3",
965
+ "modelParamsTask": "predict",
966
+ "modelParamsSuppliedFields": ["weights"],
928
967
  "schemas": {
929
968
  "tasks": [
930
969
  {
@@ -0,0 +1,102 @@
1
+ import hashlib
2
+ import json
3
+
4
+ import pytest
5
+ from typer.testing import CliRunner
6
+
7
+ from apherisfold_cli.commands import docs
8
+ from apherisfold_cli.core import hub_requests
9
+ from apherisfold_cli.core.errors import CLIError
10
+ from apherisfold_cli.main import app
11
+
12
+ runner = CliRunner()
13
+ PATH = "releases/example/notes.md"
14
+ CONTENT = "---\r\ndocument_type: release-notes\r\n---\r\n# Release\r\n\r\n| Name | Value |\r\n| --- | --- |\r\n| CLI | `docs list` |\r\n\r\n```bash\napheris-foundry login status\n```\n"
15
+
16
+
17
+ @pytest.fixture
18
+ def document(monkeypatch):
19
+ index = {
20
+ "hubVersion": "example",
21
+ "navigation": [{"title": "Releases", "children": [{"title": "Notes", "path": PATH}]}],
22
+ }
23
+ payload = {
24
+ "hubVersion": "example",
25
+ "title": "Notes",
26
+ "path": PATH,
27
+ "type": "release-notes",
28
+ "content": CONTENT,
29
+ "sha256": hashlib.sha256(CONTENT.encode()).hexdigest(),
30
+ }
31
+ monkeypatch.setattr(docs, "get_hub_documentation_index", lambda: index)
32
+ monkeypatch.setattr(docs, "get_hub_document", lambda path: payload)
33
+ return payload
34
+
35
+
36
+ def test_list_and_formatted_document(document):
37
+ result = runner.invoke(app, ["docs", "list"])
38
+ assert result.exit_code == 0, result.output
39
+ assert PATH in result.output
40
+ result = runner.invoke(app, ["docs", "show", PATH])
41
+ assert result.exit_code == 0, result.output
42
+ assert "Release" in result.output
43
+ assert "docs list" in result.output
44
+ assert "apheris-foundry login status" in result.output
45
+ assert "document_type" not in result.output
46
+ assert "| --- |" not in result.output
47
+
48
+
49
+ def test_export_preserves_exact_source_and_digest(document):
50
+ raw = runner.invoke(app, ["docs", "show", PATH, "--raw"])
51
+ assert raw.exit_code == 0, raw.output
52
+ assert raw.stdout_bytes == CONTENT.encode()
53
+ exported = runner.invoke(app, ["docs", "show", PATH, "--json"])
54
+ assert exported.exit_code == 0, exported.output
55
+ assert json.loads(exported.output) == document
56
+
57
+
58
+ @pytest.mark.parametrize(
59
+ "change", [{"content": "tampered"}, {"sha256": "bad"}, {"path": "other.md"}, {"content": None}]
60
+ )
61
+ def test_invalid_content_never_exported(document, change):
62
+ document.update(change)
63
+ result = runner.invoke(app, ["docs", "show", PATH, "--raw"])
64
+ assert result.exit_code != 0
65
+ assert not result.stdout_bytes
66
+
67
+
68
+ def test_unlisted_path_does_not_fetch(document, monkeypatch):
69
+ def unexpected(path):
70
+ pytest.fail("Unlisted path was fetched")
71
+
72
+ monkeypatch.setattr(docs, "get_hub_document", unexpected)
73
+ result = runner.invoke(app, ["docs", "show", "../secret.md"])
74
+ assert result.exit_code != 0
75
+ assert isinstance(result.exception, CLIError)
76
+ assert "docs list" in result.exception.message
77
+
78
+
79
+ @pytest.mark.parametrize("status", [401, 403, 404, 503])
80
+ def test_document_http_errors_preserve_status_and_help(status, monkeypatch):
81
+ def failed(**kwargs):
82
+ raise CLIError(
83
+ code=4, category="upstream", message="Original failure", task="docs", details={"status_code": status}
84
+ )
85
+
86
+ monkeypatch.setattr(hub_requests, "_request_json", failed)
87
+ with pytest.raises(CLIError) as error:
88
+ hub_requests.get_hub_documentation_index()
89
+ assert error.value.details["status_code"] == status
90
+ if status in {401, 403}:
91
+ assert "login" in error.value.message
92
+ elif status == 404:
93
+ assert "Hub" in error.value.message and "docs list" in error.value.message
94
+ else:
95
+ assert error.value.message == "Original failure"
96
+
97
+
98
+ def test_document_path_encoding(monkeypatch):
99
+ calls = []
100
+ monkeypatch.setattr(hub_requests, "_request_json", lambda **kwargs: calls.append(kwargs) or {})
101
+ hub_requests.get_hub_document("releases/example/a page.md")
102
+ assert calls[0]["path"] == "/api/v1/docs/pages/releases/example/a%20page.md"
@@ -18,6 +18,8 @@ def test_model_schema_references_are_preserved_for_yaml_overrides():
18
18
  }
19
19
  schema = _foundry_model_params_schema(
20
20
  {
21
+ "modelParamsTask": "predict",
22
+ "modelParamsSuppliedFields": ["weights"],
21
23
  "schemas": {"tasks": [{"name": "predict", "parameters": parameters}]},
22
24
  }
23
25
  )
@@ -98,9 +100,70 @@ def test_yaml_rejects_overflow_and_nested_duplicate_keys():
98
100
 
99
101
  def test_model_boolean_property_schemas_are_preserved():
100
102
  parameters = {"type": "object", "properties": {"allowed": True, "blocked": False}, "additionalProperties": False}
101
- schema = _foundry_model_params_schema({"schemas": {"tasks": [{"name": "predict", "parameters": parameters}]}})
103
+ schema = _foundry_model_params_schema(
104
+ {
105
+ "modelParamsTask": "predict",
106
+ "modelParamsSuppliedFields": ["weights"],
107
+ "schemas": {"tasks": [{"name": "predict", "parameters": parameters}]},
108
+ }
109
+ )
102
110
  validate({"allowed": {"anything": [1, 2]}}, schema)
103
111
  for overrides in ({"blocked": 1}, {"unknown": 1}):
104
112
  with pytest.raises(ValidationError):
105
113
  validate(overrides, schema)
106
114
  assert "required" not in parameters
115
+
116
+
117
+ @pytest.mark.parametrize("task_name", ["predict", "finetune", "custom-task"])
118
+ def test_model_parameter_task_is_declared_by_hub(task_name):
119
+ model = {
120
+ "modelParamsTask": task_name,
121
+ "schemas": {
122
+ "tasks": [
123
+ {"name": "unrelated", "parameters": {"type": "object", "properties": {"wrong": {"type": "string"}}}},
124
+ {
125
+ "name": task_name,
126
+ "parameters": {
127
+ "type": "object",
128
+ "properties": {"new_parameter": {"type": "number"}},
129
+ "additionalProperties": False,
130
+ },
131
+ },
132
+ ]
133
+ },
134
+ }
135
+ schema = _foundry_model_params_schema(model)
136
+ validate({"new_parameter": 0.01}, schema)
137
+ with pytest.raises(ValidationError):
138
+ validate({"wrong": "value"}, schema)
139
+ del model["modelParamsTask"]
140
+ with pytest.raises(Exception, match="did not declare a modelParams task"):
141
+ _foundry_model_params_schema(model)
142
+
143
+
144
+ @pytest.mark.parametrize("supplied", [[], ["weights"]])
145
+ def test_required_model_fields_remain_required(supplied):
146
+ parameters = {
147
+ "type": "object",
148
+ "required": ["weights", "max_steps"],
149
+ "properties": {
150
+ "weights": {"type": "string"},
151
+ "max_steps": {"type": "integer", "exclusiveMinimum": 0},
152
+ "options": {"type": "object", "required": ["count"], "properties": {"count": {"type": "integer"}}},
153
+ },
154
+ }
155
+ schema = _foundry_model_params_schema(
156
+ {
157
+ "modelParamsTask": "finetune",
158
+ "modelParamsSuppliedFields": supplied,
159
+ "schemas": {"tasks": [{"name": "finetune", "parameters": parameters}]},
160
+ }
161
+ )
162
+ for value in ({}, {"max_steps": None}, {"max_steps": -1}, {"max_steps": 0}):
163
+ with pytest.raises(ValidationError):
164
+ validate({"weights": "base", **value}, schema)
165
+ valid = {"max_steps": 5000} if supplied else {"max_steps": 5000, "weights": "base"}
166
+ validate(valid, schema)
167
+ with pytest.raises(ValidationError, match="count"):
168
+ validate({**valid, "options": {}}, schema)
169
+ assert parameters["required"] == ["weights", "max_steps"]
@@ -1 +0,0 @@
1
- __version__ = "2.2.0"