@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.
- package/CHANGELOG.md +16 -0
- package/README.md +99 -126
- package/dist/cursor-agents-context-registration.js +1 -3
- package/dist/cursor-agents-context.js +2 -2
- package/dist/cursor-config.js +2 -290
- package/dist/cursor-provider-errors.js +3 -58
- package/dist/cursor-provider-live-run-drain.js +0 -3
- package/dist/cursor-provider-run-finalizer.js +4 -7
- package/dist/cursor-provider-run-outcome.js +1 -1
- package/dist/cursor-provider-turn-finalize.js +3 -55
- package/dist/cursor-provider-turn-prepare.js +8 -144
- package/dist/cursor-provider-turn-runner.js +9 -23
- package/dist/cursor-provider-turn-send.js +8 -35
- package/dist/cursor-runtime-state.js +6 -268
- package/dist/cursor-sdk-billed-usage.js +3 -18
- package/dist/cursor-sdk-platform-package.js +88 -0
- package/dist/cursor-session-agent.js +18 -14
- package/dist/cursor-skill-tool.js +12 -22
- package/dist/cursor-state.js +5 -8
- package/dist/cursor-usage-accounting.js +1 -1
- package/docs/cursor-dogfood-checklist.md +4 -4
- package/docs/cursor-live-smoke-checklist.md +23 -23
- package/docs/cursor-model-ux-spec.md +27 -30
- package/docs/cursor-native-tool-replay.md +4 -4
- package/docs/cursor-native-tool-visual-audit.md +7 -7
- package/docs/cursor-testing-lessons.md +23 -16
- package/docs/cursor-tool-surfaces.md +2 -4
- package/docs/platform-smoke-implementation.md +5 -5
- package/docs/platform-smoke.md +27 -72
- package/package.json +3 -17
- package/platform-smoke.config.mjs +2 -1
- package/scripts/lib/local-resume-smoke-harness.mjs +0 -18
- package/scripts/platform-smoke/card-detect.mjs +1 -1
- package/scripts/platform-smoke/local-resume-runner.mjs +1 -1
- package/scripts/platform-smoke/scenarios.mjs +1 -1
- package/scripts/platform-smoke/targets.mjs +14 -5
- package/src/cursor-agents-context-registration.ts +0 -5
- package/src/cursor-agents-context.ts +1 -3
- package/src/cursor-config.ts +8 -379
- package/src/cursor-provider-errors.ts +2 -62
- package/src/cursor-provider-live-run-drain.ts +0 -3
- package/src/cursor-provider-run-finalizer.ts +4 -12
- package/src/cursor-provider-run-outcome.ts +0 -3
- package/src/cursor-provider-turn-finalize.ts +3 -61
- package/src/cursor-provider-turn-prepare.ts +8 -165
- package/src/cursor-provider-turn-runner.ts +15 -31
- package/src/cursor-provider-turn-send.ts +7 -38
- package/src/cursor-provider-turn-types.ts +9 -30
- package/src/cursor-runtime-state.ts +6 -345
- package/src/cursor-sdk-billed-usage.ts +3 -24
- package/src/cursor-sdk-platform-package.ts +106 -0
- package/src/cursor-session-agent.ts +16 -12
- package/src/cursor-skill-tool.ts +10 -26
- package/src/cursor-state.ts +5 -10
- package/src/cursor-usage-accounting.ts +1 -3
- package/dist/cursor-cloud-lifecycle.js +0 -650
- package/dist/cursor-cloud-local-state.js +0 -460
- package/dist/cursor-cloud-options.js +0 -145
- package/dist/cursor-cloud-reporting.js +0 -222
- package/dist/cursor-ripgrep-path.js +0 -27
- package/scripts/cloud-runtime-smoke.d.mts +0 -42
- package/scripts/cloud-runtime-smoke.mjs +0 -623
- package/scripts/lib/cloud-smoke-artifacts.d.mts +0 -16
- package/scripts/lib/cloud-smoke-artifacts.mjs +0 -94
- package/scripts/lib/cloud-smoke-cleanup-evidence.d.mts +0 -209
- package/scripts/lib/cloud-smoke-cleanup-evidence.mjs +0 -585
- package/scripts/lib/cloud-smoke-github.d.mts +0 -78
- package/scripts/lib/cloud-smoke-github.mjs +0 -331
- package/scripts/lib/cloud-smoke-pi-runner.d.mts +0 -42
- package/scripts/lib/cloud-smoke-pi-runner.mjs +0 -214
- package/scripts/lib/cloud-smoke-shutdown.d.mts +0 -67
- package/scripts/lib/cloud-smoke-shutdown.mjs +0 -133
- package/shared/cursor-cloud-lifecycle-constants.d.mts +0 -3
- package/shared/cursor-cloud-lifecycle-constants.mjs +0 -7
- package/src/cursor-cloud-lifecycle.ts +0 -733
- package/src/cursor-cloud-local-state.ts +0 -536
- package/src/cursor-cloud-options.ts +0 -182
- package/src/cursor-cloud-reporting.ts +0 -267
- 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,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";
|