pi-cursor-sdk 0.1.15 → 0.1.16
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 +27 -0
- package/README.md +19 -7
- package/docs/cursor-live-smoke-checklist.md +271 -0
- package/docs/cursor-model-ux-spec.md +12 -3
- package/docs/cursor-native-tool-replay.md +16 -5
- package/package.json +2 -1
- package/src/context.ts +180 -5
- package/src/cursor-bridge-contract.ts +27 -0
- package/src/cursor-live-run-accounting.ts +65 -0
- package/src/cursor-native-tool-display.ts +14 -5
- package/src/cursor-pi-tool-bridge.ts +565 -28
- package/src/cursor-provider.ts +200 -128
- package/src/cursor-question-tool.ts +7 -2
- package/src/cursor-session-agent.ts +372 -0
- package/src/cursor-session-cwd.ts +14 -19
- package/src/cursor-session-scope.ts +65 -0
- package/src/cursor-state.ts +38 -10
- package/src/cursor-usage-accounting.ts +71 -0
- package/src/index.ts +20 -3
package/src/index.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
import type { ExtensionAPI, ProviderConfig, ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext, ProviderConfig, ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { discoverModels, type CursorModelFallbackIssue } from "./model-discovery.js";
|
|
3
3
|
import { registerCursorFastControls } from "./cursor-state.js";
|
|
4
4
|
import { registerCursorNativeToolDisplay } from "./cursor-native-tool-display.js";
|
|
5
5
|
import { registerCursorPiToolBridge } from "./cursor-pi-tool-bridge.js";
|
|
6
6
|
import { registerCursorQuestionTool } from "./cursor-question-tool.js";
|
|
7
7
|
import { registerCursorSessionCwd } from "./cursor-session-cwd.js";
|
|
8
|
+
import { registerCursorSessionAgent } from "./cursor-session-agent.js";
|
|
8
9
|
import { streamCursor } from "./cursor-provider.js";
|
|
9
10
|
|
|
11
|
+
type CursorExtensionApi =
|
|
12
|
+
& Pick<ExtensionAPI, "registerProvider">
|
|
13
|
+
& {
|
|
14
|
+
registerCommand(name: string, options: {
|
|
15
|
+
description?: string;
|
|
16
|
+
handler: (args: string, ctx: Pick<ExtensionContext, "hasUI"> & { ui: Pick<ExtensionContext["ui"], "notify"> }) => Promise<void> | void;
|
|
17
|
+
}): void;
|
|
18
|
+
}
|
|
19
|
+
& Parameters<typeof registerCursorSessionCwd>[0]
|
|
20
|
+
& Parameters<typeof registerCursorSessionAgent>[0]
|
|
21
|
+
& Parameters<typeof registerCursorFastControls>[0]
|
|
22
|
+
& Parameters<typeof registerCursorNativeToolDisplay>[0]
|
|
23
|
+
& Parameters<typeof registerCursorQuestionTool>[0]
|
|
24
|
+
& Parameters<typeof registerCursorPiToolBridge>[0];
|
|
25
|
+
|
|
10
26
|
function createCursorProviderConfig(models: ProviderModelConfig[]): ProviderConfig {
|
|
11
27
|
return {
|
|
12
28
|
name: "Cursor",
|
|
@@ -18,13 +34,14 @@ function createCursorProviderConfig(models: ProviderModelConfig[]): ProviderConf
|
|
|
18
34
|
};
|
|
19
35
|
}
|
|
20
36
|
|
|
21
|
-
function registerCursorProvider(pi: ExtensionAPI, models: ProviderModelConfig[]): void {
|
|
37
|
+
function registerCursorProvider(pi: Pick<ExtensionAPI, "registerProvider">, models: ProviderModelConfig[]): void {
|
|
22
38
|
pi.registerProvider("cursor", createCursorProviderConfig(models));
|
|
23
39
|
}
|
|
24
40
|
|
|
25
|
-
export default async function (pi:
|
|
41
|
+
export default async function (pi: CursorExtensionApi) {
|
|
26
42
|
// Session cwd must register before other session_start listeners that depend on it.
|
|
27
43
|
registerCursorSessionCwd(pi);
|
|
44
|
+
registerCursorSessionAgent(pi);
|
|
28
45
|
registerCursorFastControls(pi);
|
|
29
46
|
registerCursorNativeToolDisplay(pi);
|
|
30
47
|
registerCursorQuestionTool(pi);
|