@alwith/module-computer 0.6.3 → 0.6.5

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.
Files changed (51) hide show
  1. package/README.md +16 -0
  2. package/artifacts/cmux-cua-e0f7388-alwith.5-aarch64-apple-darwin.tar.gz +0 -0
  3. package/dist/artifacts.js +1 -1
  4. package/dist/generated/commands.d.ts +12 -0
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +5 -1
  7. package/native/darwin-arm64/THIRD_PARTY_NOTICES.md +4 -4
  8. package/native/darwin-arm64/artifact.json +1 -1
  9. package/native/darwin-arm64/libalwith_native_computer.dylib +0 -0
  10. package/native/linux-x64/THIRD_PARTY_NOTICES.md +11 -11
  11. package/native/linux-x64/artifact.json +1 -1
  12. package/native/linux-x64/libalwith_native_computer.so +0 -0
  13. package/native/win32-x64/THIRD_PARTY_NOTICES.md +4 -4
  14. package/native/win32-x64/alwith_native_computer.dll +0 -0
  15. package/native/win32-x64/artifact.json +1 -1
  16. package/package.json +2 -2
  17. package/proxy/stdio.mjs +157 -14
  18. package/artifacts/cmux-cua-e0f7388-alwith.4-aarch64-apple-darwin.tar.gz +0 -0
  19. /package/artifacts/{cmux-cua-e0f7388-alwith.4-x86_64-pc-windows-msvc.tar.gz → cmux-cua-e0f7388-alwith.5-x86_64-pc-windows-msvc.tar.gz} +0 -0
  20. /package/artifacts/{cmux-cua-e0f7388-alwith.4-x86_64-unknown-linux-gnu.tar.gz → cmux-cua-e0f7388-alwith.5-x86_64-unknown-linux-gnu.tar.gz} +0 -0
  21. /package/native/darwin-arm64/licenses/{flate2-1.1.10 → flate2-1.1.11}/LICENSE-APACHE +0 -0
  22. /package/native/darwin-arm64/licenses/{flate2-1.1.10 → flate2-1.1.11}/LICENSE-MIT +0 -0
  23. /package/native/darwin-arm64/licenses/{specta-2.0.0-rc.27 → specta-2.0.0-rc.28}/LICENSE +0 -0
  24. /package/native/darwin-arm64/licenses/{specta-macros-2.0.0-rc.27 → specta-macros-2.0.0-rc.28}/LICENSE +0 -0
  25. /package/native/darwin-arm64/licenses/{uuid-1.29.0 → uuid-1.29.1}/LICENSE-APACHE +0 -0
  26. /package/native/darwin-arm64/licenses/{uuid-1.29.0 → uuid-1.29.1}/LICENSE-MIT +0 -0
  27. /package/native/linux-x64/licenses/{cc-1.11.0 → cc-1.11.1}/LICENSE-APACHE +0 -0
  28. /package/native/linux-x64/licenses/{cc-1.11.0 → cc-1.11.1}/LICENSE-MIT +0 -0
  29. /package/native/linux-x64/licenses/{flate2-1.1.10 → flate2-1.1.11}/LICENSE-APACHE +0 -0
  30. /package/native/linux-x64/licenses/{flate2-1.1.10 → flate2-1.1.11}/LICENSE-MIT +0 -0
  31. /package/native/linux-x64/licenses/{serde_spanned-1.1.2 → serde_spanned-1.1.3}/LICENSE-APACHE +0 -0
  32. /package/native/linux-x64/licenses/{serde_spanned-1.1.2 → serde_spanned-1.1.3}/LICENSE-MIT +0 -0
  33. /package/native/linux-x64/licenses/{smallvec-1.16.4 → smallvec-1.16.5}/LICENSE-APACHE +0 -0
  34. /package/native/linux-x64/licenses/{smallvec-1.16.4 → smallvec-1.16.5}/LICENSE-MIT +0 -0
  35. /package/native/linux-x64/licenses/{specta-2.0.0-rc.27 → specta-2.0.0-rc.28}/LICENSE +0 -0
  36. /package/native/linux-x64/licenses/{specta-macros-2.0.0-rc.27 → specta-macros-2.0.0-rc.28}/LICENSE +0 -0
  37. /package/native/linux-x64/licenses/{toml-1.2.0+spec-1.1.0 → toml-1.2.1+spec-1.1.0}/LICENSE-APACHE +0 -0
  38. /package/native/linux-x64/licenses/{toml-1.2.0+spec-1.1.0 → toml-1.2.1+spec-1.1.0}/LICENSE-MIT +0 -0
  39. /package/native/linux-x64/licenses/{toml_datetime-1.1.2+spec-1.1.0 → toml_datetime-1.1.3+spec-1.1.0}/LICENSE-APACHE +0 -0
  40. /package/native/linux-x64/licenses/{toml_datetime-1.1.2+spec-1.1.0 → toml_datetime-1.1.3+spec-1.1.0}/LICENSE-MIT +0 -0
  41. /package/native/linux-x64/licenses/{toml_edit-0.25.18+spec-1.1.0 → toml_edit-0.25.19+spec-1.1.0}/LICENSE-APACHE +0 -0
  42. /package/native/linux-x64/licenses/{toml_edit-0.25.18+spec-1.1.0 → toml_edit-0.25.19+spec-1.1.0}/LICENSE-MIT +0 -0
  43. /package/native/linux-x64/licenses/{uuid-1.29.0 → uuid-1.29.1}/LICENSE-APACHE +0 -0
  44. /package/native/linux-x64/licenses/{uuid-1.29.0 → uuid-1.29.1}/LICENSE-MIT +0 -0
  45. /package/native/linux-x64/licenses/{winnow-1.0.4 → winnow-1.0.5}/LICENSE-MIT +0 -0
  46. /package/native/win32-x64/licenses/{flate2-1.1.10 → flate2-1.1.11}/LICENSE-APACHE +0 -0
  47. /package/native/win32-x64/licenses/{flate2-1.1.10 → flate2-1.1.11}/LICENSE-MIT +0 -0
  48. /package/native/win32-x64/licenses/{specta-2.0.0-rc.27 → specta-2.0.0-rc.28}/LICENSE +0 -0
  49. /package/native/win32-x64/licenses/{specta-macros-2.0.0-rc.27 → specta-macros-2.0.0-rc.28}/LICENSE +0 -0
  50. /package/native/win32-x64/licenses/{uuid-1.29.0 → uuid-1.29.1}/LICENSE-APACHE +0 -0
  51. /package/native/win32-x64/licenses/{uuid-1.29.0 → uuid-1.29.1}/LICENSE-MIT +0 -0
