gclm-code 1.0.0 → 1.0.1

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 (43) hide show
  1. package/README.md +1 -1
  2. package/bin/gc.js +53 -25
  3. package/bin/install-runtime.js +253 -0
  4. package/package.json +10 -5
  5. package/vendor/manifest.json +92 -0
  6. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/package.json +9 -0
  7. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/bridgeClient.ts +1126 -0
  8. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/browserTools.ts +546 -0
  9. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/index.ts +15 -0
  10. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/mcpServer.ts +96 -0
  11. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/mcpSocketClient.ts +493 -0
  12. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/mcpSocketPool.ts +327 -0
  13. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/toolCalls.ts +301 -0
  14. package/vendor/modules/node_modules/@ant/claude-for-chrome-mcp/src/types.ts +134 -0
  15. package/vendor/modules/node_modules/@ant/computer-use-input/package.json +9 -0
  16. package/vendor/modules/node_modules/@ant/computer-use-input/src/driver-jxa.js +341 -0
  17. package/vendor/modules/node_modules/@ant/computer-use-input/src/driver-swift.swift +417 -0
  18. package/vendor/modules/node_modules/@ant/computer-use-input/src/implementation.js +204 -0
  19. package/vendor/modules/node_modules/@ant/computer-use-input/src/index.js +5 -0
  20. package/vendor/modules/node_modules/@ant/computer-use-mcp/package.json +11 -0
  21. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/deniedApps.ts +553 -0
  22. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/imageResize.ts +108 -0
  23. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/index.ts +69 -0
  24. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/keyBlocklist.ts +153 -0
  25. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/mcpServer.ts +313 -0
  26. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/pixelCompare.ts +171 -0
  27. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/sentinelApps.ts +43 -0
  28. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/subGates.ts +19 -0
  29. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/toolCalls.ts +3872 -0
  30. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/tools.ts +706 -0
  31. package/vendor/modules/node_modules/@ant/computer-use-mcp/src/types.ts +635 -0
  32. package/vendor/modules/node_modules/@ant/computer-use-swift/package.json +9 -0
  33. package/vendor/modules/node_modules/@ant/computer-use-swift/src/driver-jxa.js +108 -0
  34. package/vendor/modules/node_modules/@ant/computer-use-swift/src/implementation.js +706 -0
  35. package/vendor/modules/node_modules/@ant/computer-use-swift/src/index.js +7 -0
  36. package/vendor/modules/node_modules/audio-capture-napi/package.json +8 -0
  37. package/vendor/modules/node_modules/audio-capture-napi/src/index.ts +226 -0
  38. package/vendor/modules/node_modules/image-processor-napi/package.json +11 -0
  39. package/vendor/modules/node_modules/image-processor-napi/src/index.ts +396 -0
  40. package/vendor/modules/node_modules/modifiers-napi/package.json +8 -0
  41. package/vendor/modules/node_modules/modifiers-napi/src/index.ts +79 -0
  42. package/vendor/modules/node_modules/url-handler-napi/package.json +8 -0
  43. package/vendor/modules/node_modules/url-handler-napi/src/index.ts +62 -0
