tamarind-cli 0.3.2__tar.gz → 0.4.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 (126) hide show
  1. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/PKG-INFO +18 -3
  2. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/README.md +16 -2
  3. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/pyproject.toml +2 -1
  4. tamarind_cli-0.4.0/src/tamarind/cli/commands/custom_tools.py +452 -0
  5. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/main.py +13 -1
  6. tamarind_cli-0.4.0/tests/test_custom_tools_cli.py +316 -0
  7. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/uv.lock +3 -1
  8. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/.github/workflows/ci.yml +0 -0
  9. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/.github/workflows/publish.yml +0 -0
  10. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/.gitignore +0 -0
  11. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/LICENSE +0 -0
  12. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/docs/architecture.md +0 -0
  13. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/install.sh +0 -0
  14. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/openapi/openapi-python-client.json +0 -0
  15. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/openapi/pipelines-openapi-python-client.json +0 -0
  16. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/openapi/pipelines-v1.json +0 -0
  17. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/openapi/pipelines-v1.lock.json +0 -0
  18. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/openapi/public-v1.json +0 -0
  19. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/openapi/public-v1.lock.json +0 -0
  20. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/scripts/check_custom_tools_provenance.py +0 -0
  21. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/scripts/sync_custom_tools_contract.py +0 -0
  22. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/scripts/sync_pipelines_contract.py +0 -0
  23. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/__init__.py +0 -0
  24. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/catalog.py +0 -0
  25. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/__init__.py +0 -0
  26. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/commands/__init__.py +0 -0
  27. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/commands/auth.py +0 -0
  28. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/commands/catalog.py +0 -0
  29. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/commands/files.py +0 -0
  30. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/commands/jobs.py +0 -0
  31. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/guidance.py +0 -0
  32. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/inputs.py +0 -0
  33. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/cli/output.py +0 -0
  34. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/config.py +0 -0
  35. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/__init__.py +0 -0
  36. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_contract.py +0 -0
  37. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/__init__.py +0 -0
  38. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/__init__.py +0 -0
  39. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/__init__.py +0 -0
  40. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/build_custom_tool_version.py +0 -0
  41. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/cancel_custom_tool_build.py +0 -0
  42. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/create_custom_tool.py +0 -0
  43. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/create_custom_tool_upload.py +0 -0
  44. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/delete_custom_tool.py +0 -0
  45. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/get_custom_tool.py +0 -0
  46. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/get_custom_tool_version.py +0 -0
  47. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/list_custom_tool_build_logs.py +0 -0
  48. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/list_custom_tool_versions.py +0 -0
  49. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/list_custom_tools.py +0 -0
  50. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/publish_custom_tool_version.py +0 -0
  51. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/api/custom_tools/update_custom_tool.py +0 -0
  52. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/client.py +0 -0
  53. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/errors.py +0 -0
  54. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/__init__.py +0 -0
  55. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_build_error.py +0 -0
  56. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_build_event.py +0 -0
  57. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_build_log_page.py +0 -0
  58. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_build_result.py +0 -0
  59. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_build_result_action.py +0 -0
  60. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_create_custom_tool_request.py +0 -0
  61. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_create_custom_tool_request_gputype.py +0 -0
  62. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_create_custom_tool_request_memory.py +0 -0
  63. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_create_version_request.py +0 -0
  64. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_custom_tool.py +0 -0
  65. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_custom_tool_gputype.py +0 -0
  66. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_custom_tool_memory.py +0 -0
  67. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_custom_tool_page.py +0 -0
  68. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_custom_tool_status.py +0 -0
  69. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_problem.py +0 -0
  70. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_problem_errors_type_0_item.py +0 -0
  71. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_update_custom_tool_request.py +0 -0
  72. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_update_custom_tool_request_gpu_type_type_0.py +0 -0
  73. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_update_custom_tool_request_memory_type_0.py +0 -0
  74. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_upload_session.py +0 -0
  75. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_upload_session_uploadheaders.py +0 -0
  76. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_version.py +0 -0
  77. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_version_page.py +0 -0
  78. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/models/public_version_status.py +0 -0
  79. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/_generated/types.py +0 -0
  80. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/client.py +0 -0
  81. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/packaging.py +0 -0
  82. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/resources.py +0 -0
  83. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/transport.py +0 -0
  84. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/custom_tools/validation.py +0 -0
  85. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/errors.py +0 -0
  86. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/http.py +0 -0
  87. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/jobs.py +0 -0
  88. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/__init__.py +0 -0
  89. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/__init__.py +0 -0
  90. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/api/__init__.py +0 -0
  91. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/api/pipelines_public/__init__.py +0 -0
  92. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/api/pipelines_public/get_run.py +0 -0
  93. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/api/pipelines_public/list_node_run_molecules.py +0 -0
  94. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/client.py +0 -0
  95. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/errors.py +0 -0
  96. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/__init__.py +0 -0
  97. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/node_run_status.py +0 -0
  98. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_node_run.py +0 -0
  99. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_node_run_molecule.py +0 -0
  100. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_node_run_molecule_page.py +0 -0
  101. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_node_run_molecule_scores.py +0 -0
  102. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_problem.py +0 -0
  103. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_problem_errors_type_0_item.py +0 -0
  104. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_run.py +0 -0
  105. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/public_run_inputs.py +0 -0
  106. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/run_status.py +0 -0
  107. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/models/source.py +0 -0
  108. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/_generated/types.py +0 -0
  109. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/resources.py +0 -0
  110. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/pipelines/transport.py +0 -0
  111. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/py.typed +0 -0
  112. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/src/tamarind/rest.py +0 -0
  113. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_agent_contract.py +0 -0
  114. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_bugbash.py +0 -0
  115. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_cli_commands.py +0 -0
  116. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_config.py +0 -0
  117. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_custom_tools_generation.py +0 -0
  118. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_custom_tools_packaging.py +0 -0
  119. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_custom_tools_sdk.py +0 -0
  120. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_file_filters.py +0 -0
  121. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_inputs.py +0 -0
  122. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_jobs.py +0 -0
  123. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_output.py +0 -0
  124. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_pep561.py +0 -0
  125. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_pipelines_sdk.py +0 -0
  126. {tamarind_cli-0.3.2 → tamarind_cli-0.4.0}/tests/test_rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tamarind-cli
