@anhlp/alp-protocol 0.0.1-beta.4 → 0.0.1-beta.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/src/dto.ts CHANGED
@@ -54,7 +54,7 @@ export type TaskRow = {
54
54
  ready: boolean;
55
55
  blockedBy?: string[];
56
56
  waits?: string[];
57
- approvals?: Array<{ gate: string; note: string }>;
57
+ approvals?: Array<{ gate: string; note: string; /** Answers to pick from; any approves. */ options?: string[]; /** The user's latest rejection; the gate stays open. */ rejected?: { at: string; reason?: string } }>;
58
58
  handoff?: { outcome: string; summary: string; agent?: string };
59
59
  closed?: { reason: string; summary?: string; at: string };
60
60
  description?: string;
package/src/events.ts CHANGED
@@ -143,6 +143,8 @@ export type UserQuestion = {
143
143
  body: string;
144
144
  options?: string[];
145
145
  askedAt: string;
146
+ /** A card that mirrors an open human gate of the project's tasks: choosing an option approves it, dismissing rejects it. It has no timeout. */
147
+ gate?: { projectRoot: string; taskId: string; gateId: string };
146
148
  };
147
149
 
148
150
  export type SessionState = 'running' | 'waiting' | 'waiting_parent' | 'waiting_user' | 'idle';
package/src/rpc.ts CHANGED
@@ -17,6 +17,8 @@ export type TerminalInfo = {
17
17
  terminalId: string; workspaceId: string; title: string; cols: number; rows: number; state: 'running' | 'exited';
18
18
  attached: boolean; createdAt: string; lastActivityAt: string; expiresAt: string;
19
19
  exitCode?: number | null; signal?: number | null; endReason?: TerminalEndReason;
20
+ /** Absent: full native protection. root-only: best-effort Linux. none: Windows ConPTY, best-effort cleanup. */
21
+ protection?: 'root-only' | 'none';
20
22
  };
21
23
  /** Effective terminal limits a daemon.hello advertises with capability `terminal`. */
22
24
  export type TerminalLimits = {
@@ -28,13 +30,15 @@ export type TerminalEvent =
28
30
  | { terminalId: string; type: 'output'; seq: number; data: string }
29
31
  | { terminalId: string; type: 'exit'; seq: number; exitCode: number | null; signal: number | null; reason: TerminalEndReason }
30
32
  | { terminalId: string; type: 'detached'; reason: 'replaced' | 'slow_consumer' };
33
+ export type CatalogUpdatedNotification = { jsonrpc: '2.0'; method: 'catalog.updated'; params: { fetchedAt?: string } };
34
+ export type TerminalChangedNotification = { jsonrpc: '2.0'; method: 'terminal.changed'; params: { watchId: string; cursor: string } };
31
35
  export type TerminalNotification = { jsonrpc: '2.0'; method: 'terminal.event'; params: TerminalEvent };
32
36
 
33
37
  /** Names a daemon may list in its daemon.hello result (schema/methods-v1.json `capabilities`). */
34
38
  export type HistoryItem = Envelope | { cursor: number; oversized: { bytes: number } };
35
39
  export type HistoryPage = { generation: string; items: HistoryItem[]; olderCursor?: string; hasOlder: boolean; tipCursor: number };
36
40
 
37
- 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';
41
+ export type Capability = 'session.interrupt.turn' | 'session.fork' | 'session.rewind' | 'session.reload' | 'session.resumeCommand' | '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';
38
42
 
39
43
  /** `data.reason` values alpd sets on errors (docs/protocol/alp-json-rpc-v1.md §5.3). */
40
44
  export type ErrorReason =
@@ -47,6 +51,8 @@ export type ErrorReason =
47
51
  | 'library_policy' | 'unsafe_path' | 'revision_conflict' | 'task_state' | 'in_use' | 'busy' | 'unreadable'
48
52
  // workspace.files.search (§12.3); workspace.files.list and read (§12.4).
49
53
  | 'not_directory' | 'blocked_path' | 'ignored' | 'linked' | 'binary' | 'too_large'
54
+ // workspace.files.find, workspace.files.preview and internal links (§12.11).
55
+ | 'outside' | 'changed'
50
56
  // workspace.git.status and workspace.git.diff (§12.5).
51
57
  | 'not_repository' | 'unknown_ref' | 'invalid_compare' | 'stale_snapshot' | 'git_unavailable' | 'git_failed'
52
58
  // Attachments (§12.6).
@@ -61,6 +67,7 @@ export type ErrorReason =
61
67
  // session.configure with model, thinking or team (§12.9).
62
68
  | 'runtime_mismatch' | 'agent_mismatch' | 'permission_escalation' | 'team_not_found'
63
69
  // Terminal (§12.10).
70
+ | 'terminal_capture_unavailable' | 'terminal_capture_too_large' | 'terminal_snapshot_too_large'
64
71
  | 'terminal_disabled' | 'terminal_unsupported' | 'terminal_limit' | 'not_attached' | 'terminal_exited' | 'input_too_large';
65
72
 
66
73
  type Empty = Record<string, never>;
@@ -88,6 +95,16 @@ export type GitDiffLine = { type: 'add' | 'remove' | 'context'; content: string;
88
95
  export type GitDiffHunk = { oldStart: number; oldCount: number; newStart: number; newCount: number; context?: string; lines: GitDiffLine[] };
89
96
  export type GitDiffFile = { path: string; oldPath?: string; change: GitChange; kind: 'text' | 'binary' | 'too_large' | 'withheld' | 'symlink' | 'submodule'; additions: number; deletions: number; hunks: GitDiffHunk[] };
90
97
  export type GitDiffPage = { compare: { mode: GitCompare['mode']; baseRef?: string; ignoreWhitespace: boolean }; snapshot: string; files: GitDiffFile[]; hiddenCount: number; truncated: boolean; nextCursor?: string };
98
+ /**
99
+ * workspace.git.facts (capability `workspace.git.facts`, §12.5): an owner-only answer for a host
100
+ * directory, so `repoRoot` is a host path (the directory's real path, or the enclosing repository's
101
+ * top level for `not_repository_root`). Never forwarded by a gateway.
102
+ */
103
+ export type GitCheckoutFacts = { repoRoot: string; branch: string | null; detached: boolean; head: string | null; hasRemote: boolean; remoteUrl: string | null; dirty: boolean };
104
+ export type GitFacts =
105
+ | ({ kind: 'ok' | 'not_repository_root' } & GitCheckoutFacts)
106
+ | { kind: 'unknown' }
107
+ | { kind: 'unsupported'; reason: 'worktree_elsewhere' | 'inside_git_dir' };
91
108
  /**
92
109
  * Capability `attachments` (§12.6). Principal context is set only by a trusted gateway on its own
93
110
  * connection; a local client leaves it out and acts as the owner.
@@ -108,9 +125,12 @@ export type ForkBoundary = { throughTurnId: string } | { beforeTurnId: string };
108
125
  export type RegistryMutation = { requestId: string; ifRevision: number };
109
126
  export type RegistryPage = { revision: number; total: number; nextCursor: string | null };
110
127
  export type RpcMethodMap = {
111
- 'terminal.create': { params: PrincipalContext & { workspaceId: string; cols: number; rows: number; requestId: string }; result: { terminal: TerminalInfo } };
128
+ 'terminal.create': { params: PrincipalContext & { workspaceId: string; cols: number; rows: number; requestId: string; protectionAcknowledgment?: 'linux-root-only-v1' /* deprecated, ignored */ }; result: { terminal: TerminalInfo } };
112
129
  'terminal.list': { params: PrincipalContext & { workspaceId?: string }; result: { terminals: TerminalInfo[] } };
113
- 'terminal.attach': { params: PrincipalContext & { terminalId: string; after?: number }; result: { terminal: TerminalInfo; nextSeq: number; gap?: { fromSeq: number; toSeq: number } } };
130
+ 'terminal.watch': { params: PrincipalContext & { workspaceId?: string; after?: string }; result: { terminals: TerminalInfo[]; watchId: string; cursor: string; reset: boolean } };
131
+ 'terminal.unwatch': { params: Empty; result: { closed: true } };
132
+ 'terminal.capture': { params: PrincipalContext & { terminalId: string; start?: number; end?: number; stripAnsi?: boolean }; result: { lines: string[]; totalLines: number } };
133
+ 'terminal.attach': { params: PrincipalContext & { terminalId: string; after?: number; protectionAcknowledgment?: 'linux-root-only-v1' /* deprecated, ignored */ }; result: { terminal: TerminalInfo; nextSeq: number; gap?: { fromSeq: number; toSeq: number } } };
114
134
  'terminal.input': { params: PrincipalContext & { terminalId: string; data: string }; result: { bytes: number } };
115
135
  'terminal.resize': { params: PrincipalContext & { terminalId: string; cols: number; rows: number }; result: { cols: number; rows: number } };
116
136
  'terminal.close': { params: PrincipalContext & { terminalId: string }; result: { closed: true } };
@@ -123,6 +143,7 @@ export type RpcMethodMap = {
123
143
  'attachment.delete': { params: PrincipalContext & { attachmentId: string }; result: { deleted: true } };
124
144
  'workspace.git.status': { params: { workspaceId: string }; result: GitStatus };
125
145
  'workspace.git.diff': { params: { workspaceId: string; compare: GitCompare; path?: string; cursor?: string }; result: GitDiffPage };
146
+ 'workspace.git.facts': { params: { directory: string }; result: GitFacts };
126
147
  'workspace.worktree.options': { params: { workspaceId: string }; result: { mappingIds: string[] } };
127
148
  'workspace.worktree.create': { params: RegistryMutation & { workspaceId: string; mappingId: string }; result: { workspace: RegistryWorkspace; revision: number } };
128
149
  'workspace.worktree.remove': { params: RegistryMutation & { workspaceId: string }; result: { workspace: RegistryWorkspace; revision: number; filesRemoved: true; branchRetained: true } };
@@ -150,7 +171,8 @@ export type RpcMethodMap = {
150
171
  'daemon.resume': { params: { runtime?: RuntimeKind }; result: PauseState };
151
172
  'daemon.pauses': { params: Empty; result: PauseState };
152
173
  'daemon.usage': { params: { refresh?: boolean }; result: { providers: Array<Record<string, unknown>> } };
153
- 'catalog.get': { params: Empty; result: { models: Array<Record<string, unknown>>; modes: Array<Record<string, unknown>>; thinkingOptions?: unknown; defaultModel: string } };
174
+ 'catalog.get': { params: Empty; result: { models: Array<Record<string, unknown>>; modes: Array<Record<string, unknown>>; thinkingOptions?: unknown; defaultModel: string; fetchedAt?: string; providers?: Record<string, { status: string; fetchedAt?: string; error?: string }> } };
175
+ 'catalog.refresh': { params: Empty; result: { models: Array<Record<string, unknown>>; modes: Array<Record<string, unknown>>; thinkingOptions?: unknown; defaultModel: string; fetchedAt?: string; providers?: Record<string, { status: string; fetchedAt?: string; error?: string }> } };
154
176
  'assignment.recall': { params: { assignmentId?: string; taskId?: string; projectRoot?: string; question: string }; result: RecallAnswer };
155
177
  'board.list': { params: { projectRoot: string }; result: { pins: Pin[] } };
156
178
  'question.list': { params: { projectRoot?: string }; result: { questions: UserQuestion[] } };
@@ -160,10 +182,16 @@ export type RpcMethodMap = {
160
182
  'session.attention.clear': { params: { sessionId: string; at?: string }; result: { cleared: boolean } };
161
183
  /** Capability `workspace.files`: files under `projectRoot` whose relative path matches `query`, best first; read-only, links not followed. */
162
184
  'workspace.files.search': { params: { projectRoot: string; query?: string; limit?: number }; result: { files: Array<{ path: string }>; truncated?: boolean } };
163
- /** 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. */
164
- 'workspace.files.list': { params: { projectRoot: string; path?: string; includeIgnored?: boolean }; result: { entries: Array<{ name: string; path: string; kind: 'file' | 'directory'; size?: number; modifiedAt?: string }>; truncated?: boolean } };
185
+ /** 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`). */
186
+ 'workspace.files.list': { params: { projectRoot: string; path?: string; includeIgnored?: boolean; cursor?: string; internalLinks?: boolean }; result: { entries: Array<{ name: string; path: string; kind: 'file' | 'directory'; size?: number; modifiedAt?: string; target?: string }>; truncated?: boolean; nextCursor?: string; target?: string } };
165
187
  /** Capability `workspace.files.read`: a UTF-8 text file under `projectRoot`, at most 1 MiB; read-only, links not followed. */
166
188
  'workspace.files.read': { params: { projectRoot: string; path: string; includeIgnored?: boolean }; result: { path: string; content: string; size: number; modifiedAt?: string } };
189
+ /** 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. */
190
+ 'workspace.files.find': { params: { projectRoot: string; query?: string; kinds?: Array<'file' | 'directory'>; matchMode?: 'subsequence' | 'suffix'; limit?: number; cursor?: string }; result: { entries: Array<{ path: string; kind: 'file' | 'directory' }>; nextCursor?: string; truncated?: boolean } };
191
+ /** 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`. */
192
+ 'workspace.files.preview': { params: { projectRoot: string; path: string; includeIgnored?: boolean; internalLinks?: boolean; maxBytes?: number; offset?: number; revision?: string }; result: { path: string; target?: string; kind: 'text' | 'image' | 'binary'; mimeType: string; size: number; modifiedAt: string; revision: string; encoding: 'base64' | 'none'; content?: string; offset?: number; nextOffset?: number } };
193
+ /** Capability `host.directories`: directories of the daemon host whose path completes `query` (absolute or under ~), or whose name matches it under the home directory. */
194
+ 'host.directories.search': { params: { query: string; limit?: number }; result: { entries: Array<{ path: string }>; truncated?: boolean } };
167
195
  'question.answer': { params: { questionId: string; text?: string; dismiss?: boolean; reason?: string }; result: { questionId: string } };
168
196
  'session.create': {
169
197
  params: { sessionId?: string; history?: 'skip' | 'replay'; delegation?: boolean; resume?: boolean } & ({ workspaceId: string; spec: Omit<SessionSpec, 'cwd'> & { cwd?: string } } | { workspaceId?: undefined; spec: SessionSpec });
@@ -225,6 +253,14 @@ export type RpcMethodMap = {
225
253
  * The ALP CLI command that continues a session in a terminal, built by alpd (capability
226
254
  * `session.resumeCommand`, §12.8): argv and its POSIX and Windows command lines, for the clipboard only.
227
255
  */
256
+ /**
257
+ * Compacts a live root's context (t-0e56): main writes a checkpoint by skill compact, then its runtime
258
+ * compacts, or ALP starts a fresh conversation seeded with it. Idle: now; otherwise at its next turn boundary.
259
+ */
260
+ 'session.compact': {
261
+ params: { sessionId: string };
262
+ result: { status: 'started' | 'deferred' | 'running' };
263
+ };
228
264
  'session.resumeCommand': {
229
265
  params: { sessionId: string };
230
266
  result: ResumeCommand;
@@ -242,7 +278,7 @@ export type RpcMethodMap = {
242
278
  'task.list': { params: { projectRoot: string }; result: { projectRoot: string; tasks: TaskRow[]; unreadable: Array<{ file: string; error: string }>; revision: string } };
243
279
  'task.create': { params: { projectRoot: string; title: string; priority?: number; requestId?: string }; result: { id: string; duplicate?: true } };
244
280
  'task.update': { params: { projectRoot: string; id: string; action: 'close' | 'reopen'; note?: string; ifRev?: number }; result: { id: string; status: string; rev: number; landed?: string } };
245
- 'task.gate.resolve': { params: { projectRoot: string; id: string; gate: string; note?: string; ifRev?: number }; result: { id: string; status: string; rev: number } };
281
+ 'task.gate.resolve': { params: { projectRoot: string; id: string; gate: string; note?: string; ifRev?: number; /** One of a human gate's options; picking one approves it. */ choice?: string; /** Record the user's rejection instead (note is the reason); the gate stays open. */ reject?: boolean; /** Where the user decided, recorded on the gate. Default web. */ channel?: 'paseo' | 'web' }; result: { id: string; status: string; rev: number } };
246
282
  'library.list': { params: { kind: LibraryKind; projectRoot?: string }; result: { projectRoot: string | null; entries: LibraryEntryRow[] } };
247
283
  'library.get': {
248
284
  params: { kind: LibraryKind; name: EntryName; projectRoot?: string; scope?: LibraryScope };
package/src/schedule.ts CHANGED
@@ -40,4 +40,9 @@ export type ScheduleJob = {
40
40
  lateByMs?: number;
41
41
  /** The last error of the job: why it failed, or why it still waits. */
42
42
  lastError?: ScheduleError;
43
+ /**
44
+ * false: the job does not keep its session open while it waits, so an idle session may
45
+ * still be closed and the job then fails as session_closed. Absent: it keeps it open.
46
+ */
47
+ keepsSession?: false;
43
48
  };
package/src/session.ts CHANGED
@@ -80,7 +80,7 @@ export type SessionPreview = {
80
80
  /** What became of one assignment an earlier alpd left running. */
81
81
  export type RecoveryOutcome = { assignmentId: string; agent: string; outcome: 'resumed' | 'parked' | 'failed'; error?: string };
82
82
 
83
- export type Pause = { since: string; by: string; reason: string; resetsAt?: string; /** When alpd last asked the runtime about the limit (ALPD §58). */ checkedAt?: string };
83
+ export type Pause = { since: string; by: string; reason: string; resetsAt?: string; /** Why alpd paused by itself other than a usage limit: its disk takes no writes (t-2831). */ cause?: 'disk'; /** When alpd last asked the runtime about the limit (ALPD §58). */ checkedAt?: string };
84
84
  export type PauseState = {
85
85
  all?: Pause;
86
86
  runtimes: Partial<Record<RuntimeKind, Pause>>;
package/src/wire.js CHANGED
@@ -17,7 +17,7 @@ export const RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32
17
17
  * Features a daemon lists in its daemon.hello result. A client uses a feature only when listed;
18
18
  * a daemon that lists none (one older than this list) has none of them. Unknown names are ignored.
19
19
  */
20
- export const CAPABILITY = Object.freeze({ sessionInterruptTurn: 'session.interrupt.turn', attachAfter: 'attach.after', sessionHistory: 'session.history', workspaceRegistry: 'workspace.registry', workspaceWorktree: 'workspace.worktree', workspaceGit: 'workspace.git', promptReceipts: 'prompt.receipts', extensionMethods: 'extension.methods', team: 'team', task: 'task', library: 'library', libraryProjectWrite: 'library.project.write', settingsLanguage: 'settings.language', sessionListPage: 'session.list.page', questionWatch: 'question.watch', questionWatchTurns: 'question.watch.turns', sessionAttention: 'session.attention', workspaceFiles: 'workspace.files', workspaceFilesRead: 'workspace.files.read', promptImages: 'prompt.images', schedule: 'schedule', attachments: 'attachments', sessionFork: 'session.fork', sessionRewind: 'session.rewind' , sessionReload: 'session.reload', sessionResumeCommand: 'session.resumeCommand', sessionConfigureLive: 'session.configure.live', terminal: 'terminal' });
20
+ export const CAPABILITY = Object.freeze({ sessionInterruptTurn: 'session.interrupt.turn', catalogLive: 'catalog.live', attachAfter: 'attach.after', sessionHistory: 'session.history', workspaceRegistry: 'workspace.registry', workspaceWorktree: 'workspace.worktree', workspaceGit: 'workspace.git', workspaceGitFacts: 'workspace.git.facts', promptReceipts: 'prompt.receipts', extensionMethods: 'extension.methods', team: 'team', task: 'task', library: 'library', libraryProjectWrite: 'library.project.write', settingsLanguage: 'settings.language', sessionListPage: 'session.list.page', questionWatch: 'question.watch', questionWatchTurns: 'question.watch.turns', sessionAttention: 'session.attention', workspaceFiles: 'workspace.files', workspaceFilesRead: 'workspace.files.read', workspaceFilesBrowse: 'workspace.files.browse', hostDirectories: 'host.directories', promptImages: 'prompt.images', schedule: 'schedule', attachments: 'attachments', sessionFork: 'session.fork', sessionRewind: 'session.rewind' , sessionReload: 'session.reload', sessionResumeCommand: 'session.resumeCommand', sessionConfigureLive: 'session.configure.live', terminal: 'terminal', terminalCapture: 'terminal.capture', terminalWatch: 'terminal.watch' });
21
21
  /**
22
22
  * What alpd takes as images in one session.prompt (capability `prompt.images`): inline base64 of
23
23
  * these types only, never a path or URL; at most `maxCount` of them, each at most `maxBytes`
@@ -27,14 +27,17 @@ export const CAPABILITY = Object.freeze({ sessionInterruptTurn: 'session.interru
27
27
  export const PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(['image/png', 'image/jpeg', 'image/gif', 'image/webp']), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
28
28
  /** Decoded bytes of base64 `data` (padding aware), without decoding it. @param {string} data */
29
29
  export const base64Bytes = data => Math.floor(data.length * 3 / 4) - (data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0);
30
- export const RPC_METHODS = Object.freeze(["assignment.recall", "attachment.abort", "attachment.begin", "attachment.chunk", "attachment.commit", "attachment.delete", "attachment.get", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "project.list", "project.register", "project.remove", "question.answer", "question.list", "question.watch", "registry.owner", "registry.worktree", "schedule.cancel", "schedule.create", "schedule.get", "schedule.list", "session.archive", "session.attach", "session.attention.clear", "session.close", "session.configure", "session.configure.preview", "session.create", "session.fork", "session.get", "session.history", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.reload", "session.rename", "session.resumeCommand", "session.rewind", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "terminal.attach", "terminal.close", "terminal.create", "terminal.input", "terminal.list", "terminal.resize", "terminal.revoke", "workspace.files.list", "workspace.files.read", "workspace.files.search", "workspace.get", "workspace.git.diff", "workspace.git.status", "workspace.list", "workspace.update", "workspace.worktree.create", "workspace.worktree.options", "workspace.worktree.remove"]);
30
+ export const RPC_METHODS = Object.freeze(["assignment.recall", "attachment.abort", "attachment.begin", "attachment.chunk", "attachment.commit", "attachment.delete", "attachment.get", "board.list", "catalog.get", "catalog.refresh", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "host.directories.search", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "project.list", "project.register", "project.remove", "question.answer", "question.list", "question.watch", "registry.owner", "registry.worktree", "schedule.cancel", "schedule.create", "schedule.get", "schedule.list", "session.archive", "session.attach", "session.attention.clear", "session.close", "session.compact", "session.configure", "session.configure.preview", "session.create", "session.fork", "session.get", "session.history", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.reload", "session.rename", "session.resumeCommand", "session.rewind", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "terminal.attach", "terminal.close", "terminal.capture", "terminal.create", "terminal.input", "terminal.list", "terminal.watch", "terminal.unwatch", "terminal.resize", "terminal.revoke", "workspace.files.find", "workspace.files.list", "workspace.files.preview", "workspace.files.read", "workspace.files.search", "workspace.get", "workspace.git.diff", "workspace.git.facts", "workspace.git.status", "workspace.list", "workspace.update", "workspace.worktree.create", "workspace.worktree.options", "workspace.worktree.remove"]);
31
31
 
32
32
  /**
33
33
  * Limits of workspace.files.list and workspace.files.read (capability `workspace.files.read`,
34
34
  * docs/protocol/alp-json-rpc-v1.md §12.4): a file of at most `maxReadBytes`, a listing of at most
35
- * `maxListEntries` entries, a relative path of at most `maxPathLength` characters.
35
+ * `maxListEntries` entries, a relative path of at most `maxPathLength` characters. With
36
+ * `workspace.files.browse` (§12.11): a preview of a file of at most `maxPreviewBytes`, sent in chunks
37
+ * of at most `maxPreviewChunkBytes` decoded (their base64 fits one MAX_FRAME), and pages of at most
38
+ * `maxFindEntries` names from workspace.files.find.
36
39
  */
37
- export const WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1000, maxPathLength: 4096 });
40
+ export const WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1000, maxPathLength: 4096, maxPreviewBytes: 50 * 1024 * 1024, maxPreviewChunkBytes: 8 * 1024 * 1024, maxFindEntries: 1000 });
38
41
 
39
42
  /**
40
43
  * Limits of workspace.git.status and workspace.git.diff (capability `workspace.git`,