package/README.md CHANGED
@@ -120,6 +120,22 @@ its pure `dump-docs --type mcp` registry export. Tool names, descriptions, schem
120
120
  and action annotations come from that executable rather than application copies.
121
121
  Metadata discovery neither captures the desktop nor starts a control daemon.
122
122
 
123
+ Session attachment does not request computer use. The injected instructions limit
124
+ model-initiated tool discovery, resource enumeration, Skill reading, and live
125
+ observations to tasks that require the desktop or GUI interaction. Ordinary chat,
126
+ code and file work, settings questions, and attached-image analysis do not trigger
127
+ computer preflight checks. MCP initialization and tool-catalog handshakes remain
128
+ part of the connection; execution permission remains application-wide.
129
+
130
+ The gateway also advertises MCP resources and serves the bundled host integration
131
+ guide at `skill://cua-driver/SKILL.md`. `resources/list` enumerates that fixed
132
+ resource; `resources/templates/list` returns an empty list; `resources/read` returns
133
+ its Markdown plus the compiled driver version and profile. The native driver has
134
+ no resource endpoint, so these requests are handled by the shared gateway rather
135
+ than forwarded to an execution process. Unknown resource URIs return `-32002`;
136
+ invalid parameters return `-32602`. Resource reads remain available while execution
137
+ is disabled or faulted and never acquire desktop ownership.
138
+
123
139
  Only computer calls acquire desktop ownership, check the current application grant
124
140
  and system permissions, and open an execution transport for the current Driver.
125
141
  Disabling access revokes execution admission before stopping every native Driver
package/dist/artifacts.js CHANGED
@@ -1 +1 @@
1
- var a={version:"cmux-e0f7388-alwith.4",artifacts:{"aarch64-apple-darwin":{bundled:"../artifacts/cmux-cua-e0f7388-alwith.4-aarch64-apple-darwin.tar.gz",sha256:"24ec432b2fcae42eab31cb5d5164bcad34a179777e9284f026d93291fbd9cc11",archive:"cmux-cua-e0f7388-alwith.4-aarch64-apple-darwin.tar.gz",executable:"cua-driver"},"x86_64-pc-windows-msvc":{bundled:"../artifacts/cmux-cua-e0f7388-alwith.4-x86_64-pc-windows-msvc.tar.gz",sha256:"33490ea7ef0999462e0d592e792b6a0a48cb6c9c76165aa04285b320df13c824",archive:"cmux-cua-e0f7388-alwith.4-x86_64-pc-windows-msvc.tar.gz",executable:"cua-driver.exe"},"x86_64-unknown-linux-gnu":{bundled:"../artifacts/cmux-cua-e0f7388-alwith.4-x86_64-unknown-linux-gnu.tar.gz",sha256:"8664e8b4e7e81bc13641d4becb527430d140ba23f630e9f20d9da6d473e236db",archive:"cmux-cua-e0f7388-alwith.4-x86_64-unknown-linux-gnu.tar.gz",executable:"cua-driver"}}};var t=a;export{t as default};
1
+ var a={version:"cmux-e0f7388-alwith.5",artifacts:{"aarch64-apple-darwin":{bundled:"../artifacts/cmux-cua-e0f7388-alwith.5-aarch64-apple-darwin.tar.gz",sha256:"9fc31f7e3b5a53bee5d2ac8b4fcd5e992859dbfb68abd4f247051bd97be29ffe",archive:"cmux-cua-e0f7388-alwith.5-aarch64-apple-darwin.tar.gz",executable:"cua-driver"},"x86_64-pc-windows-msvc":{bundled:"../artifacts/cmux-cua-e0f7388-alwith.5-x86_64-pc-windows-msvc.tar.gz",sha256:"33490ea7ef0999462e0d592e792b6a0a48cb6c9c76165aa04285b320df13c824",archive:"cmux-cua-e0f7388-alwith.5-x86_64-pc-windows-msvc.tar.gz",executable:"cua-driver.exe"},"x86_64-unknown-linux-gnu":{bundled:"../artifacts/cmux-cua-e0f7388-alwith.5-x86_64-unknown-linux-gnu.tar.gz",sha256:"8664e8b4e7e81bc13641d4becb527430d140ba23f630e9f20d9da6d473e236db",archive:"cmux-cua-e0f7388-alwith.5-x86_64-unknown-linux-gnu.tar.gz",executable:"cua-driver"}}};var t=a;export{t as default};
@@ -61,6 +61,7 @@ export declare const events: {
61
61
  };
62
62
  export type Activity = Activity_Serialize | Activity_Deserialize;
