linkshell-cli 0.5.42 → 0.6.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.
Files changed (135) hide show
  1. package/dist/cli/src/commands/host.d.ts +30 -0
  2. package/dist/cli/src/commands/host.js +278 -0
  3. package/dist/cli/src/commands/host.js.map +1 -0
  4. package/dist/cli/src/commands/pair.d.ts +1 -0
  5. package/dist/cli/src/commands/pair.js +51 -0
  6. package/dist/cli/src/commands/pair.js.map +1 -0
  7. package/dist/cli/src/index.js +69 -0
  8. package/dist/cli/src/index.js.map +1 -1
  9. package/dist/cli/src/utils/daemon.d.ts +1 -1
  10. package/dist/cli/src/utils/daemon.js +3 -2
  11. package/dist/cli/src/utils/daemon.js.map +1 -1
  12. package/dist/cli/tsconfig.tsbuildinfo +1 -1
  13. package/dist/host/src/drivers/acp/connection.d.ts +61 -0
  14. package/dist/host/src/drivers/acp/connection.js +121 -0
  15. package/dist/host/src/drivers/acp/connection.js.map +1 -0
  16. package/dist/host/src/drivers/acp/driver.d.ts +110 -0
  17. package/dist/host/src/drivers/acp/driver.js +438 -0
  18. package/dist/host/src/drivers/acp/driver.js.map +1 -0
  19. package/dist/host/src/drivers/acp/mapper.d.ts +49 -0
  20. package/dist/host/src/drivers/acp/mapper.js +411 -0
  21. package/dist/host/src/drivers/acp/mapper.js.map +1 -0
  22. package/dist/host/src/drivers/auth.d.ts +7 -0
  23. package/dist/host/src/drivers/auth.js +57 -0
  24. package/dist/host/src/drivers/auth.js.map +1 -0
  25. package/dist/host/src/drivers/claude/driver.d.ts +76 -0
  26. package/dist/host/src/drivers/claude/driver.js +331 -0
  27. package/dist/host/src/drivers/claude/driver.js.map +1 -0
  28. package/dist/host/src/drivers/claude/transcript.d.ts +335 -0
  29. package/dist/host/src/drivers/claude/transcript.js +516 -0
  30. package/dist/host/src/drivers/claude/transcript.js.map +1 -0
  31. package/dist/host/src/drivers/codex/app-server.d.ts +36 -0
  32. package/dist/host/src/drivers/codex/app-server.js +144 -0
  33. package/dist/host/src/drivers/codex/app-server.js.map +1 -0
  34. package/dist/host/src/drivers/codex/driver.d.ts +89 -0
  35. package/dist/host/src/drivers/codex/driver.js +452 -0
  36. package/dist/host/src/drivers/codex/driver.js.map +1 -0
  37. package/dist/host/src/drivers/codex/mapper.d.ts +61 -0
  38. package/dist/host/src/drivers/codex/mapper.js +623 -0
  39. package/dist/host/src/drivers/codex/mapper.js.map +1 -0
  40. package/dist/host/src/drivers/codex/settings.d.ts +51 -0
  41. package/dist/host/src/drivers/codex/settings.js +107 -0
  42. package/dist/host/src/drivers/codex/settings.js.map +1 -0
  43. package/dist/host/src/drivers/images.d.ts +11 -0
  44. package/dist/host/src/drivers/images.js +34 -0
  45. package/dist/host/src/drivers/images.js.map +1 -0
  46. package/dist/host/src/drivers/nesting.d.ts +6 -0
  47. package/dist/host/src/drivers/nesting.js +25 -0
  48. package/dist/host/src/drivers/nesting.js.map +1 -0
  49. package/dist/host/src/drivers/registry.d.ts +21 -0
  50. package/dist/host/src/drivers/registry.js +30 -0
  51. package/dist/host/src/drivers/registry.js.map +1 -0
  52. package/dist/host/src/drivers/types.d.ts +105 -0
  53. package/dist/host/src/drivers/types.js +2 -0
  54. package/dist/host/src/drivers/types.js.map +1 -0
  55. package/dist/host/src/fs.d.ts +69 -0
  56. package/dist/host/src/fs.js +198 -0
  57. package/dist/host/src/fs.js.map +1 -0
  58. package/dist/host/src/gateway.d.ts +55 -0
  59. package/dist/host/src/gateway.js +263 -0
  60. package/dist/host/src/gateway.js.map +1 -0
  61. package/dist/host/src/host.d.ts +51 -0
  62. package/dist/host/src/host.js +133 -0
  63. package/dist/host/src/host.js.map +1 -0
  64. package/dist/host/src/hub.d.ts +89 -0
  65. package/dist/host/src/hub.js +592 -0
  66. package/dist/host/src/hub.js.map +1 -0
  67. package/dist/host/src/index.d.ts +10 -0
  68. package/dist/host/src/index.js +10 -0
  69. package/dist/host/src/index.js.map +1 -0
  70. package/dist/host/src/ports.d.ts +24 -0
  71. package/dist/host/src/ports.js +201 -0
  72. package/dist/host/src/ports.js.map +1 -0
  73. package/dist/host/src/rpc/client.d.ts +9 -0
  74. package/dist/host/src/rpc/client.js +42 -0
  75. package/dist/host/src/rpc/client.js.map +1 -0
  76. package/dist/host/src/rpc/server.d.ts +52 -0
  77. package/dist/host/src/rpc/server.js +293 -0
  78. package/dist/host/src/rpc/server.js.map +1 -0
  79. package/dist/host/src/screen.d.ts +30 -0
  80. package/dist/host/src/screen.js +230 -0
  81. package/dist/host/src/screen.js.map +1 -0
  82. package/dist/host/src/shell-env.d.ts +8 -0
  83. package/dist/host/src/shell-env.js +39 -0
  84. package/dist/host/src/shell-env.js.map +1 -0
  85. package/dist/host/src/store.d.ts +75 -0
  86. package/dist/host/src/store.js +265 -0
  87. package/dist/host/src/store.js.map +1 -0
  88. package/dist/host/src/terminals.d.ts +55 -0
  89. package/dist/host/src/terminals.js +367 -0
  90. package/dist/host/src/terminals.js.map +1 -0
  91. package/dist/shared-protocol/src/index.d.ts +3345 -3345
  92. package/dist/wire/src/crypto.d.ts +65 -0
  93. package/dist/wire/src/crypto.js +253 -0
  94. package/dist/wire/src/crypto.js.map +1 -0
  95. package/dist/wire/src/index.d.ts +8 -0
  96. package/dist/wire/src/index.js +9 -0
  97. package/dist/wire/src/index.js.map +1 -0
  98. package/dist/wire/src/model.d.ts +704 -0
  99. package/dist/wire/src/model.js +163 -0
  100. package/dist/wire/src/model.js.map +1 -0
  101. package/dist/wire/src/peer.d.ts +42 -0
  102. package/dist/wire/src/peer.js +143 -0
  103. package/dist/wire/src/peer.js.map +1 -0
  104. package/dist/wire/src/relay-client.d.ts +82 -0
  105. package/dist/wire/src/relay-client.js +259 -0
  106. package/dist/wire/src/relay-client.js.map +1 -0
  107. package/dist/wire/src/relay.d.ts +481 -0
  108. package/dist/wire/src/relay.js +129 -0
  109. package/dist/wire/src/relay.js.map +1 -0
  110. package/dist/wire/src/rpc.d.ts +4170 -0
  111. package/dist/wire/src/rpc.js +332 -0
  112. package/dist/wire/src/rpc.js.map +1 -0
  113. package/dist/wire/src/shell.d.ts +2 -0
  114. package/dist/wire/src/shell.js +62 -0
  115. package/dist/wire/src/shell.js.map +1 -0
  116. package/dist/wire/src/updates.d.ts +3325 -0
  117. package/dist/wire/src/updates.js +210 -0
  118. package/dist/wire/src/updates.js.map +1 -0
  119. package/package.json +8 -3
  120. package/src/commands/host.ts +297 -0
  121. package/src/commands/pair.ts +52 -0
  122. package/src/index.ts +74 -0
  123. package/src/utils/daemon.ts +4 -3
  124. package/dist/cli/src/commands/hook.d.ts +0 -6
  125. package/dist/cli/src/commands/hook.js +0 -120
  126. package/dist/cli/src/commands/hook.js.map +0 -1
  127. package/dist/cli/src/runtime/acp/agent-workspace-git.d.ts +0 -63
  128. package/dist/cli/src/runtime/acp/agent-workspace-git.js +0 -297
  129. package/dist/cli/src/runtime/acp/agent-workspace-git.js.map +0 -1
  130. package/dist/cli/src/runtime/acp-relay.d.ts +0 -23
  131. package/dist/cli/src/runtime/acp-relay.js +0 -73
  132. package/dist/cli/src/runtime/acp-relay.js.map +0 -1
  133. package/dist/cli/src/runtime/hook-permission-server.d.ts +0 -36
  134. package/dist/cli/src/runtime/hook-permission-server.js +0 -147
  135. package/dist/cli/src/runtime/hook-permission-server.js.map +0 -1
