linkshell-cli 0.10.36 → 0.10.38

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.
@@ -1,5 +1,6 @@
1
- import { type AgentAuth, type ContentBlock, type GoalChange, type SessionGoal } from "@linkshell/wire";
2
- import type { AttachContext, DiscoveredSession, HistoryItem } from "../types.js";
1
+ import { type AgentAuth, type ContentBlock, type GoalChange, type QuestionAnswer, type SessionGoal } from "@linkshell/wire";
2
+ import type { DriverBehavior } from "../behavior.js";
3
+ import type { AttachContext, DiscoveredSession, ForkOptions, HistoryItem } from "../types.js";
3
4
  import { AcpDriver, type AcpAgentSpec } from "./driver.js";
4
5
  /**
5
6
  * Official Google Antigravity ACP distribution metadata (from the ACP Registry:
@@ -39,66 +40,232 @@ export declare function resolveAntigravityDesktop(env?: NodeJS.ProcessEnv): Reso
39
40
  export declare function extractAntigravityAuthUrl(line: string): string | undefined;
40
41
  export declare function antigravityAuthStatus(env: NodeJS.ProcessEnv): Promise<AgentAuth>;
41
42
  export declare function antigravitySpec(): AcpAgentSpec;
43
+ interface TranscriptToolCall {
44
+ id?: string;
45
+ name?: string;
46
+ args?: Record<string, unknown>;
47
+ }
48
+ interface TranscriptMedia {
49
+ mime_type?: string;
50
+ mimeType?: string;
51
+ uri?: string;
52
+ inline_data?: string;
53
+ inlineData?: string;
54
+ }
55
+ interface TranscriptStep {
56
+ step_index?: number;
57
+ source?: string;
58
+ type?: string;
59
+ status?: string;
60
+ created_at?: string;
61
+ content?: string;
62
+ error?: string;
63
+ thinking?: string;
64
+ tool_calls?: TranscriptToolCall[];
65
+ media?: TranscriptMedia[];
66
+ input_tokens?: number;
67
+ cache_read_tokens?: number;
68
+ output_tokens?: number;
69
+ }
42
70
  export declare function cleanAntigravityUserInput(content: string): string;
43
71
  export declare function cleanAntigravityAgentContent(content: string): {
44
72
  text: string;
45
73
  goalComplete: boolean;
46
74
  goalCancelled: boolean;
47
75
  };
76
+ export interface AskQuestionItem {
77
+ question: string;
78
+ isMultiSelect?: boolean;
79
+ options?: {
80
+ id: string;
81
+ text: string;
82
+ }[];
83
+ }
84
+ export interface PendingDesktopAskQuestion {
85
+ stepIndex: number;
86
+ toolCallId: string;
87
+ title: string;
88
+ questions: AskQuestionItem[];
89
+ }
90
+ /** What has to be remembered between reads of a transcript so the next lines are understood the same way. */
91
+ export interface TranscriptParseState {
92
+ goal: SessionGoal | null;
93
+ lastModelLabel?: string;
94
+ lastStepIndex?: number;
95
+ /** A reply whose tool calls are still waiting for their outputs (the GENERIC steps that follow). */
96
+ openCalls?: {
97
+ stepIndex: number;
98
+ calls: TranscriptToolCall[];
99
+ consumed: number;
100
+ };
101
+ }
102
+ export declare function newTranscriptParseState(): TranscriptParseState;
103
+ /**
104
+ * Turns transcript steps into history items, carrying `state` across calls so
105
+ * the transcript can be read a few lines at a time. Tool calls whose outputs
106
+ * haven't been written yet are `in_progress`; their outputs arrive later as
107
+ * `tool_call_update`s.
108
+ */
109
+ export declare function parseTranscriptSteps(parsed: {
110
+ index: number;
111
+ step: TranscriptStep;
112
+ }[], state: TranscriptParseState): {
113
+ items: HistoryItem[];
114
+ pendingAskQuestion?: PendingDesktopAskQuestion;
115
+ };
48
116
  /**
49
117
  * Converts an Antigravity Desktop `transcript_full.jsonl` (or `transcript.jsonl`)
50
118
  * file into LinkShell's `HistoryItem[]` list, tracking Goal Mode (`ls_goal`),
51
- * model changes (`<USER_SETTINGS_CHANGE>`), and uploaded media.
119
+ * model changes (`<USER_SETTINGS_CHANGE>`), and uploaded media. Lines before
120
+ * `fromLine` only rebuild state.
52
121
  */
