@embedder/embedder 1.0.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/LICENSE +36 -0
- package/bundle/embedder.js +600 -0
- package/bundle/gdb-debugger-python/gdb_bridge.py +392 -0
- package/bundle/gdb-debugger-python/requirements.txt +1 -0
- package/bundle/postinstall-for-users.js +497 -0
- package/bundle/prebuilt/darwin-arm64/node-pty.node +0 -0
- package/bundle/prebuilt/darwin-arm64/serialport.node +0 -0
- package/bundle/prebuilt/darwin-x64/node-pty.node +0 -0
- package/bundle/prebuilt/darwin-x64/serialport.node +0 -0
- package/bundle/prebuilt/js/LICENSE +21 -0
- package/bundle/prebuilt/js/README.md +16 -0
- package/bundle/prebuilt/js/dist/index.d.ts +180 -0
- package/bundle/prebuilt/js/dist/index.js +380 -0
- package/bundle/prebuilt/js/package.json +30 -0
- package/bundle/prebuilt/linux-x64/node-pty.node +0 -0
- package/bundle/prebuilt/linux-x64/serialport.node +0 -0
- package/bundle/prebuilt/win32-x64/node-pty.node +0 -0
- package/bundle/prebuilt/win32-x64/serialport.node +0 -0
- package/bundle/repomap-bridge.js +6 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/16/f1/46475231336389d911f729227da4.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/4b/ed/71b2bc3ff2b4ae3127312ffb93b6.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/9a/a5/4cd70a20713e3b8fb1e15ada7795.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/a2/bd/43da7881d5016e770db1c6facb21.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/a9/9a/8d9d8580960d3db4249ad5534c93.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/c9/b3/539c4fa477faa91028d0911cbd93.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/cache.db +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/d2/7f/23d90301a6beae01ee51643cbdec.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/d4/03/91f221322e309efe044a99fd3b12.val +0 -0
- package/bundle/repomap-python/__pycache__/importance.cpython-310.pyc +0 -0
- package/bundle/repomap-python/__pycache__/repomap_class.cpython-310.pyc +0 -0
- package/bundle/repomap-python/__pycache__/scm.cpython-310.pyc +0 -0
- package/bundle/repomap-python/__pycache__/utils.cpython-310.pyc +0 -0
- package/bundle/repomap-python/importance.py +58 -0
- package/bundle/repomap-python/queries/repomap_server.py +577 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/README.md +9 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/c-tags.scm +9 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/d-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/go-tags.scm +42 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/java-tags.scm +20 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/python-tags.scm +14 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/r-tags.scm +21 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/README.md +24 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/c-tags.scm +9 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/cpp-tags.scm +15 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/dart-tags.scm +91 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/elisp-tags.scm +8 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/elixir-tags.scm +54 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/elm-tags.scm +19 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/go-tags.scm +30 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/hcl-tags.scm +77 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/java-tags.scm +20 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/javascript-tags.scm +88 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/php-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/python-tags.scm +12 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ql-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ruby-tags.scm +64 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/rust-tags.scm +60 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/scala-tags.scm +65 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/typescript-tags.scm +41 -0
- package/bundle/repomap-python/repomap.py +229 -0
- package/bundle/repomap-python/repomap_bridge.py +234 -0
- package/bundle/repomap-python/repomap_class.py +637 -0
- package/bundle/repomap-python/repomap_server.py +585 -0
- package/bundle/repomap-python/requirements.txt +7 -0
- package/bundle/repomap-python/scm.py +59 -0
- package/bundle/repomap-python/utils.py +58 -0
- package/bundle/sandbox-macos-permissive-closed.sb +26 -0
- package/bundle/sandbox-macos-permissive-open.sb +19 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +31 -0
- package/bundle/sandbox-macos-restrictive-closed.sb +87 -0
- package/bundle/sandbox-macos-restrictive-open.sb +90 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +92 -0
- package/package.json +97 -0
- package/postinstall.js +42 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Utility functions for RepoMap.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Optional, List
|
|
9
|
+
from collections import namedtuple
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
import tiktoken
|
|
13
|
+
except ImportError:
|
|
14
|
+
print("Error: tiktoken is required. Install with: pip install tiktoken")
|
|
15
|
+
sys.exit(1)
|
|
16
|
+
|
|
17
|
+
# Tag namedtuple for storing parsed code definitions and references
|
|
18
|
+
Tag = namedtuple("Tag", "rel_fname fname line name kind".split())
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def count_tokens(text: str, model_name: str = "gpt-4") -> int:
|
|
22
|
+
"""Count tokens in text using tiktoken."""
|
|
23
|
+
if not text:
|
|
24
|
+
return 0
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
encoding = tiktoken.encoding_for_model(model_name)
|
|
28
|
+
except KeyError:
|
|
29
|
+
# Fallback for unknown models
|
|
30
|
+
encoding = tiktoken.get_encoding("cl100k_base")
|
|
31
|
+
|
|
32
|
+
return len(encoding.encode(text))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def read_text(filename: str, encoding: str = "utf-8", silent: bool = False) -> Optional[str]:
|
|
36
|
+
"""Read text from file with error handling."""
|
|
37
|
+
try:
|
|
38
|
+
return Path(filename).read_text(encoding=encoding, errors='ignore')
|
|
39
|
+
except FileNotFoundError:
|
|
40
|
+
if not silent:
|
|
41
|
+
print(f"Error: {filename} not found.")
|
|
42
|
+
return None
|
|
43
|
+
except IsADirectoryError:
|
|
44
|
+
if not silent:
|
|
45
|
+
print(f"Error: {filename} is a directory.")
|
|
46
|
+
return None
|
|
47
|
+
except OSError as e:
|
|
48
|
+
if not silent:
|
|
49
|
+
print(f"Error reading {filename}: {e}")
|
|
50
|
+
return None
|
|
51
|
+
except UnicodeError as e:
|
|
52
|
+
if not silent:
|
|
53
|
+
print(f"Error decoding {filename}: {e}")
|
|
54
|
+
return None
|
|
55
|
+
except Exception as e:
|
|
56
|
+
if not silent:
|
|
57
|
+
print(f"An unexpected error occurred while reading {filename}: {e}")
|
|
58
|
+
return None
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(version 1)
|
|
2
|
+
|
|
3
|
+
;; allow everything by default
|
|
4
|
+
(allow default)
|
|
5
|
+
|
|
6
|
+
;; deny all writes EXCEPT under specific paths
|
|
7
|
+
(deny file-write*)
|
|
8
|
+
(allow file-write*
|
|
9
|
+
(subpath (param "TARGET_DIR"))
|
|
10
|
+
(subpath (param "TMP_DIR"))
|
|
11
|
+
(subpath (param "CACHE_DIR"))
|
|
12
|
+
(subpath (string-append (param "HOME_DIR") "/.embedder"))
|
|
13
|
+
(subpath (string-append (param "HOME_DIR") "/.npm"))
|
|
14
|
+
(subpath (string-append (param "HOME_DIR") "/.cache"))
|
|
15
|
+
(subpath (string-append (param "HOME_DIR") "/.gitconfig"))
|
|
16
|
+
(literal "/dev/stdout")
|
|
17
|
+
(literal "/dev/stderr")
|
|
18
|
+
(literal "/dev/null")
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
;; deny all inbound network traffic EXCEPT on debugger port
|
|
22
|
+
(deny network-inbound)
|
|
23
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
24
|
+
|
|
25
|
+
;; deny all outbound network traffic
|
|
26
|
+
(deny network-outbound)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
(version 1)
|
|
2
|
+
|
|
3
|
+
;; allow everything by default
|
|
4
|
+
(allow default)
|
|
5
|
+
|
|
6
|
+
;; deny all writes EXCEPT under specific paths
|
|
7
|
+
(deny file-write*)
|
|
8
|
+
(allow file-write*
|
|
9
|
+
(subpath (param "TARGET_DIR"))
|
|
10
|
+
(subpath (param "TMP_DIR"))
|
|
11
|
+
(subpath (param "CACHE_DIR"))
|
|
12
|
+
(subpath (string-append (param "HOME_DIR") "/.embedder"))
|
|
13
|
+
(subpath (string-append (param "HOME_DIR") "/.npm"))
|
|
14
|
+
(subpath (string-append (param "HOME_DIR") "/.cache"))
|
|
15
|
+
(subpath (string-append (param "HOME_DIR") "/.gitconfig"))
|
|
16
|
+
(literal "/dev/stdout")
|
|
17
|
+
(literal "/dev/stderr")
|
|
18
|
+
(literal "/dev/null")
|
|
19
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
(version 1)
|
|
2
|
+
|
|
3
|
+
;; allow everything by default
|
|
4
|
+
(allow default)
|
|
5
|
+
|
|
6
|
+
;; deny all writes EXCEPT under specific paths
|
|
7
|
+
(deny file-write*)
|
|
8
|
+
(allow file-write*
|
|
9
|
+
(subpath (param "TARGET_DIR"))
|
|
10
|
+
(subpath (param "TMP_DIR"))
|
|
11
|
+
(subpath (param "CACHE_DIR"))
|
|
12
|
+
(subpath (string-append (param "HOME_DIR") "/.embedder"))
|
|
13
|
+
(subpath (string-append (param "HOME_DIR") "/.npm"))
|
|
14
|
+
(subpath (string-append (param "HOME_DIR") "/.cache"))
|
|
15
|
+
(subpath (string-append (param "HOME_DIR") "/.gitconfig"))
|
|
16
|
+
(literal "/dev/stdout")
|
|
17
|
+
(literal "/dev/stderr")
|
|
18
|
+
(literal "/dev/null")
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
;; deny all inbound network traffic EXCEPT on debugger port
|
|
22
|
+
(deny network-inbound)
|
|
23
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
24
|
+
|
|
25
|
+
;; deny all outbound network traffic EXCEPT through proxy on localhost:8877
|
|
26
|
+
;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
|
|
27
|
+
;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
|
|
28
|
+
(deny network-outbound)
|
|
29
|
+
(allow network-outbound (remote tcp "localhost:8877"))
|
|
30
|
+
|
|
31
|
+
(allow network-bind (local ip "*:*"))
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
(version 1)
|
|
2
|
+
|
|
3
|
+
;; deny everything by default
|
|
4
|
+
(deny default)
|
|
5
|
+
|
|
6
|
+
;; allow reading files from anywhere on host
|
|
7
|
+
(allow file-read*)
|
|
8
|
+
|
|
9
|
+
;; allow exec/fork (children inherit policy)
|
|
10
|
+
(allow process-exec)
|
|
11
|
+
(allow process-fork)
|
|
12
|
+
|
|
13
|
+
;; allow signals to self, e.g. SIGPIPE on write to closed pipe
|
|
14
|
+
(allow signal (target self))
|
|
15
|
+
|
|
16
|
+
;; allow read access to specific information about system
|
|
17
|
+
;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
|
|
18
|
+
(allow sysctl-read
|
|
19
|
+
(sysctl-name "hw.activecpu")
|
|
20
|
+
(sysctl-name "hw.busfrequency_compat")
|
|
21
|
+
(sysctl-name "hw.byteorder")
|
|
22
|
+
(sysctl-name "hw.cacheconfig")
|
|
23
|
+
(sysctl-name "hw.cachelinesize_compat")
|
|
24
|
+
(sysctl-name "hw.cpufamily")
|
|
25
|
+
(sysctl-name "hw.cpufrequency_compat")
|
|
26
|
+
(sysctl-name "hw.cputype")
|
|
27
|
+
(sysctl-name "hw.l1dcachesize_compat")
|
|
28
|
+
(sysctl-name "hw.l1icachesize_compat")
|
|
29
|
+
(sysctl-name "hw.l2cachesize_compat")
|
|
30
|
+
(sysctl-name "hw.l3cachesize_compat")
|
|
31
|
+
(sysctl-name "hw.logicalcpu_max")
|
|
32
|
+
(sysctl-name "hw.machine")
|
|
33
|
+
(sysctl-name "hw.ncpu")
|
|
34
|
+
(sysctl-name "hw.nperflevels")
|
|
35
|
+
(sysctl-name "hw.optional.arm.FEAT_BF16")
|
|
36
|
+
(sysctl-name "hw.optional.arm.FEAT_DotProd")
|
|
37
|
+
(sysctl-name "hw.optional.arm.FEAT_FCMA")
|
|
38
|
+
(sysctl-name "hw.optional.arm.FEAT_FHM")
|
|
39
|
+
(sysctl-name "hw.optional.arm.FEAT_FP16")
|
|
40
|
+
(sysctl-name "hw.optional.arm.FEAT_I8MM")
|
|
41
|
+
(sysctl-name "hw.optional.arm.FEAT_JSCVT")
|
|
42
|
+
(sysctl-name "hw.optional.arm.FEAT_LSE")
|
|
43
|
+
(sysctl-name "hw.optional.arm.FEAT_RDM")
|
|
44
|
+
(sysctl-name "hw.optional.arm.FEAT_SHA512")
|
|
45
|
+
(sysctl-name "hw.optional.armv8_2_sha512")
|
|
46
|
+
(sysctl-name "hw.packages")
|
|
47
|
+
(sysctl-name "hw.pagesize_compat")
|
|
48
|
+
(sysctl-name "hw.physicalcpu_max")
|
|
49
|
+
(sysctl-name "hw.tbfrequency_compat")
|
|
50
|
+
(sysctl-name "hw.vectorunit")
|
|
51
|
+
(sysctl-name "kern.hostname")
|
|
52
|
+
(sysctl-name "kern.maxfilesperproc")
|
|
53
|
+
(sysctl-name "kern.osproductversion")
|
|
54
|
+
(sysctl-name "kern.osrelease")
|
|
55
|
+
(sysctl-name "kern.ostype")
|
|
56
|
+
(sysctl-name "kern.osvariant_status")
|
|
57
|
+
(sysctl-name "kern.osversion")
|
|
58
|
+
(sysctl-name "kern.secure_kernel")
|
|
59
|
+
(sysctl-name "kern.usrstack64")
|
|
60
|
+
(sysctl-name "kern.version")
|
|
61
|
+
(sysctl-name "sysctl.proc_cputype")
|
|
62
|
+
(sysctl-name-prefix "hw.perflevel")
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
;; allow writes to specific paths
|
|
66
|
+
(allow file-write*
|
|
67
|
+
(subpath (param "TARGET_DIR"))
|
|
68
|
+
(subpath (param "TMP_DIR"))
|
|
69
|
+
(subpath (param "CACHE_DIR"))
|
|
70
|
+
(subpath (string-append (param "HOME_DIR") "/.embedder"))
|
|
71
|
+
(subpath (string-append (param "HOME_DIR") "/.npm"))
|
|
72
|
+
(subpath (string-append (param "HOME_DIR") "/.cache"))
|
|
73
|
+
(subpath (string-append (param "HOME_DIR") "/.gitconfig"))
|
|
74
|
+
(literal "/dev/stdout")
|
|
75
|
+
(literal "/dev/stderr")
|
|
76
|
+
(literal "/dev/null")
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
;; allow communication with sysmond for process listing (e.g. for pgrep)
|
|
80
|
+
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
81
|
+
|
|
82
|
+
;; enable terminal access required by ink
|
|
83
|
+
;; fixes setRawMode EPERM failure (at node:tty:81:24)
|
|
84
|
+
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
85
|
+
|
|
86
|
+
;; allow inbound network traffic on debugger port
|
|
87
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
(version 1)
|
|
2
|
+
|
|
3
|
+
;; deny everything by default
|
|
4
|
+
(deny default)
|
|
5
|
+
|
|
6
|
+
;; allow reading files from anywhere on host
|
|
7
|
+
(allow file-read*)
|
|
8
|
+
|
|
9
|
+
;; allow exec/fork (children inherit policy)
|
|
10
|
+
(allow process-exec)
|
|
11
|
+
(allow process-fork)
|
|
12
|
+
|
|
13
|
+
;; allow signals to self, e.g. SIGPIPE on write to closed pipe
|
|
14
|
+
(allow signal (target self))
|
|
15
|
+
|
|
16
|
+
;; allow read access to specific information about system
|
|
17
|
+
;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
|
|
18
|
+
(allow sysctl-read
|
|
19
|
+
(sysctl-name "hw.activecpu")
|
|
20
|
+
(sysctl-name "hw.busfrequency_compat")
|
|
21
|
+
(sysctl-name "hw.byteorder")
|
|
22
|
+
(sysctl-name "hw.cacheconfig")
|
|
23
|
+
(sysctl-name "hw.cachelinesize_compat")
|
|
24
|
+
(sysctl-name "hw.cpufamily")
|
|
25
|
+
(sysctl-name "hw.cpufrequency_compat")
|
|
26
|
+
(sysctl-name "hw.cputype")
|
|
27
|
+
(sysctl-name "hw.l1dcachesize_compat")
|
|
28
|
+
(sysctl-name "hw.l1icachesize_compat")
|
|
29
|
+
(sysctl-name "hw.l2cachesize_compat")
|
|
30
|
+
(sysctl-name "hw.l3cachesize_compat")
|
|
31
|
+
(sysctl-name "hw.logicalcpu_max")
|
|
32
|
+
(sysctl-name "hw.machine")
|
|
33
|
+
(sysctl-name "hw.ncpu")
|
|
34
|
+
(sysctl-name "hw.nperflevels")
|
|
35
|
+
(sysctl-name "hw.optional.arm.FEAT_BF16")
|
|
36
|
+
(sysctl-name "hw.optional.arm.FEAT_DotProd")
|
|
37
|
+
(sysctl-name "hw.optional.arm.FEAT_FCMA")
|
|
38
|
+
(sysctl-name "hw.optional.arm.FEAT_FHM")
|
|
39
|
+
(sysctl-name "hw.optional.arm.FEAT_FP16")
|
|
40
|
+
(sysctl-name "hw.optional.arm.FEAT_I8MM")
|
|
41
|
+
(sysctl-name "hw.optional.arm.FEAT_JSCVT")
|
|
42
|
+
(sysctl-name "hw.optional.arm.FEAT_LSE")
|
|
43
|
+
(sysctl-name "hw.optional.arm.FEAT_RDM")
|
|
44
|
+
(sysctl-name "hw.optional.arm.FEAT_SHA512")
|
|
45
|
+
(sysctl-name "hw.optional.armv8_2_sha512")
|
|
46
|
+
(sysctl-name "hw.packages")
|
|
47
|
+
(sysctl-name "hw.pagesize_compat")
|
|
48
|
+
(sysctl-name "hw.physicalcpu_max")
|
|
49
|
+
(sysctl-name "hw.tbfrequency_compat")
|
|
50
|
+
(sysctl-name "hw.vectorunit")
|
|
51
|
+
(sysctl-name "kern.hostname")
|
|
52
|
+
(sysctl-name "kern.maxfilesperproc")
|
|
53
|
+
(sysctl-name "kern.osproductversion")
|
|
54
|
+
(sysctl-name "kern.osrelease")
|
|
55
|
+
(sysctl-name "kern.ostype")
|
|
56
|
+
(sysctl-name "kern.osvariant_status")
|
|
57
|
+
(sysctl-name "kern.osversion")
|
|
58
|
+
(sysctl-name "kern.secure_kernel")
|
|
59
|
+
(sysctl-name "kern.usrstack64")
|
|
60
|
+
(sysctl-name "kern.version")
|
|
61
|
+
(sysctl-name "sysctl.proc_cputype")
|
|
62
|
+
(sysctl-name-prefix "hw.perflevel")
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
;; allow writes to specific paths
|
|
66
|
+
(allow file-write*
|
|
67
|
+
(subpath (param "TARGET_DIR"))
|
|
68
|
+
(subpath (param "TMP_DIR"))
|
|
69
|
+
(subpath (param "CACHE_DIR"))
|
|
70
|
+
(subpath (string-append (param "HOME_DIR") "/.embedder"))
|
|
71
|
+
(subpath (string-append (param "HOME_DIR") "/.npm"))
|
|
72
|
+
(subpath (string-append (param "HOME_DIR") "/.cache"))
|
|
73
|
+
(subpath (string-append (param "HOME_DIR") "/.gitconfig"))
|
|
74
|
+
(literal "/dev/stdout")
|
|
75
|
+
(literal "/dev/stderr")
|
|
76
|
+
(literal "/dev/null")
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
;; allow communication with sysmond for process listing (e.g. for pgrep)
|
|
80
|
+
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
81
|
+
|
|
82
|
+
;; enable terminal access required by ink
|
|
83
|
+
;; fixes setRawMode EPERM failure (at node:tty:81:24)
|
|
84
|
+
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
85
|
+
|
|
86
|
+
;; allow inbound network traffic on debugger port
|
|
87
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
88
|
+
|
|
89
|
+
;; allow all outbound network traffic
|
|
90
|
+
(allow network-outbound)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
(version 1)
|
|
2
|
+
|
|
3
|
+
;; deny everything by default
|
|
4
|
+
(deny default)
|
|
5
|
+
|
|
6
|
+
;; allow reading files from anywhere on host
|
|
7
|
+
(allow file-read*)
|
|
8
|
+
|
|
9
|
+
;; allow exec/fork (children inherit policy)
|
|
10
|
+
(allow process-exec)
|
|
11
|
+
(allow process-fork)
|
|
12
|
+
|
|
13
|
+
;; allow signals to self, e.g. SIGPIPE on write to closed pipe
|
|
14
|
+
(allow signal (target self))
|
|
15
|
+
|
|
16
|
+
;; allow read access to specific information about system
|
|
17
|
+
;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
|
|
18
|
+
(allow sysctl-read
|
|
19
|
+
(sysctl-name "hw.activecpu")
|
|
20
|
+
(sysctl-name "hw.busfrequency_compat")
|
|
21
|
+
(sysctl-name "hw.byteorder")
|
|
22
|
+
(sysctl-name "hw.cacheconfig")
|
|
23
|
+
(sysctl-name "hw.cachelinesize_compat")
|
|
24
|
+
(sysctl-name "hw.cpufamily")
|
|
25
|
+
(sysctl-name "hw.cpufrequency_compat")
|
|
26
|
+
(sysctl-name "hw.cputype")
|
|
27
|
+
(sysctl-name "hw.l1dcachesize_compat")
|
|
28
|
+
(sysctl-name "hw.l1icachesize_compat")
|
|
29
|
+
(sysctl-name "hw.l2cachesize_compat")
|
|
30
|
+
(sysctl-name "hw.l3cachesize_compat")
|
|
31
|
+
(sysctl-name "hw.logicalcpu_max")
|
|
32
|
+
(sysctl-name "hw.machine")
|
|
33
|
+
(sysctl-name "hw.ncpu")
|
|
34
|
+
(sysctl-name "hw.nperflevels")
|
|
35
|
+
(sysctl-name "hw.optional.arm.FEAT_BF16")
|
|
36
|
+
(sysctl-name "hw.optional.arm.FEAT_DotProd")
|
|
37
|
+
(sysctl-name "hw.optional.arm.FEAT_FCMA")
|
|
38
|
+
(sysctl-name "hw.optional.arm.FEAT_FHM")
|
|
39
|
+
(sysctl-name "hw.optional.arm.FEAT_FP16")
|
|
40
|
+
(sysctl-name "hw.optional.arm.FEAT_I8MM")
|
|
41
|
+
(sysctl-name "hw.optional.arm.FEAT_JSCVT")
|
|
42
|
+
(sysctl-name "hw.optional.arm.FEAT_LSE")
|
|
43
|
+
(sysctl-name "hw.optional.arm.FEAT_RDM")
|
|
44
|
+
(sysctl-name "hw.optional.arm.FEAT_SHA512")
|
|
45
|
+
(sysctl-name "hw.optional.armv8_2_sha512")
|
|
46
|
+
(sysctl-name "hw.packages")
|
|
47
|
+
(sysctl-name "hw.pagesize_compat")
|
|
48
|
+
(sysctl-name "hw.physicalcpu_max")
|
|
49
|
+
(sysctl-name "hw.tbfrequency_compat")
|
|
50
|
+
(sysctl-name "hw.vectorunit")
|
|
51
|
+
(sysctl-name "kern.hostname")
|
|
52
|
+
(sysctl-name "kern.maxfilesperproc")
|
|
53
|
+
(sysctl-name "kern.osproductversion")
|
|
54
|
+
(sysctl-name "kern.osrelease")
|
|
55
|
+
(sysctl-name "kern.ostype")
|
|
56
|
+
(sysctl-name "kern.osvariant_status")
|
|
57
|
+
(sysctl-name "kern.osversion")
|
|
58
|
+
(sysctl-name "kern.secure_kernel")
|
|
59
|
+
(sysctl-name "kern.usrstack64")
|
|
60
|
+
(sysctl-name "kern.version")
|
|
61
|
+
(sysctl-name "sysctl.proc_cputype")
|
|
62
|
+
(sysctl-name-prefix "hw.perflevel")
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
;; allow writes to specific paths
|
|
66
|
+
(allow file-write*
|
|
67
|
+
(subpath (param "TARGET_DIR"))
|
|
68
|
+
(subpath (param "TMP_DIR"))
|
|
69
|
+
(subpath (param "CACHE_DIR"))
|
|
70
|
+
(subpath (string-append (param "HOME_DIR") "/.embedder"))
|
|
71
|
+
(subpath (string-append (param "HOME_DIR") "/.npm"))
|
|
72
|
+
(subpath (string-append (param "HOME_DIR") "/.cache"))
|
|
73
|
+
(subpath (string-append (param "HOME_DIR") "/.gitconfig"))
|
|
74
|
+
(literal "/dev/stdout")
|
|
75
|
+
(literal "/dev/stderr")
|
|
76
|
+
(literal "/dev/null")
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
;; allow communication with sysmond for process listing (e.g. for pgrep)
|
|
80
|
+
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
81
|
+
|
|
82
|
+
;; enable terminal access required by ink
|
|
83
|
+
;; fixes setRawMode EPERM failure (at node:tty:81:24)
|
|
84
|
+
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
85
|
+
|
|
86
|
+
;; allow inbound network traffic on debugger port
|
|
87
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
88
|
+
|
|
89
|
+
;; allow outbound network traffic through proxy on localhost:8877
|
|
90
|
+
;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
|
|
91
|
+
;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
|
|
92
|
+
(allow network-outbound (remote tcp "localhost:8877"))
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@embedder/embedder",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=20.0.0"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"workspaces": [
|
|
9
|
+
"packages/cli",
|
|
10
|
+
"packages/core",
|
|
11
|
+
"packages/gdb-debugger",
|
|
12
|
+
"packages/RepoMapper"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://embedder.dev",
|
|
15
|
+
"config": {
|
|
16
|
+
"sandboxImageUri": "us-docker.pkg.dev/embedder-dev/embedder-cli/sandbox:0.1.13"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"start": "node scripts/start.js",
|
|
20
|
+
"debug": "cross-env DEBUG=1 node --inspect-brk scripts/start.js",
|
|
21
|
+
"auth": "npm run auth:npm && npm run auth:docker",
|
|
22
|
+
"generate": "node scripts/generate-git-commit-info.js",
|
|
23
|
+
"build": "node scripts/build.js",
|
|
24
|
+
"build:all": "npm run build && npm run build:sandbox",
|
|
25
|
+
"build:packages": "npm run build --workspaces",
|
|
26
|
+
"build:sandbox": "node scripts/build_sandbox.js --skip-npm-install-build",
|
|
27
|
+
"bundle": "npm run generate && node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
28
|
+
"bundle:obfuscated": "npm run generate && cross-env OBFUSCATE=true NODE_ENV=production node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
29
|
+
"bundle:production": "npm run generate && cross-env NODE_ENV=production node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
30
|
+
"bundle:light": "npm run generate && cross-env OBFUSCATE=true OBFUSCATION_PRESET=light node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
31
|
+
"bundle:balanced": "npm run generate && cross-env OBFUSCATE=true OBFUSCATION_PRESET=balanced node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
32
|
+
"bundle:secure": "npm run generate && cross-env OBFUSCATE=true OBFUSCATION_PRESET=high node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
33
|
+
"bundle:dev": "npm run generate && cross-env OBFUSCATE=true OBFUSCATION_PRESET=development node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
34
|
+
"bundle:quiet": "npm run generate && cross-env SUPPRESS_STARTUP_LOGS=true node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
35
|
+
"bundle:verbose": "npm run generate && cross-env SUPPRESS_STARTUP_LOGS=false node esbuild.config.js && node scripts/copy_bundle_assets.js",
|
|
36
|
+
"test": "npm run test --workspaces",
|
|
37
|
+
"test:ci": "npm run test:ci --workspaces --if-present && npm run test:scripts",
|
|
38
|
+
"test:scripts": "vitest run --config ./scripts/tests/vitest.config.ts",
|
|
39
|
+
"lint": "eslint . --ext .ts,.tsx && eslint integration-tests",
|
|
40
|
+
"lint:fix": "eslint . --fix && eslint integration-tests --fix",
|
|
41
|
+
"lint:ci": "eslint . --ext .ts,.tsx --max-warnings 0 && eslint integration-tests --max-warnings 0",
|
|
42
|
+
"format": "prettier --write .",
|
|
43
|
+
"typecheck": "npm run typecheck --workspaces --if-present",
|
|
44
|
+
"preflight": "npm run clean && npm ci && npm run format && npm run lint:ci && npm run build && npm run typecheck && npm run test:ci",
|
|
45
|
+
"prepare": "npm run bundle:obfuscated",
|
|
46
|
+
"prepare:package": "node scripts/prepare-package.js",
|
|
47
|
+
"release:version": "node scripts/version.js",
|
|
48
|
+
"telemetry": "node scripts/telemetry.js",
|
|
49
|
+
"clean": "node scripts/clean.js",
|
|
50
|
+
"postinstall": "node postinstall.js"
|
|
51
|
+
},
|
|
52
|
+
"bin": {
|
|
53
|
+
"embedder": "bundle/embedder.js",
|
|
54
|
+
"repomap-bridge": "bundle/repomap-bridge.js"
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"bundle/",
|
|
58
|
+
"postinstall.js",
|
|
59
|
+
"README.md",
|
|
60
|
+
"LICENSE"
|
|
61
|
+
],
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/micromatch": "^4.0.9",
|
|
64
|
+
"@types/mime-types": "^3.0.1",
|
|
65
|
+
"@types/mock-fs": "^4.13.4",
|
|
66
|
+
"@types/shell-quote": "^1.7.5",
|
|
67
|
+
"@types/uuid": "^10.0.0",
|
|
68
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
69
|
+
"concurrently": "^9.2.0",
|
|
70
|
+
"cross-env": "^7.0.3",
|
|
71
|
+
"esbuild": "^0.25.0",
|
|
72
|
+
"eslint": "^9.24.0",
|
|
73
|
+
"eslint-config-prettier": "^10.1.2",
|
|
74
|
+
"eslint-plugin-import": "^2.31.0",
|
|
75
|
+
"eslint-plugin-license-header": "^0.8.0",
|
|
76
|
+
"eslint-plugin-react": "^7.37.5",
|
|
77
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
78
|
+
"glob": "^10.4.5",
|
|
79
|
+
"globals": "^16.0.0",
|
|
80
|
+
"javascript-obfuscator": "^4.1.1",
|
|
81
|
+
"json": "^11.0.0",
|
|
82
|
+
"lodash": "^4.17.21",
|
|
83
|
+
"memfs": "^4.17.2",
|
|
84
|
+
"mock-fs": "^5.5.0",
|
|
85
|
+
"pkg": "^5.8.1",
|
|
86
|
+
"prettier": "^3.5.3",
|
|
87
|
+
"react-devtools-core": "^4.28.5",
|
|
88
|
+
"typescript-eslint": "^8.30.1",
|
|
89
|
+
"vitest": "^3.2.4",
|
|
90
|
+
"yargs": "^17.7.2"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@lydell/node-pty": "^1.1.0",
|
|
94
|
+
"@serialport/bindings-cpp": "^12.0.1",
|
|
95
|
+
"@serialport/stream": "^12.0.0"
|
|
96
|
+
}
|
|
97
|
+
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cross-platform postinstall runner.
|
|
4
|
+
* Prefers bundle/postinstall-for-users.js when present (tarball installs),
|
|
5
|
+
* falls back to scripts/postinstall-for-users.js for source installs.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { spawnSync } from 'child_process';
|
|
9
|
+
import { existsSync } from 'fs';
|
|
10
|
+
import { dirname, join } from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
|
|
16
|
+
const candidates = [
|
|
17
|
+
join(__dirname, 'bundle', 'postinstall-for-users.js'),
|
|
18
|
+
join(__dirname, 'scripts', 'postinstall-for-users.js'),
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const target = candidates.find((p) => existsSync(p));
|
|
22
|
+
|
|
23
|
+
if (!target) {
|
|
24
|
+
console.log('No postinstall script found. Skipping.');
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const result = spawnSync(process.execPath, [target], {
|
|
29
|
+
stdio: 'inherit',
|
|
30
|
+
shell: false,
|
|
31
|
+
windowsHide: true,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (result.error) {
|
|
35
|
+
console.error('Failed to run postinstall script:', result.error.message);
|
|
36
|
+
if (process.env.FAIL_ON_PYTHON_ERROR === 'true') {
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
process.exit(typeof result.status === 'number' ? result.status : 0);
|