@anhlp/alp-protocol 0.0.1-beta.5 → 0.0.1-beta.7

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
@@ -114,7 +114,14 @@ export type HistoryPage = {
114
114
  hasOlder: boolean;
115
115
  tipCursor: number;
116
116
  };
117
- 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';
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';
118
125
  /** `data.reason` values alpd sets on errors (docs/protocol/alp-json-rpc-v1.md §5.3). */
119
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' | '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';
120
127
  type Empty = Record<string, never>;
@@ -1075,6 +1082,15 @@ export type RpcMethodMap = {
1075
1082
  status: 'started' | 'deferred' | 'running';
1076
1083
  };
1077
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
+ };
1078
1094
  'session.resumeCommand': {
1079
1095
  params: {
1080
1096
  sessionId: string;
package/dist/wire.d.ts CHANGED
@@ -100,6 +100,7 @@ export const CAPABILITY: Readonly<{
100
100
  sessionRewind: "session.rewind";
101
101
  sessionReload: "session.reload";
102
102
  sessionResumeCommand: "session.resumeCommand";
103
+ sessionCommands: "session.commands";
103
104
  sessionConfigureLive: "session.configure.live";
104
105
  terminal: "terminal";
105
106
  terminalCapture: "terminal.capture";
package/dist/wire.js CHANGED
@@ -10,10 +10,10 @@ var AlpRpcError = class extends Error {
10
10
  };
11
11
  var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
12
12
  var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
13
- var 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" });
13
+ var 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" });
14
14
  var 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 });
15
15
  var base64Bytes = (data) => Math.floor(data.length * 3 / 4) - (data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0);
16
- var 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"]);
16
+ var 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"]);
17
17
  var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096, maxPreviewBytes: 50 * 1024 * 1024, maxPreviewChunkBytes: 8 * 1024 * 1024, maxFindEntries: 1e3 });
18
18
  var WORKSPACE_GIT = Object.freeze({ maxFileBytes: 1024 * 1024, maxTotalBytes: 2 * 1024 * 1024, maxUntracked: 200, maxStatusFiles: 1e3, maxRefLength: 255 });
19
19
  var ATTACHMENTS = Object.freeze({
@@ -6572,6 +6572,92 @@
6572
6572
  "duplicate": true
6573
6573
  }
6574
6574
  },
