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
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ include_content = true

[extra]
version = "1.21.16"
release_version = "1.21.19"
release_version = "1.21.20"

navbar_items = [
{ code = "en", nav_items = [
Expand Down
19 changes: 19 additions & 0 deletions scripts/test_agent_hooks_publication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Bind hook claims to actual captured failures, correction and executed output."""
import ast
import re
import hashlib
import json
from pathlib import Path
Expand Down Expand Up @@ -52,6 +54,23 @@ def test_bundle_proves_hook_result_and_execution_separately(self):
digest, name = row.split(' ', 1)
self.assertEqual(hashlib.sha256(z.read(name)).hexdigest(), digest)

def test_host_prompt_delimits_an_allowed_command(self):
with zipfile.ZipFile(MEDIA / 'harbour-hooks-example.zip') as z:
tree = ast.parse(z.read('reproduce.py').decode())
prompt = next(ast.literal_eval(n.value) for n in tree.body
if isinstance(n, ast.Assign)
and any(isinstance(t, ast.Name) and t.id == 'prompt' for t in n.targets))
commands = re.findall(r'```sh\n([^`]+)\n```', prompt)
self.assertEqual(commands, ['python3 validate-brief.py --chek'])
config = json.loads(z.read('fixture/opencode.json'))
allowed = {p['resource'] for p in config['permissions']
if p['action'] == 'shell' and p['effect'] == 'allow'}
self.assertEqual(allowed, {'python3 validate-brief.py --chek',
'python3 validate-brief.py --check'})
self.assertIn(commands[0], allowed)
self.assertNotIn(commands[0] + ' .', allowed)
self.assertIn('Do not repair it or add arguments, punctuation', prompt)

def test_article_preserves_scope_and_downloads(self):
page = (ROOT / 'content/how-tos/command-rewriting-howto.md').read_text()
self.assertIn('date=2026-04-15', page)
Expand Down
Binary file modified static/demos/agent-hooks/harbour-hooks-example.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions static/demos/agent-hooks/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
},
{
"file": "harbour-hooks-example.zip",
"sha256": "f17baaaf504380209e9574d0990336d517a66f974a6f9bf27bbbab704c9acb71",
"bytes": 30326
"sha256": "bc5e8277a99dc6a7434b723a5ca0c3f20a34449b6a4527ab0721f988dd4eea45",
"bytes": 30482
},
{
"file": "screenshots/executed-result.jpg",
Expand Down
Loading