3
- Version: 0.3.2
3
+ Version: 0.4.0
4
4
  Summary: Command-line interface for the Tamarind Bio platform — submit, monitor, and download protein/molecule jobs from your terminal or an AI agent.
5
5
  Project-URL: Homepage, https://tamarind.bio
6
6
  Project-URL: Documentation, https://app.tamarind.bio/api-docs
@@ -11,6 +11,7 @@ License-File: LICENSE
11
11
  Keywords: agents,alphafold,bioinformatics,boltz,cli,protein
12
12
  Requires-Python: >=3.10
13
13
  Requires-Dist: attrs>=23.1
14
+ Requires-Dist: click>=8.1
14
15
  Requires-Dist: httpx>=0.27
15
16
  Requires-Dist: pyyaml>=6.0
16
17
  Requires-Dist: typer>=0.12
@@ -153,8 +154,21 @@ Exact Version operations use `version.id`; `version.name` is display-only. If a
153
154
  mutation reports `412 Precondition Failed`, refetch the affected Tool or Version,
154
155
  confirm the mutation is still desired, and retry using the refreshed resource.
155
156
 
156
- Custom Tool CLI commands are not part of this release. Existing CLI commands
157
- remain unchanged.
157
+ The same lifecycle is available through the unified CLI. A typical release is:
158
+
159
+ ```bash
160
+ tamarind custom-tools validate ./my-esmfold
161
+ tamarind custom-tools create my-esmfold --display-name "My ESMFold"
162
+ tamarind custom-tools build my-esmfold ./my-esmfold \
163
+ --idempotency-key release-2026-08-31 --wait --timeout 1800
164
+ tamarind custom-tools versions my-esmfold
165
+ tamarind custom-tools publish my-esmfold <opaque-version-id>
166
+ ```
167
+
168
+ Build responses contain both a display name such as `v3` and an opaque `id`.
169
+ Pass the opaque ID to `version`, `logs`, `cancel`, and `publish`. A local wait
170
+ timeout does not cancel the remote build; reattach with
171
+ `tamarind custom-tools version NAME VERSION_ID --wait`.
158
172
 
