@try-works/dsh-righthand 0.1.8 → 0.1.10

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/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,eAAe,MAAM,aAAa,CAAA;AAG9C,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAA;AAEnC,iFAAiF;AACjF,MAAM,CAAC,MAAM,MAAM,GAAa,EAAE,CAAA;AAQlC;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,SAA0B,EAAE;IAC9D,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACtB,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;IACxB,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACrB,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACrB,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACrB,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;IACxB,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AAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,CAAA;AAClK,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEtF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAClH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACvF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * places-tools - the second keyless data-adapter family (after weather).
3
+ * Geocoding, reverse geocoding and nearby search over Nominatim
4
+ * (OpenStreetMap, keyless), elevation over Open-Meteo (keyless).
5
+ *
6
+ * Every request goes through guardedFetch (the SSRF checklist from
7
+ * blueprint/data-adapter); Nominatim requests carry a User-Agent per its
8
+ * usage policy (max 1 req/s - agent-paced calls only).
9
+ * @module dsh-righthand/places-tools
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ export declare const name = "righthand-places";
13
+ export declare const inject: string[];
14
+ export interface PlacesConfig {
15
+ /** Nominatim endpoint; default https://nominatim.openstreetmap.org (keyless). */
16
+ nominatimUrl?: string;
17
+ /** Open-Meteo elevation endpoint; default https://api.open-meteo.com/v1/elevation (keyless). */
18
+ elevationUrl?: string;
19
+ /** User-Agent sent with Nominatim requests (its usage policy requires one). */
20
+ userAgent?: string;
21
+ }
22
+ /** The stable place shape callers see - the wire JSON is Nominatim's. */
23
+ export interface PlaceOut {
24
+ name: string;
25
+ lat: number;
26
+ lon: number;
27
+ displayName: string;
28
+ category: string;
29
+ type: string;
30
+ address: Record<string, string>;
31
+ }
32
+ /** Normalize one Nominatim result (search or reverse) to PlaceOut. */
33
+ export declare function normalizePlace(raw: any): PlaceOut;
34
+ export declare function normalizePlaces(raw: any): PlaceOut[];
35
+ /** Normalize the Open-Meteo elevation response { elevation: [8.0] }. */
36
+ export interface ElevationOut {
37
+ elevation: number;
38
+ }
39
+ export declare function normalizeElevation(raw: any): ElevationOut;
40
+ /** Haversine distance in km between two lat/lon pairs. */
41
+ export declare function distanceKm(lat1: number, lon1: number, lat2: number, lon2: number): number;
42
+ /**
43
+ * The Nominatim viewbox for a radius around a point, as
44
+ * left,top,right,bottom (lon,lat pairs) - the order the API expects.
45
+ */
46
+ export declare function nearbyViewbox(latitude: number, longitude: number, radiusKm: number): string;
47
+ export declare function apply(ctx: Context, config?: PlacesConfig): void;
48
+ //# sourceMappingURL=places-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"places-tools.d.ts","sourceRoot":"","sources":["../src/places-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,eAAO,MAAM,IAAI,qBAAqB,CAAA;AACtC,eAAO,MAAM,MAAM,UAAY,CAAA;AAE/B,MAAM,WAAW,YAAY;IAC3B,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAQD,yEAAyE;AACzE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAgBjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,EAAE,CAGpD;AAED,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,CAGzD;AAED,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQzF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAS3F;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,YAAiB,GAAG,IAAI,CA0HnE"}
@@ -0,0 +1,191 @@
1
+ /**
2
+ * places-tools - the second keyless data-adapter family (after weather).
3
+ * Geocoding, reverse geocoding and nearby search over Nominatim
4
+ * (OpenStreetMap, keyless), elevation over Open-Meteo (keyless).
5
+ *
6
+ * Every request goes through guardedFetch (the SSRF checklist from
7
+ * blueprint/data-adapter); Nominatim requests carry a User-Agent per its
8
+ * usage policy (max 1 req/s - agent-paced calls only).
9
+ * @module dsh-righthand/places-tools
10
+ */
11
+ import { defineTool } from '@deepseek-ai/dsh-tools';
12
+ import { guardedFetch } from "./weather-tools.js";
13
+ export const name = 'righthand-places';
14
+ export const inject = ['tools'];
15
+ const DEFAULTS = {
16
+ nominatimUrl: 'https://nominatim.openstreetmap.org',
17
+ elevationUrl: 'https://api.open-meteo.com/v1/elevation',
18
+ userAgent: 'dsh-righthand (agent data adapter)',
19
+ };
20
+ /** Normalize one Nominatim result (search or reverse) to PlaceOut. */
21
+ export function normalizePlace(raw) {
22
+ const address = {};
23
+ if (raw !== null && typeof raw === 'object' && raw.address !== null && typeof raw.address === 'object') {
24
+ for (const [k, v] of Object.entries(raw.address)) {
25
+ if (typeof v === 'string')
26
+ address[k] = v;
27
+ }
28
+ }
29
+ return {
30
+ name: typeof raw.name === 'string' ? raw.name : '',
31
+ lat: Number(raw.lat ?? 0),
32
+ lon: Number(raw.lon ?? 0),
33
+ displayName: typeof raw.display_name === 'string' ? raw.display_name : '',
34
+ category: typeof raw.category === 'string' ? raw.category : '',
35
+ type: typeof raw.type === 'string' ? raw.type : '',
36
+ address,
37
+ };
38
+ }
39
+ export function normalizePlaces(raw) {
40
+ if (!Array.isArray(raw))
41
+ return [];
42
+ return raw.map(normalizePlace);
43
+ }
44
+ export function normalizeElevation(raw) {
45
+ const arr = Array.isArray(raw.elevation) ? raw.elevation : [];
46
+ return { elevation: Number(arr[0] ?? 0) };
47
+ }
48
+ /** Haversine distance in km between two lat/lon pairs. */
49
+ export function distanceKm(lat1, lon1, lat2, lon2) {
50
+ const rad = Math.PI / 180;
51
+ const dLat = (lat2 - lat1) * rad;
52
+ const dLon = (lon2 - lon1) * rad;
53
+ const sLat = Math.sin(dLat / 2);
54
+ const sLon = Math.sin(dLon / 2);
55
+ const a = sLat * sLat + Math.cos(lat1 * rad) * Math.cos(lat2 * rad) * sLon * sLon;
56
+ return 6371 * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
57
+ }
58
+ /**
59
+ * The Nominatim viewbox for a radius around a point, as
60
+ * left,top,right,bottom (lon,lat pairs) - the order the API expects.
61
+ */
62
+ export function nearbyViewbox(latitude, longitude, radiusKm) {
63
+ const dy = radiusKm / 110.57;
64
+ const cos = Math.cos(latitude * Math.PI / 180);
65
+ const dx = radiusKm / (111.32 * (cos === 0 ? 1 : cos));
66
+ const left = longitude - dx;
67
+ const top = latitude + dy;
68
+ const right = longitude + dx;
69
+ const bottom = latitude - dy;
70
+ return [left, top, right, bottom].map(v => v.toFixed(6)).join(',');
71
+ }
72
+ export function apply(ctx, config = {}) {
73
+ const cfg = { ...DEFAULTS, ...config };
74
+ const nomHeaders = { 'User-Agent': cfg.userAgent };
75
+ ctx.tools.register(defineTool({
76
+ name: 'rh_places_geocode',
77
+ description: 'Geocode a place query with Nominatim (OpenStreetMap, keyless): text in, ranked places out. Covers search too. Respects the 1 req/s public usage policy - agent-paced calls only.',
78
+ parameters: {
79
+ query: { type: 'string', required: true, description: 'Free-text place query, e.g. "big ben london" or "Eiffel Tower".' },
80
+ limit: { type: 'integer', description: 'Max results, default 5 (max 20).' },
81
+ },
82
+ output: {
83
+ schema: { type: 'array', items: { type: 'json' } },
84
+ render: (_args, value) => {
85
+ const arr = value;
86
+ const text = arr.length === 0 ? '(no places found)' : arr.length + ' place(s): ' + arr.map(p => p.name !== '' ? p.name : p.displayName).join('; ');
87
+ return [{ type: 'text', text }];
88
+ },
89
+ },
90
+ async execute(args) {
91
+ const limit = Math.min(Math.max(1, Math.round(args.limit ?? 5)), 20);
92
+ const qs = new URLSearchParams({ q: args.query, format: 'jsonv2', addressdetails: '1', limit: String(limit) });
93
+ const body = await guardedFetch(cfg.nominatimUrl + '/search?' + qs.toString(), { init: { headers: nomHeaders } });
94
+ return normalizePlaces(JSON.parse(body));
95
+ },
96
+ }));
97
+ ctx.tools.register(defineTool({
98
+ name: 'rh_places_address',
99
+ description: 'Reverse geocode a lat/lon with Nominatim (OpenStreetMap, keyless): coordinates in, the closest address out.',
100
+ parameters: {
101
+ latitude: { type: 'number', required: true, description: 'Latitude.' },
102
+ longitude: { type: 'number', required: true, description: 'Longitude.' },
103
+ },
104
+ output: {
105
+ schema: {
106
+ type: 'object',
107
+ additionalProperties: false,
108
+ properties: {
109
+ name: { type: 'string', required: true },
110
+ lat: { type: 'number', required: true },
111
+ lon: { type: 'number', required: true },
112
+ displayName: { type: 'string', required: true },
113
+ category: { type: 'string', required: true },
114
+ type: { type: 'string', required: true },
115
+ address: { type: 'json', required: true },
116
+ },
117
+ },
118
+ render: (_args, value) => [{ type: 'text', text: value.displayName }],
119
+ },
120
+ async execute(args) {
121
+ const qs = new URLSearchParams({ lat: String(args.latitude), lon: String(args.longitude), format: 'jsonv2', addressdetails: '1' });
122
+ const body = await guardedFetch(cfg.nominatimUrl + '/reverse?' + qs.toString(), { init: { headers: nomHeaders } });
123
+ const raw = JSON.parse(body);
124
+ if (raw.error)
125
+ throw new Error('Nominatim: ' + raw.error);
126
+ return normalizePlace(raw);
127
+ },
128
+ }));
129
+ ctx.tools.register(defineTool({
130
+ name: 'rh_places_elevation',
131
+ description: 'Elevation at a lat/lon from Open-Meteo (keyless), in metres.',
132
+ parameters: {
133
+ latitude: { type: 'number', required: true, description: 'Latitude.' },
134
+ longitude: { type: 'number', required: true, description: 'Longitude.' },
135
+ },
136
+ output: {
137
+ schema: {
138
+ type: 'object',
139
+ additionalProperties: false,
140
+ properties: {
141
+ latitude: { type: 'number', required: true },
142
+ longitude: { type: 'number', required: true },
143
+ elevation: { type: 'number', required: true },
144
+ },
145
+ },
146
+ render: (_args, value) => [{ type: 'text', text: value.elevation + ' m' }],
147
+ },
148
+ async execute(args) {
149
+ const qs = new URLSearchParams({ latitude: String(args.latitude), longitude: String(args.longitude) });
150
+ const body = await guardedFetch(cfg.elevationUrl + '?' + qs.toString());
151
+ const out = normalizeElevation(JSON.parse(body));
152
+ return { latitude: args.latitude, longitude: args.longitude, elevation: out.elevation };
153
+ },
154
+ }));
155
+ ctx.tools.register(defineTool({
156
+ name: 'rh_places_nearby',
157
+ description: 'Places matching a query within radiusKm of a point (Nominatim bounded search, keyless): results sorted nearest first with distanceKm attached.',
158
+ parameters: {
159
+ query: { type: 'string', required: true, description: 'What to look for, e.g. "cafe" or "pharmacy".' },
160
+ latitude: { type: 'number', required: true, description: 'Centre latitude.' },
161
+ longitude: { type: 'number', required: true, description: 'Centre longitude.' },
162
+ radiusKm: { type: 'number', description: 'Search radius, default 1 (min 0.1, max 20).' },
163
+ limit: { type: 'integer', description: 'Max results, default 5 (max 20).' },
164
+ },
165
+ output: {
166
+ schema: { type: 'array', items: { type: 'json' } },
167
+ render: (_args, value) => {
168
+ const arr = value;
169
+ const text = arr.length === 0 ? '(no nearby places)' : arr.map((p) => (p.name !== '' ? p.name : p.displayName) + ' (' + p.distanceKm.toFixed(1) + ' km)').join('; ');
170
+ return [{ type: 'text', text }];
171
+ },
172
+ },
173
+ async execute(args) {
174
+ const radius = Math.min(Math.max(0.1, Number(args.radiusKm ?? 1)), 20);
175
+ const limit = Math.min(Math.max(1, Math.round(args.limit ?? 5)), 20);
176
+ const qs = new URLSearchParams({
177
+ q: args.query,
178
+ viewbox: nearbyViewbox(args.latitude, args.longitude, radius),
179
+ bounded: '1',
180
+ format: 'jsonv2',
181
+ addressdetails: '1',
182
+ limit: String(limit),
183
+ });
184
+ const body = await guardedFetch(cfg.nominatimUrl + '/search?' + qs.toString(), { init: { headers: nomHeaders } });
185
+ return normalizePlaces(JSON.parse(body))
186
+ .map(p => ({ ...p, distanceKm: distanceKm(args.latitude, args.longitude, p.lat, p.lon) }))
187
+ .sort((a, b) => a.distanceKm - b.distanceKm);
188
+ },
189
+ }));
190
+ }
191
+ //# sourceMappingURL=places-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"places-tools.js","sourceRoot":"","sources":["../src/places-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,IAAI,GAAG,kBAAkB,CAAA;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,CAAA;AAW/B,MAAM,QAAQ,GAA2B;IACvC,YAAY,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K,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;YACpE,MAAM,EAAE,GAAG,IAAI,eAAe,CAAC;gBAC7B,CAAC,EAAE,IAAI,CAAC,KAAK;gBACb,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;gBAC7D,OAAO,EAAE,GAAG;gBACZ,MAAM,EAAE,QAAQ;gBAChB,cAAc,EAAE,GAAG;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;aACrB,CAAC,CAAA;YACF,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,YAAY,GAAG,UAAU,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;YACjH,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBACrC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;iBACzF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAU,CAAA;QACzD,CAAC;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@try-works/dsh-righthand",
3
3
  "description": "DeepSeek Harness plugin: DSH-native righthand tools — durable KV store, credential/settings management, governed exec, and a tool guard",
