@abhishek944/pi-classifier 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/COMPUTER_USE.md +117 -0
  3. package/README.md +268 -8
  4. package/dist/box-tool.d.ts +26 -0
  5. package/dist/box-tool.js +109 -0
  6. package/dist/box.d.ts +32 -0
  7. package/dist/box.js +148 -0
  8. package/dist/choices.d.ts +8 -0
  9. package/dist/choices.js +131 -0
  10. package/dist/classification-tree.d.ts +4 -0
  11. package/dist/classification-tree.js +143 -0
  12. package/dist/classify.d.ts +4 -2
  13. package/dist/classify.js +5 -2
  14. package/dist/computer-use-state.d.ts +9 -0
  15. package/dist/computer-use-state.js +160 -0
  16. package/dist/computer-use-tool.d.ts +52 -0
  17. package/dist/computer-use-tool.js +78 -0
  18. package/dist/computer-use-types.d.ts +132 -0
  19. package/dist/computer-use-types.js +1 -0
  20. package/dist/computer-use.d.ts +22 -0
  21. package/dist/computer-use.js +223 -0
  22. package/dist/config.js +44 -0
  23. package/dist/cost.d.ts +8 -0
  24. package/dist/cost.js +202 -0
  25. package/dist/extension.d.ts +164 -9
  26. package/dist/extension.js +164 -14
  27. package/dist/image-content.d.ts +12 -0
  28. package/dist/image-content.js +90 -0
  29. package/dist/index.d.ts +9 -1
  30. package/dist/index.js +3 -0
  31. package/dist/inputs.d.ts +11 -2
  32. package/dist/inputs.js +155 -131
  33. package/dist/providers.js +113 -100
  34. package/dist/tree.d.ts +4 -0
  35. package/dist/tree.js +136 -0
  36. package/dist/types.d.ts +113 -11
  37. package/dist/validation.js +63 -39
  38. package/package.json +2 -1
  39. package/src/box-tool.ts +145 -0
  40. package/src/box.ts +253 -0
  41. package/src/choices.ts +174 -0
  42. package/src/classification-tree.ts +181 -0
  43. package/src/classify.ts +16 -4
  44. package/src/computer-use-state.ts +145 -0
  45. package/src/computer-use-tool.ts +76 -0
  46. package/src/computer-use-types.ts +127 -0
  47. package/src/computer-use.ts +216 -0
  48. package/src/config.ts +55 -0
  49. package/src/cost.ts +250 -0
  50. package/src/extension.ts +191 -15
  51. package/src/image-content.ts +77 -0
  52. package/src/index.ts +18 -0
  53. package/src/inputs.ts +163 -185
  54. package/src/providers.ts +113 -119
  55. package/src/tree.ts +157 -0
  56. package/src/types.ts +117 -10
  57. package/src/validation.ts +62 -95
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ - Added the opt-in OpenAI Decisions `classifier_computer_use` tool for a bounded observe/select/act/verify loop through existing Cua Driver MCP tools and Pi permission hooks, without changing the normal classifier default.
6
+ - Added task-scoped semantic controls, supplied nonsecret fill values, explicit supervisor handoff/continuation, fresh observation on resume, cancellation and action limits, no-progress handback, and independent Driver completion predicates. Unknown input outcomes are never automatically replayed.
7
+ - Added validated programmatic in-memory image inputs shared with existing classifier adapters, avoiding per-step screenshot files. Window-only passive text supplements indexed controls, and unrelated global menu-bar branches are excluded.
8
+ - Added bounded decision evidence, stage timings and accumulated provider usage/cost estimates, plus computer-use setup, privacy, supported-scope and handoff guidance in `COMPUTER_USE.md`.
9
+
10
+ - Added named local images and explicit `{$image:id}` references in shared state, Jev/OpenAI question instructions and Jev criteria, while retaining legacy shared image paths.
11
+ - Added OpenAI hosted HTTP(S) image descriptors without local downloads. Unsupported image placements fail before provider requests; Jev batching includes only assets used by the current batch.
12
+ - Added the local-only `classifier_box_image` tool and `renderClassifierBox` export for inline PNG box overlays or crops, without provider calls or automatic file writes.
13
+ - Added current Perplexity v1.2/Flash/latest model catalog entries and support for up to eight Perplexity images. Corrected Jev's minimum side length to 280 pixels.
14
+ - Documented capability differences, image-reference semantics, remote-image limits, experimental box caveats and user-owned verification steps. Video and unverified gateway image support remain excluded.
15
+
16
+ Verification: typecheck, build, package dry run/content checks and whitespace checks passed. Real registered-tool Pi SDK/OpenAI/Cua Driver scenarios on a controlled native macOS window verified multi-action completion, missing-value handoff and supervisor resumption, no-predicate handback, nested hook blocking, action limits and cancellation. Direct source review passed; independent review was unavailable because of session-path tooling. No unit tests were added or run. General browser/Electron typing, arbitrary canvas targets and broad third-party-app coverage remain unverified; no comparative speedup is claimed.
17
+
18
+ ## 0.3.0
19
+
20
+ - Added `classify_tree` and `classifyTree` for nested `roots`/`id`/`description`/`children` classification trees supplied inline or as bounded local UTF-8 JSON files. Results contain selected Level1/Level2/etc, model-versus-automatic steps, partial statuses and accumulated token/cost/provider-call totals.
21
+ - Tree traversal skips sole-child model calls, reuses configured sibling choice batching, and pins the successful route across later levels. Zero-call chains return genuine zero usage/cost; greedy and structural-inference limits are explicit.
22
+ - Successful classification and comparison results now include estimated USD input/output/total cost with effective token rates, or an explicit unavailable reason instead of an assumed zero.
23
+ - Bundled standard rates for known official OpenAI Decisions, TypeSafe Jev, current Perplexity v1.2 and Cloudflare routes; model/deployment-keyed pricing overrides for custom endpoints, unverified prices and account-specific rates.
24
+ - Cache-aware cost calculation, optional reported cache usage, and documented provider choice limits. Costs are estimates, not invoices or Pi session billing totals.
25
+ - Removed the artificial 64-choice cap; known routes enforce their documented provider maximum. Optional `none_of_above_choice` and `remove_choice_limits` settings add NONE and sequential first-match batching. Enabling batching without NONE fails before provider requests.
26
+ - Explicit no-match/ambiguous outcomes, batch-local probability metadata, aggregate multi-call usage/cost and provider call counts. Unknown batching limits require verified provider `maxChoices`; later failures do not replay completed batches through fallback. The 32-question and byte/image/result protections remain.
27
+
28
+ Verification: typecheck, build, package dry run, whitespace checks, recursive tool-schema validation, and independent source reviews passed. No unit tests or live provider calls were run for this release. Classification-tree traversal is greedy; automatic sole-child steps are structural inference, not model confirmation. Bundled prices are estimates, not invoices, and unknown gateway/model limits require verified configuration for batching.
29
+
3
30
  ## 0.2.0
