@switchbot/openapi-cli 3.6.1 โ†’ 3.6.2

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.
package/README.md CHANGED
@@ -63,7 +63,7 @@ Under the hood every surface shares the same catalog, cache, and HMAC client โ€”
63
63
  - ๐ŸŽจ **Dual output modes** โ€” colorized tables by default; `--json` passthrough for `jq` and scripting
64
64
  - ๐Ÿ” **Secure credentials** โ€” HMAC-SHA256 signed requests; config file written with `0600`; env-var override for CI
65
65
  - ๐Ÿ” **Dry-run mode** โ€” preview every mutating request before it hits the API
66
- - ๐Ÿงช **Fully tested** โ€” 2391 Vitest tests, mocked axios, zero network in CI
66
+ - ๐Ÿงช **Fully tested** โ€” 2465 Vitest tests, mocked axios, zero network in CI
67
67
  - โšก **Shell completion** โ€” Bash / Zsh / Fish / PowerShell
68
68
 
69
69
  ## Requirements
@@ -244,7 +244,8 @@ With a policy.yaml (v0.2) you can declare automations that the CLI
244
244
  executes for you. Supported triggers: **MQTT** (device events),
245
245
  **cron** (schedule-driven), and **webhook** (local HTTP POST).
246
246
  Supported conditions: `time_between` (quiet hours), `device_state`
247
- (live API check with per-tick dedup), and `llm` (AI decision โ€” see
247
+ (live API check with per-tick dedup), `event_count` (rolling-window
248
+ counts over per-device history), and `llm` (AI decision โ€” see
248
249
  below). Every fire is recorded in `~/.switchbot/audit.log`. `rules run` is long-running; use
249
250
  `daemon start` / `daemon reload` for the managed background mode.
250
251
 
@@ -272,14 +273,22 @@ then:
272
273
  conditions:
273
274
  - llm:
274
275
  prompt: "Is the temperature above normal comfort range?"
275
- provider: auto # auto | openai | anthropic
276
+ provider: auto # auto | openai | anthropic | local
276
277
  cache_ttl: 5m
277
278
  budget:
278
279
  max_calls_per_hour: 20
280
+ max_tokens_per_hour: 100000 # optional rolling 1h token cap
281
+ max_cost_per_day_usd: 1.00 # optional rolling 24h USD cap
279
282
  on_error: pass # fail | pass | skip
280
283
  ```
281
284
 
282
- Set `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`. `rules lint` flags misconfigured LLM conditions.
285
+ Set `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` for the cloud providers.
286
+ For `provider: local`, point `SWITCHBOT_LOCAL_LLM_URL` at any
287
+ OpenAI-compatible `/v1/chat/completions` endpoint (Ollama, llama.cpp,
288
+ vLLM, LM Studio); `SWITCHBOT_LOCAL_LLM_MODEL` picks the model and
289
+ `SWITCHBOT_LOCAL_LLM_TOOL_USE=1` opts into native tool-use when the
290
+ endpoint supports it (otherwise a structured-output fallback is used).
291
+ `rules lint` flags misconfigured LLM conditions.
283
292
 
284
293
  **Decision trace** โ€” set `automation.audit.evaluate_trace: sampled` (or `full`) in `policy.yaml` to record every evaluation decision.
285
294
 
@@ -633,7 +642,7 @@ switchbot doctor
633
642
  switchbot doctor --json
634
643
  ```
635
644
 
636
- Runs local checks (Node version, credentials, profiles, catalog, catalog-schema, catalog-coverage, cache, quota, clock, MQTT, policy, MCP, keychain, path, inventory, audit, daemon, health, notify-connectivity, release-notes) and exits 1 if any check fails. `warn` results exit 0. The MQTT check reports `ok` when REST credentials are configured (auto-provisioned on first use). The `notify-connectivity` check probes webhook URLs declared in `type: notify` actions. Use this to diagnose connectivity or config issues before running automation.
645
+ Runs local checks (Node version, credentials, profiles, catalog, catalog-schema, catalog-coverage, cache, quota, clock, MQTT, policy, MCP, keychain, path, inventory, audit, daemon, daemon-ipc, health, notify-connectivity, local-llm-reachable, release-notes) and exits 1 if any check fails. `warn` results exit 0. The MQTT check reports `ok` when REST credentials are configured (auto-provisioned on first use). The `notify-connectivity` check probes webhook URLs declared in `type: notify` actions. `daemon-ipc` round-trips the JSON-RPC socket when the daemon is running (silently skipped otherwise); `local-llm-reachable` only fires when policy uses `provider: local`. Use this to diagnose connectivity or config issues before running automation.
637
646
 
638
647
  `--json` output includes `maturityScore` (0โ€“100) and `maturityLabel` (`production-ready` / `mostly-ready` / `needs-work` / `not-ready`) to give an at-a-glance readiness rating:
639
648
 
@@ -807,7 +816,7 @@ npm install
807
816
 
808
817
  npm run dev -- <args> # Run from TypeScript sources via tsx
809
818
  npm run build # Compile to dist/
810
- npm test # Run the Vitest suite (2391 tests)
819
+ npm test # Run the Vitest suite (2465 tests)
811
820
  npm run test:watch # Watch mode
812
821
  npm run test:coverage # Coverage report (v8, HTML + text)
813
822
  ```