@wxp212/gemini-cli 0.28.3-2

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 (117) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +393 -0
  3. package/bundle/builtin/skill-creator/SKILL.md +382 -0
  4. package/bundle/builtin/skill-creator/scripts/init_skill.cjs +235 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +102 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +127 -0
  7. package/bundle/docs/architecture.md +80 -0
  8. package/bundle/docs/assets/connected_devtools.png +0 -0
  9. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  10. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  13. package/bundle/docs/assets/release_patch.png +0 -0
  14. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  15. package/bundle/docs/assets/theme-ansi.png +0 -0
  16. package/bundle/docs/assets/theme-atom-one.png +0 -0
  17. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  18. package/bundle/docs/assets/theme-ayu.png +0 -0
  19. package/bundle/docs/assets/theme-custom.png +0 -0
  20. package/bundle/docs/assets/theme-default-light.png +0 -0
  21. package/bundle/docs/assets/theme-default.png +0 -0
  22. package/bundle/docs/assets/theme-dracula.png +0 -0
  23. package/bundle/docs/assets/theme-github-light.png +0 -0
  24. package/bundle/docs/assets/theme-github.png +0 -0
  25. package/bundle/docs/assets/theme-google-light.png +0 -0
  26. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  27. package/bundle/docs/changelogs/index.md +743 -0
  28. package/bundle/docs/changelogs/latest.md +338 -0
  29. package/bundle/docs/changelogs/preview.md +437 -0
  30. package/bundle/docs/cli/authentication.md +3 -0
  31. package/bundle/docs/cli/checkpointing.md +94 -0
  32. package/bundle/docs/cli/cli-reference.md +101 -0
  33. package/bundle/docs/cli/commands.md +430 -0
  34. package/bundle/docs/cli/creating-skills.md +80 -0
  35. package/bundle/docs/cli/custom-commands.md +315 -0
  36. package/bundle/docs/cli/enterprise.md +582 -0
  37. package/bundle/docs/cli/gemini-ignore.md +71 -0
  38. package/bundle/docs/cli/gemini-md.md +108 -0
  39. package/bundle/docs/cli/generation-settings.md +210 -0
  40. package/bundle/docs/cli/headless.md +388 -0
  41. package/bundle/docs/cli/index.md +65 -0
  42. package/bundle/docs/cli/keyboard-shortcuts.md +141 -0
  43. package/bundle/docs/cli/model-routing.md +42 -0
  44. package/bundle/docs/cli/model.md +62 -0
  45. package/bundle/docs/cli/rewind.md +51 -0
  46. package/bundle/docs/cli/sandbox.md +171 -0
  47. package/bundle/docs/cli/session-management.md +158 -0
  48. package/bundle/docs/cli/settings.md +141 -0
  49. package/bundle/docs/cli/skills.md +112 -0
  50. package/bundle/docs/cli/system-prompt.md +125 -0
  51. package/bundle/docs/cli/telemetry.md +826 -0
  52. package/bundle/docs/cli/themes.md +235 -0
  53. package/bundle/docs/cli/token-caching.md +20 -0
  54. package/bundle/docs/cli/trusted-folders.md +95 -0
  55. package/bundle/docs/cli/tutorials/skills-getting-started.md +97 -0
  56. package/bundle/docs/cli/tutorials.md +87 -0
  57. package/bundle/docs/cli/uninstall.md +65 -0
  58. package/bundle/docs/core/index.md +107 -0
  59. package/bundle/docs/core/memport.md +246 -0
  60. package/bundle/docs/core/policy-engine.md +305 -0
  61. package/bundle/docs/core/remote-agents.md +84 -0
  62. package/bundle/docs/core/subagents.md +191 -0
  63. package/bundle/docs/core/tools-api.md +131 -0
  64. package/bundle/docs/examples/proxy-script.md +83 -0
  65. package/bundle/docs/extensions/best-practices.md +139 -0
  66. package/bundle/docs/extensions/index.md +45 -0
  67. package/bundle/docs/extensions/reference.md +336 -0
  68. package/bundle/docs/extensions/releasing.md +183 -0
  69. package/bundle/docs/extensions/writing-extensions.md +281 -0
  70. package/bundle/docs/faq.md +154 -0
  71. package/bundle/docs/get-started/authentication.md +321 -0
  72. package/bundle/docs/get-started/configuration-v1.md +880 -0
  73. package/bundle/docs/get-started/configuration.md +1602 -0
  74. package/bundle/docs/get-started/examples.md +219 -0
  75. package/bundle/docs/get-started/gemini-3.md +101 -0
  76. package/bundle/docs/get-started/index.md +71 -0
  77. package/bundle/docs/get-started/installation.md +141 -0
  78. package/bundle/docs/hooks/best-practices.md +677 -0
  79. package/bundle/docs/hooks/index.md +164 -0
  80. package/bundle/docs/hooks/reference.md +322 -0
  81. package/bundle/docs/hooks/writing-hooks.md +450 -0
  82. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  83. package/bundle/docs/ide-integration/index.md +202 -0
  84. package/bundle/docs/index.md +123 -0
  85. package/bundle/docs/integration-tests.md +211 -0
  86. package/bundle/docs/issue-and-pr-automation.md +134 -0
  87. package/bundle/docs/local-development.md +128 -0
  88. package/bundle/docs/mermaid/context.mmd +103 -0
  89. package/bundle/docs/mermaid/render-path.mmd +64 -0
  90. package/bundle/docs/npm.md +62 -0
  91. package/bundle/docs/quota-and-pricing.md +158 -0
  92. package/bundle/docs/release-confidence.md +164 -0
  93. package/bundle/docs/releases.md +540 -0
  94. package/bundle/docs/sidebar.json +152 -0
  95. package/bundle/docs/tools/file-system.md +216 -0
  96. package/bundle/docs/tools/index.md +98 -0
  97. package/bundle/docs/tools/mcp-server.md +1068 -0
  98. package/bundle/docs/tools/memory.md +54 -0
  99. package/bundle/docs/tools/shell.md +260 -0
  100. package/bundle/docs/tools/todos.md +57 -0
  101. package/bundle/docs/tools/web-fetch.md +59 -0
  102. package/bundle/docs/tools/web-search.md +42 -0
  103. package/bundle/docs/tos-privacy.md +96 -0
  104. package/bundle/docs/troubleshooting.md +173 -0
  105. package/bundle/gemini.js +538280 -0
  106. package/bundle/policies/discovered.toml +8 -0
  107. package/bundle/policies/plan.toml +86 -0
  108. package/bundle/policies/read-only.toml +51 -0
  109. package/bundle/policies/write.toml +78 -0
  110. package/bundle/policies/yolo.toml +32 -0
  111. package/bundle/sandbox-macos-permissive-closed.sb +32 -0
  112. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  113. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  114. package/bundle/sandbox-macos-restrictive-closed.sb +93 -0
  115. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  116. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  117. package/package.json +154 -0