4
31
 
5
32
  - Microsoft Decision-1 via Foundry resource endpoints and deployment names, API-key authentication, and text/JSON bool/choice/score questions.
@@ -0,0 +1,117 @@
1
+ # Computer use with OpenAI Decisions
2
+
3
+ `classifier_computer_use` runs repeated observations, decisions, and Cua Driver actions inside one Pi tool invocation. Pi's main agent remains the supervisor: it owns planning, authorization, content generation, unsupported controls, and final task-level review. The classifier chooses only among supplied, currently grounded controls.
4
+
5
+ This first release supports **one exact accessibility-backed native window per chunk**. Screenshots can supplement semantic state; they do not enable arbitrary pixel targeting. OpenAI Decisions does not generate text, coordinates, scripts, or bounding boxes.
6
+
7
+ ## Enable explicitly
8
+
9
+ Add this to trusted Pi settings, preserving your existing classifier configuration:
10
+
11
+ ```json
12
+ {
13
+ "pi-classifier": {
14
+ "computerUse": {
15
+ "enabled": true,
16
+ "route": { "provider": "openai-api", "model": "gpt-6-luna" },
17
+ "screenshots": true,
18
+ "minConfidence": 0.75
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ Only `openai-api` is supported for computer use initially. Its normal configured endpoint and independent API-key resolution are reused. Missing credentials fail before a window observation. No provider fallback, automatic retry, comparison, sequential choice batching, or global default changes occur. Ordinary `classify` can continue using Jev.
25
+
26
+ The Cua Driver MCP server must already be configured and accessible as `mcp__cua_driver__*`. This extension does not install, launch, or reconfigure the daemon or request OS permissions. After installing/loading the updated extension, use `/reload` to expose the new tool.
27
+
28
+ **Privacy:** the selected endpoint receives the supplied goal, nonsecret values, bounded window labels/values, recent action summaries, and optional window screenshot. Use only the intended authorized window. Structured secure/password controls are excluded, but screenshots are not automatically redacted. Set `screenshots: false` for tree-only use. No screenshots or trajectory files are written by this feature. Do not pass passwords, tokens, payment information, or other secrets.
29
+
30
+ ## Supervisor workflow
31
+
32
+ 1. Resolve the intended app/account/window through Driver. Inspect its semantic controls. Prefer an existing app API or typed browser route when that is the reliable boundary.
33
+ 2. Define one bounded goal and permitted controls. Exact role and label are re-resolved on every observation. Controls can span later screens; their order is not a script. Duplicate matches are never selected arbitrarily.
34
+ 3. Supply reusable nonsecret values. Fill uses Driver `set_value`, which replaces native field values. It is not a reliable general browser/Electron typing implementation; use the supervisor's supported browser/input route for those widgets.
35
+ 4. Supply Driver completion predicates covering the entire requested result when possible. Every predicate requires an actual condition such as value, selection, enabled state, or existence.
36
+ 5. Call the tool and handle its result. Do not observe or mutate the same window in parallel; newer observations invalidate element tokens.
37
+
38
+ Example (replace PID, window ID, and semantic names with your actual observation):
39
+
40
+ ```js
41
+ classifier_computer_use({
42
+ goal: "Set City to Lisbon, apply it, and leave the resulting city visible.",
43
+ target: { pid: 1234, window_id: 5678 },
44
+ controls: [
45
+ { id: "city", operation: "fill", selector: { role: "AXTextField", label: "City" }, valueKey: "city" },
46
+ { id: "apply", operation: "click", selector: { role: "AXButton", label: "Apply" } }
47
+ ],
48
+ values: { city: "Lisbon" },
49
+ expect: [{ element: { selector: { role: "AXTextField", label_contains: "Result" }, value_equals: "Lisbon" } }],
50
+ maxActions: 10,
51
+ timeoutMs: 60000
52
+ });
53
+ ```
54
+
55
+ Actions supported:
56
+
57
+ - `click`: exact observed invokable/native control.
58
+ - `fill`: exact editable native field and supplied `valueKey`. Already matching values are not offered again. Values are single-line strings; control characters are rejected to avoid implicit submission/focus changes.
59
+ - `key`: one explicit permitted key addressed to an exact observed field/control. No global hotkeys or arbitrary modifiers.
60
+
61
+ The tool defaults to background delivery for clicks/keys. `deliveryMode: "foreground"` is an explicit supervisor choice after an observed background-delivery failure within the same authorized target. Announce the brief focus change and preserve user scope. Do not use it to bypass a refusal. Native `fill` uses Driver's semantic value route regardless of delivery mode; unsupported typing needs a handoff.
62
+
63
+ An allowlist scopes actions; **it does not grant consent**. The main agent must stop before unapproved purchases, sends, publishing, deleting valuable data, account/security changes, credentials, CAPTCHA, or OS consent. Existing Pi nested tool hooks and Driver authorization remain active. A model safety judgment is only additional evidence, not the permission boundary.
64
+
65
+ ## Explicit handoff and resumption
66
+
67
+ The result contains:
68
+
69
+ - `status`: `completed`, `handoff`, or `stopped`.
70
+ - `reason` and `message`: verified completion, missing value, supervisor help, low confidence, no progress, incomplete observation, loading timeout, action limit, cancellation/deadline, Driver failure, or failed verification.
71
+ - `actions`: every attempted action, including an interrupted action with `effect: "unknown"`.
72
+ - `metrics`: completed provider calls, token/cost estimates when available, stage durations, and `accountingIncomplete` when an interrupted/failed provider request might have been billed.
73
+ - `decision`: the last selected candidate, confidence, and selected probability, when available. These explain a handback without exposing raw model payloads.
74
+ - `handoff.continuation`: plain task arguments and bounded previous action summaries, **not** an executable capability, saved snapshot, queued action, or authorization token.
75
+
76
+ On missing text or unsupported work:
77
+
78
+ ```js
79
+ const next = result.handoff.continuation;
80
+ // The supervisor obtains/writes the nonsecret text or handles the unsupported step.
81
+ classifier_computer_use({
82
+ ...next,
83
+ values: { ...next.values, city: "Lisbon" },
84
+ context: "The requested city value is now supplied. Continue the original goal."
85
+ });
86
+ ```
87
+
88
+ Every chunk takes a fresh observation and asks for a new decision. No snapshot, pixel capture, or element token survives a handoff. The supervisor may adjust controls to match a later screen only when the original task authorizes those effects. If the application switched to a different native window, resolve it explicitly before updating the target.
89
+
90
+ **Unknown action outcome:** inspect application state before resuming. A timeout or tool error does not mean input was not applied. The extension records the attempt and never automatically retries it. No-progress after unverified input returns control rather than replaying a possible submission. Do not lower confidence simply to force progress; the threshold is an uncalibrated handback heuristic.
91
+
92
+ ## Completion and stopping
93
+
94
+ A Decisions `DONE` choice is only a claim. It may request read-only verification even below the mutation confidence threshold; it never dispatches uncertain input. With `expect`, the tool requests fresh `verify_state` evidence with two stable satisfied samples. Only all satisfied predicates yield `completed`. Unknown, ambiguous, or unsatisfied results hand back. The supervisor must still check that the predicates cover the **whole** goal and use application-owned state/reopen checks for saves when appropriate.
95
+
96
+ Without `expect`, `DONE` returns `handoff / needs_verification`. This supports visual or semantic goals that Driver predicates cannot independently express without making a false success claim.
97
+
98
+ The observation is bounded to 180 elements, depth 14, and a 1.5-second AX budget. Explicitly truncated/degraded trees hand back. Driver's indexed list omits passive text, so `elements_complete: false` alone is not treated as a truncated walk or evidence of absence. Bounded window-only passive text supplements indexed controls; global menu-bar branches are excluded, independently of their ordering. Missing or duplicate eligible control matches are never guessed. The default chunk is 20 actions and 60 seconds, with bounded waits and model decisions. Caller cancellation/deadline propagates to nested tools and HTTP, but cannot undo an OS event already dispatched. No blind batches or automatic rollback are attempted.
99
+
100
+ ## Programmatic use
101
+
102
+ The package exports `runComputerUse(params, { settings, cwd, callTool, signal?, onProgress? })`. `callTool` must dispatch through the host's real approval/tool pipeline and return the raw MCP `CallToolResult`. The Pi tool does this through `ctx.executeTool()`, unwrapping Pi's MCP result envelope. Do not substitute another SDK connection to evade approvals.
103
+
104
+ `classify(params, options)` additionally supports `options.memoryImages`, an array of `{bytes: Uint8Array, mimeType}`. These transient images pass the same byte/pixel/full-decode and route checks as files. They supplement shared input; named references still refer only to normal named descriptors. Model-facing `classify` parameters remain path/descriptor-based. New image ingress does not weaken local-path validation.
105
+
106
+ ## Design references
107
+
108
+ This is original implementation, not vendored code. Useful patterns were curated from:
109
+
110
+ - [Browser Use Jev Ultrafast](https://github.com/browser-use/jev-ultrafast): indexed grounded actions, code-owned loop, single decision round trip.
111
+ - [Ying-Kai-Liao/jev-browser](https://github.com/Ying-Kai-Liao/jev-browser): caller values and explicit handback statuses.
112
+ - [Decision Luna Browser Lab](https://github.com/humanity-forever/decision-luna-browse-control): independent completion and waiting evidence.
113
+ - [CUA-JEV](https://github.com/ZJU-REAL/CUA-JEV): legal candidate/executor boundary.
114
+ - [Jev Browser Use](https://github.com/wy-coliney/jev-browser-use): supervisor allowlists and resumption inside an existing connection.
115
+ - [0x7067/jev-browse](https://github.com/0x7067/jev-browse): explicit action phases and bounded progress history.
116
+
117
+ Their speed/reliability results are not performance claims for this extension. Driver pacing is unchanged; stage metrics should identify whether model inference, observation, or Driver waits dominate the actual workload.
package/README.md CHANGED
@@ -9,7 +9,7 @@ One configured default, optional selective fallback, and explicit model comparis
9
9
  Requires Node.js 22.19+ and Pi 1.2+. Install the tagged release from GitHub:
10
10
 
11
11
  ```sh
