@anhlp/alp-protocol 0.0.0-beta.2 → 0.0.1-beta.10

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,573 @@ 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
+ /** Absent: full native protection. root-only: best-effort Linux. none: Windows ConPTY, best-effort cleanup. */
52
+ protection?: 'root-only' | 'none';
53
+ };
54
+ /** Effective terminal limits a daemon.hello advertises with capability `terminal`. */
55
+ export type TerminalLimits = {
56
+ maxPerPrincipal: number;
57
+ maxPerDaemon: number;
58
+ maxInputBytes: number;
59
+ maxOutputFrameBytes: number;
60
+ replayBytes: number;
61
+ idleMs: number;
62
+ maxLifetimeMs: number;
63
+ reconnectMs: number;
64
+ };
65
+ /** params of a terminal.event notification, sent only to the connection attached to the terminal. */
66
+ export type TerminalEvent = {
67
+ terminalId: string;
68
+ type: 'output';
69
+ seq: number;
70
+ data: string;
71
+ } | {
72
+ terminalId: string;
73
+ type: 'exit';
74
+ seq: number;
75
+ exitCode: number | null;
76
+ signal: number | null;
77
+ reason: TerminalEndReason;
78
+ } | {
79
+ terminalId: string;
80
+ type: 'detached';
81
+ reason: 'replaced' | 'slow_consumer';
82
+ };
83
+ export type CatalogUpdatedNotification = {
84
+ jsonrpc: '2.0';
85
+ method: 'catalog.updated';
86
+ params: {
87
+ fetchedAt?: string;
88
+ };
89
+ };
90
+ export type TerminalChangedNotification = {
91
+ jsonrpc: '2.0';
92
+ method: 'terminal.changed';
93
+ params: {
94
+ watchId: string;
95
+ cursor: string;
96
+ };
97
+ };
98
+ export type TerminalNotification = {
99
+ jsonrpc: '2.0';
100
+ method: 'terminal.event';
101
+ params: TerminalEvent;
102
+ };
33
103
  /** 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' | 'settings.language' | 'session.list.page' | 'question.watch' | 'question.watch.turns' | 'workspace.files' | 'workspace.files.read' | 'prompt.images';
104
+ export type HistoryItem = Envelope | {
105
+ cursor: number;
106
+ oversized: {
107
+ bytes: number;
108
+ };
109
+ };
110
+ export type HistoryPage = {
111
+ generation: string;
112
+ items: HistoryItem[];
113
+ olderCursor?: string;
114
+ hasOlder: boolean;
115
+ tipCursor: number;
116
+ };
117
+ /** One entry of session.commands: inserted as `/<name>` into the composer. */
118
+ export type SessionCommand = {
119
+ name: string;
120
+ description: string;
121
+ argumentHint?: string;
122
+ kind: 'command' | 'skill';
123
+ };
124
+ export type Capability = 'session.interrupt.turn' | 'session.fork' | 'session.rewind' | 'session.reload' | 'session.resumeCommand' | 'session.commands' | 'session.configure.live' | 'terminal' | 'terminal.capture' | 'terminal.watch' | 'attachments' | 'workspace.git' | 'workspace.git.facts' | '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' | 'workspace.files.browse' | 'host.directories' | 'prompt.images' | 'schedule' | 'catalog.live';
35
125
  /** `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' | 'unsafe_path' | 'revision_conflict' | 'task_state' | 'in_use' | 'busy' | 'unreadable' | 'not_directory' | 'blocked_path' | 'ignored' | 'linked' | 'binary' | 'too_large';
126
+ 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' | 'outside' | 'changed' | 'not_repository' | 'unknown_ref' | 'invalid_compare' | 'stale_snapshot' | 'git_unavailable' | 'git_failed' | 'native_command_unsupported' | '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_capture_unavailable' | 'terminal_capture_too_large' | 'terminal_snapshot_too_large' | 'terminal_disabled' | 'terminal_unsupported' | 'terminal_limit' | 'not_attached' | 'terminal_exited' | 'input_too_large';
37
127
  type Empty = Record<string, never>;
38
128
  /**
39
129
  * Params and result of every v1 method, as schema/methods-v1.json defines them; the protocol tests
40
130
  * type-check the golden fixtures against this map, so the two cannot drift. Results may carry
41
131
  * properties this map does not name: clients ignore them.
42
132
  */
