@delta-infra/cli 1.1.18 → 1.1.21

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 (77) hide show
  1. package/README.md +507 -513
  2. package/checksums.txt +5 -5
  3. package/package.json +3 -2
  4. package/scripts/install-wizard.js +689 -701
  5. package/scripts/install.js +442 -442
  6. package/scripts/run.js +65 -65
  7. package/skills/delta-protein/AGENTS.md +73 -0
  8. package/skills/delta-protein/SKILL.md +389 -0
  9. package/skills/delta-protein/agents/openai.yaml +4 -0
  10. package/skills/delta-protein/references/bfitter.md +64 -0
  11. package/skills/delta-protein/references/catapro_predict.md +63 -0
  12. package/skills/delta-protein/references/catpred_predict.md +65 -0
  13. package/skills/delta-protein/references/caver_tunnel_analyze.md +63 -0
  14. package/skills/delta-protein/references/consensus_mutation.md +61 -0
  15. package/skills/delta-protein/references/consurf_predict.md +67 -0
  16. package/skills/delta-protein/references/crop_sequence.md +69 -0
  17. package/skills/delta-protein/references/dock.md +82 -0
  18. package/skills/delta-protein/references/dock_score.md +70 -0
  19. package/skills/delta-protein/references/easifa_predict_active_site.md +70 -0
  20. package/skills/delta-protein/references/ephod_predict_mutation.md +66 -0
  21. package/skills/delta-protein/references/ephod_predict_protein.md +61 -0
  22. package/skills/delta-protein/references/esmfold2_predict.md +67 -0
  23. package/skills/delta-protein/references/evcouplings_mutation.md +64 -0
  24. package/skills/delta-protein/references/fasta_to_sequence.md +59 -0
  25. package/skills/delta-protein/references/foldseek.md +61 -0
  26. package/skills/delta-protein/references/generate_msa.md +61 -0
  27. package/skills/delta-protein/references/interpro_analyze.md +63 -0
  28. package/skills/delta-protein/references/mpnn_design_sequence.md +71 -0
  29. package/skills/delta-protein/references/multievolve.md +73 -0
  30. package/skills/delta-protein/references/pisa_query.md +70 -0
  31. package/skills/delta-protein/references/plip_analyze.md +65 -0
  32. package/skills/delta-protein/references/pocket_prediction.md +63 -0
  33. package/skills/delta-protein/references/protein_design.md +65 -0
  34. package/skills/delta-protein/references/protein_evolution.md +77 -0
  35. package/skills/delta-protein/references/protein_sol_predict_mutation.md +66 -0
  36. package/skills/delta-protein/references/protein_sol_predict_protein.md +61 -0
  37. package/skills/delta-protein/references/protenix.md +66 -0
  38. package/skills/delta-protein/references/protrek_search.md +90 -0
  39. package/skills/delta-protein/references/pubchem_search.md +68 -0
  40. package/skills/delta-protein/references/pubmed_search.md +79 -0
  41. package/skills/delta-protein/references/reap_design_primer.md +69 -0
  42. package/skills/delta-protein/references/rfd3_design.md +65 -0
  43. package/skills/delta-protein/references/structure_to_sequence.md +61 -0
  44. package/skills/delta-protein/references/summarize_result.md +68 -0
  45. package/skills/delta-protein/references/surface_charge.md +84 -0
  46. package/skills/delta-protein/references/uniprot_batch_query.md +63 -0
  47. package/skills/delta-protein/references/uniprot_query.md +64 -0
  48. package/skills/delta-protein/references/zero_shot_mutant_candidates.md +76 -0
  49. package/skills/delta-protein/scripts/gen_references.py +167 -0
  50. package/skills/delta-protein/scripts/output_metadata.json +275 -0
  51. package/skills/delta-sandbox/SKILL.md +388 -388
  52. package/skills/delta-sandbox/agents/openai.yaml +4 -4
  53. package/skills/delta-sandbox/references/commands.md +58 -58
  54. package/skills/delta-sandbox/references/lifecycle.md +100 -100
  55. package/skills/delta-sandbox/references/recipes.md +138 -138
  56. package/skills/delta-science/AGENTS.md +47 -47
  57. package/skills/delta-science/SKILL.md +227 -227
  58. package/skills/delta-science/agents/openai.yaml +4 -4
  59. package/skills/delta-science/references/antbo.md +105 -105
  60. package/skills/delta-science/references/delta-bo.md +92 -92
  61. package/skills/delta-science/references/gsasii.md +118 -118
  62. package/skills/delta-science/references/lammps.md +68 -68
  63. package/skills/delta-science/references/ldm-bo.md +132 -132
  64. package/skills/delta-science/references/materials-design.md +130 -130
  65. package/skills/delta-science/references/pubchem.md +128 -128
  66. package/skills/delta-science/references/pymatgen.md +69 -69
  67. package/skills/delta-science/references/qe.md +134 -134
  68. package/skills/delta-science/references/rdkit.md +141 -141
  69. package/skills/delta-science/references/strbo.md +95 -95
  70. package/skills/delta-science/references/synbo.md +201 -201
  71. package/skills/delta-science/references/xrd.md +688 -197
  72. package/skills/delta-science/scripts/catalog.py +92 -92
  73. package/skills/delta-science/scripts/generated_catalog.py +69 -69
  74. package/skills/delta-science/scripts/invoke.py +346 -346
  75. package/skills/delta-shared/SKILL.md +113 -113
  76. package/skills/delta-shared/agents/openai.yaml +4 -4
  77. package/skills/manifest.json +20 -19