12
- pi install git:github.com/abhishek944/pi-classifier@v0.2.0
12
+ pi install git:github.com/abhishek944/pi-classifier@v0.4.0
13
13
  ```
14
14
 
15
15
  The Pi package entrypoint is TypeScript source, so Git installs do not depend on committed build artifacts or a TypeScript compiler. Runtime dependencies are installed by Pi. The compiled `dist` exports remain available for library consumers after a build.
@@ -30,7 +30,7 @@ To install persistently after trying it:
30
30
  pi install /absolute/path/to/pi-classifier
31
31
  ```
32
32
 
33
- The package version and Git tag are `0.2.0` / `v0.2.0`. Installation is explicit. This release is prepared for GitHub; npm publication is a separate manual step.
33
+ The package version and Git tag are `0.4.0` / `v0.4.0`. Installation is explicit. This release is prepared for GitHub; npm publication is a separate manual step.
34
34
 
35
35
  ## Configuration: same shape as pi-image-gen
36
36
 
@@ -84,7 +84,7 @@ Stored API-key values support literal strings and `$NAME`/`${NAME}` references,
84
84
  | ---------------- | --------------------- | ------------------------------------------------------------------ | -------------------- |
85
85
  | `microsoft-api` | `microsoft` | `Microsoft-Decision-1` (select your actual deployment name) | `AZURE_API_KEY` |
86
86
  | `openai-api` | `openai` | `gpt-6-luna` | `OPENAI_API_KEY` |
87
- | `perplexity-api` | `perplexity` | `pplx-decider-v1.1-27b`, `pplx-decider-v1-27b` | `PERPLEXITY_API_KEY` |
87
+ | `perplexity-api` | `perplexity` | `pplx-decider-v1.2`, `pplx-decider-flash-v1.2`, latest aliases, legacy v1/v1.1 IDs | `PERPLEXITY_API_KEY` |
88
88
  | `typesafe-api` | `typesafe` | `jev-latest`, `jev-1.13.0`, `jev-preview`, `jev-1.14.0` | `TYPESAFE_API_KEY` |
89
89
  | `cloudflare-api` | `cloudflare` | `@cf/cloudflare/clef`, `@cf/cloudflare/clef-flash`, `typesafe/jev` | `CLOUDFLARE_API_KEY` |