133
+ export type RegistryProject = {
134
+ id: string;
135
+ root: string;
136
+ canonical?: string;
137
+ customName?: string | null;
138
+ addedAt: string;
139
+ removedAt?: string | null;
140
+ revision?: number;
141
+ };
142
+ export type RegistryWorkspace = {
143
+ branch?: string | null;
144
+ managedWorktree?: boolean;
145
+ id: string;
146
+ projectId: string;
147
+ directory: string;
148
+ canonical?: string;
149
+ title?: string | null;
150
+ pinnedAt?: string | null;
151
+ archivedAt?: string | null;
152
+ labels: string[];
153
+ createdAt: string;
154
+ revision?: number;
155
+ idempotencyKey?: string;
156
+ };
157
+ /** workspace.git.status and workspace.git.diff (capability `workspace.git`, §12.5): paths are relative to the workspace, never host paths. */
158
+ export type GitChange = 'modified' | 'added' | 'deleted' | 'renamed' | 'copied' | 'typechange' | 'untracked' | 'conflicted';
159
+ export type GitCompare = {
160
+ mode: 'uncommitted' | 'staged' | 'unstaged' | 'base';
161
+ baseRef?: string;
162
+ ignoreWhitespace?: boolean;
163
+ };
164
+ export type GitStatusFile = {
165
+ path: string;
166
+ oldPath?: string;
167
+ change: GitChange;
168
+ staged: boolean;
169
+ unstaged: boolean;
170
+ };
171
+ export type GitStatus = {
172
+ state: 'repository' | 'not_repository' | 'unsupported';
173
+ reason?: string;
174
+ branch: string | null;
175
+ detached: boolean;
176
+ head: string | null;
177
+ upstream: {
178
+ ref: string;
179
+ ahead: number;
180
+ behind: number;
181
+ } | null;
182
+ baseRef: string | null;
183
+ aheadBehind: {
184
+ ahead: number;
185
+ behind: number;
186
+ } | null;
187
+ hasRemote: boolean;
188
+ remoteUrl: string | null;
189
+ dirty: boolean;
190
+ files: GitStatusFile[];
191
+ hiddenCount: number;
192
+ truncated: boolean;
193
+ snapshot: string;
194
+ };
195
+ export type GitDiffLine = {
196
+ type: 'add' | 'remove' | 'context';
197
+ content: string;
198
+ noNewline?: true;
199
+ };
200
+ export type GitDiffHunk = {
201
+ oldStart: number;
202
+ oldCount: number;
203
+ newStart: number;
204
+ newCount: number;
205
+ context?: string;
206
+ lines: GitDiffLine[];
207
+ };
208
+ export type GitDiffFile = {
209
+ path: string;
210
+ oldPath?: string;
211
+ change: GitChange;
212
+ kind: 'text' | 'binary' | 'too_large' | 'withheld' | 'symlink' | 'submodule';
213
+ additions: number;
214
+ deletions: number;
215
+ hunks: GitDiffHunk[];
216
+ };
217
+ export type GitDiffPage = {
218
+ compare: {
219
+ mode: GitCompare['mode'];
220
+ baseRef?: string;
221
+ ignoreWhitespace: boolean;
222
+ };
223
+ snapshot: string;
224
+ files: GitDiffFile[];
225
+ hiddenCount: number;
226
+ truncated: boolean;
227
+ nextCursor?: string;
228
+ };
229
+ /**
230
+ * workspace.git.facts (capability `workspace.git.facts`, §12.5): an owner-only answer for a host
231
+ * directory, so `repoRoot` is a host path (the directory's real path, or the enclosing repository's
232
+ * top level for `not_repository_root`). Never forwarded by a gateway.
233
+ */
234
+ export type GitCheckoutFacts = {
235
+ repoRoot: string;
236
+ branch: string | null;
237
+ detached: boolean;
238
+ head: string | null;
239
+ hasRemote: boolean;
240
+ remoteUrl: string | null;
241
+ dirty: boolean;
242
+ };
243
+ export type GitFacts = ({
244
+ kind: 'ok' | 'not_repository_root';
245
+ } & GitCheckoutFacts) | {
246
+ kind: 'unknown';
247
+ } | {
248
+ kind: 'unsupported';
249
+ reason: 'worktree_elsewhere' | 'inside_git_dir';
250
+ };
251
+ /**
252
+ * Capability `attachments` (§12.6). Principal context is set only by a trusted gateway on its own
253
+ * connection; a local client leaves it out and acts as the owner.
254
+ */
255
+ export type PrincipalContext = {
256
+ principalId?: string;
257
+ principalEpoch?: string;
258
+ authorizedRoots?: string[];
259
+ };
260
+ /** A committed attachment as clients see it: ids and display metadata, never a host path or URL. */
261
+ export type AttachmentInfo = {
262
+ attachmentId: string;
263
+ sessionId: string;
264
+ name: string;
265
+ mimeType: string;
266
+ detectedMimeType: string;
267
+ size: number;
268
+ sha256: string;
269
+ createdAt: string;
270
+ committedAt: string;
271
+ referenced: boolean;
272
+ };
273
+ /** Effective attachment limits a daemon.hello advertises with capability `attachments`. */
274
+ export type AttachmentLimits = {
275
+ maxObjectBytes: number;
276
+ maxPerPrompt: number;
277
+ maxPromptBytes: number;
278
+ maxChunkBytes: number;
279
+ maxActiveUploads: number;
280
+ maxPrincipalBytes: number;
281
+ maxDaemonBytes: number;
282
+ uploadTimeoutMs: number;
283
+ unreferencedRetentionMs: number;
284
+ releasedGraceMs: number;
285
+ };
286
+ /** Where a fork cuts the source conversation (§12.7): after a completed turn, or before a turn. */
287
+ export type ForkBoundary = {
288
+ throughTurnId: string;
289
+ } | {
290
+ beforeTurnId: string;
291
+ };
292
+ export type RegistryMutation = {
293
+ requestId: string;
294
+ ifRevision: number;
295
+ };
296
+ export type RegistryPage = {
297
+ revision: number;
298
+ total: number;
299
+ nextCursor: string | null;
300
+ };
43
301
  export type RpcMethodMap = {
302
+ 'terminal.create': {
303
+ params: PrincipalContext & {
304
+ workspaceId: string;
305
+ cols: number;
306
+ rows: number;
307
+ requestId: string;
308
+ protectionAcknowledgment?: 'linux-root-only-v1';
309
+ };
310
+ result: {
311
+ terminal: TerminalInfo;
312
+ };
313
+ };
314
+ 'terminal.list': {
315
+ params: PrincipalContext & {
316
+ workspaceId?: string;
317
+ };
318
+ result: {
319
+ terminals: TerminalInfo[];
320
+ };
321
+ };
322
+ 'terminal.watch': {
323
+ params: PrincipalContext & {
324
+ workspaceId?: string;
325
+ after?: string;
326
+ };
327
+ result: {
328
+ terminals: TerminalInfo[];
329
+ watchId: string;
330
+ cursor: string;
331
+ reset: boolean;
332
+ };
333
+ };
334
+ 'terminal.unwatch': {
335
+ params: Empty;
336
+ result: {
337
+ closed: true;
338
+ };
339
+ };
340
+ 'terminal.capture': {
341
+ params: PrincipalContext & {
342
+ terminalId: string;
343
+ start?: number;
344
+ end?: number;
345
+ stripAnsi?: boolean;
346
+ };
347
+ result: {
348
+ lines: string[];
349
+ totalLines: number;
350
+ };
351
+ };
352
+ 'terminal.attach': {
353
+ params: PrincipalContext & {
354
+ terminalId: string;
355
+ after?: number;
356
+ protectionAcknowledgment?: 'linux-root-only-v1';
357
+ };
358
+ result: {
359
+ terminal: TerminalInfo;
360
+ nextSeq: number;
361
+ gap?: {
362
+ fromSeq: number;
363
+ toSeq: number;
364
+ };
365
+ };
366
+ };
367
+ 'terminal.input': {
368
+ params: PrincipalContext & {
369
+ terminalId: string;
370
+ data: string;
371
+ };
372
+ result: {
373
+ bytes: number;
374
+ };
375
+ };
376
+ 'terminal.resize': {
377
+ params: PrincipalContext & {
378
+ terminalId: string;
379
+ cols: number;
380
+ rows: number;
381
+ };
382
+ result: {
383
+ cols: number;
384
+ rows: number;
385
+ };
386
+ };
387
+ 'terminal.close': {
388
+ params: PrincipalContext & {
389
+ terminalId: string;
390
+ };
391
+ result: {
392
+ closed: true;
393
+ };
394
+ };
395
+ 'terminal.revoke': {
396
+ params: {
397
+ principalId: string;
398
+ };
399
+ result: {
400
+ closed: number;
401
+ };
402
+ };
403
+ 'attachment.begin': {
404
+ params: PrincipalContext & {
405
+ sessionId: string;
406
+ name: string;
407
+ size: number;
408
+ mimeType: string;
409
+ sha256?: string;
410
+ requestId: string;
411
+ };
412
+ result: {
413
+ uploadId: string;
414
+ state: 'uploading' | 'committed';
415
+ received: number;
416
+ size: number;
417
+ maxChunkBytes: number;
418
+ expiresAt?: string;
419
+ attachmentId?: string;
420
+ };
421
+ };
422
+ 'attachment.chunk': {
423
+ params: PrincipalContext & {
424
+ uploadId: string;
425
+ offset: number;
426
+ data: string;
427
+ };
428
+ result: {
429
+ received: number;
430
+ size: number;
431
+ };
432
+ };
433
+ 'attachment.commit': {
434
+ params: PrincipalContext & {
435
+ uploadId: string;
436
+ sha256: string;
437
+ };
438
+ result: {
439
+ attachment: AttachmentInfo;
440
+ };
441
+ };
442
+ 'attachment.abort': {
443
+ params: PrincipalContext & {
444
+ uploadId: string;
445
+ };
446
+ result: {
447
+ aborted: true;
448
+ };
449
+ };
450
+ 'attachment.get': {
451
+ params: PrincipalContext & {
452
+ attachmentId: string;
453
+ };
454
+ result: {
455
+ attachment: AttachmentInfo;
456
+ };
457
+ };
458
+ 'attachment.delete': {
459
+ params: PrincipalContext & {
460
+ attachmentId: string;
461
+ };
462
+ result: {
463
+ deleted: true;
464
+ };
465
+ };
466
+ 'workspace.git.status': {
467
+ params: {
468
+ workspaceId: string;
469
+ };
470
+ result: GitStatus;
471
+ };
472
+ 'workspace.git.diff': {
473
+ params: {
474
+ workspaceId: string;
475
+ compare: GitCompare;
476
+ path?: string;
477
+ cursor?: string;
478
+ };
479
+ result: GitDiffPage;
480
+ };
481
+ 'workspace.git.facts': {
482
+ params: {
483
+ directory: string;
484
+ };
485
+ result: GitFacts;
486
+ };
487
+ 'workspace.worktree.options': {
488
+ params: {
489
+ workspaceId: string;
490
+ };
491
+ result: {
492
+ mappingIds: string[];
493
+ };
494
+ };
495
+ 'workspace.worktree.create': {
496
+ params: RegistryMutation & {
497
+ workspaceId: string;
498
+ mappingId: string;
499
+ };
500
+ result: {
501
+ workspace: RegistryWorkspace;
502
+ revision: number;
503
+ };
504
+ };
505
+ 'workspace.worktree.remove': {
506
+ params: RegistryMutation & {
507
+ workspaceId: string;
508
+ };
509
+ result: {
510
+ workspace: RegistryWorkspace;
511
+ revision: number;
512
+ filesRemoved: true;
513
+ branchRetained: true;
514
+ };
515
+ };
516
+ 'registry.worktree': {
517
+ params: {
518
+ principalId?: string;
519
+ principalEpoch?: string;
520
+ mappingIds?: string[];
521
+ authorizedRoots?: string[];
522
+ };
523
+ result: {
524
+ mappings: Array<{
525
+ id: string;
526
+ source: string;
527
+ }>;
528
+ workspaces: unknown[];
529
+ };
530
+ };
531
+ 'project.list': {
532
+ params: {
533
+ cursor?: string;
534
+ limit?: number;
535
+ projectRoots?: string[];
536
+ };
537
+ result: RegistryPage & {
538
+ projects: RegistryProject[];
539
+ };
540
+ };
541
+ 'workspace.list': {
542
+ params: {
543
+ cursor?: string;
544
+ limit?: number;
545
+ projectRoots?: string[];
546
+ };
547
+ result: RegistryPage & {
548
+ workspaces: RegistryWorkspace[];
549
+ };
550
+ };
551
+ 'workspace.get': {
552
+ params: {
553
+ workspaceId: string;
554
+ };
555
+ result: {
556
+ workspace: RegistryWorkspace;
557
+ revision: number;
558
+ };
559
+ };
560
+ 'project.register': {
561
+ params: RegistryMutation & {
562
+ directory: string;
563
+ };
564
+ result: {
565
+ project: RegistryProject;
566
+ revision: number;
567
+ };
568
+ };
569
+ 'project.remove': {
570
+ params: RegistryMutation & {
571
+ projectId: string;
572
+ };
573
+ result: {
574
+ project: RegistryProject;
575
+ revision: number;
576
+ };
577
+ };
578
+ 'workspace.update': {
579
+ params: RegistryMutation & {
580
+ workspaceId: string;
581
+ title?: string | null;
582
+ pinned?: boolean;
583
+ archived?: boolean;
584
+ };
585
+ result: {
586
+ workspace: RegistryWorkspace;
587
+ revision: number;
588
+ };
589
+ };
590
+ 'registry.owner': {
591
+ params: {
592
+ operation?: string;
593
+ args?: Record<string, unknown>;
594
+ requestId?: string;
595
+ ifRevision?: number;
596
+ };
597
+ result: {
598
+ registry: Record<string, unknown>;
599
+ };
600
+ };
44
601
  'daemon.hello': {
45
602
  params: {
46
603
  protocolVersion: 1;
@@ -55,6 +612,13 @@ export type RpcMethodMap = {
55
612
  daemonVersion?: string;
56
613
  pid?: number; /** The daemon host's machine name (os.hostname()), a label for clients. */
57
614
  hostname?: string;
615
+ promptImageLimits?: {
616
+ maxCount: number;
617
+ maxBytes: number;
618
+ maxTotalBytes: number;
619
+ };
620
+ attachmentLimits?: AttachmentLimits;
621
+ terminalLimits?: TerminalLimits;
58
622
  capabilities?: string[];
59
623
  };
60
624
  };
@@ -121,6 +685,27 @@ export type RpcMethodMap = {
121
685
  modes: Array<Record<string, unknown>>;
122
686
  thinkingOptions?: unknown;
123
687
  defaultModel: string;
688
+ fetchedAt?: string;
689
+ providers?: Record<string, {
690
+ status: string;
691
+ fetchedAt?: string;
692
+ error?: string;
693
+ }>;
694
+ };
695
+ };
696
+ 'catalog.refresh': {
697
+ params: Empty;
698
+ result: {
699
+ models: Array<Record<string, unknown>>;
700
+ modes: Array<Record<string, unknown>>;
701
+ thinkingOptions?: unknown;
702
+ defaultModel: string;
703
+ fetchedAt?: string;
704
+ providers?: Record<string, {
705
+ status: string;
706
+ fetchedAt?: string;
707
+ error?: string;
708
+ }>;
124
709
  };
125
710
  };
126
711
  'assignment.recall': {
@@ -148,14 +733,29 @@ export type RpcMethodMap = {
148
733
  questions: UserQuestion[];
149
734
  };
150
735
  };
151
- /** 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`. */
736
+ /** 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. */
152
737
  'question.watch': {
153
738
  params: {
154
739
  projectRoot?: string;
155
740
  turns?: boolean;
741
+ attention?: boolean;
156
742
  };
157
743
  result: {
158
744
  questions: UserQuestion[];
745
+ attention?: Array<{
746
+ sessionId: string;
747
+ attention: TurnAttention;
748
+ }>;
749
+ };
750
+ };
751
+ /** Capability `session.attention`: acknowledges a root's attention for every client; with `at`, only that one (a later turn's stays). */
752
+ 'session.attention.clear': {
753
+ params: {
754
+ sessionId: string;
755
+ at?: string;
756
+ };
757
+ result: {
758
+ cleared: boolean;
159
759
  };
160
760
  };
161
761
  /** Capability `workspace.files`: files under `projectRoot` whose relative path matches `query`, best first; read-only, links not followed. */
@@ -172,12 +772,14 @@ export type RpcMethodMap = {
172
772
  truncated?: boolean;
173
773
  };
174
774
  };
