mostlyright-data 0.31.40__tar.gz → 0.31.42__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 (132) hide show
  1. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/PKG-INFO +1 -1
  2. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/SKILL.md +2 -0
  3. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/commands.md +2 -2
  4. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/preparing-table-search.md +23 -59
  5. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/router.py +1 -1
  6. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_public.py +102 -22
  7. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_search.py +11 -4
  8. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/vocabulary.py +2 -2
  9. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/render.py +1 -0
  10. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/.gitignore +0 -0
  11. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/README.md +0 -0
  12. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/pyproject.toml +0 -0
  13. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/scripts/hatch_build.py +0 -0
  14. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/agents/openai.yaml +0 -0
  15. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/1-open-the-page-and-the-link-to-it-in-the-first-message.md +0 -0
  16. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/2-brief-two-to-four-questions-each-with-a-recommended-answer.md +0 -0
  17. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/3-probe-read-a-source-before-committing-to-it.md +0 -0
  18. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/4-decide-say-what-you-chose-what-you-refused-and-ask-one-question.md +0 -0
  19. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/5-draft-one-recipe-document-one-call.md +0 -0
  20. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/6-build-one-run-sized-to-acquire-every-measured-source-whole.md +0 -0
  21. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/7-interrogate-ask-the-run-what-it-actually-delivered.md +0 -0
  22. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/8-fix-revise-the-document-and-register-it-again.md +0 -0
  23. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/9-present-only-what-survived-inspection-with-caveats.md +0 -0
  24. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/agent-protocol.md +0 -0
  25. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/autonomous-delivery.md +0 -0
  26. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/before-the-first-tool-call.md +0 -0
  27. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/boundaries.md +0 -0
  28. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/cloud-authentication-preflight.md +0 -0
  29. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/enriching-with-small-models.md +0 -0
  30. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/live-run.md +0 -0
  31. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/making-a-table-incremental.md +0 -0
  32. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/narrating-the-run.md +0 -0
  33. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/not-hosted-yet.md +0 -0
  34. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/one-install.md +0 -0
  35. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/patterns.md +0 -0
  36. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/predicting-with-tabular-models.md +0 -0
  37. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/prediction-labels.md +0 -0
  38. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/promote.md +0 -0
  39. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/readers.md +0 -0
  40. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/receipts.md +0 -0
  41. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/recipe-test.md +0 -0
  42. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/recording-a-stream-venue.md +0 -0
  43. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/recovering-an-import-failure.md +0 -0
  44. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/reference-pages.md +0 -0
  45. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/required-protocol.md +0 -0
  46. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/satellite-signals.md +0 -0
  47. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/source-credentials.md +0 -0
  48. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/sources.md +0 -0
  49. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/the-one-thing-to-say-about-the-skill-itself.md +0 -0
  50. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/transforms.md +0 -0
  51. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/user-communication-contract.md +0 -0
  52. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/references/writing-a-decision-record.md +0 -0
  53. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/skills/mr-data-build/scripts/write_research_notebook.py +0 -0
  54. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/__init__.py +0 -0
  55. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/agent_protocol.py +0 -0
  56. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/canonical.py +0 -0
  57. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/key_seam.py +0 -0
  58. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/page_coverage.py +0 -0
  59. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/part_check_evidence.py +0 -0
  60. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/session_probes.py +0 -0
  61. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/skill_assets.py +0 -0
  62. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/table_manifest.py +0 -0
  63. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/__init__.py +0 -0
  64. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/activity.py +0 -0
  65. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/backoff.py +0 -0
  66. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/categories.py +0 -0
  67. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/dataset-categories-v1.json +0 -0
  68. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/dataset_layout.py +0 -0
  69. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/delivery.py +0 -0
  70. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/description_shape.py +0 -0
  71. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/download.py +0 -0
  72. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/enrichment.py +0 -0
  73. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/fast_features.py +0 -0
  74. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/matching_benchmark.py +0 -0
  75. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/probe.py +0 -0
  76. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/progress_rate.py +0 -0
  77. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/progress_vocabulary.py +0 -0
  78. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/recipe.py +0 -0
  79. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/recipe_brief.py +0 -0
  80. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/recipe_explain.py +0 -0
  81. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/recipe_forecast.py +0 -0
  82. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/recipe_lint.py +0 -0
  83. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/recipe_test.py +0 -0
  84. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/refresh_rehearsal.py +0 -0
  85. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/release_check.py +0 -0
  86. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/research.py +0 -0
  87. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/run_diagnose.py +0 -0
  88. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/run_prefix.py +0 -0
  89. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/runs.py +0 -0
  90. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/session.py +0 -0
  91. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/stream.py +0 -0
  92. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/stream_venue.py +0 -0
  93. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/studio_capabilities.py +0 -0
  94. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/support.py +0 -0
  95. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/table_search_contract.json +0 -0
  96. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/table_view.py +0 -0
  97. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/transport.py +0 -0
  98. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/user_agent.py +0 -0
  99. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4.py +0 -0
  100. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_artifacts.py +0 -0
  101. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_catalog.py +0 -0
  102. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_connected.py +0 -0
  103. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_connections.py +0 -0
  104. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_dataset_covers.py +0 -0
  105. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_datasets.py +0 -0
  106. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_handoff.py +0 -0
  107. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_matching.py +0 -0
  108. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_narrative.py +0 -0
  109. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_public_pull.py +0 -0
  110. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_query.py +0 -0
  111. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_reader.py +0 -0
  112. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_runs.py +0 -0
  113. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_search_contract.py +0 -0
  114. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_secrets.py +0 -0
  115. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_stream.py +0 -0
  116. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/thin/v4_tables.py +0 -0
  117. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/__init__.py +0 -0
  118. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/attendance.py +0 -0
  119. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/clarification.py +0 -0
  120. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/cloud_auth.py +0 -0
  121. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/commands/__init__.py +0 -0
  122. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/commands/auth.py +0 -0
  123. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/commands/clarify.py +0 -0
  124. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/commands/login.py +0 -0
  125. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/commands/whoami.py +0 -0
  126. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/credential_native.py +0 -0
  127. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/credential_store.py +0 -0
  128. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/credentials.py +0 -0
  129. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/login.py +0 -0
  130. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/path_kind.py +0 -0
  131. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/plain_file.py +0 -0
  132. {mostlyright_data-0.31.40 → mostlyright_data-0.31.42}/src/mostlyright/data_harness/ux/remediation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyright-data
