obsbot-mcp 0.5.0 → 0.6.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.
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { FovType } from "../codec/commands.js";
2
3
  import { DeviceManager } from "../device/manager.js";
3
4
  import type { CaptureManager } from "../capture/manager.js";
4
5
  export interface ToolDef {
@@ -7,8 +8,57 @@ export interface ToolDef {
7
8
  schema: z.ZodTypeAny;
8
9
  handler: (args: unknown) => Promise<object>;
9
10
  }
11
+ /**
12
+ * Why {@link resolveMagnification} could not resolve a usable magnification.
13
+ * Carried explicitly rather than left for the caller to re-derive from
14
+ * `status.fovMode`, because that re-derivation is exactly the trap this type
15
+ * exists to close: it was correct for the two reasons that existed when it was
16
+ * written (an "if unknown, else assume corrupt zoom" fallthrough), but is not
17
+ * exhaustive — a third reason added later would silently be mislabelled as
18
+ * "implausible-zoom" by every caller doing that inference independently. One
19
+ * function decides the reason so there is exactly one place that has to be
20
+ * right.
21
+ */
22
+ export type MagnificationResult = {
23
+ ok: true;
24
+ magnification: number;
25
+ } | {
26
+ ok: false;
27
+ reason: "unknown-fov";
28
+ } | {
29
+ ok: false;
30
+ reason: "implausible-zoom";
31
+ zoomPercent: number;
32
+ };
33
+ /**
34
+ * The camera's total magnification relative to wide, from its reported state.
35
+ *
36
+ * A discrete FOV mode and a continuous zoom are two ways of writing to one
37
+ * scale, so this returns one number either way. Fails (`ok: false`) for
38
+ * anything that cannot be trusted:
39
+ * - `reason: "unknown-fov"` — the status byte didn't decode, a state to
40
+ * refuse on rather than guess at.
41
+ * - `reason: "implausible-zoom"` — a `"custom"` mode whose derived
42
+ * magnification falls outside the camera's known range
43
+ * [MIN_MAGNIFICATION, MAX_MAGNIFICATION] — a corrupt or implausible
44
+ * `zoomPercent` reading (e.g. a garbled status byte reporting
45
+ * zoomPercent > 100). Callers should refuse rather than pass this through:
46
+ * the geometry module's own guard (halfAngleTangents in src/geometry/aim.ts)
47
+ * would otherwise be the only thing standing between a bad reading and a
48
+ * silently wrong — or NaN/Infinity — aim.
49
+ */
50
+ export declare function resolveMagnification(status: {
51
+ fovMode: FovType | "custom" | "unknown";
52
+ zoomPercent: number;
53
+ }): MagnificationResult;
10
54
  export interface PresetReadOpts {
11
55
  attempts?: number;
12
56
  backoffMs?: number[];
13
57
  }
14
- export declare function createTools(mgr: DeviceManager, capture?: CaptureManager, debug?: boolean, presetRead?: PresetReadOpts): ToolDef[];
58
+ export interface ZoomSettleOpts {
59
+ pollMs?: number;
60
+ timeoutMs?: number;
61
+ /** Beat between the two status reads that decide whether the zoom is moving. */
62
+ motionPollMs?: number;
63
+ }
64
+ export declare function createTools(mgr: DeviceManager, capture?: CaptureManager, debug?: boolean, presetRead?: PresetReadOpts, zoomSettle?: ZoomSettleOpts): ToolDef[];