stata-code 0.8.0__tar.gz → 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stata_code-0.8.0 → stata_code-0.9.0}/CHANGELOG.md +80 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/PKG-INFO +64 -9
- {stata_code-0.8.0 → stata_code-0.9.0}/README.md +63 -8
- {stata_code-0.8.0 → stata_code-0.9.0}/SCHEMA.md +101 -20
- stata_code-0.9.0/docs/competitive-landscape.md +163 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/docs/industry-leader-roadmap.md +15 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/pyproject.toml +1 -1
- {stata_code-0.8.0 → stata_code-0.9.0}/schema/run_result.schema.json +284 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/__init__.py +41 -2
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/cli.py +12 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/__init__.py +40 -1
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/_pool.py +22 -19
- stata_code-0.9.0/stata_code/core/errors.py +802 -0
- stata_code-0.9.0/stata_code/core/estimation.py +377 -0
- stata_code-0.9.0/stata_code/core/handoff.py +96 -0
- stata_code-0.9.0/stata_code/core/provenance.py +250 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/runner.py +46 -51
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/schema.py +96 -14
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/doctor.py +170 -13
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/mcp/server.py +1 -1
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_doctor.py +99 -4
- stata_code-0.9.0/tests/test_errors.py +462 -0
- stata_code-0.9.0/tests/test_estimation.py +273 -0
- stata_code-0.9.0/tests/test_handoff.py +85 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_pool.py +22 -1
- stata_code-0.9.0/tests/test_provenance.py +193 -0
- stata_code-0.9.0/tests/test_real_stata.py +221 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_runner.py +16 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_schema.py +39 -2
- stata_code-0.8.0/stata_code/core/errors.py +0 -456
- stata_code-0.8.0/tests/test_errors.py +0 -231
- {stata_code-0.8.0 → stata_code-0.9.0}/.gitignore +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/LICENSE +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/LICENSE-POLICY.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/PUBLISHING.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/docs/design/hard_timeout.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/01-basic-regression.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/02-did-card-krueger.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/03-graphs.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/04-multi-session.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/05-large-matrix.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/06-cross-stack-parity-audit.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/07-data-mcp-handoff.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/examples/README.md +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/scripts/build_skill_zip.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/scripts/check_github_actions.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/scripts/check_versions.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/scripts/export_schema.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/__main__.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/_refs.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/_runtime.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/log_artifacts.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/notebook.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/core/run_index.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/kernel/__init__.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/kernel/__main__.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/kernel/assets/logo-32x32.png +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/kernel/assets/logo-64x64.png +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/kernel/assets/logo-svg.svg +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/kernel/kernel.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/mcp/__init__.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/stata_code/mcp/__main__.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/__init__.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/conftest.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/fixtures/.gitkeep +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_cancel.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_github_actions.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_kernel.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_log_artifacts.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_mcp.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_mcp_stdio.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_method_prompts.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_new_tools.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_notebook.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_notebook_phase2.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_public_api.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_release_versions.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_run_index.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_runtime_discovery.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_schema_artifact.py +0 -0
- {stata_code-0.8.0 → stata_code-0.9.0}/tests/test_skill_package.py +0 -0
|
@@ -4,6 +4,86 @@ All notable changes to `stata-code` are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); the project adheres
|
|
5
5
|
to semver-major.minor for the result schema (see `SCHEMA.md` §6).
|
|
6
6
|
|
|
7
|
+
## 0.9.0 — 2026-06-23
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Error-taxonomy correctness.** Audited the `_rc` → `ErrorKind` table against
|
|
12
|
+
StataCorp's `[P] error` manual (Stata 19) and corrected several
|
|
13
|
+
misclassifications: `not_sorted` is now `r(5)` (was the unrelated `r(119)`
|
|
14
|
+
"statement out of context" / `r(459)` "data is not…"); numlist errors
|
|
15
|
+
`r(122)`/`r(123)` are now `syntax` (were `invalid_name`); `r(322)` and
|
|
16
|
+
`r(1400)` map to `estimation_failure` (was `file_not_found` /
|
|
17
|
+
`estimation_sample_empty`); `r(480)` maps to `infeasible` (was
|
|
18
|
+
`out_of_memory`); local I/O `r(691)`–`r(693)` map to `file_io` (were
|
|
19
|
+
`network`). Misleading mappings for `r(9)`/`r(604)`/`r(615)`/`r(616)` were
|
|
20
|
+
removed (they fall through to `unknown` rather than assert a wrong kind).
|
|
21
|
+
- **Command "did you mean?" now fires.** The `command_not_found` (rc 199) name
|
|
22
|
+
extractor expected `"<X> unrecognized command"`, but Stata's actual message is
|
|
23
|
+
`"command <X> is unrecognized"` — so the fuzzy suggestion never matched in
|
|
24
|
+
practice (synthetic unit tests passed the name in directly and hid it). Fixed
|
|
25
|
+
the regex and added a real-Stata integration test so a typo like `regresss`
|
|
26
|
+
now surfaces "Did you mean `regress`?".
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **Typed estimation contract.** `RunResult.results.estimation` now exposes a
|
|
31
|
+
frontend-neutral coefficient table derived from verified `r(table)` when
|
|
32
|
+
possible, or from inline `e(b)` / `e(V)` as a clearly marked fallback. New
|
|
33
|
+
public helpers `build_estimation_result()` and
|
|
34
|
+
`build_estimation_from_returns()` keep the contract unit-testable without
|
|
35
|
+
Stata. The contract also carries a coarse `command_family`
|
|
36
|
+
(ols/iv/gmm/panel/count/did/…) and command-aware `diagnostics` — identification
|
|
37
|
+
and specification tests surfaced from `e()` for the commands economists must
|
|
38
|
+
report (`ivreg2`/`ivreghdfe` weak-ID F and Hansen J, `xtabond2` AR(2)/Hansen,
|
|
39
|
+
`reghdfe` within-R²/absorbed FE, `xtreg` rho). Only scalars actually present in
|
|
40
|
+
`e()` are surfaced — never fabricated.
|
|
41
|
+
- **Machine-readable recovery contract.** `error.recovery` now classifies each
|
|
42
|
+
`ErrorKind` by failure domain and tells agents whether an unchanged retry,
|
|
43
|
+
code edit, or user/out-of-band action is likely needed. Synthetic timeout,
|
|
44
|
+
cancellation, and adapter-crash errors carry the same recovery metadata as
|
|
45
|
+
ordinary Stata errors.
|
|
46
|
+
- **Reproducibility provenance helpers.** New `Provenance`,
|
|
47
|
+
`build_provenance()`, and `build_reproducible_do()` helpers turn a completed
|
|
48
|
+
`RunResult` plus original code into a runtime provenance envelope and a
|
|
49
|
+
re-runnable `.do` script preamble with Stata `version`, `set more off`, and an
|
|
50
|
+
optional `set seed`. Provenance now also records **per-package dependencies**
|
|
51
|
+
parsed from the script (`extract_package_installs()` →
|
|
52
|
+
`Provenance.packages`: `ssc`/`net install` name, source, and `from()` URL),
|
|
53
|
+
and `build_submission_package()` assembles a self-contained
|
|
54
|
+
replication/journal-submission bundle (`analysis.do` + `PROVENANCE.json` +
|
|
55
|
+
a `README.md` manifest listing runtime, seed, and required community packages).
|
|
56
|
+
- **Data-MCP handoff verifier.** New `verify_dataset()` and `DatasetCheck`
|
|
57
|
+
helpers validate imported datasets against provider metadata such as expected
|
|
58
|
+
row count, variable count, observation bounds, and required variables.
|
|
59
|
+
- **`error.rc_label` is now populated for real Stata errors.** New
|
|
60
|
+
`RC_LABEL` table and `label_for_rc()` (public API) supply Stata's canonical
|
|
61
|
+
short message (e.g. `r(111)` → "variable not found") so agents have a stable,
|
|
62
|
+
transcript-independent descriptor to branch and group on. Unverified codes
|
|
63
|
+
yield an empty label rather than a guess.
|
|
64
|
+
- **More return codes classified** (shrinking `unknown`): real network codes
|
|
65
|
+
`r(2)`/`r(631)`/`r(672)`/`r(677)` → `network`; `r(688)` → `file_corrupt`;
|
|
66
|
+
`r(907)` → `stata_limit`; `r(950)` → `out_of_memory`; numlist `r(124)`–`r(127)`
|
|
67
|
+
→ `syntax`.
|
|
68
|
+
- **Remediation suggestions for more error kinds.** `suggestions_for()` now
|
|
69
|
+
emits actionable hints for `network`, `infeasible`, `type_mismatch`,
|
|
70
|
+
`file_io`, `file_corrupt`, `permission`, `estimation_failure`, and
|
|
71
|
+
`matrix_missing`, so nearly every common failure ships a recovery hint.
|
|
72
|
+
|
|
73
|
+
## 0.8.1 — 2026-06-20
|
|
74
|
+
|
|
75
|
+
### Changed
|
|
76
|
+
|
|
77
|
+
- **README & metadata refresh.** Documented the VS Code extension's
|
|
78
|
+
seven-view sidebar (added the **Data** variables browser and the
|
|
79
|
+
**Outputs** table/export-artifact panel), corrected the error taxonomy
|
|
80
|
+
count to 31 kinds, and sharpened the Claude Code plugin / VS Code
|
|
81
|
+
Marketplace descriptions to lead with the empirical-economics workflow
|
|
82
|
+
(DiD/IV/RDD, publication tables, StatsPAI cross-validation).
|
|
83
|
+
- **Partner module.** Added a Stanford REAP × CoPaper.AI partner block
|
|
84
|
+
(logos, QR, links) to both the English and Chinese README, with the logo
|
|
85
|
+
assets bundled under `branding/partners/`.
|
|
86
|
+
|
|
7
87
|
## 0.8.0 — 2026-06-20
|
|
8
88
|
|
|
9
89
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stata-code
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Agent-native Stata bridge — one core, multiple frontends (MCP, Jupyter, VSCode)
|
|
5
5
|
Project-URL: Homepage, https://github.com/brycewang-stanford/stata-code
|
|
6
6
|
Project-URL: Repository, https://github.com/brycewang-stanford/stata-code
|
|
@@ -59,6 +59,24 @@ Description-Content-Type: text/markdown
|
|
|
59
59
|
[](https://github.com/brycewang-stanford/stata-code/releases)
|
|
60
60
|
[](https://github.com/brycewang-stanford/stata-code)
|
|
61
61
|
|
|
62
|
+
<div align="center">
|
|
63
|
+
|
|
64
|
+
<table>
|
|
65
|
+
<tr>
|
|
66
|
+
<td align="center">
|
|
67
|
+
<a href="https://copaper.ai"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-logo.png" alt="CoPaper.AI" width="200" /></a>
|
|
68
|
+
</td>
|
|
69
|
+
<td width="48"></td>
|
|
70
|
+
<td align="center">
|
|
71
|
+
<a href="https://sccei.fsi.stanford.edu/reap"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/stanford-reap-logo.png" alt="Stanford REAP — Center on China's Economy & Institutions" width="280" /></a>
|
|
72
|
+
</td>
|
|
73
|
+
</tr>
|
|
74
|
+
</table>
|
|
75
|
+
|
|
76
|
+
<sub><strong>Stanford REAP × CoPaper.AI</strong> · an academic–industrial AI toolkit for empirical research</sub>
|
|
77
|
+
|
|
78
|
+
</div>
|
|
79
|
+
|
|
62
80
|
<p align="center">
|
|
63
81
|
<img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/github-instructions.png" alt="stata-code: agent-native Stata bridge — one Python core, multiple frontends (Jupyter kernel, MCP server, VS Code extension)" width="720" />
|
|
64
82
|
</p>
|
|
@@ -166,12 +184,14 @@ Verify the local setup with the read-only doctor:
|
|
|
166
184
|
stata-code doctor
|
|
167
185
|
stata-code doctor --json # machine-readable output
|
|
168
186
|
stata-code doctor --no-stata-probe # skip live Stata initialization
|
|
187
|
+
stata-code doctor --workspace /path/to/project --no-user-config-scan
|
|
169
188
|
```
|
|
170
189
|
|
|
171
190
|
The doctor reports the package/Python version, MCP and Jupyter extras, `pystata`
|
|
172
|
-
discovery, console scripts on `PATH`,
|
|
173
|
-
|
|
174
|
-
VS Code
|
|
191
|
+
discovery, console scripts on `PATH`, common project/user MCP client config
|
|
192
|
+
files, client/VS Code configuration hints, and a best-effort Stata
|
|
193
|
+
version/edition probe. It never edits shell, Stata, Claude, Cursor, or VS Code
|
|
194
|
+
config.
|
|
175
195
|
|
|
176
196
|
---
|
|
177
197
|
|
|
@@ -385,7 +405,7 @@ Then open Jupyter Notebook / JupyterLab (or a `.ipynb` in VS Code), pick **Stata
|
|
|
385
405
|
|
|
386
406
|
### As a VS Code Extension
|
|
387
407
|
|
|
388
|
-
The companion extension is on the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode). It spawns `stata-code-mcp` as a child process and adds syntax highlighting, an Outline view for `**#` sections and `program define` blocks, code-lens "Run cell" and "Run section" actions on `.do` files, a sidebar (sessions / last result / run history / logs / graphs)
|
|
408
|
+
The companion extension is on the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode). It spawns `stata-code-mcp` as a child process and adds syntax highlighting, an Outline view for `**#` sections and `program define` blocks, code-lens "Run cell" and "Run section" actions on `.do` files, a **seven-view sidebar** (sessions / last result / **data variables** / run history / logs / graphs / **outputs**) — including an agent-native equivalent of Stata's **Variables window** and an **Outputs** panel that surfaces the `esttab` tables and `export` files each run writes to disk — status-bar indicators, completions, help lookup, conservative variable rename, and inline diagnostics from the v1.0 typed errors.
|
|
389
409
|
|
|
390
410
|
```bash
|
|
391
411
|
# from the VS Code CLI
|
|
@@ -400,7 +420,9 @@ If the extension or an MCP client cannot find the server, run
|
|
|
400
420
|
`stata-code doctor --no-stata-probe` in the same Python environment. It reports
|
|
401
421
|
whether `stata-code-mcp` is on `PATH` and suggests absolute-path or
|
|
402
422
|
`python -m stata_code.mcp` fallbacks for GUI clients whose `PATH` differs from
|
|
403
|
-
your shell.
|
|
423
|
+
your shell. It also reads common MCP config files in the current workspace and
|
|
424
|
+
user config directories so you can see whether a client is already wired to
|
|
425
|
+
`stata-code`.
|
|
404
426
|
|
|
405
427
|
#### Cell and section conventions
|
|
406
428
|
|
|
@@ -481,7 +503,7 @@ stata_code/
|
|
|
481
503
|
| Jupyter kernel | ✓ | — | — | ✓ |
|
|
482
504
|
| Unified result schema | ✓ ([SCHEMA.md](SCHEMA.md)) | per-tool | per-tool | per-tool |
|
|
483
505
|
| Token-economy defaults | ✓ (log refs, graph refs) | — | — | — |
|
|
484
|
-
| Typed errors + suggestions | ✓ (
|
|
506
|
+
| Typed errors + suggestions | ✓ (31 kinds) | — | — | — |
|
|
485
507
|
| Multi-session | ✓ (Stata frames) | partial | — | — |
|
|
486
508
|
| Mature ecosystem | early | ✓ (statamcp.com, cookbook) | ✓ (11k installs) | ✓ |
|
|
487
509
|
|
|
@@ -500,7 +522,7 @@ stata_code/
|
|
|
500
522
|
- Graph capture: `png` / `svg` / `pdf` with ref store and source-command attribution
|
|
501
523
|
- Log truncation with ref store
|
|
502
524
|
- Warning extraction: 5 categories + generic notes
|
|
503
|
-
-
|
|
525
|
+
- 31-kind error taxonomy with canonical suggestions
|
|
504
526
|
- MCP server: 18 tools, including notebook navigation / search / atomic edits, the run-bundle index (`list_runs`), log grep (`search_log`), dataset inspection (`inspect_data`), and package installation (`install_package`)
|
|
505
527
|
- Jupyter kernel: rewired to the v1.0 pipeline, kernel logos bundled
|
|
506
528
|
- Matrix size cap + `get_matrix(ref)` for large matrices (>10k cells)
|
|
@@ -514,7 +536,7 @@ stata_code/
|
|
|
514
536
|
IV/weak-IV, RDD, table export, data-MCP handoff, and cross-stack parity
|
|
515
537
|
audits
|
|
516
538
|
- JSON Schema artifact auto-generated from `schema.py`: [`schema/run_result.schema.json`](schema/run_result.schema.json)
|
|
517
|
-
- VS Code extension published to the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode): syntax highlighting, section outline/navigation, code-lens cell and section runners, sidebar (sessions / last result / run history / logs / graphs), status bar, completions, conservative variable rename, diagnostics, MCP child-process spawn
|
|
539
|
+
- VS Code extension published to the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode): syntax highlighting, section outline/navigation, code-lens cell and section runners, seven-view sidebar (sessions / last result / data variables / run history / logs / graphs / outputs), status bar, completions, conservative variable rename, diagnostics, MCP child-process spawn
|
|
518
540
|
- Clean-room license policy ([LICENSE-POLICY.md](LICENSE-POLICY.md))
|
|
519
541
|
|
|
520
542
|
### Next Up
|
|
@@ -560,3 +582,36 @@ Stata is a registered trademark of StataCorp LLC. This project is independent an
|
|
|
560
582
|
## Acknowledgements
|
|
561
583
|
|
|
562
584
|
The Stata tooling landscape that this project builds on and learns from is surveyed in [References-tools.md](References-tools.md). All listed projects retain their own licenses and authorship; please consult each repository before reuse.
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
<div align="center">
|
|
589
|
+
|
|
590
|
+
<table>
|
|
591
|
+
<tr>
|
|
592
|
+
<td align="center">
|
|
593
|
+
<a href="https://copaper.ai"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-logo.png" alt="CoPaper.AI" width="200" /></a>
|
|
594
|
+
</td>
|
|
595
|
+
<td width="40"></td>
|
|
596
|
+
<td align="center">
|
|
597
|
+
<a href="https://sccei.fsi.stanford.edu/reap"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/stanford-reap-logo.png" alt="Stanford REAP" width="280" /></a>
|
|
598
|
+
</td>
|
|
599
|
+
</tr>
|
|
600
|
+
</table>
|
|
601
|
+
|
|
602
|
+
<table>
|
|
603
|
+
<tr>
|
|
604
|
+
<td align="center">
|
|
605
|
+
<a href="https://copaper.ai"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-qrcode.png" alt="Visit copaper.ai" width="160" /></a><br/>
|
|
606
|
+
<strong>Visit <a href="https://copaper.ai">copaper.ai</a></strong>
|
|
607
|
+
</td>
|
|
608
|
+
<td align="center">
|
|
609
|
+
<img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-wechat.jpg" alt="CoPaper.AI WeChat" width="160" /><br/>
|
|
610
|
+
<strong>WeChat: CoPaper.AI</strong>
|
|
611
|
+
</td>
|
|
612
|
+
</tr>
|
|
613
|
+
</table>
|
|
614
|
+
|
|
615
|
+
<sub>Maintained by <a href="https://copaper.ai"><strong>CoPaper.AI</strong></a>, incubated at <a href="https://sccei.fsi.stanford.edu/reap"><strong>Stanford REAP / SCCEI</strong></a> · AI Assistant for Empirical Research</sub>
|
|
616
|
+
|
|
617
|
+
</div>
|
|
@@ -20,6 +20,24 @@
|
|
|
20
20
|
[](https://github.com/brycewang-stanford/stata-code/releases)
|
|
21
21
|
[](https://github.com/brycewang-stanford/stata-code)
|
|
22
22
|
|
|
23
|
+
<div align="center">
|
|
24
|
+
|
|
25
|
+
<table>
|
|
26
|
+
<tr>
|
|
27
|
+
<td align="center">
|
|
28
|
+
<a href="https://copaper.ai"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-logo.png" alt="CoPaper.AI" width="200" /></a>
|
|
29
|
+
</td>
|
|
30
|
+
<td width="48"></td>
|
|
31
|
+
<td align="center">
|
|
32
|
+
<a href="https://sccei.fsi.stanford.edu/reap"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/stanford-reap-logo.png" alt="Stanford REAP — Center on China's Economy & Institutions" width="280" /></a>
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
</table>
|
|
36
|
+
|
|
37
|
+
<sub><strong>Stanford REAP × CoPaper.AI</strong> · an academic–industrial AI toolkit for empirical research</sub>
|
|
38
|
+
|
|
39
|
+
</div>
|
|
40
|
+
|
|
23
41
|
<p align="center">
|
|
24
42
|
<img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/github-instructions.png" alt="stata-code: agent-native Stata bridge — one Python core, multiple frontends (Jupyter kernel, MCP server, VS Code extension)" width="720" />
|
|
25
43
|
</p>
|
|
@@ -127,12 +145,14 @@ Verify the local setup with the read-only doctor:
|
|
|
127
145
|
stata-code doctor
|
|
128
146
|
stata-code doctor --json # machine-readable output
|
|
129
147
|
stata-code doctor --no-stata-probe # skip live Stata initialization
|
|
148
|
+
stata-code doctor --workspace /path/to/project --no-user-config-scan
|
|
130
149
|
```
|
|
131
150
|
|
|
132
151
|
The doctor reports the package/Python version, MCP and Jupyter extras, `pystata`
|
|
133
|
-
discovery, console scripts on `PATH`,
|
|
134
|
-
|
|
135
|
-
VS Code
|
|
152
|
+
discovery, console scripts on `PATH`, common project/user MCP client config
|
|
153
|
+
files, client/VS Code configuration hints, and a best-effort Stata
|
|
154
|
+
version/edition probe. It never edits shell, Stata, Claude, Cursor, or VS Code
|
|
155
|
+
config.
|
|
136
156
|
|
|
137
157
|
---
|
|
138
158
|
|
|
@@ -346,7 +366,7 @@ Then open Jupyter Notebook / JupyterLab (or a `.ipynb` in VS Code), pick **Stata
|
|
|
346
366
|
|
|
347
367
|
### As a VS Code Extension
|
|
348
368
|
|
|
349
|
-
The companion extension is on the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode). It spawns `stata-code-mcp` as a child process and adds syntax highlighting, an Outline view for `**#` sections and `program define` blocks, code-lens "Run cell" and "Run section" actions on `.do` files, a sidebar (sessions / last result / run history / logs / graphs)
|
|
369
|
+
The companion extension is on the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode). It spawns `stata-code-mcp` as a child process and adds syntax highlighting, an Outline view for `**#` sections and `program define` blocks, code-lens "Run cell" and "Run section" actions on `.do` files, a **seven-view sidebar** (sessions / last result / **data variables** / run history / logs / graphs / **outputs**) — including an agent-native equivalent of Stata's **Variables window** and an **Outputs** panel that surfaces the `esttab` tables and `export` files each run writes to disk — status-bar indicators, completions, help lookup, conservative variable rename, and inline diagnostics from the v1.0 typed errors.
|
|
350
370
|
|
|
351
371
|
```bash
|
|
352
372
|
# from the VS Code CLI
|
|
@@ -361,7 +381,9 @@ If the extension or an MCP client cannot find the server, run
|
|
|
361
381
|
`stata-code doctor --no-stata-probe` in the same Python environment. It reports
|
|
362
382
|
whether `stata-code-mcp` is on `PATH` and suggests absolute-path or
|
|
363
383
|
`python -m stata_code.mcp` fallbacks for GUI clients whose `PATH` differs from
|
|
364
|
-
your shell.
|
|
384
|
+
your shell. It also reads common MCP config files in the current workspace and
|
|
385
|
+
user config directories so you can see whether a client is already wired to
|
|
386
|
+
`stata-code`.
|
|
365
387
|
|
|
366
388
|
#### Cell and section conventions
|
|
367
389
|
|
|
@@ -442,7 +464,7 @@ stata_code/
|
|
|
442
464
|
| Jupyter kernel | ✓ | — | — | ✓ |
|
|
443
465
|
| Unified result schema | ✓ ([SCHEMA.md](SCHEMA.md)) | per-tool | per-tool | per-tool |
|
|
444
466
|
| Token-economy defaults | ✓ (log refs, graph refs) | — | — | — |
|
|
445
|
-
| Typed errors + suggestions | ✓ (
|
|
467
|
+
| Typed errors + suggestions | ✓ (31 kinds) | — | — | — |
|
|
446
468
|
| Multi-session | ✓ (Stata frames) | partial | — | — |
|
|
447
469
|
| Mature ecosystem | early | ✓ (statamcp.com, cookbook) | ✓ (11k installs) | ✓ |
|
|
448
470
|
|
|
@@ -461,7 +483,7 @@ stata_code/
|
|
|
461
483
|
- Graph capture: `png` / `svg` / `pdf` with ref store and source-command attribution
|
|
462
484
|
- Log truncation with ref store
|
|
463
485
|
- Warning extraction: 5 categories + generic notes
|
|
464
|
-
-
|
|
486
|
+
- 31-kind error taxonomy with canonical suggestions
|
|
465
487
|
- MCP server: 18 tools, including notebook navigation / search / atomic edits, the run-bundle index (`list_runs`), log grep (`search_log`), dataset inspection (`inspect_data`), and package installation (`install_package`)
|
|
466
488
|
- Jupyter kernel: rewired to the v1.0 pipeline, kernel logos bundled
|
|
467
489
|
- Matrix size cap + `get_matrix(ref)` for large matrices (>10k cells)
|
|
@@ -475,7 +497,7 @@ stata_code/
|
|
|
475
497
|
IV/weak-IV, RDD, table export, data-MCP handoff, and cross-stack parity
|
|
476
498
|
audits
|
|
477
499
|
- JSON Schema artifact auto-generated from `schema.py`: [`schema/run_result.schema.json`](schema/run_result.schema.json)
|
|
478
|
-
- VS Code extension published to the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode): syntax highlighting, section outline/navigation, code-lens cell and section runners, sidebar (sessions / last result / run history / logs / graphs), status bar, completions, conservative variable rename, diagnostics, MCP child-process spawn
|
|
500
|
+
- VS Code extension published to the Marketplace as [`brycewang-stanford.stata-code-vscode`](https://marketplace.visualstudio.com/items?itemName=brycewang-stanford.stata-code-vscode): syntax highlighting, section outline/navigation, code-lens cell and section runners, seven-view sidebar (sessions / last result / data variables / run history / logs / graphs / outputs), status bar, completions, conservative variable rename, diagnostics, MCP child-process spawn
|
|
479
501
|
- Clean-room license policy ([LICENSE-POLICY.md](LICENSE-POLICY.md))
|
|
480
502
|
|
|
481
503
|
### Next Up
|
|
@@ -521,3 +543,36 @@ Stata is a registered trademark of StataCorp LLC. This project is independent an
|
|
|
521
543
|
## Acknowledgements
|
|
522
544
|
|
|
523
545
|
The Stata tooling landscape that this project builds on and learns from is surveyed in [References-tools.md](References-tools.md). All listed projects retain their own licenses and authorship; please consult each repository before reuse.
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
<div align="center">
|
|
550
|
+
|
|
551
|
+
<table>
|
|
552
|
+
<tr>
|
|
553
|
+
<td align="center">
|
|
554
|
+
<a href="https://copaper.ai"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-logo.png" alt="CoPaper.AI" width="200" /></a>
|
|
555
|
+
</td>
|
|
556
|
+
<td width="40"></td>
|
|
557
|
+
<td align="center">
|
|
558
|
+
<a href="https://sccei.fsi.stanford.edu/reap"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/stanford-reap-logo.png" alt="Stanford REAP" width="280" /></a>
|
|
559
|
+
</td>
|
|
560
|
+
</tr>
|
|
561
|
+
</table>
|
|
562
|
+
|
|
563
|
+
<table>
|
|
564
|
+
<tr>
|
|
565
|
+
<td align="center">
|
|
566
|
+
<a href="https://copaper.ai"><img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-qrcode.png" alt="Visit copaper.ai" width="160" /></a><br/>
|
|
567
|
+
<strong>Visit <a href="https://copaper.ai">copaper.ai</a></strong>
|
|
568
|
+
</td>
|
|
569
|
+
<td align="center">
|
|
570
|
+
<img src="https://raw.githubusercontent.com/brycewang-stanford/stata-code/main/branding/partners/copaper-wechat.jpg" alt="CoPaper.AI WeChat" width="160" /><br/>
|
|
571
|
+
<strong>WeChat: CoPaper.AI</strong>
|
|
572
|
+
</td>
|
|
573
|
+
</tr>
|
|
574
|
+
</table>
|
|
575
|
+
|
|
576
|
+
<sub>Maintained by <a href="https://copaper.ai"><strong>CoPaper.AI</strong></a>, incubated at <a href="https://sccei.fsi.stanford.edu/reap"><strong>Stanford REAP / SCCEI</strong></a> · AI Assistant for Empirical Research</sub>
|
|
577
|
+
|
|
578
|
+
</div>
|
|
@@ -77,7 +77,38 @@ Every successful or failed Stata execution returns one result object:
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"last_estimation_cmd": "regress"
|
|
80
|
+
"last_estimation_cmd": "regress",
|
|
81
|
+
"estimation": {
|
|
82
|
+
"command": "regress",
|
|
83
|
+
"depvar": "mpg",
|
|
84
|
+
"n_obs": 74,
|
|
85
|
+
"df_model": 1,
|
|
86
|
+
"df_resid": null,
|
|
87
|
+
"statistic_kind": "z",
|
|
88
|
+
"source": "e_b_v",
|
|
89
|
+
"ci_level": 95.0,
|
|
90
|
+
"coefficients": [
|
|
91
|
+
{
|
|
92
|
+
"term": "weight",
|
|
93
|
+
"b": -0.006,
|
|
94
|
+
"se": null,
|
|
95
|
+
"statistic": null,
|
|
96
|
+
"p_value": null,
|
|
97
|
+
"ci_low": null,
|
|
98
|
+
"ci_high": null
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"term": "_cons",
|
|
102
|
+
"b": 39.44,
|
|
103
|
+
"se": null,
|
|
104
|
+
"statistic": null,
|
|
105
|
+
"p_value": null,
|
|
106
|
+
"ci_low": null,
|
|
107
|
+
"ci_high": null
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"model_stats": {"N": 74, "df_m": 1, "r2": 0.219}
|
|
111
|
+
}
|
|
81
112
|
},
|
|
82
113
|
|
|
83
114
|
"dataset": {
|
|
@@ -140,7 +171,8 @@ A failed execution sets `ok: false`, `rc != 0`, and populates `error`:
|
|
|
140
171
|
|
|
141
172
|
"results": { "r": {"scalars": {}, "macros": {}, "matrices": {}},
|
|
142
173
|
"e": {"scalars": {}, "macros": {}, "matrices": {}},
|
|
143
|
-
"last_estimation_cmd": null
|
|
174
|
+
"last_estimation_cmd": null,
|
|
175
|
+
"estimation": null },
|
|
144
176
|
|
|
145
177
|
"dataset": { "frame": "default", "n_obs": 74, "n_vars": 12, "changed": false,
|
|
146
178
|
"filename": "auto.dta", "variables": null },
|
|
@@ -167,7 +199,13 @@ A failed execution sets `ok: false`, `rc != 0`, and populates `error`:
|
|
|
167
199
|
"suggestions": [
|
|
168
200
|
{"action": "Check the variable name. Did you mean `mpg`?",
|
|
169
201
|
"command": "describe"}
|
|
170
|
-
]
|
|
202
|
+
],
|
|
203
|
+
"recovery": {
|
|
204
|
+
"category": "user_code",
|
|
205
|
+
"retriable": false,
|
|
206
|
+
"needs_code_change": true,
|
|
207
|
+
"needs_user_input": false
|
|
208
|
+
}
|
|
171
209
|
},
|
|
172
210
|
|
|
173
211
|
"schema_version": "1.0",
|
|
@@ -315,6 +353,34 @@ Stata's `r()` and `e()` return dictionaries, structurally separated. Each follow
|
|
|
315
353
|
| Field | Type | Notes |
|
|
316
354
|
| --- | --- | --- |
|
|
317
355
|
| `last_estimation_cmd` | `string \| null` | Mirrors `e(cmd)` for callers who don't want to dig into `e.macros`. After multi-command code, this reflects the *last* command that wrote to `e()`. `null` if no estimation has been performed. |
|
|
356
|
+
| `estimation` | `EstimationResult \| null` | Typed coefficient table derived from `r(table)` or `e(b)` / `e(V)`. `null` when no inline `e(b)` is available. |
|
|
357
|
+
|
|
358
|
+
**`EstimationResult` shape:**
|
|
359
|
+
|
|
360
|
+
| Field | Type | Notes |
|
|
361
|
+
| --- | --- | --- |
|
|
362
|
+
| `command` | `string \| null` | Mirrors `e(cmd)` when available; falls back to `last_estimation_cmd`. |
|
|
363
|
+
| `depvar` | `string \| null` | Mirrors `e(depvar)`. |
|
|
364
|
+
| `n_obs` | `int \| null` | Integer form of `e(N)` when available. |
|
|
365
|
+
| `df_model` | `number \| null` | Mirrors `e(df_m)`. |
|
|
366
|
+
| `df_resid` | `number \| null` | Mirrors `e(df_r)`. |
|
|
367
|
+
| `statistic_kind` | `"t" \| "z"` | Which statistic fills each coefficient's `statistic` field. |
|
|
368
|
+
| `source` | `"r_table" \| "e_b_v"` | `r_table` means values were copied from Stata's displayed `r(table)` after verifying its columns and `b` row match `e(b)`; `e_b_v` means point estimates come from `e(b)` and inference, when present, is computed from `e(V)` with a normal approximation. |
|
|
369
|
+
| `ci_level` | `number` | Confidence level used for `ci_low` / `ci_high`; currently `95.0`. |
|
|
370
|
+
| `coefficients` | `array<Coefficient>` | One row per term in `e(b)`. |
|
|
371
|
+
| `model_stats` | `dict<str, number \| null>` | High-signal subset of `e()` scalars such as `N`, `df_m`, `df_r`, `r2`, `F`, `chi2`, `ll`, and `rmse`. Full scalars remain under `results.e.scalars`. |
|
|
372
|
+
|
|
373
|
+
**`Coefficient` shape:**
|
|
374
|
+
|
|
375
|
+
| Field | Type | Notes |
|
|
376
|
+
| --- | --- | --- |
|
|
377
|
+
| `term` | `string` | Term / coefficient column name. |
|
|
378
|
+
| `b` | `number \| null` | Point estimate. |
|
|
379
|
+
| `se` | `number \| null` | Standard error when available. |
|
|
380
|
+
| `statistic` | `number \| null` | `t` or `z`, per `EstimationResult.statistic_kind`. |
|
|
381
|
+
| `p_value` | `number \| null` | Two-sided p-value when available. |
|
|
382
|
+
| `ci_low` | `number \| null` | Lower confidence interval bound when available. |
|
|
383
|
+
| `ci_high` | `number \| null` | Upper confidence interval bound when available. |
|
|
318
384
|
|
|
319
385
|
**Empty is empty.** Sub-dicts are `{}` when Stata returned nothing — never absent, never `null`.
|
|
320
386
|
|
|
@@ -377,6 +443,7 @@ Populated iff `ok: false`. The schema's most important contribution to agent UX:
|
|
|
377
443
|
| `varname` | `string \| null` | For `varname_not_found` and related, the variable name at issue. |
|
|
378
444
|
| `name` | `string \| null` | For `name_conflict` and `invalid_name`, the conflicting/invalid name. |
|
|
379
445
|
| `suggestions` | `array<Suggestion>` | Producer-supplied remediation hints. Empty when none apply. See below. |
|
|
446
|
+
| `recovery` | `Recovery \| null` | Machine-readable recovery contract for agents. Present on current producers; old or third-party producers may omit it, so consumers should handle `null`. |
|
|
380
447
|
|
|
381
448
|
**`context` shape:**
|
|
382
449
|
|
|
@@ -399,36 +466,47 @@ Populated iff `ok: false`. The schema's most important contribution to agent UX:
|
|
|
399
466
|
|
|
400
467
|
Suggestions are best-effort; agents should treat them as hints, not directives. A suggestion is not consent to mutate source files or silently retry changed code; consumers should apply fixes automatically only in workflows where the user requested repair or approved iteration. The `kind` enum below documents what suggestions are typically populated.
|
|
401
468
|
|
|
469
|
+
**`Recovery` shape:**
|
|
470
|
+
|
|
471
|
+
| Field | Type | Notes |
|
|
472
|
+
| --- | --- | --- |
|
|
473
|
+
| `category` | `"user_code" \| "data" \| "model" \| "resource" \| "environment" \| "internal" \| "unknown"` | Broad failure domain for routing. |
|
|
474
|
+
| `retriable` | `bool` | Whether re-running the exact same code may succeed. True mainly for transient environment or producer-side failures. |
|
|
475
|
+
| `needs_code_change` | `bool` | Whether the submitted Stata code must change to succeed. |
|
|
476
|
+
| `needs_user_input` | `bool` | Whether resolution likely requires a human or out-of-band action such as permissions, license/edition limits, or re-acquiring a corrupt file. |
|
|
477
|
+
|
|
402
478
|
**`kind` enum (v1.0):**
|
|
403
479
|
|
|
480
|
+
rc(s) below cite StataCorp `[P] error` (Stata 19, 2025). The code is authoritative; this table is a readable mirror.
|
|
481
|
+
|
|
404
482
|
| `kind` | Typical rc(s) | Notes / suggestion seed |
|
|
405
483
|
| --- | --- | --- |
|
|
406
|
-
| `syntax` |
|
|
484
|
+
| `syntax` | 100, 101, 102, 103, 121–127, 130, 132, 197, 198 | Generic parser failure (incl. numlist errors 121–127). No automatic suggestion. |
|
|
407
485
|
| `command_not_found` | 199 | Often resolved by `ssc install` or `net install`; suggestions populated when Stata reports a likely package name. |
|
|
408
486
|
| `varname_not_found` | 111 | `varname` populated. Suggestions may include similar varnames from `dataset.variables`. |
|
|
409
|
-
| `invalid_name` |
|
|
410
|
-
| `type_mismatch` | 109, 408 | |
|
|
487
|
+
| `invalid_name` | (no dedicated rc) | Stata folds "invalid name" into r(198). `name` populated when constructed by a producer. |
|
|
488
|
+
| `type_mismatch` | 109, 408 | Suggestion: `destring`/`tostring`. |
|
|
411
489
|
| `name_conflict` | 110 | `name` populated. Suggestion typically: `replace`. |
|
|
412
|
-
| `not_sorted` |
|
|
490
|
+
| `not_sorted` | 5 | Suggestion: `sort <varlist>`. |
|
|
413
491
|
| `convergence` | 430 | |
|
|
414
|
-
| `infeasible` | 491 | Distinct from convergence: starting values not feasible. |
|
|
415
|
-
| `estimation_sample_empty` |
|
|
416
|
-
| `estimation_failure` | 1401, 1402 | |
|
|
492
|
+
| `infeasible` | 480, 491 | Distinct from convergence: starting values not feasible (e.g. `nl`, `ml`). |
|
|
493
|
+
| `estimation_sample_empty` | (no dedicated rc) | Empty estimation samples surface as r(2000); producer-set otherwise. |
|
|
494
|
+
| `estimation_failure` | 322, 1400, 1401, 1402 | Postestimation/prefix saw an unexpected result, or numerical overflow. |
|
|
417
495
|
| `no_estimation_results` | 301 | Common when calling `predict`/`margins` without prior estimation. |
|
|
418
496
|
| `no_observations` | 2000, 2001 | |
|
|
419
497
|
| `data_in_memory` | 4 | Suggestion: `clear`. |
|
|
420
498
|
| `matrix_singular` | 506, 508 | Matrix not positive definite / not invertible. |
|
|
421
|
-
| `matrix_conformability` | 503, 507 | Dimension mismatch. |
|
|
499
|
+
| `matrix_conformability` | 503, 507 | Dimension mismatch; 507 is a `matrix post` row/col name conflict kept in the matrix bucket. |
|
|
422
500
|
| `matrix_missing` | 504 | Matrix has missing values. |
|
|
423
|
-
| `file_not_found` |
|
|
501
|
+
| `file_not_found` | 601 | `path` populated. |
|
|
424
502
|
| `file_exists` | 602 | `path` populated. Suggestion: pass `replace` option. |
|
|
425
|
-
| `file_corrupt` |
|
|
426
|
-
| `file_io` | 603, 691
|
|
427
|
-
| `network` |
|
|
428
|
-
| `permission` | 608 | `path` populated.
|
|
429
|
-
| `encoding` |
|
|
430
|
-
| `stata_limit` | 901, 902, 903 | Edition /
|
|
431
|
-
| `out_of_memory` |
|
|
503
|
+
| `file_corrupt` | 610, 688 | `path` populated. "Not a Stata file" (610) or genuinely corrupt (688). |
|
|
504
|
+
| `file_io` | 603, 691, 692, 693 | `path` populated. Catch-all for open/read/write failures (691–693 are local filesystem I/O). |
|
|
505
|
+
| `network` | 2, 631, 672, 677 | Connection timed out / host not found / server refused / remote connection failed. |
|
|
506
|
+
| `permission` | 608 | `path` populated. File is read-only / not writable. |
|
|
507
|
+
| `encoding` | (no dedicated rc) | Unicode / encoding-conversion failures; producer-set. |
|
|
508
|
+
| `stata_limit` | 901, 902, 903, 907 | Edition / maxvar / width caps. Distinct from OS OOM. Suggestion: `set maxvar` or upgrade edition. |
|
|
509
|
+
| `out_of_memory` | 909, 950 | OS-level memory exhaustion. Suggestion: `compress`. |
|
|
432
510
|
| `interrupt` | 1 | User Break / Ctrl-C from a frontend. |
|
|
433
511
|
| `cancelled` | (synthetic `rc: -3`) | Cancellation was requested. Subprocess-backed producers may terminate an in-flight worker; the direct in-process runner only short-circuits before Stata receives code. |
|
|
434
512
|
| `timeout` | (synthetic `rc: -2`) | Adapter-imposed time limit exceeded. |
|
|
@@ -607,6 +685,8 @@ This section tracks how much of the schema is wired up in code. Not normative
|
|
|
607
685
|
emit a `matrix://<request_id>/<r|e>/<name>` ref instead, retrievable
|
|
608
686
|
via `get_matrix(ref)`.
|
|
609
687
|
- `results.last_estimation_cmd` (mirrors `e(cmd)`).
|
|
688
|
+
- `results.estimation` typed coefficient table, copied from verified
|
|
689
|
+
`r(table)` when possible and otherwise derived from inline `e(b)` / `e(V)`.
|
|
610
690
|
- `dataset` block — `n_obs`, `n_vars`, `frame`, `changed`, `filename`,
|
|
611
691
|
and `variables` (capped at 200 entries).
|
|
612
692
|
- `graphs[]` with `ref` + on-disk capture pipeline; format restricted to
|
|
@@ -617,7 +697,8 @@ This section tracks how much of the schema is wired up in code. Not normative
|
|
|
617
697
|
extracted from Stata's English error text by regex, structured
|
|
618
698
|
`context` (`{before, failing, after}`), `commands_executed` parsed
|
|
619
699
|
from pystata's multi-line transcript, `suggestions` generated by
|
|
620
|
-
`core.errors.suggestions_for
|
|
700
|
+
`core.errors.suggestions_for`, and `recovery` generated by
|
|
701
|
+
`core.errors.recovery_for`.
|
|
621
702
|
- `request_id` (uuid4 hex), `started_at` (ISO 8601 UTC ms),
|
|
622
703
|
`stata_elapsed_ms`, `capabilities`.
|
|
623
704
|
- Multi-session via Stata frames — `session_id="main"` ↔ `default`
|