@@ -1,197 +1,688 @@
1
- # XRD Cloud Compute reference
2
-
3
- `xrd` is a real tool for accessing XRD cloud compute through the Science tool proxy. Route every
4
- call through `delta-cli`; do not bypass the CLI with broker URLs, `curl`, `requests`, `httpx`, a
5
- browser or local XRD libraries. This is a tool reference for `delta-science`, not a second HTTP
6
- client.
7
-
8
- ## Tool and endpoints
9
-
10
- Before execution, use the live catalogue to confirm the canonical names and enabled status in the
11
- current environment:
12
-
13
- ```text
14
- delta-cli science list
15
- delta-cli science endpoints list xrd
16
- ```
17
-
18
- Copy `xrd` endpoint names exactly from the output of the second command. This reference covers
19
- the following stable contracts:
20
-
21
- | endpoint | Method/purpose | Request type |
22
- | --- | --- | --- |
23
- | `healthz`, `readyz`, `capabilities`, `xmatcher-status` | Readiness, capabilities and database status | Read-only JSON |
24
- | `xmatcher-artifacts` | Upload an observed pattern, model input, CIF or instrument parameters | `invoke --file` |
25
- | `xmatcher-artifact`, `xmatcher-artifact-content` | Query/read an artifact | `invoke --path-params` |
26
- | `xqueryer-predictions` | XQueryer single-phase candidate prediction | JSON |
27
- | `xmatcher-detect-peaks`, `xmatcher-match` | Peak detection and single-phase matching | JSON |
28
- | `xmatcher-multiphase-match`, `xdecomposer-predictions` | Multiphase matching and phase decomposition | JSON |
29
- | `xmatcher-cif-xrd`, `xmatcher-pdf-peaks-xlsx` | CIF simulation and PDF peak-table export | JSON/binary |
30
- | `xmatcher-refinement-patterns` | Generate refinement inputs and a provenance manifest | JSON |
31
- | `refinement-fullprof`, `refinement-gsasii`, `refinement-wpem` | Submit a refinement job to the corresponding backend | JSON + header |
32
- | `refinement-job`, `refinement-job-events`, `refinement-job-artifacts` | Query a refinement job | `invoke --path-params` |
33
- | `refinement-job-cancel` | Request refinement-job cancellation | `invoke --path-params` |
34
- | `mp500-cif-exports` | Export an MP500 structure as CIF | JSON |
35
-
36
- The live catalogue is authoritative. If an endpoint is absent from it, stop and report a
37
- configuration issue; do not retry under a different name.
38
-
39
- ## CLI argument mapping
40
-
41
- ```text
42
- --data Upstream JSON body
43
- --params Upstream URL query parameters
44
- --path-params Replace {artifact_id}/{job_id} in the endpoint path
45
- --headers Additional upstream headers, such as Idempotency-Key
46
- --file Send a local file to the tool proxy via file_base64
47
- --content-type The file's original MIME type
48
- ```
49
-
50
- `--params` cannot replace `--path-params`. Do not put local paths, base64, path parameters or
51
- idempotency keys in ordinary business `--data`. `science file` is a separate file interface for
52
- tools such as QE and Materials Design. XRD's `xmatcher-artifacts` is a tool-proxy endpoint; use
53
- `science invoke --file` for it.
54
-
55
- ## Call sequence
56
-
57
- 1. When the user explicitly asks for a diagnosis or execution, read `healthz` first; read
58
- `capabilities` only when you need to select a backend.
59
- 2. Upload real files through `xmatcher-artifacts` and save the returned `artifact_id` and `sha256`.
60
- 3. Use `xmatcher-match`, `xmatcher-multiphase-match` or `xdecomposer-predictions` for observed
61
- data; XQueryer uses `model_input_pattern`.
62
- 4. Use `xmatcher-cif-xrd` for CIF simulation. For refinement, call
63
- `xmatcher-refinement-patterns` first, then choose a refinement endpoint matching
64
- `data.backends`.
65
- 5. After submitting a refinement job, read its status and artifacts with `refinement-job`,
66
- `refinement-job-events` and `refinement-job-artifacts`.
67
-
68
- Do not present a returned `queued` state, scheduler completion or backend success as a scientific
69
- conclusion. For refinement, report the transport/job final state, backend execution state and
70
- scientific acceptance state separately.
71
-
72
- ## Readiness checks
73
-
74
- ```text
75
- delta-cli science invoke --tool xrd --endpoint healthz
76
- delta-cli science invoke --tool xrd --endpoint capabilities
77
- ```
78
-
79
- Call readiness/status additionally only when diagnosis requires it or the user explicitly asks.
80
- Every required component in the capabilities result must have `available` status. For production
81
- jobs, also check `asset_release_approved`, checksum fields and warnings. `auto` does not prove GPU
82
- use; report GPU use only when the result explicitly returns a GPU backend.
83
-
84
- ## Artifact upload and identity
85
-
86
- Upload an observed pattern:
87
-
88
- ```text
89
- delta-cli science invoke --tool xrd --endpoint xmatcher-artifacts `
90
- --file observed.csv `
91
- --params '{"filename":"observed.csv","kind":"observed_pattern","media_type":"text/csv"}' `
92
- --content-type application/octet-stream
93
- ```
94
-
95
- Allowed `kind` values are `observed_pattern`, `model_input_pattern`, `cif` and
96
- `instrument_parameters`. Save the successful response's `artifact_id` and `sha256` together and
97
- pass them to downstream calls unchanged. Pattern files are normalised by the server, so the
98
- returned digest identifies the normalised artifact and may differ from the digest of the local
99
- upload bytes.
100
-
101
- Use path parameters to query an artifact:
102
-
103
- ```text
104
- delta-cli science invoke --tool xrd --endpoint xmatcher-artifact `
105
- --path-params '{"artifact_id":"art_<returned-id>"}'
106
- ```
107
-
108
- Binary-content responses may return `data._binary=true`, `content_base64`, `media_type` and
109
- `content_length`. Decode only when the user asks to save the content or the workflow requires it,
110
- and verify it against the SHA-256 returned by the service. Do not infer the format from the filename.
111
-
112
- ## Phase identification and matching
113
-
114
- XQueryer's `model_input_pattern` must contain exactly 3,500 samples over 10 to 90 degrees 2theta,
115
- with intensities within the service's capability limits:
116
-
117
- ```text
118
- delta-cli science invoke --tool xrd --endpoint xqueryer-predictions `
119
- --data '{"schema_version":1,"pattern":{"artifact_id":"art_<model>","sha256":"<sha>"},"top_k":10,"radiation_profile":"CuKa"}'
120
- ```
121
-
122
- XMatcher observed pattern:
123
-
124
- ```text
125
- delta-cli science invoke --tool xrd --endpoint xmatcher-match `
126
- --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha>"},"top_n":10,"element_filter_mode":"contains"}'
127
- ```
128
-
129
- Multiphase matching:
130
-
131
- ```text
132
- delta-cli science invoke --tool xrd --endpoint xmatcher-multiphase-match `
133
- --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha>"},"max_phases":3,"candidate_pool":8}'
134
- ```
135
-
136
- The `score` from `xqueryer-predictions` is a softmax probability; the XMatcher `score` is
137
- `raw_score / 100`. Do not average them directly or treat them as the same calibrated probability.
138
-
139
- ## CIF simulation and peak tables
140
-
141
- Each artifact in `cifs` must provide both `artifact_id` and `sha256`:
142
-
143
- ```text
144
- delta-cli science invoke --tool xrd --endpoint xmatcher-cif-xrd `
145
- --data '{"schema_version":1,"cifs":[{"artifact":{"artifact_id":"art_<cif>","sha256":"<sha>"},"name":"phase"}],"two_theta_range":[5.0,90.0],"wavelength":"CuKa"}'
146
- ```
147
-
148
- `xmatcher-pdf-peaks-xlsx` returns a binary XLSX file; read and save it only when the user asks for an export.
149
-
150
- ## Refinement jobs
151
-
152
- First generate the corrected pattern and provenance manifest:
153
-
154
- ```text
155
- delta-cli science invoke --tool xrd --endpoint xmatcher-refinement-patterns `
156
- --data '{"schema_version":1,"source_pattern":{"artifact_id":"art_<observed>","sha256":"<sha>"}}'
157
- ```
158
-
159
- Then use the endpoint matching `data.backends`. The example below shows the structure; every
160
- artifact identity must come from the current call chain:
161
-
162
- ```text
163
- delta-cli science invoke --tool xrd --endpoint refinement-gsasii `
164
- --data '{"schema_version":1,"radiation_profile":"CuKa","refinement_pattern":{"observed_pattern":{"artifact_id":"art_<obs>","sha256":"<sha>"},"corrected_pattern":{"artifact_id":"art_<corrected>","sha256":"<sha>"},"provenance_manifest":{"artifact_id":"art_<manifest>","sha256":"<sha>"}},"phases":[{"phase_index":0,"name":"phase","cif":{"artifact_id":"art_<cif>","sha256":"<sha>"}}],"wavelengths_angstrom":[1.540593,1.544414],"backends":["gsasii"]}' `
165
- --headers '{"Idempotency-Key":"<stable-unique-key>"}'
166
- ```
167
-
168
- `refinement-fullprof`, `refinement-gsasii` and `refinement-wpem` select the billing/backend
169
- entry point. Do not interchange endpoint names or `backends` merely because they map to the same
170
- path. Submission, cancellation, retry and review are remote mutations and require the user's
171
- explicit authorisation. After a timeout or disconnection, do not retry blindly; first check
172
- whether a job has already been created.
173
-
174
- To query a job:
175
-
176
- ```text
177
- delta-cli science invoke --tool xrd --endpoint refinement-job `
178
- --path-params '{"job_id":"refjob_<returned-id>"}'
179
-
180
- delta-cli science invoke --tool xrd --endpoint refinement-job-events `
181
- --path-params '{"job_id":"refjob_<returned-id>"}'
182
- ```
183
-
184
- ## Results and errors
185
-
186
- - A call succeeds only when the CLI exits with code 0 and the top-level JSON `ok` is `true`.
187
- - Preserve the returned `data`, warnings, error detail and stable error codes exactly as returned.
188
- - `202`, `queued` and `running` describe job acceptance/execution state only; they do not mean the solver converged or the result was scientifically accepted.
189
- - `TIER_CONCURRENCY_EXCEEDED`, `Endpoint is disabled`, `ARTIFACT_MISSING`,
190
- `MP500_IDENTITY_MISMATCH` and similar errors should stop the current call chain; report the
191
- original detail and do not switch endpoints, rename them, guess parameters or substitute a
192
- local algorithm.
193
- - Use the live catalogue as the authority for paid endpoint prices and availability; before execution, confirm that the user actually requested the business call.
194
-
195
- Evidence boundary: business results in the current Delta CLI `data` only.
196
- Call chain: `delta-cli`.
197
- Do not add information absent from the response: yes.
1
+ # XRD reference
2
+
3
+ Make all online XRD calls with
4
+ `delta-cli science invoke --tool xrd --endpoint <operation>`.
5
+ Use the CLI's configured authentication and service address. Do not
6
+ call registry, gateway, or compute-service URLs directly, or follow returned
7
+ `content_url` and job `links` outside the CLI.
8
+
9
+ The OpenAPI contract version is `1.2.0`. Business requests and responses use
10
+ `schema_version: 1`.
11
+
12
+ This reference covers endpoints, artifact identities, request parameters, call
13
+ sequences, refinement jobs, quality assessment, and error handling. Replace
14
+ `art_<...>`, `<sha256>`, and `refjob_<...>` placeholders with values returned by
15
+ the service in the same workflow.
16
+
17
+ ## 1. Tool and operations
18
+
19
+ The CLI tool is `xrd`. Pass the operation names below exactly as `--endpoint`;
20
+ they are server catalogue contracts, not aliases. This table documents the
21
+ operations used by this reference, not a live inventory or price list.
22
+ When diagnosing availability, checking prices, or resolving a missing or
23
+ inconsistent contract, use CLI discovery:
24
+
25
+ ```text
26
+ delta-cli science list
27
+ delta-cli science endpoints list xrd
28
+ ```
29
+
30
+ Registration and enabled status do not establish backend readiness. Do not add
31
+ catalogue or health calls to an ordinary workflow unless needed for the task.
32
+
33
+ | Operation (`--endpoint`) | Purpose / response |
34
+ | --- | --- |
35
+ | `healthz` | Process liveness, JSON |
36
+ | `readyz` | Service readiness, JSON |
37
+ | `capabilities` | Components, versions, verification, modes, and limits |
38
+ | `xqueryer-predictions` | Single-phase model predictions |
39
+ | `xmatcher-detect-peaks` | Observed peak detection |
40
+ | `xmatcher-match` | Single-phase matching |
41
+ | `xmatcher-multiphase-match` | Multiphase candidate matching |
42
+ | `xmatcher-cif-xrd` | Theoretical XRD simulation from CIFs |
43
+ | `xmatcher-pdf-peaks-xlsx` | Theoretical peak tables, binary XLSX |
44
+ | `xmatcher-status` | XMatcher database status |
45
+ | `xdecomposer-predictions` | Multiphase model decomposition |
46
+ | `xmatcher-refinement-patterns` | Corrected pattern and provenance manifest |
47
+ | `mp500-cif-exports` | Export a CIF by database identity |
48
+ | `xmatcher-artifacts` | Upload file bytes and return an artifact reference |
49
+ | `xmatcher-artifact` | Artifact metadata |
50
+ | `xmatcher-artifact-content` | Artifact content, binary |
51
+ | `refinement-job` | Job status and results |
52
+ | `refinement-job-cancel` | Request cancellation |
53
+ | `refinement-job-events` | Paginated job events |
54
+ | `refinement-job-artifacts` | Public job artifacts |
55
+ | `refinement-fullprof` | Submit a FullProf job |
56
+ | `refinement-gsasii` | Submit a GSAS-II job |
57
+ | `refinement-wpem` | Submit a PyXplore/WPEM job |
58
+ | `simulation-cif-parse` | Parse CIF data blocks |
59
+ | `simulation-cif-peaks` | Simulate reflections for a selected block and wavelength |
60
+ | `pdfreporter-analyses` | Multiphase peak assignments and charts |
61
+ | `pdfreporter-assignments` | Recompute analysis with manual assignments |
62
+
63
+ The refinement operations select backend and billing entries. Request `backends`
64
+ values are `pyxplore`, `fullprof`, and `gsasii`; `refinement-wpem` corresponds to
65
+ PyXplore/WPEM. Match the operation and requested backends to the catalogue contract.
66
+
67
+ ## 2. Request conventions and CLI argument mapping
68
+
69
+ Pass business JSON through `--data`. For file uploads, pass local bytes through
70
+ `--file` and set `--content-type application/octet-stream`; uploads are not
71
+ multipart requests. Authentication is handled by the CLI, not business JSON or
72
+ manually supplied service tokens. Business request models reject unknown fields.
73
+
74
+ An optional `X-Request-ID` in `--headers` accepts 1–128 characters from letters,
75
+ digits, and `._:-`. Preserve the returned request ID for diagnostics.
76
+
77
+ | CLI argument | Meaning for XRD calls |
78
+ | --- | --- |
79
+ | `--data` | JSON request body |
80
+ | `--params` | URL query parameters, including upload metadata and event pagination |
81
+ | `--path-params` | Artifact or job identity: `artifact_id` or `job_id` |
82
+ | `--headers` | Additional headers, such as `Idempotency-Key` and `X-Content-SHA256` |
83
+ | `--file` | Upload a local file through the CLI |
84
+ | `--content-type` | Upload body Content-Type; use `application/octet-stream` |
85
+
86
+ `--params` cannot replace `--path-params`. Keep local paths, base64 content, and
87
+ idempotency keys out of business JSON. Use `science invoke --file` for XRD uploads.
88
+ The `media_type` query parameter describes the stored file format separately
89
+ from the upload body Content-Type.
90
+
91
+ All operations in this reference, including uploads, binary responses, and XRD
92
+ refinement jobs, use `science invoke`. The `science file` and `science task`
93
+ adapters documented for QE/Materials Design do not replace these XRD operations.
94
+
95
+ ```text
96
+ delta-cli science invoke --tool xrd --endpoint <operation> `
97
+ [--data JSON] [--params JSON] [--path-params JSON] [--headers JSON]
98
+ ```
99
+
100
+ Pass each JSON object as one safely quoted argument. The examples below use
101
+ PowerShell continuation syntax. A call succeeds only when the CLI exits with
102
+ code 0 and its top-level JSON has `ok:true`; read business fields from `data`.
103
+
104
+ ## 3. Call sequence
105
+
106
+ 1. Select the documented operation; inspect the CLI catalogue, readiness, or
107
+ required capabilities only when the task or diagnosis requires it.
108
+ 2. Upload observed patterns, model inputs, CIFs, or instrument files. Save the
109
+ returned `artifact_id` and `sha256` together.
110
+ 3. Use XMatcher or XDecomposer for observed data. XQueryer requires a prepared
111
+ `model_input_pattern`.
112
+ 4. Export candidate CIFs by identity or upload CIF files. Run theoretical
113
+ simulations and PDF Reporter peak assignments as needed.
114
+ 5. Generate a corrected pattern and manifest for basic refinement. GSAS report
115
+ mode uses an observed pattern uploaded with its original bytes preserved.
116
+ 6. Submit a job with an idempotency key, query its status and events, and verify
117
+ downloaded artifact hashes.
118
+ 7. Report job status, backend execution status, fit quality, physical validity,
119
+ and scientific acceptance separately.
120
+
121
+ ## 4. Readiness and capabilities
122
+
123
+ ```text
124
+ delta-cli science invoke --tool xrd --endpoint healthz
125
+ delta-cli science invoke --tool xrd --endpoint readyz
126
+ delta-cli science invoke --tool xrd --endpoint capabilities
127
+ delta-cli science invoke --tool xrd --endpoint xmatcher-status
128
+ ```
129
+
130
+ `healthz` returns business `{"ok":true}` for process liveness.
131
+ `readyz` checks authentication configuration and required components;
132
+ an unready service fails the call. Keep probe business `ok` distinct from the
133
+ CLI envelope's top-level `ok`.
134
+
135
+ `xmatcher-status` queries XMatcher database status without a request body.
136
+
137
+ `capabilities` returns `components.<name>.available`, component `details`,
138
+ `limits`, and build information. Check the components required for the workflow,
139
+ checksums, asset release approval, and mode availability. Report GPU use only when
140
+ the returned device or backend explicitly supports that conclusion.
141
+
142
+ For GSAS report mode, check both:
143
+
144
+ ```text
145
+ components.gsasii.available
146
+ components.gsasii.details.workflow_modes["gsas-report-initial-v1"].available
147
+ ```
148
+
149
+ Mode fields include `max_phases`, `defaults`, `policy_version`, `official_score`,
150
+ and `accepts_recipe`. The common request model accepts 1–3 phases, while a backend
151
+ mode may impose a lower limit. GSAS report mode supports up to two phases as
152
+ described in its detailed contract; consult the deployed capability for its limit.
153
+
154
+ ## 5. Artifact upload, identity, and download
155
+
156
+ ### Upload
157
+
158
+ Operation: `xmatcher-artifacts`. Pass the local file with `--file`; read the
159
+ returned `ArtifactRef` from CLI `data`. Query its identity with
160
+ `xmatcher-artifact` and `--path-params`, rather than a returned URL.
161
+
162
+ | Parameter | CLI argument | Requirement |
163
+ | --- | --- | --- |
164
+ | `filename` | `--params` | Required; 1–255 characters; no `/` or `\` |
165
+ | `kind` | `--params` | Required; accepted kinds are listed below |
166
+ | `media_type` | `--params` | Required; 1–255 characters; no line breaks |
167
+ | `preserve_source` | `--params` | Default false; preserve original observed text pattern bytes |
168
+ | `X-Content-SHA256` | `--headers` | Optional; 64 lowercase hexadecimal characters, hashing the upload bytes |
169
+
170
+ | Accepted upload kind | File and processing rules |
171
+ | --- | --- |
172
+ | `observed_pattern`, `model_input_pattern` | `.csv/.xy/.xye/.dat/.txt/.xrdml/.raw`; normalization to headerless two-column CSV is attempted by default |
173
+ | `background_prepared_pattern`, `background_curve` | Same pattern extensions; stored verbatim for PyXplore prepared mode |
174
+ | `cif` | `.cif/.mcif`; stored verbatim |
175
+ | `instrument_parameters` | `.instprm`; stored verbatim |
176
+ | `pcr`, `irf_profile` | Stored verbatim; upload has no extension restriction |
177
+
178
+ Pattern uploads are limited to the smaller of the configured upload limit and
179
+ 20,000,000 bytes. Instrument uploads are limited to the smaller of that limit
180
+ and 2,000,000 bytes. Other files use `max_upload_bytes`. Empty bodies are rejected.
181
+
182
+ Text patterns that fail conversion may be stored as received and rejected at
183
+ compute time. Vendor-format parsing failures are rejected during upload.
184
+
185
+ ```text
186
+ delta-cli science invoke --tool xrd --endpoint xmatcher-artifacts `
187
+ --file observed.csv `
188
+ --params '{"filename":"observed.csv","kind":"observed_pattern","media_type":"text/csv"}' `
189
+ --content-type application/octet-stream
190
+ ```
191
+
192
+ For GSAS report mode, add `"preserve_source":true` to `--params`. This requires
193
+ `kind=observed_pattern` and a `.csv/.xy/.xye/.dat/.txt` filename. It preserves
194
+ original bytes, line endings, and sigma values, and returns
195
+ `metadata.source_preserved=true`.
196
+
197
+ The upload response includes `artifact_id`, `kind`, `filename`, `media_type`,
198
+ `size_bytes`, `sha256`, `created_at`, `content_url`, `metadata`, and `producer`.
199
+ For normalized patterns, the returned digest identifies the converted artifact
200
+ and may differ from the local upload digest.
201
+
202
+ ### Downstream references
203
+
204
+ An input artifact reference contains exactly two fields:
205
+
206
+ ```json
207
+ {"artifact_id":"art_<returned-id>","sha256":"<sha256>"}
208
+ ```
209
+
210
+ Artifact IDs contain `art_` followed by 32 lowercase hexadecimal characters.
211
+ SHA-256 values contain 64 lowercase hexadecimal characters. Pass only these
212
+ fields to `ArtifactInput`; fields such as `filename` and `content_url` are rejected.
213
+
214
+ ```text
215
+ delta-cli science invoke --tool xrd --endpoint xmatcher-artifact `
216
+ --path-params '{"artifact_id":"art_<returned-id>"}'
217
+
218
+ delta-cli science invoke --tool xrd --endpoint xmatcher-artifact-content `
219
+ --path-params '{"artifact_id":"art_<returned-id>"}'
220
+ ```
221
+
222
+ Read binary content from the documented CLI response fields. The tool proxy may
223
+ wrap it as `data._binary`, `data.content_base64`, `data.media_type`, and
224
+ `data.content_length`. Decode `content_base64` only when the response declares
225
+ that representation. Verify saved content against the artifact's returned
226
+ SHA-256, and determine its format from the media type and content.
227
+
228
+ ## 6. Phase identification and matching
229
+
230
+ ### XQueryer: `xqueryer-predictions`
231
+
232
+ `pattern` must reference a `model_input_pattern` containing exactly 3,500 points
233
+ on a uniform 10–90° 2theta grid. Maximum grid error is `1e-6`. Intensities must be
234
+ nonnegative within `1e-8` tolerance and normalized to a maximum of 100 within
235
+ `1e-6` tolerance. Upload format conversion does not guarantee these constraints.
236
+
237
+ ```text
238
+ delta-cli science invoke --tool xrd --endpoint xqueryer-predictions `
239
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<model>","sha256":"<sha256>"},"top_k":10,"elements":["Mn","O"],"radiation_profile":"CuKa"}'
240
+ ```
241
+
242
+ `top_k` defaults to 50 and accepts 1–5000. `elements` defaults to an empty array,
243
+ accepts up to 16 entries, and supports H through U. `radiation_profile` is `CuKa`.
244
+ Optional `expected_versions` can pin checkpoint, MP500 database, and XMatcher
245
+ database digests.
246
+
247
+ The response includes `backend`, `status`, `duration_ms`, `candidates`,
248
+ `provenance`, and `request_id`. Candidates include rank, class_id, entry_id,
249
+ mp_id, formula, score, and available structure information. The score is a
250
+ softmax probability.
251
+
252
+ ### Peak detection and single-phase XMatcher
253
+
254
+ `xmatcher-detect-peaks` accepts `schema_version`, `pattern`, `params`,
255
+ and optional `expected_xmatcher_database_sha256`. XMatcher accepts
256
+ `observed_pattern` or `model_input_pattern` artifacts.
257
+
258
+ ```text
259
+ delta-cli science invoke --tool xrd --endpoint xmatcher-detect-peaks `
260
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"},"params":{"n_peaks":8}}'
261
+
262
+ delta-cli science invoke --tool xrd --endpoint xmatcher-match `
263
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"},"top_n":10,"elements":["Mn","O"],"element_filter_mode":"contains","formula":"Mn2O3"}'
264
+ ```
265
+
266
+ Single-phase `top_n` defaults to 10 and accepts 1–5000. Element filtering uses
267
+ `contains` by default, allowing additional elements; `exact` requires a matching
268
+ element set. Optional `formula` must be nonempty and at most 128 characters.
269
+
270
+ XMatcher matching responses include `status=ok`, `results`, `detected_peaks`,
271
+ `processed_spectrum`, `params`, `ranking`, and `calibration`. The runtime adds
272
+ duration, request_id, and provenance. Candidates retain native score or
273
+ peak_match_score values and include calibration_adjusted_score. Interpret ranks
274
+ using `ranking` and `effective_settings`. Learned mode explicitly reports
275
+ `score_is_probability=false`; do not average these scores with XQueryer probabilities.
276
+
277
+ ### Multiphase XMatcher: `xmatcher-multiphase-match`
278
+
279
+ ```text
280
+ delta-cli science invoke --tool xrd --endpoint xmatcher-multiphase-match `
281
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"},"top_n":10,"max_phases":3,"candidate_pool":20,"prefer_multiphase":false}'
282
+ ```
283
+
284
+ | Parameter | Default / range |
285
+ | --- | --- |
286
+ | `top_n` | 10; 1–50 |
287
+ | `max_phases` | 3; 1–3 |
288
+ | `candidate_pool` | 20; 2–30 |
289
+ | `elements`, `element_filter_mode` | Empty array, contains; up to 16 elements |
290
+ | `known_phase_elements`, `known_phase_formulas`, `known_phase_mpids` | Optional string or array of strings |
291
+ | `prefer_multiphase` | false |
292
+ | `params` | XMatcher parameter object |
293
+ | `expected_xmatcher_database_sha256` | Optional database digest pin |
294
+
295
+ ### XMatcher `params`
296
+
297
+ These are request model defaults. The runtime forwards explicitly set values
298
+ using `exclude_unset`; use returned evidence and the deployed adapter to determine
299
+ effective settings.
300
+
301
+ | Parameter | Model default | Constraint |
302
+ | --- | --- | --- |
303
+ | `min_peak_height` / `min_peak_prominence` | 3.0 / 2.0 | >0 / ≥0 |
304
+ | `min_peak_distance` / `smooth_window` | 0.1 / 7 | >0 / integer 1–255 |
305
+ | `baseline_window_fraction` | 0.05 | (0,1] |
306
+ | `n_peaks` / `min_matched_peaks` | 8 / 4 | 1–100 / 1–50 |
307
+ | `position_tolerance` | 0.2 | (0,2] |
308
+ | `intensity_weight` / `position_weight` | 0.15 / 0.85 | Both ≥0; sum >0 |
309
+ | `scoring_method` | hybrid | hybrid / weighted / fom / combined |
310
+ | `max_shift` / `shift_step` | 0.5 / 0.02 | (0,5] / (0,1] |
311
+ | `shift_warning_fraction` / `shift_penalty_max_fraction` | 0.60 / 0.20 | (0,1] / [0,1] |
312
+ | `fixed_zero_shift` / `specimen_displacement` | 0 / 0 | Finite numbers |
313
+ | `multiphase_n_peaks` | 20 | null or integer 1–80 |
314
+ | `learned_ranking` / `learned_candidate_pool` | true / 24 | Boolean / 1–30 |
315
+ | `learned_missing_peak_weight` / `learned_phase_penalty` | 0.15 / 3.0 | ≥0 |
316
+ | `learned_minimum_contribution` / `learned_evidence_weight` | 3.0 / 4.0 | [0,100) / ≥0 |
317
+ | `multiphase_diversify_candidates` | true | Boolean |
318
+ | `multiphase_missing_peak_weight` / `multiphase_phase_penalty` | 0.5 / 3.0 | ≥0 |
319
+ | `multiphase_minimum_phase_contribution_percent` | 8.0 | [0,100) |
320
+
321
+ ### XDecomposer: `xdecomposer-predictions`
322
+
323
+ ```text
324
+ delta-cli science invoke --tool xrd --endpoint xdecomposer-predictions `
325
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"},"top_k":5,"radiation_profile":"CuKa"}'
326
+ ```
327
+
328
+ `pattern` must reference an `observed_pattern`. `top_k` defaults to 5 and accepts
329
+ 1–20. The response includes `phases`, `provenance`, duration, and request ID.
330
+ Each phase includes `phase_index`, `active`, `activity_probability`, `mp_id`,
331
+ `match_score`, `row_id`, and `alternatives`. Phase indices may start at 0 here;
332
+ map them to unique indices in 1–3 when constructing refinement requests.
333
+
334
+ ## 7. CIFs, theoretical patterns, and peak tables
335
+
336
+ ### XMatcher simulation and XLSX export
337
+
338
+ Operations: `xmatcher-cif-xrd` and `xmatcher-pdf-peaks-xlsx`; they share a request model.
339
+
340
+ ```text
341
+ delta-cli science invoke --tool xrd --endpoint xmatcher-cif-xrd `
342
+ --data '{"schema_version":1,"cifs":[{"artifact":{"artifact_id":"art_<cif>","sha256":"<sha256>"},"name":"phase","weight":1.0}],"two_theta_range":[5.0,90.0],"wavelength":"CuKa","fwhm":0.12,"step":0.02,"normalize":true}'
343
+ ```
344
+
345
+ `cifs` contains 1–5 entries, each with an `artifact`, optional name, and
346
+ nonnegative weight defaulting to 1. `two_theta_range` must be finite and
347
+ increasing. `min_intensity` defaults to 0 and must be nonnegative; fwhm and step
348
+ must be positive. `wavelength` is a string, separate from the numeric `lambda`
349
+ field in `simulation-cif-peaks` below. `expected_xmatcher_database_sha256` is optional.
350
+
351
+ For peak-table export, use the same `--data` shape with
352
+ `--endpoint xmatcher-pdf-peaks-xlsx`. The response contains XLSX bytes with media
353
+ type `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`; decode
354
+ the CLI binary response as described in section 5.
355
+
356
+ ### MP500, RRUFF, and OPXRD CIF export
357
+
358
+ Operation: `mp500-cif-exports`. It requires both the candidate entry_id and its identity:
359
+
360
+ ```text
361
+ delta-cli science invoke --tool xrd --endpoint mp500-cif-exports `
362
+ --data '{"schema_version":1,"entry_id":1235,"expected_mp_id":"mp-<candidate-id>"}'
363
+ ```
364
+
365
+ `entry_id` is a positive integer. `expected_mp_id` comes from the selected
366
+ candidate and accepts up to 128 characters. Entries above 100315 use the local
367
+ RRUFF/OPXRD namespace, where expected_mp_id identifies a cryst_id such as
368
+ `RRUFF:...` or `OPXRD:...`.
369
+
370
+ Optional `expected_database_sha256` must identify the database being queried.
371
+ The response includes `entry_id`, `mp_id`, `structure`, and `cif_artifact`.
372
+ Use the returned CIF artifact identity downstream. Identity mismatches produce
373
+ MP500 or RRUFF mismatch errors; do not substitute guessed identifiers.
374
+
375
+ ### CIF block parsing and reflection simulation
376
+
377
+ Operation: `simulation-cif-parse`. Pass this request through `--data`:
378
+
379
+ ```json
380
+ {"schema_version":1,"cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"}}
381
+ ```
382
+
383
+ ```text
384
+ delta-cli science invoke --tool xrd --endpoint simulation-cif-parse `
385
+ --data '{"schema_version":1,"cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"}}'
386
+ ```
387
+
388
+ The response contains `blocks[]`. Successful blocks include block_index,
389
+ block_name, formula, cell, volume, site_count, spacegroup, and warnings. Failed
390
+ blocks include block_index and error. Inspect individual blocks even when the
391
+ CLI invocation succeeds.
392
+
393
+ Operation: `simulation-cif-peaks`. Pass this request through `--data`:
394
+
395
+ ```json
396
+ {"schema_version":1,"cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"},"block":0,"lambda":1.5406,"min_angle":5.0,"max_angle":90.0}
397
+ ```
398
+
399
+ ```text
400
+ delta-cli science invoke --tool xrd --endpoint simulation-cif-peaks `
401
+ --data '{"schema_version":1,"cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"},"block":0,"lambda":1.5406,"min_angle":5.0,"max_angle":90.0}'
402
+ ```
403
+
404
+ `block` selects a block index or name. It may be omitted only when exactly one
405
+ structure block was parsed successfully. `lambda` is the required JSON field
406
+ name, accepting (0,5] Å. min_angle accepts [0.1,174], and max_angle accepts
407
+ [0.2,175]; calculation also validates the angle range.
408
+ The response identifies the selected block and contains `peaks[]`.
409
+ Neither simulation endpoint depends on XMatcher search assets.
410
+
411
+ ## 8. PDF Reporter peak assignments
412
+
413
+ Operation: `pdfreporter-analyses`. Pass this request through `--data`:
414
+
415
+ ```json
416
+ {
417
+ "schema_version":1,
418
+ "observed_pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"},
419
+ "phases":[{"cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"},"name":"phase","color":"#226ba0","visible":true}],
420
+ "wavelength_angstrom":1.5406,
421
+ "tolerance":0.20,
422
+ "intensity_threshold_percent":10,
423
+ "min_peak_distance":0.08,
424
+ "min_prominence_percent":0,
425
+ "render":true
426
+ }
427
+ ```
428
+
429
+ ```text
430
+ delta-cli science invoke --tool xrd --endpoint pdfreporter-analyses `
431
+ --data '{"schema_version":1,"observed_pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"},"phases":[{"cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"},"name":"phase","color":"#226ba0","visible":true}],"wavelength_angstrom":1.5406,"tolerance":0.20,"intensity_threshold_percent":10,"min_peak_distance":0.08,"min_prominence_percent":0,"render":true}'
432
+ ```
433
+
434
+ The request accepts 1–8 phases. Phase name and color are optional; color is a
435
+ six-digit hexadecimal color, and visible defaults to true. The observed artifact
436
+ may be observed_pattern or model_input_pattern. Each pattern or CIF is limited
437
+ to 4,000,000 bytes, and observed patterns to 500,000 points.
438
+
439
+ Wavelength accepts (0,5] Å; tolerance accepts (0,2]°; both percentage parameters
440
+ accept [0,100]; min_peak_distance must be nonnegative.
441
+
442
+ The response includes per-phase theory tables in `phases`, flattened theory in
443
+ `th`, observed peaks in `pk`, `peaks_csv`, `theory_csv`, `chart.svg`, and optional
444
+ `chart.png`. Charts are downloadable artifact references. PNG is null when
445
+ rasterization dependencies are unavailable.
446
+ Peak statuses are `unmatched`, `unique`, `ambiguous`, and `manual`.
447
+
448
+ Operation: `pdfreporter-assignments`. Resubmit the complete analysis input through
449
+ `--data` and add this field:
450
+
451
+ ```json
452
+ {"selections":{"38.45|0":"0:0","30.05|0":"none"}}
453
+ ```
454
+
455
+ ```text
456
+ delta-cli science invoke --tool xrd --endpoint pdfreporter-assignments `
457
+ --data '{"schema_version":1,"observed_pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"},"phases":[{"cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"},"name":"phase","color":"#226ba0","visible":true}],"wavelength_angstrom":1.5406,"tolerance":0.20,"intensity_threshold_percent":10,"min_peak_distance":0.08,"min_prominence_percent":0,"render":true,"selections":{"38.45|0":"0:0","30.05|0":"none"}}'
458
+ ```
459
+
460
+ This is a field fragment, not a complete request. Keys have the form
461
+ `<observed-2theta>|<phase-id>`, with zero-based phase IDs. Values are a returned
462
+ matches[].key, `none` to exclude a phase, or `auto` to restore automatic assignment.
463
+ The endpoint recomputes statelessly; it does not update an analysis by analysis_id.
464
+ Theory uses a simplified Z scattering approximation. Results support preliminary
465
+ assignments and do not establish phase confirmation or weight fractions.
466
+
467
+ ## 9. Asynchronous refinement
468
+
469
+ ### Basic input preparation
470
+
471
+ ```text
472
+ delta-cli science invoke --tool xrd --endpoint xmatcher-refinement-patterns `
473
+ --data '{"schema_version":1,"source_pattern":{"artifact_id":"art_<observed>","sha256":"<sha256>"}}'
474
+ ```
475
+
476
+ The response includes `refinement_pattern_id`, `cache_hit`, `artifact`,
477
+ `manifest_artifact`, and `manifest`. Use artifact for corrected_pattern and
478
+ manifest_artifact for provenance_manifest.
479
+ This endpoint accepts schema_version, source_pattern, and optional expected_versions.
480
+ `normalize=false`, `remove_baseline=true`, and `smooth=false` are fixed internal
481
+ processing settings, not additional request fields.
482
+
483
+ ### Basic job submission
484
+
485
+ Operations: `refinement-fullprof`, `refinement-gsasii`, or `refinement-wpem`.
486
+ Pass `Idempotency-Key` through `--headers`, with 8–200 characters. The example
487
+ submits GSAS-II; select the corresponding operation and explicit `backends`
488
+ value for FullProf or PyXplore. Submission and cancellation require the user's
489
+ authorisation for that action.
490
+
491
+ ```text
492
+ delta-cli science invoke --tool xrd --endpoint refinement-gsasii `
493
+ --data '{"schema_version":1,"radiation_profile":"CuKa","refinement_pattern":{"observed_pattern":{"artifact_id":"art_<observed>","sha256":"<observed-sha>"},"corrected_pattern":{"artifact_id":"art_<corrected>","sha256":"<corrected-sha>"},"provenance_manifest":{"artifact_id":"art_<manifest>","sha256":"<manifest-sha>"}},"phases":[{"phase_index":1,"name":"phase","cif":{"artifact_id":"art_<cif>","sha256":"<cif-sha>"}}],"wavelengths_angstrom":[1.540593,1.544414],"backends":["gsasii"],"options":{"timeout_seconds":900,"gsasii":{"workflow_mode":"basic-v1"}}}' `
494
+ --headers '{"Idempotency-Key":"<stable-unique-key>"}'
495
+ ```
496
+
497
+ | Common field | Rule |
498
+ | --- | --- |
499
+ | `schema_version` | Required; 1 |
500
+ | `radiation_profile` | Default and enum CuKa; actual wavelengths are specified separately |
501
+ | `refinement_pattern` | Required; basic mode uses observed, corrected, and a valid manifest |
502
+ | `phases` | Required; 1–3 phases; unique phase_index values in 1–3; name and cif required; mp_id and entry_id optional |
503
+ | `wavelengths_angstrom` | Required; 1–2 finite positive numbers in Å; single line or doublet, preserving order |
504
+ | `backends` | 1–3 unique values; defaults to all three backends; explicit selection is recommended |
505
+ | `options.timeout_seconds` | Default 900; integer 1–3600 |
506
+ | `expected_versions` | Optional asset digest pins |
507
+
508
+ Basic mode verifies manifest source/output hashes, point counts, a shared 2theta
509
+ grid, and the fixed preprocessing policy. Basic doublet intensity ratio is 0.5.
510
+ GSAS instrument files must match requested wavelengths.
511
+
512
+ ### Backend options
513
+
514
+ | Backend | Field | Default / constraint |
515
+ | --- | --- | --- |
516
+ | PyXplore | `iterations` | 10; integer 1–200 |
517
+ | PyXplore | `initialization_epoch` | 2; strict integer ≥0; rejects Boolean, float, string, and null |
518
+ | PyXplore | `peak_generation_range` | null or two finite increasing angles; explicit endpoints must be at least 5° inside the observed range |
519
+ | PyXplore | `structure_solve` | false; true runs per-phase presolving against the full observed pattern |
520
+ | PyXplore | `low_bound` / `up_bound` | Optional; effective defaults 20 / 70; separate from peak generation range |
521
+ | PyXplore | `background` | Overrides LFctg, lowAngleRange, poly_n, bac_split, bac_num, window_length, and polyorder |
522
+ | FullProf | `cycles` / `continuations` | 12 / 2; integer 1–100 / 0–5 |
523
+ | FullProf | `stages` | Empty by default, using backend defaults; supports explicit staged actions |
524
+ | FullProf | `start_from_pcr` | Optional pcr reference; continuation requires explicit stages |
525
+ | FullProf | `raw_pattern` | false; true requires FullProf only and bypasses XMatcher lineage |
526
+ | GSAS basic | `workflow_mode` | basic-v1 |
527
+ | GSAS basic | `cycles` | 8; integer 1–100 |
528
+ | GSAS basic | `refine_zero` / `refine_profile` / `refine_cell` | true / true / true |
529
+ | GSAS basic | `refine_atoms` | false only |
530
+ | GSAS | `instrument_artifact` / `instrument_calibrated` | null / false; calibration requires server-verified records |
531
+
532
+ FullProf stage group values are scale, background, zero, cell, profile_w,
533
+ displacement, coordinates, adp, and occupancy. background_terms accepts 1–5;
534
+ cycles and continuations may be overridden per stage. Structure groups support
535
+ atoms and adp_link values site/species. A script cannot release both zero and
536
+ displacement. In raw_pattern mode, corrected_pattern is still required and must
537
+ reference observed_pattern or model_input_pattern.
538
+
539
+ PyXplore `background.prepared=true` requires a PyXplore-only job. corrected_pattern
540
+ must be background_prepared_pattern, and background.background_curve must be
541
+ background_curve; the manifest may be omitted. The service verifies all three
542
+ grids and identities and skips BackgroundFit. Caller settings are not reported
543
+ as server-measured execution evidence.
544
+
545
+ Basic PyXplore BackgroundFit operates on the observed pattern. The theoretical
546
+ peak generation range does not crop the original fitting or assessment pattern.
547
+ Execution configuration, iteration metrics, and download evidence are available
548
+ in `summary.wpem_evidence`.
549
+
550
+ ### GSAS report mode
551
+
552
+ `options.gsasii.workflow_mode="gsas-report-initial-v1"` requires
553
+ `backends=["gsasii"]`. Upload the original observed text pattern with
554
+ preserve_source=true. This mode prohibits corrected_pattern,
555
+ provenance_manifest, and basic-mode cycles/refine switches.
556
+
557
+ Submit with `--endpoint refinement-gsasii`, business JSON in `--data`, and the
558
+ idempotency key in `--headers`:
559
+
560
+ ```text
561
+ delta-cli science invoke --tool xrd --endpoint refinement-gsasii `
562
+ --data '{"schema_version":1,"radiation_profile":"CuKa","refinement_pattern":{"observed_pattern":{"artifact_id":"art_<original>","sha256":"<sha256>"}},"phases":[{"phase_index":1,"name":"phase","cif":{"artifact_id":"art_<cif>","sha256":"<sha256>"}}],"wavelengths_angstrom":[1.540593,1.544414],"backends":["gsasii"],"options":{"timeout_seconds":900,"gsasii":{"workflow_mode":"gsas-report-initial-v1"}}}' `
563
+ --headers '{"Idempotency-Key":"<stable-unique-key>"}'
564
+ ```
565
+
566
+ Optional `recipe` controls single-phase baseline/candidates, multiphase baseline,
567
+ physical bounds, selection rules, and residual peak definitions. Omission uses
568
+ the backend default recipe. Only supply a custom recipe when the current
569
+ service schema defines its fields; do not guess nested recipe fields.
570
+ The official scoring implementation is pinned by version
571
+ and module SHA-256; callers cannot replace it.
572
+
573
+ Report mode accepts a finite nonnegative `ka2_ka1_intensity_ratio` for doublets.
574
+ This field is prohibited for a single wavelength. When omitted, a generic
575
+ doublet instrument uses 0.5 and a custom instrument uses its actual ratio.
576
+
577
+ `summary.evidence` records the selected checkpoint, input hashes, actual
578
+ wavelengths, fitting range, native Rwp, full-pattern relative L2, original-sigma
579
+ Rwp, official score, and execution stages. Two-column inputs use unit numerical
580
+ weights and report `sigma_is_measured=false`; three-column original inputs
581
+ contain measured sigma.
582
+
583
+ Published GPX files require native reopen verification. Downloaded byte hashes
584
+ must match evidence. Complete execution and publication require channel success,
585
+ `workflow_complete=true`, and `publication_complete=true`. Inspect
586
+ `structure_consistency` and diagnostics as well. Artifacts marked
587
+ `diagnostic_only=true` are for failure review and are not accepted final structures.
588
+ Uncalibrated instrument results remain provisional; uploading a file does not
589
+ establish calibration.
590
+
591
+ ### Acceptance, queries, and cancellation
592
+
593
+ Successful submission returns business `schema_version`, `job_id`,
594
+ `status=queued`, `submitted_at`, and `links.self/events/artifacts` in CLI `data`.
595
+ This means accepted/queued, not convergence or scientific acceptance. Use the
596
+ returned `job_id` with CLI query operations; do not follow the link URLs directly.
597
+
598
+ The same idempotency key and canonical request reuse the original job.
599
+ The same key with a different request returns IDEMPOTENCY_CONFLICT.
600
+ Use a new key for an intentional new calculation. After a timeout or disconnect,
601
+ retain the original key and investigate whether a job exists before resubmitting.
602
+
603
+ ```text
604
+ delta-cli science invoke --tool xrd --endpoint refinement-job `
605
+ --path-params '{"job_id":"refjob_<returned-id>"}'
606
+
607
+ delta-cli science invoke --tool xrd --endpoint refinement-job-events `
608
+ --path-params '{"job_id":"refjob_<returned-id>"}' `
609
+ --params '{"after_seq":0,"limit":100}'
610
+
611
+ delta-cli science invoke --tool xrd --endpoint refinement-job-artifacts `
612
+ --path-params '{"job_id":"refjob_<returned-id>"}'
613
+
614
+ delta-cli science invoke --tool xrd --endpoint refinement-job-cancel `
615
+ --path-params '{"job_id":"refjob_<returned-id>"}'
616
+ ```
617
+
618
+ Job IDs contain `refjob_` followed by 32 lowercase hexadecimal characters.
619
+ Event after_seq defaults to 0 and must be nonnegative; limit defaults to 100
620
+ and accepts 1–500. Pass response next_after_seq for the next page.
621
+ Artifact lists are deduplicated by artifact_id; download through
622
+ `xmatcher-artifact-content` with `--path-params '{"artifact_id":"art_<returned-id>"}'`.
623
+
624
+ Cancellation returns the job's current state. Continue querying until a terminal
625
+ state is reached. Cancelling completed or failed jobs returns JOB_STATE_CONFLICT.
626
+
627
+ | Layer | Status / interpretation |
628
+ | --- | --- |
629
+ | Job `status` | queued / running / cancelling / completed / failed / cancelled |
630
+ | Pipeline `result.status` | success / partial / failed / skipped |
631
+ | Channel `result.results.<backend>.status` | success / failed / skipped / cancelled |
632
+ | `quality`, `scientific_status`, `diagnostics` | Inspect fit quality, scientific state, physical validity, and evidence completeness separately |
633
+
634
+ `completed` means the scheduling workflow finished; individual backends may
635
+ have failed. Channel success alone does not establish convergence, physical
636
+ validity, or scientific acceptance. Preserve null or unknown values for unavailable metrics.
637
+
638
+ ## 10. Responses and errors
639
+
640
+ A successful Delta CLI invocation requires exit code 0 and top-level `ok:true`;
641
+ business results are in `data`. XRD business JSON generally has no additional
642
+ common `ok`/`data` envelope. Read the fields documented for the selected operation;
643
+ health probes have their own business `ok`. Decode binary responses using the
644
+ CLI representation and returned media type described in section 5.
645
+
646
+ The CLI reports failures in its top-level `error`. Native business-error details,
647
+ when exposed by the CLI, may have this shape:
648
+
649
+ ```json
650
+ {
651
+ "schema_version":1,
652
+ "error":{"code":"VALIDATION_ERROR","message":"Request validation failed.","retryable":false,"details":[{"field":"body.pattern","reason":"missing"}]},
653
+ "request_id":"req_example"
654
+ }
655
+ ```
656
+
657
+ Gateway-generated business errors may omit schema_version. Preserve the CLI's
658
+ error classification and any returned native details; do not infer success from
659
+ a nested field or bypass the CLI to retrieve an upstream response.
660
+
661
+ | Common error | Meaning / action |
662
+ | --- | --- |
663
+ | AUTHENTICATION_REQUIRED / SERVICE_MISCONFIGURED | Missing authentication or unconfigured service authentication |
664
+ | VALIDATION_ERROR / UNSUPPORTED_MEDIA_TYPE / PAYLOAD_TOO_LARGE | Invalid fields, media type, or upload size |
665
+ | ARTIFACT_NOT_FOUND / ARTIFACT_HASH_MISMATCH / PATTERN_KIND_MISMATCH | Verify artifact ID, SHA-256, and required kind |
666
+ | PATTERN_INVALID / MODEL_INPUT_SHAPE_INVALID / CIF_INVALID / XMATCHER_INVALID | Invalid pattern, model grid, CIF, or matching input |
667
+ | CAPABILITY_UNAVAILABLE / CAPABILITY_VERSION_MISMATCH | Unavailable component or mismatched asset version |
668
+ | MP500_IDENTITY_MISMATCH / RRUFF_IDENTITY_MISMATCH | entry_id does not match the expected candidate identity |
669
+ | REFINEMENT_LINEAGE_INVALID / INSTRUMENT_INVALID | Invalid provenance, source preservation, or instrument data |
670
+ | IDEMPOTENCY_CONFLICT / JOB_NOT_FOUND / JOB_STATE_CONFLICT | Conflicting key, missing job, or operation incompatible with job state |
671
+ | REDIS_UNAVAILABLE / XMATCHER_TIMEOUT | Queue unavailable or matching wait timeout |
672
+ | UPSTREAM_UNAVAILABLE / NOT_FOUND | Upstream unavailable or operation not exposed; report the original CLI error |
673
+
674
+ Rate-limit failures may include Retry-After. Proxy errors such as Endpoint is
675
+ disabled and TIER_CONCURRENCY_EXCEEDED are separate from native compute errors.
676
+ Preserve returned code, message, details, warnings, and request_id. Do not switch
677
+ endpoints, guess parameters, or replace failed business results with local algorithms.
678
+
679
+ ## 11. Contract discovery
680
+
681
+ Use `delta-cli science endpoints list xrd` when this reference is missing an
682
+ operation or conflicts with the deployed catalogue. Use only exact returned
683
+ names. If the catalogue does not provide enough schema to construct a request,
684
+ report the missing contract rather than guessing parameters or service paths.
685
+
686
+ See [Delta Science](../SKILL.md) for shared CLI authentication, response,
687
+ retry, and cross-tool rules. The direct `gsasii` tool is a separate contract;
688
+ its operation names must not be substituted for `xrd` refinement operations.