@@ -0,0 +1,8 @@
1
+ # Default policy for tools discovered via toolDiscoveryCommand.
2
+ # These tools are potentially dangerous as they are arbitrary scripts.
3
+ # We default them to ASK_USER for safety.
4
+
5
+ [[rule]]
6
+ toolName = "discovered_tool_*"
7
+ decision = "ask_user"
8
+ priority = 10
@@ -0,0 +1,86 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 20: Plan mode catch-all DENY override (becomes 1.020 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ # Catch-All: Deny everything by default in Plan mode.
29
+
30
+ [[rule]]
31
+ decision = "deny"
32
+ priority = 20
33
+ modes = ["plan"]
34
+ deny_message = "You are in Plan Mode - adjust your prompt to only use read and search tools."
35
+
36
+ # Explicitly Allow Read-Only Tools in Plan mode.
37
+
38
+ [[rule]]
39
+ toolName = "glob"
40
+ decision = "allow"
41
+ priority = 50
42
+ modes = ["plan"]
43
+
44
+ [[rule]]
45
+ toolName = "grep_search"
46
+ decision = "allow"
47
+ priority = 50
48
+ modes = ["plan"]
49
+
50
+ [[rule]]
51
+ toolName = "list_directory"
52
+ decision = "allow"
53
+ priority = 50
54
+ modes = ["plan"]
55
+
56
+ [[rule]]
57
+ toolName = "read_file"
58
+ decision = "allow"
59
+ priority = 50
60
+ modes = ["plan"]
61
+
62
+ [[rule]]
63
+ toolName = "google_web_search"
64
+ decision = "allow"
65
+ priority = 50
66
+ modes = ["plan"]
67
+
68
+ [[rule]]
69
+ toolName = "ask_user"
70
+ decision = "ask_user"
71
+ priority = 50
72
+ modes = ["plan"]
73
+
74
+ [[rule]]
75
+ toolName = "exit_plan_mode"
76
+ decision = "ask_user"
77
+ priority = 50
78
+ modes = ["plan"]
79
+
80
+ # Allow write_file for .md files in plans directory
81
+ [[rule]]
82
+ toolName = "write_file"
83
+ decision = "allow"
84
+ priority = 50
85
+ modes = ["plan"]
86
+ argsPattern = "\"file_path\":\"[^\"]+/\\.gemini/tmp/[a-f0-9]{64}/plans/[a-zA-Z0-9_-]+\\.md\""
@@ -0,0 +1,51 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ [[rule]]
29
+ toolName = "glob"
30
+ decision = "allow"
31
+ priority = 50
32
+
33
+ [[rule]]
34
+ toolName = "grep_search"
35
+ decision = "allow"
36
+ priority = 50
37
+
38
+ [[rule]]
39
+ toolName = "list_directory"
40
+ decision = "allow"
41
+ priority = 50
42
+
43
+ [[rule]]
44
+ toolName = "read_file"
45
+ decision = "allow"
46
+ priority = 50
47
+
48
+ [[rule]]
49
+ toolName = "google_web_search"
50
+ decision = "allow"
51
+ priority = 50
@@ -0,0 +1,78 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ [[rule]]
29
+ toolName = "replace"
30
+ decision = "ask_user"
31
+ priority = 10
32
+
33
+ [[rule]]
34
+ toolName = "replace"
35
+ decision = "allow"
36
+ priority = 15
37
+ modes = ["autoEdit"]
38
+
39
+ [rule.safety_checker]
40
+ type = "in-process"
41
+ name = "allowed-path"
42
+ required_context = ["environment"]
43
+
44
+ [[rule]]
45
+ toolName = "save_memory"
46
+ decision = "ask_user"
47
+ priority = 10
48
+
49
+ [[rule]]
50
+ toolName = "run_shell_command"
51
+ decision = "ask_user"
52
+ priority = 10
53
+
54
+ [[rule]]
55
+ toolName = "write_file"
56
+ decision = "ask_user"
57
+ priority = 10
58
+
59
+ [[rule]]
60
+ toolName = "activate_skill"
61
+ decision = "ask_user"
62
+ priority = 10
63
+
64
+ [[rule]]
65
+ toolName = "write_file"
66
+ decision = "allow"
67
+ priority = 15
68
+ modes = ["autoEdit"]
69
+
70
+ [rule.safety_checker]
71
+ type = "in-process"
72
+ name = "allowed-path"
73
+ required_context = ["environment"]
74
+
75
+ [[rule]]
76
+ toolName = "web_fetch"
77
+ decision = "ask_user"
78
+ priority = 10
@@ -0,0 +1,32 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ [[rule]]
29
+ decision = "allow"
30
+ priority = 999
31
+ modes = ["yolo"]
32
+ 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") "/.gemini"))
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,27 @@
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") "/.gemini"))
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
+ (literal "/dev/ptmx")
26
+ (regex #"^/dev/ttys[0-9]*$")
27
+ )
@@ -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") "/.gemini"))
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") "/.gemini"))
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") "/.gemini"))
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") "/.gemini"))
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"))