175
- /** Capability `workspace.files.read`: the entries of a directory under `projectRoot` (its root when `path` is left out); links, blocked and (unless `includeIgnored`) .gitignore'd entries left out. */
775
+ /** Capability `workspace.files.read`: the entries of a directory under `projectRoot` (its root when `path` is left out); links, blocked and (unless `includeIgnored`) .gitignore'd entries left out. With `workspace.files.browse`: `cursor` pages past 1000 entries; `internalLinks` lists links inside the root as what they lead to (`target`). */
176
776
  'workspace.files.list': {
177
777
  params: {
178
778
  projectRoot: string;
179
779
  path?: string;
180
780
  includeIgnored?: boolean;
781
+ cursor?: string;
782
+ internalLinks?: boolean;
181
783
  };
182
784
  result: {
183
785
  entries: Array<{
@@ -186,8 +788,11 @@ export type RpcMethodMap = {
186
788
  kind: 'file' | 'directory';
187
789
  size?: number;
188
790
  modifiedAt?: string;
791
+ target?: string;
189
792
  }>;
190
793
  truncated?: boolean;
794
+ nextCursor?: string;
795
+ target?: string;
191
796
  };
192
797
  };
193
798
  /** Capability `workspace.files.read`: a UTF-8 text file under `projectRoot`, at most 1 MiB; read-only, links not followed. */
@@ -204,6 +809,63 @@ export type RpcMethodMap = {
204
809
  modifiedAt?: string;
205
810
  };
206
811
  };