53
122
  export declare function parseAntigravityTranscript(transcriptPath: string, fromLine?: number): {
54
123
  items: HistoryItem[];
55
124
  nextLine: number;
125
+ lastStepIndex?: number;
56
126
  lastModelLabel?: string;
57
127
  goal?: SessionGoal | null;
128
+ pendingAskQuestion?: PendingDesktopAskQuestion;
129
+ state: TranscriptParseState;
130
+ /** Byte offset just past the last complete line: where a TranscriptTail picks up. */
131
+ endOffset: number;
58
132
  };
133
+ /**
134
+ * Follows a transcript by byte offset so a long conversation (tens of MB) is
135
+ * never re-read: each poll parses only the lines appended since the last.
136
+ */
137
+ export declare class TranscriptTail {
138
+ private path;
139
+ readonly state: TranscriptParseState;
140
+ private offset;
141
+ private remainder;
142
+ constructor(path: string, state: TranscriptParseState, offset: number);
143
+ read(currentPath: string): {
144
+ items: HistoryItem[];
145
+ pendingAskQuestion?: PendingDesktopAskQuestion;
146
+ changed: boolean;
147
+ };
148
+ }
59
149
  /**
60
150
  * Specialized driver for Google Antigravity:
61
151
  * - Drives `agy_acp_server.par` / `agy-acp` over ACP when installed.
62
152
  * - Also discovers and interacts with Antigravity Desktop (`/Applications/Antigravity.app`,
63
153
  * `~/.gemini/antigravity/conversation_summaries.db`, `brain/<id>/.system_generated/logs/transcript_full.jsonl`,
64
154
  * and its local `language_server` Connect-RPC service) so users with only the Desktop app
65
- * get full session visibility, history, Goal Mode, image messaging, and model selection.
155
+ * get full session visibility, history, Goal Mode, slash commands and skills, image messaging,
156
+ * user questions/permissions, model selection, steering, fork, rename, archive and delete.
66
157
  */
