cursor-opencode-provider 0.2.3 → 0.2.4
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/README.md +27 -12
- package/dist/activity.d.ts +15 -0
- package/dist/activity.js +76 -0
- package/dist/context/build.js +0 -7
- package/dist/errors.d.ts +59 -0
- package/dist/errors.js +199 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +4 -0
- package/dist/language-model.d.ts +47 -4
- package/dist/language-model.js +617 -183
- package/dist/models.d.ts +7 -0
- package/dist/models.js +259 -79
- package/dist/plugin.js +35 -2
- package/dist/protocol/exec-variants.d.ts +24 -0
- package/dist/protocol/exec-variants.js +55 -0
- package/dist/protocol/messages.js +105 -25
- package/dist/protocol/request.d.ts +0 -2
- package/dist/protocol/request.js +0 -8
- package/dist/protocol/struct.js +1 -1
- package/dist/protocol/tool-call-bridge.js +2 -0
- package/dist/protocol/tools.d.ts +8 -1
- package/dist/protocol/tools.js +258 -32
- package/dist/session.d.ts +115 -8
- package/dist/session.js +362 -31
- package/dist/shell-timeout.d.ts +50 -0
- package/dist/shell-timeout.js +179 -0
- package/dist/transport/connect.d.ts +37 -1
- package/dist/transport/connect.js +679 -115
- package/package.json +6 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CursorTransportError, CursorProviderError } from "../errors.js";
|
|
2
|
+
import http2 from "node:http2";
|
|
1
3
|
export declare function buildBaseHeaders(token: string, clientVersion: string, extra?: Record<string, string>): Record<string, string>;
|
|
2
4
|
export declare function unaryAvailableModels(token: string, options?: {
|
|
3
5
|
apiBaseURL?: string;
|
|
@@ -30,19 +32,53 @@ export declare function fetchAgentUrl(token: string, options?: {
|
|
|
30
32
|
telemetryEnabled?: boolean;
|
|
31
33
|
}): Promise<string>;
|
|
32
34
|
export type BidiStream = {
|
|
33
|
-
write(msg: Uint8Array): void;
|
|
35
|
+
write(msg: Uint8Array): boolean | void;
|
|
36
|
+
waitForDrain?(timeoutMs: number): Promise<void>;
|
|
34
37
|
end(): void;
|
|
35
38
|
frames(): AsyncIterable<{
|
|
36
39
|
flags: number;
|
|
37
40
|
payload: Uint8Array;
|
|
38
41
|
}>;
|
|
39
42
|
destroy(): void;
|
|
43
|
+
isClosed(): boolean;
|
|
44
|
+
onTerminal(listener: (event: BidiTerminalEvent) => void): () => void;
|
|
40
45
|
};
|
|
46
|
+
export type BidiTerminalEvent = {
|
|
47
|
+
kind: "remote-clean-close";
|
|
48
|
+
} | {
|
|
49
|
+
kind: "remote-error";
|
|
50
|
+
error: CursorProviderError;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "local-close";
|
|
53
|
+
};
|
|
54
|
+
export declare class CursorRunInterruptedError extends CursorTransportError {
|
|
55
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
56
|
+
}
|
|
57
|
+
export declare function cursorRunTerminationError(input: {
|
|
58
|
+
responseStatus: number;
|
|
59
|
+
responseHeaders?: Record<string, unknown>;
|
|
60
|
+
responseTrailers?: Record<string, unknown>;
|
|
61
|
+
streamError?: Error | null;
|
|
62
|
+
}): CursorProviderError;
|
|
63
|
+
export declare const HTTP2_SESSION_MAX_AGE_MS: number;
|
|
64
|
+
export declare function shouldReuseHttp2Session(state: {
|
|
65
|
+
destroyed: boolean;
|
|
66
|
+
closed: boolean;
|
|
67
|
+
}, createdAt: number, now?: number): boolean;
|
|
41
68
|
/** Resolve the HTTP/2 connect origin for a Run stream (exported for tests). */
|
|
42
69
|
export declare function resolveAgentOrigin(baseURL: string): string;
|
|
70
|
+
/** Test cleanup for local HTTP/2 fixtures; production sessions stay process-cached. */
|
|
71
|
+
export declare function closeCachedHttp2SessionsForTests(): void;
|
|
72
|
+
/** Node-runtime regression hook; production callers use getSession(). */
|
|
73
|
+
export declare function installSessionInvalidationForTests(origin: string, session: http2.ClientHttp2Session): void;
|
|
74
|
+
export declare function getSession(baseURL: string, options?: {
|
|
75
|
+
pingTimeoutMs?: number;
|
|
76
|
+
}): Promise<http2.ClientHttp2Session>;
|
|
43
77
|
export declare function bidiRunStream(token: string, options: {
|
|
44
78
|
signal?: AbortSignal;
|
|
45
79
|
baseURL: string;
|
|
46
80
|
headers?: Record<string, string>;
|
|
81
|
+
readIdleMs?: number;
|
|
82
|
+
pingTimeoutMs?: number;
|
|
47
83
|
}): Promise<BidiStream>;
|
|
48
84
|
export declare function makeRequestId(): string;
|