pantheon-opencode 1.6.1 → 1.6.2-beta.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 (115) hide show
  1. package/AGENTS.global.md +11 -11
  2. package/AGENTS.md +2 -2
  3. package/CHANGELOG.md +29 -0
  4. package/README.md +100 -19
  5. package/README.pt-BR.md +27 -11
  6. package/bin/pantheon-init.mjs +106 -19
  7. package/package.json +3 -2
  8. package/plugin.json +1 -1
  9. package/pyproject.toml +1 -1
  10. package/scripts/build-agents-md.mjs +1 -1
  11. package/scripts/doctor.mjs +213 -45
  12. package/scripts/install/agents-md.mjs +2 -1
  13. package/scripts/install/config-migration.mjs +344 -393
  14. package/scripts/install/config-paths.mjs +15 -0
  15. package/scripts/install/mcp-permissions.mjs +164 -0
  16. package/scripts/install/opencode-version.mjs +31 -13
  17. package/scripts/install/opencode-wildcard.mjs +106 -0
  18. package/scripts/install/opencode.mjs +240 -69
  19. package/scripts/install/plan-artifact.mjs +12 -1
  20. package/scripts/install/plugin.mjs +17 -1
  21. package/scripts/install/v2-capabilities.mjs +5 -6
  22. package/scripts/package-evidence.mjs +1 -0
  23. package/scripts/sandbox-env.sh +174 -0
  24. package/scripts/setup-v2-config.mjs +1703 -0
  25. package/scripts/setup.mjs +415 -0
  26. package/scripts/sync-tui.mjs +9 -1
  27. package/scripts/test-opencode-v2-sandbox.sh +438 -151
  28. package/scripts/update-skills-lock.mjs +30 -0
  29. package/skills-lock.json +10 -10
  30. package/src/agents/aphrodite.md +5 -2
  31. package/src/agents/apollo.md +5 -0
  32. package/src/agents/athena.md +6 -1
  33. package/src/agents/demeter.md +5 -1
  34. package/src/agents/gaia.md +4 -0
  35. package/src/agents/hephaestus.md +6 -1
  36. package/src/agents/hermes.md +6 -3
  37. package/src/agents/iris.md +5 -1
  38. package/src/agents/mnemosyne.md +20 -50
  39. package/src/agents/nyx.md +5 -1
  40. package/src/agents/prometheus.md +4 -0
  41. package/src/agents/talos.md +4 -0
  42. package/src/agents/themis.md +4 -0
  43. package/src/agents/zeus.md +9 -3
  44. package/src/instructions/agent-return-format.instructions.md +1 -1
  45. package/src/instructions/memory-protocol.instructions.md +3 -3
  46. package/src/instructions/test-economy.instructions.md +6 -6
  47. package/src/mcp/pantheon_vision.py +37 -36
  48. package/src/pantheon/cost-command.ts +30 -133
  49. package/src/pantheon/model-pricing.ts +1 -536
  50. package/src/pantheon/v2-vision.ts +34 -29
  51. package/src/pantheon/vision.ts +43 -10
  52. package/src/plugin-v2.ts +30 -53
  53. package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
  54. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js +749 -0
  55. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js.map +1 -0
  56. package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
  57. package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
  58. package/src/plugins/tui/dist/quota-adapters.js +1142 -0
  59. package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
  60. package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
  61. package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
  62. package/src/plugins/tui/dist/quota-cli.js +184 -0
  63. package/src/plugins/tui/dist/quota-cli.js.map +1 -0
  64. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js +684 -0
  65. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js.map +1 -0
  66. package/src/plugins/tui/dist/server-v2.d.ts +14 -0
  67. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
  68. package/src/plugins/tui/dist/server-v2.js +796 -0
  69. package/src/plugins/tui/dist/server-v2.js.map +1 -0
  70. package/src/plugins/tui/dist/tui-v2.d.ts +375 -53
  71. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  72. package/src/plugins/tui/dist/tui-v2.js +5876 -530
  73. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  74. package/src/plugins/tui/dist/tui.js +1 -1
  75. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js +118 -0
  76. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js.map +1 -0
  77. package/src/plugins/tui/dist/usage-history-worker.js +25 -0
  78. package/src/plugins/tui/dist/usage-history-worker.js.map +1 -0
  79. package/src/plugins/tui/index-v2.ts +3 -6
  80. package/src/plugins/tui/package-lock.json +17 -2
  81. package/src/plugins/tui/package.json +6 -3
  82. package/src/plugins/tui/src/context-gauge.ts +59 -0
  83. package/src/plugins/tui/src/cost-data.ts +607 -0
  84. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
  85. package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
  86. package/src/plugins/tui/src/index-v2.tsx +231 -240
  87. package/src/plugins/tui/src/model-pricing.ts +536 -0
  88. package/src/plugins/tui/src/model-usage-limits.ts +4 -0
  89. package/src/plugins/tui/src/quota-adapters.ts +1598 -0
  90. package/src/plugins/tui/src/quota-cli.ts +237 -0
  91. package/src/plugins/tui/src/quota-rpc.ts +373 -0
  92. package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
  93. package/src/plugins/tui/src/quota-v2.tsx +1238 -0
  94. package/src/plugins/tui/src/server-v2.ts +985 -0
  95. package/src/plugins/tui/src/sidebar-width.ts +129 -0
  96. package/src/plugins/tui/src/usage-history-contract.ts +217 -0
  97. package/src/plugins/tui/src/usage-history-validation.ts +104 -0
  98. package/src/plugins/tui/src/usage-history-view.tsx +236 -0
  99. package/src/plugins/tui/src/usage-history-worker.ts +25 -0
  100. package/src/plugins/tui/src/usage-view-model.ts +272 -0
  101. package/src/plugins/tui/tsconfig.typecheck.json +6 -1
  102. package/src/plugins/tui/tsdown.config.ts +44 -5
  103. package/src/routing.yml +72 -13
  104. package/src/skills/README.md +4 -0
  105. package/src/skills/agent-coordination/SKILL.md +0 -3
  106. package/src/skills/artifact-management/SKILL.md +0 -3
  107. package/src/skills/auto-continue/SKILL.md +0 -3
  108. package/src/skills/code-review-checklist/SKILL.md +0 -3
  109. package/src/skills/context-compression/SKILL.md +0 -3
  110. package/src/skills/memory-bank/SKILL.md +6 -28
  111. package/src/skills/session-goal/SKILL.md +0 -3
  112. package/src/skills/simplify/SKILL.md +5 -4
  113. package/src/skills/tdd-with-agents/SKILL.md +0 -3
  114. package/src/skills/visual-review-pipeline/SKILL.md +0 -1
  115. package/src/pantheon/memory-context.ts +0 -1017
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Configure a Pantheon sandbox without inheriting host user-data paths.
4
+ pantheon_validate_sandbox_path() {
5
+ local path="$1"
6
+ local current="/"
7
+ local component
8
+ local -a components
9
+ local LC_ALL=C
10
+
11
+ if [[ "$path" =~ [[:cntrl:]] || "$path" != /* ]]; then
12
+ printf 'ERROR: sandbox path validation failed.\n' >&2
13
+ return 2
14
+ fi
15
+
16
+ IFS='/' read -r -a components <<< "$path"
17
+ for component in "${components[@]}"; do
18
+ case "$component" in
19
+ '' | .) continue ;;
20
+ ..)
21
+ printf 'ERROR: sandbox path validation failed.\n' >&2
22
+ return 2
23
+ ;;
24
+ esac
25
+
26
+ if [[ "$current" == / ]]; then
27
+ current="/$component"
28
+ else
29
+ current="$current/$component"
30
+ fi
31
+ if [[ -L "$current" ]]; then
32
+ printf 'ERROR: sandbox path validation failed.\n' >&2
33
+ return 2
34
+ fi
35
+ done
36
+ return 0
37
+ }
38
+
39
+ pantheon_validate_sandbox_root() {
40
+ local sandbox_root="$1"
41
+ local LC_ALL=C
42
+
43
+ if [[ "$sandbox_root" =~ [[:cntrl:]] || "$sandbox_root" != /* ]]; then
44
+ printf 'ERROR: sandbox path validation failed.\n' >&2
45
+ return 2
46
+ fi
47
+
48
+ if [[ "$(pantheon_normalize_sandbox_path "$sandbox_root")" == / ]]; then
49
+ printf 'ERROR: sandbox path validation failed.\n' >&2
50
+ return 2
51
+ fi
52
+
53
+ pantheon_validate_sandbox_path "$sandbox_root"
54
+ }
55
+
56
+ pantheon_normalize_sandbox_path() {
57
+ local path="$1" component normalized=""
58
+ local -a components
59
+
60
+ IFS='/' read -r -a components <<< "$path"
61
+ for component in "${components[@]}"; do
62
+ case "$component" in
63
+ '' | .) continue ;;
64
+ esac
65
+ if [[ -z "$normalized" ]]; then
66
+ normalized="/$component"
67
+ else
68
+ normalized="$normalized/$component"
69
+ fi
70
+ done
71
+ printf '%s' "${normalized:-/}"
72
+ }
73
+
74
+ # Validate configurable file paths before a caller creates their parent
75
+ # directories or launches OpenCode. Reject traversal and symlink components
76
+ # first, then compare normalized absolute paths on complete component
77
+ # boundaries so a sibling such as sandbox-extra is not accepted.
78
+ pantheon_validate_sandbox_file_path() {
79
+ local sandbox_root="$1" file_path="$2" normalized_root normalized_file
80
+ local LC_ALL=C
81
+
82
+ if ! pantheon_validate_sandbox_root "$sandbox_root" >/dev/null 2>&1 \
83
+ || ! pantheon_validate_sandbox_path "$file_path" >/dev/null 2>&1; then
84
+ printf 'ERROR: sandbox config/database path validation failed.\n' >&2
85
+ return 2
86
+ fi
87
+
88
+ normalized_root="$(pantheon_normalize_sandbox_path "$sandbox_root")"
89
+ normalized_file="$(pantheon_normalize_sandbox_path "$file_path")"
90
+ if [[ "$normalized_file" == "$normalized_root"/* ]]; then
91
+ return 0
92
+ fi
93
+
94
+ printf 'ERROR: sandbox config/database path validation failed.\n' >&2
95
+ return 2
96
+ }
97
+
98
+ # The config's parent is passed as OPENCODE_CONFIG_DIR and may be used for
99
+ # reads/writes by OpenCode. Keep both the file and that parent strictly below
100
+ # the canonical sandbox root (not the root itself or its parent).
101
+ pantheon_validate_sandbox_config_path() {
102
+ local sandbox_root="$1" config_path="$2"
103
+ local normalized_root normalized_config normalized_parent config_parent
104
+ local LC_ALL=C
105
+
106
+ pantheon_validate_sandbox_file_path "$sandbox_root" "$config_path" || return $?
107
+ normalized_root="$(pantheon_normalize_sandbox_path "$sandbox_root")"
108
+ normalized_config="$(pantheon_normalize_sandbox_path "$config_path")"
109
+ config_parent="$(dirname "$config_path")"
110
+ normalized_parent="$(pantheon_normalize_sandbox_path "$config_parent")"
111
+
112
+ if [[ "$normalized_config" != "$normalized_root"/* \
113
+ || "$normalized_parent" == "$normalized_root" \
114
+ || "$normalized_parent" != "$normalized_root"/* ]]; then
115
+ printf 'ERROR: sandbox config/database path validation failed.\n' >&2
116
+ return 2
117
+ fi
118
+ }
119
+
120
+ pantheon_sandbox_env() {
121
+ local sandbox_root="$1"
122
+ local sandbox_home="$2"
123
+ local npm_prefix="$3"
124
+ local python_venv="$4"
125
+ local opencode_config_dir="$5"
126
+
127
+ pantheon_validate_sandbox_root "$sandbox_root" || return $?
128
+
129
+ export HOME="$sandbox_home"
130
+ export PATH="$npm_prefix/bin:$python_venv/bin:$PATH"
131
+ export npm_config_prefix="$npm_prefix"
132
+ export XDG_CONFIG_HOME="$sandbox_home/.config"
133
+ export XDG_CONFIG_DIRS="$sandbox_home/.config/xdg"
134
+ export XDG_DATA_HOME="$HOME/.local/share"
135
+ export XDG_DATA_DIRS="$sandbox_home/.local/share/xdg"
136
+ export XDG_STATE_HOME="$sandbox_home/.local/state"
137
+ export XDG_CACHE_HOME="$sandbox_home/.cache"
138
+ export XDG_RUNTIME_DIR="$sandbox_root/run"
139
+ export PANTHEON_HOME="$XDG_CONFIG_HOME/opencode"
140
+ export TMPDIR="$sandbox_root/tmp"
141
+ export TMP="$TMPDIR"
142
+ export TEMP="$TMPDIR"
143
+ export OPENCODE_CONFIG_DIR="$opencode_config_dir"
144
+ unset OPENCODE_CONFIG OPENCODE_CONFIG_CONTENT OPENCODE_CONFIG_PROJECT_DISABLE \
145
+ OPENCODE_DATA_DIR OPENCODE_STATE_DIR OPENCODE_CACHE_DIR OPENCODE_STORAGE_PATH
146
+ unset LOG_PATH
147
+ LOG_PATH="$XDG_DATA_HOME/opencode/log/opencode.log"
148
+
149
+ local path
150
+ local -a sandbox_paths=(
151
+ "$sandbox_root" "$sandbox_home" "$npm_prefix" "$python_venv" "$opencode_config_dir"
152
+ "$XDG_CONFIG_HOME" "$XDG_CONFIG_DIRS" "$XDG_DATA_HOME" "$XDG_DATA_DIRS"
153
+ "$XDG_STATE_HOME" "$XDG_CACHE_HOME" "$XDG_RUNTIME_DIR" "$PANTHEON_HOME" "$TMPDIR"
154
+ )
155
+ for path in "${sandbox_paths[@]}"; do
156
+ pantheon_validate_sandbox_path "$path" || return $?
157
+ done
158
+
159
+ (
160
+ umask 077
161
+ mkdir -p \
162
+ "$XDG_CONFIG_HOME" "$XDG_CONFIG_DIRS" \
163
+ "$XDG_DATA_HOME" "$XDG_DATA_DIRS" \
164
+ "$XDG_STATE_HOME" "$XDG_CACHE_HOME" \
165
+ "$PANTHEON_HOME" "$TMPDIR" "$XDG_RUNTIME_DIR"
166
+ ) || return $?
167
+
168
+ # Re-check after mkdir before chmod, in case a path component changed while
169
+ # the sandbox directories were being created.
170
+ for path in "${sandbox_paths[@]}"; do
171
+ pantheon_validate_sandbox_path "$path" || return $?
172
+ done
173
+ chmod 700 "$TMPDIR" "$XDG_RUNTIME_DIR" || return $?
174
+ }