67
158
  export declare class AntigravityDriver extends AcpDriver {
68
159
  private desktopMode;
69
160
  private desktopSummaryTimer?;
161
+ /** The state last reported to the host for each desktop conversation. */
70
162
  private readonly desktopSessionStates;
71
163
  private readonly desktopWatchers;
164
+ /** Conversations a device has open: their watchers outlive the turn. */
165
+ private readonly watchedSessions;
72
166
  private desktopModelsCache?;
73
167
  private desktopDefaultModel?;
168
+ private desktopRowsCache?;
169
+ private readonly slashCache;
170
+ private readonly generatorCache;
171
+ private archivedCache?;
172
+ private readonly untitledCache;
74
173
  constructor(options: {
75
174
  env?: NodeJS.ProcessEnv;
76
175
  hostVersion: string;
77
176
  });
78
177
  protected get env(): NodeJS.ProcessEnv;
178
+ /**
179
+ * The desktop app takes messages mid-turn (its message_delivery hook hands them
180
+ * to the running turn), forks at any reply, and its transcript is the history.
181
+ */
182
+ get behavior(): DriverBehavior;
183
+ private desktop;
184
+ private languageServer;
185
+ private requireConnection;
186
+ private isDesktopSession;
187
+ /** Every conversation row, read at most every two seconds however many watchers ask. */
188
+ private desktopRows;
189
+ sessionExists(nativeId: string, _cwd: string): boolean;
79
190
  authStatus(): Promise<AgentAuth>;
80
191
  protected detectVersion(): Promise<string | undefined>;
192
+ /**
193
+ * Reports conversations that started or stopped on the desktop. A running one
194
+ * is followed (attached), and from then on its watcher reports its turns.
195
+ */
196
+ private syncDesktopSummaries;
81
197
  protected boot(): Promise<void>;
82
198
  stop(): Promise<void>;
199
+ watched(nativeId: string, open: boolean): void;
83
200
  private transcriptPathFor;
84
201
  private desktopAliasesFor;
85
202
  private saveDesktopAliases;
86
203
  private isConversationRunningInDesktop;
204
+ private untitledTitle;
87
205
  private listDesktopSessions;
88
206
  listSessions(limit: number): Promise<DiscoveredSession[]>;
207
+ archivedSessions(): Promise<string[]>;
89
208
  private loadDesktopModels;
209
+ /**
210
+ * The model and command auto-run policy the desktop app last used for a
211
+ * conversation (or, for a new one, for the latest conversation): sending from
212
+ * the phone must not quietly change either.
213
+ */
214
+ private generatorInfo;
215
+ private fetchGeneratorInfo;
216
+ /** A conversation the desktop hasn't generated in yet takes the settings the user last used anywhere. */
217
+ private inheritedSettings;
218
+ private latestConversationId;
90
219
  private resolveSessionModel;
91
220
  private resolvePlanModelEnum;
221
+ /** The system commands and skills the desktop offers for this conversation (its workspace adds skills). */
222
+ private slashCommands;
92
223
  private emitDesktopConfig;
224
+ private emitDesktopPendingAction;
225
+ private clearDesktopPendingAction;
226
+ private pollDesktopInteractions;
227
+ private emitTranscriptItems;
228
+ /** A sub-agent's items as the parent session carries them: nested under the spawning call, with ids of their own. */
229
+ private nestChildItems;
230
+ private childTurn;
231
+ /**
232
+ * Starts following the sub-agents `items` spawned. With `collect`, what each
233
+ * has done so far is added there (history, or a sub-agent just seen live);
234
+ * without, only what it does from now on is shown.
235
+ */
236
+ private followChildren;
237
+ /** New work from every followed sub-agent, and when each starts or stops. */
238
+ private tickChildren;
239
+ private stopWatching;
93
240
  private startWatchingDesktopTranscript;
241
+ private tickWatcher;
94
242
  attach(nativeId: string, context: AttachContext): Promise<HistoryItem[]>;
95
243
  detach(nativeId: string): Promise<void>;
244
+ private resolveDesktopTrajectory;
245
+ answerQuestion(nativeId: string, requestId: string, answers: QuestionAnswer[]): Promise<void>;
246
+ respondPermission(nativeId: string, requestId: string, optionId: string): Promise<void>;
96
247
  createSession(options: {
97
248
  cwd: string;
98
249
  model?: string;
99
250
  }): Promise<DiscoveredSession>;
251
+ /** The transcript step an item of ours came from (the phone's own messages are aliased to theirs). */
252
+ private stepOfItem;
253
+ /**
254
+ * The step a fork ends at: the end of the turn holding `upTo` (or of the
255
+ * whole conversation). Antigravity forks only at a turn's last step, right
256
+ * before the next user message; the trajectory (not the transcript, which
257
+ * skips some steps) says which that is.
258
+ */
259
+ private forkStepFor;
260
+ fork(nativeId: string, options: ForkOptions): Promise<DiscoveredSession>;
261
+ rename(nativeId: string, title: string): Promise<void>;
262
+ archive(nativeId: string, archived: boolean): Promise<void>;
263
+ delete(nativeId: string): Promise<void>;
100
264
  goal(nativeId: string, change: GoalChange): Promise<SessionGoal | null>;
265
+ private echoDesktopMessage;
101
266
  prompt(nativeId: string, content: ContentBlock[], clientMessageId: string, context?: string): Promise<"started" | "steered" | "queued">;
267
+ cancelSubagent(nativeId: string, childId: string): Promise<void>;
102
268
  cancel(nativeId: string): Promise<void>;
103
269
  setConfig(nativeId: string, optionId: string, value: string): Promise<void>;
104
270
  }
271
+ export {};