@@ -0,0 +1,335 @@
1
+ import type { SessionUpdate, ToolDetail, ToolKind } from "@linkshell/wire";
2
+ type Json = Record<string, unknown>;
3
+ export declare function claudeConfigDir(env?: NodeJS.ProcessEnv): string;
4
+ /** Claude's project directory name for a cwd: every non-alphanumeric character becomes "-". */
5
+ export declare function encodeProjectDir(cwd: string): string;
6
+ export declare function findTranscript(configDir: string, sessionId: string, cwd?: string): string | undefined;
7
+ /** A readable title and kind for a Claude Code tool call. */
8
+ export declare function describeClaudeTool(name: string, input: Json): {
9
+ title: string;
10
+ kind: ToolKind;
11
+ detail?: ToolDetail;
12
+ };
13
+ export interface TranscriptLineResult {
14
+ updates: SessionUpdate[];
15
+ /** When the line was written (ms). */
16
+ ts?: number;
17
+ /** A title set by /rename or generated by Claude. */
18
+ title?: string;
19
+ }
20
+ /** Converts one transcript line to wire updates. Sub-agent files pass `sidechain`. */
21
+ export declare function transcriptLine(raw: string, options?: {
22
+ sidechain?: boolean;
23
+ }): TranscriptLineResult;
24
+ /** Parses a whole transcript file. */
25
+ /** When each transcript update happened, for history import. */
26
+ export declare const transcriptTimes: WeakMap<{
27
+ content: {
28
+ type: "text";
29
+ text: string;
30
+ } | {
31
+ type: "image";
32
+ mimeType: string;
33
+ data?: string | undefined;
34
+ uri?: string | undefined;
35
+ } | {
36
+ type: "resource_link";
37
+ name: string;
38
+ uri: string;
39
+ kind?: "file" | "agent" | "skill" | undefined;
40
+ };
41
+ sessionUpdate: "user_message_chunk";
42
+ messageId?: string | undefined;
43
+ } | {
44
+ content: {
45
+ type: "text";
46
+ text: string;
47
+ } | {
48
+ type: "image";
49
+ mimeType: string;
50
+ data?: string | undefined;
51
+ uri?: string | undefined;
52
+ } | {
53
+ type: "resource_link";
54
+ name: string;
55
+ uri: string;
56
+ kind?: "file" | "agent" | "skill" | undefined;
57
+ };
58
+ messageId: string;
59
+ sessionUpdate: "agent_message_chunk";
60
+ parentToolCallId?: string | undefined;
61
+ } | {
62
+ content: {
63
+ type: "text";
64
+ text: string;
65
+ } | {
66
+ type: "image";
67
+ mimeType: string;
68
+ data?: string | undefined;
69
+ uri?: string | undefined;
70
+ } | {
71
+ type: "resource_link";
72
+ name: string;
73
+ uri: string;
74
+ kind?: "file" | "agent" | "skill" | undefined;
75
+ };
76
+ messageId: string;
77
+ sessionUpdate: "agent_thought_chunk";
78
+ parentToolCallId?: string | undefined;
79
+ } | {
80
+ status: "pending" | "completed" | "failed" | "in_progress";
81
+ kind: "search" | "other" | "read" | "edit" | "delete" | "move" | "execute" | "think" | "fetch";
82
+ title: string;
83
+ toolCallId: string;
84
+ sessionUpdate: "tool_call";
85
+ content?: ({
86
+ type: "content";
87
+ content: {
88
+ type: "text";
89
+ text: string;
90
+ } | {
91
+ type: "image";
92
+ mimeType: string;
93
+ data?: string | undefined;
94
+ uri?: string | undefined;
95
+ } | {
96
+ type: "resource_link";
97
+ name: string;
98
+ uri: string;
99
+ kind?: "file" | "agent" | "skill" | undefined;
100
+ };
101
+ } | {
102
+ path: string;
103
+ type: "diff";
104
+ newText: string;
105
+ oldText?: string | null | undefined;
106
+ } | {
107
+ path: string;
108
+ type: "patch";
109
+ diff: string;
110
+ change: "add" | "update" | "delete";
111
+ movePath?: string | undefined;
112
+ } | {
113
+ type: "terminal";
114
+ terminalId: string;
115
+ })[] | undefined;
116
+ detail?: {
117
+ type: "mcp";
118
+ tool: string;
119
+ server: string;
120
+ } | {
121
+ type: "subagent";
122
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
123
+ model?: string | undefined;
124
+ task?: string | undefined;
125
+ agentType?: string | undefined;
126
+ } | {
127
+ type: "skill";
128
+ name: string;
129
+ description?: string | undefined;
130
+ } | {
131
+ type: "web_search";
132
+ query?: string | undefined;
133
+ } | {
134
+ type: "image_generation";
135
+ prompt?: string | undefined;
136
+ } | {
137
+ type: "compaction";
138
+ } | {
139
+ type: "review";
140
+ phase: "finished" | "started";
141
+ } | undefined;
142
+ rawInput?: unknown;
143
+ parentToolCallId?: string | undefined;
144
+ locations?: {
145
+ path: string;
146
+ line?: number | undefined;
147
+ }[] | undefined;
148
+ } | {
149
+ toolCallId: string;
150
+ sessionUpdate: "tool_call_update";
151
+ status?: "pending" | "completed" | "failed" | "in_progress" | undefined;
152
+ content?: ({
153
+ type: "content";
154
+ content: {
155
+ type: "text";
156
+ text: string;
157
+ } | {
158
+ type: "image";
159
+ mimeType: string;
160
+ data?: string | undefined;
161
+ uri?: string | undefined;
162
+ } | {
163
+ type: "resource_link";
164
+ name: string;
165
+ uri: string;
166
+ kind?: "file" | "agent" | "skill" | undefined;
167
+ };
168
+ } | {
169
+ path: string;
170
+ type: "diff";
171
+ newText: string;
172
+ oldText?: string | null | undefined;
173
+ } | {
174
+ path: string;
175
+ type: "patch";
176
+ diff: string;
177
+ change: "add" | "update" | "delete";
178
+ movePath?: string | undefined;
179
+ } | {
180
+ type: "terminal";
181
+ terminalId: string;
182
+ })[] | undefined;
183
+ title?: string | undefined;
184
+ detail?: {
185
+ type: "mcp";
186
+ tool: string;
187
+ server: string;
188
+ } | {
189
+ type: "subagent";
190
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
191
+ model?: string | undefined;
192
+ task?: string | undefined;
193
+ agentType?: string | undefined;
194
+ } | {
195
+ type: "skill";
196
+ name: string;
197
+ description?: string | undefined;
198
+ } | {
199
+ type: "web_search";
200
+ query?: string | undefined;
201
+ } | {
202
+ type: "image_generation";
203
+ prompt?: string | undefined;
204
+ } | {
205
+ type: "compaction";
206
+ } | {
207
+ type: "review";
208
+ phase: "finished" | "started";
209
+ } | undefined;
210
+ rawOutput?: unknown;
211
+ parentToolCallId?: string | undefined;
212
+ appendOutput?: string | undefined;
213
+ } | {
214
+ entries: {
215
+ status: "pending" | "completed" | "in_progress";
216
+ content: string;
217
+ priority: "low" | "medium" | "high";
218
+ }[];
219
+ sessionUpdate: "plan";
220
+ } | {
221
+ sessionUpdate: "available_commands_update";
222
+ availableCommands: {
223
+ name: string;
224
+ description: string;
225
+ hint?: string | undefined;
226
+ }[];
227
+ } | {
228
+ sessionUpdate: "current_mode_update";
229
+ currentModeId: string;
230
+ } | {
231
+ sessionUpdate: "session_info_update";
232
+ title?: string | undefined;
233
+ model?: string | undefined;
234
+ } | {
235
+ sessionUpdate: "usage_update";
236
+ contextWindow?: number | undefined;
237
+ usedTokens?: number | undefined;
238
+ } | {
239
+ role: "user" | "agent" | "thought";
240
+ messageId: string;
241
+ sessionUpdate: "ls_message_done";
242
+ parentToolCallId?: string | undefined;
243
+ } | {
244
+ options: {
245
+ values: {
246
+ value: string;
247
+ name: string;
248
+ description?: string | undefined;
249
+ }[];
250
+ id: string;
251
+ name: string;
252
+ category: "mode" | "other" | "model" | "effort";
253
+ current: string;
254
+ }[];
255
+ sessionUpdate: "ls_config";
256
+ } | {
257
+ title: string;
258
+ sessionUpdate: "ls_notice";
259
+ level: "info" | "warning";
260
+ detail?: string | undefined;
261
+ } | {
262
+ state: "started" | "ended";
263
+ sessionUpdate: "ls_turn";
264
+ turnId?: string | undefined;
265
+ parentToolCallId?: string | undefined;
266
+ stopReason?: "error" | "cancelled" | "end_turn" | "max_tokens" | "refusal" | undefined;
267
+ } | {
268
+ options: {
269
+ name: string;
270
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
271
+ optionId: string;
272
+ }[];
273
+ requestId: string;
274
+ title: string;
275
+ sessionUpdate: "ls_permission";
276
+ detail?: string | undefined;
277
+ toolCallId?: string | undefined;
278
+ } | {
279
+ requestId: string;
280
+ sessionUpdate: "ls_permission_resolved";
281
+ optionId?: string | undefined;
282
+ } | {
283
+ sessionUpdate: "ls_driver";
284
+ driver: "none" | "desktop" | "remote";
285
+ deviceId?: string | undefined;
286
+ } | {
287
+ state: "idle" | "error" | "running" | "waiting" | "offline";
288
+ sessionUpdate: "ls_status";
289
+ } | {
290
+ code: string;
291
+ message: string;
292
+ sessionUpdate: "ls_error";
293
+ hint?: string | undefined;
294
+ }, number>;
295
+ /**
296
+ * Claude Code keeps each sub-agent's transcript next to the session:
297
+ * `<session>/subagents/agent-<id>.jsonl`, with `agent-<id>.meta.json` naming
298
+ * the Agent/Task tool call that spawned it. Returns the sub-agents' work as
299
+ * updates nested under those calls (their prompt is the call's own input).
300
+ */
301
+ export declare function readSubagents(transcriptPath: string): SessionUpdate[];
302
+ /** Interleaves sub-agent updates into the session's by time, keeping each list's order. */
303
+ export declare function mergeByTime(main: SessionUpdate[], nested: SessionUpdate[]): SessionUpdate[];
304
+ export declare function readTranscript(path: string): {
305
+ updates: SessionUpdate[];
306
+ title?: string;
307
+ size: number;
308
+ };
309
+ /**
310
+ * Follows a transcript from a byte offset by polling (Claude only appends).
311
+ * `locate` is retried until the file exists, for sessions with no messages yet.
312
+ */
313
+ export declare class TranscriptTail {
314
+ private readonly options;
315
+ private offset;
316
+ private carry;
317
+ private timer?;
318
+ private paused;
319
+ private path?;
320
+ constructor(options: {
321
+ locate: () => string | undefined;
322
+ offset: number;
323
+ onLine: (line: string) => void;
324
+ pollMs?: number;
325
+ });
326
+ start(): void;
327
+ stop(): void;
328
+ /** Stops emitting (the remote driver is writing); `resumeAtEnd` skips what was written meanwhile. */
329
+ pause(): void;
330
+ resumeAtEnd(): void;
331
+ /** Reads whatever is new right now. */
332
+ poll(): void;
333
+ private resolve;
334
+ }
335
+ export {};