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.
- package/CHANGELOG.md +56 -1
- package/README.md +20 -8
- package/docs/cursor-live-smoke-checklist.md +267 -0
- package/docs/cursor-model-ux-spec.md +15 -5
- package/docs/cursor-native-tool-replay.md +16 -5
- package/package.json +12 -5
- package/scripts/steering-rpc-smoke.mjs +238 -0
- package/scripts/tmux-live-smoke.sh +418 -0
- package/scripts/validate-smoke-jsonl.mjs +152 -0
- package/src/context.ts +180 -5
- package/src/cursor-bridge-contract.ts +27 -0
- package/src/cursor-edit-diff.ts +11 -0
- package/src/cursor-env-boolean.ts +22 -0
- package/src/cursor-live-run-accounting.ts +65 -0
- package/src/cursor-live-run-coordinator.ts +483 -0
- package/src/cursor-native-tool-display-registration.ts +93 -0
- package/src/cursor-native-tool-display-replay.ts +465 -0
- package/src/cursor-native-tool-display-state.ts +78 -0
- package/src/cursor-native-tool-display-tools.ts +102 -0
- package/src/cursor-native-tool-display.ts +10 -639
- package/src/cursor-partial-content-emitter.ts +121 -0
- package/src/cursor-pi-tool-bridge-abort.ts +133 -0
- package/src/cursor-pi-tool-bridge-diagnostics.ts +179 -0
- package/src/cursor-pi-tool-bridge-mcp.ts +118 -0
- package/src/cursor-pi-tool-bridge-run.ts +384 -0
- package/src/cursor-pi-tool-bridge-server.ts +182 -0
- package/src/cursor-pi-tool-bridge-snapshot.ts +88 -0
- package/src/cursor-pi-tool-bridge-types.ts +80 -0
- package/src/cursor-pi-tool-bridge.ts +77 -602
- package/src/cursor-provider-live-run-drain.ts +379 -0
- package/src/cursor-provider-turn-coordinator.ts +456 -0
- package/src/cursor-provider.ts +133 -1092
- package/src/cursor-question-tool.ts +7 -2
- package/src/cursor-record-utils.ts +26 -0
- package/src/cursor-sdk-output-filter.ts +100 -0
- package/src/cursor-sensitive-text.ts +37 -0
- 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-tool-transcript.ts +28 -1229
- package/src/cursor-transcript-tool-formatters.ts +641 -0
- package/src/cursor-transcript-tool-specs.ts +441 -0
- package/src/cursor-transcript-utils.ts +276 -0
- package/src/cursor-usage-accounting.ts +71 -0
- 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
|
+
}
|