pi-cursor-sdk 0.1.15 → 0.1.17

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 (46) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/README.md +20 -8
  3. package/docs/cursor-live-smoke-checklist.md +267 -0
  4. package/docs/cursor-model-ux-spec.md +15 -5
  5. package/docs/cursor-native-tool-replay.md +16 -5
  6. package/package.json +12 -5
  7. package/scripts/steering-rpc-smoke.mjs +238 -0
  8. package/scripts/tmux-live-smoke.sh +418 -0
  9. package/scripts/validate-smoke-jsonl.mjs +152 -0
  10. package/src/context.ts +180 -5
  11. package/src/cursor-bridge-contract.ts +27 -0
  12. package/src/cursor-edit-diff.ts +11 -0
  13. package/src/cursor-env-boolean.ts +22 -0
  14. package/src/cursor-live-run-accounting.ts +65 -0
  15. package/src/cursor-live-run-coordinator.ts +483 -0
  16. package/src/cursor-native-tool-display-registration.ts +93 -0
  17. package/src/cursor-native-tool-display-replay.ts +465 -0
  18. package/src/cursor-native-tool-display-state.ts +78 -0
  19. package/src/cursor-native-tool-display-tools.ts +102 -0
  20. package/src/cursor-native-tool-display.ts +10 -639
  21. package/src/cursor-partial-content-emitter.ts +121 -0
  22. package/src/cursor-pi-tool-bridge-abort.ts +133 -0
  23. package/src/cursor-pi-tool-bridge-diagnostics.ts +179 -0
  24. package/src/cursor-pi-tool-bridge-mcp.ts +118 -0
  25. package/src/cursor-pi-tool-bridge-run.ts +384 -0
  26. package/src/cursor-pi-tool-bridge-server.ts +182 -0
  27. package/src/cursor-pi-tool-bridge-snapshot.ts +88 -0
  28. package/src/cursor-pi-tool-bridge-types.ts +80 -0
  29. package/src/cursor-pi-tool-bridge.ts +77 -602
  30. package/src/cursor-provider-live-run-drain.ts +379 -0
  31. package/src/cursor-provider-turn-coordinator.ts +456 -0
  32. package/src/cursor-provider.ts +133 -1092
  33. package/src/cursor-question-tool.ts +7 -2
  34. package/src/cursor-record-utils.ts +26 -0
  35. package/src/cursor-sdk-output-filter.ts +100 -0
  36. package/src/cursor-sensitive-text.ts +37 -0
  37. package/src/cursor-session-agent.ts +372 -0
  38. package/src/cursor-session-cwd.ts +14 -19
  39. package/src/cursor-session-scope.ts +65 -0
  40. package/src/cursor-state.ts +38 -10
  41. package/src/cursor-tool-transcript.ts +28 -1229
  42. package/src/cursor-transcript-tool-formatters.ts +641 -0
  43. package/src/cursor-transcript-tool-specs.ts +441 -0
  44. package/src/cursor-transcript-utils.ts +276 -0
  45. package/src/cursor-usage-accounting.ts +71 -0
  46. package/src/index.ts +20 -3
@@ -0,0 +1,80 @@
1
+ import type { McpServerConfig } from "@cursor/sdk";
2
+ import type { Context, ToolResultMessage } from "@earendil-works/pi-ai";
3
+ import type {
4
+ ExtensionAPI,
5
+ ExtensionHandler,
6
+ SessionShutdownEvent,
7
+ ToolCallEvent,
8
+ ToolCallEventResult,
9
+ ToolInfo,
10
+ ToolResultEvent,
11
+ } from "@earendil-works/pi-coding-agent";
12
+
13
+ export type CursorPiToolBridgeSnapshotApi = Pick<ExtensionAPI, "getActiveTools" | "getAllTools">;
14
+
15
+ export type CursorPiToolBridgeExtensionApi = CursorPiToolBridgeSnapshotApi & {
16
+ on(event: "tool_call", handler: ExtensionHandler<ToolCallEvent, ToolCallEventResult>): void;
17
+ on(event: "tool_result", handler: ExtensionHandler<ToolResultEvent>): void;
18
+ on(event: "session_shutdown", handler: ExtensionHandler<SessionShutdownEvent>): void;
19
+ };
20
+
21
+ export interface CursorPiMcpInputSchema {
22
+ type: "object";
23
+ properties?: Record<string, object>;
24
+ required?: string[];
25
+ [key: string]: unknown;
26
+ }
27
+
28
+ export interface CursorPiBridgeToolDefinition {
29
+ piToolName: string;
30
+ mcpToolName: string;
31
+ description: string;
32
+ inputSchema: CursorPiMcpInputSchema;
33
+ sourceInfo: ToolInfo["sourceInfo"];
34
+ }
35
+
36
+ export interface CursorPiToolBridgeSnapshot {
37
+ tools: CursorPiBridgeToolDefinition[];
38
+ mcpToolNameToPiToolName: ReadonlyMap<string, string>;
39
+ piToolNameToMcpToolName: ReadonlyMap<string, string>;
40
+ }
41
+
42
+ export interface CursorPiToolBridgeSnapshotOptions {
43
+ exposeOverlappingBuiltins?: boolean;
44
+ }
45
+
46
+ export interface CursorPiBridgeToolRequest {
47
+ runId: string;
48
+ bridgeCallId: string;
49
+ cursorMcpCallId?: string;
50
+ piToolCallId: string;
51
+ piToolName: string;
52
+ mcpToolName: string;
53
+ args: Record<string, unknown>;
54
+ }
55
+
56
+ export interface CursorPiToolBridgeRun {
57
+ id: string;
58
+ enabled: boolean;
59
+ mcpServers?: Record<string, McpServerConfig>;
60
+ snapshot: CursorPiToolBridgeSnapshot;
61
+ takeQueuedToolRequests(): CursorPiBridgeToolRequest[];
62
+ resolveToolResults(toolResults: readonly ToolResultMessage[]): void;
63
+ resolveToolResultsFromContext(context: Context): void;
64
+ hasPendingPiToolCallId(piToolCallId: string): boolean;
65
+ isBridgeMcpToolCall(toolCall: unknown): boolean;
66
+ setOnToolRequest(handler?: (request: CursorPiBridgeToolRequest) => void): void;
67
+ cancel(reason: string): void;
68
+ dispose(): Promise<void>;
69
+ }
70
+
71
+ export interface CursorPiToolBridge {
72
+ isEnabled(): boolean;
73
+ getToolSurfaceSignature(): string;
74
+ createRun(options?: CursorPiToolBridgeRunOptions): Promise<CursorPiToolBridgeRun>;
75
+ disposeAll(reason?: string): Promise<void>;
76
+ }
77
+
78
+ export interface CursorPiToolBridgeRunOptions {
79
+ onToolRequest?: (request: CursorPiBridgeToolRequest) => void;
80
+ }