90
90
  | `openrouter-api` | `openrouter` | `typesafe/jev-1.13`, `~typesafe/jev-latest` | `OPENROUTER_API_KEY` |
@@ -130,10 +130,194 @@ classify({
130
130
  });
131
131
  ```
132
132
 
133
- The tool takes no provider/model parameter. Its structured result identifies the configured route and model, typed answers, reported token usage and an available request ID. `bool.probability` is the probability of true; `choice` includes a probability per label and confidence; `score` is a probability-weighted level index (starting at zero), not necessarily an integer. Refusals are explicit typed answers. Token counts are reported, but this initial version does not estimate monetary cost or add it to Pi's session billing totals.
133
+ The tool takes no provider/model parameter. Its structured result identifies the configured route and model, typed answers, reported token usage, estimated USD cost (or an explicit unavailable reason) and an available request ID. `bool.probability` is the probability of true; `choice` includes a probability per label and confidence; `score` is a probability-weighted level index (starting at zero), not necessarily an integer. Refusals are explicit typed answers. Token counts are reported when available. Each successful result includes `cost`; classifier spending is not added to Pi's session billing totals. See [Per-call costs](#per-call-costs).
134
134
 
135
135
  Provider results are checked for probability ranges/distribution sums and decision consistency (selected choices must be most likely; supplied score distributions must match the expected score within rounding tolerance). Low confidence is a valid answer, not an error. Calibrate thresholds on your own data; scores from different providers are not interchangeable.
136
136
 
137
+ ## Classification trees: `classify_tree`
138
+
139
+ Use `classify_tree` to follow a **nested classification tree**, rather than supply every leaf as one flat choice list. The extension orchestrates ordinary model decisions; this is not a native provider tree API. Existing `classify` and `classify_compare` behavior is unchanged.
140
+
141
+ A classification tree is an object with `roots`. Each node has an `id`, optional `description`, and optional `children`:
142
+
143
+ ```json
144
+ {
145
+ "roots": [
146
+ {
147
+ "id": "a",
148
+ "description": "Describe the domain covered by category a and its descendants.",
149
+ "children": [
150
+ { "id": "b", "children": [{ "id": "c" }] },
151
+ { "id": "c", "children": [{ "id": "d" }] }
152
+ ]
153
+ },
154
+ { "id": "c" },
155
+ { "id": "d", "children": [{ "id": "e" }] }
156
+ ]
157
+ }
158
+ ```
159
+
160
+ IDs must be non-empty, at most 128 characters, and unique **among siblings**. Root `c` and `a > c` are different nodes. Descriptions are at most 4096 characters; use meaningful descriptions to explain which parent branch to choose. Missing or empty `children` means leaf. Only `roots`, `id`, `description` and `children` are supported; internal-node stopping flags, path-list imports and graph references are not implemented.
161
+
162
+ Supply the same shape inline or by local file:
163
+
164
+ ```js
165
+ classify_tree({
166
+ state: "The content to classify",
167
+ tree: "./classification-tree.json",
168
+ instructions: "Choose the most appropriate category for this content."
169
+ });
170
+
171
+ classify_tree({
172
+ state: { ticket: "Refund requested for a duplicate payment." },
173
+ tree: {
174
+ roots: [
175
+ { id: "billing", description: "Charges, invoices and refunds" },
176
+ { id: "technical", description: "Errors, outages and integration problems" }
177
+ ]
178
+ }
179
+ });
180
+ ```
181
+
182
+ `instructions` is optional and at most 8192 characters. Text/JSON `state` and optional `images` use the existing classifier input rules, including named images referenced in state. Tree definitions and tree instructions remain text-only. No provider/model override is accepted. The library exports `classifyTree(params, { settings, cwd, signal? })` and the `ClassificationTree`, `ClassificationTreeNode`, `ClassifyTreeParams`, `TreeStep` and `ClassifierTreeResult` types.
183
+
184
+ ### Traversal and results
185
+
186
+ The example first chooses among `a`, `c` and `d`. After choosing `a`, it chooses between `b` and `c`. If it chooses `b`, its sole child `c` is automatic. Relevant result fields are:
187
+
188
+ ```json
189
+ {
190
+ "status": "complete",
191
+ "levels": { "Level1": "a", "Level2": "b", "Level3": "c" },
192
+ "steps": [
193
+ { "level": 1, "id": "a", "source": "model", "confidence": 0.9, "probabilityScope": "siblings" },
194
+ { "level": 2, "id": "b", "source": "model", "confidence": 0.8, "probabilityScope": "siblings" },
195
+ { "level": 3, "id": "c", "source": "automatic" }
196
+ ],
197
+ "providerCalls": 2
198
+ }
199
+ ```
200
+
201
+ The confidence values above are illustrative. Full results also identify the configured/selected provider and model and include estimated `cost` plus reported `usage` when complete. Model confidence describes its sibling decision (or one batch), **not the whole path**. No artificial confidence is assigned to automatic steps.
202
+
203
+ - A sole sibling is followed automatically, including a sole root. This is structural inference, not model confirmation. It intentionally bypasses a possible NONE rejection of that sole option even when NONE is enabled.
204
+ - An entirely forced chain makes **zero provider calls**, needs no API key, and returns genuine zero token usage and estimated zero cost. It still requires a valid configured route. `complete` means a leaf was reached, not that the model verified the input fits that chain.
205
+ - NONE, strict ties and refusals stop the traversal with `status: "no_match"`, `"ambiguous"` or `"refusal"`. `levels` and `steps` retain only the selected prefix; no deeper category is fabricated. Exact top ties stop even when NONE is disabled.
206
+ - The selected parent path and current sibling descriptions inform each question. Unselected descendant branches are not uploaded wholesale, so parent descriptions must explain their coverage. Selection is greedy and cannot recover a wrong parent; no global best-path or calibrated path-probability claim is made.
207
+ - Configured NONE/batching behavior applies at each branching node. A wide level can consume multiple provider requests; `providerCalls`, usage and cost account for inner batches and all completed model decisions. Missing usage or unavailable prices do not become complete-looking numeric subtotals.
208
+ - The first actual decision may use configured selective fallback. After a successful decision the actual provider/model is pinned for the rest of that traversal; later failures do not replay completed levels on another route. Failures/cancellation may still have billed completed work. Images use the ordinary classifier validation and upload behavior on each branching call.
209
+
210
+ ### Local-file and size limits
211
+
212
+ Classification trees must fit **2 MiB and 32 levels**; the full node structure is validated before any model call. Local files must be valid UTF-8 JSON regular files inside the session cwd with no symlink path components or URLs. Descriptor-based containment checks reuse the existing local-image boundary and support macOS/Linux; inline classification tree works on other platforms. Files are read once per `classify_tree` invocation; no persistent classification tree registry or cache is introduced.
213
+
214
+ Original classifier state/image/request protections remain. Each constructed branch question must fit the existing input limits, including its selected-path context. Tree results are bounded to 40 KiB. User-owned live verification should compare inline and file inputs, zero-call chains, deeper NONE/tie outcomes, wide sibling batching, and provider billing totals.
215
+
216
+ ## Per-call costs
217
+
218
+ Every successful `classify` result and each successful `classify_compare` entry includes one of:
219
+
220
+ ```json
221
+ {
222
+ "cost": {
223
+ "status": "estimated",
224
+ "currency": "USD",
225
+ "input": 0.000042,
226
+ "output": 0,
227
+ "total": 0.000042,
228
+ "source": "builtin",
229
+ "rates": { "inputPerMillion": 0.042, "outputPerMillion": 0 }
230
+ }
231
+ }
232
+ ```
233
+
234
+ This example uses 1,000 Jev input tokens. Amounts are not rounded to cents; doing so would hide most classifier charges. `source` is `builtin` for the bundled standard public rates or `configured` for explicit rates. `rates` contains the effective USD-per-million rates used. Multi-call choice processing sums all completed calls and uses `source: "aggregated"` without a single misleading rates table; `providerCalls` reports the number of completed provider requests. Usage is omitted if any completed call lacks usage, and aggregate cost is unavailable if any call lacks an estimate. These are estimates, not provider invoices: taxes, credits, free allowances, account discounts and unreported billable activity are not included. There is no network pricing lookup.
235
+
236
+ | Official route/model | Input USD / 1M tokens | Output USD / 1M tokens |
237
+ | --- | ---: | ---: |
238
+ | OpenAI Decisions `gpt-6-luna` | 0.10 | 0 |
239
+ | TypeSafe `jev-1.13.0`, `jev-1.14.0`, `jev-latest`, `jev-preview` | 0.042 | 0 |
240
+ | Perplexity `pplx-decider-v1.2`, `pplx-decider-latest`, `pplx-decider-v1.1-27b`, `pplx-decider-v1-27b` | 0.02 | 0 |
241
+ | Perplexity `pplx-decider-flash-v1.2`, `pplx-decider-flash-latest` | 0.01 | 0 |
242
+ | Cloudflare `@cf/cloudflare/clef` | 0.24 | 0 |
243
+ | Cloudflare `@cf/cloudflare/clef-flash` | 0.038 | 0 |
244
+ | Cloudflare `typesafe/jev` | 0.042 | 0 |
245
+
246
+ Sources: [OpenAI Decisions pricing](https://developers.openai.com/api/docs/guides/decisions#pricing-and-availability), [OpenAI rates](https://developers.openai.com/api/docs/pricing), [TypeSafe models](https://docs.typesafe.ai/models), [Perplexity Decisions](https://docs.perplexity.ai/docs/decisions/quickstart#pricing), [Clef](https://developers.cloudflare.com/workers-ai/models/clef/), [Clef Flash](https://developers.cloudflare.com/workers-ai/models/clef-flash/), [Cloudflare Jev](https://developers.cloudflare.com/ai/models/typesafe/jev/). Aliases can move and public prices can change; explicit overrides take precedence. Perplexity's [model names](https://docs.perplexity.ai/docs/decisions/quickstart#model-names) documentation maps the older v1/v1.1 IDs in the discovery catalog to v1.2 and bills them at its rate. New text model IDs may already be selected through settings, but this cost feature does not change image capability declarations.
247
+
248
+ When reported, cache reads and writes are exposed as `usage.cachedInputTokens` and `usage.cacheWriteTokens`. They are **included** in input tokens, not additional tokens. Input cost is `(ordinary input × input rate + cache reads × cached-input rate + cache writes × cache-write rate) / 1,000,000`; output cost uses its separate rate. OpenAI's bundled cached-input rate is $0.01/M and default 30-minute write rate is $0.125/M, with all input rates doubled above 272,000 input tokens. Cloudflare Jev's bundled cached-input rate is zero. Unexpected 12-hour writes are unavailable rather than priced as 30-minute writes.
249
+
250
+ If pricing or usable token counts are missing, `cost` is `{ "status": "unavailable", "currency": "USD", "reason": "unknown_pricing" }` (or `missing_usage`, `invalid_usage`, `missing_cache_pricing`, `calculation_overflow`). No numeric amounts are returned in that case. Zero means a calculated zero, never an unknown charge. Failed or cancelled calls may still be billable but do not have reliable cost results; a fallback success reports only the successful request, not a total for prior attempts. Comparison callers must not treat a sum of available estimates as complete if any entries failed or have unavailable costs.
251
+
252
+ ### Explicit deployment, gateway and custom pricing
253
+
254
+ Set `providers.<id>.pricing` to a map keyed by the **selected model ID** (Azure deployment name for Microsoft). Rates are non-negative finite USD per million tokens; input and output rates are required. Cache rates are optional, but reported cache activity needs the matching rate. Configured rates replace, rather than merge with, bundled rates. Custom providers accept the same `pricing` map.
255
+
256
+ ```json
257
+ {
258
+ "pi-classifier": {
259
+ "providers": {
260
+ "microsoft": {
261
+ "pricing": {
262
+ "my-decision-deployment": {
263
+ "inputPerMillion": 0.1,
264
+ "outputPerMillion": 0
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
270
+ }
271
+ ```
272
+
273
+ The numbers above are illustrative, **not a claim about Azure pricing**. Use your deployment's actual rates. Optional keys are `cachedInputPerMillion` and `cacheWritePerMillion`. Overrides specify effective rates; no automatic long-context multiplier is applied to them. Microsoft deployments, OpenRouter, unverified model IDs and custom or regional endpoints require verified explicit rates. Built-in prices apply only to exact known models on their official endpoint; a compatible gateway does not inherit the upstream provider's price. Misconfigured selected rates fail before a request; missing rates do not prevent classification.
274
+
275
+ ## Choice limits by provider
276
+
277
+ The artificial **64-choice cap has been removed** from both runtime validation and the tool schema. Known official model routes use their documented 255-option wire maximum. Unknown model/endpoint limits are left to the provider unless you configure `providers.<id>.maxChoices` (also available on custom providers). The package still accepts **1–32 questions per call**. The 128-character limit applies to an option's name, not to the option count.
278
+
279
+ | Provider/model | Documented upstream choice options per question | Evidence/qualification |
280
+ | --- | --- | --- |
281
+ | TypeSafe Jev | Up to 255 | [Choice docs](https://docs.typesafe.ai/primitives/choice); current Jev service documentation |
282
+ | OpenAI Decisions `gpt-6-luna` | 2–255 | [API reference](https://developers.openai.com/api/reference/resources/decisions/methods/create), confirmed from official indexed search results; direct reference fetch returned 404 during this investigation |
283
+ | Perplexity `pplx-decider-v1.2`, Flash v1.2 and documented aliases (including catalog v1/v1.1 IDs) | 1–255 | [Request limits](https://docs.perplexity.ai/docs/decisions/quickstart#request-limits) and [model names](https://docs.perplexity.ai/docs/decisions/quickstart#model-names) |
284
+ | Cloudflare Clef | 2–255 | [Official input schema](https://developers.cloudflare.com/workers-ai/models/clef/schema-input.json) |
285
+ | Cloudflare Clef Flash | 2–255 | [Official input schema](https://developers.cloudflare.com/workers-ai/models/clef-flash/schema-input.json) |
286
+ | Cloudflare-hosted Jev | Not independently verified | Do not assume direct-TypeSafe limits apply to every gateway |
287
+ | Microsoft Decision-1 | Not specified in the fetched guide | [Foundry guide](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/how-to/use-foundry-models-microsoft-decision) |
288
+ | OpenRouter-hosted Jev / custom routes | Endpoint-dependent; not verified | Requires the selected gateway/model's contract |
289
+
290
+ A documented upstream maximum is not a live deployment guarantee. Limits are matched to known model IDs on official endpoints; other deployments and gateways must not silently inherit an upstream model's limit. A configured `maxChoices` must be a safe integer of at least 2 and must reflect that endpoint's actual capability.
291
+
292
+ ### Optional NONE and sequential choice batching
293
+
294
+ Both settings default to `false`:
295
+
296
+ ```json
297
+ {
298
+ "pi-classifier": {
299
+ "none_of_above_choice": true,
300
+ "remove_choice_limits": true
301
+ }
302
+ }
303
+ ```
304
+
305
+ `remove_choice_limits: true` **requires** `none_of_above_choice: true`. Both `classify` and `classify_compare` reject an invalid pair before any provider request, with:
306
+
307
+ ```text
308
+ remove_choice_limits requires none_of_above_choice: true. No classifier request was sent.
309
+ ```
310
+
311
+ With only `none_of_above_choice` enabled, the extension adds a collision-safe internal NONE option to every choice question. That option consumes one slot: a 255-option provider can accept 254 real choices plus NONE in a single request. If the list exceeds that capacity while `remove_choice_limits` is false, the call fails locally with instructions to enable both flags or reduce the list.
312
+
313
+ With both flags enabled, the extension walks the choices in their JavaScript/JSON object enumeration order, sending at most `maxChoices - 1` real choices plus NONE per batch. On a 255-option model this is **254 + 1**. A question advances only if NONE's probability is **strictly greater than every real option's probability**, not merely because the provider picked NONE and not necessarily greater than 50%. A unique real winner ends that question. An exact tie for top probability returns `{ "type": "ambiguous" }`. If all batches reject, the answer is `{ "type": "no_match" }`. Typed refusals stop that question without advancing.
314
+
315
+ Batching is **sequential first-match selection**, not a global best-choice guarantee. An early acceptable result can hide a better later option, and NONE itself can be unreliable. Returned choice probabilities cover only the winning batch's real options, with `probabilityScope: "batch"` and a separate `noneOfAboveProbability`; those real probabilities plus NONE sum to approximately one. Unseen options are not assigned fabricated zeros. The internal NONE label is never returned as the selected real choice. Ordinary calls without these flags retain their previous answer shapes.
316
+
317
+ Multiple choice questions progress independently in shared rounds; settled questions and bool/score/box questions are not resent. Images are prepared once per selected route and included in the required requests. Each request may be billed. Usage and estimated cost cover all completed calls in a successful result, with `providerCalls` for transparency. A multi-call result omits a single `requestId` because no one ID represents every request. If a later request fails after partial completion, the operation may have incurred charges; HTTP 401/404/429 after completed batches does not replay the operation on a fallback route.
318
+
319
+ For an endpoint without a known limit, automatic batching fails before any request until you set its verified `providers.<id>.maxChoices` or `customProviders.<id>.maxChoices`. This setting does not remove context-window, input-byte, image, output-size, timeout or cancellation protections. The 2 MiB original text/questions limit and 40 KiB returned-result limit remain in place. No automatic tree construction, retrieval, hidden model switching or cross-batch probability normalization is performed.
320
+
137
321
  ## Microsoft Decision-1 on Foundry
138
322
 
139
323
  Deploy `Microsoft-Decision-1` in Microsoft Foundry, then configure the **resource endpoint**, API key, and actual **deployment name**:
@@ -156,11 +340,11 @@ The extension appends `/providers/microsoft/v1/systemone` and uses the `api-key`
156
340
 
157
341
  ## Fallback and explicit comparison
158
342
 
159
- `classify` uses the default first. It tries configured `fallback` entries in order **only** after a missing API key or an explicit HTTP **401, 404, or 429**. Each resolved endpoint/model is attempted at most once. When fallback is exercised, `attemptedRoutes` identifies the routes considered, including missing-key failures.
343
+ `classify` uses the default first. It tries configured `fallback` entries in order **only** after a missing API key or an explicit HTTP **401, 404, or 429**. Each resolved endpoint/model is selected at most once in the fallback chain; explicitly configured choice batching can make multiple requests on that selected route. When fallback is exercised, `attemptedRoutes` identifies the routes considered, including missing-key failures.
160
344
 
161
345
  No automatic fallback occurs after 403/policy refusal, 400/422, 5xx, timeout, network failure, cancellation, malformed answers, input/capability/configuration errors, low confidence, or typed refusals. Each candidate validates the original input against its own capabilities; incompatible images or box questions stop the chain, never silently drop input. Every attempted request has its own timeout. Crossing billing providers and sharing state with them happens only through explicitly configured route pairs. Omit `fallback` or use `[]` to disable it.
162
346
 
163
- Use **`classify_compare`** only when you explicitly want a model comparison. It accepts the same `{ state, questions, images? }` as `classify`, runs exactly the entries in `compare` sequentially, and never substitutes the default, uses fallback, or changes settings. Every entry is a separate potentially billable call. Responses contain labeled `results` with status, duration in milliseconds, typed answers/token usage on success, or safe errors. A failed entry does not discard successes. Duplicate endpoint/model entries report an error without another call. Cancellation retains completed results, records an in-flight cancellation when present, sets `cancelled`, and prevents later requests. Scores from different models are not assumed to be calibrated equally.
347
+ Use **`classify_compare`** only when you explicitly want a model comparison. It accepts the same `{ state, questions, images? }` as `classify`, runs exactly the entries in `compare` sequentially, and never substitutes the default, uses fallback, or changes settings. Every entry is a separate potentially billable classification; configured choice batching can make multiple provider requests for that entry. Responses contain labeled `results` with status, duration in milliseconds, typed answers/token usage and estimated cost (or an unavailable reason) on success, or safe errors. A failed entry does not discard successes. Duplicate endpoint/model entries report an error without another call. Cancellation retains completed results, records an in-flight cancellation when present, sets `cancelled`, and prevents later requests. Scores from different models are not assumed to be calibrated equally.
164
348
 
165
349
  You can also run `/classifier compare <JSON params>`, for example:
166
350
 
@@ -174,9 +358,11 @@ The library exports `compareClassifiers(params, { settings, cwd, signal? })`. Ne
174
358
 
175
359
  Pass `images: ["photo.png"]`. Images are attached in order alongside state. OpenAI, Perplexity and Clef/Clef Flash support images. Cloudflare-hosted Jev and the built-in OpenRouter route are text-only in this package.
176
360
 
177
- Image inputs are local non-animated PNG/JPEG/WebP regular files inside the session cwd, with no symlink components, URLs or inline base64. Safe descriptor-based loading currently supports macOS (requires the OS `/usr/sbin/lsof`) and Linux (`/proc`); other platforms support text classification only. Images are fully decoded locally before upload. Limits: five images; 5 MiB each, 10 MiB total and 16 megapixels each. Clef has stricter limits: four images, 4 MiB each and 8 MiB total. Perplexity requires at most 2048 tiles of 32×32 pixels per image; resize before sending. Images are not silently resized. Text/JSON plus questions are limited to 2 MiB, with at most 32 questions per call.
361
+ Local image inputs are non-animated PNG/JPEG/WebP regular files inside the session cwd, with no symlink components or inline base64. Safe descriptor-based loading supports macOS (requires the OS `/usr/sbin/lsof`) and Linux (`/proc`). Images are fully decoded locally before upload. Limits: five images on OpenAI/Jev, eight on Perplexity; 5 MiB each, 10 MiB total and 16 megapixels each. Clef has stricter limits: four images, 4 MiB each and 8 MiB total. Perplexity allows at most eight image occurrences in shared state, including repeated references, and requires at most 2048 tiles of 32×32 pixels per image. Images are not silently resized. Text/JSON plus questions remain limited to 2 MiB and 32 questions.
362
+
363
+ Named hosted URLs on OpenAI do not require local file loading and work on other platforms. They are passed directly to the selected OpenAI-compatible endpoint, never downloaded by this package. The provider must be able to access them and enforces remote image format/size limits; local byte/pixel validation cannot inspect them. URLs must use HTTP(S), with no credentials or fragment. Do not send sensitive URLs unless you intend to share them with that endpoint.
178
364
 
179
- TypeSafe Jev images are experimental and require opt-in. Use PNG/JPEG. Each side must be 256–1568 pixels, with total area 78,400–2,458,624 pixels; resize or pad beforehand. These limits also apply to custom SystemOne image routes using Jev's assets protocol:
365
+ TypeSafe Jev images are experimental and require opt-in. Use PNG/JPEG. Each side must be **280–1568 pixels**, with total area 78,400–2,458,624 pixels; resize or pad beforehand. These limits also apply to custom SystemOne image routes using Jev's assets protocol:
180
366
 
181
367
  ```json
182
368
  {
@@ -195,6 +381,73 @@ TypeSafe Jev images are experimental and require opt-in. Use PNG/JPEG. Each side
195
381
 
196
382
  With an image, a question such as `{ "type": "box", "instructions": "Find the mug in the first image." }` returns normalized `top`, `bottom`, `left`, `right` edges and confidence. Box needs Jev 1.14 (`jev-preview` or `jev-1.14.0`) and both opt-ins. It is not production-grade localization. A box does not mean the object exists: pair it with a bool existence question when necessary.
197
383
 
384
+ ### Named images and composable image content
385
+
386
+ Existing `images: ["photo.png"]` still attaches every image to shared state in order. Alternatively, use named descriptors:
387
+
388
+ ```json
389
+ {
390
+ "state": { "scene": { "$image": "scene" } },
391
+ "images": [
392
+ { "id": "scene", "path": "scene.png" },
393
+ { "id": "target", "path": "reference.jpg" }
394
+ ],
395
+ "questions": {
396
+ "present": {
397
+ "type": "bool",
398
+ "instructions": ["Does the scene contain the object shown here? ", { "$image": "target" }]
399
+ }
400
+ }
401
+ }
402
+ ```
403
+
404
+ Image IDs must be unique, 1–64 letters/digits/underscores/hyphens. Each named image must be referenced, and every reference must resolve. The exact object `{"$image":"id"}` is reserved for image references, not ordinary JSON data. Named images are not also attached automatically. Ordinary provider-looking JSON, such as an `image_url` key, remains text/data and cannot inject native image parts.
405
+
406
+ `instructions` and criterion descriptions accept either the existing text string or an ordered array of strings and image references. Jev preserves these as structured arrays with asset references. Other supported adapters concatenate adjacent text parts; include spaces/newlines where needed. For Jev, criterion descriptions can include visual examples:
407
+
408
+ ```json
409
+ {
410
+ "type": "choice",
411
+ "instructions": "Which reference most resembles the scene?",
412
+ "criteria": {
413
+ "good": ["Correct assembly: ", { "$image": "good_example" }],
414
+ "bad": ["Incorrect assembly: ", { "$image": "bad_example" }]
415
+ }
416
+ }
417
+ ```
418
+
419
+ Declare these images in the surrounding request's `images` list. The same content form works for each score level and bool true/false descriptions on Jev.
420
+
421
+ | Placement | Jev assets protocol | OpenAI Decisions | Perplexity Decisions | Clef / Flash |
422
+ | --- | --- | --- | --- | --- |
423
+ | Legacy shared local paths | Yes, opt-in | Yes | Yes | Yes |
424
+ | Named references in shared state | Yes, opt-in | Yes | Yes | No |
425
+ | Images in question instructions | Yes, opt-in | Yes | No | No |
426
+ | Images in criteria | Yes, opt-in | No | No | No |
427
+ | Named hosted URL descriptors | No | Yes | No | No |
428
+
429
+ For OpenAI, replace a named local descriptor with `{"id":"target","url":"https://example.com/reference.jpg"}` and reference it in state or instructions. Nested JSON state is represented as text fragments interleaved with the referenced images; it is not an upstream JSON object containing embedded native parts. Unsupported placements fail locally before a request, including on fallback and comparison routes. No image is silently dropped or moved.
430
+
431
+ Jev uploads each used named image once per provider call. Choice batching sends only assets referenced by that batch, so images used only by settled questions or later criteria are not sent unnecessarily. Reusing an image reference still counts each occurrence against Jev's expanded request limits; the server may reject a request after re-encoding/expansion. No automatic image splitting, resizing or multipart upload is performed.
432
+
433
+ ### Local bounding-box visualization and cropping
434
+
435
+ Use **`classifier_box_image`** with a local image and a returned normalized box:
436
+
437
+ ```json
438
+ {
439
+ "image": "scene.png",
440
+ "box": { "top": 0.25, "bottom": 0.82, "left": 0.44, "right": 0.84 },
441
+ "mode": "overlay"
442
+ }
443
+ ```
444
+
445
+ The default `overlay` mode draws the box. Set `mode: "crop"` to extract its region. This tool is local-only: no classifier request, provider charge, URL download or file write. It returns an inline PNG plus dimensions and the pixel-space box. Local input limits are 5 MiB and 16 megapixels; the PNG output is limited to 10 MiB. Coordinates refer to stored image dimensions, without automatic EXIF rotation. Verify you are using the same image that the provider evaluated.
446
+
447
+ The library exports `renderClassifierBox(params, { cwd, signal? })`, which returns PNG base64 data, MIME type, dimensions, pixel box and mode. Saving the result is the caller's responsibility. A box is not proof that an object exists; check existence separately.
448
+
449
+ Video descriptions in Cloudflare's model pages do not establish a hosted video API contract. Video, segmentation masks, multi-object box lists, image generation/editing and gateway image parity are not implemented.
450
+
198
451
  ## Custom providers
199
452
 
200
453
  Like image-gen, `customProviders` adds a named endpoint and explicit model list. Supported protocols are `openai-decisions`, `perplexity-decisions`, `system-one`, `cloudflare-system-one`, and `microsoft-system-one` (Foundry resource root and API-key authentication). A custom URL cannot make an arbitrary API compatible. Custom IDs must not shadow built-in provider/route IDs.
@@ -218,6 +471,10 @@ Like image-gen, `customProviders` adds a named endpoint and explicit model list.
218
471
 
219
472
  Custom endpoints use their route ID as the Pi stored-credential provider ID. They have no implicit environment variable; use an explicit key reference. SystemOne image endpoints must implement Jev's assets protocol, declare image input and opt into `experimentalImages`. Box additionally requires `box: true` on the model and `experimentalBox: true` on the provider.
220
473
 
474
+ ## Goal-running computer use (OpenAI Decisions)
475
+
476
+ The optional `classifier_computer_use` tool runs a bounded Cua Driver loop inside Pi, selecting only supervisor-permitted controls and returning explicit handoff/continuation when help is needed. It has a separate opt-in OpenAI route, preserves the normal classifier default, accepts transient Driver screenshots without disk files, and verifies completion through fresh Driver predicates. See [COMPUTER_USE.md](COMPUTER_USE.md) for setup, real input/output examples, safety limits, supervisor resumption and verification.
477
+
221
478
  ## Development and live verification
222
479
 
223
480
  ```sh
@@ -236,6 +493,9 @@ No provider calls are made by these commands. Live tests belong to the user:
236
493
  6. Configure your Foundry endpoint and deployment name, select `microsoft-api`, and verify bool/choice/score responses and token usage. Verify an image is rejected locally.
237
494
  7. Configure two `compare` pairs and explicitly invoke `classify_compare`; confirm labeled successes/errors, duration, unchanged defaults, and that cancellation prevents subsequent calls. Each valid entry may be billed.
238
495
  8. In your own controlled deployment, verify missing keys and HTTP 401/404/429 allow only configured fallbacks; duplicate routes are never called twice. Verify low confidence and refusals return normally without switching models.
496
+ 9. On Jev, enable the image/box flags and try the named scene/reference example above. Compare visual choice/score criteria, then a box plus a separate existence question. Verify repeated references and choice batching do not leave unreferenced assets. Try a 279-pixel side and confirm local rejection.
497
+ 10. On OpenAI, try one shared named local image plus a question-specific local image, then replace the latter with a public HTTPS descriptor. Confirm references stay in their intended placements. On Perplexity, try named state references and eight small images; instruction/criterion images should fail locally.
498
+ 11. Invoke `classifier_box_image` with the exact local scene and a returned box in both overlay and crop modes. Confirm pixel bounds and orientation visually, no files are written, invalid/reversed edges are rejected, and cancellation interrupts processing. Check EXIF-oriented photos carefully: no automatic rotation is applied.
239
499
 
240
500
  Provider schemas and previews can change; no live entitlement or model-accuracy claim is made by a local build.
241
501
 
@@ -0,0 +1,26 @@
1
+ import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { Type } from "typebox";
3
+ export declare const boxParameters: Type.TObject<{
4
+ image: Type.TString;
5
+ box: Type.TObject<{
6
+ top: Type.TNumber;
7
+ bottom: Type.TNumber;
8
+ left: Type.TNumber;
9
+ right: Type.TNumber;
10
+ }>;
11
+ mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"overlay">, Type.TLiteral<"crop">]>>;
12
+ }>;
13
+ export declare const boxOutput: Type.TObject<{
14
+ mode: Type.TUnion<[Type.TLiteral<"overlay">, Type.TLiteral<"crop">]>;
15
+ mimeType: Type.TLiteral<"image/png">;
16
+ width: Type.TInteger;
17
+ height: Type.TInteger;
18
+ pixelBox: Type.TObject<{
19
+ left: Type.TInteger;
20
+ top: Type.TInteger;
21
+ width: Type.TInteger;
22
+ height: Type.TInteger;
23
+ }>;
24
+ byteLength: Type.TInteger;
25
+ }>;
26
+ export declare function registerBoxTool(pi: ExtensionAPI): void;