pi-cursor-sdk 0.1.55 → 0.1.57

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 (88) hide show
  1. package/CHANGELOG.md +60 -2
  2. package/README.md +100 -28
  3. package/docs/cursor-live-smoke-checklist.md +7 -7
  4. package/docs/cursor-model-ux-spec.md +48 -41
  5. package/docs/cursor-native-tool-replay.md +4 -4
  6. package/docs/cursor-native-tool-visual-audit.md +1 -1
  7. package/docs/cursor-testing-lessons.md +20 -7
  8. package/docs/cursor-tool-surfaces.md +13 -2
  9. package/docs/platform-smoke-implementation.md +220 -0
  10. package/docs/platform-smoke.md +183 -247
  11. package/package.json +39 -7
  12. package/platform-smoke.config.mjs +5 -1
  13. package/scripts/cloud-runtime-smoke.d.mts +3 -0
  14. package/scripts/cloud-runtime-smoke.mjs +502 -0
  15. package/scripts/debug-provider-events.mjs +7 -2
  16. package/scripts/isolated-cursor-smoke.sh +4 -6
  17. package/scripts/lib/cursor-child-process.d.mts +1 -0
  18. package/scripts/lib/cursor-child-process.mjs +137 -7
  19. package/scripts/lib/local-resume-smoke-harness.mjs +543 -0
  20. package/scripts/local-resume-cleanup-smoke.mjs +108 -0
  21. package/scripts/local-resume-smoke.d.mts +1 -0
  22. package/scripts/local-resume-smoke.mjs +642 -0
  23. package/scripts/platform-smoke/artifact-anchored-extract.d.mts +10 -0
  24. package/scripts/platform-smoke/artifact-anchored-extract.mjs +111 -0
  25. package/scripts/platform-smoke/artifact-bundle-chunk.mjs +57 -0
  26. package/scripts/platform-smoke/artifact-bundle-contract.mjs +34 -0
  27. package/scripts/platform-smoke/artifact-fs-safety.mjs +311 -0
  28. package/scripts/platform-smoke/artifact-openat-extract.c +335 -0
  29. package/scripts/platform-smoke/artifact-secrets.mjs +155 -0
  30. package/scripts/platform-smoke/artifacts.mjs +293 -65
  31. package/scripts/platform-smoke/card-detect.mjs +16 -4
  32. package/scripts/platform-smoke/crabbox-runner.mjs +45 -3
  33. package/scripts/platform-smoke/doctor.mjs +20 -10
  34. package/scripts/platform-smoke/live-suite-runner.mjs +18 -57
  35. package/scripts/platform-smoke/local-resume-runner.mjs +252 -0
  36. package/scripts/platform-smoke/local-resume-suites.d.mts +15 -0
  37. package/scripts/platform-smoke/local-resume-suites.mjs +104 -0
  38. package/scripts/platform-smoke/scenarios.mjs +16 -2
  39. package/scripts/platform-smoke/target-runtime.mjs +206 -0
  40. package/scripts/platform-smoke/targets.mjs +33 -141
  41. package/scripts/platform-smoke/visual-evidence.mjs +6 -7
  42. package/scripts/platform-smoke/wrapped-line-match.mjs +9 -0
  43. package/scripts/platform-smoke.mjs +40 -27
  44. package/scripts/refresh-cursor-model-snapshots.mjs +18 -6
  45. package/scripts/steering-rpc-smoke.mjs +12 -2
  46. package/scripts/tmux-live-smoke.sh +3 -5
  47. package/shared/cursor-cloud-lifecycle-constants.d.mts +3 -0
  48. package/shared/cursor-cloud-lifecycle-constants.mjs +7 -0
  49. package/shared/cursor-sensitive-text.mjs +7 -1
  50. package/src/context.ts +5 -2
  51. package/src/cursor-agents-context-registration.ts +7 -0
  52. package/src/cursor-agents-context.ts +3 -1
  53. package/src/cursor-api-key.ts +15 -1
  54. package/src/cursor-bridge-contract.ts +3 -0
  55. package/src/cursor-cloud-lifecycle.ts +733 -0
  56. package/src/cursor-cloud-options.ts +206 -0
  57. package/src/cursor-cloud-reporting.ts +246 -0
  58. package/src/cursor-config.ts +659 -0
  59. package/src/cursor-display-only-trace.ts +14 -0
  60. package/src/cursor-display-text.ts +8 -2
  61. package/src/cursor-durable-fs.ts +49 -0
  62. package/src/cursor-fallback-models.generated.ts +2045 -485
  63. package/src/cursor-live-run-accounting.ts +7 -1
  64. package/src/cursor-live-run-coordinator.ts +1 -0
  65. package/src/cursor-pi-tool-bridge-run.ts +14 -4
  66. package/src/cursor-provider-errors.ts +31 -5
  67. package/src/cursor-provider-live-run-drain.ts +5 -0
  68. package/src/cursor-provider-run-finalizer.ts +37 -28
  69. package/src/cursor-provider-run-outcome.ts +7 -2
  70. package/src/cursor-provider-turn-finalize.ts +77 -7
  71. package/src/cursor-provider-turn-prepare.ts +228 -12
  72. package/src/cursor-provider-turn-runner.ts +42 -13
  73. package/src/cursor-provider-turn-send.ts +59 -16
  74. package/src/cursor-provider-turn-types.ts +44 -10
  75. package/src/cursor-runtime-state.ts +478 -0
  76. package/src/cursor-sdk-event-debug.ts +46 -6
  77. package/src/cursor-sdk-process-error-guard.ts +101 -30
  78. package/src/cursor-session-agent-cleanup.ts +328 -0
  79. package/src/cursor-session-agent-resume.ts +439 -0
  80. package/src/cursor-session-agent.ts +109 -13
  81. package/src/cursor-session-scope.ts +35 -2
  82. package/src/cursor-session-send-policy.ts +1 -1
  83. package/src/cursor-skill-tool.ts +30 -11
  84. package/src/cursor-state.ts +112 -69
  85. package/src/cursor-tool-manifest.ts +1 -1
  86. package/src/cursor-usage-accounting.ts +14 -4
  87. package/src/index.ts +11 -2
  88. package/src/model-discovery.ts +10 -56
