feat(messaging): balanced TOOL parsing, DM shorthand, box.exec, tools.list
- response-harvester: extract [TOOL]/[EXEC] JSON args with balanced-brace
scanning (']' and nesting inside args no longer truncate calls); add
[DM {...}] shorthand mapping to dm.send; native aliases (dm, box,
tools) plus arg-synonym normalization; formatters and expanded hints.
- exec-constrained: new read-only box.exec op (27 allowlisted box-ctl
reads) and tools.list op backed by --list-ops for dynamic discovery.
- prompt_envelope: advertise dm.send/box.exec/tools.list in every timer
DM; add dm_call builder.
- lookup_engine + regex_patterns.json: canonical tool_call pattern
accepts the DM engine, ']' in args, one nesting level.
- tests/test_tool_calls.py: 38 tests; docs/INBAND-MESSAGING-SPEC.md:
accepted decision record (Final).
This commit is contained in:
@@ -99,18 +99,20 @@
|
||||
},
|
||||
"tool_call": {
|
||||
"name": "In-Band Tool Execution Call",
|
||||
"pattern": "\\[(?P<engine>TOOL|EXEC)\\s+(?P<op>[a-zA-Z0-9_.-]+)\\s+(?P<args>\\{.*?\\})\\]",
|
||||
"pattern": "\\[(?P<engine>TOOL|EXEC|DM)\\s+(?:(?P<op>[a-zA-Z0-9_.-]+)\\s+)?(?P<args>\\{([^{}]|\\{[^{}]*\\})*\\})\\]",
|
||||
"flags": ["DOTALL"],
|
||||
"description": "Matches synthesized inline tool execution directives with JSON arguments.",
|
||||
"description": "Matches inline tool directives with JSON args (one nesting level; response-harvester.py scans balanced braces for arbitrary depth). DM carries no op (implies dm.send).",
|
||||
"named_groups": {
|
||||
"engine": "Either TOOL or EXEC",
|
||||
"op": "Target operation name (e.g. followup.create, swarm.spawn)",
|
||||
"args": "Valid JSON string of argument parameters"
|
||||
"engine": "TOOL, EXEC, or DM (DM implies dm.send)",
|
||||
"op": "Target operation (e.g. followup.create, swarm.spawn); absent for DM",
|
||||
"args": "JSON argument object; may contain ']' and one level of nested objects"
|
||||
},
|
||||
"test_samples": {
|
||||
"valid": [
|
||||
"[TOOL followup.create {\"in_m\": 5, \"prompt\": \"check\"}]",
|
||||
"[EXEC health.check {\"verbose\": true}]"
|
||||
"[EXEC health.check {\"verbose\": true}]",
|
||||
"[TOOL box.exec {\"action\": \"job-get\", \"arg\": \"a-b[0]\"}]",
|
||||
"[DM {\"to\": \"pip\", \"target\": \"pip tasks\", \"message\": \"hi\"}]"
|
||||
],
|
||||
"invalid": [
|
||||
"[TOOL followup.create without args]",
|
||||
|
||||
Reference in New Issue
Block a user