@crewx/sdk 0.9.0-rc.190 → 0.9.0-rc.191
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/dist/esm/index.js +354 -346
- package/dist/esm/plugins/index.js +55 -55
- package/dist/esm/repository/index.js +90 -90
- package/dist/events/types.d.ts +15 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +308 -300
- package/dist/plugins/index.js +55 -55
- package/dist/provider/acp/adapter.d.ts +37 -2
- package/dist/provider/acp/adapters/antigravity-account.d.ts +4 -0
- package/dist/provider/acp/completion-observer.d.ts +24 -0
- package/dist/provider/acp/connection.d.ts +63 -3
- package/dist/provider/acp/index.d.ts +3 -3
- package/dist/provider/acp/register.d.ts +1 -0
- package/dist/provider/acp/runtime.d.ts +1 -0
- package/dist/provider/acp/types.d.ts +31 -4
- package/dist/provider/bridge.browser.d.ts +1 -0
- package/dist/provider/bridge.d.ts +9 -1
- package/dist/provider-account/antigravity-acp/auth.d.ts +29 -0
- package/dist/provider-account/antigravity-acp/browser.d.ts +4 -0
- package/dist/provider-account/antigravity-acp/install.d.ts +42 -0
- package/dist/provider-account/antigravity-acp/lease.d.ts +23 -0
- package/dist/provider-account/antigravity-acp/lifecycle.d.ts +76 -0
- package/dist/provider-account/antigravity-acp/manifest.d.ts +76 -0
- package/dist/provider-account/antigravity-acp/profile.d.ts +4 -0
- package/dist/provider-account/capabilities.d.ts +6 -0
- package/dist/provider-account/index.d.ts +9 -1
- package/dist/provider-account/registry.d.ts +1 -1
- package/dist/provider-account/types.d.ts +9 -2
- package/dist/repository/index.js +89 -89
- package/dist/types/index.d.ts +8 -0
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { NewSessionRequest, SessionNotification, PromptResponse } from './types.js';
|
|
2
|
-
import type { ProviderUsage } from '../bridge.js';
|
|
1
|
+
import type { RequestPermissionRequest, RequestPermissionResponse, NewSessionRequest, NewSessionResponse, ResumeSessionResponse, SessionNotification, PromptResponse, InitializeResponse, ClientCapabilities } from './types.js';
|
|
2
|
+
import type { ProviderQueryOptions, ProviderUsage } from '../bridge.js';
|
|
3
3
|
import type { AcpSessionOptions, AcpOptionAction } from './types.js';
|
|
4
|
+
import type { AcpConnection } from './connection.js';
|
|
4
5
|
import type { TaskLogEntry } from '../../types/task-log.types.js';
|
|
5
6
|
export type { AcpSessionOptions, AcpOptionAction };
|
|
6
7
|
export interface AcpToolCallParsed {
|
|
@@ -27,9 +28,42 @@ export interface AcpProviderMeta {
|
|
|
27
28
|
displayName: string;
|
|
28
29
|
defaultMode?: string;
|
|
29
30
|
}
|
|
31
|
+
export type AcpPermissionPolicy = (request: RequestPermissionRequest) => RequestPermissionResponse | Promise<RequestPermissionResponse>;
|
|
32
|
+
export interface AcpSessionSelectionContext {
|
|
33
|
+
readonly connection: AcpConnection;
|
|
34
|
+
readonly sessionId: string;
|
|
35
|
+
readonly resumed: boolean;
|
|
36
|
+
readonly sessionState?: NewSessionResponse | ResumeSessionResponse;
|
|
37
|
+
readonly options: ProviderQueryOptions;
|
|
38
|
+
}
|
|
39
|
+
export interface AcpAppliedSelection {
|
|
40
|
+
readonly model?: {
|
|
41
|
+
readonly requested?: string;
|
|
42
|
+
readonly applied?: string;
|
|
43
|
+
};
|
|
44
|
+
readonly effort?: {
|
|
45
|
+
readonly requested?: string;
|
|
46
|
+
readonly applied?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export type AcpLineInterceptor = (stream: 'stdout' | 'stderr', line: string) => boolean;
|
|
30
50
|
export interface AcpProviderAdapter {
|
|
31
51
|
readonly spawn: AcpSpawnConfig;
|
|
52
|
+
readonly completionProof?: boolean;
|
|
53
|
+
readonly completionEligible?: () => boolean;
|
|
32
54
|
readonly meta?: AcpProviderMeta;
|
|
55
|
+
readonly strictOptions?: boolean;
|
|
56
|
+
readonly connectTimeoutMs?: number;
|
|
57
|
+
readonly sessionTimeoutMs?: number;
|
|
58
|
+
readonly permissionPolicy?: AcpPermissionPolicy;
|
|
59
|
+
readonly autoAuthenticate?: boolean;
|
|
60
|
+
readonly allowIdOnlyAuth?: boolean;
|
|
61
|
+
readonly sessionResume?: boolean;
|
|
62
|
+
readonly clientCapabilities?: ClientCapabilities;
|
|
63
|
+
readonly validateInitialize?: (initializeResult: InitializeResponse) => void;
|
|
64
|
+
readonly beforeSession?: (connection: AcpConnection, initializeResult: InitializeResponse, options: ProviderQueryOptions) => void | Promise<void>;
|
|
65
|
+
readonly applySessionSelection?: (context: AcpSessionSelectionContext) => Promise<AcpAppliedSelection | void>;
|
|
66
|
+
readonly interceptLine?: AcpLineInterceptor;
|
|
33
67
|
readonly npmPackage?: string;
|
|
34
68
|
readonly clientInfo?: {
|
|
35
69
|
name: string;
|
|
@@ -40,6 +74,7 @@ export interface AcpProviderAdapter {
|
|
|
40
74
|
extractUsage?(result: PromptResponse): ProviderUsage | null;
|
|
41
75
|
buildEffortAction?(effort: string, model?: string): AcpOptionAction | null;
|
|
42
76
|
buildSpawnEnv?(model: string): Record<string, string> | undefined;
|
|
77
|
+
buildTrustedSpawnEnv?(options: ProviderQueryOptions): Record<string, string> | undefined;
|
|
43
78
|
resolveMode?(mode: string): string | null;
|
|
44
79
|
readonly yoloModeId?: string;
|
|
45
80
|
parseToolCall?(event: AcpToolCallEvent): AcpToolCallParsed | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AiAccountRunBinding } from '../../../provider-account/antigravity-acp/lifecycle.js';
|
|
2
|
+
import type { AcpProviderAdapter } from '../adapter.js';
|
|
3
|
+
export declare function createAntigravityAccountAdapter(input: AiAccountRunBinding): AcpProviderAdapter;
|
|
4
|
+
export declare function resolveAntigravityAccountMode(mode: string): string | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare class AcpCompletionObserver {
|
|
2
|
+
private valid;
|
|
3
|
+
private eofObserved;
|
|
4
|
+
private sessionId;
|
|
5
|
+
private readonly pendingSessionUpdates;
|
|
6
|
+
private readonly tools;
|
|
7
|
+
private readonly pendingAgentRequests;
|
|
8
|
+
private readonly pendingClientRequests;
|
|
9
|
+
private readonly seenAgentRequestIds;
|
|
10
|
+
private readonly seenClientRequestIds;
|
|
11
|
+
observeLine(line: string): void;
|
|
12
|
+
observeOutgoingLine(line: string): void;
|
|
13
|
+
setSessionId(sessionId: string): void;
|
|
14
|
+
observeEndOfStream(): void;
|
|
15
|
+
invalidate(): void;
|
|
16
|
+
isCompleteFor(sessionId: string): boolean;
|
|
17
|
+
private observeAgentRequest;
|
|
18
|
+
private observeAgentNotification;
|
|
19
|
+
private observeAgentResponse;
|
|
20
|
+
private observeClientRequest;
|
|
21
|
+
private observeClientNotification;
|
|
22
|
+
private observeClientResponse;
|
|
23
|
+
private applySessionUpdate;
|
|
24
|
+
}
|
|
@@ -1,21 +1,39 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SetSessionConfigOptionResponse } from '@agentclientprotocol/sdk';
|
|
2
|
+
import type { NewSessionRequest, NewSessionResponse, InitializeResponse, SessionNotification, PromptResponse, ContentBlock, ResumeSessionRequest, ResumeSessionResponse, ClientCapabilities } from './types.js';
|
|
2
3
|
import { AcpProtocolError } from './types.js';
|
|
3
|
-
import type { AcpSpawnConfig } from './adapter.js';
|
|
4
|
+
import type { AcpLineInterceptor, AcpPermissionPolicy, AcpSpawnConfig } from './adapter.js';
|
|
4
5
|
export interface AcpConnectionOptions {
|
|
5
6
|
spawn: AcpSpawnConfig;
|
|
6
7
|
env?: Record<string, string>;
|
|
8
|
+
trustedEnv?: Record<string, string>;
|
|
9
|
+
unsetEnv?: readonly string[];
|
|
10
|
+
unsetEnvPrefixes?: readonly string[];
|
|
7
11
|
cwd?: string;
|
|
8
12
|
timeoutMs?: number;
|
|
13
|
+
connectTimeoutMs?: number;
|
|
14
|
+
sessionTimeoutMs?: number;
|
|
15
|
+
strictOptions?: boolean;
|
|
16
|
+
autoAuthenticate?: boolean;
|
|
17
|
+
allowIdOnlyAuth?: boolean;
|
|
18
|
+
sessionResume?: boolean;
|
|
19
|
+
clientCapabilities?: ClientCapabilities;
|
|
20
|
+
interceptLine?: AcpLineInterceptor;
|
|
21
|
+
onProtocolLine?: (line: string) => void;
|
|
22
|
+
onOutgoingProtocolLine?: (line: string) => void;
|
|
23
|
+
verifyOwnedProcessGroup?: boolean;
|
|
24
|
+
signal?: AbortSignal;
|
|
9
25
|
idleMs?: number;
|
|
10
26
|
onStderr?: (line: string) => void;
|
|
11
27
|
onPid?: (pid: number) => void;
|
|
12
28
|
configOptions?: Record<string, string>;
|
|
29
|
+
permissionPolicy?: AcpPermissionPolicy;
|
|
13
30
|
}
|
|
14
31
|
export declare class AcpConnection {
|
|
15
32
|
private readonly options;
|
|
16
33
|
private proc;
|
|
17
34
|
private sdkConnection;
|
|
18
35
|
private disposed;
|
|
36
|
+
private disposePromise;
|
|
19
37
|
private stderrBuffer;
|
|
20
38
|
private collectedStderr;
|
|
21
39
|
private stderrDecoder;
|
|
@@ -25,9 +43,23 @@ export declare class AcpConnection {
|
|
|
25
43
|
private idleReject;
|
|
26
44
|
private idlePromise;
|
|
27
45
|
private authMethods;
|
|
46
|
+
private effectiveEnv;
|
|
28
47
|
private _initResponse;
|
|
48
|
+
private stdoutDecoder;
|
|
49
|
+
private stdoutLineBuffer;
|
|
50
|
+
private outgoingDecoder;
|
|
51
|
+
private outgoingLineBuffer;
|
|
52
|
+
private _stdoutTailObserved;
|
|
53
|
+
private stdoutTailDone;
|
|
54
|
+
private readonly stdoutTailPromise;
|
|
55
|
+
private resolveStdoutTail;
|
|
56
|
+
private processClosePromise;
|
|
57
|
+
private ownedProcessGroupId;
|
|
58
|
+
private _ownedProcessGroupDisposed;
|
|
29
59
|
get initResponse(): InitializeResponse | null;
|
|
30
60
|
constructor(options: AcpConnectionOptions);
|
|
61
|
+
get ownedProcessGroupDisposed(): boolean;
|
|
62
|
+
get stdoutTailObserved(): boolean;
|
|
31
63
|
connect(clientInfo?: {
|
|
32
64
|
name: string;
|
|
33
65
|
version: string;
|
|
@@ -37,14 +69,42 @@ export declare class AcpConnection {
|
|
|
37
69
|
private newSessionWithTimeout;
|
|
38
70
|
newSessionRaw(params: NewSessionRequest): Promise<NewSessionResponse>;
|
|
39
71
|
private newSessionRawTimeout;
|
|
72
|
+
resumeSession(params: ResumeSessionRequest): Promise<string>;
|
|
73
|
+
resumeSessionRaw(params: ResumeSessionRequest): Promise<ResumeSessionResponse>;
|
|
74
|
+
private resumeSessionRawTimeout;
|
|
75
|
+
getAuthMethods(): Array<{
|
|
76
|
+
id: string;
|
|
77
|
+
name?: string;
|
|
78
|
+
type?: string;
|
|
79
|
+
}>;
|
|
80
|
+
authenticate(methodId: string, options?: {
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
logout(options?: {
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
private withProcessReply;
|
|
40
87
|
private isAuthError;
|
|
41
88
|
private tryAuthenticate;
|
|
42
89
|
private hasEnvVarsFor;
|
|
90
|
+
private hasResumeCapability;
|
|
91
|
+
private createAuthRequiredError;
|
|
92
|
+
private assertCanOperate;
|
|
93
|
+
private withSignal;
|
|
94
|
+
private withTimeoutAndSignal;
|
|
95
|
+
private shouldConsumeLine;
|
|
96
|
+
private consumeStdoutText;
|
|
97
|
+
private finishStdoutTail;
|
|
98
|
+
private consumeOutgoingText;
|
|
99
|
+
private consumeStderrText;
|
|
100
|
+
private emitStderrLine;
|
|
43
101
|
setModel(sessionId: string, modelId: string): Promise<void>;
|
|
44
102
|
setMode(sessionId: string, modeId: string): Promise<void>;
|
|
45
|
-
setConfigOption(sessionId: string, configId: string, value: string): Promise<
|
|
103
|
+
setConfigOption(sessionId: string, configId: string, value: string): Promise<SetSessionConfigOptionResponse>;
|
|
46
104
|
prompt(sessionId: string, promptBlocks: ContentBlock[], onUpdate?: (notification: SessionNotification) => void, timeoutMs?: number): Promise<PromptResponse>;
|
|
47
105
|
dispose(): Promise<void>;
|
|
106
|
+
private disposeResources;
|
|
107
|
+
private disposeOwnedProcessGroup;
|
|
48
108
|
get isConnected(): boolean;
|
|
49
109
|
}
|
|
50
110
|
export { AcpProtocolError };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { AcpProtocolError } from './types.js';
|
|
2
|
-
export type { AcpSessionOptions, InitializeRequest, InitializeResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, SessionNotification, SessionUpdate, ContentBlock, McpServer, } from './types.js';
|
|
3
|
-
export type { AcpProviderAdapter, AcpProviderMeta, AcpSpawnConfig } from './adapter.js';
|
|
1
|
+
export { AcpAbortError, AcpAuthMethodError, AcpAuthRequiredError, AcpCapabilityError, AcpOptionError, AcpProtocolError, } from './types.js';
|
|
2
|
+
export type { AcpSessionOptions, AcpProtocolErrorReason, ClientCapabilities, InitializeRequest, InitializeResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ResumeSessionRequest, ResumeSessionResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification, SessionUpdate, ContentBlock, McpServer, } from './types.js';
|
|
3
|
+
export type { AcpAppliedSelection, AcpLineInterceptor, AcpPermissionPolicy, AcpProviderAdapter, AcpProviderMeta, AcpSessionSelectionContext, AcpSpawnConfig, } from './adapter.js';
|
|
4
4
|
export { defaultExtractText, defaultParseEvent } from './adapter.js';
|
|
5
5
|
export type { AcpProviderMetaResult } from './meta.js';
|
|
6
6
|
export { queryAcpProviderMeta, queryAllAcpProviderMetas } from './meta.js';
|
|
@@ -7,6 +7,7 @@ export declare class AcpProviderRuntime implements ProviderRuntime {
|
|
|
7
7
|
execute(message: string, options?: ProviderQueryOptions): Promise<string>;
|
|
8
8
|
dispose(): Promise<void>;
|
|
9
9
|
private runPrompt;
|
|
10
|
+
private awaitWithSignal;
|
|
10
11
|
private applySessionOptions;
|
|
11
12
|
private composePrompt;
|
|
12
13
|
private handleUpdate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InitializeRequest, InitializeResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, SessionNotification, SessionUpdate, ContentBlock, McpServer, ClientCapabilities } from '@agentclientprotocol/sdk';
|
|
2
|
-
export type { InitializeRequest, InitializeResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, SessionNotification, SessionUpdate, ContentBlock, McpServer, ClientCapabilities, };
|
|
1
|
+
import type { InitializeRequest, InitializeResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ResumeSessionRequest, ResumeSessionResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification, SessionUpdate, ContentBlock, McpServer, ClientCapabilities } from '@agentclientprotocol/sdk';
|
|
2
|
+
export type { InitializeRequest, InitializeResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ResumeSessionRequest, ResumeSessionResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification, SessionUpdate, ContentBlock, McpServer, ClientCapabilities, };
|
|
3
3
|
export interface AcpSessionOptions {
|
|
4
4
|
cwd?: string;
|
|
5
5
|
env?: Record<string, string>;
|
|
@@ -16,9 +16,36 @@ export type AcpOptionAction = {
|
|
|
16
16
|
type: 'set_model';
|
|
17
17
|
modelId: string;
|
|
18
18
|
};
|
|
19
|
+
export type AcpProtocolErrorReason = 'connect_timeout' | 'session_timeout' | 'resume_unsupported' | 'auth_required' | 'auth_method_unsupported' | 'aborted';
|
|
19
20
|
export declare class AcpProtocolError extends Error {
|
|
20
21
|
readonly code?: number | undefined;
|
|
21
22
|
readonly data?: unknown | undefined;
|
|
22
|
-
readonly
|
|
23
|
-
|
|
23
|
+
readonly reason?: AcpProtocolErrorReason | undefined;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
constructor(message: string, code?: number | undefined, data?: unknown | undefined, reason?: AcpProtocolErrorReason | undefined);
|
|
26
|
+
}
|
|
27
|
+
export declare class AcpAuthRequiredError extends AcpProtocolError {
|
|
28
|
+
readonly name = "AcpAuthRequiredError";
|
|
29
|
+
readonly methodIds: readonly string[];
|
|
30
|
+
constructor(methodIds: readonly string[]);
|
|
31
|
+
}
|
|
32
|
+
export declare class AcpAuthMethodError extends AcpProtocolError {
|
|
33
|
+
readonly name = "AcpAuthMethodError";
|
|
34
|
+
constructor();
|
|
35
|
+
}
|
|
36
|
+
export declare class AcpCapabilityError extends AcpProtocolError {
|
|
37
|
+
readonly capability: 'session.resume' | 'auth.logout';
|
|
38
|
+
readonly name = "AcpCapabilityError";
|
|
39
|
+
constructor(capability: 'session.resume' | 'auth.logout');
|
|
40
|
+
}
|
|
41
|
+
export declare class AcpAbortError extends AcpProtocolError {
|
|
42
|
+
readonly name = "AcpAbortError";
|
|
43
|
+
constructor();
|
|
44
|
+
}
|
|
45
|
+
export declare class AcpOptionError extends AcpProtocolError {
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly option: 'model' | 'mode' | 'config';
|
|
48
|
+
readonly requestedValue: string;
|
|
49
|
+
readonly supportedValues?: readonly string[];
|
|
50
|
+
constructor(option: 'model' | 'mode' | 'config', requestedValue: string, supportedValues?: readonly string[], reason?: string);
|
|
24
51
|
}
|
|
@@ -43,7 +43,7 @@ export declare class ClientToolCallRequiredError extends Error {
|
|
|
43
43
|
readonly name = "ClientToolCallRequiredError";
|
|
44
44
|
constructor(toolCall: ClientToolCall, continuationState: ContinuationState);
|
|
45
45
|
}
|
|
46
|
-
export type ProviderFactory = (id: string, providerStr: string) => ProviderRuntime;
|
|
46
|
+
export type ProviderFactory = (id: string, providerStr: string, context?: unknown) => ProviderRuntime;
|
|
47
47
|
export type AdditionalArgsProvider = (ctx: {
|
|
48
48
|
providerStr: string;
|
|
49
49
|
providerId: string;
|
|
@@ -58,6 +58,7 @@ export interface ProviderUsage {
|
|
|
58
58
|
complete?: boolean;
|
|
59
59
|
}
|
|
60
60
|
export interface ProviderQueryOptions {
|
|
61
|
+
signal?: AbortSignal;
|
|
61
62
|
model?: string;
|
|
62
63
|
effort?: string;
|
|
63
64
|
mode?: string;
|
|
@@ -68,6 +69,11 @@ export interface ProviderQueryOptions {
|
|
|
68
69
|
resumeSessionId?: string;
|
|
69
70
|
providerSessionId?: string;
|
|
70
71
|
onProviderSessionId?: (id: string) => void;
|
|
72
|
+
onAcpCompletionProof?: (proof: {
|
|
73
|
+
sessionId: string;
|
|
74
|
+
stopReason: 'end_turn';
|
|
75
|
+
lifecycleComplete: true;
|
|
76
|
+
}) => void;
|
|
71
77
|
onSpawn?: () => void;
|
|
72
78
|
onOutput?: (line: string, level: 'stdout' | 'stderr') => void;
|
|
73
79
|
onPid?: (pid: number) => void;
|
|
@@ -78,6 +84,7 @@ export interface ProviderQueryOptions {
|
|
|
78
84
|
onTaskLog?: (entries: import('../types/task-log.types').TaskLogEntry[]) => void;
|
|
79
85
|
env?: Record<string, string>;
|
|
80
86
|
unsetEnv?: readonly string[];
|
|
87
|
+
unsetEnvPrefixes?: readonly string[];
|
|
81
88
|
onRateLimitObserved?: (windows: ProviderRateLimitWindows) => void;
|
|
82
89
|
cwd?: string;
|
|
83
90
|
timeoutMs?: number;
|
|
@@ -97,6 +104,7 @@ export interface ProviderRuntime {
|
|
|
97
104
|
dispose?(): Promise<void>;
|
|
98
105
|
}
|
|
99
106
|
export declare function createProvider(providerStr: string, additionalArgsProvider?: AdditionalArgsProvider): ProviderRuntime;
|
|
107
|
+
export declare function createProviderWithContext(providerStr: string, additionalArgsProvider?: AdditionalArgsProvider, context?: unknown): ProviderRuntime;
|
|
100
108
|
export declare function mergeAdditionalArgs(options: ProviderQueryOptions | undefined, provider: AdditionalArgsProvider | undefined, ctx: {
|
|
101
109
|
providerStr: string;
|
|
102
110
|
providerId: string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AcpConnection } from '../../provider/acp/connection.js';
|
|
2
|
+
import type { AcpLineInterceptor } from '../../provider/acp/adapter.js';
|
|
3
|
+
import type { InitializeResponse } from '../../provider/acp/types.js';
|
|
4
|
+
import { AiAccountError } from '../types.js';
|
|
5
|
+
import type { AiAccountErrorCode } from '../types.js';
|
|
6
|
+
export type AntigravityAuthPromptMode = 'interactive' | 'noninteractive';
|
|
7
|
+
export interface AntigravityAuthPromptObserver {
|
|
8
|
+
readonly mode: AntigravityAuthPromptMode;
|
|
9
|
+
readonly interceptLine: AcpLineInterceptor;
|
|
10
|
+
readonly authorizationUrl: string | null;
|
|
11
|
+
readonly failureCode: 'ACCOUNT_NOT_SIGNED_IN' | 'ACCOUNT_LOGIN_FAILED' | 'ACCOUNT_LOGIN_UNSUPPORTED_POLICY' | null;
|
|
12
|
+
readonly browserSuppressionObserved: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface CreateAntigravityAuthPromptObserverOptions {
|
|
15
|
+
mode: AntigravityAuthPromptMode;
|
|
16
|
+
controller: AbortController;
|
|
17
|
+
onAuthorizationUrl?: (url: string) => void;
|
|
18
|
+
onBrowserSuppression?: () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function parseAntigravityAuthorizationUrl(value: string): string;
|
|
21
|
+
export declare function redactOAuthText(value: string): string;
|
|
22
|
+
export declare function createAntigravityAuthPromptObserver(options: CreateAntigravityAuthPromptObserverOptions): AntigravityAuthPromptObserver;
|
|
23
|
+
export declare function validateAntigravityInitialize(result: InitializeResponse | null | undefined, options?: {
|
|
24
|
+
requireLogout?: boolean;
|
|
25
|
+
}): asserts result is InitializeResponse;
|
|
26
|
+
export declare function authenticateAntigravityAcpConnection(connection: AcpConnection, observer: AntigravityAuthPromptObserver, options?: {
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
export declare function accountError(code: AiAccountErrorCode): AiAccountError;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const ANTIGRAVITY_BROWSER_SUPPRESSION_MARKER = "__CREWX_AGY_BROWSER_SUPPRESSED__";
|
|
2
|
+
export declare const ANTIGRAVITY_BROWSER_SUPPRESSION_SCRIPT = "#!/bin/sh\nprintf '%s\\n' '__CREWX_AGY_BROWSER_SUPPRESSED__' >&2\nexit 0\n";
|
|
3
|
+
export declare function createBrowserSuppressionHelper(directory: string): string;
|
|
4
|
+
export declare function isSupportedBrowserHelperPath(helperPath: string): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type AiAccountProvider } from '../types';
|
|
2
|
+
import { type AntigravityAcpDistribution } from './manifest';
|
|
3
|
+
export type AiAccountRuntimeStatusReason = 'unsupported_platform' | 'not_installed' | 'digest_mismatch' | 'helper_path_unsupported';
|
|
4
|
+
export interface AiAccountRuntimeStatus {
|
|
5
|
+
installed: boolean;
|
|
6
|
+
version?: string;
|
|
7
|
+
platformSupported: boolean;
|
|
8
|
+
reason?: AiAccountRuntimeStatusReason;
|
|
9
|
+
}
|
|
10
|
+
export type AiAccountRuntimeInstallPhase = 'download' | 'verify' | 'extract' | 'finalize';
|
|
11
|
+
export interface AiAccountRuntimeInstallProgress {
|
|
12
|
+
phase: AiAccountRuntimeInstallPhase;
|
|
13
|
+
receivedBytes?: number;
|
|
14
|
+
totalBytes?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface InstallAiAccountRuntimeOptions {
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
onProgress?: (progress: AiAccountRuntimeInstallProgress) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface TrustedAiAccountRuntimePaths {
|
|
21
|
+
command: string;
|
|
22
|
+
args: string[];
|
|
23
|
+
harnessPath: string;
|
|
24
|
+
browserHelper: string;
|
|
25
|
+
browserSetting: string;
|
|
26
|
+
version: string;
|
|
27
|
+
}
|
|
28
|
+
export interface RuntimeInstallDependencies {
|
|
29
|
+
homeDir: string;
|
|
30
|
+
distribution: AntigravityAcpDistribution;
|
|
31
|
+
fetcher: typeof fetch;
|
|
32
|
+
}
|
|
33
|
+
export declare function getAiAccountRuntimeStatus(provider: AiAccountProvider): AiAccountRuntimeStatus;
|
|
34
|
+
export declare function installAiAccountRuntime(provider: AiAccountProvider, options?: InstallAiAccountRuntimeOptions): Promise<AiAccountRuntimeStatus & {
|
|
35
|
+
installed: true;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function resolveInstalledAiAccountRuntime(provider: AiAccountProvider): TrustedAiAccountRuntimePaths;
|
|
38
|
+
export declare function getAiAccountRuntimeStatusAt(provider: AiAccountProvider, homeDir: string, platform: string, architecture: string, distributionOverride?: AntigravityAcpDistribution): AiAccountRuntimeStatus;
|
|
39
|
+
export declare function resolveInstalledAiAccountRuntimeAt(provider: AiAccountProvider, homeDir: string, distribution: AntigravityAcpDistribution): TrustedAiAccountRuntimePaths;
|
|
40
|
+
export declare function installAiAccountRuntimeWithDependencies(provider: AiAccountProvider, options: InstallAiAccountRuntimeOptions, dependencies: RuntimeInstallDependencies): Promise<AiAccountRuntimeStatus & {
|
|
41
|
+
installed: true;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type AntigravityAuthRecord = Readonly<{
|
|
2
|
+
epoch: string;
|
|
3
|
+
state: 'stable' | 'login';
|
|
4
|
+
}>;
|
|
5
|
+
export type AntigravityProfileLeaseErrorCode = 'INVALID_PROFILE_DIR' | 'INVALID_TASK_ID' | 'AUTH_REQUIRED' | 'AUTH_INCOMPLETE' | 'AUTH_RECORD_INVALID' | 'AUTH_EPOCH_CHANGED' | 'AUTH_EPOCH_MISMATCH' | 'AUTHENTICATION_NOT_BEGUN' | 'PROFILE_BUSY' | 'LOCK_INVALID' | 'LOCK_UNVERIFIABLE' | 'OWNERSHIP_MISMATCH' | 'LEASE_RELEASED' | 'IO_ERROR';
|
|
6
|
+
export declare class AntigravityProfileLeaseError extends Error {
|
|
7
|
+
readonly code: AntigravityProfileLeaseErrorCode;
|
|
8
|
+
constructor(code: AntigravityProfileLeaseErrorCode, message: string, cause?: unknown);
|
|
9
|
+
}
|
|
10
|
+
export type AntigravityRunLease = Readonly<{
|
|
11
|
+
epoch: string;
|
|
12
|
+
release: () => Promise<void>;
|
|
13
|
+
}>;
|
|
14
|
+
export type AntigravityExclusiveProfileLease = Readonly<{
|
|
15
|
+
beginAuthentication: () => Promise<string>;
|
|
16
|
+
commitAuthentication: (epoch: string) => Promise<void>;
|
|
17
|
+
commitLogout: (epoch: string) => Promise<void>;
|
|
18
|
+
release: () => Promise<void>;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function readAuthRecord(accountDir: string): Promise<AntigravityAuthRecord | null>;
|
|
21
|
+
export declare function acquireRunLease(accountDir: string, taskId: string): Promise<AntigravityRunLease>;
|
|
22
|
+
export declare function acquireExclusiveProfileLease(accountDir: string): Promise<AntigravityExclusiveProfileLease>;
|
|
23
|
+
export declare function assertProfileIdle(accountDir: string): Promise<void>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { AcpConnection } from '../../provider/acp/connection.js';
|
|
2
|
+
import type { AcpConnectionOptions } from '../../provider/acp/connection.js';
|
|
3
|
+
import type { AcpSpawnConfig } from '../../provider/acp/adapter.js';
|
|
4
|
+
import { removeAiAccount } from '../accounts.js';
|
|
5
|
+
import { type TrustedAiAccountRuntimePaths } from './install.js';
|
|
6
|
+
import { type AiAccountErrorCode, type ResolvedAiAccount } from '../types.js';
|
|
7
|
+
export type AiAccountRuntimeKind = 'native' | 'acp';
|
|
8
|
+
export type AiAccountState = 'signed-in' | 'signed-out' | 'runtime-missing' | 'login-in-progress' | 'login-incomplete' | 'error';
|
|
9
|
+
export type AntigravityAccountErrorCode = AiAccountErrorCode;
|
|
10
|
+
export interface AiAccountStatus {
|
|
11
|
+
accountId: string;
|
|
12
|
+
state: AiAccountState;
|
|
13
|
+
authEpoch?: string;
|
|
14
|
+
runtimeVersion?: string;
|
|
15
|
+
code?: AntigravityAccountErrorCode;
|
|
16
|
+
}
|
|
17
|
+
export interface AiAccountLoginResult {
|
|
18
|
+
state: 'signed-in';
|
|
19
|
+
authEpoch: string;
|
|
20
|
+
browserSuppressionObserved: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AiAccountLoginHandle {
|
|
23
|
+
readonly accountId: string;
|
|
24
|
+
readonly authorizationUrl: Promise<string | null>;
|
|
25
|
+
readonly done: Promise<AiAccountLoginResult>;
|
|
26
|
+
cancel(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export interface AiAccountRunBinding {
|
|
29
|
+
readonly accountId: string;
|
|
30
|
+
readonly runtime: 'acp';
|
|
31
|
+
readonly runtimeVersion: string;
|
|
32
|
+
readonly authEpoch: string;
|
|
33
|
+
readonly spawn: AcpSpawnConfig;
|
|
34
|
+
readonly env: Record<string, string>;
|
|
35
|
+
readonly unsetEnv: string[];
|
|
36
|
+
readonly unsetEnvPrefixes: string[];
|
|
37
|
+
release(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export interface AiAccountResumeMetadata {
|
|
40
|
+
authEpoch?: string;
|
|
41
|
+
runtime?: string;
|
|
42
|
+
runtimeVersion?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface AntigravityAccountServiceDependencies {
|
|
45
|
+
resolveRuntime?: () => TrustedAiAccountRuntimePaths;
|
|
46
|
+
createConnection?: (options: AcpConnectionOptions) => AcpConnection;
|
|
47
|
+
}
|
|
48
|
+
export interface AiAccountLifecycleOptions {
|
|
49
|
+
signal?: AbortSignal;
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function createAntigravityAccountService(dependencies?: AntigravityAccountServiceDependencies): {
|
|
53
|
+
getAiAccountStatus: (accountId: string, options?: AiAccountLifecycleOptions) => Promise<AiAccountStatus>;
|
|
54
|
+
startAiAccountLogin: (accountId: string, options?: AiAccountLifecycleOptions) => Promise<AiAccountLoginHandle>;
|
|
55
|
+
logoutAiAccount: (accountId: string) => Promise<void>;
|
|
56
|
+
assertAiAccountIdle: (accountId: string) => Promise<void>;
|
|
57
|
+
withAiAccountExclusive: <T>(accountId: string, operation: () => T | Promise<T>) => Promise<T>;
|
|
58
|
+
removeAiAccountGuarded: (accountId: string) => Promise<ReturnType<typeof removeAiAccount>>;
|
|
59
|
+
bindAiAccountRun: (input: {
|
|
60
|
+
account: ResolvedAiAccount;
|
|
61
|
+
taskId: string;
|
|
62
|
+
resume?: AiAccountResumeMetadata;
|
|
63
|
+
}) => Promise<AiAccountRunBinding>;
|
|
64
|
+
};
|
|
65
|
+
export declare const getAiAccountStatus: (accountId: string, options?: AiAccountLifecycleOptions) => Promise<AiAccountStatus>;
|
|
66
|
+
export declare const startAiAccountLogin: (accountId: string, options?: AiAccountLifecycleOptions) => Promise<AiAccountLoginHandle>;
|
|
67
|
+
export declare const logoutAiAccount: (accountId: string) => Promise<void>;
|
|
68
|
+
export declare const assertAiAccountIdle: (accountId: string) => Promise<void>;
|
|
69
|
+
export declare const withAiAccountExclusive: <T>(accountId: string, operation: () => T | Promise<T>) => Promise<T>;
|
|
70
|
+
export declare const removeAiAccountGuarded: (accountId: string) => Promise<ReturnType<typeof removeAiAccount>>;
|
|
71
|
+
export declare const bindAiAccountRun: (input: {
|
|
72
|
+
account: ResolvedAiAccount;
|
|
73
|
+
taskId: string;
|
|
74
|
+
resume?: AiAccountResumeMetadata;
|
|
75
|
+
}) => Promise<AiAccountRunBinding>;
|
|
76
|
+
export declare function requireActiveAiAccountRunBinding(value: unknown): AiAccountRunBinding;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const ANTIGRAVITY_ACP_VERSION: "1.4.3";
|
|
2
|
+
export interface AntigravityAcpDistribution {
|
|
3
|
+
platform: 'darwin' | 'linux' | 'win32';
|
|
4
|
+
architecture: 'arm64' | 'x64';
|
|
5
|
+
archiveUrl: string;
|
|
6
|
+
command: string;
|
|
7
|
+
args: readonly string[];
|
|
8
|
+
sha256: string;
|
|
9
|
+
archiveBytes?: number;
|
|
10
|
+
expectedMembers: readonly string[];
|
|
11
|
+
supported: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const ANTIGRAVITY_ACP_DISTRIBUTIONS: {
|
|
14
|
+
readonly 'darwin-arm64': {
|
|
15
|
+
readonly platform: "darwin";
|
|
16
|
+
readonly architecture: "arm64";
|
|
17
|
+
readonly archiveUrl: "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.4.3-darwin-arm64.zip";
|
|
18
|
+
readonly command: "./agy_acp_server.par";
|
|
19
|
+
readonly args: readonly [];
|
|
20
|
+
readonly sha256: "c57db0a9b8b712daa9c3c17cdb990a61842ea569f279e8bd79d7aa85a303b20b";
|
|
21
|
+
readonly archiveBytes: 114147623;
|
|
22
|
+
readonly expectedMembers: readonly ["agy_acp_server.par", "localharness_external"];
|
|
23
|
+
readonly supported: true;
|
|
24
|
+
};
|
|
25
|
+
readonly 'darwin-x64': {
|
|
26
|
+
readonly platform: "darwin";
|
|
27
|
+
readonly architecture: "x64";
|
|
28
|
+
readonly archiveUrl: "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.4.3-darwin-x86_64.zip";
|
|
29
|
+
readonly command: "./agy_acp_server.par";
|
|
30
|
+
readonly args: readonly [];
|
|
31
|
+
readonly sha256: "9392dbbdad7f0663dbfb5a0bf641297b0cf80d2ee9cd2d49a616bbbc7378731d";
|
|
32
|
+
readonly expectedMembers: readonly ["agy_acp_server.par", "localharness_external"];
|
|
33
|
+
readonly supported: true;
|
|
34
|
+
};
|
|
35
|
+
readonly 'linux-x64': {
|
|
36
|
+
readonly platform: "linux";
|
|
37
|
+
readonly architecture: "x64";
|
|
38
|
+
readonly archiveUrl: "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.4.3-linux-x86_64.zip";
|
|
39
|
+
readonly command: "./agy_acp_server.par";
|
|
40
|
+
readonly args: readonly ["--uid="];
|
|
41
|
+
readonly sha256: "0634ce5306ba92c932945455e7a83fda78e2d99c33fa8aa6ee0566206a382714";
|
|
42
|
+
readonly expectedMembers: readonly ["agy_acp_server.par", "localharness_external"];
|
|
43
|
+
readonly supported: true;
|
|
44
|
+
};
|
|
45
|
+
readonly 'linux-arm64': {
|
|
46
|
+
readonly platform: "linux";
|
|
47
|
+
readonly architecture: "arm64";
|
|
48
|
+
readonly archiveUrl: "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.4.3-linux-arm64.zip";
|
|
49
|
+
readonly command: "./agy_acp_server.par";
|
|
50
|
+
readonly args: readonly ["--uid="];
|
|
51
|
+
readonly sha256: "05c153443b0b1175151c760eeddea538950bc9843e317d54786a1f03670182bc";
|
|
52
|
+
readonly expectedMembers: readonly ["agy_acp_server.par", "localharness_external"];
|
|
53
|
+
readonly supported: true;
|
|
54
|
+
};
|
|
55
|
+
readonly 'win32-x64': {
|
|
56
|
+
readonly platform: "win32";
|
|
57
|
+
readonly architecture: "x64";
|
|
58
|
+
readonly archiveUrl: "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.4.3-windows-x86_64.zip";
|
|
59
|
+
readonly command: "./agy_acp_server.exe";
|
|
60
|
+
readonly args: readonly [];
|
|
61
|
+
readonly sha256: "54c2e16378d9a4952e1da70e355f3c33c4f284308d6de48ab3e6e34a127bd325";
|
|
62
|
+
readonly expectedMembers: readonly [];
|
|
63
|
+
readonly supported: false;
|
|
64
|
+
};
|
|
65
|
+
readonly 'win32-arm64': {
|
|
66
|
+
readonly platform: "win32";
|
|
67
|
+
readonly architecture: "arm64";
|
|
68
|
+
readonly archiveUrl: "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.4.3-windows-arm64.zip";
|
|
69
|
+
readonly command: "./agy_acp_server.exe";
|
|
70
|
+
readonly args: readonly [];
|
|
71
|
+
readonly sha256: "fcd46431ad33d3b510ce0b98fe7b43d095bd8b3f1c363ee2d57faa7ee981c7bb";
|
|
72
|
+
readonly expectedMembers: readonly [];
|
|
73
|
+
readonly supported: false;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export declare function getAntigravityAcpDistribution(platform: string, architecture: string): AntigravityAcpDistribution | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AiAccountEnvPlan } from '../types';
|
|
2
|
+
export declare const ANTIGRAVITY_ACCOUNT_STRIPPED_ENV: readonly ["GEMINI_API_KEY", "GOOGLE_API_KEY", "GOOGLE_APPLICATION_CREDENTIALS", "GOOGLE_CLOUD_PROJECT", "GOOGLE_CLOUD_LOCATION", "GOOGLE_CLOUD_QUOTA_PROJECT", "GOOGLE_GENAI_USE_VERTEXAI", "GCLOUD_PROJECT", "CLOUDSDK_CORE_PROJECT", "AGY_ADC_AUTH", "GEMINI_BASE_URL", "JETSKI_OAUTH_TOKEN"];
|
|
3
|
+
export declare const ANTIGRAVITY_ACCOUNT_STRIPPED_ENV_PREFIXES: readonly ["AGY_ACP_"];
|
|
4
|
+
export declare function antigravityAccountEnvPlan(accountDir: string): AiAccountEnvPlan;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export { addAiAccount, applyAiAccountEnv, aiAccountEnvPlan, getLoginInvocation, getStatusInvocation, listAiAccounts, removeAiAccount, resolveAiAccountForRun, setActiveAiAccount, } from './accounts';
|
|
2
|
+
export { getAiAccountCapabilities } from './capabilities';
|
|
3
|
+
export { ANTIGRAVITY_ACCOUNT_STRIPPED_ENV, ANTIGRAVITY_ACCOUNT_STRIPPED_ENV_PREFIXES, antigravityAccountEnvPlan, } from './antigravity-acp/profile';
|
|
4
|
+
export { ANTIGRAVITY_ACP_DISTRIBUTIONS, ANTIGRAVITY_ACP_VERSION, } from './antigravity-acp/manifest';
|
|
5
|
+
export { getAiAccountRuntimeStatus, installAiAccountRuntime, } from './antigravity-acp/install';
|
|
6
|
+
export type { AiAccountRuntimeInstallPhase, AiAccountRuntimeInstallProgress, AiAccountRuntimeStatus, AiAccountRuntimeStatusReason, InstallAiAccountRuntimeOptions, } from './antigravity-acp/install';
|
|
7
|
+
export type { AntigravityAcpDistribution } from './antigravity-acp/manifest';
|
|
8
|
+
export { assertAiAccountIdle, bindAiAccountRun, getAiAccountStatus, logoutAiAccount, removeAiAccountGuarded, startAiAccountLogin, withAiAccountExclusive, } from './antigravity-acp/lifecycle';
|
|
9
|
+
export type { AiAccountLifecycleOptions, AiAccountLoginHandle, AiAccountLoginResult, AiAccountResumeMetadata, AiAccountRunBinding, AiAccountRuntimeKind, AiAccountState, AiAccountStatus, AntigravityAccountErrorCode, } from './antigravity-acp/lifecycle';
|
|
2
10
|
export { defaultAiAccountDir, loadProviderAccountsRegistry, providerAccountsRegistryPath, providerAccountsRoot, } from './registry';
|
|
3
11
|
export type { ProviderAccountsRegistry, RemovedAiAccount, StoredAiAccount, } from './registry';
|
|
4
12
|
export { AI_ACCOUNT_PROVIDERS, AiAccountError, CLAUDE_ACCOUNT_STRIPPED_ENV, DEFAULT_AI_ACCOUNT_ID, } from './types';
|
|
5
|
-
export type { AddedAiAccount, AiAccountEnvPlan, AiAccountErrorCode, AiAccountInvocation, AiAccountProvider, AiAccountSummary, ResolveAiAccountInput, ResolvedAiAccount, } from './types';
|
|
13
|
+
export type { AddedAiAccount, AiAccountEnvPlan, AiAccountErrorCode, AiAccountInvocation, AiAccountLoginKind, AiAccountProvider, AiAccountRuntime, AiAccountSummary, ResolveAiAccountInput, ResolvedAiAccount, } from './types';
|