linkshell-cli 0.10.4 → 0.10.6
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 +2 -0
- package/dist/cli/src/commands/doctor.js +1 -1
- package/dist/cli/src/commands/doctor.js.map +1 -1
- package/dist/cli/src/commands/gateway.js +7 -1
- package/dist/cli/src/commands/gateway.js.map +1 -1
- package/dist/cli/src/commands/host.js +2 -2
- package/dist/cli/src/commands/host.js.map +1 -1
- package/dist/cli/src/commands/login.js +4 -1
- package/dist/cli/src/commands/login.js.map +1 -1
- package/dist/cli/src/commands/pair.d.ts +5 -0
- package/dist/cli/src/commands/pair.js +22 -12
- package/dist/cli/src/commands/pair.js.map +1 -1
- package/dist/cli/src/utils/daemon.d.ts +5 -0
- package/dist/cli/src/utils/daemon.js +16 -1
- package/dist/cli/src/utils/daemon.js.map +1 -1
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/dist/gateway/src/main.js +1 -1
- package/dist/gateway/src/main.js.map +1 -1
- package/dist/gateway/src/rate-limit.d.ts +16 -4
- package/dist/gateway/src/rate-limit.js +52 -12
- package/dist/gateway/src/rate-limit.js.map +1 -1
- package/dist/gateway/src/serve.js +15 -1
- package/dist/gateway/src/serve.js.map +1 -1
- package/dist/gateway/src/subscription.js +1 -1
- package/dist/gateway/src/subscription.js.map +1 -1
- package/dist/host/src/drivers/acp/driver.js +1 -1
- package/dist/host/src/drivers/acp/driver.js.map +1 -1
- package/dist/host/src/drivers/acp/mapper.js +5 -2
- package/dist/host/src/drivers/acp/mapper.js.map +1 -1
- package/dist/host/src/drivers/claude/activity.d.ts +40 -0
- package/dist/host/src/drivers/claude/activity.js +425 -0
- package/dist/host/src/drivers/claude/activity.js.map +1 -0
- package/dist/host/src/drivers/claude/driver.d.ts +2 -0
- package/dist/host/src/drivers/claude/driver.js +54 -5
- package/dist/host/src/drivers/claude/driver.js.map +1 -1
- package/dist/host/src/drivers/claude/transcript.d.ts +78 -13
- package/dist/host/src/drivers/claude/transcript.js +11 -3
- package/dist/host/src/drivers/claude/transcript.js.map +1 -1
- package/dist/host/src/drivers/codex/driver.js +1 -1
- package/dist/host/src/drivers/codex/driver.js.map +1 -1
- package/dist/host/src/hub.js +16 -6
- package/dist/host/src/hub.js.map +1 -1
- package/dist/host/src/input.js +0 -2
- package/dist/host/src/input.js.map +1 -1
- package/dist/host/src/rpc/server.d.ts +11 -0
- package/dist/host/src/rpc/server.js +37 -3
- package/dist/host/src/rpc/server.js.map +1 -1
- package/dist/host/src/store.d.ts +3 -0
- package/dist/host/src/store.js +14 -5
- package/dist/host/src/store.js.map +1 -1
- package/dist/wire/src/index.d.ts +1 -0
- package/dist/wire/src/index.js +1 -0
- package/dist/wire/src/index.js.map +1 -1
- package/dist/wire/src/model.d.ts +222 -30
- package/dist/wire/src/model.js +6 -0
- package/dist/wire/src/model.js.map +1 -1
- package/dist/wire/src/relay.d.ts +2 -2
- package/dist/wire/src/rpc.d.ts +2744 -385
- package/dist/wire/src/updates.d.ts +1405 -98
- package/dist/wire/src/updates.js +5 -0
- package/dist/wire/src/updates.js.map +1 -1
- package/dist/wire/src/workflow.d.ts +187 -0
- package/dist/wire/src/workflow.js +35 -0
- package/dist/wire/src/workflow.js.map +1 -0
- package/package.json +4 -4
- package/src/commands/doctor.ts +1 -0
- package/src/commands/gateway.ts +7 -1
- package/src/commands/host.ts +2 -2
- package/src/commands/login.ts +4 -1
- package/src/commands/pair.ts +23 -12
- package/src/utils/daemon.ts +16 -1
package/dist/wire/src/updates.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { permissionOptionSchema, questionAnswerSchema, questionSchema, sessionDriverSchema, sessionStateSchema, toolKindSchema } from "./model.js";
|
|
3
|
+
import { workflowAgentStateSchema, workflowSchema } from "./workflow.js";
|
|
3
4
|
// Session updates mirror ACP's `SessionUpdate` shapes (discriminated by
|
|
4
5
|
// `sessionUpdate`) so one renderer works for every agent. LinkShell-specific
|
|
5
6
|
// updates use the `ls_` prefix.
|
|
@@ -58,6 +59,10 @@ export const toolDetailSchema = z.discriminatedUnion("type", [
|
|
|
58
59
|
/** The sub-agent's role or type, e.g. "Explore". */
|
|
59
60
|
agentType: z.string().optional(),
|
|
60
61
|
model: z.string().optional(),
|
|
62
|
+
/** Agent outcome when a tool's coarse completed/failed state is insufficient. */
|
|
63
|
+
state: workflowAgentStateSchema.optional(),
|
|
64
|
+
/** A Claude workflow is a background run containing its own agents. Counts are observed, not a predicted total. */
|
|
65
|
+
workflow: workflowSchema.optional(),
|
|
61
66
|
}),
|
|
62
67
|
z.object({ type: z.literal("skill"), name: z.string(), description: z.string().optional() }),
|
|
63
68
|
z.object({ type: z.literal("web_search"), query: z.string().optional() }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../../../../wire/src/updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../../../../wire/src/updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnJ,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEzE,wEAAwE;AACxE,6EAA6E;AAC7E,gCAAgC;AAEhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7D,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,C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ACrC,MAAM,EAAE,mBAAmB;QAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QACrC,KAAK,EAAE,kBAAkB;KAC1B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC5B,CAAC;CACH,CAAC,CAAC;AAIH,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,mBAAmB;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const workflowStateSchema: z.ZodEnum<["running", "paused", "completed", "failed", "stopped"]>;
|
|
3
|
+
export type WorkflowState = z.infer<typeof workflowStateSchema>;
|
|
4
|
+
export declare const workflowAgentStateSchema: z.ZodEnum<["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]>;
|
|
5
|
+
export type WorkflowAgentState = z.infer<typeof workflowAgentStateSchema>;
|
|
6
|
+
export declare const workflowAgentSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
/** Present only after the host has imported this agent's transcript. */
|
|
9
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
title: z.ZodString;
|
|
11
|
+
state: z.ZodEnum<["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]>;
|
|
12
|
+
phaseId: z.ZodOptional<z.ZodString>;
|
|
13
|
+
model: z.ZodOptional<z.ZodString>;
|
|
14
|
+
tokens: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
endedAt: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
result: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
24
|
+
toolCallId?: string | undefined;
|
|
25
|
+
phaseId?: string | undefined;
|
|
26
|
+
model?: string | undefined;
|
|
27
|
+
tokens?: number | undefined;
|
|
28
|
+
toolCalls?: number | undefined;
|
|
29
|
+
durationMs?: number | undefined;
|
|
30
|
+
startedAt?: number | undefined;
|
|
31
|
+
endedAt?: number | undefined;
|
|
32
|
+
result?: string | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
id: string;
|
|
35
|
+
title: string;
|
|
36
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
37
|
+
toolCallId?: string | undefined;
|
|
38
|
+
phaseId?: string | undefined;
|
|
39
|
+
model?: string | undefined;
|
|
40
|
+
tokens?: number | undefined;
|
|
41
|
+
toolCalls?: number | undefined;
|
|
42
|
+
durationMs?: number | undefined;
|
|
43
|
+
startedAt?: number | undefined;
|
|
44
|
+
endedAt?: number | undefined;
|
|
45
|
+
result?: string | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export type WorkflowAgent = z.infer<typeof workflowAgentSchema>;
|
|
48
|
+
export declare const workflowPhaseSchema: z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
title: z.ZodString;
|
|
51
|
+
order: z.ZodNumber;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
id: string;
|
|
54
|
+
title: string;
|
|
55
|
+
order: number;
|
|
56
|
+
}, {
|
|
57
|
+
id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
order: number;
|
|
60
|
+
}>;
|
|
61
|
+
export type WorkflowPhase = z.infer<typeof workflowPhaseSchema>;
|
|
62
|
+
/** A complete run snapshot, independent of the loaded conversation window. */
|
|
63
|
+
export declare const workflowSchema: z.ZodObject<{
|
|
64
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
65
|
+
name: z.ZodOptional<z.ZodString>;
|
|
66
|
+
state: z.ZodOptional<z.ZodEnum<["running", "paused", "completed", "failed", "stopped"]>>;
|
|
67
|
+
/** Observed counts: a dynamic script may start more agents later. */
|
|
68
|
+
started: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
completed: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
tokens: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
endedAt: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
phases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
title: z.ZodString;
|
|
77
|
+
order: z.ZodNumber;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
order: number;
|
|
82
|
+
}, {
|
|
83
|
+
id: string;
|
|
84
|
+
title: string;
|
|
85
|
+
order: number;
|
|
86
|
+
}>, "many">>;
|
|
87
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
/** Present only after the host has imported this agent's transcript. */
|
|
90
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
91
|
+
title: z.ZodString;
|
|
92
|
+
state: z.ZodEnum<["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]>;
|
|
93
|
+
phaseId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
model: z.ZodOptional<z.ZodString>;
|
|
95
|
+
tokens: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
endedAt: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
result: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
id: string;
|
|
103
|
+
title: string;
|
|
104
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
105
|
+
toolCallId?: string | undefined;
|
|
106
|
+
phaseId?: string | undefined;
|
|
107
|
+
model?: string | undefined;
|
|
108
|
+
tokens?: number | undefined;
|
|
109
|
+
toolCalls?: number | undefined;
|
|
110
|
+
durationMs?: number | undefined;
|
|
111
|
+
startedAt?: number | undefined;
|
|
112
|
+
endedAt?: number | undefined;
|
|
113
|
+
result?: string | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
title: string;
|
|
117
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
118
|
+
toolCallId?: string | undefined;
|
|
119
|
+
phaseId?: string | undefined;
|
|
120
|
+
model?: string | undefined;
|
|
121
|
+
tokens?: number | undefined;
|
|
122
|
+
toolCalls?: number | undefined;
|
|
123
|
+
durationMs?: number | undefined;
|
|
124
|
+
startedAt?: number | undefined;
|
|
125
|
+
endedAt?: number | undefined;
|
|
126
|
+
result?: string | undefined;
|
|
127
|
+
}>, "many">>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
completed?: number | undefined;
|
|
130
|
+
state?: "running" | "paused" | "completed" | "failed" | "stopped" | undefined;
|
|
131
|
+
tokens?: number | undefined;
|
|
132
|
+
durationMs?: number | undefined;
|
|
133
|
+
startedAt?: number | undefined;
|
|
134
|
+
endedAt?: number | undefined;
|
|
135
|
+
runId?: string | undefined;
|
|
136
|
+
name?: string | undefined;
|
|
137
|
+
started?: number | undefined;
|
|
138
|
+
phases?: {
|
|
139
|
+
id: string;
|
|
140
|
+
title: string;
|
|
141
|
+
order: number;
|
|
142
|
+
}[] | undefined;
|
|
143
|
+
agents?: {
|
|
144
|
+
id: string;
|
|
145
|
+
title: string;
|
|
146
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
147
|
+
toolCallId?: string | undefined;
|
|
148
|
+
phaseId?: string | undefined;
|
|
149
|
+
model?: string | undefined;
|
|
150
|
+
tokens?: number | undefined;
|
|
151
|
+
toolCalls?: number | undefined;
|
|
152
|
+
durationMs?: number | undefined;
|
|
153
|
+
startedAt?: number | undefined;
|
|
154
|
+
endedAt?: number | undefined;
|
|
155
|
+
result?: string | undefined;
|
|
156
|
+
}[] | undefined;
|
|
157
|
+
}, {
|
|
158
|
+
completed?: number | undefined;
|
|
159
|
+
state?: "running" | "paused" | "completed" | "failed" | "stopped" | undefined;
|
|
160
|
+
tokens?: number | undefined;
|
|
161
|
+
durationMs?: number | undefined;
|
|
162
|
+
startedAt?: number | undefined;
|
|
163
|
+
endedAt?: number | undefined;
|
|
164
|
+
runId?: string | undefined;
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
started?: number | undefined;
|
|
167
|
+
phases?: {
|
|
168
|
+
id: string;
|
|
169
|
+
title: string;
|
|
170
|
+
order: number;
|
|
171
|
+
}[] | undefined;
|
|
172
|
+
agents?: {
|
|
173
|
+
id: string;
|
|
174
|
+
title: string;
|
|
175
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
176
|
+
toolCallId?: string | undefined;
|
|
177
|
+
phaseId?: string | undefined;
|
|
178
|
+
model?: string | undefined;
|
|
179
|
+
tokens?: number | undefined;
|
|
180
|
+
toolCalls?: number | undefined;
|
|
181
|
+
durationMs?: number | undefined;
|
|
182
|
+
startedAt?: number | undefined;
|
|
183
|
+
endedAt?: number | undefined;
|
|
184
|
+
result?: string | undefined;
|
|
185
|
+
}[] | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
export type Workflow = z.infer<typeof workflowSchema>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const workflowStateSchema = z.enum(["running", "paused", "completed", "failed", "stopped"]);
|
|
3
|
+
export const workflowAgentStateSchema = z.enum(["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]);
|
|
4
|
+
export const workflowAgentSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
/** Present only after the host has imported this agent's transcript. */
|
|
7
|
+
toolCallId: z.string().optional(),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
state: workflowAgentStateSchema,
|
|
10
|
+
phaseId: z.string().optional(),
|
|
11
|
+
model: z.string().optional(),
|
|
12
|
+
tokens: z.number().nonnegative().optional(),
|
|
13
|
+
toolCalls: z.number().int().nonnegative().optional(),
|
|
14
|
+
durationMs: z.number().nonnegative().optional(),
|
|
15
|
+
startedAt: z.number().optional(),
|
|
16
|
+
endedAt: z.number().optional(),
|
|
17
|
+
result: z.string().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const workflowPhaseSchema = z.object({ id: z.string(), title: z.string(), order: z.number() });
|
|
20
|
+
/** A complete run snapshot, independent of the loaded conversation window. */
|
|
21
|
+
export const workflowSchema = z.object({
|
|
22
|
+
runId: z.string().optional(),
|
|
23
|
+
name: z.string().optional(),
|
|
24
|
+
state: workflowStateSchema.optional(),
|
|
25
|
+
/** Observed counts: a dynamic script may start more agents later. */
|
|
26
|
+
started: z.number().int().nonnegative().optional(),
|
|
27
|
+
completed: z.number().int().nonnegative().optional(),
|
|
28
|
+
tokens: z.number().nonnegative().optional(),
|
|
29
|
+
durationMs: z.number().nonnegative().optional(),
|
|
30
|
+
startedAt: z.number().optional(),
|
|
31
|
+
endedAt: z.number().optional(),
|
|
32
|
+
phases: z.array(workflowPhaseSchema).optional(),
|
|
33
|
+
agents: z.array(workflowAgentSchema).optional(),
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../../wire/src/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAGnG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAG9H,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,wEAAwE;IACxE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,wBAAwB;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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O,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE;IAC/C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linkshell-cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"description": "Follow, steer and approve the coding agents on your computer (Claude Code, Codex, Gemini, Copilot and more) from your phone",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"commander": "^13.1.0",
|
|
34
34
|
"node-pty": "^1.1.0",
|
|
35
35
|
"qrcode-terminal": "^0.12.0",
|
|
36
|
-
"@linkshell/
|
|
37
|
-
"@linkshell/
|
|
38
|
-
"@linkshell/
|
|
36
|
+
"@linkshell/host": "0.4.6",
|
|
37
|
+
"@linkshell/gateway": "0.6.3",
|
|
38
|
+
"@linkshell/wire": "0.2.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"tsx": "^4.19.3",
|
package/src/commands/doctor.ts
CHANGED
|
@@ -66,6 +66,7 @@ export async function runDoctor(version: string, gatewayUrl?: string): Promise<v
|
|
|
66
66
|
`could not load node-pty from this LinkShell installation: ${reason}. ` +
|
|
67
67
|
"Reinstall linkshell-cli with the package manager you used to install it. " +
|
|
68
68
|
"For a pnpm source checkout, approve node-pty build scripts and reinstall.",
|
|
69
|
+
{ cause: error },
|
|
69
70
|
);
|
|
70
71
|
}
|
|
71
72
|
}));
|
package/src/commands/gateway.ts
CHANGED
|
@@ -10,7 +10,13 @@ export async function runGatewayForeground(version: string, port: number): Promi
|
|
|
10
10
|
const { startGateway } = await import("@linkshell/gateway");
|
|
11
11
|
// Pairings live here; keeping this file keeps phones paired.
|
|
12
12
|
const databasePath = join(daemon.linkshellDir(), "relay.db");
|
|
13
|
-
const gateway = await startGateway({
|
|
13
|
+
const gateway = await startGateway({
|
|
14
|
+
port,
|
|
15
|
+
databasePath,
|
|
16
|
+
log: (message) => process.stderr.write(`[gateway] ${message}\n`),
|
|
17
|
+
// As for the Docker image: the reverse proxy in front, whose X-Forwarded-For says who is connecting.
|
|
18
|
+
trustedProxies: (process.env.TRUSTED_PROXIES ?? "").split(","),
|
|
19
|
+
});
|
|
14
20
|
daemon.savePid("gateway", process.pid);
|
|
15
21
|
|
|
16
22
|
process.stderr.write(`\n LinkShell Gateway ${version}\n`);
|
package/src/commands/host.ts
CHANGED
|
@@ -210,7 +210,7 @@ export async function joinGatewayAfterLogin(plan: "pro" | "free"): Promise<void>
|
|
|
210
210
|
if (!chosen && plan !== "pro") {
|
|
211
211
|
// A running host now gets the gateway's own answer, instead of an old login's.
|
|
212
212
|
await refreshGateway(0);
|
|
213
|
-
out("The official gateway needs a Pro subscription: https://
|
|
213
|
+
out("The official gateway needs a Pro subscription: https://liutianjie.github.io/LinkShell/pricing/");
|
|
214
214
|
out("Or use your own gateway: linkshell host --gateway <url>, then linkshell pair\n");
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
@@ -355,7 +355,7 @@ export async function runAgentShim(agent: string, args: string[]): Promise<void>
|
|
|
355
355
|
|
|
356
356
|
const sessionId = launch.sessionId;
|
|
357
357
|
let child: import("node:child_process").ChildProcess | undefined;
|
|
358
|
-
let yielded
|
|
358
|
+
let yielded: boolean;
|
|
359
359
|
let showingRemote = false;
|
|
360
360
|
client.on("desktop.yield", ({ sessionId: target }) => {
|
|
361
361
|
if (target !== sessionId) return;
|
package/src/commands/login.ts
CHANGED
|
@@ -26,6 +26,7 @@ export async function runLogin(): Promise<LoginResult | null> {
|
|
|
26
26
|
process.stderr.write("\n LinkShell Login\n\n");
|
|
27
27
|
|
|
28
28
|
return new Promise<LoginResult | null>((resolve) => {
|
|
29
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
29
30
|
const server = http.createServer(async (req, res) => {
|
|
30
31
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
31
32
|
|
|
@@ -136,6 +137,8 @@ export async function runLogin(): Promise<LoginResult | null> {
|
|
|
136
137
|
` \x1b[32m✓\x1b[0m Logged in as ${email || userId} (${planLabel})\n\n`,
|
|
137
138
|
);
|
|
138
139
|
|
|
140
|
+
// Left pending, the five-minute limit would keep the command alive long after the login.
|
|
141
|
+
clearTimeout(timeout);
|
|
139
142
|
setTimeout(() => {
|
|
140
143
|
server.close();
|
|
141
144
|
resolve({
|
|
@@ -182,7 +185,7 @@ export async function runLogin(): Promise<LoginResult | null> {
|
|
|
182
185
|
} catch {}
|
|
183
186
|
|
|
184
187
|
// Timeout after 5 minutes
|
|
185
|
-
setTimeout(() => {
|
|
188
|
+
timeout = setTimeout(() => {
|
|
186
189
|
process.stderr.write(" Login timed out.\n\n");
|
|
187
190
|
server.close();
|
|
188
191
|
resolve(null);
|
package/src/commands/pair.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import qrcode from "qrcode-terminal";
|
|
2
|
+
import type { HostClient } from "@linkshell/host";
|
|
2
3
|
|
|
3
4
|
// `linkshell pair`: show a QR code (and a code to type) that lets a phone reach
|
|
4
5
|
// this computer through the gateway, then wait for it to pair.
|
|
@@ -34,19 +35,29 @@ export async function runPair(): Promise<void> {
|
|
|
34
35
|
const code = `${offer.code.slice(0, 3)} ${offer.code.slice(3)}`;
|
|
35
36
|
const minutes = Math.round((offer.expiresAt - Date.now()) / 60_000);
|
|
36
37
|
process.stdout.write(`\n Or enter the code: ${code} (valid ${minutes} min, gateway ${offer.gateway})\n\n Waiting for your phone…`);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
stop();
|
|
44
|
-
resolve(undefined);
|
|
45
|
-
}, offer.expiresAt - Date.now());
|
|
46
|
-
process.on("SIGINT", () => resolve(undefined));
|
|
47
|
-
});
|
|
48
|
-
process.stdout.write(device ? `\r ✓ Paired with ${device.name}. It can reach this computer from anywhere now.\n\n` : "\r Pairing window closed. \n\n");
|
|
38
|
+
const outcome = await waitForPairing(client, offer.expiresAt);
|
|
39
|
+
process.stdout.write(typeof outcome === "object" ? `\r ✓ Paired with ${outcome.name}. It can reach this computer from anywhere now.\n\n` : "\r Pairing window closed. \n\n");
|
|
40
|
+
// What a shell expects of a command ended by Ctrl-C.
|
|
41
|
+
if (outcome === "interrupted") process.exitCode = 130;
|
|
49
42
|
} finally {
|
|
50
43
|
client.close();
|
|
51
44
|
}
|
|
52
45
|
}
|
|
46
|
+
|
|
47
|
+
/** Waits for a phone to pair: the device, or why the wait ended without one. */
|
|
48
|
+
export function waitForPairing(client: Pick<HostClient, "on">, expiresAt: number): Promise<{ name: string } | "expired" | "interrupted"> {
|
|
49
|
+
return new Promise((resolve) => {
|
|
50
|
+
// However the wait ends, the timer and the listeners end with it: a pending timer keeps the process alive until
|
|
51
|
+
// the window closes, and a SIGINT listener left behind swallows every later Ctrl-C.
|
|
52
|
+
const finish = (outcome: { name: string } | "expired" | "interrupted") => {
|
|
53
|
+
stop();
|
|
54
|
+
clearTimeout(timer);
|
|
55
|
+
process.off("SIGINT", interrupt);
|
|
56
|
+
resolve(outcome);
|
|
57
|
+
};
|
|
58
|
+
const stop = client.on("pairing.done", ({ device }) => finish(device));
|
|
59
|
+
const timer = setTimeout(() => finish("expired"), expiresAt - Date.now());
|
|
60
|
+
const interrupt = () => finish("interrupted");
|
|
61
|
+
process.on("SIGINT", interrupt);
|
|
62
|
+
});
|
|
63
|
+
}
|
package/src/utils/daemon.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync, unlinkSync, mkdirSync, openSync } from "node:fs";
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync, unlinkSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
@@ -58,9 +58,24 @@ export function getLogFile(service: ServiceName): string {
|
|
|
58
58
|
return logFile(service);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
const MAX_LOG_BYTES = 5 * 1024 * 1024;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Keeps a log from growing forever: a full one becomes `<service>.log.1`, replacing the one before it.
|
|
65
|
+
* Only when a daemon starts, since a running one holds the file open.
|
|
66
|
+
*/
|
|
67
|
+
export function rotateLog(log: string, maxBytes = MAX_LOG_BYTES): void {
|
|
68
|
+
try {
|
|
69
|
+
if (statSync(log).size > maxBytes) renameSync(log, `${log}.1`);
|
|
70
|
+
} catch {
|
|
71
|
+
// No log yet.
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
61
75
|
export function spawnDaemon(service: ServiceName, args: string[]): number {
|
|
62
76
|
mkdirSync(LINKSHELL_DIR, { recursive: true });
|
|
63
77
|
const log = logFile(service);
|
|
78
|
+
rotateLog(log);
|
|
64
79
|
const out = openSync(log, "a");
|
|
65
80
|
const err = openSync(log, "a");
|
|
66
81
|
|