6575
+ {
6576
+ "name": "session.commands params",
6577
+ "check": "params",
6578
+ "method": "session.commands",
6579
+ "valid": true,
6580
+ "value": {
6581
+ "sessionId": "ses_1"
6582
+ }
6583
+ },
6584
+ {
6585
+ "name": "session.commands params with an extra field",
6586
+ "check": "params",
6587
+ "method": "session.commands",
6588
+ "valid": false,
6589
+ "value": {
6590
+ "sessionId": "ses_1",
6591
+ "agent": "main"
6592
+ }
6593
+ },
6594
+ {
6595
+ "name": "session.commands result",
6596
+ "check": "result",
6597
+ "method": "session.commands",
6598
+ "valid": true,
6599
+ "value": {
6600
+ "commands": [
6601
+ {
6602
+ "name": "compact",
6603
+ "description": "Clear history but keep a summary",
6604
+ "argumentHint": "<instructions>",
6605
+ "kind": "command"
6606
+ },
6607
+ {
6608
+ "name": "alp:bug-loop",
6609
+ "description": "Diagnose a bug",
6610
+ "kind": "skill"
6611
+ }
6612
+ ]
6613
+ }
6614
+ },
6615
+ {
6616
+ "name": "session.commands result with a path",
6617
+ "check": "result",
6618
+ "method": "session.commands",
6619
+ "valid": false,
6620
+ "value": {
6621
+ "commands": [
6622
+ {
6623
+ "name": "xia",
6624
+ "description": "",
6625
+ "kind": "skill",
6626
+ "path": "/home/u/.alp/skills/xia/SKILL.md"
6627
+ }
6628
+ ]
6629
+ }
6630
+ },
6631
+ {
6632
+ "name": "session.commands result with a space in a name",
6633
+ "check": "result",
6634
+ "method": "session.commands",
6635
+ "valid": false,
6636
+ "value": {
6637
+ "commands": [
6638
+ {
6639
+ "name": "rm -rf",
6640
+ "description": "",
6641
+ "kind": "command"
6642
+ }
6643
+ ]
6644
+ }
6645
+ },
6646
+ {
6647
+ "name": "session.commands result of an unknown kind",
6648
+ "check": "result",
6649
+ "method": "session.commands",
6650
+ "valid": false,
6651
+ "value": {
6652
+ "commands": [
6653
+ {
6654
+ "name": "x",
6655
+ "description": "",
6656
+ "kind": "agent"
6657
+ }
6658
+ ]
6659
+ }
6660
+ },
6575
6661
  {
6576
6662
  "name": "session.resumeCommand params",
6577
6663
  "check": "params",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anhlp/alp-protocol",
3
- "version": "0.0.1-beta.5",
3
+ "version": "0.0.1-beta.7",
4
4
  "type": "module",
5
5
  "description": "ALP protocol module",
6
6
  "files": [
@@ -43,6 +43,7 @@
43
43
  "session.rewind": "session.rewind: a root's conversation from before a turn on, under the same session id; the later turns stay a recoverable branch, files are never changed, history generation advances (`history.reset` event). Same condition as session.fork.",
44
44
  "session.reload": "session.reload: restarts a live root's native process on its own conversation and configuration at the idle barrier (no turn, child, question, mail or parked work), keeping its session id, history and receipts; through the lifecycle journal. Listed with a store and a runtime that restarts a root on its own conversation, on macOS and Linux (not Windows).",
45
45
  "session.resumeCommand": "session.resumeCommand: the ALP CLI command (`alp attach <sessionId>`) that follows a session in a terminal, as argv and POSIX and Windows (cmd.exe) command lines built by alpd; for the clipboard only, never run, never a native runtime's command, credential, env or path.",
46
+ "session.commands": "session.commands: the slash commands and skills a live session's composer offers after \"/\" (its runtime's, then its agent's ALP skills): names, descriptions and argument hints only, never a path.",
46
47
  "session.configure.live": "session.configure takes model, thinking and team (with requestId and ifGeneration) besides mode, and session.configure.preview answers the configuration a change would run with: a live root's model, effort or team changes at the idle barrier (no turn, child, question, mail or parked work) through a controlled restart of its native process on the same conversation; the effective configuration is written only after the runtime took it, through the lifecycle journal (§12.9). Never another runtime and never more permissions. Listed with a store and a runtime that restarts a root with a new configuration, on macOS and Linux (not Windows).",
47
48
  "terminal": "terminal.create/list/attach/input/resize/close/revoke and terminal.event notifications: a real PTY shell on the daemon host as the daemon's account (a cwd is not a sandbox), served only when the host owner opted in (<ALP_HOME>/terminal.json allowRemoteTerminal) on macOS (full protection), Linux and Windows (best-effort).",
48
49
  "session.interrupt.turn": "session.interrupt accepts turnId and atomically cancels only that active turn, including its subtree. Conditional requests answer interrupted:true when canceled, false when the named turn is no longer active; false changes nothing. Without this capability clients must not send turnId or infer targeted cancellation from a legacy interrupt.",
@@ -1785,6 +1786,75 @@
1785
1786
  "additionalProperties": false
1786
1787
  }
1787
1788
  },
1789
+ "session.commands": {
1790
+ "x-alp": {
1791
+ "effect": "query",
1792
+ "scope": {
1793
+ "kind": "session",
1794
+ "param": "sessionId"
1795
+ },
1796
+ "capability": "session.commands",
1797
+ "idempotent": true
1798
+ },
1799
+ "params": {
1800
+ "type": "object",
1801
+ "properties": {
1802
+ "sessionId": {
1803
+ "type": "string",
1804
+ "minLength": 1,
1805
+ "maxLength": 128
1806
+ }
1807
+ },
1808
+ "required": [
1809
+ "sessionId"
1810
+ ],
1811
+ "additionalProperties": false
1812
+ },
1813
+ "result": {
1814
+ "type": "object",
1815
+ "properties": {
1816
+ "commands": {
1817
+ "type": "array",
1818
+ "maxItems": 1000,
1819
+ "items": {
1820
+ "type": "object",
1821
+ "properties": {
1822
+ "name": {
1823
+ "type": "string",
1824
+ "minLength": 1,
1825
+ "maxLength": 256,
1826
+ "pattern": "^[^\\s\\u0000-\\u001f\\u007f]+$"
1827
+ },
1828
+ "description": {
1829
+ "type": "string",
1830
+ "maxLength": 4096
1831
+ },
1832
+ "argumentHint": {
1833
+ "type": "string",
1834
+ "maxLength": 256
1835
+ },
1836
+ "kind": {
1837
+ "enum": [
1838
+ "command",
1839
+ "skill"
1840
+ ]
1841
+ }
1842
+ },
1843
+ "required": [
1844
+ "name",
1845
+ "description",
1846
+ "kind"
1847
+ ],
1848
+ "additionalProperties": false
1849
+ }
1850
+ }
1851
+ },
1852
+ "required": [
1853
+ "commands"
1854
+ ],
1855
+ "additionalProperties": false
1856
+ }
1857
+ },
1788
1858
  "session.configure": {
1789
1859
  "x-alp": {
1790
1860
  "effect": "mutation",