@anhlp/alp-protocol 0.0.1-beta.6 → 0.0.1-beta.8
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/contract-v1.d.ts +66 -0
- package/dist/contract-v1.js +1 -1
- package/dist/rpc.d.ts +19 -2
- package/dist/wire.d.ts +6 -0
- package/dist/wire.js +4 -2
- package/fixtures/v1/cases.json +174 -1
- package/package.json +1 -1
- package/schema/ipc-v1.json +3 -0
- package/schema/methods-v1.json +78 -2
- package/src/contract-v1.js +1 -1
- package/src/rpc.ts +12 -2
- package/src/wire.js +7 -2
package/src/rpc.ts
CHANGED
|
@@ -38,7 +38,10 @@ export type TerminalNotification = { jsonrpc: '2.0'; method: 'terminal.event'; p
|
|
|
38
38
|
export type HistoryItem = Envelope | { cursor: number; oversized: { bytes: number } };
|
|
39
39
|
export type HistoryPage = { generation: string; items: HistoryItem[]; olderCursor?: string; hasOlder: boolean; tipCursor: number };
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/** One entry of session.commands: inserted as `/<name>` into the composer. */
|
|
42
|
+
export type SessionCommand = { name: string; description: string; argumentHint?: string; kind: 'command' | 'skill' };
|
|
43
|
+
|
|
44
|
+
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';
|
|
42
45
|
|
|
43
46
|
/** `data.reason` values alpd sets on errors (docs/protocol/alp-json-rpc-v1.md §5.3). */
|
|
44
47
|
export type ErrorReason =
|
|
@@ -55,6 +58,8 @@ export type ErrorReason =
|
|
|
55
58
|
| 'outside' | 'changed'
|
|
56
59
|
// workspace.git.status and workspace.git.diff (§12.5).
|
|
57
60
|
| 'not_repository' | 'unknown_ref' | 'invalid_compare' | 'stale_snapshot' | 'git_unavailable' | 'git_failed'
|
|
61
|
+
// session.prompt: a Claude command ALP does not follow (t-e906).
|
|
62
|
+
| 'native_command_unsupported'
|
|
58
63
|
// Attachments (§12.6).
|
|
59
64
|
| 'invalid_name' | 'invalid_data' | 'attachment_too_large' | 'offset_mismatch' | 'chunk_conflict' | 'upload_incomplete'
|
|
60
65
|
| 'hash_mismatch' | 'upload_expired' | 'quota_exceeded' | 'attachment_referenced' | 'attachment_limit'
|
|
@@ -261,6 +266,11 @@ export type RpcMethodMap = {
|
|
|
261
266
|
params: { sessionId: string };
|
|
262
267
|
result: { status: 'started' | 'deferred' | 'running' };
|
|
263
268
|
};
|
|
269
|
+
/** The slash commands and skills a live session's composer offers after "/" (capability `session.commands`, t-f628). */
|
|
270
|
+
'session.commands': {
|
|
271
|
+
params: { sessionId: string };
|
|
272
|
+
result: { commands: SessionCommand[] };
|
|
273
|
+
};
|
|
264
274
|
'session.resumeCommand': {
|
|
265
275
|
params: { sessionId: string };
|
|
266
276
|
result: ResumeCommand;
|
|
@@ -297,7 +307,7 @@ export type RpcMethodMap = {
|
|
|
297
307
|
'settings.language.get': { params: Empty; result: LanguageSetting };
|
|
298
308
|
'settings.language.set': { params: { language: string | null }; result: LanguageSetting };
|
|
299
309
|
/** Capability `schedule`: a one-shot continuation of a root session, due at `dueAt` (UTC, ISO 8601). */
|
|
300
|
-
'schedule.create': { params: { projectRoot: string; sessionId: string; dueAt: string; prompt: string }; result: { job: ScheduleJob } };
|
|
310
|
+
'schedule.create': { params: { projectRoot: string; sessionId: string; dueAt: string; prompt: string; keepsSession?: boolean }; result: { job: ScheduleJob } };
|
|
301
311
|
'schedule.list': { params: { projectRoot: string; status?: ScheduleStatus }; result: { jobs: ScheduleJob[] } };
|
|
302
312
|
'schedule.get': { params: { id: string; projectRoot: string }; result: { job: ScheduleJob } };
|
|
303
313
|
'schedule.cancel': { params: { id: string; projectRoot: string }; result: { job: ScheduleJob } };
|
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', 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' });
|
|
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', sessionCommands: 'session.commands', 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,7 +27,7 @@ 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", "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"]);
|
|
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.commands", "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`,
|
|
@@ -98,6 +98,11 @@ export const TERMINAL = Object.freeze({
|
|
|
98
98
|
});
|
|
99
99
|
/** The TERMINAL limits a daemon.hello `terminalLimits` carries (the size bounds are fixed). */
|
|
100
100
|
export const TERMINAL_LIMIT_KEYS = Object.freeze(['maxPerPrincipal', 'maxPerDaemon', 'maxInputBytes', 'maxOutputFrameBytes', 'replayBytes', 'idleMs', 'maxLifetimeMs', 'reconnectMs']);
|
|
101
|
+
/**
|
|
102
|
+
* An agent's name: lower-case letters, digits and single hyphens, starting with a letter, 1 to 64
|
|
103
|
+
* characters. One pattern for `principal.agent` in daemon.hello and a gateway credential's agent.
|
|
104
|
+
*/
|
|
105
|
+
export const AGENT_NAME = /^[a-z](?:[a-z0-9]|-(?=[a-z0-9])){0,63}$/;
|
|
101
106
|
/** An opaque terminal id (§12.10). @param {unknown} id */
|
|
102
107
|
export const isTerminalId = id => typeof id === 'string' && /^term_[0-9a-f]{32}$/.test(id);
|
|
103
108
|
/** Room an attachment.chunk request needs besides its base64 data. */
|