@unity-china/codely-cli 1.0.0-rc.4 → 1.0.0-rc.42
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 +203 -0
- package/README.md +366 -0
- package/README.zh-CN.md +336 -0
- package/bundle/builtin/skill-creator/SKILL.md +381 -0
- package/bundle/builtin/skill-creator/scripts/init_skill.cjs +237 -0
- package/bundle/builtin/skill-creator/scripts/package_skill.cjs +140 -0
- package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +137 -0
- package/bundle/builtin-agents/explore.toml +62 -0
- package/bundle/builtin-agents/general-purpose.toml +34 -0
- package/bundle/builtin-agents/plan.toml +69 -0
- package/bundle/example-prompts/README.md +56 -0
- package/bundle/example-prompts/analyze.toml +47 -0
- package/bundle/example-prompts/explain-code.toml +200 -0
- package/bundle/example-prompts/git-commit.toml +48 -0
- package/bundle/gemini.js +4577 -0
- package/bundle/gemini.js.LEGAL.txt +465 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/LICENSE.md +201 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/README.md +158 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/package.json +23 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs.d.ts +3226 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs.js +4521 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs_bg.js +4270 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm +0 -0
- package/bundle/policies/plan.toml +153 -0
- package/bundle/policies/read-only.toml +65 -0
- package/bundle/policies/write.toml +39 -0
- package/bundle/policies/yolo.toml +9 -0
- package/bundle/sandbox-macos-permissive-closed.sb +32 -0
- package/bundle/sandbox-macos-permissive-open.sb +25 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
- package/bundle/sandbox-macos-restrictive-closed.sb +93 -0
- package/bundle/sandbox-macos-restrictive-open.sb +96 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
- package/bundle/tiktoken_bg.wasm +0 -0
- package/bundle/web-ui/dist/public/app.css +2923 -0
- package/bundle/web-ui/dist/public/app.js +140 -0
- package/bundle/web-ui/dist/public/index.html +17 -0
- package/package.json +102 -81
- package/dist/index.js +0 -19
|
Binary file
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Plan Mode policy: default-ask + explicit allow for exploration/planning tools.
|
|
2
|
+
# Active only when ApprovalMode = "plan".
|
|
3
|
+
#
|
|
4
|
+
# Design:
|
|
5
|
+
# - No blanket deny-all: tools default to ASK_USER (interactive) or ALLOW (non-interactive).
|
|
6
|
+
# - Explicit ALLOW for exploration/planning tools (including shell).
|
|
7
|
+
# - Conditional ALLOW for write_file/replace (plans directory only).
|
|
8
|
+
#
|
|
9
|
+
# Priority bands (tiers):
|
|
10
|
+
# - Default policies (TOML): 1 + priority/1000
|
|
11
|
+
# 70: Explicit allows and ask rules for plan mode (becomes 1.070, overrides deny)
|
|
12
|
+
#
|
|
13
|
+
# Non-interactive plan mode:
|
|
14
|
+
# The PolicyEngine converts ASK_USER → DENY for non-interactive sessions.
|
|
15
|
+
# When entering plan mode in non-interactive, Config.setApprovalMode()
|
|
16
|
+
# sets the PolicyEngine default decision to ALLOW, so tools without
|
|
17
|
+
# explicit rules are available by default.
|
|
18
|
+
|
|
19
|
+
# --- Explicit allows for plan mode ---
|
|
20
|
+
[[rule]]
|
|
21
|
+
toolName = "run_shell_command"
|
|
22
|
+
decision = "allow"
|
|
23
|
+
priority = 70
|
|
24
|
+
modes = ["plan"]
|
|
25
|
+
allow_redirection = true
|
|
26
|
+
allow_command_substitution = true
|
|
27
|
+
|
|
28
|
+
# --- Read-only tools allowed in plan mode ---
|
|
29
|
+
[[rule]]
|
|
30
|
+
toolName = "glob"
|
|
31
|
+
decision = "allow"
|
|
32
|
+
priority = 70
|
|
33
|
+
modes = ["plan"]
|
|
34
|
+
|
|
35
|
+
[[rule]]
|
|
36
|
+
toolName = "search_file_content"
|
|
37
|
+
decision = "allow"
|
|
38
|
+
priority = 70
|
|
39
|
+
modes = ["plan"]
|
|
40
|
+
|
|
41
|
+
[[rule]]
|
|
42
|
+
toolName = "list_directory"
|
|
43
|
+
decision = "allow"
|
|
44
|
+
priority = 70
|
|
45
|
+
modes = ["plan"]
|
|
46
|
+
|
|
47
|
+
[[rule]]
|
|
48
|
+
toolName = "read_file"
|
|
49
|
+
decision = "allow"
|
|
50
|
+
priority = 70
|
|
51
|
+
modes = ["plan"]
|
|
52
|
+
|
|
53
|
+
[[rule]]
|
|
54
|
+
toolName = "analyze_multimedia"
|
|
55
|
+
decision = "allow"
|
|
56
|
+
priority = 70
|
|
57
|
+
modes = ["plan"]
|
|
58
|
+
|
|
59
|
+
[[rule]]
|
|
60
|
+
toolName = "web_search"
|
|
61
|
+
decision = "allow"
|
|
62
|
+
priority = 70
|
|
63
|
+
modes = ["plan"]
|
|
64
|
+
|
|
65
|
+
[[rule]]
|
|
66
|
+
toolName = "job_create"
|
|
67
|
+
decision = "allow"
|
|
68
|
+
priority = 70
|
|
69
|
+
modes = ["plan"]
|
|
70
|
+
|
|
71
|
+
[[rule]]
|
|
72
|
+
toolName = "job_get"
|
|
73
|
+
decision = "allow"
|
|
74
|
+
priority = 70
|
|
75
|
+
modes = ["plan"]
|
|
76
|
+
|
|
77
|
+
[[rule]]
|
|
78
|
+
toolName = "job_update"
|
|
79
|
+
decision = "allow"
|
|
80
|
+
priority = 70
|
|
81
|
+
modes = ["plan"]
|
|
82
|
+
|
|
83
|
+
[[rule]]
|
|
84
|
+
toolName = "job_list"
|
|
85
|
+
decision = "allow"
|
|
86
|
+
priority = 70
|
|
87
|
+
modes = ["plan"]
|
|
88
|
+
|
|
89
|
+
# --- Allow writing plan files (.md) to the plans directory only ---
|
|
90
|
+
# The argsPattern matches the JSON-serialized file_path within:
|
|
91
|
+
# ~/.codely-cli/tmp/<64-hex-project-hash>/plans/<name>.md
|
|
92
|
+
# Supports both / and escaped \\ separators.
|
|
93
|
+
[[rule]]
|
|
94
|
+
toolName = "write_file"
|
|
95
|
+
decision = "allow"
|
|
96
|
+
priority = 70
|
|
97
|
+
modes = ["plan"]
|
|
98
|
+
argsPattern = "\"file_path\"\\s*:\\s*\"[^\"]*[/\\\\]+\\.codely-cli[/\\\\]+tmp[/\\\\]+[a-f0-9]{64}[/\\\\]+plans[/\\\\]+[a-zA-Z0-9_\\-][a-zA-Z0-9_\\-.]*\\.md\""
|
|
99
|
+
|
|
100
|
+
# write_file outside the plans directory requires approval (interactive)
|
|
101
|
+
# or is denied (non-interactive via ask-downgrade)
|
|
102
|
+
[[rule]]
|
|
103
|
+
toolName = "write_file"
|
|
104
|
+
decision = "ask_user"
|
|
105
|
+
priority = 65
|
|
106
|
+
modes = ["plan"]
|
|
107
|
+
|
|
108
|
+
[[rule]]
|
|
109
|
+
toolName = "replace"
|
|
110
|
+
decision = "allow"
|
|
111
|
+
priority = 70
|
|
112
|
+
modes = ["plan"]
|
|
113
|
+
argsPattern = "\"file_path\"\\s*:\\s*\"[^\"]*[/\\\\]+\\.codely-cli[/\\\\]+tmp[/\\\\]+[a-f0-9]{64}[/\\\\]+plans[/\\\\]+[a-zA-Z0-9_\\-][a-zA-Z0-9_\\-.]*\\.md\""
|
|
114
|
+
|
|
115
|
+
# replace outside the plans directory requires approval (interactive)
|
|
116
|
+
# or is denied (non-interactive via ask-downgrade)
|
|
117
|
+
[[rule]]
|
|
118
|
+
toolName = "replace"
|
|
119
|
+
decision = "ask_user"
|
|
120
|
+
priority = 65
|
|
121
|
+
modes = ["plan"]
|
|
122
|
+
|
|
123
|
+
# --- exit_plan_mode requires user approval ---
|
|
124
|
+
[[rule]]
|
|
125
|
+
toolName = "exit_plan_mode"
|
|
126
|
+
decision = "ask_user"
|
|
127
|
+
priority = 70
|
|
128
|
+
modes = ["plan"]
|
|
129
|
+
|
|
130
|
+
[[rule]]
|
|
131
|
+
toolName = "ask_user"
|
|
132
|
+
decision = "ask_user"
|
|
133
|
+
priority = 70
|
|
134
|
+
modes = ["plan"]
|
|
135
|
+
|
|
136
|
+
# --- Task dispatch allowed in plan mode (for exploration / context gathering) ---
|
|
137
|
+
[[rule]]
|
|
138
|
+
toolName = "task"
|
|
139
|
+
decision = "allow"
|
|
140
|
+
priority = 70
|
|
141
|
+
modes = ["plan"]
|
|
142
|
+
|
|
143
|
+
[[rule]]
|
|
144
|
+
toolName = "task_output"
|
|
145
|
+
decision = "allow"
|
|
146
|
+
priority = 70
|
|
147
|
+
modes = ["plan"]
|
|
148
|
+
|
|
149
|
+
[[rule]]
|
|
150
|
+
toolName = "task_stop"
|
|
151
|
+
decision = "allow"
|
|
152
|
+
priority = 70
|
|
153
|
+
modes = ["plan"]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Read-only tools that are always allowed without confirmation.
|
|
2
|
+
# These tools only read data and cannot modify the filesystem or execute commands.
|
|
3
|
+
#
|
|
4
|
+
# Priority bands (tiers):
|
|
5
|
+
# - Default policies (TOML): 1 + priority/1000 (e.g., priority 50 → 1.050)
|
|
6
|
+
# - User policies (TOML): 2 + priority/1000
|
|
7
|
+
# - Admin policies (TOML): 3 + priority/1000
|
|
8
|
+
|
|
9
|
+
[[rule]]
|
|
10
|
+
toolName = "glob"
|
|
11
|
+
decision = "allow"
|
|
12
|
+
priority = 50
|
|
13
|
+
|
|
14
|
+
[[rule]]
|
|
15
|
+
toolName = "search_file_content"
|
|
16
|
+
decision = "allow"
|
|
17
|
+
priority = 50
|
|
18
|
+
|
|
19
|
+
[[rule]]
|
|
20
|
+
toolName = "list_directory"
|
|
21
|
+
decision = "allow"
|
|
22
|
+
priority = 50
|
|
23
|
+
|
|
24
|
+
[[rule]]
|
|
25
|
+
toolName = "read_file"
|
|
26
|
+
decision = "allow"
|
|
27
|
+
priority = 50
|
|
28
|
+
|
|
29
|
+
[[rule]]
|
|
30
|
+
toolName = "web_search"
|
|
31
|
+
decision = "allow"
|
|
32
|
+
priority = 50
|
|
33
|
+
|
|
34
|
+
[[rule]]
|
|
35
|
+
toolName = "analyze_multimedia"
|
|
36
|
+
decision = "allow"
|
|
37
|
+
priority = 50
|
|
38
|
+
|
|
39
|
+
# Job tools are planning/tracking tools that don't modify the filesystem.
|
|
40
|
+
[[rule]]
|
|
41
|
+
toolName = "job_create"
|
|
42
|
+
decision = "allow"
|
|
43
|
+
priority = 50
|
|
44
|
+
|
|
45
|
+
[[rule]]
|
|
46
|
+
toolName = "job_get"
|
|
47
|
+
decision = "allow"
|
|
48
|
+
priority = 50
|
|
49
|
+
|
|
50
|
+
[[rule]]
|
|
51
|
+
toolName = "job_update"
|
|
52
|
+
decision = "allow"
|
|
53
|
+
priority = 50
|
|
54
|
+
|
|
55
|
+
[[rule]]
|
|
56
|
+
toolName = "job_list"
|
|
57
|
+
decision = "allow"
|
|
58
|
+
priority = 50
|
|
59
|
+
|
|
60
|
+
# web_fetch is a read operation (fetching content from the web).
|
|
61
|
+
# It was auto-approved in autoEdit mode; treating it as read-equivalent.
|
|
62
|
+
[[rule]]
|
|
63
|
+
toolName = "web_fetch"
|
|
64
|
+
decision = "allow"
|
|
65
|
+
priority = 50
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Write/mutating tools that require user confirmation by default.
|
|
2
|
+
# In autoEdit mode, replace and write_file are auto-approved.
|
|
3
|
+
#
|
|
4
|
+
# Priority bands (tiers):
|
|
5
|
+
# - Default policies (TOML): 1 + priority/1000
|
|
6
|
+
# 10: Write tools default to ASK_USER (becomes 1.010)
|
|
7
|
+
# 15: Auto-edit tool override (becomes 1.015)
|
|
8
|
+
|
|
9
|
+
[[rule]]
|
|
10
|
+
toolName = "replace"
|
|
11
|
+
decision = "ask_user"
|
|
12
|
+
priority = 10
|
|
13
|
+
|
|
14
|
+
[[rule]]
|
|
15
|
+
toolName = "replace"
|
|
16
|
+
decision = "allow"
|
|
17
|
+
priority = 15
|
|
18
|
+
modes = ["autoEdit"]
|
|
19
|
+
|
|
20
|
+
[[rule]]
|
|
21
|
+
toolName = "write_file"
|
|
22
|
+
decision = "ask_user"
|
|
23
|
+
priority = 10
|
|
24
|
+
|
|
25
|
+
[[rule]]
|
|
26
|
+
toolName = "write_file"
|
|
27
|
+
decision = "allow"
|
|
28
|
+
priority = 15
|
|
29
|
+
modes = ["autoEdit"]
|
|
30
|
+
|
|
31
|
+
[[rule]]
|
|
32
|
+
toolName = "run_shell_command"
|
|
33
|
+
decision = "ask_user"
|
|
34
|
+
priority = 10
|
|
35
|
+
|
|
36
|
+
[[rule]]
|
|
37
|
+
toolName = "activate_skill"
|
|
38
|
+
decision = "ask_user"
|
|
39
|
+
priority = 10
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# YOLO mode: allow all tools without confirmation.
|
|
2
|
+
# This rule has the highest default-tier priority (999 → 1.999).
|
|
3
|
+
# It only applies when the approval mode is "yolo".
|
|
4
|
+
|
|
5
|
+
[[rule]]
|
|
6
|
+
decision = "allow"
|
|
7
|
+
priority = 999
|
|
8
|
+
modes = ["yolo"]
|
|
9
|
+
allow_redirection = true
|
|
@@ -0,0 +1,32 @@
|
|
|
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") "/.codely-cli"))
|
|
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
|
+
;; Allow writes to included directories from --include-directories
|
|
17
|
+
(subpath (param "INCLUDE_DIR_0"))
|
|
18
|
+
(subpath (param "INCLUDE_DIR_1"))
|
|
19
|
+
(subpath (param "INCLUDE_DIR_2"))
|
|
20
|
+
(subpath (param "INCLUDE_DIR_3"))
|
|
21
|
+
(subpath (param "INCLUDE_DIR_4"))
|
|
22
|
+
(literal "/dev/stdout")
|
|
23
|
+
(literal "/dev/stderr")
|
|
24
|
+
(literal "/dev/null")
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
;; deny all inbound network traffic EXCEPT on debugger port
|
|
28
|
+
(deny network-inbound)
|
|
29
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
30
|
+
|
|
31
|
+
;; deny all outbound network traffic
|
|
32
|
+
(deny network-outbound)
|
|
@@ -0,0 +1,25 @@
|
|
|
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") "/.codely-cli"))
|
|
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
|
+
;; Allow writes to included directories from --include-directories
|
|
17
|
+
(subpath (param "INCLUDE_DIR_0"))
|
|
18
|
+
(subpath (param "INCLUDE_DIR_1"))
|
|
19
|
+
(subpath (param "INCLUDE_DIR_2"))
|
|
20
|
+
(subpath (param "INCLUDE_DIR_3"))
|
|
21
|
+
(subpath (param "INCLUDE_DIR_4"))
|
|
22
|
+
(literal "/dev/stdout")
|
|
23
|
+
(literal "/dev/stderr")
|
|
24
|
+
(literal "/dev/null")
|
|
25
|
+
)
|
|
@@ -0,0 +1,37 @@
|
|
|
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") "/.codely-cli"))
|
|
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
|
+
;; Allow writes to included directories from --include-directories
|
|
17
|
+
(subpath (param "INCLUDE_DIR_0"))
|
|
18
|
+
(subpath (param "INCLUDE_DIR_1"))
|
|
19
|
+
(subpath (param "INCLUDE_DIR_2"))
|
|
20
|
+
(subpath (param "INCLUDE_DIR_3"))
|
|
21
|
+
(subpath (param "INCLUDE_DIR_4"))
|
|
22
|
+
(literal "/dev/stdout")
|
|
23
|
+
(literal "/dev/stderr")
|
|
24
|
+
(literal "/dev/null")
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
;; deny all inbound network traffic EXCEPT on debugger port
|
|
28
|
+
(deny network-inbound)
|
|
29
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
30
|
+
|
|
31
|
+
;; deny all outbound network traffic EXCEPT through proxy on localhost:8877
|
|
32
|
+
;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
|
|
33
|
+
;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
|
|
34
|
+
(deny network-outbound)
|
|
35
|
+
(allow network-outbound (remote tcp "localhost:8877"))
|
|
36
|
+
|
|
37
|
+
(allow network-bind (local ip "*:*"))
|
|
@@ -0,0 +1,93 @@
|
|
|
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") "/.codely-cli"))
|
|
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
|
+
;; Allow writes to included directories from --include-directories
|
|
75
|
+
(subpath (param "INCLUDE_DIR_0"))
|
|
76
|
+
(subpath (param "INCLUDE_DIR_1"))
|
|
77
|
+
(subpath (param "INCLUDE_DIR_2"))
|
|
78
|
+
(subpath (param "INCLUDE_DIR_3"))
|
|
79
|
+
(subpath (param "INCLUDE_DIR_4"))
|
|
80
|
+
(literal "/dev/stdout")
|
|
81
|
+
(literal "/dev/stderr")
|
|
82
|
+
(literal "/dev/null")
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
;; allow communication with sysmond for process listing (e.g. for pgrep)
|
|
86
|
+
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
87
|
+
|
|
88
|
+
;; enable terminal access required by ink
|
|
89
|
+
;; fixes setRawMode EPERM failure (at node:tty:81:24)
|
|
90
|
+
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
91
|
+
|
|
92
|
+
;; allow inbound network traffic on debugger port
|
|
93
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
@@ -0,0 +1,96 @@
|
|
|
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") "/.codely-cli"))
|
|
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
|
+
;; Allow writes to included directories from --include-directories
|
|
75
|
+
(subpath (param "INCLUDE_DIR_0"))
|
|
76
|
+
(subpath (param "INCLUDE_DIR_1"))
|
|
77
|
+
(subpath (param "INCLUDE_DIR_2"))
|
|
78
|
+
(subpath (param "INCLUDE_DIR_3"))
|
|
79
|
+
(subpath (param "INCLUDE_DIR_4"))
|
|
80
|
+
(literal "/dev/stdout")
|
|
81
|
+
(literal "/dev/stderr")
|
|
82
|
+
(literal "/dev/null")
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
;; allow communication with sysmond for process listing (e.g. for pgrep)
|
|
86
|
+
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
87
|
+
|
|
88
|
+
;; enable terminal access required by ink
|
|
89
|
+
;; fixes setRawMode EPERM failure (at node:tty:81:24)
|
|
90
|
+
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
91
|
+
|
|
92
|
+
;; allow inbound network traffic on debugger port
|
|
93
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
94
|
+
|
|
95
|
+
;; allow all outbound network traffic
|
|
96
|
+
(allow network-outbound)
|
|
@@ -0,0 +1,98 @@
|
|
|
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") "/.codely-cli"))
|
|
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
|
+
;; Allow writes to included directories from --include-directories
|
|
75
|
+
(subpath (param "INCLUDE_DIR_0"))
|
|
76
|
+
(subpath (param "INCLUDE_DIR_1"))
|
|
77
|
+
(subpath (param "INCLUDE_DIR_2"))
|
|
78
|
+
(subpath (param "INCLUDE_DIR_3"))
|
|
79
|
+
(subpath (param "INCLUDE_DIR_4"))
|
|
80
|
+
(literal "/dev/stdout")
|
|
81
|
+
(literal "/dev/stderr")
|
|
82
|
+
(literal "/dev/null")
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
;; allow communication with sysmond for process listing (e.g. for pgrep)
|
|
86
|
+
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
87
|
+
|
|
88
|
+
;; enable terminal access required by ink
|
|
89
|
+
;; fixes setRawMode EPERM failure (at node:tty:81:24)
|
|
90
|
+
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
91
|
+
|
|
92
|
+
;; allow inbound network traffic on debugger port
|
|
93
|
+
(allow network-inbound (local ip "localhost:9229"))
|
|
94
|
+
|
|
95
|
+
;; allow outbound network traffic through proxy on localhost:8877
|
|
96
|
+
;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
|
|
97
|
+
;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
|
|
98
|
+
(allow network-outbound (remote tcp "localhost:8877"))
|
|
Binary file
|