4
- "version": "0.1.8",
4
+ "version": "0.1.10",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -74,6 +74,7 @@
74
74
  "lib",
75
75
  "src",
76
76
  "skills",
77
+ "docs",
77
78
  "cordis.patch.yml",
78
79
  "README.md",
79
80
  "LICENSE"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dsh-righthand
3
- description: Use when a task needs the righthand toolkit — durable key-value storage (rh_store_*), a task board (rh_task_*), reminders (rh_events_*), credential and settings management (rh_credential_* / rh_settings_*), governed command execution (rh_run / rh_run_bg), language work (rh_text_*), weather/air data (rh_weather_*), R2 file tools (rh_files_*), ntfy push (rh_notify_send), or its tool guard policy. Covers tool reference, guard semantics, and service availability.
3
+ description: Use when a task needs the righthand toolkit — durable key-value storage (rh_store_*), a task board (rh_task_*), reminders (rh_events_*), credential and settings management (rh_credential_* / rh_settings_*), governed command execution (rh_run / rh_run_bg), language work (rh_text_*), weather/air data (rh_weather_*), places data (rh_places_*), R2 file tools (rh_files_*), ntfy push (rh_notify_send), or its tool guard policy. Covers tool reference, guard semantics, and service availability.
4
4
  ---
5
5
 
