bind directory completion to output descendants

This commit is contained in:
pewdiepie-archdaemon
2026-09-19 02:25:27 +00:00
parent 27affcdb58
commit f5e3119b10
4 changed files with 46 additions and 20 deletions
+27 -8
View File
@@ -625,16 +625,28 @@ def test_artifact_completion_schema_binds_single_required_file_without_mutating_
def test_artifact_completion_schema_binds_directory_descendant_but_not_multiple_outputs():
source = [{
'type': 'function',
'function': {
'name': 'write_file',
'parameters': {
'type': 'object',
'properties': {'path': {'type': 'string'}},
source = [
{
'type': 'function',
'function': {
'name': 'write_file',
'parameters': {
'type': 'object',
'properties': {'path': {'type': 'string'}},
},
},
},
}]
{
'type': 'function',
'function': {
'name': 'python',
'parameters': {
'type': 'object',
'properties': {'code': {'type': 'string'}},
},
},
},
]
directory_bound = artifact_completion_tool_schemas(
source, ('/workspace/results/',),
@@ -644,6 +656,13 @@ def test_artifact_completion_schema_binds_directory_descendant_but_not_multiple_
assert not re.search(directory_path['pattern'], '/workspace/results')
assert 'inside the required directory' in directory_path['description']
assert 'pattern' not in source[0]['function']['parameters']['properties']['path']
directory_code = directory_bound[1]['function']['parameters']['properties']['code']
assert re.search(
directory_code['pattern'],
"Path('/workspace/results/1.tex').write_text('table')",
)
assert not re.search(directory_code['pattern'], "Path('/workspace/source.tar').unlink()")
assert 'non-empty files inside' in directory_code['description']
assert artifact_completion_tool_schemas(
source, ('/workspace/a.txt', '/workspace/b.txt'),
) == source
+1 -1
View File
@@ -8,7 +8,7 @@ ROOT = Path(__file__).resolve().parents[1]
def test_original_harness_version_is_canonical_semver() -> None:
version = (ROOT / "HARNESS_VERSION").read_text(encoding="utf-8").strip()
assert version == "0.20.14"
assert version == "0.20.15"
assert re.fullmatch(r"\d+\.\d+\.\d+", version)