File size: 5,912 Bytes
0cac2f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
{
  "protocol_id": "zoomlynx",
  "protocol_version": "zoomlynx",
  "tool": {
    "function": {
      "description": "Crop a selected region from any currently visible image and, when useful under the frozen environment policy, return a super-resolved view. Raw crop evidence is always returned; model-visible arguments are limited to image_idx and bbox_2d.",
      "name": "zoom_and_super_resolve",
      "parameters": {
        "additionalProperties": false,
        "properties": {
          "bbox_2d": {
            "description": "Normalized xyxy coordinates [x1,y1,x2,y2] relative to image_idx; x1<x2 and y1<y2.",
            "items": {
              "maximum": 1000,
              "minimum": 0,
              "type": "integer"
            },
            "maxItems": 4,
            "minItems": 4,
            "type": "array"
          },
          "image_idx": {
            "description": "Index of a currently visible image. The original image is always index 0.",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "image_idx",
          "bbox_2d"
        ],
        "type": "object"
      }
    },
    "type": "function"
  },
  "executor": {
    "automatic_scale_policy": [
      {
        "condition": "raw_crop_short_side < 112 and raw_crop_long_side * 4 <= 2048",
        "scale": 4
      },
      {
        "condition": "raw_crop_short_side < 224 and raw_crop_long_side * 2 <= 2048",
        "scale": 2
      },
      {
        "condition": "otherwise",
        "scale": 1
      }
    ],
    "budget_charge_policy": "Every invocation attempt made while remaining_zoom_calls is positive consumes one call, including invalid arguments and SR service failures. A rejected call after the budget reaches zero consumes nothing.",
    "image_index_policy": "Successful raw crops and SR crops are appended to the visible image registry in placeholder order. Nested calls may reference either output. Every image record keeps its parent image and mapped bbox in the original image.",
    "implementation": "inference/zoom_sr_executor.py",
    "max_zoom_calls": 3,
    "maximum_sr_output_side_pixels": 2048,
    "minimum_crop_side_pixels": 8,
    "raw_crop_policy": "The raw crop is the exact clamped pixel crop after EXIF transpose and RGB conversion. It is saved losslessly as PNG and is never replaced by a GT crop or learned enhancement.",
    "request_timeout_seconds": 600,
    "sr_endpoint": "http://127.0.0.1:9049/v1/sr/upscale",
    "sr_method": "realesrgan",
    "sr_out_format": "PNG"
  },
  "observation_contract": {
    "error_codes": [
      "INVALID_ARGUMENTS",
      "IMAGE_INDEX_OUT_OF_RANGE",
      "INVALID_BBOX",
      "CROP_TOO_SMALL",
      "BUDGET_EXHAUSTED",
      "SR_SERVICE_ERROR",
      "INTERNAL_ERROR"
    ],
    "image_placeholder_order": [
      "raw_crop.image",
      "super_resolved_crop.image when sr.applied is true"
    ],
    "partial_success_policy": "If the raw crop succeeds but SR fails, return partial_success with the raw image, SR_SERVICE_ERROR metadata, and the remaining budget. Never fabricate or silently substitute an SR image.",
    "status_values": [
      "success",
      "partial_success",
      "error"
    ],
    "success_required_fields": [
      "status",
      "protocol_version",
      "parent_image_idx",
      "bbox_2d",
      "bbox_pixel",
      "bbox_in_original_pixel",
      "bbox_in_original_2d",
      "raw_crop",
      "super_resolved_crop",
      "sr",
      "remaining_zoom_calls"
    ]
  },
  "terminal_contract": {
    "answer": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "answer"
        },
        "answer": {
          "pattern": "^<reasoning>[\\s\\S]*</reasoning><answer>[\\s\\S]+</answer>$",
          "type": "string"
        }
      },
      "required": [
        "action",
        "answer"
      ],
      "type": "object"
    },
    "serialization": "The final assistant content is one compact JSON object. The answer field contains exactly one <reasoning>...</reasoning> followed by exactly one <answer>...</answer>. Evaluation extracts only the answer tag content.",
    "stop": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "stop"
        },
        "answer": {
          "pattern": "^<reasoning>[\\s\\S]*</reasoning><answer>[\\s\\S]+</answer>$",
          "type": "string"
        },
        "reason": {
          "enum": [
            "ambiguous_query",
            "budget_exhausted",
            "external_knowledge_required",
            "insufficient_visual_evidence",
            "missing_required_evidence",
            "target_not_found",
            "tool_error_unrecoverable"
          ]
        }
      },
      "required": [
        "action",
        "reason",
        "answer"
      ],
      "type": "object"
    }
  },
  "agent_interaction_contract": {
    "causal_observation_order": "An assistant turn may reason only from the original image and tool observations returned before that turn. It must never describe, assume, or cite the result of a pending tool call.",
    "first_tool_turn_visible_evidence": [
      "original_image"
    ],
    "parameter_placement": "Exact image_idx, bbox_2d, pixel coordinates, and complete function arguments appear only in the tool call, never in assistant prose.",
    "pre_tool_assistant_content": {
      "forbidden_content": [
        "unreturned_tool_observation",
        "image_idx",
        "bbox_2d",
        "pixel_coordinates",
        "complete_function_arguments"
      ],
      "required": true,
      "required_semantics": [
        "currently_visible_evidence",
        "evidence_gap",
        "natural_language_target_region"
      ]
    },
    "tool_result_analysis_turn": "A Raw/SR observation may first be analyzed by the assistant turn after the matching tool response."
  }
}