fix(filesystem): require metadata evidence in chat

This commit is contained in:
BukeLy 2026-05-26 16:25:51 +08:00
parent 8ae94ade19
commit 5c948d0840
2 changed files with 22 additions and 0 deletions

View file

@ -79,6 +79,17 @@ class PIFSAgentStreamTest(unittest.TestCase):
self.assertEqual(stream_log[1]["kind"], "tool_result")
self.assertEqual(stream_log[2], {"kind": "tool_args", "text": '{"command":"ls /"}'})
def test_empty_tool_command_is_not_printed_or_logged(self):
output = io.StringIO()
stream_log = []
observer = PIFSAgentStreamObserver("tools", stream_log=stream_log, output=output)
observer.emit_tool_call("")
observer.emit_tool_call(" ")
self.assertEqual(output.getvalue(), "")
self.assertEqual(stream_log, [])
def test_tool_result_preview_compacts_large_outputs(self):
output = io.StringIO()
observer = PIFSAgentStreamObserver("tools", output=output)
@ -188,6 +199,11 @@ class PIFSAgentStreamTest(unittest.TestCase):
self.assertIn("page-level evidence", AGENT_TOOL_POLICY)
self.assertIn("prefer\ncat <path> --node <node_id>", BASH_TOOL_DESCRIPTION)
def test_prompt_requires_stat_for_metadata_questions(self):
self.assertIn("stat --schema and stat <target>", AGENT_TOOL_POLICY)
self.assertIn("do not infer metadata presence or absence", AGENT_TOOL_POLICY)
self.assertIn("questions about metadata fields", BASH_TOOL_DESCRIPTION)
def test_system_prompt_sets_workspace_identity_and_scope(self):
self.assertIn("PageIndex FileSystem Demo Agent", AGENT_SYSTEM_PROMPT)
self.assertIn("VectifyAI Team", AGENT_SYSTEM_PROMPT)