Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pointman OpenCode client
# Pointman OpenCode harness

A standalone client extension for OpenCode **2.2.1**, using the machine's existing
A standalone harness extension for OpenCode **2.2.1**, using the machine's existing
OpenCode sign-in. Its official icon is recorded in ICON-SOURCE.md.

Requires Pointman node **0.4.3 or newer with AGC-75 support**: `opencode-stream`,
Expand Down Expand Up @@ -68,7 +68,7 @@ in `tests/fixtures/mcp-contract.json`.

Private `XDG_CONFIG_HOME` keeps the machine's user config out of agent runs.
Effective config and remember/recall runs were verified with OpenCode 2.2.1 on
mac-m4. No Python or database preflight runs before the client starts.
mac-m4. No Python or database preflight runs before the harness starts.
If OpenCode produces no stdout within 120 seconds, the node ends the run with
"OpenCode didn't start" and the timeout, rather than waiting silently.

Expand Down
22 changes: 11 additions & 11 deletions extension.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[extension]
id = "opencode"
name = "OpenCode"
version = "0.1.1"
node = ">=0.4.3"
version = "0.2.0"
node = ">=0.6,<1"
publisher = "aurelio"
summary = "OpenCode with the machine's sign-in and private agent configuration."

[client]
[harness]
binaries = ["opencode"]
protocol = "opencode-stream"
home_env = "HOME"
# Prevent ambient provider keys from replacing the machine's saved sign-in.
api_keys = ["ZAI_API_KEY", "ZHIPUAI_API_KEY", "ZHIPU_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "OPENCODE_API_KEY"]

[client.install]
[harness.install]
# Official binaries are checksum-verified and repacked by this repository.
from = "release"
repo = "pointman-ai/pointman-opencode"
asset = "opencode-{platform}.tar.gz"

[client.sign_in]
[harness.sign_in]
how = "opencode auth login (in your normal machine environment)"

[client.run]
[harness.run]
prompt = "arg"
args = ["run", "--standalone", "--format", "json", "{session}", "{permissions}", "{model}", "--", "{prompt}"]
new_session = ["--session", "{value}"]
resume = ["--session", "{value}"]
model = ["-m", "{value}"]

[client.run.env]
[harness.run.env]
XDG_CONFIG_HOME = "{home}/.config"
OPENCODE_CONFIG_DIR = "{home}/.config/opencode"
XDG_STATE_HOME = "{home}/.local/state"
Expand All @@ -43,22 +43,22 @@ OPENCODE_DISABLE_CLAUDE_CODE = "1"
OPENCODE_DISABLE_CLAUDE_CODE_SKILLS = "1"
# XDG_DATA_HOME and OPENCODE_DB require runtime resolution, never static paths.

[client.run.permissions]
[harness.run.permissions]
default = ["--auto"]
auto = ["--auto"]
# The node refuses acceptEdits: --auto would also approve shell/tools.
acceptEdits = []
plan = ["--agent", "plan"]

[client.instructions]
[harness.instructions]
via = "prompt"

[client.mcp]
[harness.mcp]
via = "config-file"
file = ".config/opencode/opencode.json"
key = "mcp"
# opencode-stream runtime translates servers to native remote/local shapes.
settings = { model = "zai-coding-plan/glm-5.3" }

[client.limits]
[harness.limits]
words = ["rate limit", "rate_limit", "too many requests", "quota exceeded", "usage limit", "insufficient balance"]
2 changes: 1 addition & 1 deletion scripts/repack.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def repack(data, target, pin, output):
output.mkdir(parents=True, exist_ok=True)
name = f'opencode-{target}'
dest = output / f'{name}.tar.gz'
# Exact root filename is required by node/src/clients.rs release().
# Exact root filename is required by the node's harness release install.
members = [(name, executable, 0o755),
('LICENSE.opencode', (ROOT / 'LICENSE.opencode').read_bytes(), 0o644),
('upstream.json', (json.dumps(pin, indent=2) + '\n').encode(), 0o644)]
Expand Down
34 changes: 17 additions & 17 deletions tests/test_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

ROOT = Path(__file__).resolve().parents[1]
MANIFEST = tomllib.loads((ROOT / 'extension.toml').read_text())
CLIENT = MANIFEST['client']
HARNESS = MANIFEST['harness']


class Contract(unittest.TestCase):
def test_install_requires_reviewed_release(self):
self.assertEqual(MANIFEST['extension']['id'], 'opencode')
self.assertEqual(CLIENT['protocol'], 'opencode-stream')
self.assertEqual(CLIENT['binaries'], ['opencode'])
self.assertEqual(CLIENT['install'], {'from': 'release', 'repo': 'pointman-ai/pointman-opencode', 'asset': 'opencode-{platform}.tar.gz'})
self.assertNotIn('npm', CLIENT)
self.assertEqual(HARNESS['protocol'], 'opencode-stream')
self.assertEqual(HARNESS['binaries'], ['opencode'])
self.assertEqual(HARNESS['install'], {'from': 'release', 'repo': 'pointman-ai/pointman-opencode', 'asset': 'opencode-{platform}.tar.gz'})
self.assertNotIn('npm', HARNESS)

def test_exact_session_and_prompt_boundary(self):
run = CLIENT['run']
run = HARNESS['run']
self.assertEqual(run['prompt'], 'arg')
for name in ('new_session', 'resume'):
self.assertEqual(run[name], ['--session', '{value}'])
Expand All @@ -33,8 +33,8 @@ def test_exact_session_and_prompt_boundary(self):
self.assertFalse({'--continue', '--server', '--fork'} & set(run['args']))

def test_private_config_without_hardcoding_machine_data(self):
self.assertEqual(CLIENT['home_env'], 'HOME')
env = CLIENT['run']['env']
self.assertEqual(HARNESS['home_env'], 'HOME')
env = HARNESS['run']['env']
for name in ('XDG_CONFIG_HOME', 'XDG_CACHE_HOME', 'XDG_STATE_HOME',
'OPENCODE_CONFIG_DIR', 'OPENCODE_CONFIG', 'OPENCODE_TEST_HOME'):
self.assertTrue(env[name].startswith('{home}'), name)
Expand All @@ -44,19 +44,19 @@ def test_private_config_without_hardcoding_machine_data(self):
for name in ('OPENCODE_CONFIG_PROJECT_DISABLE', 'OPENCODE_DISABLE_PROJECT_CONFIG',
'OPENCODE_DISABLE_CLAUDE_CODE', 'OPENCODE_DISABLE_CLAUDE_CODE_SKILLS'):
self.assertEqual(env[name], '1')
self.assertEqual(env['OPENCODE_CONFIG'], '{home}/' + CLIENT['mcp']['file'])
self.assertEqual(env['OPENCODE_CONFIG'], '{home}/' + HARNESS['mcp']['file'])

def test_no_vault_key_or_offline_account_probe(self):
for name in ('credentials', 'commands', 'permissions'):
self.assertNotIn(name, MANIFEST)
self.assertNotIn('key', CLIENT)
self.assertNotIn('check', CLIENT['sign_in'])
self.assertIn('ZAI_API_KEY', CLIENT['api_keys'])
self.assertNotIn('key', HARNESS)
self.assertNotIn('check', HARNESS['sign_in'])
self.assertIn('ZAI_API_KEY', HARNESS['api_keys'])

def test_behaviours_model_and_permission_mapping(self):
self.assertEqual(CLIENT['instructions'], {'via': 'prompt'})
self.assertEqual(CLIENT['mcp']['settings']['model'], 'zai-coding-plan/glm-5.3')
permissions = CLIENT['run']['permissions']
self.assertEqual(HARNESS['instructions'], {'via': 'prompt'})
self.assertEqual(HARNESS['mcp']['settings']['model'], 'zai-coding-plan/glm-5.3')
permissions = HARNESS['run']['permissions']
self.assertEqual(permissions['default'], ['--auto'])
self.assertEqual(permissions['acceptEdits'], [])
self.assertEqual(permissions['plan'], ['--agent', 'plan'])
Expand All @@ -72,7 +72,7 @@ def test_mcp_fixture_preserves_headers_and_argument_boundaries(self):
local = before['local_example']
self.assertEqual(after['local_example']['command'], [local['command'], *local['args']])
self.assertEqual(after['local_example']['environment'], local['env'])
self.assertEqual(CLIENT['mcp']['key'], 'mcp')
self.assertEqual(HARNESS['mcp']['key'], 'mcp')

def test_code_evidence_is_versioned_without_runtime_data(self):
e = json.loads((ROOT / 'research/installed-evidence.json').read_text())
Expand All @@ -93,7 +93,7 @@ def test_v2_help_in_synthetic_home(self):
for kind in ('DATA', 'CONFIG', 'CACHE', 'STATE'):
env[f'XDG_{kind}_HOME'] = str(root / kind.lower())
env.update({key: value.replace('{home}', folder)
for key, value in CLIENT['run']['env'].items()})
for key, value in HARNESS['run']['env'].items()})
def probe(*args):
result = subprocess.run([binary, *args], cwd=folder, env=env,
capture_output=True, text=True, timeout=20)
Expand Down
Loading