jukto-cli 0.1.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/README.md +109 -0
- package/dist/ai/codex.d.ts +149 -0
- package/dist/ai/codex.js +2122 -0
- package/dist/ai/index.d.ts +57 -0
- package/dist/ai/index.js +119 -0
- package/dist/ai/interface.d.ts +93 -0
- package/dist/ai/interface.js +3 -0
- package/dist/ai/opencode.d.ts +72 -0
- package/dist/ai/opencode.js +883 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3356 -0
- package/dist/transport/protocol.d.ts +77 -0
- package/dist/transport/protocol.js +79 -0
- package/dist/transport/v2.d.ts +47 -0
- package/dist/transport/v2.js +347 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Jukto CLI
|
|
2
|
+
|
|
3
|
+
Node.js CLI that connects a local machine to the Jukto mobile app through the Jukto gateway. It runs from the project directory you want to expose and keeps filesystem, terminal, process, port, git, and AI actions scoped to that working tree.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 18 or newer
|
|
8
|
+
- npm
|
|
9
|
+
- Jukto mobile app for QR/session pairing
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Run the published package:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx jukto-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The CLI prints a QR code and session details. Scan the QR code with the Jukto app to connect to the current working directory.
|
|
20
|
+
|
|
21
|
+
Common options:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx jukto-cli --help
|
|
25
|
+
npx jukto-cli --new
|
|
26
|
+
npx jukto-cli --debug
|
|
27
|
+
npx jukto-cli --extra-ports 3000,8080
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
|
|
32
|
+
| Option | Description |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `-h`, `--help` | Show CLI help |
|
|
35
|
+
| `-n`, `--new` | Create a fresh session code instead of reusing the saved one |
|
|
36
|
+
| `-d`, `--debug` | Enable verbose CLI and AI backend logs |
|
|
37
|
+
| `--extra-ports` | Comma-separated local ports to expose through Jukto |
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
By default, the CLI uses the public Jukto services:
|
|
42
|
+
|
|
43
|
+
- Gateway: `https://gateway.jukto.dev`
|
|
44
|
+
- Manager: `https://manager.jukto.dev`
|
|
45
|
+
|
|
46
|
+
Override them with environment variables when developing against local or custom infrastructure:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
JUKTO_PROXY_URL=http://localhost:3001 \
|
|
50
|
+
JUKTO_MANAGER_URL=http://localhost:3002 \
|
|
51
|
+
npx jukto-cli
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Other useful environment variables:
|
|
55
|
+
|
|
56
|
+
| Variable | Description |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `JUKTO_PROXY_URL` | Gateway/proxy URL |
|
|
59
|
+
| `JUKTO_MANAGER_URL` | Manager URL |
|
|
60
|
+
| `JUKTO_DEBUG` | Set to `1` for debug logging |
|
|
61
|
+
| `JUKTO_DEBUG_AI` | Set to `1` for AI backend debug logging |
|
|
62
|
+
| `NO_COLOR` | Disable colored terminal output |
|
|
63
|
+
| `FORCE_COLOR` | Force colored terminal output |
|
|
64
|
+
|
|
65
|
+
Session config is saved per project root in the OS-specific Jukto config directory:
|
|
66
|
+
|
|
67
|
+
- macOS: `~/Library/Application Support/jukto/config.json`
|
|
68
|
+
- Windows: `%APPDATA.\jukto\config.json`
|
|
69
|
+
- Linux: `$XDG_CONFIG_HOME/jukto/config.json` or `~/.config/jukto/config.json`
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
Install dependencies:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm install
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Build the CLI:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm run build
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Run from source output:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run dev
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The package entrypoint is `dist/index.js`, generated from `src/index.ts`. `npm run build` compiles TypeScript and marks the generated entrypoint executable.
|
|
92
|
+
|
|
93
|
+
## Project Layout
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
src/
|
|
97
|
+
index.ts CLI entrypoint and local machine bridge
|
|
98
|
+
ai/ Codex/OpenCode provider integration
|
|
99
|
+
transport/ Session transport protocol
|
|
100
|
+
libsodium-wrappers.d.ts
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Publishing
|
|
104
|
+
|
|
105
|
+
The package is published as `jukto-cli`. `prepublishOnly` runs the production build before publishing.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm publish
|
|
109
|
+
```
|
|
@@ -0,0 +1,149 @@
|
|
|
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 debugLog;
|
|
17
|
+
private debugHistory;
|
|
18
|
+
init(): Promise<void>;
|
|
19
|
+
destroy(): Promise<void>;
|
|
20
|
+
subscribe(emitter: AiEventEmitter): () => void;
|
|
21
|
+
createSession(title?: string): Promise<{
|
|
22
|
+
session: SessionInfo;
|
|
23
|
+
}>;
|
|
24
|
+
listSessions(): Promise<{
|
|
25
|
+
sessions: unknown;
|
|
26
|
+
}>;
|
|
27
|
+
getSession(id: string): Promise<{
|
|
28
|
+
session: SessionInfo;
|
|
29
|
+
}>;
|
|
30
|
+
deleteSession(id: string): Promise<{
|
|
31
|
+
deleted: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
renameSession(id: string, title: string): Promise<{
|
|
34
|
+
session: SessionInfo;
|
|
35
|
+
}>;
|
|
36
|
+
getMessages(sessionId: string): Promise<{
|
|
37
|
+
messages: MessageInfo[];
|
|
38
|
+
}>;
|
|
39
|
+
prompt(sessionId: string, text: string, model?: ModelSelector, agent?: string, files?: FileAttachment[], codexOptions?: CodexPromptOptions): Promise<{
|
|
40
|
+
ack: true;
|
|
41
|
+
}>;
|
|
42
|
+
abort(sessionId: string): Promise<Record<string, never>>;
|
|
43
|
+
agents(): Promise<{
|
|
44
|
+
agents: unknown;
|
|
45
|
+
}>;
|
|
46
|
+
providers(): Promise<ProviderInfo>;
|
|
47
|
+
setAuth(providerId: string, key: string): Promise<Record<string, never>>;
|
|
48
|
+
command(sessionId: string, command: string, args: string): Promise<{
|
|
49
|
+
result: unknown;
|
|
50
|
+
}>;
|
|
51
|
+
revert(sessionId: string, messageId: string): Promise<Record<string, never>>;
|
|
52
|
+
unrevert(sessionId: string): Promise<Record<string, never>>;
|
|
53
|
+
share(sessionId: string): Promise<{
|
|
54
|
+
share: ShareInfo;
|
|
55
|
+
}>;
|
|
56
|
+
permissionReply(sessionId: string, permissionId: string, response: "once" | "always" | "reject"): Promise<Record<string, never>>;
|
|
57
|
+
questionReply(sessionId: string, questionId: string, answers: string[][]): Promise<Record<string, never>>;
|
|
58
|
+
questionReject(sessionId: string, questionId: string): Promise<Record<string, never>>;
|
|
59
|
+
private send;
|
|
60
|
+
private call;
|
|
61
|
+
private handleLine;
|
|
62
|
+
private handleServerRequest;
|
|
63
|
+
private handleNotification;
|
|
64
|
+
private isCommandApprovalMethod;
|
|
65
|
+
private emitMirroredUserMessage;
|
|
66
|
+
private handleItemStarted;
|
|
67
|
+
private handleStructuredItemCompleted;
|
|
68
|
+
private emitTextPart;
|
|
69
|
+
private emitStructuredToolPart;
|
|
70
|
+
private finishAssistantTurn;
|
|
71
|
+
private emitMessagePartEvent;
|
|
72
|
+
private ensureAssistantMessage;
|
|
73
|
+
private upsertLocalMessagePart;
|
|
74
|
+
private fetchServerThreads;
|
|
75
|
+
private refreshConfigDefaults;
|
|
76
|
+
private refreshSessionMetadata;
|
|
77
|
+
private fetchServerThreadsByArchiveState;
|
|
78
|
+
private fetchModels;
|
|
79
|
+
private fetchModelById;
|
|
80
|
+
private resolveModelId;
|
|
81
|
+
private buildCollaborationMode;
|
|
82
|
+
private parseThreadListEntry;
|
|
83
|
+
private hasNextCursor;
|
|
84
|
+
private ingestThreadMetadata;
|
|
85
|
+
private reconcileSessionsWithServer;
|
|
86
|
+
private mergeSession;
|
|
87
|
+
private upsertSession;
|
|
88
|
+
private ensureLocalSession;
|
|
89
|
+
private ensureThreadResumed;
|
|
90
|
+
private resolveSessionFromPayload;
|
|
91
|
+
private resolveInFlightTurnId;
|
|
92
|
+
private decodeMessagesFromThreadRead;
|
|
93
|
+
private logThreadReadSummary;
|
|
94
|
+
private decodeStoredToolLikePart;
|
|
95
|
+
private describeStoredToolName;
|
|
96
|
+
private extractStoredToolInput;
|
|
97
|
+
private extractStoredToolOutput;
|
|
98
|
+
private decodeStoredCommandExecutionOutput;
|
|
99
|
+
private decodeUserMessageParts;
|
|
100
|
+
private decodeItemText;
|
|
101
|
+
private makeTurnInputPayload;
|
|
102
|
+
private shouldRetryTurnStartWithImageURLField;
|
|
103
|
+
private inferImageMimeFromDataUrl;
|
|
104
|
+
private decodeReasoningItemText;
|
|
105
|
+
private decodePlanItemText;
|
|
106
|
+
private decodeCommandExecutionItemText;
|
|
107
|
+
private decodeFileLikeItemText;
|
|
108
|
+
private normalizedCommandPhase;
|
|
109
|
+
private shortCommand;
|
|
110
|
+
private flattenTextValue;
|
|
111
|
+
private toSessionInfo;
|
|
112
|
+
private extractThreadObject;
|
|
113
|
+
private extractThreadTitleFromUnknown;
|
|
114
|
+
private extractThreadTitle;
|
|
115
|
+
private extractTurnId;
|
|
116
|
+
private extractItemId;
|
|
117
|
+
private extractTextPayload;
|
|
118
|
+
private extractStructuredUserInputQuestions;
|
|
119
|
+
private extractThreadId;
|
|
120
|
+
private extractThreadCwd;
|
|
121
|
+
private extractCreatedAt;
|
|
122
|
+
private extractUpdatedAt;
|
|
123
|
+
private readTimestamp;
|
|
124
|
+
private firstString;
|
|
125
|
+
private firstStringFromSources;
|
|
126
|
+
private readArray;
|
|
127
|
+
private readRawString;
|
|
128
|
+
private readString;
|
|
129
|
+
private asRecord;
|
|
130
|
+
private normalizedItemType;
|
|
131
|
+
private isUserRole;
|
|
132
|
+
private isAssistantMessageItem;
|
|
133
|
+
private extractIncomingItem;
|
|
134
|
+
private describeToolPart;
|
|
135
|
+
private normalizeStructuredType;
|
|
136
|
+
private isFileChangeStructuredItem;
|
|
137
|
+
private extractStructuredOutput;
|
|
138
|
+
private extractDiffLikePayload;
|
|
139
|
+
private renderFileChangeEntriesBody;
|
|
140
|
+
private renderUnifiedDiffBody;
|
|
141
|
+
private extractCanonicalPatch;
|
|
142
|
+
private normalizeDisplayPath;
|
|
143
|
+
private normalizeDirectoryPath;
|
|
144
|
+
private belongsToCurrentRoot;
|
|
145
|
+
private normalizedFileChangeStatus;
|
|
146
|
+
private extractToolInput;
|
|
147
|
+
private extractCommandExecutionInput;
|
|
148
|
+
private describeCompletedItemOutput;
|
|
149
|
+
}
|