kodorun-cli 0.0.0-stage → 0.1.122
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 +99 -2
- package/dist/ai/acp.d.ts +95 -0
- package/dist/ai/acp.js +771 -0
- package/dist/ai/antigravity.d.ts +4 -0
- package/dist/ai/antigravity.js +29 -0
- package/dist/ai/claude.d.ts +4 -0
- package/dist/ai/claude.js +45 -0
- package/dist/ai/codex.d.ts +154 -0
- package/dist/ai/codex.js +2241 -0
- package/dist/ai/cursor.d.ts +4 -0
- package/dist/ai/cursor.js +56 -0
- package/dist/ai/gemini.d.ts +4 -0
- package/dist/ai/gemini.js +26 -0
- package/dist/ai/index.d.ts +58 -0
- package/dist/ai/index.js +137 -0
- package/dist/ai/interface.d.ts +95 -0
- package/dist/ai/interface.js +10 -0
- package/dist/ai/opencode.d.ts +72 -0
- package/dist/ai/opencode.js +906 -0
- package/dist/ai/session-store.d.ts +36 -0
- package/dist/ai/session-store.js +252 -0
- package/dist/ai/stream-json.d.ts +80 -0
- package/dist/ai/stream-json.js +555 -0
- package/dist/cli.test.d.ts +1 -0
- package/dist/cli.test.js +167 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3736 -0
- package/dist/transport/protocol.d.ts +77 -0
- package/dist/transport/protocol.js +80 -0
- package/dist/transport/v2.d.ts +49 -0
- package/dist/transport/v2.js +362 -0
- package/package.json +59 -4
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as os from "os";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { AcpProvider } from "./acp.js";
|
|
4
|
+
export class AntigravityProvider extends AcpProvider {
|
|
5
|
+
constructor() {
|
|
6
|
+
const home = os.homedir();
|
|
7
|
+
super({
|
|
8
|
+
backend: "antigravity",
|
|
9
|
+
displayName: "Antigravity",
|
|
10
|
+
binaryCandidates: ["agy"],
|
|
11
|
+
extraBinaryPaths: [
|
|
12
|
+
path.join(home, ".gemini", "bin", process.platform === "win32" ? "agy.exe" : "agy"),
|
|
13
|
+
],
|
|
14
|
+
acpArgs: ["acp", "--include-default-customizations=false"],
|
|
15
|
+
authEnvKey: "GEMINI_API_KEY",
|
|
16
|
+
authMethodId: "gemini-api-key",
|
|
17
|
+
defaultModels: [
|
|
18
|
+
{ id: "gemini-3.8-flash-low", name: "Gemini 3.8 Flash (Low)", isDefault: true, reasoning: false, attachment: true },
|
|
19
|
+
{ id: "gemini-3.8-flash-medium", name: "Gemini 3.8 Flash (Medium)", reasoning: true, attachment: true },
|
|
20
|
+
{ id: "gemini-3.8-flash-high", name: "Gemini 3.8 Flash (High)", reasoning: true, attachment: true },
|
|
21
|
+
{ id: "gemini-4-hydrogen-high", name: "Gemini 4 Hydrogen (High)", reasoning: true, attachment: true },
|
|
22
|
+
{ id: "gemini-4-hydrogen-xhigh", name: "Gemini 4 Hydrogen (XHigh)", reasoning: true, attachment: true },
|
|
23
|
+
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6 (Thinking)", reasoning: true, attachment: true },
|
|
24
|
+
{ id: "claude-opus-4-6-thinking", name: "Claude Opus 4.6 (Thinking)", reasoning: true, attachment: true },
|
|
25
|
+
{ id: "gpt-oss-120b-medium", name: "GPT-OSS 120B (Medium)", reasoning: true, attachment: false },
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as os from "os";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { StreamJsonProvider } from "./stream-json.js";
|
|
4
|
+
export class ClaudeCodeProvider extends StreamJsonProvider {
|
|
5
|
+
constructor() {
|
|
6
|
+
const home = os.homedir();
|
|
7
|
+
super({
|
|
8
|
+
backend: "claude",
|
|
9
|
+
displayName: "Claude Code",
|
|
10
|
+
binaryCandidates: ["claude"],
|
|
11
|
+
extraBinaryPaths: [
|
|
12
|
+
path.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude"),
|
|
13
|
+
path.join(home, ".claude", "local", process.platform === "win32" ? "claude.exe" : "claude"),
|
|
14
|
+
],
|
|
15
|
+
authEnvKey: "ANTHROPIC_API_KEY",
|
|
16
|
+
defaultModels: [
|
|
17
|
+
{ id: "claude-haiku-4-5", name: "Claude Haiku 4.5", isDefault: true, reasoning: false },
|
|
18
|
+
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6", reasoning: true },
|
|
19
|
+
{ id: "claude-opus-4-6", name: "Claude Opus 4.6", reasoning: true },
|
|
20
|
+
],
|
|
21
|
+
buildArgs: ({ prompt, remoteSessionId, localSessionId, isFirstTurn, modelId, agent }) => {
|
|
22
|
+
const args = [
|
|
23
|
+
"-p",
|
|
24
|
+
prompt,
|
|
25
|
+
"--output-format",
|
|
26
|
+
"stream-json",
|
|
27
|
+
"--verbose",
|
|
28
|
+
"--include-partial-messages",
|
|
29
|
+
"--permission-mode",
|
|
30
|
+
agent === "plan" ? "plan" : "acceptEdits",
|
|
31
|
+
];
|
|
32
|
+
if (!isFirstTurn && remoteSessionId) {
|
|
33
|
+
args.push("--resume", remoteSessionId);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
args.push("--session-id", localSessionId);
|
|
37
|
+
}
|
|
38
|
+
if (modelId) {
|
|
39
|
+
args.push("--model", modelId);
|
|
40
|
+
}
|
|
41
|
+
return args;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { AIProvider, AiEventEmitter, CodexPromptOptions, FileAttachment, ModelSelector, MessageInfo, ProviderInfo, SessionInfo, ShareInfo } from "./interface.js";
|
|
2
|
+
export declare class CodexProvider implements AIProvider {
|
|
3
|
+
private proc;
|
|
4
|
+
private shuttingDown;
|
|
5
|
+
private emitter;
|
|
6
|
+
private defaultModelContextWindow;
|
|
7
|
+
private nextId;
|
|
8
|
+
private pending;
|
|
9
|
+
private sessions;
|
|
10
|
+
private deletedThreadIds;
|
|
11
|
+
private resumedThreadIds;
|
|
12
|
+
private pendingPermissionRequestIds;
|
|
13
|
+
private pendingQuestionRequestIds;
|
|
14
|
+
private assistantMessageIdByTurnId;
|
|
15
|
+
private partTextById;
|
|
16
|
+
private cachedModels;
|
|
17
|
+
private cachedModelsAt;
|
|
18
|
+
private modelsInFlight;
|
|
19
|
+
private debugLog;
|
|
20
|
+
private debugHistory;
|
|
21
|
+
private resolveCodexExecutable;
|
|
22
|
+
init(): Promise<void>;
|
|
23
|
+
destroy(): Promise<void>;
|
|
24
|
+
subscribe(emitter: AiEventEmitter): () => void;
|
|
25
|
+
createSession(title?: string): Promise<{
|
|
26
|
+
session: SessionInfo;
|
|
27
|
+
}>;
|
|
28
|
+
listSessions(): Promise<{
|
|
29
|
+
sessions: unknown;
|
|
30
|
+
}>;
|
|
31
|
+
getSession(id: string): Promise<{
|
|
32
|
+
session: SessionInfo;
|
|
33
|
+
}>;
|
|
34
|
+
deleteSession(id: string): Promise<{
|
|
35
|
+
deleted: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
renameSession(id: string, title: string): Promise<{
|
|
38
|
+
session: SessionInfo;
|
|
39
|
+
}>;
|
|
40
|
+
getMessages(sessionId: string): Promise<{
|
|
41
|
+
messages: MessageInfo[];
|
|
42
|
+
}>;
|
|
43
|
+
prompt(sessionId: string, text: string, model?: ModelSelector, agent?: string, files?: FileAttachment[], codexOptions?: CodexPromptOptions): Promise<{
|
|
44
|
+
ack: true;
|
|
45
|
+
}>;
|
|
46
|
+
abort(sessionId: string): Promise<Record<string, never>>;
|
|
47
|
+
agents(): Promise<{
|
|
48
|
+
agents: unknown;
|
|
49
|
+
}>;
|
|
50
|
+
providers(): Promise<ProviderInfo>;
|
|
51
|
+
setAuth(providerId: string, key: string): Promise<Record<string, never>>;
|
|
52
|
+
command(sessionId: string, command: string, args: string): Promise<{
|
|
53
|
+
result: unknown;
|
|
54
|
+
}>;
|
|
55
|
+
revert(sessionId: string, messageId: string): Promise<Record<string, never>>;
|
|
56
|
+
unrevert(sessionId: string): Promise<Record<string, never>>;
|
|
57
|
+
share(sessionId: string): Promise<{
|
|
58
|
+
share: ShareInfo;
|
|
59
|
+
}>;
|
|
60
|
+
permissionReply(sessionId: string, permissionId: string, response: "once" | "always" | "reject"): Promise<Record<string, never>>;
|
|
61
|
+
questionReply(sessionId: string, questionId: string, answers: string[][]): Promise<Record<string, never>>;
|
|
62
|
+
questionReject(sessionId: string, questionId: string): Promise<Record<string, never>>;
|
|
63
|
+
private send;
|
|
64
|
+
private call;
|
|
65
|
+
private handleLine;
|
|
66
|
+
private handleServerRequest;
|
|
67
|
+
private handleNotification;
|
|
68
|
+
private isCommandApprovalMethod;
|
|
69
|
+
private emitMirroredUserMessage;
|
|
70
|
+
private handleItemStarted;
|
|
71
|
+
private handleStructuredItemCompleted;
|
|
72
|
+
private emitTextPart;
|
|
73
|
+
private emitStructuredToolPart;
|
|
74
|
+
private finishAssistantTurn;
|
|
75
|
+
private emitMessagePartEvent;
|
|
76
|
+
private ensureAssistantMessage;
|
|
77
|
+
private upsertLocalMessagePart;
|
|
78
|
+
private fetchServerThreads;
|
|
79
|
+
private refreshConfigDefaults;
|
|
80
|
+
private readThreadSafe;
|
|
81
|
+
private refreshSessionMetadata;
|
|
82
|
+
private fetchServerThreadsByArchiveState;
|
|
83
|
+
private fetchModels;
|
|
84
|
+
private fetchModelById;
|
|
85
|
+
private resolveModelId;
|
|
86
|
+
private buildCollaborationMode;
|
|
87
|
+
private parseThreadListEntry;
|
|
88
|
+
private hasNextCursor;
|
|
89
|
+
private ingestThreadMetadata;
|
|
90
|
+
private reconcileSessionsWithServer;
|
|
91
|
+
private mergeSession;
|
|
92
|
+
private upsertSession;
|
|
93
|
+
private ensureLocalSession;
|
|
94
|
+
private ensureThreadResumed;
|
|
95
|
+
private resolveSessionFromPayload;
|
|
96
|
+
private resolveInFlightTurnId;
|
|
97
|
+
private decodeMessagesFromThreadRead;
|
|
98
|
+
private logThreadReadSummary;
|
|
99
|
+
private decodeStoredToolLikePart;
|
|
100
|
+
private describeStoredToolName;
|
|
101
|
+
private extractStoredToolInput;
|
|
102
|
+
private extractStoredToolOutput;
|
|
103
|
+
private decodeStoredCommandExecutionOutput;
|
|
104
|
+
private decodeUserMessageParts;
|
|
105
|
+
private decodeItemText;
|
|
106
|
+
private makeTurnInputPayload;
|
|
107
|
+
private shouldRetryTurnStartWithImageURLField;
|
|
108
|
+
private inferImageMimeFromDataUrl;
|
|
109
|
+
private decodeReasoningItemText;
|
|
110
|
+
private decodePlanItemText;
|
|
111
|
+
private decodeCommandExecutionItemText;
|
|
112
|
+
private decodeFileLikeItemText;
|
|
113
|
+
private normalizedCommandPhase;
|
|
114
|
+
private shortCommand;
|
|
115
|
+
private flattenTextValue;
|
|
116
|
+
private toSessionInfo;
|
|
117
|
+
private extractThreadObject;
|
|
118
|
+
private extractThreadTitleFromUnknown;
|
|
119
|
+
private extractThreadTitle;
|
|
120
|
+
private extractTurnId;
|
|
121
|
+
private extractItemId;
|
|
122
|
+
private extractTextPayload;
|
|
123
|
+
private extractStructuredUserInputQuestions;
|
|
124
|
+
private extractThreadId;
|
|
125
|
+
private extractThreadCwd;
|
|
126
|
+
private extractCreatedAt;
|
|
127
|
+
private extractUpdatedAt;
|
|
128
|
+
private readTimestamp;
|
|
129
|
+
private firstString;
|
|
130
|
+
private firstStringFromSources;
|
|
131
|
+
private readArray;
|
|
132
|
+
private readRawString;
|
|
133
|
+
private readString;
|
|
134
|
+
private asRecord;
|
|
135
|
+
private normalizedItemType;
|
|
136
|
+
private isUserRole;
|
|
137
|
+
private isAssistantMessageItem;
|
|
138
|
+
private extractIncomingItem;
|
|
139
|
+
private describeToolPart;
|
|
140
|
+
private normalizeStructuredType;
|
|
141
|
+
private isFileChangeStructuredItem;
|
|
142
|
+
private extractStructuredOutput;
|
|
143
|
+
private extractDiffLikePayload;
|
|
144
|
+
private renderFileChangeEntriesBody;
|
|
145
|
+
private renderUnifiedDiffBody;
|
|
146
|
+
private extractCanonicalPatch;
|
|
147
|
+
private normalizeDisplayPath;
|
|
148
|
+
private normalizeDirectoryPath;
|
|
149
|
+
private belongsToCurrentRoot;
|
|
150
|
+
private normalizedFileChangeStatus;
|
|
151
|
+
private extractToolInput;
|
|
152
|
+
private extractCommandExecutionInput;
|
|
153
|
+
private describeCompletedItemOutput;
|
|
154
|
+
}
|