6
6
  # dsh-righthand
@@ -18,6 +18,7 @@ The righthand toolkit: DSH-native tools over the harness's own services. Use thi
18
18
  | exec | `rh_run` / `rh_run_bg` | `ctx.subprocess` + `ctx.jobs` | Running one command (argv array, no shell interpretation). `rh_run` collects bounded output; `rh_run_bg` starts an owner-scoped background job and returns its id. |
19
19
  | text | `rh_text_summarise` / `rh_text_extract` / `rh_text_classify` / `rh_text_translate` | `ctx.llm` (one model call per verb) | Language work: shorten, turn into JSON matching a schema, sort into your labels with confidence, or translate preserving formatting. |
20
20
  | weather | `rh_weather_forecast` / `rh_weather_air` | Open-Meteo (keyless) via the SSRF-guarded fetcher | Current conditions + 3-day min/max, or PM2.5/PM10/AQI, for a lat/lon. Keyless only — anything needing an API token is out of scope. |
21
+ | places | `rh_places_geocode` / `rh_places_address` / `rh_places_elevation` / `rh_places_nearby` | Nominatim/OSM + Open-Meteo (both keyless) via the SSRF-guarded fetcher | Geocode text to places, reverse a lat/lon to an address, get elevation, or find what is near a point — `rh_places_geocode` covers keyword search too. |
21
22
  | files | `rh_files_put` / `rh_files_get` / `rh_files_list` / `rh_files_share` / `rh_files_delete` | Cloudflare R2 (the user's own account) | Store/read/list/share/delete objects in an R2 bucket. `rh_files_share` returns a presigned download URL valid for N minutes (default 60, max 7 days) — anyone with the URL can read it for that window. |
22
23
  | events | `rh_events_create` / `rh_events_due` / `rh_events_list` / `rh_events_free` / `rh_events_cancel` | `ctx.storageDomain` (typed `righthand_events` domain) | Reminders. The agent IS the scheduler: `rh_events_due` each turn returns pending events whose time has come and marks them notified — delivered exactly once, never silently dropped. `rh_events_free` finds free slots within local working hours 09:00–17:00. |
23
24
  | notify | `rh_notify_send` | ntfy.sh (keyless) | Interrupt yourself on your own devices: publish to a topic; subscribed devices receive it. The topic name is the only secret — use an unguessable one. |
@@ -28,6 +29,8 @@ The righthand toolkit: DSH-native tools over the harness's own services. Use thi
28
29
  - One domain `righthand_store`: a `rows` table (string key → JSON value + timestamp) and a global write counter.
29
30
  - `rh_store_get` returns `{ found, key, value?, updatedAt? }` — `found: false` means the key is absent, not an error.
30
31
  - Writes are durable (backend flush before commit) and serialized on one write chain; values must be JSON-serializable.
32
+ - The key prefix IS the collection (`task:`, `digest:`, `run:`, `uptime:`, `deploy:`); `rh_store_list` + a prefix filter is the query language. See `docs/scenario-patterns.md` for the conventions, the receipt pattern and undo trails.
33
+ - Build, then keep one receipt key per run (`{ ...result, fetchedAt }`) — the store is the agent's durable trail; delete scenario keys when a run is only a test.
31
34
 
32
35
  ## Events semantics
33
36
 
@@ -48,6 +51,13 @@ The righthand toolkit: DSH-native tools over the harness's own services. Use thi
48
51
  - Content is text (`text/plain` default, override with `contentType`); `rh_files_get` returns `found: false` for absent keys, not an error.
49
52
  - `rh_files_share` presigns a GET — treat the URL as a secret for its validity window.
50
53
 
54
+ ## Places semantics
55
+
56
+ - Two keyless providers: Nominatim (geocoding, reverse, nearby) and Open-Meteo (elevation). No tokens; requests carry a User-Agent because Nominatim's public usage policy requires one — respect the 1 req/s limit, agent-paced calls only.
57
+ - The wire shape is the provider's; the tool shape is `{ name, lat, lon, displayName, category, type, address }`. Search tools return a root array.
58
+ - `rh_places_nearby` bounds the query with a viewbox (`bounded=1`) and attaches a computed `distanceKm`, sorted nearest first.
59
+ - A reverse geocode miss surfaces as a clean error, not a zeroed place.
60
+
51
61
  ## Weather semantics
52
62
 
53
63
  - Keyless only: Open-Meteo, no token. Every request goes through `guardedFetch` — public destinations only (loopback/private/link-local/multicast refused), every redirect hop revalidated, size and time capped.
@@ -84,6 +94,8 @@ The righthand toolkit: DSH-native tools over the harness's own services. Use thi
84
94
  | `defaultR2Bucket` | `""` | default R2 bucket for `rh_files_*` |
85
95
  | `defaultNotifyTopic` | `""` | default ntfy topic for `rh_notify_send` |
86
96
 
97
+ Schema wall: `rh_settings_set` accepts keys the schema does not define, but `rh_settings_get` never returns them — an unregistered key looks written and silently disappears. Register new keys in the schema (a plugin change) or keep ad-hoc knobs in `rh_store`.
98
+
87
99
  ## Guard policy
88
100
 
89
101
  Rules come from the plugin config (`rules: [{ toolPrefix, mode, ask?, destructive? }]`). `deny` throws before dispatch; `ask` defers to the policy function (return true to allow); `allow` passes through. Tools matching no rule are unaffected. Prefixes match by prefix — `rh_run` also covers `rh_run_bg`.
@@ -92,5 +104,5 @@ Rules come from the plugin config (`rules: [{ toolPrefix, mode, ask?, destructiv
92
104
 
93
105
  ## Service availability
94
106
 
95
- - **web profile**: all thirty-three tools register (`storageDomain` is provided by the web app rows).
96
- - **other profiles** (e.g. headless): the store, task and events families stay dormant (no `storageDomain`); the other nineteen tools (secrets, settings, exec, text, weather, files, notify) still register. The plugin never fails the boot.
107
+ - **web profile**: all thirty-seven tools register (`storageDomain` is provided by the web app rows).
108
+ - **other profiles** (e.g. headless): the store, task and events families stay dormant (no `storageDomain`); the other twenty-three tools (secrets, settings, exec, text, weather, places, files, notify) still register. The plugin never fails the boot.
package/src/index.ts CHANGED
@@ -9,9 +9,9 @@
9
9
  * and the packaged skill as child fibers; each child waits on its own
10
10
  * services, so a
11
11
  * profile without `storageDomain` (e.g. headless) simply gets the
12
- * store/task/events families dormant and the other nineteen tools
13
- * (secrets, settings, exec, text, weather, files, notify) instead of
14
- * failing the boot.
12
+ * store/task/events families dormant and the other twenty-three tools
13
+ * (secrets, settings, exec, text, weather, places, files, notify) instead
14
+ * of failing the boot.
15
15
  *
16
16
  * Modules (each individually mountable via `export * as ...`):
17
17
  * - store-tools: rh_store_put/get/delete/list over ctx.storageDomain
@@ -19,6 +19,7 @@
19
19
  * - task-tools: rh_task_create/list/next/update/delete over ctx.storageDomain
20
20
  * - text-tools: rh_text_summarise/extract/classify/translate over ctx.llm
21
21
  * - weather-tools: rh_weather_forecast/air over Open-Meteo (keyless, SSRF-guarded)
22
+ * - places-tools: rh_places_geocode/address/elevation/nearby (Nominatim + Open-Meteo, keyless)
22
23
  * - files-tools: rh_files_put/get/list/share/delete over Cloudflare R2
23
24
  * - events-tools: rh_events_create/due/list/free/cancel over ctx.storageDomain
24
25
  * - notify-tools: rh_notify_send over ntfy.sh (keyless)
@@ -37,6 +38,7 @@ import * as guardTools from './guard-tools.ts'
37
38
  import * as taskTools from './task-tools.ts'
38
39
  import * as textTools from './text-tools.ts'
39
40
  import * as weatherTools from './weather-tools.ts'
41
+ import * as placesTools from './places-tools.ts'
40
42
  import * as filesTools from './files-tools.ts'
41
43
  import * as eventsTools from './events-tools.ts'
42
44
  import * as notifyTools from './notify-tools.ts'
@@ -67,6 +69,7 @@ export function apply(ctx: Context, config: RighthandConfig = {}): void {
67
69
  ctx.plugin(taskTools)
68
70
  ctx.plugin(textTools)
69
71
  ctx.plugin(weatherTools)
72
+ ctx.plugin(placesTools)
70
73
  ctx.plugin(filesTools)
71
74
  ctx.plugin(eventsTools)
72
75
  ctx.plugin(notifyTools)
@@ -75,16 +78,18 @@ export function apply(ctx: Context, config: RighthandConfig = {}): void {
75
78
  }
76
79
 
77
80
  // Individual modules stay importable for selective mounting.
78
- export { storeTools, secretsTools, execTools, taskTools, textTools, weatherTools, filesTools, eventsTools, notifyTools, guardTools, righthandSkills }
81
+ export { storeTools, secretsTools, execTools, taskTools, textTools, weatherTools, placesTools, filesTools, eventsTools, notifyTools, guardTools, righthandSkills }
79
82
  export { SKILL_NAME, SKILL_DESCRIPTION, skillDirectory, skillBody } from './skills.ts'
80
83
  export type { GuardRule } from './guard-tools.ts'
81
84
  export { guardFactsFor } from './guard-tools.ts'
82
85
  export type { GuardFacts } from './guard-tools.ts'
83
86
  export { isBlockedIP, guardedFetch, normalizeForecast, normalizeAir } from './weather-tools.ts'
87
+ export { normalizePlace, normalizePlaces, normalizeElevation, distanceKm, nearbyViewbox } from './places-tools.ts'
84
88
  export { createR2Client, R2_ACCESS_KEY_REF, R2_SECRET_KEY_REF } from './files-tools.ts'
85
89
  export { signRequest, presignGet } from './sigv4.ts'
86
90
  export { freeSlots } from './events-tools.ts'
87
91
  export type { Event } from './events-tools.ts'
88
92
  export type { R2Options, ListEntry } from './files-tools.ts'
89
93
  export type { WeatherConfig, ForecastOut, AirOut } from './weather-tools.ts'
94
+ export type { PlacesConfig, PlaceOut, ElevationOut } from './places-tools.ts'
90
95
 
@@ -0,0 +1,227 @@
1
+ /**
2
+ * places-tools - the second keyless data-adapter family (after weather).
3
+ * Geocoding, reverse geocoding and nearby search over Nominatim
4
+ * (OpenStreetMap, keyless), elevation over Open-Meteo (keyless).
5
+ *
6
+ * Every request goes through guardedFetch (the SSRF checklist from
7
+ * blueprint/data-adapter); Nominatim requests carry a User-Agent per its
8
+ * usage policy (max 1 req/s - agent-paced calls only).
9
+ * @module dsh-righthand/places-tools
10
+ */
11
+
12
+ import type { Context } from '@deepseek-ai/cordis'
13
+ import { defineTool } from '@deepseek-ai/dsh-tools'
14
+ import { guardedFetch } from './weather-tools.ts'
15
+
16
+ export const name = 'righthand-places'
17
+ export const inject = ['tools']
18
+
19
+ export interface PlacesConfig {
20
+ /** Nominatim endpoint; default https://nominatim.openstreetmap.org (keyless). */
21
+ nominatimUrl?: string
22
+ /** Open-Meteo elevation endpoint; default https://api.open-meteo.com/v1/elevation (keyless). */
23
+ elevationUrl?: string
24
+ /** User-Agent sent with Nominatim requests (its usage policy requires one). */
25
+ userAgent?: string
26
+ }
27
+
28
+ const DEFAULTS: Required<PlacesConfig> = {
29
+ nominatimUrl: 'https://nominatim.openstreetmap.org',
30
+ elevationUrl: 'https://api.open-meteo.com/v1/elevation',
31
+ userAgent: 'dsh-righthand (agent data adapter)',
32
+ }
33
+
34
+ /** The stable place shape callers see - the wire JSON is Nominatim's. */
35
+ export interface PlaceOut {
36
+ name: string
37
+ lat: number
38
+ lon: number
39
+ displayName: string
40
+ category: string
41
+ type: string
42
+ address: Record<string, string>
43
+ }
44
+
45
+ /** Normalize one Nominatim result (search or reverse) to PlaceOut. */
46
+ export function normalizePlace(raw: any): PlaceOut {
47
+ const address: Record<string, string> = {}
48
+ if (raw !== null && typeof raw === 'object' && raw.address !== null && typeof raw.address === 'object') {
49
+ for (const [k, v] of Object.entries(raw.address)) {
50
+ if (typeof v === 'string') address[k] = v
51
+ }
52
+ }
53
+ return {
54
+ name: typeof raw.name === 'string' ? raw.name : '',
55
+ lat: Number(raw.lat ?? 0),
56
+ lon: Number(raw.lon ?? 0),
57
+ displayName: typeof raw.display_name === 'string' ? raw.display_name : '',
58
+ category: typeof raw.category === 'string' ? raw.category : '',
59
+ type: typeof raw.type === 'string' ? raw.type : '',
60
+ address,
61
+ }
62
+ }
63
+
64
+ export function normalizePlaces(raw: any): PlaceOut[] {
65
+ if (!Array.isArray(raw)) return []
66
+ return raw.map(normalizePlace)
67
+ }
68
+
69
+ /** Normalize the Open-Meteo elevation response { elevation: [8.0] }. */
70
+ export interface ElevationOut {
71
+ elevation: number
72
+ }
73
+
74
+ export function normalizeElevation(raw: any): ElevationOut {
75
+ const arr = Array.isArray(raw.elevation) ? raw.elevation : []
76
+ return { elevation: Number(arr[0] ?? 0) }
77
+ }
78
+
79
+ /** Haversine distance in km between two lat/lon pairs. */
80
+ export function distanceKm(lat1: number, lon1: number, lat2: number, lon2: number): number {
81
+ const rad = Math.PI / 180
82
+ const dLat = (lat2 - lat1) * rad
83
+ const dLon = (lon2 - lon1) * rad
84
+ const sLat = Math.sin(dLat / 2)
85
+ const sLon = Math.sin(dLon / 2)
86
+ const a = sLat * sLat + Math.cos(lat1 * rad) * Math.cos(lat2 * rad) * sLon * sLon
87
+ return 6371 * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
88
+ }
89
+
90
+ /**
91
+ * The Nominatim viewbox for a radius around a point, as
92
+ * left,top,right,bottom (lon,lat pairs) - the order the API expects.
93
+ */
94
+ export function nearbyViewbox(latitude: number, longitude: number, radiusKm: number): string {
95
+ const dy = radiusKm / 110.57
96
+ const cos = Math.cos(latitude * Math.PI / 180)
97
+ const dx = radiusKm / (111.32 * (cos === 0 ? 1 : cos))
98
+ const left = longitude - dx
99
+ const top = latitude + dy
100
+ const right = longitude + dx
101
+ const bottom = latitude - dy
102
+ return [left, top, right, bottom].map(v => v.toFixed(6)).join(',')
103
+ }
104
+
105
+ export function apply(ctx: Context, config: PlacesConfig = {}): void {
106
+ const cfg: Required<PlacesConfig> = { ...DEFAULTS, ...config }
107
+
108
+ const nomHeaders = { 'User-Agent': cfg.userAgent }
109
+
110
+ ctx.tools.register(defineTool({
111
+ name: 'rh_places_geocode',
112
+ description: 'Geocode a place query with Nominatim (OpenStreetMap, keyless): text in, ranked places out. Covers search too. Respects the 1 req/s public usage policy - agent-paced calls only.',
113
+ parameters: {
114
+ query: { type: 'string', required: true, description: 'Free-text place query, e.g. "big ben london" or "Eiffel Tower".' },
115
+ limit: { type: 'integer', description: 'Max results, default 5 (max 20).' },
116
+ },
117
+ output: {
118
+ schema: { type: 'array', items: { type: 'json' } },
119
+ render: (_args, value) => {
120
+ const arr = value as any[]
121
+ const text = arr.length === 0 ? '(no places found)' : arr.length + ' place(s): ' + arr.map(p => p.name !== '' ? p.name : p.displayName).join('; ')
122
+ return [{ type: 'text', text }]
123
+ },
124
+ },
125
+ async execute(args) {
126
+ const limit = Math.min(Math.max(1, Math.round(args.limit ?? 5)), 20)
127
+ const qs = new URLSearchParams({ q: args.query, format: 'jsonv2', addressdetails: '1', limit: String(limit) })
128
+ const body = await guardedFetch(cfg.nominatimUrl + '/search?' + qs.toString(), { init: { headers: nomHeaders } })
129
+ return normalizePlaces(JSON.parse(body)) as any[]
130
+ },
131
+ }))
132
+
133
+ ctx.tools.register(defineTool({
134
+ name: 'rh_places_address',
135
+ description: 'Reverse geocode a lat/lon with Nominatim (OpenStreetMap, keyless): coordinates in, the closest address out.',
136
+ parameters: {
137
+ latitude: { type: 'number', required: true, description: 'Latitude.' },
138
+ longitude: { type: 'number', required: true, description: 'Longitude.' },
139
+ },
140
+ output: {
141
+ schema: {
142
+ type: 'object',
143
+ additionalProperties: false,
144
+ properties: {
145
+ name: { type: 'string', required: true },
146
+ lat: { type: 'number', required: true },
147
+ lon: { type: 'number', required: true },
148
+ displayName: { type: 'string', required: true },
149
+ category: { type: 'string', required: true },
150
+ type: { type: 'string', required: true },
151
+ address: { type: 'json', required: true },
152
+ },
153
+ },
154
+ render: (_args, value) => [{ type: 'text', text: value.displayName }],
155
+ },
156
+ async execute(args) {
157
+ const qs = new URLSearchParams({ lat: String(args.latitude), lon: String(args.longitude), format: 'jsonv2', addressdetails: '1' })
158
+ const body = await guardedFetch(cfg.nominatimUrl + '/reverse?' + qs.toString(), { init: { headers: nomHeaders } })
159
+ const raw = JSON.parse(body)
160
+ if (raw.error) throw new Error('Nominatim: ' + raw.error)
161
+ return normalizePlace(raw) as any
162
+ },
163
+ }))
164
+
165
+ ctx.tools.register(defineTool({
166
+ name: 'rh_places_elevation',
167
+ description: 'Elevation at a lat/lon from Open-Meteo (keyless), in metres.',
168
+ parameters: {
169
+ latitude: { type: 'number', required: true, description: 'Latitude.' },
170
+ longitude: { type: 'number', required: true, description: 'Longitude.' },
171
+ },
172
+ output: {
173
+ schema: {
174
+ type: 'object',
175
+ additionalProperties: false,
176
+ properties: {
177
+ latitude: { type: 'number', required: true },
178
+ longitude: { type: 'number', required: true },
179
+ elevation: { type: 'number', required: true },
180
+ },
181
+ },
182
+ render: (_args, value) => [{ type: 'text', text: value.elevation + ' m' }],
183
+ },
184
+ async execute(args) {
185
+ const qs = new URLSearchParams({ latitude: String(args.latitude), longitude: String(args.longitude) })
186
+ const body = await guardedFetch(cfg.elevationUrl + '?' + qs.toString())
187
+ const out = normalizeElevation(JSON.parse(body))
188
+ return { latitude: args.latitude, longitude: args.longitude, elevation: out.elevation }
189
+ },
190
+ }))
191
+
192
+ ctx.tools.register(defineTool({
193
+ name: 'rh_places_nearby',
194
+ description: 'Places matching a query within radiusKm of a point (Nominatim bounded search, keyless): results sorted nearest first with distanceKm attached.',
195
+ parameters: {
196
+ query: { type: 'string', required: true, description: 'What to look for, e.g. "cafe" or "pharmacy".' },
197
+ latitude: { type: 'number', required: true, description: 'Centre latitude.' },
198
+ longitude: { type: 'number', required: true, description: 'Centre longitude.' },
199
+ radiusKm: { type: 'number', description: 'Search radius, default 1 (min 0.1, max 20).' },
200
+ limit: { type: 'integer', description: 'Max results, default 5 (max 20).' },
201
+ },
202
+ output: {
203
+ schema: { type: 'array', items: { type: 'json' } },
204
+ render: (_args, value) => {
205
+ const arr = value as any[]
206
+ const text = arr.length === 0 ? '(no nearby places)' : arr.map((p: any) => (p.name !== '' ? p.name : p.displayName) + ' (' + p.distanceKm.toFixed(1) + ' km)').join('; ')
207
+ return [{ type: 'text', text }]
208
+ },
209
+ },
210
+ async execute(args) {
211
+ const radius = Math.min(Math.max(0.1, Number(args.radiusKm ?? 1)), 20)
212
+ const limit = Math.min(Math.max(1, Math.round(args.limit ?? 5)), 20)
213
+ const qs = new URLSearchParams({
214
+ q: args.query,
215
+ viewbox: nearbyViewbox(args.latitude, args.longitude, radius),
216
+ bounded: '1',
217
+ format: 'jsonv2',
218
+ addressdetails: '1',
219
+ limit: String(limit),
220
+ })
221
+ const body = await guardedFetch(cfg.nominatimUrl + '/search?' + qs.toString(), { init: { headers: nomHeaders } })
222
+ return normalizePlaces(JSON.parse(body))
223
+ .map(p => ({ ...p, distanceKm: distanceKm(args.latitude, args.longitude, p.lat, p.lon) }))
224
+ .sort((a, b) => a.distanceKm - b.distanceKm) as any[]
225
+ },
226
+ }))
227
+ }