v0.4.0 — batch + scale (SPEC-4) - #9
Merged
Merged
Conversation
- auto mode: serial loop → mapWithConcurrency (bounded by batchConcurrency) - one batch-level AbortController replaces per-image timers (autoDelegateTimeoutMs = total batch budget) - autoDelegateOne takes the shared signal (no own controller) - autoDelegateTimeoutMs clamp min lowered 5000→1000ms (enables sane 1s batch budgets + testable) - T48/T49/T52 pass (parallel + batch timeout + hint paths)
- describe_image: +image_paths param (Type.Array), normalizeImagePaths (schema-tolerant: stringified-array coercion per edit.js:36 precedent) - batch execute: mapWithConcurrency (bounded by batchConcurrency), per-image resilience (failed image → [error: …] section, not whole-batch fail), isError only when all fail - single-image path byte-for-byte back-compat (mode=delegate, raw text) - MAX_BATCH_IMAGES=50 hard cap + actionable errors (no paths, over cap) - /vision batch-concurrency subcommand + panel row - T43-T47f pass (batch basic, 10-image parallel, partial fail, all fail, back-compat, merge/dedup, stringified, empty, cap, subcommand)
- T51: /tmp/pi-clipboard-<uuid>.png path detected + markered + attached (guards the §3.3 finding that pi routes clipboard→tempfile→path) - T53: regression gate (full suite green = T1-T52 intact)
- new 'Batch + scale (v0.4.0)' section: image_paths, parallel delegation, batchConcurrency, MAX_BATCH_IMAGES, structured result, parallel auto mode, hint-mode path exposure, clipboard-paste-via-path - /vision batch-concurrency + /vision preview subcommand rows - describe_image param table: +image_paths, optional image_path, details.batch traceability
…import (challenge step) - export normalizeImagePaths from vision.ts + 16 unit tests (merge/dedup/stringified-array/invalid-JSON/whitespace/non-string/no-normalization edge cases) - T44: tighten maxObserved assertion to >=4 (conclusively rules out serial execution, not just >=1) - remove dead clearSharedState import from paste.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes PRD gap #8 (batch handling). Third epic of the 5-epic roadmap (3/5 → 4/5 shipped).
What
describe_image— additiveimage_paths: string[]param (alongside back-compatimage_path). Parallel delegation via bounded concurrency, structured order-stable result, per-image resilience (a failed image is an[error: …]section, not a whole-batch fail). Hard capMAX_BATCH_IMAGES=50. Single-image calls byte-for-byte back-compat (mode=delegate).mapWithConcurrency; one batch-levelAbortControllerreplaces per-image timers (autoDelegateTimeoutMsis now the total batch budget).lib/batch.ts— new puremapWithConcurrencyhelper (bounded concurrency, order-preserving, reject-propagating).buildHintLinenow lists the image paths + names theimage_pathsbatch affordance, so a text-only primary can actually invokedescribe_image(v0.3.x erased paths to markers, leaving the hint naming an uncallable tool).ctrl+v→readClipboardImage()→/tmp/pi-clipboard-<uuid>.png→ editor path (interactive-mode.js:2055), which our existing path-token pipeline already handles. Building a parallel clipboard-byte pipeline would be redundant (Israf). Regression guard test added.Verified pi API facts (PLAN-4 §1)
Type.Arrayparams render to the provider (proven by built-inedittool,edit.js:19).normalizeImagePathscoerces (mirrorsedit.js:36prepareEditArguments).ctx.signalis defined during tool execution (PLAN-3 §1.3) — the batch uses it directly, no extra timeout.Tests (TDD)
286 pass, typecheck clean. T43–T53 added (28 new tests):
batchConcurrency=5→ maxObserved ≥4 (conclusive parallelism gate, clears PRD "10+ images" bar)[error: …], others succeed,isErrorfalse)isErrortrue)mode=delegate, raw text)/vision batch-concurrencysubcommandmapWithConcurrencyunit tests, 11buildHintLine/buildBatchToolResultunit tests, 16normalizeImagePathsunit tests, 11batchConcurrency/MAX_BATCH_IMAGESconfig testsConfig
batchConcurrency(default 5, clamp 1–20) +/vision batch-concurrencysubcommand + panel row.autoDelegateTimeoutMsclamp min lowered 5000→1000ms (enables sane 1s batch budgets + makes batch-timeout testable). Minor SPEC-3 amendment, documented in the commit.MAX_BATCH_IMAGES = 50(code constant, not user-settable).Pipeline
SPEC ✅ → PLAN ✅ → IMPL ✅ (TDD, one commit per feature) → EVAL (automated ✅; real-pi manual pending RECTOR) → PUBLISH (after merge →
git tag v0.4.0→ CI auto-publish).Specs:
~/Documents/secret/strategy/getpipher/vision/SPEC-4-batch-and-scale.md+PLAN-4-batch-and-scale.md.Constraints met
pnpm typecheck && pnpm test:rungreen after every step.lib/batch.tsis stateless (no globalThis needed); no new shared module-level state.handleInputchanges).