@linkshell/host 0.4.37 → 0.4.39

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.
@@ -14,3 +14,4 @@ export * from "./async-questions.js";
14
14
  export * from "./questions.js";
15
15
  export * from "./acp.js";
16
16
  export * from "./editor.js";
17
+ export * from "./live-activity.js";
@@ -14,4 +14,5 @@ export * from "./async-questions.js";
14
14
  export * from "./questions.js";
15
15
  export * from "./acp.js";
16
16
  export * from "./editor.js";
17
+ export * from "./live-activity.js";
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../wire/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../wire/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,334 @@
1
+ import { z } from "zod";
2
+ import type { PendingPermissionSummary, PermissionOption, SessionActivity, SessionSummary, TerminalInfo, ToolKind } from "./model.js";
3
+ export type AttentionPhase = "waiting_for_approval" | "waiting_for_input" | "failed" | "running" | "starting" | "completed" | "stale";
4
+ export declare const liveActivityActionSchema: z.ZodObject<{
5
+ id: z.ZodString;
6
+ label: z.ZodString;
7
+ role: z.ZodEnum<["allow", "reject", "always", "stop", "choice"]>;
8
+ kind: z.ZodEnum<["permission", "answer", "async-answer"]>;
9
+ computerKey: z.ZodString;
10
+ sessionId: z.ZodString;
11
+ requestId: z.ZodString;
12
+ optionId: z.ZodString;
13
+ questionId: z.ZodOptional<z.ZodString>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ kind: "answer" | "permission" | "async-answer";
16
+ id: string;
17
+ role: "stop" | "choice" | "reject" | "allow" | "always";
18
+ requestId: string;
19
+ optionId: string;
20
+ label: string;
21
+ sessionId: string;
22
+ computerKey: string;
23
+ questionId?: string | undefined;
24
+ }, {
25
+ kind: "answer" | "permission" | "async-answer";
26
+ id: string;
27
+ role: "stop" | "choice" | "reject" | "allow" | "always";
28
+ requestId: string;
29
+ optionId: string;
30
+ label: string;
31
+ sessionId: string;
32
+ computerKey: string;
33
+ questionId?: string | undefined;
34
+ }>;
35
+ export type LiveActivityAction = z.infer<typeof liveActivityActionSchema>;
36
+ export declare const liveActivityTaskSchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ kind: z.ZodEnum<["session", "terminal"]>;
39
+ phase: z.ZodEnum<["waiting_for_approval", "waiting_for_input", "failed", "running", "starting", "completed", "stale"]>;
40
+ title: z.ZodString;
41
+ subtitle: z.ZodString;
42
+ project: z.ZodString;
43
+ agent: z.ZodString;
44
+ }, "strip", z.ZodTypeAny, {
45
+ title: string;
46
+ agent: string;
47
+ kind: "terminal" | "session";
48
+ id: string;
49
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
50
+ subtitle: string;
51
+ project: string;
52
+ }, {
53
+ title: string;
54
+ agent: string;
55
+ kind: "terminal" | "session";
56
+ id: string;
57
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
58
+ subtitle: string;
59
+ project: string;
60
+ }>;
61
+ export type LiveActivityTask = z.infer<typeof liveActivityTaskSchema>;
62
+ /** A transition, rather than a heartbeat: the receiver can alert exactly once. */
63
+ export declare const liveActivityNoticeSchema: z.ZodObject<{
64
+ id: z.ZodString;
65
+ createdAt: z.ZodNumber;
66
+ task: z.ZodObject<{
67
+ id: z.ZodString;
68
+ kind: z.ZodEnum<["session", "terminal"]>;
69
+ phase: z.ZodEnum<["waiting_for_approval", "waiting_for_input", "failed", "running", "starting", "completed", "stale"]>;
70
+ title: z.ZodString;
71
+ subtitle: z.ZodString;
72
+ project: z.ZodString;
73
+ agent: z.ZodString;
74
+ }, "strip", z.ZodTypeAny, {
75
+ title: string;
76
+ agent: string;
77
+ kind: "terminal" | "session";
78
+ id: string;
79
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
80
+ subtitle: string;
81
+ project: string;
82
+ }, {
83
+ title: string;
84
+ agent: string;
85
+ kind: "terminal" | "session";
86
+ id: string;
87
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
88
+ subtitle: string;
89
+ project: string;
90
+ }>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ id: string;
93
+ task: {
94
+ title: string;
95
+ agent: string;
96
+ kind: "terminal" | "session";
97
+ id: string;
98
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
99
+ subtitle: string;
100
+ project: string;
101
+ };
102
+ createdAt: number;
103
+ }, {
104
+ id: string;
105
+ task: {
106
+ title: string;
107
+ agent: string;
108
+ kind: "terminal" | "session";
109
+ id: string;
110
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
111
+ subtitle: string;
112
+ project: string;
113
+ };
114
+ createdAt: number;
115
+ }>;
116
+ export type LiveActivityNotice = z.infer<typeof liveActivityNoticeSchema>;
117
+ export declare const liveActivityContentSchema: z.ZodObject<{
118
+ phase: z.ZodEnum<["waiting_for_approval", "waiting_for_input", "failed", "running", "starting", "completed", "stale"]>;
119
+ title: z.ZodString;
120
+ subtitle: z.ZodString;
121
+ project: z.ZodString;
122
+ agent: z.ZodString;
123
+ agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
124
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
125
+ id: z.ZodString;
126
+ label: z.ZodString;
127
+ role: z.ZodEnum<["allow", "reject", "always", "stop", "choice"]>;
128
+ kind: z.ZodEnum<["permission", "answer", "async-answer"]>;
129
+ computerKey: z.ZodString;
130
+ sessionId: z.ZodString;
131
+ requestId: z.ZodString;
132
+ optionId: z.ZodString;
133
+ questionId: z.ZodOptional<z.ZodString>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ kind: "answer" | "permission" | "async-answer";
136
+ id: string;
137
+ role: "stop" | "choice" | "reject" | "allow" | "always";
138
+ requestId: string;
139
+ optionId: string;
140
+ label: string;
141
+ sessionId: string;
142
+ computerKey: string;
143
+ questionId?: string | undefined;
144
+ }, {
145
+ kind: "answer" | "permission" | "async-answer";
146
+ id: string;
147
+ role: "stop" | "choice" | "reject" | "allow" | "always";
148
+ requestId: string;
149
+ optionId: string;
150
+ label: string;
151
+ sessionId: string;
152
+ computerKey: string;
153
+ questionId?: string | undefined;
154
+ }>, "many">>;
155
+ hasMoreActions: z.ZodOptional<z.ZodBoolean>;
156
+ tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
157
+ id: z.ZodString;
158
+ kind: z.ZodEnum<["session", "terminal"]>;
159
+ phase: z.ZodEnum<["waiting_for_approval", "waiting_for_input", "failed", "running", "starting", "completed", "stale"]>;
160
+ title: z.ZodString;
161
+ subtitle: z.ZodString;
162
+ project: z.ZodString;
163
+ agent: z.ZodString;
164
+ }, "strip", z.ZodTypeAny, {
165
+ title: string;
166
+ agent: string;
167
+ kind: "terminal" | "session";
168
+ id: string;
169
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
170
+ subtitle: string;
171
+ project: string;
172
+ }, {
173
+ title: string;
174
+ agent: string;
175
+ kind: "terminal" | "session";
176
+ id: string;
177
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
178
+ subtitle: string;
179
+ project: string;
180
+ }>, "many">>;
181
+ noticeId: z.ZodOptional<z.ZodString>;
182
+ waitingCount: z.ZodNumber;
183
+ runningCount: z.ZodNumber;
184
+ failedCount: z.ZodNumber;
185
+ deepLink: z.ZodEffects<z.ZodString, string, string>;
186
+ }, "strip", z.ZodTypeAny, {
187
+ title: string;
188
+ agent: string;
189
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
190
+ subtitle: string;
191
+ project: string;
192
+ waitingCount: number;
193
+ runningCount: number;
194
+ failedCount: number;
195
+ deepLink: string;
196
+ agents?: string[] | undefined;
197
+ tasks?: {
198
+ title: string;
199
+ agent: string;
200
+ kind: "terminal" | "session";
201
+ id: string;
202
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
203
+ subtitle: string;
204
+ project: string;
205
+ }[] | undefined;
206
+ actions?: {
207
+ kind: "answer" | "permission" | "async-answer";
208
+ id: string;
209
+ role: "stop" | "choice" | "reject" | "allow" | "always";
210
+ requestId: string;
211
+ optionId: string;
212
+ label: string;
213
+ sessionId: string;
214
+ computerKey: string;
215
+ questionId?: string | undefined;
216
+ }[] | undefined;
217
+ hasMoreActions?: boolean | undefined;
218
+ noticeId?: string | undefined;
219
+ }, {
220
+ title: string;
221
+ agent: string;
222
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
223
+ subtitle: string;
224
+ project: string;
225
+ waitingCount: number;
226
+ runningCount: number;
227
+ failedCount: number;
228
+ deepLink: string;
229
+ agents?: string[] | undefined;
230
+ tasks?: {
231
+ title: string;
232
+ agent: string;
233
+ kind: "terminal" | "session";
234
+ id: string;
235
+ phase: "completed" | "failed" | "running" | "waiting_for_approval" | "waiting_for_input" | "starting" | "stale";
236
+ subtitle: string;
237
+ project: string;
238
+ }[] | undefined;
239
+ actions?: {
240
+ kind: "answer" | "permission" | "async-answer";
241
+ id: string;
242
+ role: "stop" | "choice" | "reject" | "allow" | "always";
243
+ requestId: string;
244
+ optionId: string;
245
+ label: string;
246
+ sessionId: string;
247
+ computerKey: string;
248
+ questionId?: string | undefined;
249
+ }[] | undefined;
250
+ hasMoreActions?: boolean | undefined;
251
+ noticeId?: string | undefined;
252
+ }>;
253
+ export type LiveActivityContentState = z.infer<typeof liveActivityContentSchema>;
254
+ export interface LiveActivityPayload extends Partial<LiveActivityContentState> {
255
+ active: boolean;
256
+ computerName: string;
257
+ computerKey?: string;
258
+ }
259
+ export declare const liveActivityIdSchema: z.ZodString;
260
+ export declare const liveActivitySubscriptionSchema: z.ZodObject<{
261
+ activityId: z.ZodString;
262
+ serviceUrl: z.ZodString;
263
+ grant: z.ZodString;
264
+ expiresAt: z.ZodNumber;
265
+ computerKey: z.ZodString;
266
+ }, "strip", z.ZodTypeAny, {
267
+ computerKey: string;
268
+ activityId: string;
269
+ serviceUrl: string;
270
+ grant: string;
271
+ expiresAt: number;
272
+ }, {
273
+ computerKey: string;
274
+ activityId: string;
275
+ serviceUrl: string;
276
+ grant: string;
277
+ expiresAt: number;
278
+ }>;
279
+ export type LiveActivitySubscription = z.infer<typeof liveActivitySubscriptionSchema>;
280
+ export declare function liveActivityContent(payload: LiveActivityPayload): LiveActivityContentState;
281
+ export declare const toolVerb: Record<ToolKind, string>;
282
+ /** Drops the agent's own English verb and wrapping backticks from a tool title. */
283
+ export declare function cleanToolTitle(title: string): string;
284
+ /** Drops the shell wrapper and environment prefixes agents put around a command. */
285
+ export declare function tidyCommand(command: string): string;
286
+ export declare function activityText(activity: SessionActivity | undefined): string;
287
+ export interface PermissionChoice {
288
+ option: PermissionOption;
289
+ label: string;
290
+ role: "allow" | "always" | "reject" | "stop";
291
+ }
292
+ /** Localized permission choices, in the order: reject, allow, then the rest. */
293
+ export declare function permissionChoices(options: PermissionOption[]): PermissionChoice[];
294
+ export declare function sessionTitle(session: Pick<SessionSummary, "title">): string;
295
+ /** Markdown flattened to one line of plain text, for list previews. */
296
+ export declare function plainPreview(text: string): string;
297
+ /** Async questions need attention even while the agent keeps working. */
298
+ export declare function needsUserInput(session: SessionSummary): boolean;
299
+ export declare function needsAttention(session: SessionSummary): boolean;
300
+ /**
301
+ * A start command as a one-line title. The UI font has no Nerd Font glyphs
302
+ * (private-use code points), which would show as boxes; the terminal itself
303
+ * draws them with its symbol font.
304
+ */
305
+ export declare function commandTitle(command: string): string;
306
+ /** How a terminal reads in a list: its title, what it's doing, and whether it has ended. */
307
+ export declare function terminalState(terminal: TerminalInfo): {
308
+ title: string;
309
+ mono: boolean;
310
+ ended: boolean;
311
+ busy: boolean;
312
+ failed: boolean;
313
+ detail: string;
314
+ };
315
+ /** Classify a session into the 7-phase attention hierarchy (t3code model). */
316
+ export declare function classifySessionPhase(session: SessionSummary, online?: boolean): AttentionPhase;
317
+ export declare function phasePriority(phase: AttentionPhase): number;
318
+ export declare function liveActivityActions(session: SessionSummary, computerKey: string): {
319
+ actions: LiveActivityAction[];
320
+ hasMoreActions: boolean;
321
+ };
322
+ /** Recheck against the connected host after waking the app, not the cached card. */
323
+ export declare function isLiveActivityActionCurrent(action: LiveActivityAction, computerKey: string, session: SessionSummary | undefined, permissions?: PendingPermissionSummary[]): boolean;
324
+ export declare function liveActivityDetailLink(computerKey: string, kind: "session" | "terminal", id: string): string;
325
+ export declare function liveActivitySessionTask(session: SessionSummary, online?: boolean): LiveActivityTask;
326
+ export declare function liveActivityTerminalTask(terminal: TerminalInfo, online?: boolean): LiveActivityTask;
327
+ /**
328
+ * Builds the aggregated single-card iOS Live Activity / Dynamic Island payload
329
+ * for a computer. New progress brings its task and agent to the front together.
330
+ */
331
+ export declare function buildLiveActivitySnapshot(computerName: string, sessions: SessionSummary[], terminals: TerminalInfo[], online: boolean, computerKey?: string, goals?: Record<string, {
332
+ status: string;
333
+ objective: string;
334
+ }>): LiveActivityPayload;