3
- Version: 0.31.40
3
+ Version: 0.31.42
4
4
  Summary: Mostly Right hosted CLI for reviewed datasets
5
5
  Project-URL: Homepage, https://mostlyright.md/
6
6
  Project-URL: Documentation, https://mostlyright.md/docs/guides/cli/
@@ -15,6 +15,8 @@ prediction where a column is known for some rows and wanted for others. Do not
15
15
  wait for the person to name a model. Steps 3, 4, 5, 8 and 10 say where, and
16
16
  [enriching with small models](references/enriching-with-small-models.md) says how.
17
17
 
18
+ For application access, API queries or polling for updates, use `mr-data public api-guide TABLE_ID`. It returns table-specific requests and key setup. Use environment variables for secrets.
19
+
18
20
  ## Set the goal as a checklist
19
21
 
20
22
  At the start of every build, write the goal as a checklist with the host's todo or plan tool:
@@ -19,7 +19,7 @@ run in full.
19
19
  | `mr-data source` | `source inspect` takes a bounded look at one source, and it is the v4 path where `probe` is not. [Stage 3](3-probe-read-a-source-before-committing-to-it.md) says when to use it. It starts one of three ways, and each prints the `session_id`, `probe_id` and `source_id`, plus the `dataset_id` and `question_id` when it has them. For a new public HTTPS CSV that needs no key, give `--dataset-id`, `--question`, `--source-name`, `--source-url`, `--claimed-basis` and `--claim-evidence-digest`: it prepares the source and opens a session. For a source already prepared, give `--dataset-id`, `--question-id` and `--source-id`, which opens a session. In a session you already hold, give `--session-id` with `--source-id`. `--context-source-id` adds a source to a session it opens. `--session-id` with `--probe-id` reads the answer back; `--probe-id` alone is refused. A look is bounded to 65,536 bytes, 1,000 rows and 300 seconds. A larger file can fail `BYTE_LIMIT` after a wait, so read it by a bounded run of a scratch table. `queued` and `truncated` are not complete answers, and `capability_unavailable` means this deployment cannot inspect, so read the source by a bounded run of a scratch table instead, as [the probe rule](3-probe-read-a-source-before-committing-to-it.md#the-probe-rule-test-on-a-scratch-table-never-on-the-real-table) says. What it finds is exploratory evidence, not a run and not a receipt. |
20
20
  | `mr-data reader` | `reader normalize --family-id ID --family-version VERSION --options-file FILE [--workspace-id ID]` asks the server's Reader service to apply one certified family's own defaults and option rules to a JSON object of options, at most 64 KiB, and prints the normalized `decode_options`, `decode_options_json` and `options_digest`. The second is the text a recipe carries as `reader.decode_options`, and the third is the `options_digest` a Generic API's `generic_api.response.reader` states for exactly those options. A connector pin takes no `reader.options_digest` parameter ([Readers](readers.md)). It changes nothing, and this client does not validate or invent a family's options: the server decides. Run it for every Reader pin before you register, so a wrong option is refused here and not inside a run. |
21
21
  | `mr-data catalog` | `catalog search "QUESTION"` asks the sealed public-source catalogue which of its entries might answer a question and ranks them best first. Every ranked entry comes back with the disposition its own facts earned — `admitted`, `human_escalation_required` or `refused` — because an entry the catalogue could not vouch for is still a finding. `--format csv` states the one data format the question requires — one token per question, never repeated — and it is not a filter: an entry that does not declare that format still comes back ranked, with disposition `refused` and `filters_match` false, so nothing is held back; `--limit N` ranks at most N, up to 25. It fetches nothing and registers nothing. The catalogue holds one provider (Data.gov) and only part of it, so it is never exhaustive and an empty answer is not evidence that no such source exists. When the answer is `catalog_unavailable`, this deployment has no catalogue to search: record the lane and carry on. |
22
- | `mr-data public` | Read Mostly Right's public dataset catalogue. `public search "QUERY"` ranks published datasets (`--topic`, `--limit` and `--cursor` narrow and page it), `show SLUG` reads one overview, `tables SLUG` lists its table identifiers, `schema TABLE_ID` reads one table's schema, `sample TABLE_ID` prints its published preview rows, `lookup "QUERY"` is the connector search shape and `fetch SLUG` returns the dataset's Markdown document. Those seven need no login. `query TABLE_ID`, with `--body` or `--body-file`, and `download-url TABLE_ID` do need `mr-data login`: they ask Cloud, with the device key, to run one query over a public table and to say how it can be downloaded. Preview rows are not a query, and those commands pass no table bytes. `pull SLUG` writes the dataset into `DIR/SLUG/` (`--dir`, default `./datasets`; `--table TABLE_ID` repeats to pick tables): `README.md`, `dataset.json`, and per table `schema.json` and `sample.json`, all read-only. Only with `--data` does it add each table's `data.parquet`, and only where the publisher enabled download and an `mr_use_` key is in the `MOSTLYRIGHT_USE_KEY` environment variable; never pass the key as an argument. `--data` connects the dataset to the key's workspace and counts each download against its allowance, so leave it off unless the bytes are needed. A rerun asks Cloud whether a file it already verified is still current and keeps it when Cloud says so, and a failed table is recorded in `dataset.json` without stopping the others. |
22
+ | `mr-data public` | Read Mostly Right's public dataset catalogue. `public search "QUERY"` ranks published datasets (`--topic`, `--limit` and `--cursor` narrow and page it), `show SLUG` reads one overview, `tables SLUG` lists its table identifiers, `schema TABLE_ID` reads one table's schema, `sample TABLE_ID` prints its published preview rows, `lookup "QUERY"` is the connector search shape and `fetch SLUG` returns the dataset's Markdown document. Those seven need no login. For app integration or polling, run `mr-data public api-guide TABLE_ID` for the table’s query and conditional snapshot requests. A public guide needs no login. For a private workspace table set `MOSTLYRIGHT_USE_KEY` in the environment. A `query` body with `search.engine=resident` uses MCP and the workspace of `MOSTLYRIGHT_USE_KEY`. For ordinary query bodies, `query TABLE_ID`, with `--body` or `--body-file`, and `download-url TABLE_ID` do need `mr-data login`: they ask Cloud, with the device key, to run one query over a public table and to say how it can be downloaded. Preview rows are not a query, and those commands pass no table bytes. `pull SLUG` writes the dataset into `DIR/SLUG/` (`--dir`, default `./datasets`; `--table TABLE_ID` repeats to pick tables): `README.md`, `dataset.json`, and per table `schema.json` and `sample.json`, all read-only. Only with `--data` does it add each table's `data.parquet`, and only where the publisher enabled download and an `mr_use_` key is in the `MOSTLYRIGHT_USE_KEY` environment variable; never pass the key as an argument. `--data` connects the dataset to the key's workspace and counts each download against its allowance, so leave it off unless the bytes are needed. A rerun asks Cloud whether a file it already verified is still current and keeps it when Cloud says so, and a failed table is recorded in `dataset.json` without stopping the others. |
23
23
  | `mr-data connected` | `connected list` shows the public datasets connected to this workspace and `connected add SLUG` connects one by its slug. It needs `mr-data login`: both ask Cloud, with the device key, over the routes MCP's `list_connected_datasets` and `connect_dataset` use. |
24
24
  | `mr-data ask` | `ask "QUESTION" [--run RUN_ID ...] [--failure-code CODE]` asks the Mostly Right support agent one question and waits for the answer; `--no-wait` prints the question id at once and `ask status QUESTION_ID` reads it later. It needs `mr-data login` and a workspace the agent is switched on for: while it is off the answer is `THIN_CLOUD_SUPPORT_AGENT_DISABLED`, which is final. The agent may file a problem for the Mostly Right team and prints its reference (`SR-N`). |
25
25
  | `mr-data dataset` | Bring the dataset page into existence before there is anything on it, then fill it in while somebody watches. `dataset create --name TEXT` mints it and prints the `dataset_id`, unless the user's own request already has an empty dataset open, in which case it answers `open_request_reused` with that `dataset_id` and mints nothing (`--separate` mints a new one for a different dataset); `dataset show ID` reads it back; `dataset check ID` lists every delivery step the whole dataset still owes (cover, description shape, topics (never a licence), a real table that is unbuilt, queued, building, held or live on a build cut short, search and a saved view on the main table (the layout's `search_table_id` and `default_table_id` when it names them), cadence, failing refreshes, every `scratch_` table still listed), exits 2 and ends `Delivery open: N items.` while any is open, and exits 0 with `Delivery complete.` when none is (with `--json`, `status` is `dataset_delivery_open` or `dataset_delivery_complete`); `dataset set ID --name TEXT --topics "a,b,c" --license ID --description-file F` writes the title, the descriptive tags, the SPDX licence and the description under the version it was read at, retrying once if somebody else wrote first, and an empty `--topics` or `--license` takes that value off the page; send `--name` and `--topics` whenever you send `--description-file`, because a description sent on its own can make the server write a new title and new tags, and read `changed` and `written_by_studio` on the receipt for every field the write moved; a saved write whose public sync fails exits 2 and reports `public_projection_synced: false` — use `dataset sync ID` to retry that sync without writing the dataset again; `dataset note ID --heading H --blocks-file B` writes one cell of the decision record that OUTLIVES every run, and `--list` reads it back; `dataset watch ID` follows the page's own event stream; `dataset activity ID --phase P --message TEXT` says what is happening right now, silently, and is never a chat message and never a cell; `dataset publish ID [--mode public|link|private]` says who can read the dataset — `public` lists it in the public directory and serves it at an address anybody can read, `link` serves it at an unlisted address, `private` takes it back to the workspace — and `dataset publish ID --show` reads that back without changing it; `dataset layout ID` reads the dataset's layout from Cloud: its sections, `default_table_id` (the table the Data tab opens on), `search_table_id` (the table the dataset's search runs on), the main-table choice and the dataset's tables; `dataset layout ID --set LAYOUT.json` saves `{"version": 1, "default_table_id", "search_table_id", "sections": [{"id", "title", "collapsed", "tables": [{"table_id", "title", "description"}]}]}`, `--dry-run` has Cloud check it and save nothing, replacing a saved layout needs its revision as `--expected-revision`, and a first layout takes `--expected-main-table TABLE_ID|none`, the main-table choice the read printed; a stale one is refused `THIN_DATASET_LAYOUT_LAYOUT_CHANGED`, and it uses the device key; `dataset archive ID --confirm-name TITLE` retires the page and frees its title, deleting nothing. |
@@ -30,7 +30,7 @@ run in full.
30
30
  | `mr-data runs` | Report this workspace's own runs: identifier, mode, state and creation time, plus the failure triple of any that failed and whether that failure was the execution room's. `--dataset DATASET_ID` narrows it to one dataset's runs, so "what have I run for this dataset?" is one scoped read, and a value that is not an identifier is refused `THIN_ARGUMENT_INVALID`. `--status` and `--mode` narrow it too and are refused `THIN_ARGUMENT_INVALID` for a word outside the seven states or the six modes; the three combine. The server narrows before it cuts a page, so a filtered page holds the newest runs that match however many runs the workspace has. `--limit` says how many, and pages are followed to reach it; a listing that does not end says how many were read and suggests a smaller `--limit` or a narrower filter. The answer prints `next_cursor`, and `--cursor` continues from it. |
31
31
  | `mr-data watch` | Stream one run's live progress under the durable event type of each stage, resuming across stream cuts. Exits non-zero when the run failed. `mr-data watch RUN_ID RUN_ID ...` follows up to 16 runs at once, prints one line as each ends, and returns once all have finished with one receipt per run (`failed_run_ids`, `refused_run_ids`); it exits 2 when any run failed and 1 when a run could not be watched. `--from-seq` and `--last-event-id` resume one run only. A full run that succeeds carries the same `delivery` block as `mr-data status`, and the multi-run receipt merges every run's steps. |
32
32
  | `mr-data query` | Run one bounded read-only SQL statement over a finished run's own table and print the rows. Name the table `run_table` in the SQL, whatever the recipe called it. Bounded on rows, on answer bytes and on time, and refused by name when a bound is crossed. When no worker can answer, the refusal names `mr-data download RUN_ID` as `fallback_command`, which brings the table here to read locally. The question is asked through Mostly Right Cloud; while its usage paywall is on and the workspace is unsubscribed, each answered query counts toward the person's monthly allowance, and a spent allowance refuses `THIN_USAGE_LIMIT`. A refusal after the question was queued names its `query_id`; running the same command again reads that query back. |
33
- | `mr-data search` | `search VERB` prepares and tests versioned search for a new table through the server; no model or index runs on this computer. The verbs are `inspect`, `sample`, `values`, `propose`, `configure`, `validate`, `add-cases`, `explain`, `preview`, `evaluate`, `estimate`, `build`, `status`, `activate`, `cancel`, `rollback`, `locate`, `try` and `query`. `inspect`, `propose` and `validate` also take `--recipe FILE` before registration. `validate --spec` checks a spec and its evaluation cases against the pinned contract without sending anything. A top-level spec member the pinned contract does not name is a warning, and `validate` (with a table or `--recipe`) and `configure` still send the spec to the server. `locate` resolves evaluation-case rows to locators, `try` runs one query against the live search, and `query` searches a table through Cloud's search route as its page does. `try` and `query` keep every member of the answer they do not name (on a collapsed page `matched_via`, `group_size` and `collapsed_by`), and `--group row\|collapse` asks for one row per match or one result per value of the spec's `collapse` column. `--group` and grouped results need a server that serves contract 4.61.0 and takes `group`; an older one answers 400 `invalid_request` to `--group`, so run without it there. A build returns promptly with job coordinates, and an operation the server does not serve answers a typed capability error. [Prepare search](preparing-table-search.md) says how it fits a build. |
33
+ | `mr-data search` | `search VERB` prepares and tests versioned search for a new table through the server; no model or index runs on this computer. The verbs are `inspect`, `sample`, `values`, `propose`, `configure`, `validate`, `add-cases`, `explain`, `preview`, `evaluate`, `estimate`, `build`, `status`, `activate`, `cancel`, `rollback`, `locate`, `try` and `query`. `inspect`, `propose` and `validate` also take `--recipe FILE` before registration. `validate --spec` checks a spec and its evaluation cases against the pinned contract without sending anything. A top-level spec member the pinned contract does not name is a warning, and `validate` (with a table or `--recipe`) and `configure` still send the spec to the server. `locate` resolves evaluation-case rows to locators, `try` runs one query against the live search, and `query` searches a table using MCP search_table as dataset chat does. `try` and `query` keep every member of the answer they do not name (on a collapsed page `matched_via`, `group_size` and `collapsed_by`), and `--group row\|collapse` asks for one row per match or one result per value of the spec's `collapse` column. `--group` and grouped results need a server that serves contract 4.61.0 and takes `group`; an older one answers 400 `invalid_request` to `--group`, so run without it there. A build returns promptly with job coordinates, and an operation the server does not serve answers a typed capability error. [Prepare search](preparing-table-search.md) says how it fits a build. |
34
34
  | `mr-data peek` | Print the columns, their logical types and the first rows of one run's table. The type comes off the run's own column profile where the preview carries none, so `type` is null only for a run that sealed no profile. |
35
35
  | `mr-data receipt` | Print what one run recorded about how it was built: every source it fetched and what those bytes hashed to, the coverage it delivered, and the members of its raw snapshot. |
36
36
  | `mr-data checks` | Report how each check the recipe declared came out — the name, whether it passed, what it found. Exits non-zero when one did not pass. |
@@ -6,7 +6,7 @@ example `mr-data search validate --help`.
6
6
 
7
7
  The steps below build search at the level of a dedicated search site: typo-tolerant titles,
8
8
  person and brand lookups, category words that become filters, sort words that become sorts,
9
- meaning-based retrieval over descriptions, and a planner that turns a sentence into a plan.
9
+ meaning-based retrieval over descriptions, and explicit plans supplied by the querying agent.
10
10
 
11
11
  ## The verbs
12
12
 
@@ -25,7 +25,7 @@ meaning-based retrieval over descriptions, and a planner that turns a sentence i
25
25
  | `search build` | Queues a search build for a sealed version, or for one revision with `--revision`. |
26
26
  | `search status` | Reports package readiness, job progress and the failure reason. |
27
27
  | `search try` | Runs one query against the table's live search and prints rows, plan and timings. |
28
- | `search query` | Searches a public table through Cloud's search route, as its page and MCP do. |
28
+ | `search query` | Searches a public table through the same MCP tool as dataset chat. |
29
29
  | `search activate` | Switches the version's live search to a built generation. |
30
30
  | `search rollback` | Switches back to an earlier generation. |
31
31
  | `search explain` | Shows how the server parses one query into filters and sorts. |
@@ -71,7 +71,7 @@ NOTE.md`; that note closes the search item in `mr-data dataset check`.
71
71
  When the brief does not mention search, search is optional only while the capability is missing.
72
72
  Then omit `table.search`, keep the drafted intent beside the recipe, and record the limit in the
73
73
  dataset's Sources and decisions note. Never put that limit in the description, title or topics.
74
- When the user explicitly requires semantic retrieval or the planner, do not register a recipe
74
+ When the user explicitly requires semantic retrieval, do not register a recipe
75
75
  without it. Report the limit and wait.
76
76
 
77
77
  ## 2. Choose keyword and semantic columns
@@ -90,7 +90,7 @@ A table with no useful prose keeps `semantic_columns` empty. A semantic-only tab
90
90
 
91
91
  ## 3. Fill the field roles
92
92
 
93
- `field_roles` tells search what each column means. The ranking and the planner use it.
93
+ `field_roles` tells search what each column means. The index uses these roles for ranking.
94
94
 
95
95
  | Role | Column type | Use |
96
96
  |---|---|---|
@@ -150,10 +150,7 @@ column description.
150
150
 
151
151
  ## 6. Write the vocabulary column by column
152
152
 
153
- An alias maps a phrase to an exact filter, and a sort alias maps a phrase to a sort. Once
154
- the live page's search applies the aliases, it merges them with the planner's plan. Until
155
- then aliases are honoured only by `search explain`, and only while the
156
- planner is unavailable for that table. The live page applies none. List every
153
+ An alias maps a phrase to an exact filter, and a sort alias maps a phrase to a sort. List every
157
154
  declared column before you write the spec. Then generate its phrases from its type:
158
155
 
159
156
  | Column | Phrases | Spec entry |
@@ -194,7 +191,7 @@ When the brief names the metric that makes a row popular, point "best", "top" an
194
191
  at that column.
195
192
 
196
193
  A sort alias binds its phrase to one column for every query that holds it, and it wins over the
197
- column names, the descriptions and the planner. Never bind a word that two columns could own,
194
+ column names and their descriptions. Never bind a word that two columns could own,
198
195
  such as "growth", "change" or "best", unless the brief names the metric. "Highest growth"
199
196
  pointed at a revenue column turns "highest growth last 30 days" into a revenue sort.
200
197
 
@@ -224,7 +221,7 @@ base that makes the rate meaningful, in `order_floors` (contract 4.54.0, up to 3
224
221
  - Floors are declared on a search revision with `mr-data search configure --spec`, not in the
225
222
  recipe's `table.search`, which refuses the member. A revision configured from the recipe's own
226
223
  spec carries none, and a new version of a private table keeps them only when you configure the
227
- revision again. A plan made without the planner, such as a keystroke search, applies no floor.
224
+ revision again. Include the floor explicitly when submitting an agent-generated plan.
228
225
  - A server older than contract 4.54.0 refuses the member as unknown. Configure without it there.
229
226
  - When a plan orders by `column`, in either direction, the server adds `base_column >= min` as a
230
227
  filter. The reader sees it in the search summary and can remove it. A query that already filters
@@ -234,47 +231,19 @@ base that makes the rate meaningful, in `order_floors` (contract 4.54.0, up to 3
234
231
  wrong ranking.
235
232
  - Choose `min` from the built table with `mr-data query`: the smallest base at which the rate stops
236
233
  being dominated by placeholders. State the floor at the start of the base column's
237
- description, since the planner reads only the first 160 characters of a description.
234
+ description so the querying agent can find it.
238
235
 
239
236
  A recipe's spec takes 128 filter aliases and 64 sort aliases, and a search revision 512 and 256.
240
237
  `search validate` refuses more.
241
238
  Rank the phrases and keep the top of the list. Put first the words that name the kind of row, the
242
239
  facets users type most, the popularity sorts and the product's own vocabulary. A phrase you leave
243
- out maps to nothing. The planner may still recover it from the column names and values, and
244
- nothing guarantees that.
245
-
246
- ## 8. Turn the planner on
247
-
248
- The planner turns a sentence into filters, sorts and preferences. Turn it on for every table with
249
- search with `"enabled": true`. A query whose every word an alias resolved skips it. Queries with
250
- negation or "or" stay unresolved rather than becoming a guessed filter.
251
-
252
- The planner model sees the query text, the column names and their descriptions, value
253
- dictionaries of at most 16 columns of at most 256 short values each, the aliases and the field
254
- roles. It never sees rows.
255
-
256
- `external_context_allowed` is the owner's consent to send that context to the planner model:
257
-
258
- - A public table whose sources are all public gets the planner on its live page whatever the flag
259
- says. Set the flag to `true` on it, so `search explain` and `capabilities.planner` match the page.
260
- - A private or link-shared table gets the planner only when the recipe sets the flag to `true`.
261
- That is a deliberate yes from the user or the workspace policy. Data-read permission is not that
262
- consent. Without that yes, keep the flag `false`.
263
- - Until the server supports it, the flag changes only `search explain` and the
264
- `capabilities.planner` readout. The live page plans a public table with public sources and no
265
- other table.
266
-
267
- `search inspect`, `search status` and `search explain` say why the planner is unavailable in
268
- `planner_detail.reason`. `external_context_not_allowed` means the recipe withholds consent.
269
- `private_source` means a source is not public.
270
-
271
- Write each column description as if the planner reads it, because it does, and the page shows it
272
- to the reader beside results ordered by that column. Say what the column holds, the period it
273
- covers ("trailing twelve months", "latest fiscal year against the year before", "over the last
274
- five fiscal years"), its unit, and the words people use for it, abbreviations included
275
- ("compound annual growth rate, CAGR"). The planner picks the column a query asks about, named
276
- bare ("revenue") or in a question ("what is the P/E ratio?"), from these descriptions. It reads
277
- the first 160 characters of each, so lead with what the column measures and its period.
240
+ out maps to nothing. Agents can inspect column names and values when composing explicit filters.
241
+
242
+ ## 8. Describe columns for the querying agent
243
+
244
+ The webagent or external MCP client chooses the filters, order and retrieval mode. Give each
245
+ column a clear description, including its unit, time window and what a typical value means.
246
+ Leave the legacy planner flags disabled. Keyword and semantic indexes remain available.
278
247
 
279
248
  ### Name and describe columns for search
280
249
 
@@ -282,7 +251,7 @@ Search reads a numeric comparison ("growth over 50") and a superlative ("highest
282
251
  onto the one column whose words the phrase holds. It splits a column's name on underscores. A
283
252
  word of the name scores 3, the same word less a plural ending scores 2, and a description word
284
253
  that no other column's description holds scores 1. Every word of the phrase must belong to the
285
- column. The highest total wins. A tie names no column, and the planner model decides.
254
+ column. The highest total wins. A tie leaves the column unspecified.
286
255
 
287
256
  - Put the words people type in the name: the subject, the measure and the window. Name a price
288
257
  column `price_change_30d_pct` and a revenue column `revenue_growth_ttm_pct`, not
@@ -308,7 +277,7 @@ A full spec looks like this:
308
277
  "semantic_columns": ["title", "overview"],
309
278
  "aliases": [{"phrase": "horror", "column": "genres", "operator": "contains", "value": "Horror"}],
310
279
  "sort_aliases": [{"phrase": "most popular", "column": "popularity", "direction": "desc"}],
311
- "planner": {"enabled": true, "external_context_allowed": true},
280
+ "planner": {"enabled": false, "external_context_allowed": false},
312
281
  "field_roles": {"title": "title", "person": "people_text", "date": "release_date",
313
282
  "popularity": "popularity", "rating": "vote_average", "identifier": "id",
314
283
  "description": "overview", "category": "genres", "image": "poster_url",
@@ -386,10 +355,8 @@ the dashboard's explain, or through `search explain`:
386
355
  mr-data search explain TABLE_ID --version VERSION_ID --query "stocks under 10" --json
387
356
  ```
388
357
 
389
- Read `planner_used`, `filters` and `order_by`. A query that asks for a filter or a sort and plans
390
- text only is a gap in the spec. Add the alias or sharpen the column description, then check again.
391
- `planner_used: false` on a settled query is a fault to report, unless aliases resolved every word
392
- or `planner_detail.reason` says the planner is withheld.
358
+ Read `filters` and `order_by` to check the deterministic interpretation. To test an
359
+ agent-selected plan, pass it explicitly and inspect the returned rows.
393
360
 
394
361
  Run real queries against the live search once `package_state` is `ready`:
395
362
 
@@ -569,11 +536,9 @@ Add `"engine": "resident"` and `"settled": true` to `search` to use the live pac
569
536
  does. Public query prints Cloud stage durations under `result.timings`, the HTTP status and the
570
537
  request ID. Keep a refusal's `detail` with its request ID.
571
538
 
572
- ## 15. Search a table the way its page does
539
+ ## 15. Query an indexed table
573
540
 
574
- A public table with a ready search package answers through Cloud's search route. The dataset
575
- page, the Public API's `POST /api/v2/public/tables/{id}/search`, MCP `search_table` and this verb
576
- all reach the same search service with the same plans. There is no scan fallback.
541
+ Dataset chat and this command call the same MCP tool, `search_table`. Public tables allow anonymous reads. Set `MOSTLYRIGHT_USE_KEY` for your workspace's allowance and its private tables. With semantic columns, `--mode meaning` retrieves descriptions by embedding similarity.
577
542
 
578
543
  ```sh
579
544
  mr-data search query PUBLIC_TABLE_ID --query "incepton" --json
@@ -582,8 +547,7 @@ mr-data search query PUBLIC_TABLE_ID --query "dune" --count --json
582
547
  mr-data search query PUBLIC_TABLE_ID --query "dune" --plan plan.json --cursor NEXT_CURSOR --json
583
548
  ```
584
549
 
585
- A query is settled by default, so the planner runs. `--unsettled` answers as the search box does
586
- while someone types, without the planner. `--page-size` is 1 to 100 (default 20). `--count` asks
550
+ The calling agent supplies filters and ordering in an explicit plan. `--page-size` is 1 to 100 (default 20). `--count` asks
587
551
  for the number of matching rows. To read the next page, save the answer's `plan` to a file and
588
552
  pass it with `--plan` beside `--cursor NEXT_CURSOR`; a cursor continues one plan.
589
553
 
@@ -689,7 +653,7 @@ example. Run the bounded test of Gate 3 on a scratch table and read the passages
689
653
  "semantic_columns": ["passage_text"],
690
654
  "aliases": [{"phrase": "analyst questions", "column": "section", "operator": "eq", "value": "qa"}],
691
655
  "sort_aliases": [{"phrase": "latest", "column": "call_date", "direction": "desc"}],
692
- "planner": {"enabled": true, "external_context_allowed": false},
656
+ "planner": {"enabled": false, "external_context_allowed": false},
693
657
  "field_roles": {"identifier": "passage_id", "title": "company", "person": "speaker",
694
658
  "date": "call_date", "description": "passage_text"},
695
659
  "display_columns": ["passage_id", "call_id", "company", "ticker", "call_date",
@@ -148,7 +148,7 @@ HOSTED_SUMMARY = dict(
148
148
  ("catalog", "ask the sealed public-source catalogue what might answer a question"),
149
149
  (
150
150
  "public",
151
- "read the public dataset catalogue anonymously (search, show, tables, schema, sample)",
151
+ "browse published datasets, get application API examples (api-guide) and download data",
152
152
  ),
153
153
  ("connected", "list or connect public datasets for this workspace (device key)"),
154
154
  ("ask", "ask the support agent a question about a run, a source or a refusal"),
@@ -16,6 +16,7 @@ Command map (MCP tool → CLI verb):
16
16
  * ``get_dataset`` → ``mr-data public show``
17
17
  * ``list_tables`` → ``mr-data public tables``
18
18
  * ``get_table_schema`` → ``mr-data public schema``
19
+ * ``get_access_instructions`` with table_id → ``mr-data public api-guide``
19
20
  * ``sample_rows`` → ``mr-data public sample``
20
21
  * ``search`` (connector) → ``mr-data public lookup``
21
22
  * ``fetch`` (connector) → ``mr-data public fetch``
@@ -87,6 +88,7 @@ ACTIONS: tuple[str, ...] = (
87
88
  "fetch",
88
89
  "query",
89
90
  "download-url",
91
+ "api-guide",
90
92
  "pull",
91
93
  )
92
94
 
@@ -189,7 +191,7 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
189
191
  "tables lists table ids; schema reads one table schema; sample "
190
192
  "returns published preview rows; lookup is the connector search "
191
193
  "shape; fetch returns the Markdown document; pull writes the dataset "
192
- "into DIR/SLUG"
194
+ "into DIR/SLUG; api-guide prints application query and polling examples for a table"
193
195
  ),
194
196
  )
195
197
  parser.add_argument(
@@ -198,7 +200,7 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
198
200
  default=None,
199
201
  help=(
200
202
  "for search/lookup: the query string; for show/tables/fetch/pull: the "
201
- "dataset slug; for schema/sample: the table UUID"
203
+ "dataset slug; for schema/sample/api-guide: the table UUID"
202
204
  ),
203
205
  )
204
206
  parser.add_argument(
@@ -924,7 +926,6 @@ def _fetch(args: argparse.Namespace, client: PublicCatalogClient) -> dict[str, A
924
926
 
925
927
  CLOUD_PUBLIC_TABLE_QUERY_PATH = "/api/cli/public/tables/{table_id}/query"
926
928
  CLOUD_PUBLIC_TABLE_DOWNLOAD_URL_PATH = "/api/cli/public/tables/{table_id}/download-url"
927
- CLOUD_PUBLIC_TABLE_SEARCH_PATH = "/api/cli/public/tables/{table_id}/search"
928
929
  QUERY_SCHEMA = f"{THIN_SCHEMA_PREFIX}-v4-public-query.v1"
929
930
  DOWNLOAD_URL_SCHEMA = f"{THIN_SCHEMA_PREFIX}-v4-public-download-url.v1"
930
931
 
@@ -943,6 +944,72 @@ MAX_PUBLIC_QUERY_RESPONSE_MEMBERS = (
943
944
  )
944
945
 
945
946
 
947
+ class AgentSearchClient(PublicCatalogClient):
948
+ """Call the same indexed row tool as dataset chat, anonymously or with a use key."""
949
+
950
+ def search_table(self, table_id: str, body: Mapping[str, Any]) -> dict[str, Any]:
951
+ return self.call_tool("search_table", table_id, body)
952
+
953
+ def query_table(self, table_id: str, body: Mapping[str, Any]) -> dict[str, Any]:
954
+ return self.call_tool("query_table", table_id, body)
955
+
956
+ def call_tool(self, name: str, table_id: str, body: Mapping[str, Any]) -> dict[str, Any]:
957
+ from mostlyright.data_harness.thin.v4_public_pull import read_use_key
958
+
959
+ headers = self._headers(accept="application/json, text/event-stream")
960
+ headers["Content-Type"] = "application/json"
961
+ key = read_use_key()
962
+ if key:
963
+ headers["Authorization"] = f"Bearer {key}"
964
+ payload = {
965
+ "jsonrpc": "2.0",
966
+ "id": 1,
967
+ "method": "tools/call",
968
+ "params": {"name": name, "arguments": {**body, "table_id": table_id}},
969
+ }
970
+ status, raw, response_headers = self.transport.request(
971
+ "POST",
972
+ f"{self.cloud_url}/api/mcp",
973
+ headers,
974
+ json.dumps(payload).encode(),
975
+ MAX_PUBLIC_QUERY_RESPONSE_BYTES * 3,
976
+ )
977
+ try:
978
+ envelope = parse_foreign_json(
979
+ raw, max_members=MAX_PUBLIC_QUERY_RESPONSE_MEMBERS, wide_integers=True
980
+ )
981
+ except CanonicalJSONError:
982
+ envelope = None
983
+ self.response_metadata = cloud_response_metadata(status, envelope, response_headers)
984
+ if status != 200:
985
+ raise cloud_refusal(status, envelope, act=f"call {name}", headers=response_headers)
986
+ if (
987
+ not isinstance(envelope, dict)
988
+ or envelope.get("id") != 1
989
+ or envelope.get("jsonrpc") != "2.0"
990
+ ):
991
+ raise ThinLaneError("THIN_RESPONSE_INVALID", "MCP answered without a matching response")
992
+ result = envelope.get("result")
993
+ answer = result.get("structuredContent") if isinstance(result, dict) else None
994
+ if not isinstance(answer, dict):
995
+ raise ThinLaneError(
996
+ "THIN_CLOUD_REFUSED", f"MCP could not run {name}; check tool access"
997
+ )
998
+ if result.get("isError"):
999
+ http_status = answer.get("http_status")
1000
+ retry = answer.get("retry_after_seconds")
1001
+ headers = dict(response_headers)
1002
+ if type(retry) is int:
1003
+ headers["Retry-After"] = str(retry)
1004
+ raise cloud_refusal(
1005
+ http_status if type(http_status) is int else 400,
1006
+ {**answer, "detail": answer.get("message") or answer.get("detail")},
1007
+ act=f"call {name}",
1008
+ headers=headers,
1009
+ )
1010
+ return answer
1011
+
1012
+
946
1013
  class PublicQueryClient(CloudClient):
947
1014
  """Authenticated public table query + download-url over the device-key client."""
948
1015
 
@@ -983,22 +1050,6 @@ class PublicQueryClient(CloudClient):
983
1050
  self.response_metadata = self._query_client.response_metadata
984
1051
  return answer
985
1052
 
986
- def search_table(self, table_id: str, body: Mapping[str, Any]) -> dict[str, Any]:
987
- """One search through Cloud's search route, the one the dataset page and MCP use."""
988
-
989
- answer = self._query_client.call(
990
- "POST",
991
- CLOUD_PUBLIC_TABLE_SEARCH_PATH.format(table_id=table_id),
992
- act="search a public table",
993
- body=body,
994
- absent="no public table has that id",
995
- maximum=MAX_PUBLIC_QUERY_RESPONSE_BYTES,
996
- table_values=True,
997
- max_members=MAX_PUBLIC_QUERY_RESPONSE_MEMBERS,
998
- )
999
- self.response_metadata = self._query_client.response_metadata
1000
- return answer
1001
-
1002
1053
  def download_url(self, table_id: str) -> dict[str, Any]:
1003
1054
  """Read download instructions; keep download_not_enabled distinct from missing table.
1004
1055
 
@@ -1064,6 +1115,13 @@ def _auth_query_client(client: PublicQueryClient | None = None) -> PublicQueryCl
1064
1115
  return PublicQueryClient(credentials)
1065
1116
 
1066
1117
 
1118
+ def table_query_client(body: Mapping[str, Any]) -> PublicQueryClient | AgentSearchClient:
1119
+ search = body.get("search")
1120
+ if isinstance(search, Mapping) and search.get("engine") == "resident":
1121
+ return AgentSearchClient(resolve_public_origin())
1122
+ return _auth_query_client()
1123
+
1124
+
1067
1125
  def _read_query_body(args: argparse.Namespace) -> dict[str, Any]:
1068
1126
  raw = getattr(args, "body", None)
1069
1127
  path = getattr(args, "body_file", None)
@@ -1096,7 +1154,11 @@ def _read_query_body(args: argparse.Namespace) -> dict[str, Any]:
1096
1154
  def _query(args: argparse.Namespace, client: Any = None) -> dict[str, Any]:
1097
1155
  table_id = _require_table_id(getattr(args, "target", None))
1098
1156
  body = _read_query_body(args)
1099
- selected = _auth_query_client(client if isinstance(client, PublicQueryClient) else None)
1157
+ selected = (
1158
+ client
1159
+ if isinstance(client, PublicQueryClient | AgentSearchClient)
1160
+ else table_query_client(body)
1161
+ )
1100
1162
  answer = selected.query_table(table_id, body)
1101
1163
  metadata = getattr(selected, "response_metadata", {})
1102
1164
  if "timings" in metadata:
@@ -1112,6 +1174,21 @@ def _query(args: argparse.Namespace, client: Any = None) -> dict[str, Any]:
1112
1174
  }
1113
1175
 
1114
1176
 
1177
+ def _api_guide(args: argparse.Namespace, client: Any = None) -> dict[str, Any]:
1178
+ table_id = _require_table_id(getattr(args, "target", None))
1179
+ selected = client or AgentSearchClient(resolve_public_origin())
1180
+ answer = selected.call_tool("get_access_instructions", table_id, {})
1181
+ guide = answer.get("integration")
1182
+ if not isinstance(guide, dict):
1183
+ raise ThinLaneError("THIN_RESPONSE_INVALID", "Cloud returned no table integration guide")
1184
+ return {
1185
+ "schema_version": f"{THIN_SCHEMA_PREFIX}-v4-public-api-guide.v1",
1186
+ "status": "public_api_guide_shown",
1187
+ "integration": guide,
1188
+ **({"note": answer["note"]} if answer.get("note") else {}),
1189
+ }
1190
+
1191
+
1115
1192
  def _download_url(args: argparse.Namespace, client: Any = None) -> dict[str, Any]:
1116
1193
  table_id = _require_table_id(getattr(args, "target", None))
1117
1194
  selected = _auth_query_client(client if isinstance(client, PublicQueryClient) else None)
@@ -1145,6 +1222,7 @@ _HANDLERS = {
1145
1222
  "fetch": _fetch,
1146
1223
  "query": _query,
1147
1224
  "download-url": _download_url,
1225
+ "api-guide": _api_guide,
1148
1226
  "pull": _pull,
1149
1227
  }
1150
1228
 
@@ -1196,6 +1274,7 @@ def public(
1196
1274
  "lookup",
1197
1275
  "query",
1198
1276
  "download-url",
1277
+ "api-guide",
1199
1278
  "pull",
1200
1279
  }
1201
1280
  and not args.target
@@ -1209,6 +1288,7 @@ def public(
1209
1288
  "lookup": "a query string",
1210
1289
  "query": "a table UUID",
1211
1290
  "download-url": "a table UUID",
1291
+ "api-guide": "a table UUID",
1212
1292
  "pull": "a dataset slug",
1213
1293
  }[action]
1214
1294
  raise ThinLaneError("THIN_REQUEST_INVALID", f"public {action} needs {needed}")
@@ -1228,7 +1308,7 @@ def public(
1228
1308
  "THIN_REQUEST_INVALID",
1229
1309
  f"{', '.join(stray)} apply to public pull, not public {action}",
1230
1310
  )
1231
- if action in {"query", "download-url"}:
1311
+ if action in {"query", "download-url", "api-guide"}:
1232
1312
  return _HANDLERS[action](args, client)
1233
1313
  selected = _client(args, client=client)
1234
1314
  return _HANDLERS[action](args, selected)
@@ -1238,7 +1318,6 @@ __all__ = [
1238
1318
  "ACTIONS",
1239
1319
  "CLOUD_PUBLIC_TABLE_DOWNLOAD_URL_PATH",
1240
1320
  "CLOUD_PUBLIC_TABLE_QUERY_PATH",
1241
- "CLOUD_PUBLIC_TABLE_SEARCH_PATH",
1242
1321
  "DATASETS_PATH",
1243
1322
  "DATASET_MARKDOWN_PATH",
1244
1323
  "DATASET_PATH",
@@ -1259,6 +1338,7 @@ __all__ = [
1259
1338
  "TABLES_SCHEMA",
1260
1339
  "TABLE_PREVIEW_PATH",
1261
1340
  "TABLE_SCHEMA_PATH",
1341
+ "AgentSearchClient",
1262
1342
  "PublicCatalogClient",
1263
1343
  "PublicQueryClient",
1264
1344
  "declare_arguments",
@@ -194,6 +194,11 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
194
194
  action="store_true",
195
195
  help="answer as the search box does while someone types: no planner",
196
196
  )
197
+ sub.add_argument(
198
+ "--mode",
199
+ choices=("auto", "meaning", "image", "emoji"),
200
+ help="first page retrieval mode; meaning uses the semantic index",
201
+ )
197
202
  sub.add_argument("--cursor", help="next_cursor from the previous page")
198
203
  sub.add_argument("--page-size", dest="page_size", type=int, default=20)
199
204
  sub.add_argument("--count", action="store_true", help="also count matching rows")
@@ -780,9 +785,9 @@ def _bind_public(
780
785
 
781
786
 
782
787
  def _cloud_query(table_id: str, body: dict[str, Any], query_client: Any) -> tuple[dict, dict]:
783
- from mostlyright.data_harness.thin.v4_public import _auth_query_client
788
+ from mostlyright.data_harness.thin.v4_public import table_query_client
784
789
 
785
- selected = query_client or _auth_query_client()
790
+ selected = query_client or table_query_client(body)
786
791
  answer = selected.query_table(table_id, body)
787
792
  return answer, dict(getattr(selected, "response_metadata", {}) or {})
788
793
 
@@ -1110,6 +1115,8 @@ def _search_query(args: argparse.Namespace, query_client: Any) -> dict[str, Any]
1110
1115
  "settled": not args.unsettled,
1111
1116
  "page_size": page_size,
1112
1117
  }
1118
+ if args.mode is not None:
1119
+ body["mode"] = args.mode
1113
1120
  if plan is not None:
1114
1121
  body["plan"] = plan
1115
1122
  if args.cursor is not None:
@@ -1133,9 +1140,9 @@ def _search_query(args: argparse.Namespace, query_client: Any) -> dict[str, Any]
1133
1140
  if group is not None:
1134
1141
  body["group"] = group
1135
1142
 
1136
- from mostlyright.data_harness.thin.v4_public import _auth_query_client
1143
+ from mostlyright.data_harness.thin.v4_public import AgentSearchClient, resolve_public_origin
1137
1144
 
1138
- selected = query_client or _auth_query_client()
1145
+ selected = query_client or AgentSearchClient(resolve_public_origin())
1139
1146
  try:
1140
1147
  answer = selected.search_table(public_table_id, body)
1141
1148
  except ThinLaneError as refusal:
@@ -215,8 +215,8 @@ CLASSIFICATION: dict[str, Lane] = {
215
215
  HOSTED,
216
216
  "it prepares and tests versioned search through the server; index work runs in the hosted "
217
217
  "engine, while draft configuration and activation remain server-authorized. "
218
- "`search query` runs one search on a public table through Cloud's search route, the "
219
- "one the dataset page and MCP `search_table` use",
218
+ "`search query` runs one search on a public table through MCP, using the "
219
+ "`search_table` tool shared with dataset chat",
220
220
  ),
221
221
  "query": Lane(
222
222
  HOSTED,
@@ -498,6 +498,7 @@ STATUS_HEADLINES: dict[str, str] = {
498
498
  "support_budget_exhausted": "The support agent ran out of budget; this is as far as it got.",
499
499
  "support_pending": "The support agent has the question.",
500
500
  "support_running": "The support agent is still working on that question.",
501
+ "public_api_guide_shown": "Connect your application to this table.",
501
502
  "public_table_queried": "Here are the query results.",
502
503
  "public_download_url_shown": "Here are the download instructions for that table.",
503
504
  "table_verified": "The table matches the manifest that names it.",