159
173
  ## Output for agents
160
174
 
@@ -200,6 +214,7 @@ place them before the command name.
200
214
  | Submit | `validate`, `submit`, `batch` |
201
215
  | Monitor | `jobs`, `status`, `wait`, `results`, `logs` |
202
216
  | Files | `files list`, `files stats`, `files upload`, `files delete`, `files folders` |
217
+ | Custom Tools | `custom-tools list`, `get`, `create`, `update`, `validate`, `build`, `versions`, `version`, `logs`, `cancel`, `publish`, `delete` |
203
218
  | Lifecycle | `cancel`, `delete` |
204
219
  | Auth | `auth login`, `auth status`, `auth logout` |
205
220
 
@@ -128,8 +128,21 @@ Exact Version operations use `version.id`; `version.name` is display-only. If a
128
128
  mutation reports `412 Precondition Failed`, refetch the affected Tool or Version,
129
129
  confirm the mutation is still desired, and retry using the refreshed resource.
130
130
 
131
- Custom Tool CLI commands are not part of this release. Existing CLI commands
132
- remain unchanged.
131
+ The same lifecycle is available through the unified CLI. A typical release is:
132
+
133
+ ```bash
134
+ tamarind custom-tools validate ./my-esmfold
135
+ tamarind custom-tools create my-esmfold --display-name "My ESMFold"
136
+ tamarind custom-tools build my-esmfold ./my-esmfold \
137
+ --idempotency-key release-2026-08-31 --wait --timeout 1800
138
+ tamarind custom-tools versions my-esmfold
139
+ tamarind custom-tools publish my-esmfold <opaque-version-id>
140
+ ```
141
+
142
+ Build responses contain both a display name such as `v3` and an opaque `id`.
143
+ Pass the opaque ID to `version`, `logs`, `cancel`, and `publish`. A local wait
144
+ timeout does not cancel the remote build; reattach with
145
+ `tamarind custom-tools version NAME VERSION_ID --wait`.
133
146
 
134
147
  ## Output for agents
135
148
 
@@ -175,6 +188,7 @@ place them before the command name.
175
188
  | Submit | `validate`, `submit`, `batch` |
176
189
  | Monitor | `jobs`, `status`, `wait`, `results`, `logs` |
177
190
  | Files | `files list`, `files stats`, `files upload`, `files delete`, `files folders` |
191
+ | Custom Tools | `custom-tools list`, `get`, `create`, `update`, `validate`, `build`, `versions`, `version`, `logs`, `cancel`, `publish`, `delete` |
178
192
  | Lifecycle | `cancel`, `delete` |
179
193
  | Auth | `auth login`, `auth status`, `auth logout` |
180
194
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tamarind-cli"
3
- version = "0.3.2"
3
+ version = "0.4.0"
4
4
  description = "Command-line interface for the Tamarind Bio platform — submit, monitor, and download protein/molecule jobs from your terminal or an AI agent."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -9,6 +9,7 @@ authors = [{ name = "Tamarind Bio" }]
9
9
  keywords = ["bioinformatics", "protein", "alphafold", "boltz", "cli", "agents"]
