@linkshell/host 0.4.0 → 0.4.1
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/host/src/drivers/claude/transcript.d.ts +68 -68
- package/dist/host/src/drivers/codex/app-server.d.ts +31 -6
- package/dist/host/src/drivers/codex/app-server.js +99 -24
- package/dist/host/src/drivers/codex/app-server.js.map +1 -1
- package/dist/host/src/drivers/codex/desktop-ipc.d.ts +8 -0
- package/dist/host/src/drivers/codex/desktop-ipc.js +124 -0
- package/dist/host/src/drivers/codex/desktop-ipc.js.map +1 -0
- package/dist/host/src/drivers/codex/driver.d.ts +111 -2
- package/dist/host/src/drivers/codex/driver.js +629 -63
- package/dist/host/src/drivers/codex/driver.js.map +1 -1
- package/dist/host/src/drivers/codex/mapper.d.ts +21 -0
- package/dist/host/src/drivers/codex/mapper.js +45 -6
- package/dist/host/src/drivers/codex/mapper.js.map +1 -1
- package/dist/host/src/drivers/types.d.ts +6 -0
- package/dist/host/src/fs.d.ts +3 -3
- package/dist/host/src/hub.js +8 -1
- package/dist/host/src/hub.js.map +1 -1
- package/dist/host/src/input.d.ts +4 -4
- package/dist/host/src/terminals.d.ts +1 -1
- package/dist/host/tsconfig.tsbuildinfo +1 -1
- package/dist/wire/src/model.d.ts +130 -130
- package/dist/wire/src/rpc.d.ts +1977 -1977
- package/dist/wire/src/updates.d.ts +545 -545
- package/package.json +2 -2
- package/dist/host/src/input-helper.d.ts +0 -1
- package/dist/host/src/input-helper.js +0 -564
- package/dist/host/src/input-helper.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desktop-ipc.js","sourceRoot":"","sources":["../../../../../src/drivers/codex/desktop-ipc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAe,MAAM,UAAU,CA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,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE;oBACrB,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;wBAClB,YAAY,CAAC,KAAK,CAAC,CAAC;wBACpB,OAAO,CAAC,MAAM,CAAC,CAAC;oBAClB,CAAC;oBACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;wBAChB,YAAY,CAAC,KAAK,CAAC,CAAC;wBACpB,MAAM,CAAC,KAAK,CAAC,CAAC;oBAChB,CAAC;iBACF,CAAC,CAAC;gBACH,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAC3H,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -8,10 +8,31 @@ export interface CodexDriverOptions {
|
|
|
8
8
|
hostVersion: string;
|
|
9
9
|
/** Delay before restarting a crashed app-server; doubles up to 30s. */
|
|
10
10
|
restartDelayMs?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Codex's own background server, joined for the threads that live in it
|
|
13
|
+
* (default: where the installed Codex keeps it). `false`: never.
|
|
14
|
+
*/
|
|
15
|
+
sharedSocketPath?: string | false;
|
|
16
|
+
/**
|
|
17
|
+
* The bus the Codex desktop app's windows share, through which it is asked
|
|
18
|
+
* to stop a turn it runs (default: where the installed Codex keeps it). `false`: never.
|
|
19
|
+
*/
|
|
20
|
+
desktopBusPath?: string | false;
|
|
21
|
+
/** How often a thread that can only be read is looked at again. */
|
|
22
|
+
observeIntervalMs?: number;
|
|
23
|
+
/** How long a thread no device has open, and that isn't working, stays joined. */
|
|
24
|
+
releaseDelayMs?: number;
|
|
11
25
|
}
|
|
12
26
|
/**
|
|
13
27
|
* Codex, tier multi_client: LinkShell and the desktop TUI (`codex --remote`)
|
|
14
28
|
* are both clients of one app-server, so every thread is live on both sides.
|
|
29
|
+
*
|
|
30
|
+
* Codex lets one process have a thread loaded at a time. A thread loaded in
|
|
31
|
+
* Codex's own background server (a plain `codex` in a terminal) is joined
|
|
32
|
+
* there, as one more client. A thread in a process that takes no other
|
|
33
|
+
* clients (the desktop app, an IDE extension) is read from disk as that
|
|
34
|
+
* process writes it; a message for it goes into Codex's own queue, which that
|
|
35
|
+
* process starts when it is idle; and its turn is stopped by asking the app.
|
|
15
36
|
*/
|
|
16
37
|
export declare class CodexDriver implements AgentDriver {
|
|
17
38
|
private readonly options;
|
|
@@ -52,12 +73,35 @@ export declare class CodexDriver implements AgentDriver {
|
|
|
52
73
|
private restartTimer?;
|
|
53
74
|
private restartDelay;
|
|
54
75
|
private stopped;
|
|
76
|
+
private shared?;
|
|
77
|
+
/** Threads loaded in Codex's background server: announced by it, or joined there. */
|
|
78
|
+
private readonly inShared;
|
|
79
|
+
private readonly observed;
|
|
80
|
+
private readonly takingUp;
|
|
81
|
+
/** Messages in Codex's own queue for threads another process holds: it starts them when it is idle or its turn ends. */
|
|
82
|
+
private readonly waiting;
|
|
83
|
+
/** Notifications for a thread being joined, held until its history has been read. */
|
|
84
|
+
private readonly joining;
|
|
85
|
+
/** Threads a device has open. */
|
|
86
|
+
private readonly watching;
|
|
87
|
+
/** Threads another client of this host's app-server opened (`linkshell codex`): followed for as long as the host runs. */
|
|
88
|
+
private readonly kept;
|
|
89
|
+
/** Threads started here that have had no turn: nothing on disk yet to come back to. */
|
|
90
|
+
private readonly fresh;
|
|
91
|
+
private readonly releases;
|
|
92
|
+
/** What was last announced per thread (settings, commands): a thread joined again says it only if it changed. */
|
|
93
|
+
private readonly announced;
|
|
94
|
+
private readonly observeIntervalMs;
|
|
95
|
+
private readonly releaseDelayMs;
|
|
96
|
+
private readonly sharedSocketPath?;
|
|
97
|
+
private readonly desktopBusPath?;
|
|
55
98
|
constructor(options: CodexDriverOptions);
|
|
56
99
|
status(): DriverStatus;
|
|
57
100
|
start(host: DriverHost): Promise<DriverStatus>;
|
|
58
101
|
authStatus(): Promise<AgentAuth>;
|
|
59
102
|
stop(): Promise<void>;
|
|
60
103
|
listSessions(limit: number): Promise<DiscoveredSession[]>;
|
|
104
|
+
private stateElsewhere;
|
|
61
105
|
/** Codex's own fork: a new thread with this one's turns, all or through `lastTurnId`, in `cwd`. */
|
|
62
106
|
fork(nativeId: string, options: ForkOptions): Promise<DiscoveredSession>;
|
|
63
107
|
createSession(options: {
|
|
@@ -65,10 +109,67 @@ export declare class CodexDriver implements AgentDriver {
|
|
|
65
109
|
model?: string;
|
|
66
110
|
}): Promise<DiscoveredSession>;
|
|
67
111
|
attach(nativeId: string): Promise<HistoryItem[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Subscribes to a thread where it can be driven: this host's app-server, or
|
|
114
|
+
* Codex's background server when the thread is loaded there. What the
|
|
115
|
+
* server sends from then on is held until `goLive`.
|
|
116
|
+
*/
|
|
117
|
+
private subscribe;
|
|
118
|
+
/** thread/resume where the thread can be loaded: here, or in Codex's background server if it is loaded there. */
|
|
119
|
+
private resume;
|
|
120
|
+
/** Says where the joined thread stands, then lets through what arrived while it was being read. */
|
|
121
|
+
private goLive;
|
|
122
|
+
/** Reads the thread from disk, and keeps reading while a device has it open. */
|
|
123
|
+
private observe;
|
|
124
|
+
/** Reports what the other process has finished since the last look. An item still being written isn't on disk. */
|
|
125
|
+
private refresh;
|
|
126
|
+
private report;
|
|
127
|
+
private stopObserving;
|
|
128
|
+
/**
|
|
129
|
+
* Before writing to a thread that could only be read: joins it if whoever
|
|
130
|
+
* had it has let go, with what they wrote since the last look. Still held,
|
|
131
|
+
* it stays as it is.
|
|
132
|
+
*/
|
|
133
|
+
private takeUp;
|
|
134
|
+
/**
|
|
135
|
+
* Leaves a message in Codex's own queue for a thread another process holds.
|
|
136
|
+
* That process starts it when it is idle, or right after the turn it is running.
|
|
137
|
+
*/
|
|
138
|
+
private enqueue;
|
|
139
|
+
/** What waits in Codex's queue for the thread, as the session's queue on the devices. */
|
|
140
|
+
private syncWaiting;
|
|
141
|
+
private setWaiting;
|
|
142
|
+
unqueue(nativeId: string, clientMessageId: string): boolean;
|
|
143
|
+
/** A queued message can't be put into the turn another Codex is running: that turn is stopped, and the queue goes on. */
|
|
144
|
+
sendQueuedNow(nativeId: string): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Stops the turn a Codex that can't be joined is running. Only its own app
|
|
147
|
+
* can: it is asked over the bus its windows share.
|
|
148
|
+
*/
|
|
149
|
+
private stopElsewhere;
|
|
150
|
+
/**
|
|
151
|
+
* What a message for a thread held elsewhere is refused with. The apps show
|
|
152
|
+
* a failed message without its reason, so the reason goes into the session too.
|
|
153
|
+
*/
|
|
154
|
+
private refused;
|
|
155
|
+
/** Says, when it becomes so and when it is over, that the session is in a Codex this host can't join. */
|
|
156
|
+
private reportHeld;
|
|
157
|
+
/** Whether a device has the session open. */
|
|
158
|
+
watched(nativeId: string, open: boolean): void;
|
|
159
|
+
private cancelRelease;
|
|
160
|
+
/**
|
|
161
|
+
* A thread stays loaded, and closed to every other Codex program, for as
|
|
162
|
+
* long as this host is subscribed to it. One that no device has open and
|
|
163
|
+
* that isn't working is let go after a while, so the desktop app or a
|
|
164
|
+
* `codex` in a terminal can open it; opening it on a device joins it again.
|
|
165
|
+
*/
|
|
166
|
+
private considerRelease;
|
|
167
|
+
private release;
|
|
168
|
+
private hasApprovals;
|
|
68
169
|
/** Nests each sub-agent's own history right after the call that spawned it. */
|
|
69
170
|
private withSubAgents;
|
|
70
171
|
detach(nativeId: string): Promise<void>;
|
|
71
|
-
prompt(nativeId: string, content: ContentBlock[], clientMessageId: string): Promise<"started" | "steered">;
|
|
172
|
+
prompt(nativeId: string, content: ContentBlock[], clientMessageId: string): Promise<"started" | "steered" | "queued">;
|
|
72
173
|
/**
|
|
73
174
|
* `/compact`, `/review`, `/init` and `/<skill>`: what the TUI does for them,
|
|
74
175
|
* through the app-server. Anything else is an ordinary message.
|
|
@@ -79,6 +180,7 @@ export declare class CodexDriver implements AgentDriver {
|
|
|
79
180
|
setConfig(nativeId: string, optionId: string, value: string): Promise<void>;
|
|
80
181
|
private loadModels;
|
|
81
182
|
private announceConfig;
|
|
183
|
+
private isNews;
|
|
82
184
|
private loadSkills;
|
|
83
185
|
/** What `/` offers on a device: the commands above, then the skills this project can use. */
|
|
84
186
|
private announceCommands;
|
|
@@ -88,7 +190,7 @@ export declare class CodexDriver implements AgentDriver {
|
|
|
88
190
|
cancel(nativeId: string): Promise<void>;
|
|
89
191
|
respondPermission(nativeId: string, requestId: string, optionId: string): Promise<void>;
|
|
90
192
|
answerQuestion(nativeId: string, requestId: string, answers: QuestionAnswer[]): Promise<void>;
|
|
91
|
-
desktopLaunch(args: string[], nativeId?: string): LaunchSpec
|
|
193
|
+
desktopLaunch(args: string[], nativeId?: string): Promise<LaunchSpec>;
|
|
92
194
|
private boot;
|
|
93
195
|
/** Follows every thread already live in the app-server (e.g. opened in the TUI). */
|
|
94
196
|
private reattachLoaded;
|
|
@@ -107,4 +209,11 @@ export declare class CodexDriver implements AgentDriver {
|
|
|
107
209
|
private onServerRequest;
|
|
108
210
|
private rememberTitle;
|
|
109
211
|
private rpc;
|
|
212
|
+
/** A request about a thread, to the server it is loaded in. */
|
|
213
|
+
private rpcFor;
|
|
214
|
+
/** Connects to Codex's background server, if it is running. */
|
|
215
|
+
private connectShared;
|
|
216
|
+
/** Codex's background server went away (stopped, or restarted by its updater): the threads joined there are joined again wherever they are now. */
|
|
217
|
+
private onSharedDown;
|
|
218
|
+
private abandonApprovals;
|
|
110
219
|
}
|