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
5 changes: 4 additions & 1 deletion docs/PLUGIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,10 @@ open-vocabulary. On a repository you do not trust, leave micro-skills off (the d
`PreToolUse` hook that prints `{}` makes agy deny the tool, so none is registered;
`PostToolUse` carries no tool result and a matcher `"*"` never matches, so the results are read
from the conversation's `transcript_full.jsonl` at the next `PreInvocation` and at `Stop`, where
every result of the previous model call is already written (`trace/antigravity.py`). There is no
every result of the previous model call is already written (`trace/antigravity.py`). The reader
also takes `write_file` and `edit_file` (with `Path`), the names reported from Antigravity
Desktop's transcripts, as Write and Edit; the plugin has not been run with Antigravity Desktop.
There is no
prompt event and no `SessionEnd`: a prompt is the `PreInvocation` with `invocationNum` 0, and a
conversation is folded by the next session start in its repository once its transcript has been
quiet for ten minutes. Context goes back as `injectSteps`: a persistent `systemMessage` at
Expand Down
19 changes: 19 additions & 0 deletions tests/test_antigravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,25 @@ def test_running_steps_system_rows_and_finish_do_not_shift_the_pairing(tp):
assert [(i["args"]["command"], i["exit_code"]) for i in items] == [("ls", 0)]


def test_write_file_and_edit_file_read_as_write_and_edit(tp, tmp_path):
"""`write_file` and `edit_file` (with `Path`), the names reported from Antigravity Desktop's
transcripts, read as Write and Edit, as agy's own file tools do."""
t = Transcript(tp)
t.prompt("add a helper")
t.call([("write_file", {"Path": "/work/repo/src/helper.py"})], [("ok", {"type": "CODE_ACTION"})])
t.call([("edit_file", {"Path": "/work/repo/src/helper.py"})], [("ok", {"type": "CODE_ACTION"})])
items, _offset, _last = trace.antigravity_read(str(tp), offset=0, after=-1, final=True)
assert [(i["name"], i["args"], i["is_error"]) for i in items if i["kind"] == "tool"] == [
("Write", {"file_path": "/work/repo/src/helper.py"}, False),
("Edit", {"file_path": "/work/repo/src/helper.py"}, False)]
work = tmp_path / "w"
work.mkdir()
path = Antigravity().mechanism_trace(str(tp), str(work))
assert [(tool, args) for tool, args, _text, _ok in trace.load_trajectory(path)] == [
("Write", {"file_path": "/work/repo/src/helper.py"}),
("Edit", {"file_path": "/work/repo/src/helper.py"})]


# ---- agy's answer --------------------------------------------------------------------------
def test_render_answers_each_event_in_agys_terms():
host = Antigravity()
Expand Down
2 changes: 2 additions & 0 deletions tokeneconomizer/trace/antigravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"run_command": ("Bash", {"command": ("CommandLine",)}),
"view_file": ("Read", {"file_path": _FILE}),
"read_file": ("Read", {"file_path": _FILE}),
"write_file": ("Write", {"file_path": _FILE}),
"write_to_file": ("Write", {"file_path": _FILE}),
"edit_file": ("Edit", {"file_path": _FILE}),
"replace_file_content": ("Edit", {"file_path": _FILE}),
"multi_replace_file_content": ("Edit", {"file_path": _FILE}),
"sed_file": ("Edit", {"file_path": _FILE}),
Expand Down
Loading