@crewx/sdk 0.8.3-rc.9 → 0.8.4-rc.0
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 +46 -59
- package/dist/facade/Crewx.d.ts +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +46 -59
- package/dist/provider/acp/adapter.d.ts +43 -0
- package/dist/provider/acp/adapters/claude.d.ts +2 -0
- package/dist/provider/acp/adapters/codex.d.ts +2 -0
- package/dist/provider/acp/adapters/copilot.d.ts +2 -0
- package/dist/provider/acp/adapters/gemini.d.ts +2 -0
- package/dist/provider/acp/adapters/index.d.ts +7 -0
- package/dist/provider/acp/adapters/opencode.d.ts +2 -0
- package/dist/provider/acp/connection.d.ts +39 -0
- package/dist/provider/acp/index.d.ts +9 -0
- package/dist/provider/acp/register.d.ts +2 -0
- package/dist/provider/acp/runtime.d.ts +16 -0
- package/dist/provider/acp/types.d.ts +24 -0
- package/dist/provider/bridge.d.ts +5 -1
- package/dist/provider/{adapter.types.d.ts → cli/adapter.types.d.ts} +2 -2
- package/dist/provider/{adapters → cli/adapters}/agent-call.util.d.ts +1 -1
- package/dist/provider/{adapters → cli/adapters}/index.d.ts +1 -1
- package/dist/provider/cli/index.d.ts +3 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +22 -1
- /package/dist/provider/{adapters → cli/adapters}/claude.d.ts +0 -0
- /package/dist/provider/{adapters → cli/adapters}/codex.d.ts +0 -0
- /package/dist/provider/{adapters → cli/adapters}/copilot.d.ts +0 -0
- /package/dist/provider/{adapters → cli/adapters}/gemini.d.ts +0 -0
- /package/dist/provider/{adapters → cli/adapters}/opencode.d.ts +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { NewSessionRequest, SessionNotification, PromptResponse } from './types.js';
|
|
2
|
+
import type { ProviderUsage } from '../bridge.js';
|
|
3
|
+
import type { AcpSessionOptions, AcpOptionAction } from './types.js';
|
|
4
|
+
import type { TaskLogEntry } from '../../types/task-log.types.js';
|
|
5
|
+
export type { AcpSessionOptions, AcpOptionAction };
|
|
6
|
+
export interface AcpToolCallParsed {
|
|
7
|
+
toolName?: string;
|
|
8
|
+
toolInput?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AcpToolCallEvent {
|
|
11
|
+
title: string;
|
|
12
|
+
kind?: string;
|
|
13
|
+
rawInput?: unknown;
|
|
14
|
+
rawOutput?: unknown;
|
|
15
|
+
locations?: Array<{
|
|
16
|
+
path: string;
|
|
17
|
+
range?: unknown;
|
|
18
|
+
}>;
|
|
19
|
+
_meta?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface AcpSpawnConfig {
|
|
22
|
+
command: string;
|
|
23
|
+
args: string[];
|
|
24
|
+
shellOnWindows?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface AcpProviderAdapter {
|
|
27
|
+
readonly spawn: AcpSpawnConfig;
|
|
28
|
+
readonly npmPackage?: string;
|
|
29
|
+
readonly clientInfo?: {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
};
|
|
33
|
+
buildSessionParams(options: AcpSessionOptions): NewSessionRequest;
|
|
34
|
+
extractTextFromUpdate?(notification: SessionNotification): string | null;
|
|
35
|
+
extractUsage?(result: PromptResponse): ProviderUsage | null;
|
|
36
|
+
buildEffortAction?(effort: string, model?: string): AcpOptionAction | null;
|
|
37
|
+
resolveMode?(mode: string): string | null;
|
|
38
|
+
readonly yoloModeId?: string;
|
|
39
|
+
parseToolCall?(event: AcpToolCallEvent): AcpToolCallParsed | null;
|
|
40
|
+
parseEvent?(message: string, timestamp?: string): TaskLogEntry[];
|
|
41
|
+
}
|
|
42
|
+
export declare function defaultExtractText(notification: SessionNotification): string | null;
|
|
43
|
+
export declare function defaultParseEvent(message: string, timestamp?: string): TaskLogEntry[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AcpProviderAdapter } from '../adapter.js';
|
|
2
|
+
export { claudeAcpAdapter } from './claude.js';
|
|
3
|
+
export { codexAcpAdapter } from './codex.js';
|
|
4
|
+
export { geminiAcpAdapter } from './gemini.js';
|
|
5
|
+
export { copilotAcpAdapter } from './copilot.js';
|
|
6
|
+
export { opencodeAcpAdapter } from './opencode.js';
|
|
7
|
+
export declare const ACP_ADAPTERS: Record<string, AcpProviderAdapter>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { NewSessionRequest, SessionNotification, PromptResponse, ContentBlock } from './types.js';
|
|
2
|
+
import { AcpProtocolError } from './types.js';
|
|
3
|
+
import type { AcpSpawnConfig } from './adapter.js';
|
|
4
|
+
export interface AcpConnectionOptions {
|
|
5
|
+
spawn: AcpSpawnConfig;
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
cwd?: string;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
onStderr?: (line: string) => void;
|
|
10
|
+
onPid?: (pid: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class AcpConnection {
|
|
13
|
+
private readonly options;
|
|
14
|
+
private proc;
|
|
15
|
+
private sdkConnection;
|
|
16
|
+
private disposed;
|
|
17
|
+
private stderrBuffer;
|
|
18
|
+
private collectedStderr;
|
|
19
|
+
private pendingUpdateCallback;
|
|
20
|
+
private authMethods;
|
|
21
|
+
constructor(options: AcpConnectionOptions);
|
|
22
|
+
connect(clientInfo?: {
|
|
23
|
+
name: string;
|
|
24
|
+
version: string;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
private doInitialize;
|
|
27
|
+
newSession(params: NewSessionRequest): Promise<string>;
|
|
28
|
+
private newSessionWithTimeout;
|
|
29
|
+
private isAuthError;
|
|
30
|
+
private tryAuthenticate;
|
|
31
|
+
private hasEnvVarsFor;
|
|
32
|
+
setModel(sessionId: string, modelId: string): Promise<void>;
|
|
33
|
+
setMode(sessionId: string, modeId: string): Promise<void>;
|
|
34
|
+
setConfigOption(sessionId: string, configId: string, value: string): Promise<void>;
|
|
35
|
+
prompt(sessionId: string, promptBlocks: ContentBlock[], onUpdate?: (notification: SessionNotification) => void, timeoutMs?: number): Promise<PromptResponse>;
|
|
36
|
+
dispose(): Promise<void>;
|
|
37
|
+
get isConnected(): boolean;
|
|
38
|
+
}
|
|
39
|
+
export { AcpProtocolError };
|
|
@@ -0,0 +1,9 @@
|
|
|
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, AcpSpawnConfig } from './adapter.js';
|
|
4
|
+
export { defaultExtractText, defaultParseEvent } from './adapter.js';
|
|
5
|
+
export { AcpConnection } from './connection.js';
|
|
6
|
+
export type { AcpConnectionOptions } from './connection.js';
|
|
7
|
+
export { AcpProviderRuntime } from './runtime.js';
|
|
8
|
+
export { claudeAcpAdapter, codexAcpAdapter, geminiAcpAdapter, copilotAcpAdapter, opencodeAcpAdapter, ACP_ADAPTERS, } from './adapters/index.js';
|
|
9
|
+
export { registerAcpProviders } from './register.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ProviderRuntime, ProviderQueryOptions } from '../bridge.js';
|
|
2
|
+
import type { AcpProviderAdapter } from './adapter.js';
|
|
3
|
+
export declare class AcpProviderRuntime implements ProviderRuntime {
|
|
4
|
+
private readonly adapter;
|
|
5
|
+
constructor(_providerId: string, adapter: AcpProviderAdapter, _providerStr: string);
|
|
6
|
+
query(message: string, options?: ProviderQueryOptions): Promise<string>;
|
|
7
|
+
execute(message: string, options?: ProviderQueryOptions): Promise<string>;
|
|
8
|
+
dispose(): Promise<void>;
|
|
9
|
+
private runPrompt;
|
|
10
|
+
private applySessionOptions;
|
|
11
|
+
private composePrompt;
|
|
12
|
+
private handleUpdate;
|
|
13
|
+
private resolveToolCall;
|
|
14
|
+
private extractResultPreview;
|
|
15
|
+
private handleUsage;
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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, };
|
|
3
|
+
export interface AcpSessionOptions {
|
|
4
|
+
cwd?: string;
|
|
5
|
+
env?: Record<string, string>;
|
|
6
|
+
model?: string;
|
|
7
|
+
systemPrompt?: string;
|
|
8
|
+
effort?: string;
|
|
9
|
+
mode?: string;
|
|
10
|
+
}
|
|
11
|
+
export type AcpOptionAction = {
|
|
12
|
+
type: 'set_config_option';
|
|
13
|
+
configId: string;
|
|
14
|
+
value: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'set_model';
|
|
17
|
+
modelId: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class AcpProtocolError extends Error {
|
|
20
|
+
readonly code?: number | undefined;
|
|
21
|
+
readonly data?: unknown | undefined;
|
|
22
|
+
readonly name = "AcpProtocolError";
|
|
23
|
+
constructor(message: string, code?: number | undefined, data?: unknown | undefined);
|
|
24
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CliProviderAdapter } from './adapter.types.js';
|
|
1
|
+
import type { CliProviderAdapter } from './cli/adapter.types.js';
|
|
2
2
|
export declare function parseStreamJsonOutput(raw: string): string;
|
|
3
3
|
export declare function parseResultEventUsage(raw: string): ProviderUsage | null;
|
|
4
4
|
export declare class ProviderError extends Error {
|
|
@@ -54,6 +54,8 @@ export interface ProviderUsage {
|
|
|
54
54
|
}
|
|
55
55
|
export interface ProviderQueryOptions {
|
|
56
56
|
model?: string;
|
|
57
|
+
effort?: string;
|
|
58
|
+
mode?: string;
|
|
57
59
|
context?: string;
|
|
58
60
|
systemPrompt?: string;
|
|
59
61
|
additionalArgs?: string[];
|
|
@@ -63,6 +65,7 @@ export interface ProviderQueryOptions {
|
|
|
63
65
|
onUsage?: (usage: ProviderUsage) => void;
|
|
64
66
|
onExitCode?: (code: number) => void;
|
|
65
67
|
onModel?: (model: string) => void;
|
|
68
|
+
onTaskLog?: (entries: import('../types/task-log.types').TaskLogEntry[]) => void;
|
|
66
69
|
env?: Record<string, string>;
|
|
67
70
|
cwd?: string;
|
|
68
71
|
timeoutMs?: number;
|
|
@@ -77,5 +80,6 @@ export interface ProviderRuntime {
|
|
|
77
80
|
toolName: string;
|
|
78
81
|
result: unknown;
|
|
79
82
|
}>, options?: ProviderQueryOptions): Promise<string>;
|
|
83
|
+
dispose?(): Promise<void>;
|
|
80
84
|
}
|
|
81
85
|
export declare function createProvider(providerStr: string): ProviderRuntime;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProviderQueryOptions, ProviderUsage } from '
|
|
2
|
-
import type { TaskLogEntry } from '
|
|
1
|
+
import type { ProviderQueryOptions, ProviderUsage } from '../bridge.js';
|
|
2
|
+
import type { TaskLogEntry } from '../../types/task-log.types.js';
|
|
3
3
|
export interface CliProviderAdapter {
|
|
4
4
|
readonly command: string;
|
|
5
5
|
buildArgs(message: string, options: ProviderQueryOptions, isExecute: boolean): {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { TaskLogEntry } from '
|
|
1
|
+
import type { TaskLogEntry } from '../../../types/task-log.types';
|
|
2
2
|
export declare function isAgentCallCommand(command: string): boolean;
|
|
3
3
|
export declare function parseAgentCall(timestamp: string, command: string): TaskLogEntry;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CliProviderAdapter } from '../adapter.types.js';
|
|
2
|
-
import type { TaskLogEntry } from '
|
|
2
|
+
import type { TaskLogEntry } from '../../../types/task-log.types.js';
|
|
3
3
|
export { claudeAdapter } from './claude.js';
|
|
4
4
|
export { geminiAdapter } from './gemini.js';
|
|
5
5
|
export { copilotAdapter } from './copilot.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BUILTIN_ADAPTERS, parseStdoutEvent, claudeAdapter, geminiAdapter, copilotAdapter, codexAdapter, opencodeAdapter, isAgentCallCommand, parseAgentCall, } from './adapters/index.js';
|
|
2
|
+
export type { CliProviderAdapter } from './adapter.types.js';
|
|
3
|
+
export { RateLimitError } from './adapter.types.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1297,6 +1297,7 @@ export interface QueryOptions {
|
|
|
1297
1297
|
threadId?: string;
|
|
1298
1298
|
platform?: Platform;
|
|
1299
1299
|
messages?: import('../conversation/types').TemplateMessage[];
|
|
1300
|
+
vars?: Record<string, unknown>;
|
|
1300
1301
|
}
|
|
1301
1302
|
export interface QueryResult {
|
|
1302
1303
|
ok: boolean;
|
|
@@ -1327,6 +1328,7 @@ export interface ExecuteOptions {
|
|
|
1327
1328
|
threadId?: string;
|
|
1328
1329
|
platform?: Platform;
|
|
1329
1330
|
messages?: import('../conversation/types').TemplateMessage[];
|
|
1331
|
+
vars?: Record<string, unknown>;
|
|
1330
1332
|
}
|
|
1331
1333
|
export interface ExecuteResult {
|
|
1332
1334
|
ok: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewx/sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-rc.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"README.md"
|
|
70
70
|
],
|
|
71
71
|
"dependencies": {
|
|
72
|
+
"@agentclientprotocol/sdk": "^0.21.0",
|
|
72
73
|
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
73
74
|
"ai": "^4.0.0",
|
|
74
75
|
"drizzle-orm": "^0.45.2",
|
|
@@ -77,9 +78,29 @@
|
|
|
77
78
|
"zod": "^3.24.1"
|
|
78
79
|
},
|
|
79
80
|
"peerDependencies": {
|
|
81
|
+
"@agentclientprotocol/claude-agent-acp": ">=0.33.0",
|
|
82
|
+
"@agentclientprotocol/codex-acp": ">=0.0.43",
|
|
83
|
+
"@ai-sdk/anthropic": "^1.0.8",
|
|
84
|
+
"@ai-sdk/google": "^1.0.10",
|
|
85
|
+
"@ai-sdk/openai": "^1.0.11",
|
|
80
86
|
"better-sqlite3": "^12.0.0"
|
|
81
87
|
},
|
|
82
88
|
"peerDependenciesMeta": {
|
|
89
|
+
"@agentclientprotocol/claude-agent-acp": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@agentclientprotocol/codex-acp": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@ai-sdk/anthropic": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@ai-sdk/google": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"@ai-sdk/openai": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
83
104
|
"better-sqlite3": {
|
|
84
105
|
"optional": true
|
|
85
106
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|