63
63
  export type Activity_Deserialize = {
64
+ refreshing?: boolean;
64
65
  sessionId: string;
65
66
  phase: string;
66
67
  queuePosition: number;
@@ -70,6 +71,7 @@ export type Activity_Deserialize = {
70
71
  revision: number;
71
72
  };
72
73
  export type Activity_Serialize = {
74
+ refreshing: boolean;
73
75
  sessionId: string;
74
76
  phase: string;
75
77
  queuePosition: number;
@@ -93,6 +95,8 @@ export type ComputerPreview_Serialize = {
93
95
  };
94
96
  export type ComputerStatus = ComputerStatus_Serialize | ComputerStatus_Deserialize;
95
97
  export type ComputerStatus_Deserialize = {
98
+ driverPhase: string;
99
+ connections: ConnectionHealth;
96
100
  permissions: Permissions;
97
101
  available: boolean;
98
102
  enabled: boolean;
@@ -102,6 +106,8 @@ export type ComputerStatus_Deserialize = {
102
106
  diagnostics: string;
103
107
  };
104
108
  export type ComputerStatus_Serialize = {
109
+ driverPhase: string;
110
+ connections: ConnectionHealth;
105
111
  permissions: Permissions;
106
112
  available: boolean;
107
113
  enabled: boolean;
@@ -116,6 +122,12 @@ export type Connection = {
116
122
  args: string[];
117
123
  env: Environment[];
118
124
  };
125
+ export type ConnectionHealth = {
126
+ ready: number;
127
+ connecting: number;
128
+ disconnected: number;
129
+ failed: number;
130
+ };
119
131
  export type CursorPosition = {
120
132
  x: number;
121
133
  y: number;
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ export interface ComputerMcpServer {
27
27
  }>;
28
28
  }
29
29
  export declare const COMPUTER_SERVER_NAME = "alwith_computer";
30
- export declare const COMPUTER_INSTRUCTIONS = "Computer actions must use the private MCP server named alwith_computer. Discover its tools before acting. When get_app_state is available, use the app-oriented tools: get_app_state starts app use and returns its key-window screenshot and accessibility tree; act using that app identity and the returned element indices or screenshot coordinates. Stable grounded actions can follow without another snapshot; refresh after navigation, layout changes, modal transitions or an action error, and verify the completed sequence. Actions report dispatch, not verified completion. Otherwise, read skill://cua-driver/SKILL.md from alwith_computer and use its window-oriented tools and element tokens. The host handles conversation ownership, queuing and preview. Respect driver refusals and explicit input delivery modes. Computer access is disabled until the user enables it in the application. If a computer call fails or access is revoked, stop computer actions and report the tool error; ordinary conversation can continue. Never replay an action whose outcome is unknown; never substitute cua_repl, shell automation or another computer channel. Ask the user to enable or reconnect computer access in the application when computer actions are needed.";
30
+ export declare const COMPUTER_INSTRUCTIONS = "Computer access is an application-wide capability available to every conversation. Enabling it grants permission; it is not a request to use the computer. Decide from the user's current task whether observing the live desktop or interacting with a GUI is necessary. Only when the task requires computer use should you discover alwith_computer tools or read its driver Skill. For ordinary conversation, reasoning, coding, local file work, or tasks that can be completed with other relevant tools, do not discover computer tools, enumerate computer resources or resource templates, read skill://cua-driver/SKILL.md, check computer connectivity, list apps or windows, or capture the screen as a startup check or preflight. A question about computer settings or an attached screenshot alone does not require live computer access. Tool availability and an enabled grant are not reasons to probe the computer.\n\nWhen the current task requires computer use, computer actions must use the private MCP server named alwith_computer. Discover its tools before acting. When get_app_state is available, use the app-oriented tools: get_app_state starts app use and returns its key-window screenshot and accessibility tree; act using that app identity and the returned element indices or screenshot coordinates. Group independent actions against a stable layout in one host turn, awaiting them sequentially. Do not run desktop actions concurrently. Prefer set_value for an editable field when supported. Do not poll get_app_state after each action: stable grounded actions can follow without another snapshot; refresh after navigation, layout changes, modal transitions or an action error, and verify the completed sequence. Actions report dispatch, not verified completion. For a required computer task on a driver without get_app_state, read skill://cua-driver/SKILL.md from alwith_computer and use its window-oriented tools and element tokens. The host handles conversation ownership, queuing and preview. Respect driver refusals and explicit input delivery modes. Computer access is disabled until the user enables it in the application. If a computer call fails or access is revoked, stop computer actions and report the tool error; ordinary conversation can continue. Never replay an action whose outcome is unknown; never substitute cua_repl, shell automation or another computer channel. Ask the user to enable or reconnect computer access in the application when computer actions are needed.";
31
31
  export declare function computerContext(resolve: () => Promise<ComputerConnection | null>): Promise<{
32
32
  mcpServers: ComputerMcpServer[];
33
33
  appendSystemPrompt?: string;
package/dist/index.js CHANGED
@@ -1 +1,5 @@
1
- var r="alwith_computer",o="Computer actions must use the private MCP server named alwith_computer. Discover its tools before acting. When get_app_state is available, use the app-oriented tools: get_app_state starts app use and returns its key-window screenshot and accessibility tree; act using that app identity and the returned element indices or screenshot coordinates. Stable grounded actions can follow without another snapshot; refresh after navigation, layout changes, modal transitions or an action error, and verify the completed sequence. Actions report dispatch, not verified completion. Otherwise, read skill://cua-driver/SKILL.md from alwith_computer and use its window-oriented tools and element tokens. The host handles conversation ownership, queuing and preview. Respect driver refusals and explicit input delivery modes. Computer access is disabled until the user enables it in the application. If a computer call fails or access is revoked, stop computer actions and report the tool error; ordinary conversation can continue. Never replay an action whose outcome is unknown; never substitute cua_repl, shell automation or another computer channel. Ask the user to enable or reconnect computer access in the application when computer actions are needed.";async function s(t){let e=await t();if(!e)return{mcpServers:[],revision:"disabled"};return{mcpServers:[{type:"stdio",name:"alwith_computer",command:e.command,args:[...e.args],env:e.env.map((n)=>({...n}))}],revision:e.generation,appendSystemPrompt:"Computer actions must use the private MCP server named alwith_computer. Discover its tools before acting. When get_app_state is available, use the app-oriented tools: get_app_state starts app use and returns its key-window screenshot and accessibility tree; act using that app identity and the returned element indices or screenshot coordinates. Stable grounded actions can follow without another snapshot; refresh after navigation, layout changes, modal transitions or an action error, and verify the completed sequence. Actions report dispatch, not verified completion. Otherwise, read skill://cua-driver/SKILL.md from alwith_computer and use its window-oriented tools and element tokens. The host handles conversation ownership, queuing and preview. Respect driver refusals and explicit input delivery modes. Computer access is disabled until the user enables it in the application. If a computer call fails or access is revoked, stop computer actions and report the tool error; ordinary conversation can continue. Never replay an action whose outcome is unknown; never substitute cua_repl, shell automation or another computer channel. Ask the user to enable or reconnect computer access in the application when computer actions are needed."}}export{o as COMPUTER_INSTRUCTIONS,r as COMPUTER_SERVER_NAME,s as computerContext};
1
+ var o="alwith_computer",n=`Computer access is an application-wide capability available to every conversation. Enabling it grants permission; it is not a request to use the computer. Decide from the user's current task whether observing the live desktop or interacting with a GUI is necessary. Only when the task requires computer use should you discover alwith_computer tools or read its driver Skill. For ordinary conversation, reasoning, coding, local file work, or tasks that can be completed with other relevant tools, do not discover computer tools, enumerate computer resources or resource templates, read skill://cua-driver/SKILL.md, check computer connectivity, list apps or windows, or capture the screen as a startup check or preflight. A question about computer settings or an attached screenshot alone does not require live computer access. Tool availability and an enabled grant are not reasons to probe the computer.
2
+
3
+ When the current task requires computer use, computer actions must use the private MCP server named alwith_computer. Discover its tools before acting. When get_app_state is available, use the app-oriented tools: get_app_state starts app use and returns its key-window screenshot and accessibility tree; act using that app identity and the returned element indices or screenshot coordinates. Group independent actions against a stable layout in one host turn, awaiting them sequentially. Do not run desktop actions concurrently. Prefer set_value for an editable field when supported. Do not poll get_app_state after each action: stable grounded actions can follow without another snapshot; refresh after navigation, layout changes, modal transitions or an action error, and verify the completed sequence. Actions report dispatch, not verified completion. For a required computer task on a driver without get_app_state, read skill://cua-driver/SKILL.md from alwith_computer and use its window-oriented tools and element tokens. The host handles conversation ownership, queuing and preview. Respect driver refusals and explicit input delivery modes. Computer access is disabled until the user enables it in the application. If a computer call fails or access is revoked, stop computer actions and report the tool error; ordinary conversation can continue. Never replay an action whose outcome is unknown; never substitute cua_repl, shell automation or another computer channel. Ask the user to enable or reconnect computer access in the application when computer actions are needed.`;async function s(t){let e=await t();if(!e)return{mcpServers:[],revision:"disabled"};return{mcpServers:[{type:"stdio",name:"alwith_computer",command:e.command,args:[...e.args],env:e.env.map((r)=>({...r}))}],revision:e.generation,appendSystemPrompt:`Computer access is an application-wide capability available to every conversation. Enabling it grants permission; it is not a request to use the computer. Decide from the user's current task whether observing the live desktop or interacting with a GUI is necessary. Only when the task requires computer use should you discover alwith_computer tools or read its driver Skill. For ordinary conversation, reasoning, coding, local file work, or tasks that can be completed with other relevant tools, do not discover computer tools, enumerate computer resources or resource templates, read skill://cua-driver/SKILL.md, check computer connectivity, list apps or windows, or capture the screen as a startup check or preflight. A question about computer settings or an attached screenshot alone does not require live computer access. Tool availability and an enabled grant are not reasons to probe the computer.
4
+
5
+ When the current task requires computer use, computer actions must use the private MCP server named alwith_computer. Discover its tools before acting. When get_app_state is available, use the app-oriented tools: get_app_state starts app use and returns its key-window screenshot and accessibility tree; act using that app identity and the returned element indices or screenshot coordinates. Group independent actions against a stable layout in one host turn, awaiting them sequentially. Do not run desktop actions concurrently. Prefer set_value for an editable field when supported. Do not poll get_app_state after each action: stable grounded actions can follow without another snapshot; refresh after navigation, layout changes, modal transitions or an action error, and verify the completed sequence. Actions report dispatch, not verified completion. For a required computer task on a driver without get_app_state, read skill://cua-driver/SKILL.md from alwith_computer and use its window-oriented tools and element tokens. The host handles conversation ownership, queuing and preview. Respect driver refusals and explicit input delivery modes. Computer access is disabled until the user enables it in the application. If a computer call fails or access is revoked, stop computer actions and report the tool error; ordinary conversation can continue. Never replay an action whose outcome is unknown; never substitute cua_repl, shell automation or another computer channel. Ask the user to enable or reconnect computer access in the application when computer actions are needed.`}}export{n as COMPUTER_INSTRUCTIONS,o as COMPUTER_SERVER_NAME,s as computerContext};
@@ -20,7 +20,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
20
20
  - errno@0.3.14: MIT OR Apache-2.0; licenses/errno-0.3.14/
21
21
  - fastrand@2.5.0: Apache-2.0 OR MIT; licenses/fastrand-2.5.0/
22
22
  - fdeflate@0.3.7: MIT OR Apache-2.0; licenses/fdeflate-0.3.7/
23
- - flate2@1.1.10: MIT OR Apache-2.0; licenses/flate2-1.1.10/
23
+ - flate2@1.1.11: MIT OR Apache-2.0; licenses/flate2-1.1.11/
24
24
  - getrandom@0.4.3: MIT OR Apache-2.0; licenses/getrandom-0.4.3/
25
25
  - image@0.25.10: MIT OR Apache-2.0; licenses/image-0.25.10/
26
26
  - itoa@1.0.18: MIT OR Apache-2.0; licenses/itoa-1.0.18/
@@ -71,8 +71,8 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
71
71
  - signal-hook-registry@1.4.8: MIT OR Apache-2.0; licenses/signal-hook-registry-1.4.8/
72
72
  - simd-adler32@0.3.10: MIT; licenses/simd-adler32-0.3.10/
73
73
  - socket2@0.6.5: MIT OR Apache-2.0; licenses/socket2-0.6.5/
74
- - specta@2.0.0-rc.27: MIT; licenses/specta-2.0.0-rc.27/; source: https://raw.githubusercontent.com/specta-rs/specta/bb4d872b131b1a4a58a340a01c9a693a7d799485/LICENSE
75
- - specta-macros@2.0.0-rc.27: MIT; licenses/specta-macros-2.0.0-rc.27/; source: https://raw.githubusercontent.com/specta-rs/specta/bb4d872b131b1a4a58a340a01c9a693a7d799485/LICENSE
74
+ - specta@2.0.0-rc.28: MIT; licenses/specta-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
75
+ - specta-macros@2.0.0-rc.28: MIT; licenses/specta-macros-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
76
76
  - syn@2.0.119: MIT OR Apache-2.0; licenses/syn-2.0.119/
77
77
  - syn@3.0.9: MIT OR Apache-2.0; licenses/syn-3.0.9/
78
78
  - tempfile@3.27.0: MIT OR Apache-2.0; licenses/tempfile-3.27.0/
@@ -81,7 +81,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
81
81
  - tokio@1.54.1: MIT; licenses/tokio-1.54.1/
82
82
  - tokio-macros@2.7.2: MIT; licenses/tokio-macros-2.7.2/
83
83
  - unicode-ident@1.0.27: (MIT OR Apache-2.0) AND Unicode-3.0; licenses/unicode-ident-1.0.27/
84
- - uuid@1.29.0: Apache-2.0 OR MIT; licenses/uuid-1.29.0/
84
+ - uuid@1.29.1: Apache-2.0 OR MIT; licenses/uuid-1.29.1/
85
85
  - xcap@0.9.8: Apache-2.0; licenses/xcap-0.9.8/
86
86
  - zlib-rs@0.6.8: Zlib; licenses/zlib-rs-0.6.8/
87
87
  - zmij@1.0.23: MIT; licenses/zmij-1.0.23/
@@ -4,5 +4,5 @@
4
4
  "abi": 1,
5
5
  "target": "aarch64-apple-darwin",
6
6
  "binary": "libalwith_native_computer.dylib",
7
- "sha256": "8fff2ffe55e105c8e636a5aaa3efa720f5cd5a4f6b92f3a4097d608e22d961d0"
7
+ "sha256": "c2b657264e580ba29bd21a41313f6d124ebc1c604864cda2428736cc23e0479e"
8
8
  }
@@ -27,7 +27,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
27
27
  - bytemuck_derive@1.12.1: Zlib OR Apache-2.0 OR MIT; licenses/bytemuck_derive-1.12.1/
28
28
  - byteorder-lite@0.1.0: Unlicense OR MIT; licenses/byteorder-lite-0.1.0/
29
29
  - bytes@1.12.1: MIT; licenses/bytes-1.12.1/
30
- - cc@1.11.0: MIT OR Apache-2.0; licenses/cc-1.11.0/
30
+ - cc@1.11.1: MIT OR Apache-2.0; licenses/cc-1.11.1/
31
31
  - cexpr@0.6.0: Apache-2.0/MIT; licenses/cexpr-0.6.0/
32
32
  - cfg-expr@0.20.10: MIT OR Apache-2.0; licenses/cfg-expr-0.20.10/
33
33
  - cfg-if@1.0.5: MIT OR Apache-2.0; licenses/cfg-if-1.0.5/
@@ -57,7 +57,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
57
57
  - fastrand@2.5.0: Apache-2.0 OR MIT; licenses/fastrand-2.5.0/
58
58
  - fdeflate@0.3.7: MIT OR Apache-2.0; licenses/fdeflate-0.3.7/
59
59
  - find-msvc-tools@0.1.15: MIT OR Apache-2.0; licenses/find-msvc-tools-0.1.15/
60
- - flate2@1.1.10: MIT OR Apache-2.0; licenses/flate2-1.1.10/
60
+ - flate2@1.1.11: MIT OR Apache-2.0; licenses/flate2-1.1.11/
61
61
  - form_urlencoded@1.2.2: MIT OR Apache-2.0; licenses/form_urlencoded-1.2.2/
62
62
  - futures-core@0.3.34: MIT OR Apache-2.0; licenses/futures-core-0.3.34/
63
63
  - futures-io@0.3.34: MIT OR Apache-2.0; licenses/futures-io-0.3.34/
@@ -141,16 +141,16 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
141
141
  - serde_derive@1.0.229: MIT OR Apache-2.0; licenses/serde_derive-1.0.229/
142
142
  - serde_json@1.0.154: MIT OR Apache-2.0; licenses/serde_json-1.0.154/
143
143
  - serde_repr@0.1.21: MIT OR Apache-2.0; licenses/serde_repr-0.1.21/
144
- - serde_spanned@1.1.2: MIT OR Apache-2.0; licenses/serde_spanned-1.1.2/
144
+ - serde_spanned@1.1.3: MIT OR Apache-2.0; licenses/serde_spanned-1.1.3/
145
145
  - shlex@1.3.0: MIT OR Apache-2.0; licenses/shlex-1.3.0/
146
146
  - shlex@2.0.1: MIT OR Apache-2.0; licenses/shlex-2.0.1/
147
147
  - signal-hook-registry@1.4.8: MIT OR Apache-2.0; licenses/signal-hook-registry-1.4.8/
148
148
  - simd-adler32@0.3.10: MIT; licenses/simd-adler32-0.3.10/
149
149
  - slab@0.4.12: MIT; licenses/slab-0.4.12/
150
- - smallvec@1.16.4: MIT OR Apache-2.0; licenses/smallvec-1.16.4/
150
+ - smallvec@1.16.5: MIT OR Apache-2.0; licenses/smallvec-1.16.5/
151
151
  - socket2@0.6.5: MIT OR Apache-2.0; licenses/socket2-0.6.5/
152
- - specta@2.0.0-rc.27: MIT; licenses/specta-2.0.0-rc.27/; source: https://raw.githubusercontent.com/specta-rs/specta/bb4d872b131b1a4a58a340a01c9a693a7d799485/LICENSE
153
- - specta-macros@2.0.0-rc.27: MIT; licenses/specta-macros-2.0.0-rc.27/; source: https://raw.githubusercontent.com/specta-rs/specta/bb4d872b131b1a4a58a340a01c9a693a7d799485/LICENSE
152
+ - specta@2.0.0-rc.28: MIT; licenses/specta-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
153
+ - specta-macros@2.0.0-rc.28: MIT; licenses/specta-macros-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
154
154
  - stable_deref_trait@1.2.1: MIT OR Apache-2.0; licenses/stable_deref_trait-1.2.1/
155
155
  - syn@2.0.119: MIT OR Apache-2.0; licenses/syn-2.0.119/
156
156
  - syn@3.0.9: MIT OR Apache-2.0; licenses/syn-3.0.9/
@@ -163,9 +163,9 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
163
163
  - tinystr@0.8.5: Unicode-3.0; licenses/tinystr-0.8.5/
164
164
  - tokio@1.54.1: MIT; licenses/tokio-1.54.1/
165
165
  - tokio-macros@2.7.2: MIT; licenses/tokio-macros-2.7.2/
166
- - toml@1.2.0+spec-1.1.0: MIT OR Apache-2.0; licenses/toml-1.2.0+spec-1.1.0/
167
- - toml_datetime@1.1.2+spec-1.1.0: MIT OR Apache-2.0; licenses/toml_datetime-1.1.2+spec-1.1.0/
168
- - toml_edit@0.25.18+spec-1.1.0: MIT OR Apache-2.0; licenses/toml_edit-0.25.18+spec-1.1.0/
166
+ - toml@1.2.1+spec-1.1.0: MIT OR Apache-2.0; licenses/toml-1.2.1+spec-1.1.0/
167
+ - toml_datetime@1.1.3+spec-1.1.0: MIT OR Apache-2.0; licenses/toml_datetime-1.1.3+spec-1.1.0/
168
+ - toml_edit@0.25.19+spec-1.1.0: MIT OR Apache-2.0; licenses/toml_edit-0.25.19+spec-1.1.0/
169
169
  - toml_parser@1.1.5+spec-1.1.0: MIT OR Apache-2.0; licenses/toml_parser-1.1.5+spec-1.1.0/
170
170
  - toml_writer@1.2.0+spec-1.1.0: MIT OR Apache-2.0; licenses/toml_writer-1.2.0+spec-1.1.0/
171
171
  - tracing@0.1.44: MIT; licenses/tracing-0.1.44/
@@ -176,7 +176,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
176
176
  - url@2.5.8: MIT OR Apache-2.0; licenses/url-2.5.8/
177
177
  - utf8_iter@1.1.0: Apache-2.0 OR MIT; licenses/utf8_iter-1.1.0/
178
178
  - utf_types@1.0.0: Apache-2.0 OR MIT; licenses/utf_types-1.0.0/
179
- - uuid@1.29.0: Apache-2.0 OR MIT; licenses/uuid-1.29.0/
179
+ - uuid@1.29.1: Apache-2.0 OR MIT; licenses/uuid-1.29.1/
180
180
  - version-compare@0.2.1: MIT; licenses/version-compare-0.2.1/
181
181
  - wayland-backend@0.3.17: MIT; licenses/wayland-backend-0.3.17/
182
182
  - wayland-client@0.31.15: MIT; licenses/wayland-client-0.31.15/
@@ -185,7 +185,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
185
185
  - wayland-scanner@0.31.11: MIT; licenses/wayland-scanner-0.31.11/
186
186
  - wayland-server@0.31.14: MIT; licenses/wayland-server-0.31.14/
187
187
  - wayland-sys@0.31.11: MIT; licenses/wayland-sys-0.31.11/
188
- - winnow@1.0.4: MIT; licenses/winnow-1.0.4/
188
+ - winnow@1.0.5: MIT; licenses/winnow-1.0.5/
189
189
  - writeable@0.6.4: Unicode-3.0; licenses/writeable-0.6.4/
190
190
  - xcap@0.9.8: Apache-2.0; licenses/xcap-0.9.8/
191
191
  - xcb@1.7.1: MIT; licenses/xcb-1.7.1/
@@ -4,5 +4,5 @@
4
4
  "abi": 1,
5
5
  "target": "x86_64-unknown-linux-gnu",
6
6
  "binary": "libalwith_native_computer.so",
7
- "sha256": "80bc1714db343c0a008231689451b85a6e32c1c2719376a3b30e0b5a55af8ff7"
7
+ "sha256": "c6d5eb65d8f83011c73291771d32979394470df14c7cee38167ea1de62b57fb6"
8
8
  }
@@ -15,7 +15,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
15
15
  - crc32fast@1.5.4: MIT OR Apache-2.0; licenses/crc32fast-1.5.4/
16
16
  - fastrand@2.5.0: Apache-2.0 OR MIT; licenses/fastrand-2.5.0/
17
17
  - fdeflate@0.3.7: MIT OR Apache-2.0; licenses/fdeflate-0.3.7/
18
- - flate2@1.1.10: MIT OR Apache-2.0; licenses/flate2-1.1.10/
18
+ - flate2@1.1.11: MIT OR Apache-2.0; licenses/flate2-1.1.11/
19
19
  - getrandom@0.4.3: MIT OR Apache-2.0; licenses/getrandom-0.4.3/
20
20
  - image@0.25.10: MIT OR Apache-2.0; licenses/image-0.25.10/
21
21
  - itoa@1.0.18: MIT OR Apache-2.0; licenses/itoa-1.0.18/
@@ -42,8 +42,8 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
42
42
  - serde_json@1.0.154: MIT OR Apache-2.0; licenses/serde_json-1.0.154/
43
43
  - simd-adler32@0.3.10: MIT; licenses/simd-adler32-0.3.10/
44
44
  - socket2@0.6.5: MIT OR Apache-2.0; licenses/socket2-0.6.5/
45
- - specta@2.0.0-rc.27: MIT; licenses/specta-2.0.0-rc.27/; source: https://raw.githubusercontent.com/specta-rs/specta/bb4d872b131b1a4a58a340a01c9a693a7d799485/LICENSE
46
- - specta-macros@2.0.0-rc.27: MIT; licenses/specta-macros-2.0.0-rc.27/; source: https://raw.githubusercontent.com/specta-rs/specta/bb4d872b131b1a4a58a340a01c9a693a7d799485/LICENSE
45
+ - specta@2.0.0-rc.28: MIT; licenses/specta-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
46
+ - specta-macros@2.0.0-rc.28: MIT; licenses/specta-macros-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
47
47
  - syn@2.0.119: MIT OR Apache-2.0; licenses/syn-2.0.119/
48
48
  - syn@3.0.9: MIT OR Apache-2.0; licenses/syn-3.0.9/
49
49
  - tempfile@3.27.0: MIT OR Apache-2.0; licenses/tempfile-3.27.0/
@@ -52,7 +52,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
52
52
  - tokio@1.54.1: MIT; licenses/tokio-1.54.1/
53
53
  - tokio-macros@2.7.2: MIT; licenses/tokio-macros-2.7.2/
54
54
  - unicode-ident@1.0.27: (MIT OR Apache-2.0) AND Unicode-3.0; licenses/unicode-ident-1.0.27/
55
- - uuid@1.29.0: Apache-2.0 OR MIT; licenses/uuid-1.29.0/
55
+ - uuid@1.29.1: Apache-2.0 OR MIT; licenses/uuid-1.29.1/
56
56
  - widestring@1.2.1: MIT OR Apache-2.0; licenses/widestring-1.2.1/
57
57
  - windows@0.62.2: MIT OR Apache-2.0; licenses/windows-0.62.2/
58
58
  - windows-collections@0.3.2: MIT OR Apache-2.0; licenses/windows-collections-0.3.2/
@@ -4,5 +4,5 @@
4
4
  "abi": 1,
5
5
  "target": "x86_64-pc-windows-msvc",
6
6
  "binary": "alwith_native_computer.dll",
7
- "sha256": "d88597de45c9fefed07fbb489d87c172bbae7234cc51133249092b8177c2b3f3"
7
+ "sha256": "89132fad053051c4e49e17d89786dbaea0e3c7daf10ad9f80f49f12cb9d1a33a"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwith/module-computer",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "files": [
@@ -10,7 +10,7 @@
10
10
  "README.md",
11
11
  "licenses",
12
12
  "proxy",
13
- "artifacts/cmux-cua-e0f7388-alwith.4-*.tar.gz",
13
+ "artifacts/cmux-cua-e0f7388-alwith.5-*.tar.gz",
14
14
  "native/**"
15
15
  ],
16
16
  "exports": {
package/proxy/stdio.mjs CHANGED
@@ -1,19 +1,162 @@
1
- // A byte-only stdio carrier. Authentication and all scheduling live in the native host.
1
+ // Keep MCP stdio alive across gateway disconnects. Never replay a dispatched action.
2
2
  import { connect } from "node:net"
3
+ import { createInterface } from "node:readline"
4
+
3
5
  const [address, token] = process.argv.slice(2)
4
6
  if (!address || !token || !/^127\.0\.0\.1:\d+$/.test(address)) throw new Error("Invalid computer gateway address")
5
- const socket = connect({ host: "127.0.0.1", port: Number(address.split(":")[1]) })
6
- socket.on("connect", () => {
7
- socket.write(`${token}\n`)
8
- process.stdin.pipe(socket)
9
- socket.pipe(process.stdout)
7
+ let socket
8
+ let opening
9
+ let pending
10
+ let initialization
11
+ let stopped = false
12
+ let sequence = 0
13
+ const wire = new WeakMap()
14
+ const output = (value) => process.stdout.write(`${wire.get(value) ?? JSON.stringify(value)}\n`)
15
+ const failure = () =>
16
+ new Error(
17
+ "Computer gateway disconnected. The previous action may have completed; do not replay it. Reconnect computer access and obtain a fresh app state. If the application restarted, reopen the conversation to renew its connection."
18
+ )
19
+
20
+ function exchange(request) {
21
+ return new Promise((resolve, reject) => {
22
+ if (!socket || socket.destroyed) {
23
+ reject(failure())
24
+ return
25
+ }
26
+ const timer = setTimeout(() => socket?.destroy(failure()), 155_000)
27
+ pending = { id: request.id, resolve, reject, timer }
28
+ socket.write(`${JSON.stringify(request)}\n`)
29
+ })
30
+ }
31
+
32
+ async function establish() {
33
+ if (socket && !socket.destroyed) return
34
+ if (opening) return opening
35
+ opening = new Promise((resolve, reject) => {
36
+ const current = connect({
37
+ host: "127.0.0.1",
38
+ port: Number(address.split(":")[1])
39
+ })
40
+ socket = current
41
+ const timer = setTimeout(() => current.destroy(new Error("Computer gateway connection timed out")), 5000)
42
+ current.on("error", () => {})
43
+ current.on("close", () => {
44
+ clearTimeout(timer)
45
+ reject(failure())
46
+ if (socket !== current) return
47
+ socket = undefined
48
+ if (pending) {
49
+ clearTimeout(pending.timer)
50
+ pending.reject(failure())
51
+ pending = undefined
52
+ }
53
+ })
54
+ createInterface({ input: current }).on("line", (line) => {
55
+ let response
56
+ try {
57
+ response = JSON.parse(line)
58
+ } catch {
59
+ current.destroy(failure())
60
+ return
61
+ }
62
+ if (!response || typeof response !== "object" || Array.isArray(response)) {
63
+ current.destroy(failure())
64
+ return
65
+ }
66
+ wire.set(response, line)
67
+ if (pending && response.id === pending.id) {
68
+ const completed = pending
69
+ pending = undefined
70
+ clearTimeout(completed.timer)
71
+ completed.resolve(response)
72
+ } else output(response)
73
+ })
74
+ current.on("connect", () => {
75
+ clearTimeout(timer)
76
+ current.write(`${token}\n`)
77
+ resolve()
78
+ })
79
+ })
80
+ try {
81
+ await opening
82
+ if (initialization) {
83
+ for (const method of ["initialize", "tools/list"]) {
84
+ const request = method === "initialize" ? { ...initialization } : { jsonrpc: "2.0", method, params: {} }
85
+ request.id = `carrier-handshake-${++sequence}`
86
+ const response = await exchange(request)
87
+ if (response.error) throw new Error(`Computer gateway ${method} failed`)
88
+ if (method === "initialize")
89
+ socket.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })}\n`)
90
+ }
91
+ }
92
+ } catch (error) {
93
+ socket?.destroy()
94
+ throw error
95
+ } finally {
96
+ opening = undefined
97
+ }
98
+ }
99
+
100
+ let queue = Promise.resolve()
101
+ const input = createInterface({ input: process.stdin })
102
+ input.on("line", (line) => {
103
+ // Server-request replies and cancellation notifications must bypass a pending call.
104
+ let message
105
+ try {
106
+ message = JSON.parse(line)
107
+ } catch {
108
+ output({
109
+ jsonrpc: "2.0",
110
+ id: null,
111
+ error: { code: -32700, message: "Invalid JSON" }
112
+ })
113
+ return
114
+ }
115
+ if (!message || typeof message !== "object" || Array.isArray(message)) {
116
+ output({ jsonrpc: "2.0", id: null, error: { code: -32600, message: "Invalid MCP request" } })
117
+ return
118
+ }
119
+ if (!message.method || !Object.hasOwn(message, "id")) {
120
+ if (socket && !socket.destroyed) socket.write(`${line}\n`)
121
+ return
122
+ }
123
+ queue = queue.then(async () => {
124
+ if (stopped) return
125
+ let request
126
+ try {
127
+ request = JSON.parse(line)
128
+ } catch {
129
+ output({
130
+ jsonrpc: "2.0",
131
+ id: null,
132
+ error: { code: -32700, message: "Invalid JSON" }
133
+ })
134
+ return
135
+ }
136
+ try {
137
+ await establish()
138
+ if (!Object.hasOwn(request, "id")) {
139
+ socket.write(`${line}\n`)
140
+ return
141
+ }
142
+ const response = await exchange(request)
143
+ if (request.method === "initialize" && !response.error) initialization = request
144
+ output(response)
145
+ } catch (error) {
146
+ if (Object.hasOwn(request, "id"))
147
+ output({
148
+ jsonrpc: "2.0",
149
+ id: request.id,
150
+ error: { code: -32000, message: error.message }
151
+ })
152
+ }
153
+ })
10
154
  })
11
- socket.on("error", () => {
12
- process.exitCode = 1
155
+ function stop() {
156
+ stopped = true
157
+ socket?.destroy()
158
+ input.close()
13
159
  process.stdin.destroy()
14
- })
15
- socket.on("close", () => {
16
- process.stdin.destroy()
17
- })
18
- process.stdin.on("end", () => socket.destroy())
19
- process.stdout.on("error", () => socket.destroy())
160
+ }
161
+ input.on("close", stop)
162
+ process.stdout.on("error", stop)