linkshell-cli 0.6.1 → 0.6.3
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 +47 -132
- package/dist/cli/src/auth.js +1 -1
- package/dist/cli/src/auth.js.map +1 -1
- package/dist/cli/src/commands/doctor.d.ts +1 -1
- package/dist/cli/src/commands/doctor.js +76 -36
- package/dist/cli/src/commands/doctor.js.map +1 -1
- package/dist/cli/src/commands/host.d.ts +15 -0
- package/dist/cli/src/commands/host.js +101 -20
- package/dist/cli/src/commands/host.js.map +1 -1
- package/dist/cli/src/commands/logout.d.ts +1 -1
- package/dist/cli/src/commands/logout.js +10 -2
- package/dist/cli/src/commands/logout.js.map +1 -1
- package/dist/cli/src/commands/upgrade.js +11 -0
- package/dist/cli/src/commands/upgrade.js.map +1 -1
- package/dist/cli/src/config.js +1 -1
- package/dist/cli/src/config.js.map +1 -1
- package/dist/cli/src/index.js +105 -120
- package/dist/cli/src/index.js.map +1 -1
- package/dist/cli/src/utils/daemon.d.ts +2 -0
- package/dist/cli/src/utils/daemon.js +4 -0
- package/dist/cli/src/utils/daemon.js.map +1 -1
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/dist/host/src/carry.d.ts +15 -0
- package/dist/host/src/carry.js +83 -0
- package/dist/host/src/carry.js.map +1 -0
- package/dist/host/src/drivers/acp/driver.d.ts +21 -3
- package/dist/host/src/drivers/acp/driver.js +99 -13
- package/dist/host/src/drivers/acp/driver.js.map +1 -1
- package/dist/host/src/drivers/acp/mapper.d.ts +5 -1
- package/dist/host/src/drivers/acp/mapper.js +58 -6
- package/dist/host/src/drivers/acp/mapper.js.map +1 -1
- package/dist/host/src/drivers/claude/driver.d.ts +76 -8
- package/dist/host/src/drivers/claude/driver.js +510 -29
- package/dist/host/src/drivers/claude/driver.js.map +1 -1
- package/dist/host/src/drivers/claude/holders.d.ts +9 -0
- package/dist/host/src/drivers/claude/holders.js +61 -0
- package/dist/host/src/drivers/claude/holders.js.map +1 -0
- package/dist/host/src/drivers/claude/transcript.d.ts +105 -61
- package/dist/host/src/drivers/claude/transcript.js +260 -22
- package/dist/host/src/drivers/claude/transcript.js.map +1 -1
- package/dist/host/src/drivers/codex/commands.d.ts +27 -0
- package/dist/host/src/drivers/codex/commands.js +23 -0
- package/dist/host/src/drivers/codex/commands.js.map +1 -0
- package/dist/host/src/drivers/codex/driver.d.ts +21 -1
- package/dist/host/src/drivers/codex/driver.js +140 -1
- package/dist/host/src/drivers/codex/driver.js.map +1 -1
- package/dist/host/src/drivers/codex/mapper.d.ts +4 -0
- package/dist/host/src/drivers/codex/mapper.js +29 -5
- package/dist/host/src/drivers/codex/mapper.js.map +1 -1
- package/dist/host/src/drivers/types.d.ts +45 -4
- package/dist/host/src/fs.d.ts +26 -4
- package/dist/host/src/fs.js +71 -17
- package/dist/host/src/fs.js.map +1 -1
- package/dist/host/src/gateway.d.ts +3 -0
- package/dist/host/src/gateway.js +10 -1
- package/dist/host/src/gateway.js.map +1 -1
- package/dist/host/src/host.d.ts +7 -3
- package/dist/host/src/host.js +53 -21
- package/dist/host/src/host.js.map +1 -1
- package/dist/host/src/hub.d.ts +98 -14
- package/dist/host/src/hub.js +639 -27
- package/dist/host/src/hub.js.map +1 -1
- package/dist/host/src/index.d.ts +1 -1
- package/dist/host/src/index.js +1 -1
- package/dist/host/src/index.js.map +1 -1
- package/dist/host/src/legacy.d.ts +7 -0
- package/dist/host/src/legacy.js +36 -0
- package/dist/host/src/legacy.js.map +1 -0
- package/dist/host/src/rpc/server.d.ts +4 -2
- package/dist/host/src/rpc/server.js +62 -5
- package/dist/host/src/rpc/server.js.map +1 -1
- package/dist/host/src/screen.d.ts +11 -0
- package/dist/host/src/screen.js +54 -2
- package/dist/host/src/screen.js.map +1 -1
- package/dist/host/src/shell-env.d.ts +6 -0
- package/dist/host/src/shell-env.js +48 -0
- package/dist/host/src/shell-env.js.map +1 -1
- package/dist/host/src/slim.d.ts +17 -0
- package/dist/host/src/slim.js +66 -0
- package/dist/host/src/slim.js.map +1 -0
- package/dist/host/src/store.d.ts +81 -3
- package/dist/host/src/store.js +249 -16
- package/dist/host/src/store.js.map +1 -1
- package/dist/host/src/terminals.d.ts +4 -4
- package/dist/host/src/terminals.js +19 -4
- package/dist/host/src/terminals.js.map +1 -1
- package/dist/host/src/worktrees.d.ts +36 -0
- package/dist/host/src/worktrees.js +96 -0
- package/dist/host/src/worktrees.js.map +1 -0
- package/dist/wire/src/model.d.ts +334 -139
- package/dist/wire/src/model.js +68 -0
- package/dist/wire/src/model.js.map +1 -1
- package/dist/wire/src/relay-client.d.ts +2 -0
- package/dist/wire/src/relay-client.js +12 -0
- package/dist/wire/src/relay-client.js.map +1 -1
- package/dist/wire/src/rpc.d.ts +7273 -890
- package/dist/wire/src/rpc.js +154 -6
- package/dist/wire/src/rpc.js.map +1 -1
- package/dist/wire/src/updates.d.ts +498 -498
- package/package.json +5 -5
- package/src/auth.ts +1 -1
- package/src/commands/doctor.ts +76 -34
- package/src/commands/host.ts +109 -19
- package/src/commands/logout.ts +10 -2
- package/src/commands/upgrade.ts +11 -0
- package/src/config.ts +1 -1
- package/src/index.ts +104 -137
- package/src/utils/daemon.ts +5 -0
package/dist/host/src/hub.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type AgentInfo, type ContentBlock, type SessionEvent, type SessionSummary } from "@linkshell/wire";
|
|
1
|
+
import { type AgentInfo, type ContentBlock, type SessionEvent, type SessionSummary, type SubagentInfo, type GitInfo, type ProjectSummary, type WorktreeEntry } from "@linkshell/wire";
|
|
2
2
|
import type { AgentDriver, DesktopController, DesktopLaunchContext, DriverHost, LaunchSpec } from "./drivers/types.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type HostStore } from "./store.js";
|
|
4
4
|
export interface Subscriber {
|
|
5
5
|
event(event: SessionEvent): void;
|
|
6
|
+
/** The backlog that follows starts after `startSeq`, not where the subscriber left off. */
|
|
7
|
+
window?(startSeq: number): void;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* The host's source of truth for sessions. Drivers push native events in;
|
|
@@ -12,16 +14,23 @@ export interface Subscriber {
|
|
|
12
14
|
export declare class SessionHub {
|
|
13
15
|
private readonly store;
|
|
14
16
|
private readonly log;
|
|
17
|
+
/** Where the host keeps its own files: worktrees go under it. */
|
|
18
|
+
private readonly home;
|
|
15
19
|
private readonly drivers;
|
|
16
20
|
private readonly live;
|
|
17
21
|
private readonly summaryListeners;
|
|
22
|
+
private readonly removedListeners;
|
|
18
23
|
private readonly auth;
|
|
19
24
|
/** Terminals (`linkshell <agent>`) currently driving handoff sessions. */
|
|
20
25
|
private readonly desktops;
|
|
21
26
|
private discoveryTimer?;
|
|
27
|
+
private readonly branches;
|
|
28
|
+
private worktreeCache?;
|
|
22
29
|
private authRefreshing?;
|
|
23
30
|
readonly driverHost: DriverHost;
|
|
24
|
-
constructor(store: HostStore, drivers: AgentDriver[], log?: (message: string) => void
|
|
31
|
+
constructor(store: HostStore, drivers: AgentDriver[], log?: (message: string) => void,
|
|
32
|
+
/** Where the host keeps its own files: worktrees go under it. */
|
|
33
|
+
home?: string);
|
|
25
34
|
start(options?: {
|
|
26
35
|
discoveryIntervalMs?: number;
|
|
27
36
|
}): Promise<void>;
|
|
@@ -41,14 +50,16 @@ export declare class SessionHub {
|
|
|
41
50
|
sessions: SessionSummary[];
|
|
42
51
|
nextBefore?: number;
|
|
43
52
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
sessionCount: number;
|
|
49
|
-
}[];
|
|
53
|
+
/** Projects, each with the branch checked out there now. */
|
|
54
|
+
listProjects(limit?: number): Promise<ProjectSummary[]>;
|
|
55
|
+
/** Asked for every project each time the list is: remembered for a moment. */
|
|
56
|
+
private branchOf;
|
|
50
57
|
getSession(sessionId: string): SessionSummary;
|
|
51
58
|
/** Adds the live-only fields (current activity, first pending permission) to a stored summary. */
|
|
59
|
+
/** Marks a session that works in one of LinkShell's worktrees. */
|
|
60
|
+
private withWorktree;
|
|
61
|
+
/** The worktrees table, read once and again whenever it changes. */
|
|
62
|
+
private worktrees;
|
|
52
63
|
private decorate;
|
|
53
64
|
createSession(input: {
|
|
54
65
|
agent: string;
|
|
@@ -56,17 +67,88 @@ export declare class SessionHub {
|
|
|
56
67
|
model?: string;
|
|
57
68
|
prompt?: ContentBlock[];
|
|
58
69
|
clientMessageId?: string;
|
|
70
|
+
/** Start in a new git worktree of `cwd`'s repository. */
|
|
71
|
+
worktree?: boolean;
|
|
72
|
+
}): Promise<SessionSummary>;
|
|
73
|
+
/**
|
|
74
|
+
* A new session that starts with this one's conversation: all of it, or
|
|
75
|
+
* through the turn `itemId` is in. With `worktree` it works in a new git
|
|
76
|
+
* worktree of the project.
|
|
77
|
+
*/
|
|
78
|
+
fork(sessionId: string, options?: {
|
|
79
|
+
itemId?: string;
|
|
80
|
+
worktree?: boolean;
|
|
59
81
|
}): Promise<SessionSummary>;
|
|
60
82
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
83
|
+
* A fork for an agent that can't fork a session itself: a new session that
|
|
84
|
+
* shows the conversation up to `cut` (its latest page, from our log), whose
|
|
85
|
+
* agent is told that conversation with the first message sent to it.
|
|
86
|
+
*/
|
|
87
|
+
private forkByReplay;
|
|
88
|
+
/** Hands a message to the agent — with the conversation a forked session still owes it, the first time. */
|
|
89
|
+
private deliver;
|
|
90
|
+
gitInfo(path: string): Promise<GitInfo | undefined>;
|
|
91
|
+
private newWorktree;
|
|
92
|
+
private dropWorktree;
|
|
93
|
+
listWorktrees(): Promise<WorktreeEntry[]>;
|
|
94
|
+
/** Removes a worktree and its branch, unless a session uses it or (without `force`) work in it would be lost. */
|
|
95
|
+
removeWorktree(path: string, force?: boolean): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Sends the backlog, then streams live events. A fresh subscriber (or one too
|
|
98
|
+
* far behind to catch up) gets the latest turns only, after the standing
|
|
99
|
+
* state from before them; earlier history is read in pages (`history`).
|
|
100
|
+
* The backlog read and the subscriber registration happen in one synchronous
|
|
101
|
+
* step, so no event can fall between them.
|
|
102
|
+
*/
|
|
103
|
+
subscribe(sessionId: string, fromSeq: number, subscriber: Subscriber): Promise<{
|
|
104
|
+
session: SessionSummary;
|
|
105
|
+
startSeq: number;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* A handoff agent names its commands only once it runs here, so a session
|
|
109
|
+
* still driven at the desk has none to offer. It borrows the list of the
|
|
110
|
+
* agent's latest session in the same folder (or its latest anywhere) until
|
|
111
|
+
* it gets its own: `/compact` typed on the phone works from the first message.
|
|
64
112
|
*/
|
|
65
|
-
|
|
113
|
+
private lendCommands;
|
|
114
|
+
/** The page of history before `beforeSeq`, oldest first. */
|
|
115
|
+
history(sessionId: string, beforeSeq: number): {
|
|
116
|
+
events: SessionEvent[];
|
|
117
|
+
startSeq: number;
|
|
118
|
+
};
|
|
119
|
+
/** The sub-agents the session started, newest first. */
|
|
120
|
+
subagents(sessionId: string): SubagentInfo[];
|
|
121
|
+
private subagentsOf;
|
|
122
|
+
/** Keeps the sub-agent tally current; true when it changed. */
|
|
123
|
+
private trackSubagent;
|
|
124
|
+
/** A sub-agent's conversation: its call, then what happened under it. */
|
|
125
|
+
subagent(sessionId: string, toolCallId: string): SessionEvent[];
|
|
126
|
+
readEvent(sessionId: string, seq: number): SessionEvent | undefined;
|
|
127
|
+
/** What still holds at `seq` from the events before it: settings, an open turn, unanswered approvals. */
|
|
128
|
+
private standingBefore;
|
|
66
129
|
unsubscribe(sessionId: string, subscriber: Subscriber): void;
|
|
67
|
-
prompt(sessionId: string, clientMessageId: string, content: ContentBlock[]): Promise<"started" | "steered" | "queued" | "duplicate">;
|
|
130
|
+
prompt(sessionId: string, clientMessageId: string, content: ContentBlock[], whenBusy?: "queue"): Promise<"started" | "steered" | "queued" | "duplicate">;
|
|
68
131
|
/** Retries attaching a session that just became joinable. */
|
|
69
132
|
private attachWhenReady;
|
|
133
|
+
unqueue(sessionId: string, clientMessageId: string): boolean;
|
|
134
|
+
reorderQueue(sessionId: string, clientMessageIds: string[]): void;
|
|
135
|
+
/**
|
|
136
|
+
* Sends a queued message without waiting for the running turn to end: into
|
|
137
|
+
* that turn if the agent takes input mid-turn, otherwise by stopping it.
|
|
138
|
+
*/
|
|
139
|
+
sendQueuedNow(sessionId: string, clientMessageId?: string): Promise<void>;
|
|
140
|
+
/** A turn ended: the next held message starts the following one. */
|
|
141
|
+
private sendHeld;
|
|
142
|
+
onRemoved(listener: (sessionId: string) => void): () => void;
|
|
143
|
+
archive(sessionId: string, archived: boolean): Promise<SessionSummary>;
|
|
144
|
+
rename(sessionId: string, title: string): Promise<SessionSummary>;
|
|
145
|
+
/**
|
|
146
|
+
* Deletes a session. A worktree only it used goes too when nothing in it
|
|
147
|
+
* would be lost (or `worktree` says "remove"); "keep" leaves it.
|
|
148
|
+
*/
|
|
149
|
+
delete(sessionId: string, worktree?: "keep" | "remove"): Promise<void>;
|
|
150
|
+
/** Drops a session from LinkShell and tells every client. */
|
|
151
|
+
private forget;
|
|
70
152
|
cancel(sessionId: string): Promise<void>;
|
|
71
153
|
respondPermission(sessionId: string, requestId: string, optionId: string): Promise<void>;
|
|
72
154
|
desktopLaunch(agent: string, args: string[], sessionId: string | undefined, context: DesktopLaunchContext): Promise<LaunchSpec & {
|
|
@@ -85,5 +167,7 @@ export declare class SessionHub {
|
|
|
85
167
|
private ingest;
|
|
86
168
|
private commit;
|
|
87
169
|
private applyToSummary;
|
|
170
|
+
/** Sends the session's current summary to every client (its queue or activity changed). */
|
|
171
|
+
private announce;
|
|
88
172
|
private emitSummary;
|
|
89
173
|
}
|