@@ -0,0 +1,220 @@
1
+ # Platform Smoke Implementation Reference
2
+
3
+ Back to the canonical [Platform Smoke Gate runbook](./platform-smoke.md) for release commands, required targets and suites, artifacts, assertions, security, and the release bar.
4
+
5
+ This document records detailed detector, registry, command-rendering, implementation-history, replacement, and portability material. The phase plan is retained as implementation history, not as active release instructions.
6
+
7
+ ## Visual evidence detector
8
+
9
+ The detector operates on host-rendered terminal HTML and PNG evidence. It must not pass from prompt text alone.
10
+
11
+ Required behavior:
12
+
13
+ - render ANSI with xterm/Playwright and assert the terminal DOM/theme is present, styled, non-empty, and screenshotted;
14
+ - search the rendered xterm buffer for suite-owned evidence patterns that correspond to actual tool output/results, not instructions in the prompt;
15
+ - scroll to each evidence line and write `cards/<evidence-id>.png` screenshots plus `visual-evidence.json`;
16
+ - write `cards.json` for the legacy rendered-evidence inventory;
17
+ - fail when required visual evidence is missing;
18
+ - fail when a card/evidence item has the wrong success/error state;
19
+ - fail when footer/status is missing or unreadable.
20
+
21
+ Meaningful gap closed: earlier card assertions could pass when the prompt mentioned `pi__read` or a missing-file path even if the actual tool card/result never rendered. The gate now requires JSONL result evidence and per-evidence rendered screenshots for native read, native shell success/failure, native edit diffs, bridge read success/failure, and bridge shell success.
22
+
23
+ ## Registry visual classification
24
+
25
+ The implementation must classify every `CURSOR_TOOL_PRESENTATION_SPECS` entry from `src/cursor-tool-presentation-registry.ts` as required or excluded for the release visual gate. A validation check fails when a registry entry lacks classification.
26
+
27
+ Required deterministic cards:
28
+
29
+ - `read`
30
+ - `grep`
31
+ - `glob` / find
32
+ - `shell`
33
+ - `write`
34
+ - `edit`
35
+ - failed `read`
36
+
37
+ Excluded from release visual matrix with required rationale:
38
+
39
+ - `delete`: destructive and redundant with file mutation card coverage.
40
+ - `readLints`: dependent on target diagnostics state.
41
+ - `updateTodos`: model workflow dependent.
42
+ - `createPlan`: model workflow dependent.
43
+ - `task`: model/task orchestration dependent.
44
+ - `generateImage`: external image generation surface.
45
+ - `mcp`: separate MCP integration surface beyond built-in bridge smoke.
46
+ - `semSearch`: semantic index state dependent.
47
+ - `recordScreen`: desktop capture dependency outside terminal smoke.
48
+ - `webSearch`: network/search dependent.
49
+ - `webFetch`: network dependent.
50
+
51
+ Adding a registry entry requires adding it to the required or excluded list with rationale. `ls` is currently excluded from the required one-prompt matrix because composer-2-5 does not route the deterministic source-enumeration step through the native `ls` surface reliably; the suite instead gates that behavior through a successful native `find` result for `src/cursor-provider.ts`.
52
+
53
+ ## Platform command rendering
54
+
55
+ Scenario commands are not raw shell strings. The runner renders commands per target:
56
+
57
+ - `posix` for macOS and Ubuntu.
58
+ - `powershell` for Windows native.
59
+
60
+ Scenario shape:
61
+
62
+ ```js
63
+ {
64
+ id: "cursor-native-visual-matrix",
65
+ requires: ["cursor-auth", "pty", "packed-install"],
66
+ promptTemplate: "... <platform-command:shellSmoke> ...",
67
+ commands: {
68
+ shellSmoke: {
69
+ posix: "printf 'cursor visual smoke\\n'",
70
+ powershell: "Write-Output 'cursor visual smoke'",
71
+ },
72
+ },
73
+ assertions: ["final-marker", "required-cards", "jsonl-tools"],
74
+ }
75
+ ```
76
+
77
+ The renderer owns quoting, path normalization, environment assignment, and canonical gzip JSON/base64 artifact encoding.
78
+
79
+ ## Implementation phases
80
+
81
+ ### Phase 0: plan-only branch state
82
+
83
+ Create this plan on `feat/crabbox-platform-smoke`. Do not implement code in this phase.
84
+
85
+ ### Phase 1: dependency spike
86
+
87
+ Verify `node-pty` and ConPTY on every target before committing the dependency.
88
+
89
+ Exit criteria:
90
+
91
+ - node-pty self-test passes on macOS;
92
+ - node-pty self-test passes on Ubuntu local-container;
93
+ - node-pty self-test passes on Windows native Node 24.
94
+
95
+ ### Phase 2: config and doctor
96
+
97
+ Add config, CLI skeleton, doctor, and npm scripts.
98
+
99
+ Exit criteria:
100
+
101
+ ```bash
102
+ npm run smoke:platform:doctor
103
+ ```
104
+
105
+ passes only when all required local setup exists.
106
+
107
+ ### Phase 3: target session manager
108
+
109
+ Implement Crabbox target lifecycle for all three targets.
110
+
111
+ Exit criteria:
112
+
113
+ - each target can acquire/warm;
114
+ - each target can sync;
115
+ - each target can run `node --version`;
116
+ - each target can package/download a trivial artifact;
117
+ - each target can stop/cleanup;
118
+ - one lease per target session.
119
+
120
+ ### Phase 4: `platform-build`
121
+
122
+ Implement build/package/install suite.
123
+
124
+ Exit criteria: `platform-build` passes on all targets through `smoke:platform:all -- --suite platform-build` without live Cursor calls.
125
+
126
+ ### Phase 5: PTY capture and host render
127
+
128
+ Implement PTY/ConPTY capture and host-side xterm/Playwright render.
129
+
130
+ Exit criteria:
131
+
132
+ - ANSI capture works on all targets;
133
+ - host render writes HTML, full PNG, and final viewport PNG;
134
+ - visual evidence detector can capture fixture evidence screenshots.
135
+
136
+ ### Phase 6: native visual matrix
137
+
138
+ Implement one-call native matrix.
139
+
140
+ Exit criteria:
141
+
142
+ - all required native visual evidence screenshots are captured on every target;
143
+ - JSONL assertions pass on every target;
144
+ - Cursor call budget remains one call per target.
145
+
146
+ ### Phase 7: bridge visual matrix
147
+
148
+ Implement one-call bridge matrix.
149
+
150
+ Exit criteria:
151
+
152
+ - all required bridge visual evidence screenshots are captured on every target;
153
+ - bridge diagnostics assertions pass on every target;
154
+ - JSONL assertions pass on every target.
155
+
156
+ ### Phase 8: abort cleanup
157
+
158
+ Implement interrupted bridge run.
159
+
160
+ Exit criteria:
161
+
162
+ - no leftovers on any target;
163
+ - no false success in JSONL;
164
+ - target session stops cleanly.
165
+
166
+ ### Phase 9: docs and legacy cleanup
167
+
168
+ Update:
169
+
170
+ - `README.md`
171
+ - `docs/cursor-live-smoke-checklist.md`
172
+ - `docs/cursor-testing-lessons.md`
173
+ - `docs/cursor-native-tool-visual-audit.md`
174
+
175
+ They must state:
176
+
177
+ - required local release gate is `npm run smoke:platform:all`;
178
+ - cloud-runtime changes additionally require `npm run smoke:cloud`;
179
+ - legacy smoke scripts are inner-loop/debug helpers;
180
+ - `tmux` visual smoke is not the canonical cross-platform gate.
181
+
182
+ ## Gate replacement criteria
183
+
184
+ Replace or redesign this platform runner if any of these become true:
185
+
186
+ - Parallels Windows linked clones are unreliable.
187
+ - Windows native cannot run the required ConPTY visual matrix.
188
+ - macOS static SSH localhost cannot run the required PTY visual matrix.
189
+ - Ubuntu local-container cannot run the required PTY visual matrix.
190
+ - Packed install cannot be tested uniformly across all targets.
191
+ - Artifact transfer cannot be made uniform across success and failure.
192
+ - The visual card detector cannot reliably identify required deterministic cards.
193
+ - The full gate exceeds the fixed Cursor invocation budget.
194
+ - Node 24 + `node-pty` cannot be made reliable on Windows native.
195
+
196
+ If the gate is replaced, document the new cross-platform release process before removing this one. Existing local smoke scripts remain inner-loop/debug helpers, not release gates.
197
+
198
+ ## Portability to other pi extensions
199
+
200
+ Repo-specific pieces:
201
+
202
+ - `platform-smoke.config.mjs`
203
+ - expected package name
204
+ - model IDs
205
+ - scenario prompts
206
+ - required visual card matrix
207
+ - final markers
208
+
209
+ Reusable pieces:
210
+
211
+ - Crabbox target session manager
212
+ - PTY/ConPTY capture
213
+ - host-side ANSI render
214
+ - artifact manifest writer
215
+ - JSONL parser
216
+ - visual evidence detector
217
+ - process cleanup checker
218
+ - target doctor
219
+
220
+ The framework is successful when another pi extension can copy the runner and change only its config plus scenarios.