10
10
  dependencies = [
11
11
  "attrs>=23.1",
12
+ "click>=8.1",
12
13
  "httpx>=0.27",
13
14
  "typer>=0.12",
14
15
  "PyYAML>=6.0",
@@ -0,0 +1,452 @@
1
+ """``tamarind custom-tools`` — organization Custom Tool lifecycle commands."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import asdict
6
+ from pathlib import Path
7
+ from typing import Any, Optional
8
+
9
+ import typer
10
+
11
+ from ...custom_tools.resources import BuildEvent, CustomTool, Version
12
+ from ...custom_tools.transport import (
13
+ GpuType,
14
+ MemorySize,
15
+ PublicCustomToolStatus,
16
+ PublicVersionStatus,
17
+ )
18
+ from ...custom_tools.validation import ValidationProblem, ValidationReport, validate_folder
19
+ from ...errors import ExitCode, TamarindError, ValidationError
20
+ from .. import output
21
+
22
+
23
+ app = typer.Typer(no_args_is_help=True)
24
+
25
+
26
+ def _value(value: object) -> object:
27
+ return getattr(value, "value", value)
28
+
29
+
30
+ def _problem(problem: ValidationProblem) -> dict[str, str]:
31
+ return {
32
+ "code": problem.code,
33
+ "path": problem.path,
34
+ "message": problem.message,
35
+ }
36
+
37
+
38
+ def _report(report: ValidationReport) -> dict[str, object]:
39
+ return {
40
+ "valid": report.valid,
41
+ "errors": [_problem(item) for item in report.errors],
42
+ "warnings": [_problem(item) for item in report.warnings],
43
+ }
44
+
45
+
46
+ def _tool(tool: CustomTool) -> dict[str, object]:
47
+ return {
48
+ "name": tool.name,
49
+ "generation": tool.generation,
50
+ "displayName": tool.display_name,
51
+ "description": tool.description,
52
+ "functions": list(tool.functions),
53
+ "status": _value(tool.status),
54
+ "gpuType": _value(tool.gpu_type),
55
+ "memory": _value(tool.memory),
56
+ "cpu": tool.cpu,
57
+ "homeDiskGi": tool.home_disk_gi,
58
+ "maxRuntimeSeconds": tool.max_runtime_seconds,
59
+ "hasSource": tool.has_source,
60
+ "sourceDigest": tool.source_digest,
61
+ "published": tool.published,
62
+ "autoPublish": tool.auto_publish,
63
+ "estTime": tool.est_time,
64
+ "paperUrl": tool.paper_url,
65
+ "tags": list(tool.tags),
66
+ "defaultVersion": tool.default_version,
67
+ "createdAt": tool.created_at,
68
+ "updatedAt": tool.updated_at,
69
+ "canEdit": tool.can_edit,
70
+ "canBuild": tool.can_build,
71
+ }
72
+
73
+
74
+ def _version(version: Version) -> dict[str, object]:
75
+ error = None
76
+ if version.error is not None:
77
+ error = {"code": version.error.code, "message": version.error.message}
78
+ return {
79
+ "id": version.id,
80
+ "name": version.name,
81
+ "toolName": version.tool_name,
82
+ "toolGeneration": version.tool_generation,
83
+ "sourceRevision": version.source_revision,
84
+ "sourceDigest": version.source_digest,
85
+ "status": _value(version.status),
86
+ "terminal": version.terminal,
87
+ "origin": version.origin,
88
+ "createdAt": version.created_at,
89
+ "startedAt": version.started_at,
90
+ "completedAt": version.completed_at,
91
+ "error": error,
92
+ }
93
+
94
+
95
+ def _tool_human(tool: CustomTool) -> str:
96
+ published = "published" if tool.published else "unpublished"
97
+ return (
98
+ f"{tool.display_name or tool.name} [{tool.name}]\n"
99
+ f"status: {tool.status} {published}\n"
100
+ f"generation: {tool.generation}\n"
101
+ f"default version: {tool.default_version or '(none)'}\n"
102
+ f"resources: {tool.cpu} CPU, {tool.memory}, GPU {tool.gpu_type}"
103
+ )
104
+
105
+
106
+ def _version_human(version: Version) -> str:
107
+ error = f"\nerror: {version.error.message}" if version.error is not None else ""
108
+ return (
109
+ f"{version.tool_name}/{version.name}\n"
110
+ f"id: {version.id}\n"
111
+ f"status: {version.status}\n"
112
+ f"terminal: {'yes' if version.terminal else 'no'}{error}"
113
+ )
114
+
115
+
116
+ def _event_printer(mode: output.OutputMode):
117
+ if mode.json:
118
+ return None
119
+
120
+ def show(event: BuildEvent) -> None:
121
+ output.info(event.message, mode)
122
+
123
+ return show
124
+
125
+
126
+ def _get_version(client: Any, tool_name: str, version_id: str) -> Version:
127
+ return client.custom_tools.get(tool_name).get_version(version_id)
128
+
129
+
130
+ def _attach_version_context(
131
+ exc: TamarindError, *, version: Version, action: object | None = None
132
+ ) -> TamarindError:
133
+ """Keep the durable reattachment handle when a local wait fails."""
134
+ detail = dict(exc.detail) if isinstance(exc.detail, dict) else {}
135
+ if exc.detail is not None and not isinstance(exc.detail, dict):
136
+ detail["upstreamDetail"] = exc.detail
137
+ detail.update(
138
+ {
139
+ "toolName": version.tool_name,
140
+ "versionId": version.id,
141
+ "versionName": version.name,
142
+ }
143
+ )
144
+ if action is not None:
145
+ detail["action"] = _value(action)
146
+ exc.detail = detail
147
+ return exc
148
+
149
+
150
+ @app.command("list")
151
+ def list_tools(
152
+ ctx: typer.Context,
153
+ status: Optional[PublicCustomToolStatus] = typer.Option(
154
+ None, "--status", help="Filter by Draft, Building, or Deployed."
155
+ ),
156
+ published: Optional[bool] = typer.Option(
157
+ None, "--published/--unpublished", help="Filter by publication state."
158
+ ),
159
+ limit: int = typer.Option(50, "--limit", min=1, max=100),
160
+ cursor: Optional[str] = typer.Option(None, "--cursor", help="Opaque pagination cursor."),
161
+ ) -> None:
162
+ """List Custom Tools owned by your organization."""
163
+ state = ctx.obj
164
+ with state.sdk_client() as client:
165
+ page = client.custom_tools.list(
166
+ status=status, published=published, limit=limit, cursor=cursor
167
+ )
168
+ result = {
169
+ "items": [_tool(item) for item in page.items],
170
+ "nextCursor": page.next_cursor,
171
+ }
172
+ rows = [
173
+ {
174
+ "name": item.name,
175
+ "status": str(item.status),
176
+ "published": "yes" if item.published else "",
177
+ "defaultVersion": item.default_version or "",
178
+ "updatedAt": item.updated_at,
179
+ }
180
+ for item in page.items
181
+ ]
182
+ human = output.render_table(
183
+ rows, ["name", "status", "published", "defaultVersion", "updatedAt"]
184
+ )
185
+ if page.next_cursor:
186
+ human += f"\n\nMore results: pass --cursor {page.next_cursor}"
187
+ output.emit(result, state.output, human=human)
188
+
189
+
190
+ @app.command()
191
+ def get(ctx: typer.Context, name: str = typer.Argument(..., help="Custom Tool name.")) -> None:
192
+ """Inspect one Custom Tool."""
193
+ state = ctx.obj
194
+ with state.sdk_client() as client:
195
+ tool = client.custom_tools.get(name)
196
+ output.emit(_tool(tool), state.output, human=_tool_human(tool))
197
+
198
+
199
+ @app.command()
200
+ def create(
201
+ ctx: typer.Context,
202
+ name: str = typer.Argument(..., help="Unique Custom Tool name."),
203
+ display_name: Optional[str] = typer.Option(None, "--display-name"),
204
+ description: Optional[str] = typer.Option(None, "--description"),
205
+ gpu_type: Optional[GpuType] = typer.Option(None, "--gpu-type"),
206
+ memory: Optional[MemorySize] = typer.Option(None, "--memory"),
207
+ cpu: Optional[int] = typer.Option(None, "--cpu", min=1),
208
+ ) -> None:
209
+ """Create an empty Custom Tool ready for a source build."""
210
+ state = ctx.obj
211
+ kwargs: dict[str, object] = {}
212
+ for key, value in (
213
+ ("display_name", display_name),
214
+ ("description", description),
215
+ ("gpu_type", gpu_type),
216
+ ("memory", memory),
217
+ ("cpu", cpu),
218
+ ):
219
+ if value is not None:
220
+ kwargs[key] = value
221
+ with state.sdk_client() as client:
222
+ tool = client.custom_tools.create(name, **kwargs)
223
+ output.emit(_tool(tool), state.output, human=f"created {tool.name}\n{_tool_human(tool)}")
224
+
225
+
226
+ @app.command()
227
+ def update(
228
+ ctx: typer.Context,
229
+ name: str = typer.Argument(..., help="Custom Tool name."),
230
+ display_name: Optional[str] = typer.Option(None, "--display-name"),
231
+ description: Optional[str] = typer.Option(None, "--description"),
232
+ function: Optional[list[str]] = typer.Option(None, "--function", help="Repeatable."),
233
+ gpu_type: Optional[GpuType] = typer.Option(None, "--gpu-type"),
234
+ memory: Optional[MemorySize] = typer.Option(None, "--memory"),
235
+ cpu: Optional[int] = typer.Option(None, "--cpu", min=1),
236
+ home_disk_gi: Optional[int] = typer.Option(None, "--home-disk-gi", min=1),
237
+ auto_publish: Optional[bool] = typer.Option(
238
+ None, "--auto-publish/--no-auto-publish"
239
+ ),
240
+ est_time: Optional[str] = typer.Option(None, "--est-time"),
241
+ paper_url: Optional[str] = typer.Option(None, "--paper-url"),
242
+ tag: Optional[list[str]] = typer.Option(None, "--tag", help="Repeatable."),
243
+ ) -> None:
244
+ """Update editable Custom Tool metadata and resource settings."""
245
+ state = ctx.obj
246
+ values: dict[str, object] = {
247
+ "display_name": display_name,
248
+ "description": description,
249
+ "functions": function,
250
+ "gpu_type": gpu_type,
251
+ "memory": memory,
252
+ "cpu": cpu,
253
+ "home_disk_gi": home_disk_gi,
254
+ "auto_publish": auto_publish,
255
+ "est_time": est_time,
256
+ "paper_url": paper_url,
257
+ "tags": tag,
258
+ }
259
+ kwargs = {key: value for key, value in values.items() if value is not None}
260
+ if not kwargs:
261
+ raise ValidationError("No updates supplied.")
262
+ with state.sdk_client() as client:
263
+ tool = client.custom_tools.get(name).update(**kwargs)
264
+ output.emit(_tool(tool), state.output, human=f"updated {tool.name}\n{_tool_human(tool)}")
265
+
266
+
267
+ @app.command()
268
+ def validate(
269
+ ctx: typer.Context,
270
+ folder: Path = typer.Argument(
271
+ ..., exists=True, file_okay=False, readable=True, resolve_path=True
272
+ ),
273
+ ) -> None:
274
+ """Validate a local Custom Tool source folder without uploading it."""
275
+ state = ctx.obj
276
+ report = validate_folder(folder)
277
+ result = _report(report)
278
+ rows = [
279
+ {"severity": "error", **_problem(item)} for item in report.errors
280
+ ] + [{"severity": "warning", **_problem(item)} for item in report.warnings]
281
+ human = "valid" if report.valid and not rows else output.render_table(
282
+ rows, ["severity", "code", "path", "message"]
283
+ )
284
+ output.emit(result, state.output, human=human)
285
+ if not report.valid:
286
+ raise typer.Exit(ExitCode.VALIDATION)
287
+
288
+
289
+ @app.command()
290
+ def build(
291
+ ctx: typer.Context,
292
+ name: str = typer.Argument(..., help="Custom Tool name."),
293
+ folder: Path = typer.Argument(
294
+ ..., exists=True, file_okay=False, readable=True, resolve_path=True
295
+ ),
296
+ idempotency_key: Optional[str] = typer.Option(
297
+ None, "--idempotency-key", help="Reuse this key when retrying an ambiguous build request."
298
+ ),
299
+ wait: bool = typer.Option(False, "--wait", help="Wait for the build to finish."),
300
+ timeout: float = typer.Option(1800.0, "--timeout", min=0.001),
301
+ poll_interval: float = typer.Option(2.0, "--poll-interval", min=0.001),
302
+ ) -> None:
303
+ """Validate, package, upload, and build a local source folder."""
304
+ state = ctx.obj
305
+ with state.sdk_client() as client:
306
+ result = client.custom_tools.get(name).build(
307
+ folder, idempotency_key=idempotency_key
308
+ )
309
+ version = result.version
310
+ if wait:
311
+ try:
312
+ version = version.monitor(
313
+ timeout=timeout,
314
+ interval=poll_interval,
315
+ on_event=_event_printer(state.output),
316
+ )
317
+ except TamarindError as exc:
318
+ raise _attach_version_context(
319
+ exc, version=version, action=result.action
320
+ ) from exc
321
+ payload = {"action": _value(result.action), "version": _version(version)}
322
+ human = f"{_value(result.action)}: {_version_human(version)}"
323
+ if not wait and not version.terminal:
324
+ human += (
325
+ f"\n\nReattach with `tamarind custom-tools version {name} {version.id} --wait`."
326
+ )
327
+ output.emit(payload, state.output, human=human)
328
+
329
+
330
+ @app.command()
331
+ def versions(
332
+ ctx: typer.Context,
333
+ name: str = typer.Argument(..., help="Custom Tool name."),
334
+ status: Optional[PublicVersionStatus] = typer.Option(None, "--status"),
335
+ limit: int = typer.Option(50, "--limit", min=1, max=100),
336
+ cursor: Optional[str] = typer.Option(None, "--cursor", help="Opaque pagination cursor."),
337
+ ) -> None:
338
+ """List a Custom Tool's build versions."""
339
+ state = ctx.obj
340
+ with state.sdk_client() as client:
341
+ page = client.custom_tools.get(name).versions(
342
+ status=status, limit=limit, cursor=cursor
343
+ )
344
+ result = {"items": [_version(item) for item in page.items], "nextCursor": page.next_cursor}
345
+ rows = [
346
+ {
347
+ "id": item.id,
348
+ "name": item.name,
349
+ "status": str(item.status),
350
+ "origin": item.origin,
351
+ "createdAt": item.created_at,
352
+ }
353
+ for item in page.items
354
+ ]
355
+ human = output.render_table(rows, ["id", "name", "status", "origin", "createdAt"])
356
+ if page.next_cursor:
357
+ human += f"\n\nMore results: pass --cursor {page.next_cursor}"
358
+ output.emit(result, state.output, human=human)
359
+
360
+
361
+ @app.command("version")
362
+ def get_version(
363
+ ctx: typer.Context,
364
+ name: str = typer.Argument(..., help="Custom Tool name."),
365
+ version_id: str = typer.Argument(..., help="Opaque Version ID (not its vN display name)."),
366
+ wait: bool = typer.Option(False, "--wait", help="Wait for this build to finish."),
367
+ timeout: float = typer.Option(1800.0, "--timeout", min=0.001),
368
+ poll_interval: float = typer.Option(2.0, "--poll-interval", min=0.001),
369
+ ) -> None:
370
+ """Inspect or wait for one exact Version."""
371
+ state = ctx.obj
372
+ with state.sdk_client() as client:
373
+ version = _get_version(client, name, version_id)
374
+ if wait:
375
+ try:
376
+ version = version.monitor(
377
+ timeout=timeout,
378
+ interval=poll_interval,
379
+ on_event=_event_printer(state.output),
380
+ )
381
+ except TamarindError as exc:
382
+ raise _attach_version_context(exc, version=version) from exc
383
+ output.emit(_version(version), state.output, human=_version_human(version))
384
+
385
+
386
+ @app.command()
387
+ def logs(
388
+ ctx: typer.Context,
389
+ name: str = typer.Argument(..., help="Custom Tool name."),
390
+ version_id: str = typer.Argument(..., help="Opaque Version ID."),
391
+ cursor: Optional[str] = typer.Option(None, "--cursor", help="Resume from this log cursor."),
392
+ ) -> None:
393
+ """Read one page of build logs for an exact Version."""
394
+ state = ctx.obj
395
+ with state.sdk_client() as client:
396
+ page = _get_version(client, name, version_id).logs(cursor=cursor)
397
+ result = {
398
+ "items": [asdict(item) for item in page.items],
399
+ "status": _value(page.status),
400
+ "nextCursor": page.next_cursor,
401
+ "error": asdict(page.error) if page.error is not None else None,
402
+ }
403
+ human = "\n".join(item.message for item in page.items) or "(no new logs)"
404
+ if page.next_cursor:
405
+ human += f"\n\nResume with --cursor {page.next_cursor}"
406
+ output.emit(result, state.output, human=human)
407
+
408
+
409
+ @app.command()
410
+ def cancel(
411
+ ctx: typer.Context,
412
+ name: str = typer.Argument(..., help="Custom Tool name."),
413
+ version_id: str = typer.Argument(..., help="Opaque Version ID."),
414
+ yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
415
+ ) -> None:
416
+ """Request cancellation of a queued or running build."""
417
+ state = ctx.obj
418
+ output.confirm_destructive(
419
+ f"cancel Custom Tool build '{name}/{version_id}'", yes=yes, mode=state.output
420
+ )
421
+ with state.sdk_client() as client:
422
+ version = _get_version(client, name, version_id).cancel()
423
+ output.emit(_version(version), state.output, human=f"cancellation requested\n{_version_human(version)}")
424
+
425
+
426
+ @app.command()
427
+ def publish(
428
+ ctx: typer.Context,
429
+ name: str = typer.Argument(..., help="Custom Tool name."),
430
+ version_id: str = typer.Argument(..., help="Opaque completed Version ID."),
431
+ ) -> None:
432
+ """Publish a completed Version as the tool's organization-wide default."""
433
+ state = ctx.obj
434
+ with state.sdk_client() as client:
435
+ tool = _get_version(client, name, version_id).publish()
436
+ output.emit(_tool(tool), state.output, human=f"published {name}/{version_id}\n{_tool_human(tool)}")
437
+
438
+
439
+ @app.command()
440
+ def delete(
441
+ ctx: typer.Context,
442
+ name: str = typer.Argument(..., help="Custom Tool name."),
443
+ yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
444
+ ) -> None:
445
+ """Delete a Custom Tool and release its name for reuse."""
446
+ state = ctx.obj
447
+ output.confirm_destructive(
448
+ f"permanently delete Custom Tool '{name}'", yes=yes, mode=state.output
449
+ )
450
+ with state.sdk_client() as client:
451
+ client.custom_tools.get(name).delete()
452
+ output.emit({"ok": True, "name": name}, state.output, human=f"deleted {name}")
@@ -23,12 +23,14 @@ from .. import __version__
23
23
  from ..config import Config, load_config
24
24
  from ..errors import ExitCode, TamarindError
25
25
  from ..http import HTTPClient
26
+ from ..custom_tools.client import Tamarind
26
27
  from . import output
27
28
  from .output import OutputMode
28
29
  from .commands import auth as auth_cmds
29
30
  from .commands import catalog as catalog_cmds
30
31
  from .commands import files as files_cmds
31
32
  from .commands import jobs as jobs_cmds
33
+ from .commands import custom_tools as custom_tools_cmds
32
34
 
33
35
 
34
36
  # The callback updates this before any command runs. Keeping the resolved mode
@@ -38,7 +40,7 @@ from .commands import jobs as jobs_cmds
38
40
  _active_output_mode = OutputMode(json=not output.is_tty(), quiet=False)
39
41
  _GLOBAL_VALUE_OPTIONS = {"--api-key", "--api-base", "--catalog-base", "--profile"}
40
42
  _GLOBAL_FLAG_OPTIONS = {"--json", "--no-json", "--quiet", "-q"}
41
- _COMMAND_GROUPS = {"auth", "files"}
43
+ _COMMAND_GROUPS = {"auth", "custom-tools", "files"}
42
44
 
43
45
 
44
46
  def _missing_command_message(argv: list[str]) -> str | None:
@@ -89,6 +91,11 @@ class State:
89
91
  cfg = self.config()
90
92
  return HTTPClient(cfg.catalog_base, cfg.api_key)
91
93
 
94
+ def sdk_client(self) -> Tamarind:
95
+ """Build the shared SDK with this invocation's resolved credentials."""
96
+ cfg = self.config()
97
+ return Tamarind(api_key=cfg.api_key, api_base=cfg.api_base, profile=cfg.profile)
98
+
92
99
 
93
100
  app = typer.Typer(
94
101
  name="tamarind",
@@ -148,6 +155,11 @@ def main(
148
155
 
149
156
  # Sub-apps (grouped commands)
150
157
  app.add_typer(auth_cmds.app, name="auth", help="Manage credentials.")
158
+ app.add_typer(
159
+ custom_tools_cmds.app,
160
+ name="custom-tools",
161
+ help="Create, build, publish, and inspect organization Custom Tools.",
162
+ )
151
163
  app.add_typer(files_cmds.app, name="files", help="List, upload, and delete workspace files.")
152
164
 
153
165
  # Flat commands