sanka-cli 0.2.7__tar.gz → 0.2.8__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.
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/PKG-INFO +13 -6
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/README.md +12 -5
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/pyproject.toml +3 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/__init__.py +6 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/_client.py +109 -31
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/cli/__init__.py +43 -26
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/__init__.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/connector_client.py +18 -14
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/connector_host.py +20 -16
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/engine.py +17 -17
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/model.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/report_codec.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/routes.py +9 -9
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/scope.py +8 -8
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/validate.py +2 -2
- sanka_cli-0.2.8/src/sanka/runtime/extensions/artifacts.py +80 -0
- sanka_cli-0.2.8/src/sanka/runtime/extensions/code_lifecycle.py +214 -0
- sanka_cli-0.2.8/src/sanka/runtime/extensions/code_repair.py +185 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/extensions/discovery.py +4 -4
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/extensions/lifecycle.py +1 -65
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/extensions/model.py +9 -2
- sanka_cli-0.2.8/src/sanka/runtime/extensions/runner.py +258 -0
- sanka_cli-0.2.7/src/sanka/runtime/extensions/runner.py → sanka_cli-0.2.8/src/sanka/runtime/extensions/stage.py +65 -230
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/extensions/store.py +96 -31
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/mapping/mapping_candidates.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/mapping/model.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/mapping/owner_mapping.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/mapping/pending_relationships.py +3 -3
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/mapping/record_mapping.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/planner.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/registry.py +37 -23
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/state.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/__init__.py +1 -1
- sanka_cli-0.2.8/src/sanka_cli/commands/code.py +19 -0
- sanka_cli-0.2.7/src/sanka_cli/commands/code.py → sanka_cli-0.2.8/src/sanka_cli/commands/functions.py +41 -37
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/migrate.py +7 -7
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/main.py +2 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/skills/sanka-cli/SKILL.md +9 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/__about__.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/__init__.py +54 -18
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/credentials.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/errors.py +27 -16
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/protocols.py +24 -15
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/provisioning.py +2 -2
- sanka_cli-0.2.8/src/sanka_connector/registration.py +42 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/schema.py +10 -3
- sanka_cli-0.2.8/src/sanka_extension_sdk/__init__.py +32 -0
- sanka_cli-0.2.8/src/sanka_extension_sdk/contract.py +328 -0
- sanka_cli-0.2.8/src/sanka_extension_sdk/py.typed +0 -0
- sanka_cli-0.2.8/src/sanka_extensions/__init__.py +2 -0
- sanka_cli-0.2.8/src/sanka_extensions/code/__init__.py +32 -0
- sanka_cli-0.2.8/src/sanka_extensions/code/contract.py +4 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/__about__.py +8 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/__init__.py +256 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/credentials.py +14 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/errors.py +62 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/protocols.py +78 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/provisioning.py +42 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/py.typed +0 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/records.py +111 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/registration.py +11 -0
- sanka_cli-0.2.8/src/sanka_extensions/data/schema.py +20 -0
- sanka_cli-0.2.8/src/sanka_extensions/flow/__init__.py +18 -0
- sanka_cli-0.2.8/src/sanka_extensions/flow/definition.py +140 -0
- sanka_cli-0.2.8/src/sanka_extensions/py.typed +0 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/__about__.py +6 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/__init__.py +132 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/credentials.py +8 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/errors.py +34 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/protocols.py +48 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/provisioning.py +24 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/py.typed +0 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/records.py +44 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/registration.py +7 -0
- sanka_cli-0.2.8/src/sanka_extensions/systems/schema.py +10 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/conftest.py +3 -3
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_cli.py +11 -10
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_code_commands.py +41 -22
- sanka_cli-0.2.8/tests/test_code_lifecycle.py +241 -0
- sanka_cli-0.2.8/tests/test_code_repair.py +207 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_connector_client.py +21 -21
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_connector_host.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_credential_provider.py +7 -7
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_engine_e2e.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_engine_execution_adoption.py +8 -8
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_engine_pg_to_clickhouse_e2e.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_engine_postgres_e2e.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_exact_scope.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_routes.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_scope.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_seam.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_validate.py +12 -12
- sanka_cli-0.2.8/tests/test_extension_stage.py +245 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_extension_store.py +114 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_hosted_cli.py +46 -3
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_mapping_candidates.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_mapping_owner_mapping.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_mapping_pending_relationships.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_mapping_record_mapping.py +1 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_mcp.py +2 -2
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_planner.py +7 -1
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_registry.py +20 -20
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_sanka_facade.py +52 -7
- sanka_cli-0.2.7/src/sanka_connector/registration.py +0 -38
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/.gitignore +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/LICENSES/AGPL-3.0-only.txt +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/LICENSES/Apache-2.0.txt +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/NOTICE +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/cli/_compact.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/cli/_output.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/cli/_research.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/cli/py.typed +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/connector/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/connector/py.typed +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/__about__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/concurrency.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/continuous.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/errors.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/local.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/execution/state.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/extensions/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/hashing.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/mapping/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/mapping/errors.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/private_sqlite.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/py.typed +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/safe_local_io.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka/runtime/spec.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/__main__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/bundle.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/certificates.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/client.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/ai.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/auth.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/cloud.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/cloud_fleet.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/cloud_migrate.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/profiles.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/resources.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/skill.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/commands/workflows.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/config.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/mcp/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/mcp/client.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/mcp/render.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/mcp/server.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/output.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/runtime.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_cli/state.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/py.typed +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/src/sanka_connector/records.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_drf_project/api/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_drf_project/api/serializers.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_drf_project/api/views.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_drf_project/config/__init__.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_drf_project/config/settings.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_drf_project/config/urls.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_drf_project/manage.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_marketplace/drf-to-fastapi.json +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/fixtures/extension_marketplace/marketplace.json +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_cli_developer_experience.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_code_bundle.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_concurrency.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_continuous.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_local_store.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_execution_report_codec.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_extension_discovery.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_extension_lifecycle.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_extension_runner.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_extension_wheel_acceptance.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_hashing.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_safe_local_io.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_skill_commands.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_spec.py +0 -0
- {sanka_cli-0.2.7 → sanka_cli-0.2.8}/tests/test_state_store.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sanka-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Sanka command-line interface and migration runtime
|
|
5
5
|
Project-URL: Repository, https://github.com/sankaHQ/sanka
|
|
6
6
|
Project-URL: Issues, https://github.com/sankaHQ/sanka/issues
|
|
@@ -36,7 +36,7 @@ executable and contains:
|
|
|
36
36
|
|
|
37
37
|
- the Apache-2.0 hosted command dispatcher, authentication, output, and
|
|
38
38
|
optional MCP integration under `sanka_cli`;
|
|
39
|
-
- the embedded Apache-2.0
|
|
39
|
+
- the embedded Apache-2.0 Sanka Extension SDK through `sanka_extensions`; and
|
|
40
40
|
- the AGPL-3.0-only local migration runtime under `sanka`.
|
|
41
41
|
|
|
42
42
|
Python 3.12 or newer is required.
|
|
@@ -108,6 +108,13 @@ workflows, AI, Custom Code, and explicitly cloud-selected migrations retain
|
|
|
108
108
|
their existing authentication requirements. Add `--json` to local lifecycle
|
|
109
109
|
commands for the stable `sanka-cli/v1` response envelope.
|
|
110
110
|
|
|
111
|
+
Custom functions use `sanka functions`; the old `sanka code` group keeps its original
|
|
112
|
+
function operations as a compatibility alias. Sanka Code migration commands remain
|
|
113
|
+
`scan`, `plan`, `apply`, `test`, and `verify`.
|
|
114
|
+
|
|
115
|
+
`--base-url` also selects the API origin for anonymous research/assessment. A full
|
|
116
|
+
migration-service URL in `SANKA_MIGRATE_API_BASE` is retained as a fallback.
|
|
117
|
+
|
|
111
118
|
## Hosted repository runs
|
|
112
119
|
|
|
113
120
|
`sanka cloud` uploads reviewed repository ZIPs, starts runs with an explicit
|
|
@@ -126,10 +133,10 @@ component/runtime compatibility, exact wheel URL and SHA-256 digest, package
|
|
|
126
133
|
metadata, entry points, and installed files. Project locks record the exact
|
|
127
134
|
snapshot and artifact identities in `.sanka/extensions.lock`.
|
|
128
135
|
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
Code extensions use the `sanka-extension/v1` subprocess protocol.
|
|
137
|
+
Extension implementations load only in an isolated child environment and are
|
|
131
138
|
proxied over `sanka-connector/v1`; provider code is never imported into the
|
|
132
|
-
main CLI process. Hosted
|
|
139
|
+
main CLI process. Hosted SaaS implementations remain private to the cloud runtime.
|
|
133
140
|
|
|
134
141
|
## Python facade
|
|
135
142
|
|
|
@@ -137,7 +144,7 @@ main CLI process. Hosted providers are not local connectors.
|
|
|
137
144
|
from sanka import Sanka
|
|
138
145
|
```
|
|
139
146
|
|
|
140
|
-
`Sanka.
|
|
147
|
+
`Sanka.configure_system(...)` creates a write-free endpoint descriptor.
|
|
141
148
|
`Sanka.migrate(...)` creates or resumes a local lifecycle handle. Planning is
|
|
142
149
|
destination-write-free, and apply requires the exact plan hash returned by
|
|
143
150
|
plan.
|
|
@@ -5,7 +5,7 @@ executable and contains:
|
|
|
5
5
|
|
|
6
6
|
- the Apache-2.0 hosted command dispatcher, authentication, output, and
|
|
7
7
|
optional MCP integration under `sanka_cli`;
|
|
8
|
-
- the embedded Apache-2.0
|
|
8
|
+
- the embedded Apache-2.0 Sanka Extension SDK through `sanka_extensions`; and
|
|
9
9
|
- the AGPL-3.0-only local migration runtime under `sanka`.
|
|
10
10
|
|
|
11
11
|
Python 3.12 or newer is required.
|
|
@@ -77,6 +77,13 @@ workflows, AI, Custom Code, and explicitly cloud-selected migrations retain
|
|
|
77
77
|
their existing authentication requirements. Add `--json` to local lifecycle
|
|
78
78
|
commands for the stable `sanka-cli/v1` response envelope.
|
|
79
79
|
|
|
80
|
+
Custom functions use `sanka functions`; the old `sanka code` group keeps its original
|
|
81
|
+
function operations as a compatibility alias. Sanka Code migration commands remain
|
|
82
|
+
`scan`, `plan`, `apply`, `test`, and `verify`.
|
|
83
|
+
|
|
84
|
+
`--base-url` also selects the API origin for anonymous research/assessment. A full
|
|
85
|
+
migration-service URL in `SANKA_MIGRATE_API_BASE` is retained as a fallback.
|
|
86
|
+
|
|
80
87
|
## Hosted repository runs
|
|
81
88
|
|
|
82
89
|
`sanka cloud` uploads reviewed repository ZIPs, starts runs with an explicit
|
|
@@ -95,10 +102,10 @@ component/runtime compatibility, exact wheel URL and SHA-256 digest, package
|
|
|
95
102
|
metadata, entry points, and installed files. Project locks record the exact
|
|
96
103
|
snapshot and artifact identities in `.sanka/extensions.lock`.
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
Code extensions use the `sanka-extension/v1` subprocess protocol.
|
|
106
|
+
Extension implementations load only in an isolated child environment and are
|
|
100
107
|
proxied over `sanka-connector/v1`; provider code is never imported into the
|
|
101
|
-
main CLI process. Hosted
|
|
108
|
+
main CLI process. Hosted SaaS implementations remain private to the cloud runtime.
|
|
102
109
|
|
|
103
110
|
## Python facade
|
|
104
111
|
|
|
@@ -106,7 +113,7 @@ main CLI process. Hosted providers are not local connectors.
|
|
|
106
113
|
from sanka import Sanka
|
|
107
114
|
```
|
|
108
115
|
|
|
109
|
-
`Sanka.
|
|
116
|
+
`Sanka.configure_system(...)` creates a write-free endpoint descriptor.
|
|
110
117
|
`Sanka.migrate(...)` creates or resumes a local lifecycle handle. Planning is
|
|
111
118
|
destination-write-free, and apply requires the exact plan hash returned by
|
|
112
119
|
plan.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sanka-cli"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.8"
|
|
4
4
|
description = "Sanka command-line interface and migration runtime"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -43,5 +43,7 @@ build-backend = "hatchling.build"
|
|
|
43
43
|
packages = [
|
|
44
44
|
"src/sanka",
|
|
45
45
|
"src/sanka_cli",
|
|
46
|
+
"src/sanka_extensions",
|
|
46
47
|
"src/sanka_connector",
|
|
48
|
+
"src/sanka_extension_sdk",
|
|
47
49
|
]
|
|
@@ -6,16 +6,17 @@ Install the ``sanka-cli`` distribution, then start here::
|
|
|
6
6
|
from sanka import Sanka
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
from sanka._client import Connection, Migration, Sanka
|
|
9
|
+
from sanka._client import Connection, DataEndpoint, Migration, Sanka, SystemConfig
|
|
10
10
|
from sanka.runtime.__about__ import __version__
|
|
11
11
|
from sanka.runtime.engine import ExecutionError, InspectionResult, PlanMismatchError, VerifyReport
|
|
12
12
|
from sanka.runtime.planner import MigrationPlan
|
|
13
|
-
from sanka.runtime.registry import UnknownConnectorError
|
|
13
|
+
from sanka.runtime.registry import UnknownConnectorError, UnknownEndpointError, UnknownSystemError
|
|
14
14
|
from sanka.runtime.spec import EndpointSpec, MigrationSpec, SpecError
|
|
15
15
|
from sanka.runtime.state import RunStatus
|
|
16
16
|
|
|
17
17
|
__all__ = [
|
|
18
18
|
"Connection",
|
|
19
|
+
"DataEndpoint",
|
|
19
20
|
"EndpointSpec",
|
|
20
21
|
"ExecutionError",
|
|
21
22
|
"InspectionResult",
|
|
@@ -26,7 +27,10 @@ __all__ = [
|
|
|
26
27
|
"RunStatus",
|
|
27
28
|
"Sanka",
|
|
28
29
|
"SpecError",
|
|
30
|
+
"SystemConfig",
|
|
29
31
|
"UnknownConnectorError",
|
|
32
|
+
"UnknownEndpointError",
|
|
33
|
+
"UnknownSystemError",
|
|
30
34
|
"VerifyReport",
|
|
31
35
|
"__version__",
|
|
32
36
|
]
|
|
@@ -12,36 +12,89 @@ from typing import Any
|
|
|
12
12
|
from sanka.runtime.engine import InspectionResult, MigrationEngine, VerifyReport
|
|
13
13
|
from sanka.runtime.execution import DEFAULT_VALIDATION_SAMPLE_SIZE
|
|
14
14
|
from sanka.runtime.planner import MigrationPlan
|
|
15
|
-
from sanka.runtime.registry import
|
|
15
|
+
from sanka.runtime.registry import ExtensionRegistry
|
|
16
16
|
from sanka.runtime.spec import EndpointSpec, MigrationSpec, SpecError
|
|
17
17
|
from sanka.runtime.state import RunStatus, SqliteStateStore
|
|
18
|
-
from
|
|
18
|
+
from sanka_extensions.data import CredentialProvider
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
@dataclass(frozen=True, slots=True, kw_only=True)
|
|
22
|
-
class
|
|
23
|
-
"""A
|
|
21
|
+
@dataclass(frozen=True, slots=True, kw_only=True, init=False)
|
|
22
|
+
class DataEndpoint:
|
|
23
|
+
"""A data source or destination with independent, non-secret configuration.
|
|
24
24
|
|
|
25
|
-
Creating
|
|
26
|
-
|
|
27
|
-
:meth:`Sanka.migrate`. Authentication and reachability are evaluated by the
|
|
28
|
-
migration lifecycle, never while selecting the provider.
|
|
25
|
+
Creating this descriptor never authenticates an endpoint. Secret values stay
|
|
26
|
+
in environment variables or a managed credential store.
|
|
29
27
|
"""
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
endpoint_type: str
|
|
32
30
|
roles: tuple[str, ...]
|
|
33
|
-
|
|
31
|
+
endpoint_reference: str | None = None
|
|
34
32
|
options: Mapping[str, Any] = field(default_factory=dict)
|
|
35
33
|
|
|
34
|
+
def __init__(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
endpoint_type: str | None = None,
|
|
38
|
+
system_type: str | None = None,
|
|
39
|
+
roles: tuple[str, ...],
|
|
40
|
+
endpoint_reference: str | None = None,
|
|
41
|
+
options: Mapping[str, Any] | None = None,
|
|
42
|
+
provider: str | None = None,
|
|
43
|
+
connection: str | None = None,
|
|
44
|
+
) -> None:
|
|
45
|
+
# Old Connection keyword arguments remain accepted without silently
|
|
46
|
+
# choosing one endpoint when a caller supplies conflicting identities.
|
|
47
|
+
if system_type is not None and provider is not None and system_type != provider:
|
|
48
|
+
raise ValueError("system_type and compatibility provider disagree")
|
|
49
|
+
compatibility_type = system_type if system_type is not None else provider
|
|
50
|
+
if (
|
|
51
|
+
endpoint_type is not None
|
|
52
|
+
and compatibility_type is not None
|
|
53
|
+
and endpoint_type != compatibility_type
|
|
54
|
+
):
|
|
55
|
+
raise ValueError("endpoint_type and compatibility type disagree")
|
|
56
|
+
if (
|
|
57
|
+
endpoint_reference is not None
|
|
58
|
+
and connection is not None
|
|
59
|
+
and endpoint_reference != connection
|
|
60
|
+
):
|
|
61
|
+
raise ValueError("endpoint_reference and compatibility connection disagree")
|
|
62
|
+
selected_type = endpoint_type if endpoint_type is not None else compatibility_type
|
|
63
|
+
if selected_type is None or not selected_type.strip():
|
|
64
|
+
raise ValueError("endpoint_type is required")
|
|
65
|
+
object.__setattr__(self, "endpoint_type", selected_type)
|
|
66
|
+
object.__setattr__(self, "roles", roles)
|
|
67
|
+
object.__setattr__(
|
|
68
|
+
self,
|
|
69
|
+
"endpoint_reference",
|
|
70
|
+
endpoint_reference if endpoint_reference is not None else connection,
|
|
71
|
+
)
|
|
72
|
+
object.__setattr__(self, "options", dict(options or {}))
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def provider(self) -> str:
|
|
76
|
+
"""Compatibility spelling for endpoint_type."""
|
|
77
|
+
return self.endpoint_type
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def system_type(self) -> str:
|
|
81
|
+
"""Compatibility spelling for endpoint_type."""
|
|
82
|
+
return self.endpoint_type
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def connection(self) -> str | None:
|
|
86
|
+
"""Compatibility spelling for endpoint_reference."""
|
|
87
|
+
return self.endpoint_reference
|
|
88
|
+
|
|
36
89
|
def endpoint(self) -> EndpointSpec:
|
|
37
90
|
return EndpointSpec(
|
|
38
|
-
type=self.
|
|
39
|
-
connection=self.
|
|
91
|
+
type=self.endpoint_type,
|
|
92
|
+
connection=self.endpoint_reference,
|
|
40
93
|
options=dict(self.options),
|
|
41
94
|
)
|
|
42
95
|
|
|
43
96
|
|
|
44
|
-
EndpointInput = str | Path | EndpointSpec |
|
|
97
|
+
EndpointInput = str | Path | EndpointSpec | DataEndpoint
|
|
45
98
|
|
|
46
99
|
|
|
47
100
|
class Migration:
|
|
@@ -106,7 +159,7 @@ class Sanka:
|
|
|
106
159
|
credential_provider: CredentialProvider | None = None,
|
|
107
160
|
) -> None:
|
|
108
161
|
self._store = SqliteStateStore(state)
|
|
109
|
-
self._registry =
|
|
162
|
+
self._registry = ExtensionRegistry.discover()
|
|
110
163
|
self._engine = MigrationEngine(
|
|
111
164
|
store=self._store,
|
|
112
165
|
registry=self._registry,
|
|
@@ -116,32 +169,50 @@ class Sanka:
|
|
|
116
169
|
)
|
|
117
170
|
self._closed = False
|
|
118
171
|
|
|
119
|
-
def
|
|
172
|
+
def configure_endpoint(
|
|
120
173
|
self,
|
|
121
|
-
|
|
122
|
-
|
|
174
|
+
endpoint_type: str,
|
|
175
|
+
endpoint_reference: str | Path | None = None,
|
|
123
176
|
*,
|
|
124
177
|
options: Mapping[str, Any] | None = None,
|
|
125
|
-
) ->
|
|
126
|
-
"""
|
|
178
|
+
) -> DataEndpoint:
|
|
179
|
+
"""Configure a data endpoint supported by an installed extension.
|
|
127
180
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
store; the resulting descriptor may be persisted in a migration spec.
|
|
181
|
+
The endpoint reference is a path, URL, or named data endpoint.
|
|
182
|
+
Authentication and reachability are checked by the migration lifecycle.
|
|
131
183
|
"""
|
|
132
184
|
self._ensure_open()
|
|
133
|
-
normalized =
|
|
185
|
+
normalized = endpoint_type.strip().lower()
|
|
134
186
|
if normalized == "postgresql":
|
|
135
187
|
normalized = "postgres"
|
|
136
188
|
roles = self._registry.roles(normalized)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
provider=normalized,
|
|
189
|
+
return DataEndpoint(
|
|
190
|
+
endpoint_type=normalized,
|
|
140
191
|
roles=roles,
|
|
141
|
-
|
|
142
|
-
options=
|
|
192
|
+
endpoint_reference=None if endpoint_reference is None else str(endpoint_reference),
|
|
193
|
+
options=options,
|
|
143
194
|
)
|
|
144
195
|
|
|
196
|
+
def configure_system(
|
|
197
|
+
self,
|
|
198
|
+
system_type: str,
|
|
199
|
+
endpoint_reference: str | Path | None = None,
|
|
200
|
+
*,
|
|
201
|
+
options: Mapping[str, Any] | None = None,
|
|
202
|
+
) -> DataEndpoint:
|
|
203
|
+
"""Compatibility method for configure_endpoint; does not authenticate."""
|
|
204
|
+
return self.configure_endpoint(system_type, endpoint_reference, options=options)
|
|
205
|
+
|
|
206
|
+
def connect(
|
|
207
|
+
self,
|
|
208
|
+
provider: str,
|
|
209
|
+
connection: str | Path | None = None,
|
|
210
|
+
*,
|
|
211
|
+
options: Mapping[str, Any] | None = None,
|
|
212
|
+
) -> DataEndpoint:
|
|
213
|
+
"""Compatibility method for configure_endpoint; does not authenticate."""
|
|
214
|
+
return self.configure_endpoint(provider, connection, options=options)
|
|
215
|
+
|
|
145
216
|
def migrate(
|
|
146
217
|
self,
|
|
147
218
|
source: EndpointInput,
|
|
@@ -194,7 +265,7 @@ class Sanka:
|
|
|
194
265
|
|
|
195
266
|
|
|
196
267
|
def _endpoint(value: EndpointInput, *, role: str) -> EndpointSpec:
|
|
197
|
-
if isinstance(value,
|
|
268
|
+
if isinstance(value, DataEndpoint):
|
|
198
269
|
return value.endpoint()
|
|
199
270
|
if isinstance(value, EndpointSpec):
|
|
200
271
|
return value
|
|
@@ -218,6 +289,13 @@ def _endpoint(value: EndpointInput, *, role: str) -> EndpointSpec:
|
|
|
218
289
|
return EndpointSpec(type="sqlite", connection=str(path))
|
|
219
290
|
|
|
220
291
|
raise SpecError(
|
|
221
|
-
f"cannot infer the {role}
|
|
292
|
+
f"cannot infer the {role} system type from {raw!r}; pass an EndpointSpec, "
|
|
222
293
|
"a URL-style endpoint, or a supported local path"
|
|
223
294
|
)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
# Compatibility import for clients using the original descriptor name.
|
|
298
|
+
Connection = DataEndpoint
|
|
299
|
+
|
|
300
|
+
# Compatibility names from the earlier systems terminology.
|
|
301
|
+
SystemConfig = DataEndpoint
|
|
@@ -55,7 +55,7 @@ from sanka.runtime.extensions.lifecycle import ApplicationLifecycle
|
|
|
55
55
|
from sanka.runtime.extensions.runner import ExtensionResult
|
|
56
56
|
from sanka.runtime.extensions.store import ExtensionStore
|
|
57
57
|
from sanka.runtime.planner import MigrationPlan
|
|
58
|
-
from sanka.runtime.registry import
|
|
58
|
+
from sanka.runtime.registry import ExtensionRegistry, UnknownEndpointError
|
|
59
59
|
from sanka.runtime.spec import EndpointSpec, MigrationSpec, SpecError
|
|
60
60
|
from sanka.runtime.state import SqliteStateStore
|
|
61
61
|
|
|
@@ -83,12 +83,13 @@ class _CliArgumentParser(argparse.ArgumentParser):
|
|
|
83
83
|
super().error(message)
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
def main(argv: list[str] | None = None) -> int:
|
|
86
|
+
def main(argv: list[str] | None = None, *, api_base: str | None = None) -> int:
|
|
87
87
|
arguments = list(sys.argv[1:] if argv is None else argv)
|
|
88
88
|
json_errors = "--json" in arguments or "--compact-dsl" in arguments
|
|
89
89
|
parser = _build_parser(json_errors=json_errors)
|
|
90
90
|
try:
|
|
91
91
|
args = parser.parse_args(arguments)
|
|
92
|
+
args.api_base = api_base
|
|
92
93
|
except CliUsageError as error:
|
|
93
94
|
command = arguments[0] if arguments and arguments[0] in SDK_COMMANDS else "sanka"
|
|
94
95
|
return _print_cli_error(
|
|
@@ -121,7 +122,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
121
122
|
)
|
|
122
123
|
except (
|
|
123
124
|
SpecError,
|
|
124
|
-
|
|
125
|
+
UnknownEndpointError,
|
|
125
126
|
ExecutionError,
|
|
126
127
|
FileNotFoundError,
|
|
127
128
|
) as error:
|
|
@@ -400,7 +401,7 @@ def _build_parser(*, json_errors: bool = False) -> argparse.ArgumentParser:
|
|
|
400
401
|
|
|
401
402
|
test = commands.add_parser(
|
|
402
403
|
"test",
|
|
403
|
-
help="generate and run
|
|
404
|
+
help="generate and run tests for the converted application",
|
|
404
405
|
description=(
|
|
405
406
|
"Prepare the generated uv or pip environment, write generated-app tests, and run "
|
|
406
407
|
"them. This proves generated scope, not source parity."
|
|
@@ -550,9 +551,9 @@ def _build_parser(*, json_errors: bool = False) -> argparse.ArgumentParser:
|
|
|
550
551
|
|
|
551
552
|
connect = commands.add_parser(
|
|
552
553
|
"connect",
|
|
553
|
-
help="
|
|
554
|
+
help="inspect installed extension support; does not authenticate a system",
|
|
554
555
|
)
|
|
555
|
-
connect.add_argument("provider", help="
|
|
556
|
+
connect.add_argument("provider", help="system type, e.g. markdown or postgres")
|
|
556
557
|
connect.add_argument("--json", action="store_true", help="print provider details as JSON")
|
|
557
558
|
connect.set_defaults(handler=_cmd_connect)
|
|
558
559
|
|
|
@@ -668,13 +669,20 @@ def _research_output_options(parser: argparse.ArgumentParser) -> None:
|
|
|
668
669
|
parser.add_argument("--json", action="store_true", help="print the API data payload as JSON")
|
|
669
670
|
|
|
670
671
|
|
|
671
|
-
def _research_client() -> SankaMigrateApiClient:
|
|
672
|
+
def _research_client(api_base: str | None = None) -> SankaMigrateApiClient:
|
|
673
|
+
# The shared CLI option names an API origin (optionally with a path prefix).
|
|
674
|
+
# The older SANKA_MIGRATE_API_BASE setting continues to name the full service root.
|
|
675
|
+
if api_base:
|
|
676
|
+
base = api_base.rstrip("/")
|
|
677
|
+
if not base.endswith("/v2/migrate"):
|
|
678
|
+
base += "/v2/migrate"
|
|
679
|
+
return SankaMigrateApiClient(base_url=base)
|
|
672
680
|
return SankaMigrateApiClient()
|
|
673
681
|
|
|
674
682
|
|
|
675
683
|
def _engine(state_path: str) -> MigrationEngine:
|
|
676
684
|
return MigrationEngine(
|
|
677
|
-
store=SqliteStateStore(state_path), registry=
|
|
685
|
+
store=SqliteStateStore(state_path), registry=ExtensionRegistry.discover()
|
|
678
686
|
)
|
|
679
687
|
|
|
680
688
|
|
|
@@ -696,7 +704,9 @@ def _extension_result(
|
|
|
696
704
|
[
|
|
697
705
|
(
|
|
698
706
|
str(record.get("id", "")),
|
|
699
|
-
|
|
707
|
+
{"connector": "System access", "migration": "Code conversion"}.get(
|
|
708
|
+
str(record.get("kind", "")), str(record.get("kind", ""))
|
|
709
|
+
),
|
|
700
710
|
str(record.get("version", "")),
|
|
701
711
|
", ".join(map(str, record.get("status", []))),
|
|
702
712
|
str(record.get("marketplace", "")),
|
|
@@ -791,22 +801,29 @@ async def _cmd_extension_marketplace_remove(args: argparse.Namespace) -> int:
|
|
|
791
801
|
|
|
792
802
|
|
|
793
803
|
async def _cmd_connect(args: argparse.Namespace) -> int:
|
|
794
|
-
registry =
|
|
795
|
-
|
|
796
|
-
if
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
804
|
+
registry = ExtensionRegistry.discover()
|
|
805
|
+
system_type = str(args.provider).strip().lower()
|
|
806
|
+
if system_type == "postgresql":
|
|
807
|
+
system_type = "postgres"
|
|
808
|
+
try:
|
|
809
|
+
roles = list(registry.roles(system_type))
|
|
810
|
+
payload = {
|
|
811
|
+
"provider": system_type, # Compatibility JSON key.
|
|
812
|
+
"system_type": system_type,
|
|
813
|
+
"roles": roles,
|
|
814
|
+
"installed": True,
|
|
815
|
+
"connection_status": "not_checked",
|
|
816
|
+
**registry.extension_metadata(system_type),
|
|
817
|
+
}
|
|
818
|
+
finally:
|
|
819
|
+
registry.close()
|
|
805
820
|
if args.json:
|
|
806
821
|
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
|
807
822
|
else:
|
|
808
|
-
print(f"{
|
|
809
|
-
|
|
823
|
+
print(f"{system_type}: extension installed ({', '.join(roles)})")
|
|
824
|
+
if payload.get("package"):
|
|
825
|
+
print(f"extension {payload['extension_id']}; package {payload['package']}")
|
|
826
|
+
print("System authentication and reachability have not been checked.")
|
|
810
827
|
return 0
|
|
811
828
|
|
|
812
829
|
|
|
@@ -1149,7 +1166,7 @@ async def _cmd_migrate(args: argparse.Namespace) -> int:
|
|
|
1149
1166
|
|
|
1150
1167
|
async def _cmd_research_eol(args: argparse.Namespace) -> int:
|
|
1151
1168
|
data = await asyncio.to_thread(
|
|
1152
|
-
_research_client().research_eol,
|
|
1169
|
+
_research_client(getattr(args, "api_base", None)).research_eol,
|
|
1153
1170
|
product=args.product,
|
|
1154
1171
|
category=args.category,
|
|
1155
1172
|
event_type=args.type,
|
|
@@ -1162,7 +1179,7 @@ async def _cmd_research_eol(args: argparse.Namespace) -> int:
|
|
|
1162
1179
|
|
|
1163
1180
|
async def _cmd_research_tco(args: argparse.Namespace) -> int:
|
|
1164
1181
|
data = await asyncio.to_thread(
|
|
1165
|
-
_research_client().research_tco,
|
|
1182
|
+
_research_client(getattr(args, "api_base", None)).research_tco,
|
|
1166
1183
|
product=args.product,
|
|
1167
1184
|
category=args.category,
|
|
1168
1185
|
locale=args.locale,
|
|
@@ -1177,7 +1194,7 @@ async def _cmd_research_compare(args: argparse.Namespace) -> int:
|
|
|
1177
1194
|
"--platforms accepts at most 10 comma-separated values.",
|
|
1178
1195
|
)
|
|
1179
1196
|
data = await asyncio.to_thread(
|
|
1180
|
-
_research_client().research_compare,
|
|
1197
|
+
_research_client(getattr(args, "api_base", None)).research_compare,
|
|
1181
1198
|
category=args.category,
|
|
1182
1199
|
platforms=args.platforms,
|
|
1183
1200
|
locale=args.locale,
|
|
@@ -1209,7 +1226,7 @@ async def _cmd_assess(args: argparse.Namespace) -> int:
|
|
|
1209
1226
|
if elapsed_ms < 2000:
|
|
1210
1227
|
await asyncio.sleep((2000 - elapsed_ms) / 1000)
|
|
1211
1228
|
data = await asyncio.to_thread(
|
|
1212
|
-
_research_client().assess,
|
|
1229
|
+
_research_client(getattr(args, "api_base", None)).assess,
|
|
1213
1230
|
{
|
|
1214
1231
|
"source": args.source,
|
|
1215
1232
|
"destination": args.destination or "",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""Sanka Runtime — planner, engine, state, and verification.
|
|
3
3
|
|
|
4
4
|
Everything under ``sanka.runtime`` is AGPL-3.0-only. Connectors must not
|
|
5
|
-
import this package; they depend on the Apache-2.0 ``
|
|
5
|
+
import this package; they depend on the Apache-2.0 ``sanka_extensions.data`` SPI
|
|
6
6
|
instead, and CI enforces that boundary.
|
|
7
7
|
|
|
8
8
|
The runtime lands in Phase 2 (lifecycle state machine, SQLite state store,
|
|
@@ -23,25 +23,25 @@ from sanka.runtime.connector_host import (
|
|
|
23
23
|
encode_value,
|
|
24
24
|
)
|
|
25
25
|
from sanka.runtime.extensions.model import ExtensionError
|
|
26
|
-
from
|
|
26
|
+
from sanka_extensions.data import (
|
|
27
27
|
BatchRelationshipWriteResult,
|
|
28
28
|
BatchWriteInput,
|
|
29
29
|
BatchWriteResult,
|
|
30
30
|
Credentials,
|
|
31
31
|
CustomObjectDefinition,
|
|
32
|
-
|
|
32
|
+
DataIdentity,
|
|
33
|
+
DataReader,
|
|
34
|
+
DataWriter,
|
|
33
35
|
Inventory,
|
|
34
36
|
Limits,
|
|
35
37
|
OwnerProfile,
|
|
36
38
|
PipelineDefinition,
|
|
37
39
|
PropertyDefinition,
|
|
38
40
|
PropertyResult,
|
|
39
|
-
ProviderIdentity,
|
|
40
41
|
RecordPage,
|
|
41
42
|
RelationshipWrite,
|
|
42
43
|
RelationshipWriteResult,
|
|
43
44
|
ResourceResult,
|
|
44
|
-
SourceConnector,
|
|
45
45
|
SourceFilter,
|
|
46
46
|
SourceObject,
|
|
47
47
|
WriteOptions,
|
|
@@ -60,7 +60,7 @@ def _minimal_environment() -> dict[str, str]:
|
|
|
60
60
|
return environment
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
class
|
|
63
|
+
class ExtensionHostClient:
|
|
64
64
|
"""One locked request stream to one verified connector environment."""
|
|
65
65
|
|
|
66
66
|
def __init__(
|
|
@@ -293,7 +293,7 @@ class ConnectorHostClient:
|
|
|
293
293
|
self._stdout = queue.Queue()
|
|
294
294
|
self._stderr = queue.Queue()
|
|
295
295
|
|
|
296
|
-
def __enter__(self) ->
|
|
296
|
+
def __enter__(self) -> ExtensionHostClient:
|
|
297
297
|
return self
|
|
298
298
|
|
|
299
299
|
def __exit__(self, *_args: object) -> None:
|
|
@@ -303,7 +303,7 @@ class ConnectorHostClient:
|
|
|
303
303
|
class _RemoteConnector:
|
|
304
304
|
def __init__(
|
|
305
305
|
self,
|
|
306
|
-
client:
|
|
306
|
+
client: ExtensionHostClient,
|
|
307
307
|
provider: str,
|
|
308
308
|
role: str,
|
|
309
309
|
binding_kind: str,
|
|
@@ -410,9 +410,9 @@ class _RemoteDestination(_RemoteConnector):
|
|
|
410
410
|
|
|
411
411
|
|
|
412
412
|
class _IdentityInspection(_RemoteConnector):
|
|
413
|
-
async def inspect(self, credentials: Credentials) ->
|
|
413
|
+
async def inspect(self, credentials: Credentials) -> DataIdentity:
|
|
414
414
|
return cast(
|
|
415
|
-
|
|
415
|
+
DataIdentity, await self._async_request("inspect", {"credentials": credentials})
|
|
416
416
|
)
|
|
417
417
|
|
|
418
418
|
|
|
@@ -685,13 +685,13 @@ def _valid_description(description: Any, role: str) -> bool:
|
|
|
685
685
|
return True
|
|
686
686
|
|
|
687
687
|
|
|
688
|
-
def
|
|
689
|
-
client:
|
|
688
|
+
def build_remote_extension(
|
|
689
|
+
client: ExtensionHostClient,
|
|
690
690
|
provider: str,
|
|
691
691
|
role: str,
|
|
692
692
|
*,
|
|
693
693
|
description: dict[str, Any] | None = None,
|
|
694
|
-
) ->
|
|
694
|
+
) -> DataReader | DataWriter:
|
|
695
695
|
"""Build a structural proxy with only capabilities the host advertised."""
|
|
696
696
|
description = description or cast(dict[str, Any], client.request(provider, "describe", {}))
|
|
697
697
|
if not _valid_description(description, role):
|
|
@@ -702,9 +702,13 @@ def build_remote_connector(
|
|
|
702
702
|
mixins = tuple(_MIXINS[name] for name in capabilities[role] if name in _MIXINS)
|
|
703
703
|
proxy_type = type(f"Remote{provider.title()}{role.title()}", (base, *mixins), {})
|
|
704
704
|
return cast(
|
|
705
|
-
|
|
705
|
+
DataReader | DataWriter,
|
|
706
706
|
proxy_type(client, provider, role, binding_kinds[role]),
|
|
707
707
|
)
|
|
708
708
|
|
|
709
709
|
|
|
710
|
-
__all__ = ["
|
|
710
|
+
__all__ = ["ExtensionHostClient", "build_remote_extension"]
|
|
711
|
+
|
|
712
|
+
# Compatibility imports for existing clients.
|
|
713
|
+
ConnectorHostClient = ExtensionHostClient
|
|
714
|
+
build_remote_connector = build_remote_extension
|