@@ -0,0 +1,79 @@
1
+ import { createRequire } from 'module'
2
+
3
+ const require = createRequire(import.meta.url)
4
+
5
+ const FLAG_SHIFT = 0x20000
6
+ const FLAG_CONTROL = 0x40000
7
+ const FLAG_OPTION = 0x80000
8
+ const FLAG_COMMAND = 0x100000
9
+
10
+ const modifierFlags: Record<string, number> = {
11
+ shift: FLAG_SHIFT,
12
+ control: FLAG_CONTROL,
13
+ option: FLAG_OPTION,
14
+ command: FLAG_COMMAND,
15
+ }
16
+
17
+ const kCGEventSourceStateCombinedSessionState = 0
18
+
19
+ let cgEventSourceFlagsState: ((stateID: number) => number) | null | undefined
20
+
21
+ function loadFFI(): ((stateID: number) => number) | null {
22
+ if (cgEventSourceFlagsState !== undefined) {
23
+ return cgEventSourceFlagsState
24
+ }
25
+
26
+ if (process.platform !== 'darwin') {
27
+ cgEventSourceFlagsState = null
28
+ return null
29
+ }
30
+
31
+ try {
32
+ const ffi = require('bun:ffi') as typeof import('bun:ffi')
33
+ const lib = ffi.dlopen('/System/Library/Frameworks/Carbon.framework/Carbon', {
34
+ CGEventSourceFlagsState: {
35
+ args: [ffi.FFIType.i32],
36
+ returns: ffi.FFIType.u64,
37
+ },
38
+ })
39
+ cgEventSourceFlagsState = (stateID: number): number =>
40
+ Number(lib.symbols.CGEventSourceFlagsState(stateID))
41
+ } catch {
42
+ cgEventSourceFlagsState = null
43
+ }
44
+
45
+ return cgEventSourceFlagsState
46
+ }
47
+
48
+ function getCurrentFlags(): number {
49
+ const readFlags = loadFFI()
50
+ if (!readFlags) {
51
+ return 0
52
+ }
53
+
54
+ return readFlags(kCGEventSourceStateCombinedSessionState)
55
+ }
56
+
57
+ export function getModifiers(): string[] {
58
+ const currentFlags = getCurrentFlags()
59
+ if (!currentFlags) {
60
+ return []
61
+ }
62
+
63
+ return Object.entries(modifierFlags)
64
+ .filter(([, flag]) => (currentFlags & flag) !== 0)
65
+ .map(([modifier]) => modifier)
66
+ }
67
+
68
+ export function isModifierPressed(modifier: string): boolean {
69
+ const flag = modifierFlags[modifier]
70
+ if (flag === undefined) {
71
+ return false
72
+ }
73
+
74
+ return (getCurrentFlags() & flag) !== 0
75
+ }
76
+
77
+ export function prewarm(): void {
78
+ loadFFI()
79
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "url-handler-napi",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "types": "./src/index.ts"
8
+ }
@@ -0,0 +1,62 @@
1
+ import { readFileSync } from 'fs'
2
+
3
+ const sleepBuffer = new Int32Array(new SharedArrayBuffer(4))
4
+
5
+ function isUrlCandidate(value: string | undefined): value is string {
6
+ return typeof value === 'string' && /^[a-z][a-z0-9+.-]*:\/\//i.test(value)
7
+ }
8
+
9
+ function readUrlFromFallbackFile(path: string | undefined): string | null {
10
+ if (!path) {
11
+ return null
12
+ }
13
+ try {
14
+ const value = readFileSync(path, 'utf8').trim()
15
+ return isUrlCandidate(value) ? value : null
16
+ } catch {
17
+ return null
18
+ }
19
+ }
20
+
21
+ function sleepSync(milliseconds: number): void {
22
+ Atomics.wait(sleepBuffer, 0, 0, milliseconds)
23
+ }
24
+
25
+ function waitForFallbackUrl(timeoutMs: number): string | null {
26
+ const directCandidates = [
27
+ process.env.CLAUDE_CODE_HANDLE_URI,
28
+ process.env.CLAUDE_CODE_URL,
29
+ process.env.LAUNCH_URL,
30
+ ...process.argv,
31
+ ]
32
+ for (const candidate of directCandidates) {
33
+ if (isUrlCandidate(candidate)) {
34
+ return candidate
35
+ }
36
+ }
37
+
38
+ const fileCandidates = [
39
+ process.env.CLAUDE_CODE_URL_EVENT_FILE,
40
+ process.env.URL_HANDLER_EVENT_FILE,
41
+ ]
42
+
43
+ const deadline = Date.now() + Math.max(0, timeoutMs)
44
+ do {
45
+ for (const candidate of fileCandidates) {
46
+ const url = readUrlFromFallbackFile(candidate)
47
+ if (url) {
48
+ return url
49
+ }
50
+ }
51
+ if (Date.now() >= deadline) {
52
+ break
53
+ }
54
+ sleepSync(50)
55
+ } while (true)
56
+
57
+ return null
58
+ }
59
+
60
+ export function waitForUrlEvent(timeoutMs: number): string | null {
61
+ return waitForFallbackUrl(timeoutMs)
62
+ }