@emmaneugene/pi-cursor-sdk 0.3.7 → 0.4.0

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 (79) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +99 -126
  3. package/dist/cursor-agents-context-registration.js +1 -3
  4. package/dist/cursor-agents-context.js +2 -2
  5. package/dist/cursor-config.js +2 -290
  6. package/dist/cursor-provider-errors.js +3 -58
  7. package/dist/cursor-provider-live-run-drain.js +0 -3
  8. package/dist/cursor-provider-run-finalizer.js +4 -7
  9. package/dist/cursor-provider-run-outcome.js +1 -1
  10. package/dist/cursor-provider-turn-finalize.js +3 -55
  11. package/dist/cursor-provider-turn-prepare.js +8 -144
  12. package/dist/cursor-provider-turn-runner.js +9 -23
  13. package/dist/cursor-provider-turn-send.js +8 -35
  14. package/dist/cursor-runtime-state.js +6 -268
  15. package/dist/cursor-sdk-billed-usage.js +3 -18
  16. package/dist/cursor-sdk-platform-package.js +88 -0
  17. package/dist/cursor-session-agent.js +18 -14
  18. package/dist/cursor-skill-tool.js +12 -22
  19. package/dist/cursor-state.js +5 -8
  20. package/dist/cursor-usage-accounting.js +1 -1
  21. package/docs/cursor-dogfood-checklist.md +4 -4
  22. package/docs/cursor-live-smoke-checklist.md +23 -23
  23. package/docs/cursor-model-ux-spec.md +27 -30
  24. package/docs/cursor-native-tool-replay.md +4 -4
  25. package/docs/cursor-native-tool-visual-audit.md +7 -7
  26. package/docs/cursor-testing-lessons.md +23 -16
  27. package/docs/cursor-tool-surfaces.md +2 -4
  28. package/docs/platform-smoke-implementation.md +5 -5
  29. package/docs/platform-smoke.md +27 -72
  30. package/package.json +3 -17
  31. package/platform-smoke.config.mjs +2 -1
  32. package/scripts/lib/local-resume-smoke-harness.mjs +0 -18
  33. package/scripts/platform-smoke/card-detect.mjs +1 -1
  34. package/scripts/platform-smoke/local-resume-runner.mjs +1 -1
  35. package/scripts/platform-smoke/scenarios.mjs +1 -1
  36. package/scripts/platform-smoke/targets.mjs +14 -5
  37. package/src/cursor-agents-context-registration.ts +0 -5
  38. package/src/cursor-agents-context.ts +1 -3
  39. package/src/cursor-config.ts +8 -379
  40. package/src/cursor-provider-errors.ts +2 -62
  41. package/src/cursor-provider-live-run-drain.ts +0 -3
  42. package/src/cursor-provider-run-finalizer.ts +4 -12
  43. package/src/cursor-provider-run-outcome.ts +0 -3
  44. package/src/cursor-provider-turn-finalize.ts +3 -61
  45. package/src/cursor-provider-turn-prepare.ts +8 -165
  46. package/src/cursor-provider-turn-runner.ts +15 -31
  47. package/src/cursor-provider-turn-send.ts +7 -38
  48. package/src/cursor-provider-turn-types.ts +9 -30
  49. package/src/cursor-runtime-state.ts +6 -345
  50. package/src/cursor-sdk-billed-usage.ts +3 -24
  51. package/src/cursor-sdk-platform-package.ts +106 -0
  52. package/src/cursor-session-agent.ts +16 -12
  53. package/src/cursor-skill-tool.ts +10 -26
  54. package/src/cursor-state.ts +5 -10
  55. package/src/cursor-usage-accounting.ts +1 -3
  56. package/dist/cursor-cloud-lifecycle.js +0 -650
  57. package/dist/cursor-cloud-local-state.js +0 -460
  58. package/dist/cursor-cloud-options.js +0 -145
  59. package/dist/cursor-cloud-reporting.js +0 -222
  60. package/dist/cursor-ripgrep-path.js +0 -27
  61. package/scripts/cloud-runtime-smoke.d.mts +0 -42
  62. package/scripts/cloud-runtime-smoke.mjs +0 -623
  63. package/scripts/lib/cloud-smoke-artifacts.d.mts +0 -16
  64. package/scripts/lib/cloud-smoke-artifacts.mjs +0 -94
  65. package/scripts/lib/cloud-smoke-cleanup-evidence.d.mts +0 -209
  66. package/scripts/lib/cloud-smoke-cleanup-evidence.mjs +0 -585
  67. package/scripts/lib/cloud-smoke-github.d.mts +0 -78
  68. package/scripts/lib/cloud-smoke-github.mjs +0 -331
  69. package/scripts/lib/cloud-smoke-pi-runner.d.mts +0 -42
  70. package/scripts/lib/cloud-smoke-pi-runner.mjs +0 -214
  71. package/scripts/lib/cloud-smoke-shutdown.d.mts +0 -67
  72. package/scripts/lib/cloud-smoke-shutdown.mjs +0 -133
  73. package/shared/cursor-cloud-lifecycle-constants.d.mts +0 -3
  74. package/shared/cursor-cloud-lifecycle-constants.mjs +0 -7
  75. package/src/cursor-cloud-lifecycle.ts +0 -733
  76. package/src/cursor-cloud-local-state.ts +0 -536
  77. package/src/cursor-cloud-options.ts +0 -182
  78. package/src/cursor-cloud-reporting.ts +0 -267
  79. package/src/cursor-ripgrep-path.ts +0 -32
