@anhlp/alp-protocol 0.0.1-beta.3 → 0.0.1-beta.4

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/dist/rpc.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  /** Portable JSON-RPC structures; implementations and provider SDKs stay outside protocol. */
2
2
  import type { RuntimeKind, Pin } from './dto.js';
3
- import type { AlpError, Envelope, SessionSnapshot, TreeStatus, UserQuestion } from './events.js';
4
- import type { PauseState, PromptContent, RecallAnswer, SessionPreview, SessionSpec, SessionSummary } from './session.js';
3
+ import type { AlpError, Envelope, SessionSnapshot, TreeStatus, TurnAttention, UserQuestion } from './events.js';
4
+ import type { ConfigureOutcome, ConfigurePreview, ConversationBranch, ForkProvenance, PauseState, PromptContent, RecallAnswer, ResumeCommand, SessionPreview, SessionSpec, SessionSummary } from './session.js';
5
5
  import type { EntryName, LanguageSetting, LibraryEntryRow, LibraryKind, LibraryScope, LibrarySource, TaskRow, TeamRow } from './dto.js';
6
+ import type { ScheduleJob, ScheduleStatus } from './schedule.js';
6
7
  export type RpcId = string | number | null;
7
8
  export type RpcErrorData = {
8
9
  code: number;
@@ -30,17 +31,489 @@ export type EventNotification = {
30
31
  method: 'event';
31
32
  params: Envelope;
32
33
  };
34
+ /** Why a terminal ended (§12.10). */
35
+ export type TerminalEndReason = 'exited' | 'closed' | 'idle' | 'lifetime' | 'detached' | 'revoked' | 'disabled' | 'shutdown';
36
+ /** A terminal as clients see it (capability `terminal`, §12.10): never a process id, shell path or host path. */
37
+ export type TerminalInfo = {
38
+ terminalId: string;
39
+ workspaceId: string;
40
+ title: string;
41
+ cols: number;
42
+ rows: number;
43
+ state: 'running' | 'exited';
44
+ attached: boolean;
45
+ createdAt: string;
46
+ lastActivityAt: string;
47
+ expiresAt: string;
48
+ exitCode?: number | null;
49
+ signal?: number | null;
50
+ endReason?: TerminalEndReason;
51
+ };
52
+ /** Effective terminal limits a daemon.hello advertises with capability `terminal`. */
53
+ export type TerminalLimits = {
54
+ maxPerPrincipal: number;
55
+ maxPerDaemon: number;
56
+ maxInputBytes: number;
57
+ maxOutputFrameBytes: number;
58
+ replayBytes: number;
59
+ idleMs: number;
60
+ maxLifetimeMs: number;
61
+ reconnectMs: number;
62
+ };
63
+ /** params of a terminal.event notification, sent only to the connection attached to the terminal. */
64
+ export type TerminalEvent = {
65
+ terminalId: string;
66
+ type: 'output';
67
+ seq: number;
68
+ data: string;
69
+ } | {
70
+ terminalId: string;
71
+ type: 'exit';
72
+ seq: number;
73
+ exitCode: number | null;
74
+ signal: number | null;
75
+ reason: TerminalEndReason;
76
+ } | {
77
+ terminalId: string;
78
+ type: 'detached';
79
+ reason: 'replaced' | 'slow_consumer';
80
+ };
81
+ export type TerminalNotification = {
82
+ jsonrpc: '2.0';
83
+ method: 'terminal.event';
84
+ params: TerminalEvent;
85
+ };
33
86
  /** Names a daemon may list in its daemon.hello result (schema/methods-v1.json `capabilities`). */
34
- export type Capability = 'attach.after' | 'prompt.receipts' | 'extension.methods' | 'team' | 'task' | 'library' | 'library.project.write' | 'settings.language' | 'session.list.page' | 'question.watch' | 'question.watch.turns' | 'workspace.files' | 'workspace.files.read' | 'prompt.images';
87
+ export type HistoryItem = Envelope | {
88
+ cursor: number;
89
+ oversized: {
90
+ bytes: number;
91
+ };
92
+ };
93
+ export type HistoryPage = {
94
+ generation: string;
95
+ items: HistoryItem[];
96
+ olderCursor?: string;
97
+ hasOlder: boolean;
98
+ tipCursor: number;
99
+ };
100
+ export type Capability = 'session.interrupt.turn' | 'session.fork' | 'session.rewind' | 'session.reload' | 'session.resumeCommand' | 'session.configure.live' | 'terminal' | 'attachments' | 'workspace.git' | 'workspace.worktree' | 'workspace.registry' | 'session.history' | 'attach.after' | 'prompt.receipts' | 'extension.methods' | 'team' | 'task' | 'library' | 'library.project.write' | 'settings.language' | 'session.list.page' | 'question.watch' | 'question.watch.turns' | 'session.attention' | 'workspace.files' | 'workspace.files.read' | 'prompt.images' | 'schedule';
35
101
  /** `data.reason` values alpd sets on errors (docs/protocol/alp-json-rpc-v1.md §5.3). */
36
- export type ErrorReason = 'hello_required' | 'protocol_version' | 'invalid_params' | 'invalid_id' | 'batch_unsupported' | 'frame_too_large' | 'response_too_large' | 'persistence_failed' | 'outcome_unknown' | 'key_conflict' | 'invalid_path' | 'invalid_scope' | 'invalid_entry' | 'secret_marker' | 'not_alp_project' | 'unknown_task' | 'not_found' | 'library_policy' | 'unsafe_path' | 'revision_conflict' | 'task_state' | 'in_use' | 'busy' | 'unreadable' | 'not_directory' | 'blocked_path' | 'ignored' | 'linked' | 'binary' | 'too_large';
102
+ export type ErrorReason = 'hello_required' | 'protocol_version' | 'invalid_params' | 'invalid_id' | 'batch_unsupported' | 'frame_too_large' | 'invalid_cursor' | 'stale_cursor' | 'history_gap' | 'stale_revision' | 'request_conflict' | 'cwd_mismatch' | 'workspace_mismatch' | 'corrupt_registry' | 'identity_changed' | 'response_too_large' | 'persistence_failed' | 'outcome_unknown' | 'key_conflict' | 'invalid_path' | 'invalid_scope' | 'invalid_entry' | 'secret_marker' | 'not_alp_project' | 'unknown_task' | 'not_found' | 'library_policy' | 'unsafe_path' | 'revision_conflict' | 'task_state' | 'in_use' | 'busy' | 'unreadable' | 'not_directory' | 'blocked_path' | 'ignored' | 'linked' | 'binary' | 'too_large' | 'not_repository' | 'unknown_ref' | 'invalid_compare' | 'stale_snapshot' | 'git_unavailable' | 'git_failed' | 'invalid_name' | 'invalid_data' | 'attachment_too_large' | 'offset_mismatch' | 'chunk_conflict' | 'upload_incomplete' | 'hash_mismatch' | 'upload_expired' | 'quota_exceeded' | 'attachment_referenced' | 'attachment_limit' | 'attachment_unavailable' | 'attachment_unsupported' | 'session_busy' | 'stale_generation' | 'turn_not_found' | 'turn_in_progress' | 'empty_prefix' | 'boundary_unmapped' | 'runtime_unsupported' | 'native_refused' | 'branch_not_found' | 'attachment_forbidden' | 'session_closed' | 'no_history' | 'runtime_mismatch' | 'agent_mismatch' | 'permission_escalation' | 'team_not_found' | 'terminal_disabled' | 'terminal_unsupported' | 'terminal_limit' | 'not_attached' | 'terminal_exited' | 'input_too_large';
37
103
  type Empty = Record<string, never>;
38
104
  /**
39
105
  * Params and result of every v1 method, as schema/methods-v1.json defines them; the protocol tests
40
106
  * type-check the golden fixtures against this map, so the two cannot drift. Results may carry
41
107
  * properties this map does not name: clients ignore them.
42
108
  */
109
+ export type RegistryProject = {
110
+ id: string;
111
+ root: string;
112
+ canonical?: string;
113
+ customName?: string | null;
114
+ addedAt: string;
115
+ removedAt?: string | null;
116
+ revision?: number;
117
+ };
118
+ export type RegistryWorkspace = {
119
+ branch?: string | null;
120
+ managedWorktree?: boolean;
121
+ id: string;
122
+ projectId: string;
123
+ directory: string;
124
+ canonical?: string;
125
+ title?: string | null;
126
+ pinnedAt?: string | null;
127
+ archivedAt?: string | null;
128
+ labels: string[];
129
+ createdAt: string;
130
+ revision?: number;
131
+ idempotencyKey?: string;
132
+ };
133
+ /** workspace.git.status and workspace.git.diff (capability `workspace.git`, §12.5): paths are relative to the workspace, never host paths. */
134
+ export type GitChange = 'modified' | 'added' | 'deleted' | 'renamed' | 'copied' | 'typechange' | 'untracked' | 'conflicted';
135
+ export type GitCompare = {
136
+ mode: 'uncommitted' | 'staged' | 'unstaged' | 'base';
137
+ baseRef?: string;
138
+ ignoreWhitespace?: boolean;
139
+ };
140
+ export type GitStatusFile = {
141
+ path: string;
142
+ oldPath?: string;
143
+ change: GitChange;
144
+ staged: boolean;
145
+ unstaged: boolean;
146
+ };
147
+ export type GitStatus = {
148
+ state: 'repository' | 'not_repository' | 'unsupported';
149
+ reason?: string;
150
+ branch: string | null;
151
+ detached: boolean;
152
+ head: string | null;
153
+ upstream: {
154
+ ref: string;
155
+ ahead: number;
156
+ behind: number;
157
+ } | null;
158
+ baseRef: string | null;
159
+ aheadBehind: {
160
+ ahead: number;
161
+ behind: number;
162
+ } | null;
163
+ hasRemote: boolean;
164
+ remoteUrl: string | null;
165
+ dirty: boolean;
166
+ files: GitStatusFile[];
167
+ hiddenCount: number;
168
+ truncated: boolean;
169
+ snapshot: string;
170
+ };
171
+ export type GitDiffLine = {
172
+ type: 'add' | 'remove' | 'context';
173
+ content: string;
174
+ noNewline?: true;
175
+ };
176
+ export type GitDiffHunk = {
177
+ oldStart: number;
178
+ oldCount: number;
179
+ newStart: number;
180
+ newCount: number;
181
+ context?: string;
182
+ lines: GitDiffLine[];
183
+ };
184
+ export type GitDiffFile = {
185
+ path: string;
186
+ oldPath?: string;
187
+ change: GitChange;
188
+ kind: 'text' | 'binary' | 'too_large' | 'withheld' | 'symlink' | 'submodule';
189
+ additions: number;
190
+ deletions: number;
191
+ hunks: GitDiffHunk[];
192
+ };
193
+ export type GitDiffPage = {
194
+ compare: {
195
+ mode: GitCompare['mode'];
196
+ baseRef?: string;
197
+ ignoreWhitespace: boolean;
198
+ };
199
+ snapshot: string;
200
+ files: GitDiffFile[];
201
+ hiddenCount: number;
202
+ truncated: boolean;
203
+ nextCursor?: string;
204
+ };
205
+ /**
206
+ * Capability `attachments` (§12.6). Principal context is set only by a trusted gateway on its own
207
+ * connection; a local client leaves it out and acts as the owner.
208
+ */
209
+ export type PrincipalContext = {
210
+ principalId?: string;
211
+ principalEpoch?: string;
212
+ authorizedRoots?: string[];
213
+ };
214
+ /** A committed attachment as clients see it: ids and display metadata, never a host path or URL. */
215
+ export type AttachmentInfo = {
216
+ attachmentId: string;
217
+ sessionId: string;
218
+ name: string;
219
+ mimeType: string;
220
+ detectedMimeType: string;
221
+ size: number;
222
+ sha256: string;
223
+ createdAt: string;
224
+ committedAt: string;
225
+ referenced: boolean;
226
+ };
227
+ /** Effective attachment limits a daemon.hello advertises with capability `attachments`. */
228
+ export type AttachmentLimits = {
229
+ maxObjectBytes: number;
230
+ maxPerPrompt: number;
231
+ maxPromptBytes: number;
232
+ maxChunkBytes: number;
233
+ maxActiveUploads: number;
234
+ maxPrincipalBytes: number;
235
+ maxDaemonBytes: number;
236
+ uploadTimeoutMs: number;
237
+ unreferencedRetentionMs: number;
238
+ releasedGraceMs: number;
239
+ };
240
+ /** Where a fork cuts the source conversation (§12.7): after a completed turn, or before a turn. */
241
+ export type ForkBoundary = {
242
+ throughTurnId: string;
243
+ } | {
244
+ beforeTurnId: string;
245
+ };
246
+ export type RegistryMutation = {
247
+ requestId: string;
248
+ ifRevision: number;
249
+ };
250
+ export type RegistryPage = {
251
+ revision: number;
252
+ total: number;
253
+ nextCursor: string | null;
254
+ };
43
255
  export type RpcMethodMap = {
256
+ 'terminal.create': {
257
+ params: PrincipalContext & {
258
+ workspaceId: string;
259
+ cols: number;
260
+ rows: number;
261
+ requestId: string;
262
+ };
263
+ result: {
264
+ terminal: TerminalInfo;
265
+ };
266
+ };
267
+ 'terminal.list': {
268
+ params: PrincipalContext & {
269
+ workspaceId?: string;
270
+ };
271
+ result: {
272
+ terminals: TerminalInfo[];
273
+ };
274
+ };
275
+ 'terminal.attach': {
276
+ params: PrincipalContext & {
277
+ terminalId: string;
278
+ after?: number;
279
+ };
280
+ result: {
281
+ terminal: TerminalInfo;
282
+ nextSeq: number;
283
+ gap?: {
284
+ fromSeq: number;
285
+ toSeq: number;
286
+ };
287
+ };
288
+ };
289
+ 'terminal.input': {
290
+ params: PrincipalContext & {
291
+ terminalId: string;
292
+ data: string;
293
+ };
294
+ result: {
295
+ bytes: number;
296
+ };
297
+ };
298
+ 'terminal.resize': {
299
+ params: PrincipalContext & {
300
+ terminalId: string;
301
+ cols: number;
302
+ rows: number;
303
+ };
304
+ result: {
305
+ cols: number;
306
+ rows: number;
307
+ };
308
+ };
309
+ 'terminal.close': {
310
+ params: PrincipalContext & {
311
+ terminalId: string;
312
+ };
313
+ result: {
314
+ closed: true;
315
+ };
316
+ };
317
+ 'terminal.revoke': {
318
+ params: {
319
+ principalId: string;
320
+ };
321
+ result: {
322
+ closed: number;
323
+ };
324
+ };
325
+ 'attachment.begin': {
326
+ params: PrincipalContext & {
327
+ sessionId: string;
328
+ name: string;
329
+ size: number;
330
+ mimeType: string;
331
+ sha256?: string;
332
+ requestId: string;
333
+ };
334
+ result: {
335
+ uploadId: string;
336
+ state: 'uploading' | 'committed';
337
+ received: number;
338
+ size: number;
339
+ maxChunkBytes: number;
340
+ expiresAt?: string;
341
+ attachmentId?: string;
342
+ };
343
+ };
344
+ 'attachment.chunk': {
345
+ params: PrincipalContext & {
346
+ uploadId: string;
347
+ offset: number;
348
+ data: string;
349
+ };
350
+ result: {
351
+ received: number;
352
+ size: number;
353
+ };
354
+ };
355
+ 'attachment.commit': {
356
+ params: PrincipalContext & {
357
+ uploadId: string;
358
+ sha256: string;
359
+ };
360
+ result: {
361
+ attachment: AttachmentInfo;
362
+ };
363
+ };
364
+ 'attachment.abort': {
365
+ params: PrincipalContext & {
366
+ uploadId: string;
367
+ };
368
+ result: {
369
+ aborted: true;
370
+ };
371
+ };
372
+ 'attachment.get': {
373
+ params: PrincipalContext & {
374
+ attachmentId: string;
375
+ };
376
+ result: {
377
+ attachment: AttachmentInfo;
378
+ };
379
+ };
380
+ 'attachment.delete': {
381
+ params: PrincipalContext & {
382
+ attachmentId: string;
383
+ };
384
+ result: {
385
+ deleted: true;
386
+ };
387
+ };
388
+ 'workspace.git.status': {
389
+ params: {
390
+ workspaceId: string;
391
+ };
392
+ result: GitStatus;
393
+ };
394
+ 'workspace.git.diff': {
395
+ params: {
396
+ workspaceId: string;
397
+ compare: GitCompare;
398
+ path?: string;
399
+ cursor?: string;
400
+ };
401
+ result: GitDiffPage;
402
+ };
403
+ 'workspace.worktree.options': {
404
+ params: {
405
+ workspaceId: string;
406
+ };
407
+ result: {
408
+ mappingIds: string[];
409
+ };
410
+ };
411
+ 'workspace.worktree.create': {
412
+ params: RegistryMutation & {
413
+ workspaceId: string;
414
+ mappingId: string;
415
+ };
416
+ result: {
417
+ workspace: RegistryWorkspace;
418
+ revision: number;
419
+ };
420
+ };
421
+ 'workspace.worktree.remove': {
422
+ params: RegistryMutation & {
423
+ workspaceId: string;
424
+ };
425
+ result: {
426
+ workspace: RegistryWorkspace;
427
+ revision: number;
428
+ filesRemoved: true;
429
+ branchRetained: true;
430
+ };
431
+ };
432
+ 'registry.worktree': {
433
+ params: {
434
+ principalId?: string;
435
+ principalEpoch?: string;
436
+ mappingIds?: string[];
437
+ authorizedRoots?: string[];
438
+ };
439
+ result: {
440
+ mappings: Array<{
441
+ id: string;
442
+ source: string;
443
+ }>;
444
+ workspaces: unknown[];
445
+ };
446
+ };
447
+ 'project.list': {
448
+ params: {
449
+ cursor?: string;
450
+ limit?: number;
451
+ projectRoots?: string[];
452
+ };
453
+ result: RegistryPage & {
454
+ projects: RegistryProject[];
455
+ };
456
+ };
457
+ 'workspace.list': {
458
+ params: {
459
+ cursor?: string;
460
+ limit?: number;
461
+ projectRoots?: string[];
462
+ };
463
+ result: RegistryPage & {
464
+ workspaces: RegistryWorkspace[];
465
+ };
466
+ };
467
+ 'workspace.get': {
468
+ params: {
469
+ workspaceId: string;
470
+ };
471
+ result: {
472
+ workspace: RegistryWorkspace;
473
+ revision: number;
474
+ };
475
+ };
476
+ 'project.register': {
477
+ params: RegistryMutation & {
478
+ directory: string;
479
+ };
480
+ result: {
481
+ project: RegistryProject;
482
+ revision: number;
483
+ };
484
+ };
485
+ 'project.remove': {
486
+ params: RegistryMutation & {
487
+ projectId: string;
488
+ };
489
+ result: {
490
+ project: RegistryProject;
491
+ revision: number;
492
+ };
493
+ };
494
+ 'workspace.update': {
495
+ params: RegistryMutation & {
496
+ workspaceId: string;
497
+ title?: string | null;
498
+ pinned?: boolean;
499
+ archived?: boolean;
500
+ };
501
+ result: {
502
+ workspace: RegistryWorkspace;
503
+ revision: number;
504
+ };
505
+ };
506
+ 'registry.owner': {
507
+ params: {
508
+ operation?: string;
509
+ args?: Record<string, unknown>;
510
+ requestId?: string;
511
+ ifRevision?: number;
512
+ };
513
+ result: {
514
+ registry: Record<string, unknown>;
515
+ };
516
+ };
44
517
  'daemon.hello': {
45
518
  params: {
46
519
  protocolVersion: 1;
@@ -60,6 +533,8 @@ export type RpcMethodMap = {
60
533
  maxBytes: number;
61
534
  maxTotalBytes: number;
62
535
  };
536
+ attachmentLimits?: AttachmentLimits;
537
+ terminalLimits?: TerminalLimits;
63
538
  capabilities?: string[];
64
539
  };
65
540
  };
@@ -153,14 +628,29 @@ export type RpcMethodMap = {
153
628
  questions: UserQuestion[];
154
629
  };
155
630
  };
156
- /** Capability `question.watch`: the waiting questions now; then this connection is told of every tree's `question` and `question.resolved` (of `projectRoot` when given). `turns` (capability `question.watch.turns`): also every root's `turn.ended`. */
631
+ /** Capability `question.watch`: the waiting questions now; then this connection is told of every tree's `question` and `question.resolved` (of `projectRoot` when given). `turns` (capability `question.watch.turns`): also every root's `turn.ended`. `attention` (capability `session.attention`): also each root's attention, now and as it changes. */
157
632
  'question.watch': {
158
633
  params: {
159
634
  projectRoot?: string;
160
635
  turns?: boolean;
636
+ attention?: boolean;
161
637
  };
162
638
  result: {
163
639
  questions: UserQuestion[];
640
+ attention?: Array<{
641
+ sessionId: string;
642
+ attention: TurnAttention;
643
+ }>;
644
+ };
645
+ };
646
+ /** Capability `session.attention`: acknowledges a root's attention for every client; with `at`, only that one (a later turn's stays). */
647
+ 'session.attention.clear': {
648
+ params: {
649
+ sessionId: string;
650
+ at?: string;
651
+ };
652
+ result: {
653
+ cleared: boolean;
164
654
  };
165
655
  };
166
656
  /** Capability `workspace.files`: files under `projectRoot` whose relative path matches `query`, best first; read-only, links not followed. */
@@ -223,11 +713,18 @@ export type RpcMethodMap = {
223
713
  'session.create': {
224
714
  params: {
225
715
  sessionId?: string;
226
- spec: SessionSpec;
227
716
  history?: 'skip' | 'replay';
228
717
  delegation?: boolean;
229
718
  resume?: boolean;
230
- };
719
+ } & ({
720
+ workspaceId: string;
721
+ spec: Omit<SessionSpec, 'cwd'> & {
722
+ cwd?: string;
723
+ };
724
+ } | {
725
+ workspaceId?: undefined;
726
+ spec: SessionSpec;
727
+ });
231
728
  result: {
232
729
  session: SessionSnapshot;
233
730
  attached: boolean;
@@ -243,11 +740,21 @@ export type RpcMethodMap = {
243
740
  preview: SessionPreview;
244
741
  };
245
742
  };
743
+ 'session.history': {
744
+ params: {
745
+ sessionId: string;
746
+ before?: string;
747
+ limit?: number;
748
+ maxBytes?: number;
749
+ };
750
+ result: HistoryPage;
751
+ };
246
752
  'session.attach': {
247
753
  params: {
248
754
  sessionId: string;
249
755
  replay?: boolean;
250
756
  after?: number;
757
+ generation?: string;
251
758
  };
252
759
  result: {
253
760
  session: SessionSummary;
@@ -264,7 +771,7 @@ export type RpcMethodMap = {
264
771
  };
265
772
  };
266
773
  'session.prompt': {
267
- params: {
774
+ params: PrincipalContext & {
268
775
  sessionId: string;
269
776
  clientMessageId: string;
270
777
  delivery?: 'auto' | 'steer';
@@ -280,17 +787,46 @@ export type RpcMethodMap = {
280
787
  };
281
788
  'session.interrupt': {
282
789
  params: {
283
- sessionId: string;
790
+ sessionId: string; /** With session.interrupt.turn, cancel only this turn. */
791
+ turnId?: string;
792
+ };
793
+ result: {
794
+ interrupted?: boolean;
284
795
  };
285
- result: Empty;
286
796
  };
797
+ /**
798
+ * Changes a session's permissions mode while idle; with capability `session.configure.live`, also a live
799
+ * root's model, effort or team (§12.9): those need requestId and ifGeneration, apply at the idle barrier
800
+ * through a restart of its native process on the same conversation, and answer `configured`. Answered
801
+ * once per (sessionId, requestId): a repeat answers the first result with `duplicate: true`.
802
+ */
287
803
  'session.configure': {
288
804
  params: {
289
805
  sessionId: string;
290
806
  mode?: string;
807
+ model?: string;
808
+ thinking?: string;
809
+ team?: string;
810
+ requestId?: string;
811
+ ifGeneration?: string;
291
812
  };
292
813
  result: {
293
- session: SessionSnapshot;
814
+ session: SessionSnapshot | SessionSummary;
815
+ configured?: ConfigureOutcome;
816
+ duplicate?: true;
817
+ };
818
+ };
819
+ /** What session.configure would run a live root with, and whether it would take it now (capability `session.configure.live`, §12.9). */
820
+ 'session.configure.preview': {
821
+ params: {
822
+ sessionId: string;
823
+ mode?: string;
824
+ model?: string;
825
+ thinking?: string;
826
+ team?: string;
827
+ };
828
+ result: {
829
+ preview: ConfigurePreview;
294
830
  };
295
831
  };
296
832
  'session.close': {
@@ -308,6 +844,71 @@ export type RpcMethodMap = {
308
844
  session: SessionSummary;
309
845
  };
310
846
  };
847
+ /**
848
+ * A new root whose conversation is the source's up to a completed turn (capability `session.fork`, §12.7).
849
+ * Answered once per (sessionId, requestId): a repeat answers the first result with `duplicate: true`.
850
+ */
851
+ 'session.fork': {
852
+ params: PrincipalContext & {
853
+ sessionId: string;
854
+ requestId: string;
855
+ ifGeneration: string;
856
+ boundary?: ForkBoundary;
857
+ branchId?: string;
858
+ workspaceId?: string;
859
+ newSessionId?: string;
860
+ title?: string;
861
+ };
862
+ result: {
863
+ session: SessionSummary;
864
+ forkedFrom: ForkProvenance;
865
+ duplicate?: true;
866
+ };
867
+ };
868
+ /**
869
+ * The root's conversation from before a turn on, under the same session id; the later turns stay as a
870
+ * recoverable branch and no file is changed (capability `session.rewind`, §12.7).
871
+ */
872
+ 'session.rewind': {
873
+ params: {
874
+ sessionId: string;
875
+ requestId: string;
876
+ ifGeneration: string;
877
+ beforeTurnId: string;
878
+ };
879
+ result: {
880
+ session: SessionSummary;
881
+ generation: string;
882
+ branch: ConversationBranch;
883
+ duplicate?: true;
884
+ };
885
+ };
886
+ /**
887
+ * Restarts a live root's native process on its own conversation and configuration at the idle
888
+ * barrier, keeping its session id, history and receipts (capability `session.reload`, §12.8).
889
+ * Answered once per (sessionId, requestId): a repeat answers the first result with `duplicate: true`.
890
+ */
891
+ 'session.reload': {
892
+ params: {
893
+ sessionId: string;
894
+ requestId: string;
895
+ ifGeneration: string;
896
+ };
897
+ result: {
898
+ session: SessionSummary;
899
+ duplicate?: true;
900
+ };
901
+ };
902
+ /**
903
+ * The ALP CLI command that continues a session in a terminal, built by alpd (capability
904
+ * `session.resumeCommand`, §12.8): argv and its POSIX and Windows command lines, for the clipboard only.
905
+ */
906
+ 'session.resumeCommand': {
907
+ params: {
908
+ sessionId: string;
909
+ };
910
+ result: ResumeCommand;
911
+ };
311
912
  'session.archive': {
312
913
  params: {
313
914
  sessionId: string;
@@ -563,6 +1164,45 @@ export type RpcMethodMap = {
563
1164
  };
564
1165
  result: LanguageSetting;
565
1166
  };
1167
+ /** Capability `schedule`: a one-shot continuation of a root session, due at `dueAt` (UTC, ISO 8601). */
1168
+ 'schedule.create': {
1169
+ params: {
1170
+ projectRoot: string;
1171
+ sessionId: string;
1172
+ dueAt: string;
1173
+ prompt: string;
1174
+ };
1175
+ result: {
1176
+ job: ScheduleJob;
1177
+ };
1178
+ };
1179
+ 'schedule.list': {
1180
+ params: {
1181
+ projectRoot: string;
1182
+ status?: ScheduleStatus;
1183
+ };
1184
+ result: {
1185
+ jobs: ScheduleJob[];
1186
+ };
1187
+ };
1188
+ 'schedule.get': {
1189
+ params: {
1190
+ id: string;
1191
+ projectRoot: string;
1192
+ };
1193
+ result: {
1194
+ job: ScheduleJob;
1195
+ };
1196
+ };
1197
+ 'schedule.cancel': {
1198
+ params: {
1199
+ id: string;
1200
+ projectRoot: string;
1201
+ };
1202
+ result: {
1203
+ job: ScheduleJob;
1204
+ };
1205
+ };
566
1206
  };
567
1207
  export type RpcMethod = keyof RpcMethodMap;
568
1208
  export type RpcParams<M extends RpcMethod> = RpcMethodMap[M]['params'];