-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(policy): add weather preset for wttr.in and Open-Meteo #1918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a0a55c1
5751beb
e34f558
26b9031
144e312
962fe37
a5e1d20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| preset: | ||
| name: weather | ||
| description: "Weather data via wttr.in and Open-Meteo — required for the built-in weather skill" | ||
|
|
||
| network_policies: | ||
| weather: | ||
| name: weather | ||
| endpoints: | ||
| # wttr.in — primary weather source used by the weather skill (web_fetch) | ||
| - host: wttr.in | ||
| port: 443 | ||
| protocol: rest | ||
| enforcement: enforce | ||
| rules: | ||
| - allow: { method: GET, path: "/**" } | ||
| # Open-Meteo — free weather API (no key required), used as fallback | ||
| - host: api.open-meteo.com | ||
| port: 443 | ||
| protocol: rest | ||
| enforcement: enforce | ||
| rules: | ||
| - allow: { method: GET, path: "/**" } | ||
| # Open-Meteo geocoding — required to resolve city names to coordinates | ||
| - host: geocoding-api.open-meteo.com | ||
| port: 443 | ||
| protocol: rest | ||
| enforcement: enforce | ||
| rules: | ||
| - allow: { method: GET, path: "/**" } | ||
| binaries: | ||
| - { path: /usr/local/bin/node } | ||
| - { path: /usr/local/bin/openclaw } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -341,3 +341,46 @@ describe("huggingface preset", () => { | |||||||||||||
| } | ||||||||||||||
| }); | ||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| describe("weather preset", () => { | ||||||||||||||
| // The weather skill requires wttr.in and Open-Meteo to be reachable. | ||||||||||||||
| // Regression test to ensure the preset file exists and covers the required hosts. | ||||||||||||||
| // See: https://github.com/NVIDIA/NemoClaw/issues/1417 | ||||||||||||||
| const WEATHER_PRESET_PATH = new URL( | ||||||||||||||
| "../nemoclaw-blueprint/policies/presets/weather.yaml", | ||||||||||||||
| import.meta.url, | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| const weatherPreset = YAML.parse( | ||||||||||||||
| readFileSync(WEATHER_PRESET_PATH, "utf-8"), | ||||||||||||||
| ) as Record<string, unknown>; | ||||||||||||||
|
|
||||||||||||||
| type Endpoint = { host?: string; rules?: Array<{ allow?: { method?: string } }> }; | ||||||||||||||
|
|
||||||||||||||
| function weatherEndpoints(): Endpoint[] { | ||||||||||||||
| const np = weatherPreset.network_policies as Record<string, unknown> | undefined; | ||||||||||||||
| if (!np) return []; | ||||||||||||||
| const w = np.weather as { endpoints?: unknown } | undefined; | ||||||||||||||
| return Array.isArray(w?.endpoints) ? (w!.endpoints as Endpoint[]) : []; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| it("regression #1417: weather preset covers wttr.in", () => { | ||||||||||||||
| const hosts = weatherEndpoints().map((ep) => ep.host); | ||||||||||||||
| expect(hosts).toContain("wttr.in"); | ||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| it("regression #1417: weather preset covers api.open-meteo.com", () => { | ||||||||||||||
| const hosts = weatherEndpoints().map((ep) => ep.host); | ||||||||||||||
| expect(hosts).toContain("api.open-meteo.com"); | ||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| it("regression #1417: weather preset covers geocoding-api.open-meteo.com", () => { | |
| const hosts = weatherEndpoints().map((ep) => ep.host); | |
| expect(hosts).toContain("geocoding-api.open-meteo.com"); | |
| }); |
Uh oh!
There was an error while loading. Please reload this page.