@@ -1,133 +0,0 @@
1
- export function createCloudSmokeShutdownController(terminate) {
2
- if (typeof terminate !== "function") throw new TypeError("terminate must be a function");
3
- const activeChildren = new Set();
4
- const abortController = new AbortController();
5
- let shutdownPromise;
6
- let reason;
7
- let requestedSignal;
8
- let terminationFailureReason;
9
-
10
- const terminationFailure = (error) => {
11
- if (terminationFailureReason) return terminationFailureReason;
12
- terminationFailureReason = new Error(`cloud smoke ${requestedSignal} child termination failed`, { cause: error });
13
- terminationFailureReason.signal = requestedSignal;
14
- reason = terminationFailureReason;
15
- return terminationFailureReason;
16
- };
17
-
18
- const track = async (child) => {
19
- if (abortController.signal.aborted) {
20
- try {
21
- await terminate(child);
22
- } catch (error) {
23
- throw terminationFailure(error);
24
- }
25
- throw reason;
26
- }
27
- activeChildren.add(child);
28
- const untrack = () => activeChildren.delete(child);
29
- child.once?.("close", untrack);
30
- return untrack;
31
- };
32
-
33
- const request = async (signalName) => {
34
- if (!abortController.signal.aborted) {
35
- requestedSignal = signalName;
36
- const interruptReason = new Error(`cloud smoke interrupted by ${signalName}`);
37
- interruptReason.signal = signalName;
38
- reason = interruptReason;
39
- const terminations = [...activeChildren].map((child) => Promise.resolve().then(() => terminate(child)));
40
- shutdownPromise = Promise.allSettled(terminations).then((results) => {
41
- const failed = results.find((result) => result.status === "rejected");
42
- if (failed) throw terminationFailure(failed.reason);
43
- });
44
- abortController.abort(interruptReason);
45
- }
46
- await shutdownPromise;
47
- return reason;
48
- };
49
-
50
- return {
51
- signal: abortController.signal,
52
- track,
53
- request,
54
- get reason() { return reason; },
55
- wait: () => shutdownPromise ?? Promise.resolve(),
56
- throwIfRequested() {
57
- if (abortController.signal.aborted) throw reason;
58
- },
59
- };
60
- }
61
-
62
- export async function awaitCloudSmokeShutdown(shutdown, tracking = Promise.resolve()) {
63
- const results = await Promise.allSettled([shutdown.wait(), tracking]);
64
- const failed = results.find((result) => result.status === "rejected");
65
- const outcome = failed?.reason ?? shutdown.reason;
66
- return outcome instanceof Error ? outcome : new Error("cloud smoke shutdown failed", { cause: outcome });
67
- }
68
-
69
- export async function checkpointCloudSmokeShutdown(shutdown) {
70
- await new Promise((resolve) => setImmediate(resolve));
71
- shutdown.throwIfRequested();
72
- }
73
-
74
- export function createCloudSmokeTerminalFailureState(rejectPending) {
75
- let failure;
76
- return {
77
- record(error) {
78
- failure ??= error;
79
- rejectPending(failure);
80
- },
81
- throwIfFailed() {
82
- if (failure) throw failure;
83
- },
84
- };
85
- }
86
-
87
- export async function stopCloudSmokeTrackedChild(shutdown, tracking, terminateChild) {
88
- const termination = Promise.resolve().then(terminateChild);
89
- const [terminationResult] = await Promise.allSettled([termination]);
90
- if (shutdown.signal.aborted) {
91
- const results = await Promise.allSettled([shutdown.wait(), tracking, termination]);
92
- const failed = results.find((result) => result.status === "rejected");
93
- if (failed) throw failed.reason instanceof Error ? failed.reason : new Error("cloud smoke child termination failed", { cause: failed.reason });
94
- return shutdown.reason;
95
- }
96
- if (terminationResult.status === "rejected") throw terminationResult.reason;
97
- return undefined;
98
- }
99
-
100
- export function routeCloudSmokeChildError(shutdown, onShutdown, onError, error) {
101
- if (shutdown.signal.aborted) onShutdown();
102
- else onError(error);
103
- }
104
-
105
- export function installCloudSmokeChildErrorHandlers(child, shutdown, onShutdown, onError) {
106
- const routeError = (error) => routeCloudSmokeChildError(shutdown, onShutdown, onError, error);
107
- child.once("error", routeError);
108
- child.stdin?.on?.("error", routeError);
109
- return routeError;
110
- }
111
-
112
- export function routeCloudSmokeChildClose(shutdown, timedOut, onShutdown, onClose, result) {
113
- if (shutdown.signal.aborted) onShutdown();
114
- else if (!timedOut) onClose(result);
115
- }
116
-
117
- export function installCloudSmokeSignalHandlers(shutdown, processLike = process, onSignal) {
118
- const handlers = new Map();
119
- for (const signalName of ["SIGINT", "SIGTERM"]) {
120
- const handler = () => {
121
- try {
122
- onSignal?.(signalName);
123
- } finally {
124
- void shutdown.request(signalName).catch(() => {});
125
- }
126
- };
127
- handlers.set(signalName, handler);
128
- processLike.on(signalName, handler);
129
- }
130
- return () => {
131
- for (const [signalName, handler] of handlers) processLike.off(signalName, handler);
132
- };
133
- }
@@ -1,3 +0,0 @@
1
- export declare const CLOUD_AGENT_ID_PATTERN: RegExp;
2
- export declare const CLOUD_LIFECYCLE_ENTRY_TYPE: "cursor-cloud-lifecycle";
3
- export declare const CLOUD_LIFECYCLE_JOURNAL_PREFIX: ".cursor-cloud-lifecycle";
@@ -1,7 +0,0 @@
1
- /** Canonical Cursor Cloud lifecycle contract shared by the runtime and maintainer scripts. */
2
-
3
- export const CLOUD_AGENT_ID_PATTERN = /^bc-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4
-
5
- export const CLOUD_LIFECYCLE_ENTRY_TYPE = "cursor-cloud-lifecycle";
6
-
7
- export const CLOUD_LIFECYCLE_JOURNAL_PREFIX = ".cursor-cloud-lifecycle";