812
+ /** Capability `workspace.files.browse`: every name under `projectRoot` holding `query`'s letters in order (or ending with it), in path order, in pages of a snapshot; read-only, links not entered. */
813
+ 'workspace.files.find': {
814
+ params: {
815
+ projectRoot: string;
816
+ query?: string;
817
+ kinds?: Array<'file' | 'directory'>;
818
+ matchMode?: 'subsequence' | 'suffix';
819
+ limit?: number;
820
+ cursor?: string;
821
+ };
822
+ result: {
823
+ entries: Array<{
824
+ path: string;
825
+ kind: 'file' | 'directory';
826
+ }>;
827
+ nextCursor?: string;
828
+ truncated?: boolean;
829
+ };
830
+ };
831
+ /** Capability `workspace.files.browse`: a file under `projectRoot` as a preview, text, image or binary, at most 50 MiB, its bytes in chunks from `offset`. */
832
+ 'workspace.files.preview': {
833
+ params: {
834
+ projectRoot: string;
835
+ path: string;
836
+ includeIgnored?: boolean;
837
+ internalLinks?: boolean;
838
+ maxBytes?: number;
839
+ offset?: number;
840
+ revision?: string;
841
+ };
842
+ result: {
843
+ path: string;
844
+ target?: string;
845
+ kind: 'text' | 'image' | 'binary';
846
+ mimeType: string;
847
+ size: number;
848
+ modifiedAt: string;
849
+ revision: string;
850
+ encoding: 'base64' | 'none';
851
+ content?: string;
852
+ offset?: number;
853
+ nextOffset?: number;
854
+ };
855
+ };
856
+ /** Capability `host.directories`: directories of the daemon host whose path completes `query` (absolute or under ~), or whose name matches it under the home directory. */
857
+ 'host.directories.search': {
858
+ params: {
859
+ query: string;
860
+ limit?: number;
861
+ };
862
+ result: {
863
+ entries: Array<{
864
+ path: string;
865
+ }>;
866
+ truncated?: boolean;
867
+ };
868
+ };
207
869
  'question.answer': {
208
870
  params: {
209
871
  questionId: string;
@@ -218,11 +880,18 @@ export type RpcMethodMap = {
218
880
  'session.create': {
219
881
  params: {
220
882
  sessionId?: string;
221
- spec: SessionSpec;
222
883
  history?: 'skip' | 'replay';
223
884
  delegation?: boolean;
224
885
  resume?: boolean;
225
- };
886
+ } & ({
887
+ workspaceId: string;
888
+ spec: Omit<SessionSpec, 'cwd'> & {
889
+ cwd?: string;
890
+ };
891
+ } | {
892
+ workspaceId?: undefined;
893
+ spec: SessionSpec;
894
+ });
226
895
  result: {
227
896
  session: SessionSnapshot;
228
897
  attached: boolean;
@@ -238,11 +907,21 @@ export type RpcMethodMap = {
238
907
  preview: SessionPreview;
239
908
  };
240
909
  };
910
+ 'session.history': {
911
+ params: {
912
+ sessionId: string;
913
+ before?: string;
914
+ limit?: number;
915
+ maxBytes?: number;
916
+ };
917
+ result: HistoryPage;
918
+ };
241
919
  'session.attach': {
242
920
  params: {
243
921
  sessionId: string;
244
922
  replay?: boolean;
245
923
  after?: number;
924
+ generation?: string;
246
925
  };
247
926
  result: {
248
927
  session: SessionSummary;
@@ -259,7 +938,7 @@ export type RpcMethodMap = {
259
938
  };
260
939
  };
261
940
  'session.prompt': {
262
- params: {
941
+ params: PrincipalContext & {
263
942
  sessionId: string;
264
943
  clientMessageId: string;
265
944
  delivery?: 'auto' | 'steer';
@@ -275,17 +954,46 @@ export type RpcMethodMap = {
275
954
  };
276
955
  'session.interrupt': {
277
956
  params: {
278
- sessionId: string;
957
+ sessionId: string; /** With session.interrupt.turn, cancel only this turn. */
958
+ turnId?: string;
959
+ };
960
+ result: {
961
+ interrupted?: boolean;
279
962
  };
280
- result: Empty;
281
963
  };
964
+ /**
965
+ * Changes a session's permissions mode while idle; with capability `session.configure.live`, also a live
966
+ * root's model, effort or team (§12.9): those need requestId and ifGeneration, apply at the idle barrier
967
+ * through a restart of its native process on the same conversation, and answer `configured`. Answered
968
+ * once per (sessionId, requestId): a repeat answers the first result with `duplicate: true`.
969
+ */
282
970
  'session.configure': {
283
971
  params: {
284
972
  sessionId: string;
285
973
  mode?: string;
974
+ model?: string;
975
+ thinking?: string;
976
+ team?: string;
977
+ requestId?: string;
978
+ ifGeneration?: string;
286
979
  };
287
980
  result: {
288
- session: SessionSnapshot;
981
+ session: SessionSnapshot | SessionSummary;
982
+ configured?: ConfigureOutcome;
983
+ duplicate?: true;
984
+ };
985
+ };
986
+ /** What session.configure would run a live root with, and whether it would take it now (capability `session.configure.live`, §12.9). */
987
+ 'session.configure.preview': {
988
+ params: {
989
+ sessionId: string;
990
+ mode?: string;
991
+ model?: string;
992
+ thinking?: string;
993
+ team?: string;
994
+ };
995
+ result: {
996
+ preview: ConfigurePreview;
289
997
  };
290
998
  };
291
999
  'session.close': {
@@ -303,6 +1011,92 @@ export type RpcMethodMap = {
303
1011
  session: SessionSummary;
304
1012
  };
305
1013
  };
1014
+ /**
1015
+ * A new root whose conversation is the source's up to a completed turn (capability `session.fork`, §12.7).
1016
+ * Answered once per (sessionId, requestId): a repeat answers the first result with `duplicate: true`.
1017
+ */
1018
+ 'session.fork': {
1019
+ params: PrincipalContext & {
1020
+ sessionId: string;
1021
+ requestId: string;
1022
+ ifGeneration: string;
1023
+ boundary?: ForkBoundary;
1024
+ branchId?: string;
1025
+ workspaceId?: string;
1026
+ newSessionId?: string;
1027
+ title?: string;
1028
+ };
1029
+ result: {
1030
+ session: SessionSummary;
1031
+ forkedFrom: ForkProvenance;
1032
+ duplicate?: true;
1033
+ };
1034
+ };
1035
+ /**
1036
+ * The root's conversation from before a turn on, under the same session id; the later turns stay as a
1037
+ * recoverable branch and no file is changed (capability `session.rewind`, §12.7).
1038
+ */
1039
+ 'session.rewind': {
1040
+ params: {
1041
+ sessionId: string;
1042
+ requestId: string;
1043
+ ifGeneration: string;
1044
+ beforeTurnId: string;
1045
+ };
1046
+ result: {
1047
+ session: SessionSummary;
1048
+ generation: string;
1049
+ branch: ConversationBranch;
1050
+ duplicate?: true;
1051
+ };
1052
+ };
1053
+ /**
1054
+ * Restarts a live root's native process on its own conversation and configuration at the idle
1055
+ * barrier, keeping its session id, history and receipts (capability `session.reload`, §12.8).
1056
+ * Answered once per (sessionId, requestId): a repeat answers the first result with `duplicate: true`.
1057
+ */
1058
+ 'session.reload': {
1059
+ params: {
1060
+ sessionId: string;
1061
+ requestId: string;
1062
+ ifGeneration: string;
1063
+ };
1064
+ result: {
1065
+ session: SessionSummary;
1066
+ duplicate?: true;
1067
+ };
1068
+ };
1069
+ /**
1070
+ * The ALP CLI command that continues a session in a terminal, built by alpd (capability
1071
+ * `session.resumeCommand`, §12.8): argv and its POSIX and Windows command lines, for the clipboard only.
1072
+ */
1073
+ /**
1074
+ * Compacts a live root's context (t-0e56): main writes a checkpoint by skill compact, then its runtime
1075
+ * compacts, or ALP starts a fresh conversation seeded with it. Idle: now; otherwise at its next turn boundary.
1076
+ */
1077
+ 'session.compact': {
1078
+ params: {
1079
+ sessionId: string;
1080
+ };
1081
+ result: {
1082
+ status: 'started' | 'deferred' | 'running';
1083
+ };
1084
+ };
1085
+ /** The slash commands and skills a live session's composer offers after "/" (capability `session.commands`, t-f628). */
1086
+ 'session.commands': {
1087
+ params: {
1088
+ sessionId: string;
1089
+ };
1090
+ result: {
1091
+ commands: SessionCommand[];
1092
+ };
1093
+ };
1094
+ 'session.resumeCommand': {
1095
+ params: {
1096
+ sessionId: string;
1097
+ };
1098
+ result: ResumeCommand;
1099
+ };
306
1100
  'session.archive': {
307
1101
  params: {
308
1102
  sessionId: string;
@@ -433,7 +1227,10 @@ export type RpcMethodMap = {
433
1227
  id: string;
434
1228
  gate: string;
435
1229
  note?: string;
436
- ifRev?: number;
1230
+ ifRev?: number; /** One of a human gate's options; picking one approves it. */
1231
+ choice?: string; /** Record the user's rejection instead (note is the reason); the gate stays open. */
1232
+ reject?: boolean; /** Where the user decided, recorded on the gate. Default web. */
1233
+ channel?: 'paseo' | 'web';
437
1234
  };
438
1235
  result: {
439
1236
  id: string;
@@ -477,6 +1274,7 @@ export type RpcMethodMap = {
477
1274
  name: EntryName;
478
1275
  scope: LibraryScope;
479
1276
  projectRoot?: string;
1277
+ policy?: 'project-data';
480
1278
  content: Record<string, unknown>;
481
1279
  revision?: string | null;
482
1280
  sync?: 'none' | 'known-projects';
@@ -493,6 +1291,7 @@ export type RpcMethodMap = {
493
1291
  name: EntryName;
494
1292
  scope: LibraryScope;
495
1293
  projectRoot?: string;
1294
+ policy?: 'project-data';
496
1295
  revision?: string;
497
1296
  };
498
1297
  result: {
@@ -507,6 +1306,7 @@ export type RpcMethodMap = {
507
1306
  to: EntryName;
508
1307
  scope: LibraryScope;
509
1308
  projectRoot?: string;
1309
+ policy?: 'project-data';
510
1310
  };
511
1311
  result: {
512
1312
  revision: string | null;
@@ -519,6 +1319,7 @@ export type RpcMethodMap = {
519
1319
  to: EntryName;
520
1320
  scope: LibraryScope;
521
1321
  projectRoot?: string;
1322
+ policy?: 'project-data';
522
1323
  };
523
1324
  result: {
524
1325
  revision: string | null;
@@ -554,6 +1355,46 @@ export type RpcMethodMap = {
554
1355
  };
555
1356
  result: LanguageSetting;
556
1357
  };
1358
+ /** Capability `schedule`: a one-shot continuation of a root session, due at `dueAt` (UTC, ISO 8601). */
1359
+ 'schedule.create': {
1360
+ params: {
1361
+ projectRoot: string;
1362
+ sessionId: string;
1363
+ dueAt: string;
1364
+ prompt: string;
1365
+ keepsSession?: boolean;
1366
+ };
1367
+ result: {
1368
+ job: ScheduleJob;
1369
+ };
1370
+ };
1371
+ 'schedule.list': {
1372
+ params: {
1373
+ projectRoot: string;
1374
+ status?: ScheduleStatus;
1375
+ };
1376
+ result: {
1377
+ jobs: ScheduleJob[];
1378
+ };
1379
+ };
1380
+ 'schedule.get': {
1381
+ params: {
1382
+ id: string;
1383
+ projectRoot: string;
1384
+ };
1385
+ result: {
1386
+ job: ScheduleJob;
1387
+ };
1388
+ };
1389
+ 'schedule.cancel': {
1390
+ params: {
1391
+ id: string;
1392
+ projectRoot: string;
1393
+ };
1394
+ result: {
1395
+ job: ScheduleJob;
1396
+ };
1397
+ };
557
1398
  };
558
1399
  export type RpcMethod = keyof RpcMethodMap;
559
1400
  export type RpcParams<M extends RpcMethod> = RpcMethodMap[M]['params'];