@yu_robotics/remote-cli 1.1.21 → 1.1.33
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/client/MessageHandler.d.ts +23 -55
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +289 -265
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +22 -11
- package/dist/commands/start.js.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +17 -6
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/executor/GeminiExecutor.d.ts +12 -0
- package/dist/executor/GeminiExecutor.d.ts.map +1 -1
- package/dist/executor/GeminiExecutor.js +174 -54
- package/dist/executor/GeminiExecutor.js.map +1 -1
- package/dist/executor/acp/SessionManager.d.ts +8 -0
- package/dist/executor/acp/SessionManager.d.ts.map +1 -1
- package/dist/executor/acp/SessionManager.js +18 -0
- package/dist/executor/acp/SessionManager.js.map +1 -1
- package/dist/executor/index.d.ts +1 -1
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +3 -3
- package/dist/executor/index.js.map +1 -1
- package/dist/thread/ThreadExecutorPool.d.ts +57 -0
- package/dist/thread/ThreadExecutorPool.d.ts.map +1 -0
- package/dist/thread/ThreadExecutorPool.js +104 -0
- package/dist/thread/ThreadExecutorPool.js.map +1 -0
- package/dist/thread/ThreadManager.d.ts +65 -0
- package/dist/thread/ThreadManager.d.ts.map +1 -0
- package/dist/thread/ThreadManager.js +182 -0
- package/dist/thread/ThreadManager.js.map +1 -0
- package/dist/thread/index.d.ts +6 -0
- package/dist/thread/index.d.ts.map +1 -0
- package/dist/thread/index.js +12 -0
- package/dist/thread/index.js.map +1 -0
- package/dist/thread/types.d.ts +28 -0
- package/dist/thread/types.d.ts.map +1 -0
- package/dist/thread/types.js +11 -0
- package/dist/thread/types.js.map +1 -0
- package/dist/types/index.d.ts +12 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Thread } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Manages thread lifecycle: create, list, update, delete.
|
|
4
|
+
* Persists thread metadata to ~/.remote-cli/threads.json.
|
|
5
|
+
* Session files are stored at ~/.remote-cli/claude-sessions/<threadId>.jsonl
|
|
6
|
+
*/
|
|
7
|
+
export declare class ThreadManager {
|
|
8
|
+
private store;
|
|
9
|
+
private storePath;
|
|
10
|
+
private sessionsDir;
|
|
11
|
+
private constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Initialize ThreadManager. Creates the default thread if no threads exist.
|
|
14
|
+
* Migrates from single-session mode if a legacy .claude-session file exists.
|
|
15
|
+
*
|
|
16
|
+
* @param configDir Base config directory (defaults to ~/.remote-cli)
|
|
17
|
+
*/
|
|
18
|
+
static initialize(configDir?: string): Promise<ThreadManager>;
|
|
19
|
+
/**
|
|
20
|
+
* Read legacy single-session ID from ~/.remote-cli/claude-session for migration.
|
|
21
|
+
*/
|
|
22
|
+
private readLegacySessionId;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new thread.
|
|
25
|
+
* Throws if name already exists, name is invalid, or MAX_THREADS reached.
|
|
26
|
+
*/
|
|
27
|
+
createThread(name: string, workingDirectory: string): Promise<Thread>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a thread by ID.
|
|
30
|
+
*/
|
|
31
|
+
getThread(id: string): Thread | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get a thread by name.
|
|
34
|
+
*/
|
|
35
|
+
getThreadByName(name: string): Thread | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Get the default thread (always exists).
|
|
38
|
+
*/
|
|
39
|
+
getDefaultThread(): Thread;
|
|
40
|
+
/**
|
|
41
|
+
* Update mutable fields of a thread.
|
|
42
|
+
* Throws if thread not found.
|
|
43
|
+
*/
|
|
44
|
+
updateThread(id: string, updates: Partial<Pick<Thread, 'sessionId' | 'workingDirectory' | 'lastActiveAt'>>): Promise<Thread>;
|
|
45
|
+
/**
|
|
46
|
+
* Delete a thread.
|
|
47
|
+
* Cannot delete the default thread.
|
|
48
|
+
* Removes the thread's session file if it exists.
|
|
49
|
+
*/
|
|
50
|
+
deleteThread(id: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* List all threads sorted by createdAt ascending.
|
|
53
|
+
*/
|
|
54
|
+
listThreads(): Thread[];
|
|
55
|
+
/**
|
|
56
|
+
* Get the session file path for a thread.
|
|
57
|
+
* Session files are stored as ~/.remote-cli/claude-sessions/<threadId>.jsonl
|
|
58
|
+
*/
|
|
59
|
+
getSessionFilePath(threadId: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Persist store to disk.
|
|
62
|
+
*/
|
|
63
|
+
private persist;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=ThreadManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreadManager.d.ts","sourceRoot":"","sources":["../../src/thread/ThreadManager.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,MAAM,EAKP,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO;IAMP;;;;;OAKG;WACU,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAwCnE;;OAEG;YACW,mBAAmB;IAUjC;;;OAGG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4B3E;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIzC;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIjD;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAM1B;;;OAGG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,kBAAkB,GAAG,cAAc,CAAC,CAAC,GAChF,OAAO,CAAC,MAAM,CAAC;IAUlB;;;;OAIG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB7C;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE;IAIvB;;;OAGG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI5C;;OAEG;YACW,OAAO;CAGtB"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ThreadManager = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
const types_1 = require("./types");
|
|
11
|
+
/**
|
|
12
|
+
* Manages thread lifecycle: create, list, update, delete.
|
|
13
|
+
* Persists thread metadata to ~/.remote-cli/threads.json.
|
|
14
|
+
* Session files are stored at ~/.remote-cli/claude-sessions/<threadId>.jsonl
|
|
15
|
+
*/
|
|
16
|
+
class ThreadManager {
|
|
17
|
+
store;
|
|
18
|
+
storePath;
|
|
19
|
+
sessionsDir;
|
|
20
|
+
constructor(storePath, sessionsDir, store) {
|
|
21
|
+
this.storePath = storePath;
|
|
22
|
+
this.sessionsDir = sessionsDir;
|
|
23
|
+
this.store = store;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Initialize ThreadManager. Creates the default thread if no threads exist.
|
|
27
|
+
* Migrates from single-session mode if a legacy .claude-session file exists.
|
|
28
|
+
*
|
|
29
|
+
* @param configDir Base config directory (defaults to ~/.remote-cli)
|
|
30
|
+
*/
|
|
31
|
+
static async initialize(configDir) {
|
|
32
|
+
const baseDir = configDir
|
|
33
|
+
? path_1.default.join(configDir, '.remote-cli')
|
|
34
|
+
: path_1.default.join(process.env.HOME || require('os').homedir(), '.remote-cli');
|
|
35
|
+
const storePath = path_1.default.join(baseDir, 'threads.json');
|
|
36
|
+
const sessionsDir = path_1.default.join(baseDir, 'claude-sessions');
|
|
37
|
+
await fs_1.promises.mkdir(baseDir, { recursive: true });
|
|
38
|
+
await fs_1.promises.mkdir(sessionsDir, { recursive: true });
|
|
39
|
+
let store = { threads: {} };
|
|
40
|
+
try {
|
|
41
|
+
const raw = await fs_1.promises.readFile(storePath, 'utf-8');
|
|
42
|
+
store = JSON.parse(raw);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// File does not exist or is invalid — start fresh
|
|
46
|
+
}
|
|
47
|
+
const manager = new ThreadManager(storePath, sessionsDir, store);
|
|
48
|
+
// Ensure default thread always exists
|
|
49
|
+
if (!manager.getThreadByName(types_1.DEFAULT_THREAD_NAME)) {
|
|
50
|
+
const sessionId = await manager.readLegacySessionId(baseDir);
|
|
51
|
+
const defaultThread = {
|
|
52
|
+
id: (0, crypto_1.randomUUID)(),
|
|
53
|
+
name: types_1.DEFAULT_THREAD_NAME,
|
|
54
|
+
sessionId,
|
|
55
|
+
workingDirectory: process.cwd(),
|
|
56
|
+
createdAt: Date.now(),
|
|
57
|
+
lastActiveAt: Date.now(),
|
|
58
|
+
};
|
|
59
|
+
store.threads[defaultThread.id] = defaultThread;
|
|
60
|
+
await manager.persist();
|
|
61
|
+
}
|
|
62
|
+
return manager;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Read legacy single-session ID from ~/.remote-cli/claude-session for migration.
|
|
66
|
+
*/
|
|
67
|
+
async readLegacySessionId(baseDir) {
|
|
68
|
+
try {
|
|
69
|
+
const legacyPath = path_1.default.join(baseDir, 'claude-session');
|
|
70
|
+
const content = await fs_1.promises.readFile(legacyPath, 'utf-8');
|
|
71
|
+
return content.trim() || null;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a new thread.
|
|
79
|
+
* Throws if name already exists, name is invalid, or MAX_THREADS reached.
|
|
80
|
+
*/
|
|
81
|
+
async createThread(name, workingDirectory) {
|
|
82
|
+
if (!name || !types_1.THREAD_NAME_REGEX.test(name)) {
|
|
83
|
+
throw new Error(`Invalid thread name: "${name}". Use alphanumeric characters and hyphens only (no leading/trailing hyphens).`);
|
|
84
|
+
}
|
|
85
|
+
if (this.getThreadByName(name)) {
|
|
86
|
+
throw new Error(`Thread "${name}" already exists.`);
|
|
87
|
+
}
|
|
88
|
+
const count = Object.keys(this.store.threads).length;
|
|
89
|
+
if (count >= types_1.MAX_THREADS) {
|
|
90
|
+
throw new Error(`Maximum ${types_1.MAX_THREADS} threads allowed. Delete an existing thread first.`);
|
|
91
|
+
}
|
|
92
|
+
const thread = {
|
|
93
|
+
id: (0, crypto_1.randomUUID)(),
|
|
94
|
+
name,
|
|
95
|
+
sessionId: null,
|
|
96
|
+
workingDirectory,
|
|
97
|
+
createdAt: Date.now(),
|
|
98
|
+
lastActiveAt: Date.now(),
|
|
99
|
+
};
|
|
100
|
+
this.store.threads[thread.id] = thread;
|
|
101
|
+
await this.persist();
|
|
102
|
+
return thread;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get a thread by ID.
|
|
106
|
+
*/
|
|
107
|
+
getThread(id) {
|
|
108
|
+
return this.store.threads[id];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get a thread by name.
|
|
112
|
+
*/
|
|
113
|
+
getThreadByName(name) {
|
|
114
|
+
return Object.values(this.store.threads).find(t => t.name === name);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get the default thread (always exists).
|
|
118
|
+
*/
|
|
119
|
+
getDefaultThread() {
|
|
120
|
+
const def = this.getThreadByName(types_1.DEFAULT_THREAD_NAME);
|
|
121
|
+
if (!def)
|
|
122
|
+
throw new Error('Default thread missing — this should never happen');
|
|
123
|
+
return def;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Update mutable fields of a thread.
|
|
127
|
+
* Throws if thread not found.
|
|
128
|
+
*/
|
|
129
|
+
async updateThread(id, updates) {
|
|
130
|
+
const thread = this.store.threads[id];
|
|
131
|
+
if (!thread)
|
|
132
|
+
throw new Error(`Thread not found: ${id}`);
|
|
133
|
+
const updated = { ...thread, ...updates };
|
|
134
|
+
this.store.threads[id] = updated;
|
|
135
|
+
await this.persist();
|
|
136
|
+
return updated;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Delete a thread.
|
|
140
|
+
* Cannot delete the default thread.
|
|
141
|
+
* Removes the thread's session file if it exists.
|
|
142
|
+
*/
|
|
143
|
+
async deleteThread(id) {
|
|
144
|
+
const thread = this.store.threads[id];
|
|
145
|
+
if (!thread)
|
|
146
|
+
throw new Error(`Thread not found: ${id}`);
|
|
147
|
+
if (thread.name === types_1.DEFAULT_THREAD_NAME) {
|
|
148
|
+
throw new Error('Cannot delete the default thread.');
|
|
149
|
+
}
|
|
150
|
+
delete this.store.threads[id];
|
|
151
|
+
await this.persist();
|
|
152
|
+
// Remove session file
|
|
153
|
+
const sessionPath = this.getSessionFilePath(id);
|
|
154
|
+
try {
|
|
155
|
+
await fs_1.promises.unlink(sessionPath);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// File may not exist, that's fine
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* List all threads sorted by createdAt ascending.
|
|
163
|
+
*/
|
|
164
|
+
listThreads() {
|
|
165
|
+
return Object.values(this.store.threads).sort((a, b) => a.createdAt - b.createdAt);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get the session file path for a thread.
|
|
169
|
+
* Session files are stored as ~/.remote-cli/claude-sessions/<threadId>.jsonl
|
|
170
|
+
*/
|
|
171
|
+
getSessionFilePath(threadId) {
|
|
172
|
+
return path_1.default.join(this.sessionsDir, `${threadId}.jsonl`);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Persist store to disk.
|
|
176
|
+
*/
|
|
177
|
+
async persist() {
|
|
178
|
+
await fs_1.promises.writeFile(this.storePath, JSON.stringify(this.store, null, 2), 'utf-8');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.ThreadManager = ThreadManager;
|
|
182
|
+
//# sourceMappingURL=ThreadManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreadManager.js","sourceRoot":"","sources":["../../src/thread/ThreadManager.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAoC;AACpC,gDAAwB;AACxB,mCAAoC;AACpC,mCAMiB;AAEjB;;;;GAIG;AACH,MAAa,aAAa;IAChB,KAAK,CAAc;IACnB,SAAS,CAAS;IAClB,WAAW,CAAS;IAE5B,YAAoB,SAAiB,EAAE,WAAmB,EAAE,KAAkB;QAC5E,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,SAAkB;QACxC,MAAM,OAAO,GAAG,SAAS;YACvB,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC;YACrC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,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 -0,0 +1,6 @@
|
|
|
1
|
+
export { ThreadManager } from './ThreadManager';
|
|
2
|
+
export { ThreadExecutorPool } from './ThreadExecutorPool';
|
|
3
|
+
export type { ExecutorFactory } from './ThreadExecutorPool';
|
|
4
|
+
export type { Thread, ThreadStore, ThreadSummary } from './types';
|
|
5
|
+
export { MAX_THREADS, DEFAULT_THREAD_NAME, THREAD_NAME_REGEX } from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/thread/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.THREAD_NAME_REGEX = exports.DEFAULT_THREAD_NAME = exports.MAX_THREADS = exports.ThreadExecutorPool = exports.ThreadManager = void 0;
|
|
4
|
+
var ThreadManager_1 = require("./ThreadManager");
|
|
5
|
+
Object.defineProperty(exports, "ThreadManager", { enumerable: true, get: function () { return ThreadManager_1.ThreadManager; } });
|
|
6
|
+
var ThreadExecutorPool_1 = require("./ThreadExecutorPool");
|
|
7
|
+
Object.defineProperty(exports, "ThreadExecutorPool", { enumerable: true, get: function () { return ThreadExecutorPool_1.ThreadExecutorPool; } });
|
|
8
|
+
var types_1 = require("./types");
|
|
9
|
+
Object.defineProperty(exports, "MAX_THREADS", { enumerable: true, get: function () { return types_1.MAX_THREADS; } });
|
|
10
|
+
Object.defineProperty(exports, "DEFAULT_THREAD_NAME", { enumerable: true, get: function () { return types_1.DEFAULT_THREAD_NAME; } });
|
|
11
|
+
Object.defineProperty(exports, "THREAD_NAME_REGEX", { enumerable: true, get: function () { return types_1.THREAD_NAME_REGEX; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/thread/index.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAG3B,iCAA8E;AAArE,oGAAA,WAAW,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAAE,0GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thread state model for true parallel execution.
|
|
3
|
+
* Each thread has its own independent executor process.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MAX_THREADS = 5;
|
|
6
|
+
export declare const DEFAULT_THREAD_NAME = "default";
|
|
7
|
+
export declare const THREAD_NAME_REGEX: RegExp;
|
|
8
|
+
export interface Thread {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
sessionId: string | null;
|
|
12
|
+
workingDirectory: string;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
lastActiveAt: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ThreadStore {
|
|
17
|
+
threads: Record<string, Thread>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Lightweight thread summary for wire protocol and card display.
|
|
21
|
+
* Status is runtime-only (not persisted) — computed from ThreadExecutorPool.
|
|
22
|
+
*/
|
|
23
|
+
export interface ThreadSummary {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
status: 'idle' | 'running' | 'error';
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/thread/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,iBAAiB,QAA6D,CAAC;AAE5F,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;CACtC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Thread state model for true parallel execution.
|
|
4
|
+
* Each thread has its own independent executor process.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.THREAD_NAME_REGEX = exports.DEFAULT_THREAD_NAME = exports.MAX_THREADS = void 0;
|
|
8
|
+
exports.MAX_THREADS = 5;
|
|
9
|
+
exports.DEFAULT_THREAD_NAME = 'default';
|
|
10
|
+
exports.THREAD_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9-]{0,28}[a-zA-Z0-9]$|^[a-zA-Z0-9]$/;
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/thread/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAChC,QAAA,iBAAiB,GAAG,0DAA0D,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ThreadSummary } from '../thread/types';
|
|
1
2
|
/**
|
|
2
3
|
* WebSocket protocol version.
|
|
3
4
|
* Increment this when making breaking changes to the wire format.
|
|
@@ -98,6 +99,8 @@ export interface IncomingMessage {
|
|
|
98
99
|
timestamp: number;
|
|
99
100
|
/** Whether this is a passthrough slash command */
|
|
100
101
|
isSlashCommand?: boolean;
|
|
102
|
+
/** Target thread ID for multi-thread routing (optional — defaults to default thread) */
|
|
103
|
+
threadId?: string;
|
|
101
104
|
}
|
|
102
105
|
/**
|
|
103
106
|
* Stream message types
|
|
@@ -107,7 +110,7 @@ export type StreamType = 'text' | 'tool_use' | 'tool_result' | 'redacted_thinkin
|
|
|
107
110
|
* Outgoing message to router server
|
|
108
111
|
*/
|
|
109
112
|
export interface OutgoingMessage {
|
|
110
|
-
type: 'result' | 'progress' | 'status' | 'pong' | 'structured' | 'stream';
|
|
113
|
+
type: 'result' | 'progress' | 'status' | 'pong' | 'structured' | 'stream' | 'response';
|
|
111
114
|
messageId: string;
|
|
112
115
|
success?: boolean;
|
|
113
116
|
/** Plain text output (for backward compatibility) */
|
|
@@ -130,5 +133,13 @@ export interface OutgoingMessage {
|
|
|
130
133
|
toolResult?: ToolResultInfo;
|
|
131
134
|
/** Plan content (when streamType === 'plan_mode') */
|
|
132
135
|
planContent?: string;
|
|
136
|
+
/** Thread ID that produced this output (optional — for multi-thread routing) */
|
|
137
|
+
threadId?: string;
|
|
138
|
+
/** Runtime thread summaries (for card display) */
|
|
139
|
+
threads?: ThreadSummary[];
|
|
140
|
+
/** Current working directory (for response messages) */
|
|
141
|
+
cwd?: string;
|
|
142
|
+
/** Session abbreviation */
|
|
143
|
+
sessionAbbr?: string;
|
|
133
144
|
}
|
|
134
145
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAU,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,mBAAmB,CAAC;AAErG;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM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,MAAM,CAAC;IAChB,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qDAAqD;IACrD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAG7C;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,CAAC,CAAC;AAElC;;;GAGG;AACU,QAAA,WAAW,GAAG,sBAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yu_robotics/remote-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.33",
|
|
4
4
|
"description": "Remote control Claude Code CLI via mobile",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
18
|
"dev": "tsx watch src/index.ts",
|
|
19
|
-
"test": "vitest",
|
|
20
|
-
"test:coverage": "vitest --coverage",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:coverage": "vitest run --coverage",
|
|
21
21
|
"prepublishOnly": "npm run build && npm test"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|