@ai-ide-bridge/cli 1.1.1 → 1.1.2
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/.turbo/turbo-build.log +1 -1
- package/dist/commands/daemon.js +7 -4
- package/dist/core/parser.d.ts +5 -5
- package/dist/core/types.d.ts +4 -3
- package/dist/core/types.js +1 -1
- package/dist/plugins/copilot/session.js +1 -1
- package/dist/plugins/cursor/session.js +5 -1
- package/package.json +2 -1
- package/src/commands/daemon.ts +7 -9
- package/src/core/types.ts +2 -1
- package/src/plugins/copilot/session.ts +1 -1
- package/src/plugins/cursor/session.ts +6 -1
package/.turbo/turbo-build.log
CHANGED
package/dist/commands/daemon.js
CHANGED
|
@@ -20,7 +20,8 @@ export async function installDaemonCommand() {
|
|
|
20
20
|
}
|
|
21
21
|
async function installMacOSDaemon() {
|
|
22
22
|
const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${LABEL}.plist`);
|
|
23
|
-
const
|
|
23
|
+
const binaryPath = process.execPath;
|
|
24
|
+
const uid = os.userInfo().uid;
|
|
24
25
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
25
26
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
26
27
|
<plist version="1.0">
|
|
@@ -29,7 +30,8 @@ async function installMacOSDaemon() {
|
|
|
29
30
|
<string>${LABEL}</string>
|
|
30
31
|
<key>ProgramArguments</key>
|
|
31
32
|
<array>
|
|
32
|
-
<string>${
|
|
33
|
+
<string>${binaryPath}</string>
|
|
34
|
+
<string>start</string>
|
|
33
35
|
</array>
|
|
34
36
|
<key>RunAtLoad</key>
|
|
35
37
|
<true/>
|
|
@@ -52,7 +54,7 @@ async function installMacOSDaemon() {
|
|
|
52
54
|
process.exit(1);
|
|
53
55
|
}
|
|
54
56
|
try {
|
|
55
|
-
execSync(`launchctl bootstrap
|
|
57
|
+
execSync(`launchctl bootstrap gui/${uid} "${plistPath}"`, { stdio: 'inherit' });
|
|
56
58
|
console.log(`Installed LaunchAgent: ${plistPath}`);
|
|
57
59
|
console.log(`Logs: ~/Library/Logs/llm-bridge.{log,err.log}`);
|
|
58
60
|
}
|
|
@@ -112,8 +114,9 @@ export async function uninstallDaemonCommand() {
|
|
|
112
114
|
}
|
|
113
115
|
async function uninstallMacOSDaemon() {
|
|
114
116
|
const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${LABEL}.plist`);
|
|
117
|
+
const uid = os.userInfo().uid;
|
|
115
118
|
try {
|
|
116
|
-
execSync(`launchctl bootout
|
|
119
|
+
execSync(`launchctl bootout gui/${uid} "${plistPath}" 2>/dev/null || true`, {
|
|
117
120
|
stdio: 'inherit',
|
|
118
121
|
});
|
|
119
122
|
}
|
package/dist/core/parser.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const ChatRequestSchema: z.ZodObject<{
|
|
|
4
4
|
model: z.ZodString;
|
|
5
5
|
messages: z.ZodArray<z.ZodObject<{
|
|
6
6
|
role: z.ZodEnum<["system", "user", "assistant", "tool", "function"]>;
|
|
7
|
-
content: z.ZodOptional<z.ZodNullable<z.
|
|
7
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
8
8
|
name: z.ZodOptional<z.ZodString>;
|
|
9
9
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
10
10
|
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -37,7 +37,7 @@ declare const ChatRequestSchema: z.ZodObject<{
|
|
|
37
37
|
}>, "many">>;
|
|
38
38
|
}, "strip", z.ZodTypeAny, {
|
|
39
39
|
role: "function" | "system" | "user" | "assistant" | "tool";
|
|
40
|
-
content?:
|
|
40
|
+
content?: unknown;
|
|
41
41
|
name?: string | undefined;
|
|
42
42
|
tool_call_id?: string | undefined;
|
|
43
43
|
tool_calls?: {
|
|
@@ -50,7 +50,7 @@ declare const ChatRequestSchema: z.ZodObject<{
|
|
|
50
50
|
}[] | undefined;
|
|
51
51
|
}, {
|
|
52
52
|
role: "function" | "system" | "user" | "assistant" | "tool";
|
|
53
|
-
content?:
|
|
53
|
+
content?: unknown;
|
|
54
54
|
name?: string | undefined;
|
|
55
55
|
tool_call_id?: string | undefined;
|
|
56
56
|
tool_calls?: {
|
|
@@ -98,7 +98,7 @@ declare const ChatRequestSchema: z.ZodObject<{
|
|
|
98
98
|
model: string;
|
|
99
99
|
messages: {
|
|
100
100
|
role: "function" | "system" | "user" | "assistant" | "tool";
|
|
101
|
-
content?:
|
|
101
|
+
content?: unknown;
|
|
102
102
|
name?: string | undefined;
|
|
103
103
|
tool_call_id?: string | undefined;
|
|
104
104
|
tool_calls?: {
|
|
@@ -124,7 +124,7 @@ declare const ChatRequestSchema: z.ZodObject<{
|
|
|
124
124
|
model: string;
|
|
125
125
|
messages: {
|
|
126
126
|
role: "function" | "system" | "user" | "assistant" | "tool";
|
|
127
|
-
content?:
|
|
127
|
+
content?: unknown;
|
|
128
128
|
name?: string | undefined;
|
|
129
129
|
tool_call_id?: string | undefined;
|
|
130
130
|
tool_calls?: {
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const MessageSchema: z.ZodObject<{
|
|
3
3
|
role: z.ZodEnum<["system", "user", "assistant", "tool", "function"]>;
|
|
4
|
-
content: z.ZodOptional<z.ZodNullable<z.
|
|
4
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
5
5
|
name: z.ZodOptional<z.ZodString>;
|
|
6
6
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
7
7
|
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -34,7 +34,7 @@ export declare const MessageSchema: z.ZodObject<{
|
|
|
34
34
|
}>, "many">>;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
36
|
role: "function" | "system" | "user" | "assistant" | "tool";
|
|
37
|
-
content?:
|
|
37
|
+
content?: unknown;
|
|
38
38
|
name?: string | undefined;
|
|
39
39
|
tool_call_id?: string | undefined;
|
|
40
40
|
tool_calls?: {
|
|
@@ -47,7 +47,7 @@ export declare const MessageSchema: z.ZodObject<{
|
|
|
47
47
|
}[] | undefined;
|
|
48
48
|
}, {
|
|
49
49
|
role: "function" | "system" | "user" | "assistant" | "tool";
|
|
50
|
-
content?:
|
|
50
|
+
content?: unknown;
|
|
51
51
|
name?: string | undefined;
|
|
52
52
|
tool_call_id?: string | undefined;
|
|
53
53
|
tool_calls?: {
|
|
@@ -140,6 +140,7 @@ export interface StreamChunk {
|
|
|
140
140
|
export interface BridgePlugin {
|
|
141
141
|
name: string;
|
|
142
142
|
version: string;
|
|
143
|
+
oauthProvider?: import('@ai-ide-bridge/oauth').OAuthProvider;
|
|
143
144
|
authenticate(config: Record<string, string>): Promise<boolean>;
|
|
144
145
|
listModels(config: Record<string, string>): Promise<ModelInfo[]>;
|
|
145
146
|
createSession(config: Record<string, string>, model: string): Promise<BridgeSession>;
|
package/dist/core/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const MessageSchema = z.object({
|
|
3
3
|
role: z.enum(['system', 'user', 'assistant', 'tool', 'function']),
|
|
4
|
-
content: z.
|
|
4
|
+
content: z.unknown().nullable().optional(),
|
|
5
5
|
name: z.string().optional(),
|
|
6
6
|
tool_call_id: z.string().optional(),
|
|
7
7
|
tool_calls: z
|
|
@@ -12,7 +12,7 @@ export class CopilotBridgeSession {
|
|
|
12
12
|
model: this.modelId,
|
|
13
13
|
messages: messages.map((m) => ({
|
|
14
14
|
role: m.role,
|
|
15
|
-
content: m.content
|
|
15
|
+
content: m.content,
|
|
16
16
|
...(m.tool_calls && { tool_calls: m.tool_calls }),
|
|
17
17
|
...(m.tool_call_id && { tool_call_id: m.tool_call_id }),
|
|
18
18
|
})),
|
|
@@ -58,7 +58,11 @@ export class CursorBridgeSession {
|
|
|
58
58
|
buildPrompt(messages) {
|
|
59
59
|
const blocks = [];
|
|
60
60
|
for (const m of messages) {
|
|
61
|
-
const text = typeof m.content === 'string'
|
|
61
|
+
const text = typeof m.content === 'string'
|
|
62
|
+
? m.content
|
|
63
|
+
: m.content != null
|
|
64
|
+
? JSON.stringify(m.content)
|
|
65
|
+
: '';
|
|
62
66
|
if (!text)
|
|
63
67
|
continue;
|
|
64
68
|
const label = m.role === 'tool' ? `tool (${m.tool_call_id ?? m.name ?? 'result'})` : m.role;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ide-bridge/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"llm-bridge": "./dist/index.js"
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"start": "node dist/index.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@ai-ide-bridge/oauth": "workspace:*",
|
|
17
18
|
"@cursor/sdk": "^1.0.13",
|
|
18
19
|
"zod": "^3.25.76"
|
|
19
20
|
},
|
package/src/commands/daemon.ts
CHANGED
|
@@ -21,12 +21,8 @@ export async function installDaemonCommand(): Promise<void> {
|
|
|
21
21
|
|
|
22
22
|
async function installMacOSDaemon(): Promise<void> {
|
|
23
23
|
const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${LABEL}.plist`);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
'..',
|
|
27
|
-
'scripts',
|
|
28
|
-
'llm-bridge-daemon.sh',
|
|
29
|
-
);
|
|
24
|
+
const binaryPath = process.execPath;
|
|
25
|
+
const uid = os.userInfo().uid;
|
|
30
26
|
|
|
31
27
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
32
28
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -36,7 +32,8 @@ async function installMacOSDaemon(): Promise<void> {
|
|
|
36
32
|
<string>${LABEL}</string>
|
|
37
33
|
<key>ProgramArguments</key>
|
|
38
34
|
<array>
|
|
39
|
-
<string>${
|
|
35
|
+
<string>${binaryPath}</string>
|
|
36
|
+
<string>start</string>
|
|
40
37
|
</array>
|
|
41
38
|
<key>RunAtLoad</key>
|
|
42
39
|
<true/>
|
|
@@ -60,7 +57,7 @@ async function installMacOSDaemon(): Promise<void> {
|
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
try {
|
|
63
|
-
execSync(`launchctl bootstrap
|
|
60
|
+
execSync(`launchctl bootstrap gui/${uid} "${plistPath}"`, { stdio: 'inherit' });
|
|
64
61
|
console.log(`Installed LaunchAgent: ${plistPath}`);
|
|
65
62
|
console.log(`Logs: ~/Library/Logs/llm-bridge.{log,err.log}`);
|
|
66
63
|
} catch (e) {
|
|
@@ -122,9 +119,10 @@ export async function uninstallDaemonCommand(): Promise<void> {
|
|
|
122
119
|
|
|
123
120
|
async function uninstallMacOSDaemon(): Promise<void> {
|
|
124
121
|
const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${LABEL}.plist`);
|
|
122
|
+
const uid = os.userInfo().uid;
|
|
125
123
|
|
|
126
124
|
try {
|
|
127
|
-
execSync(`launchctl bootout
|
|
125
|
+
execSync(`launchctl bootout gui/${uid} "${plistPath}" 2>/dev/null || true`, {
|
|
128
126
|
stdio: 'inherit',
|
|
129
127
|
});
|
|
130
128
|
} catch {
|
package/src/core/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
export const MessageSchema = z.object({
|
|
4
4
|
role: z.enum(['system', 'user', 'assistant', 'tool', 'function']),
|
|
5
|
-
content: z.
|
|
5
|
+
content: z.unknown().nullable().optional(),
|
|
6
6
|
name: z.string().optional(),
|
|
7
7
|
tool_call_id: z.string().optional(),
|
|
8
8
|
tool_calls: z
|
|
@@ -63,6 +63,7 @@ export interface StreamChunk {
|
|
|
63
63
|
export interface BridgePlugin {
|
|
64
64
|
name: string;
|
|
65
65
|
version: string;
|
|
66
|
+
oauthProvider?: import('@ai-ide-bridge/oauth').OAuthProvider;
|
|
66
67
|
authenticate(config: Record<string, string>): Promise<boolean>;
|
|
67
68
|
listModels(config: Record<string, string>): Promise<ModelInfo[]>;
|
|
68
69
|
createSession(config: Record<string, string>, model: string): Promise<BridgeSession>;
|
|
@@ -17,7 +17,7 @@ export class CopilotBridgeSession implements BridgeSession {
|
|
|
17
17
|
model: this.modelId,
|
|
18
18
|
messages: messages.map((m) => ({
|
|
19
19
|
role: m.role,
|
|
20
|
-
content: m.content
|
|
20
|
+
content: m.content,
|
|
21
21
|
...(m.tool_calls && { tool_calls: m.tool_calls }),
|
|
22
22
|
...(m.tool_call_id && { tool_call_id: m.tool_call_id }),
|
|
23
23
|
})),
|
|
@@ -68,7 +68,12 @@ export class CursorBridgeSession implements BridgeSession {
|
|
|
68
68
|
private buildPrompt(messages: Message[]): string {
|
|
69
69
|
const blocks: string[] = [];
|
|
70
70
|
for (const m of messages) {
|
|
71
|
-
const text =
|
|
71
|
+
const text =
|
|
72
|
+
typeof m.content === 'string'
|
|
73
|
+
? m.content
|
|
74
|
+
: m.content != null
|
|
75
|
+
? JSON.stringify(m.content)
|
|
76
|
+
: '';
|
|
72
77
|
if (!text) continue;
|
|
73
78
|
const label = m.role === 'tool' ? `tool (${m.tool_call_id ?? m.name ?? 'result'})` : m.role;
|
|
74
79
|
blocks.push(`[${label}]\n${text}`);
|