@ouro.bot/cli 0.1.0-alpha.1305 → 0.1.0-alpha.1307
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/changelog.json +13 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/mailbox-ui/assets/index-DEsikqKt.js +1 -0
- package/dist/mailbox-ui/index.html +1 -1
- package/dist/repertoire/tools-files.js +37 -3
- package/dist/repertoire/tools-travel.js +1 -1
- package/dist/repertoire/travel-api-client.js +152 -49
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/mailbox-ui/assets/index-Cu8GV60v.js +0 -1
|
@@ -43,6 +43,8 @@ const scrutiny_1 = require("../mind/scrutiny");
|
|
|
43
43
|
const tools_base_1 = require("./tools-base");
|
|
44
44
|
const guardrails_1 = require("./guardrails");
|
|
45
45
|
const tool_limits_1 = require("./tool-limits");
|
|
46
|
+
/** The profile of a file tool that only reads, so a card can say `read`; it is the dispatcher's own default. */
|
|
47
|
+
const READS_ONLY = { mutates: "none", risk: "low" };
|
|
46
48
|
const LIST_CAP = 500;
|
|
47
49
|
const GREP_MAX_MATCHES = 100;
|
|
48
50
|
const GREP_MAX_LINE_CHARS = 500;
|
|
@@ -167,6 +169,11 @@ exports.fileToolDefinitions = [
|
|
|
167
169
|
return `${text}\n${(0, tool_limits_1.cutNotice)("read_file", `[lines ${start + 1}-${last} of ${lines.length} shown; read on with offset=${last + 1}]`, { path: resolvedPath })}`;
|
|
168
170
|
},
|
|
169
171
|
summaryKeys: ["path"],
|
|
172
|
+
riskProfile: READS_ONLY,
|
|
173
|
+
ax: { id: "tool:read_file", group: "turn-files", when: "Pick this to see a file's exact text before you quote or change it; to find which file holds something, grep or glob first.", effect: "read", idempotent: true, errors: [
|
|
174
|
+
{ code: "guardrail-blocked", means: "The path is inside the folder holding the sync key, which no tool may read, or the path can't be resolved (a link loop or a folder you can't open).", fix: "Read a file outside that folder; for a path that won't resolve, check it with ls first." },
|
|
175
|
+
{ code: "invalid-arguments", means: "path is missing, or offset, limit or char_offset isn't a number.", fix: "Call read_file again with path as text and offset, limit and char_offset as numbers." },
|
|
176
|
+
] },
|
|
170
177
|
},
|
|
171
178
|
{
|
|
172
179
|
tool: {
|
|
@@ -193,6 +200,11 @@ exports.fileToolDefinitions = [
|
|
|
193
200
|
},
|
|
194
201
|
summaryKeys: ["path"],
|
|
195
202
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "writes file contents" },
|
|
203
|
+
ax: { id: "tool:write_file", group: "turn-files", when: "Pick this to create a new file or replace one whole; for a change to part of an existing file, edit_file is safer and smaller.", effect: "write", destructive: true, idempotent: true, errors: [
|
|
204
|
+
{ code: "guardrail-blocked", means: "The path is protected (such as agent.json, state/policy, .git, friends/, product/ or a psyche file), or this person may only have you write inside your home.", fix: "Pass an absolute path under your home that isn't protected; a psyche file changes only when your owner asks in your own chat." },
|
|
205
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so writes wait until you know what the person meant.", fix: "Call orientation_get, settle the correction, then write the file if it is still right." },
|
|
206
|
+
{ code: "invalid-arguments", means: "path or content is missing or isn't text.", fix: "Call write_file again with path and the whole new content as text." },
|
|
207
|
+
] },
|
|
196
208
|
},
|
|
197
209
|
{
|
|
198
210
|
tool: {
|
|
@@ -214,7 +226,7 @@ exports.fileToolDefinitions = [
|
|
|
214
226
|
handler: (a, ctx) => {
|
|
215
227
|
const resolvedPath = resolveLocalToolPath(a.path, ctx);
|
|
216
228
|
if (!tools_base_1.editFileReadTracker.has(resolvedPath)) {
|
|
217
|
-
return `error: you must read the file with read_file before editing it. call read_file on ${a.path} first
|
|
229
|
+
return (0, tools_base_1.withCode)(`error: you must read the file with read_file before editing it. call read_file on ${a.path} first.`, "read-first");
|
|
218
230
|
}
|
|
219
231
|
// Check staleness before editing
|
|
220
232
|
const stalenessCheck = file_state_1.fileStateCache.isStale(resolvedPath);
|
|
@@ -236,10 +248,10 @@ exports.fileToolDefinitions = [
|
|
|
236
248
|
searchFrom = idx + 1;
|
|
237
249
|
}
|
|
238
250
|
if (occurrences.length === 0) {
|
|
239
|
-
return `error: old_string not found in ${a.path}
|
|
251
|
+
return (0, tools_base_1.withCode)(`error: old_string not found in ${a.path}`, "no-match");
|
|
240
252
|
}
|
|
241
253
|
if (occurrences.length > 1) {
|
|
242
|
-
return `error: old_string is ambiguous -- found ${occurrences.length} matches in ${a.path}. provide more context to make the match unique
|
|
254
|
+
return (0, tools_base_1.withCode)(`error: old_string is ambiguous -- found ${occurrences.length} matches in ${a.path}. provide more context to make the match unique.`, "ambiguous-match");
|
|
243
255
|
}
|
|
244
256
|
// Single unique match -- replace
|
|
245
257
|
const idx = occurrences[0];
|
|
@@ -276,6 +288,13 @@ exports.fileToolDefinitions = [
|
|
|
276
288
|
},
|
|
277
289
|
summaryKeys: ["path"],
|
|
278
290
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "edits file contents" },
|
|
291
|
+
ax: { id: "tool:edit_file", group: "turn-files", when: "Pick this to change one exact passage of a file you have read; write_file is for new files and full rewrites.", effect: "write", errors: [
|
|
292
|
+
{ code: "read-first", means: "You haven't read this file with read_file yet, so the edit was refused.", fix: "Call read_file on the same path, then send the edit again." },
|
|
293
|
+
{ code: "no-match", means: "old_string appears nowhere in the file, often because whitespace or an earlier edit differs.", fix: "Read the file again and copy old_string from it exactly, indentation included." },
|
|
294
|
+
{ code: "ambiguous-match", means: "old_string appears more than once, so the edit can't tell which place you mean.", fix: "Add surrounding lines to old_string until it matches one place only." },
|
|
295
|
+
{ code: "guardrail-blocked", means: "The path is protected (such as agent.json, state/policy, .git or a psyche file), or this person may only have you edit inside your home.", fix: "Pass an absolute path under your home that isn't protected; a psyche file changes only when your owner asks in your own chat." },
|
|
296
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so edits wait until you know what the person meant.", fix: "Call orientation_get, settle the correction, then make the edit if it is still right." },
|
|
297
|
+
] },
|
|
279
298
|
},
|
|
280
299
|
{
|
|
281
300
|
tool: {
|
|
@@ -298,6 +317,11 @@ exports.fileToolDefinitions = [
|
|
|
298
317
|
return lines.length > 0 ? lines.join("\n") : "(empty)";
|
|
299
318
|
},
|
|
300
319
|
summaryKeys: ["path"],
|
|
320
|
+
riskProfile: READS_ONLY,
|
|
321
|
+
ax: { id: "tool:ls", group: "turn-files", when: "Pick this to see what one folder holds, with sizes; to find files by name pattern across many folders, glob is faster.", effect: "read", idempotent: true, errors: [
|
|
322
|
+
{ code: "guardrail-blocked", means: "That folder holds the sync key, which no tool may list, or the path can't be resolved.", fix: "List a different folder; nothing in that one is meant for you." },
|
|
323
|
+
{ code: "invalid-arguments", means: "path isn't text.", fix: "Call ls again with path as a folder name, or with no path to list your home." },
|
|
324
|
+
] },
|
|
301
325
|
},
|
|
302
326
|
{
|
|
303
327
|
tool: {
|
|
@@ -327,6 +351,11 @@ exports.fileToolDefinitions = [
|
|
|
327
351
|
return [...matches.slice(0, LIST_CAP), (0, tool_limits_1.cutNotice)("glob", `[${LIST_CAP} of ${matches.length} matches shown; narrow the pattern or cwd]`, { pattern: a.pattern }), ...note].join("\n");
|
|
328
352
|
},
|
|
329
353
|
summaryKeys: ["pattern", "cwd"],
|
|
354
|
+
riskProfile: READS_ONLY,
|
|
355
|
+
ax: { id: "tool:glob", group: "turn-files", when: "Pick this to find files by name pattern, such as every Markdown file under notes; to search inside files, use grep.", effect: "read", idempotent: true, errors: [
|
|
356
|
+
{ code: "guardrail-blocked", means: "The pattern or cwd reaches into the folder holding the sync key, or cwd can't be resolved.", fix: "Narrow cwd or the pattern so the search stays out of that folder." },
|
|
357
|
+
{ code: "invalid-arguments", means: "pattern is missing, or cwd isn't text.", fix: "Call glob again with pattern set, such as **/*.md, and cwd as a folder name if you want one." },
|
|
358
|
+
] },
|
|
330
359
|
},
|
|
331
360
|
{
|
|
332
361
|
tool: {
|
|
@@ -459,5 +488,10 @@ exports.fileToolDefinitions = [
|
|
|
459
488
|
return results.join("\n");
|
|
460
489
|
},
|
|
461
490
|
summaryKeys: ["pattern", "path", "include"],
|
|
491
|
+
riskProfile: READS_ONLY,
|
|
492
|
+
ax: { id: "tool:grep", group: "turn-files", when: "Pick this to learn which files and lines contain some text or regex; then read_file shows a match in full.", effect: "read", idempotent: true, errors: [
|
|
493
|
+
{ code: "guardrail-blocked", means: "The search path is, or contains, the folder holding the sync key, or it can't be resolved.", fix: "Pass a narrower path that leaves that folder out." },
|
|
494
|
+
{ code: "invalid-arguments", means: "pattern is missing, or context_lines, ignore_case or files_only has the wrong type.", fix: "Call grep again with pattern as text, context_lines as a number and the flags as true or false." },
|
|
495
|
+
] },
|
|
462
496
|
},
|
|
463
497
|
];
|
|
@@ -56,7 +56,7 @@ exports.travelToolDefinitions = [
|
|
|
56
56
|
properties: {
|
|
57
57
|
country_code: {
|
|
58
58
|
type: "string",
|
|
59
|
-
description: "ISO 3166 alpha-2 country code (e.g. 'US', '
|
|
59
|
+
description: "ISO 3166 alpha-2 country code (e.g. 'US', 'FR', 'AF')",
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
required: ["country_code"],
|
|
@@ -135,61 +135,162 @@ exports.TRAVEL_ADVISORY_RSS_URL = "https://travel.state.gov/_res/rss/TAsTWs.xml"
|
|
|
135
135
|
*
|
|
136
136
|
* The RSS feed Country-Tag uses FIPS codes. Callers typically pass ISO codes.
|
|
137
137
|
* When the codes match (e.g. AF for Afghanistan), no lookup is needed.
|
|
138
|
-
*
|
|
138
|
+
* A code that diverges must be listed even when its country has no advisory, because the
|
|
139
|
+
* bare tag then belongs to another country (ISO GB is the UK, but the feed's GB is Gabon;
|
|
140
|
+
* the UK's tag is UK). Values are the country names as the feed titles spell them, and a
|
|
141
|
+
* country with no advisory is listed so that it is reported as not found rather than
|
|
142
|
+
* answered with another country's advisory.
|
|
139
143
|
*/
|
|
140
144
|
const ISO_FIPS_DIVERGENCE = {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
145
|
+
AD: "Andorra",
|
|
146
|
+
AG: "Antigua and Barbuda",
|
|
147
|
+
AI: "Anguilla",
|
|
148
|
+
AQ: "Antarctica",
|
|
149
|
+
AS: "American Samoa",
|
|
150
|
+
AT: "Austria",
|
|
151
|
+
AU: "Australia",
|
|
152
|
+
AW: "Aruba",
|
|
153
|
+
AZ: "Azerbaijan",
|
|
154
|
+
BA: "Bosnia and Herzegovina",
|
|
155
|
+
BD: "Bangladesh",
|
|
156
|
+
BF: "Burkina Faso",
|
|
157
|
+
BG: "Bulgaria",
|
|
158
|
+
BH: "Bahrain",
|
|
159
|
+
BI: "Burundi",
|
|
160
|
+
BJ: "Benin",
|
|
161
|
+
BL: "Saint Barthelemy",
|
|
162
|
+
BM: "Bermuda",
|
|
163
|
+
BN: "Brunei",
|
|
164
|
+
BO: "Bolivia",
|
|
165
|
+
BS: "The Bahamas",
|
|
166
|
+
BW: "Botswana",
|
|
167
|
+
BY: "Belarus",
|
|
168
|
+
BZ: "Belize",
|
|
169
|
+
CD: "Democratic Republic of the Congo",
|
|
170
|
+
CF: "Central African Republic",
|
|
171
|
+
CG: "Republic of Congo",
|
|
172
|
+
CH: "Switzerland",
|
|
173
|
+
CI: "Côte d’Ivoire",
|
|
174
|
+
CL: "Chile",
|
|
175
|
+
CN: "China",
|
|
176
|
+
CR: "Costa Rica",
|
|
177
|
+
CW: "Curaçao",
|
|
178
|
+
CZ: "Czechia",
|
|
179
|
+
DE: "Germany",
|
|
180
|
+
DK: "Denmark",
|
|
181
|
+
DM: "Dominica",
|
|
182
|
+
DO: "Dominican Republic",
|
|
183
|
+
DZ: "Algeria",
|
|
184
|
+
EE: "Estonia",
|
|
185
|
+
ES: "Spain",
|
|
186
|
+
GA: "Gabon",
|
|
187
|
+
GB: "United Kingdom",
|
|
188
|
+
GD: "Grenada",
|
|
189
|
+
GE: "Georgia",
|
|
190
|
+
GF: "French Guiana",
|
|
191
|
+
GG: "Guernsey",
|
|
192
|
+
GM: "The Gambia",
|
|
193
|
+
GN: "Guinea",
|
|
194
|
+
GQ: "Equatorial Guinea",
|
|
195
|
+
HN: "Honduras",
|
|
196
|
+
HT: "Haiti",
|
|
197
|
+
IE: "Ireland",
|
|
198
|
+
IL: "Israel",
|
|
199
|
+
IQ: "Iraq",
|
|
200
|
+
IS: "Iceland",
|
|
201
|
+
JP: "Japan",
|
|
202
|
+
KH: "Cambodia",
|
|
203
|
+
KI: "Kiribati",
|
|
204
|
+
KM: "Comoros",
|
|
205
|
+
KN: "Saint Kitts and Nevis",
|
|
206
|
+
KP: "North Korea",
|
|
207
|
+
KR: "South Korea",
|
|
208
|
+
KW: "Kuwait",
|
|
209
|
+
KY: "Cayman Islands",
|
|
210
|
+
LB: "Lebanon",
|
|
211
|
+
LC: "Saint Lucia",
|
|
212
|
+
LI: "Liechtenstein",
|
|
213
|
+
LK: "Sri Lanka",
|
|
214
|
+
LR: "Liberia",
|
|
215
|
+
LS: "Lesotho",
|
|
216
|
+
LT: "Lithuania",
|
|
217
|
+
LV: "Latvia",
|
|
218
|
+
MA: "Morocco",
|
|
219
|
+
MC: "Monaco",
|
|
220
|
+
ME: "Montenegro",
|
|
221
|
+
MG: "Madagascar",
|
|
222
|
+
MH: "Marshall Islands",
|
|
223
|
+
MM: "Burma",
|
|
224
|
+
MN: "Mongolia",
|
|
225
|
+
MO: "Macau",
|
|
226
|
+
MP: "Northern Mariana Islands",
|
|
227
|
+
MS: "Montserrat",
|
|
228
|
+
MU: "Mauritius",
|
|
229
|
+
MW: "Malawi",
|
|
230
|
+
NA: "Namibia",
|
|
231
|
+
NE: "Niger",
|
|
232
|
+
NG: "Nigeria",
|
|
233
|
+
NI: "Nicaragua",
|
|
234
|
+
NU: "Niue",
|
|
235
|
+
OM: "Oman",
|
|
236
|
+
PA: "Panama",
|
|
237
|
+
PF: "French Polynesia",
|
|
238
|
+
PG: "Papua New Guinea",
|
|
239
|
+
PH: "Philippines",
|
|
240
|
+
PM: "Saint Pierre and Miquelon",
|
|
241
|
+
PS: "Palestinian Territories",
|
|
242
|
+
PT: "Portugal",
|
|
243
|
+
PW: "Palau",
|
|
244
|
+
PY: "Paraguay",
|
|
245
|
+
RS: "Serbia",
|
|
246
|
+
RU: "Russia",
|
|
247
|
+
SB: "Solomon Islands",
|
|
248
|
+
SC: "Seychelles",
|
|
249
|
+
SD: "Sudan",
|
|
250
|
+
SE: "Sweden",
|
|
251
|
+
SG: "Singapore",
|
|
252
|
+
SK: "Slovakia",
|
|
253
|
+
SN: "Senegal",
|
|
254
|
+
SR: "Suriname",
|
|
255
|
+
SS: "South Sudan",
|
|
256
|
+
ST: "São Tomé and Príncipe",
|
|
257
|
+
SV: "El Salvador",
|
|
258
|
+
SX: "Sint Maarten",
|
|
259
|
+
SZ: "Eswatini",
|
|
260
|
+
TC: "Turks and Caicos Islands",
|
|
261
|
+
TD: "Chad",
|
|
262
|
+
TG: "Togo",
|
|
263
|
+
TJ: "Tajikistan",
|
|
264
|
+
TK: "Tokelau",
|
|
265
|
+
TL: "Timor-Leste",
|
|
266
|
+
TM: "Turkmenistan",
|
|
267
|
+
TN: "Tunisia",
|
|
268
|
+
TO: "Tonga",
|
|
269
|
+
TR: "Turkey",
|
|
270
|
+
TT: "Trinidad and Tobago",
|
|
271
|
+
UA: "Ukraine",
|
|
272
|
+
VA: "Holy See",
|
|
273
|
+
VG: "British Virgin Islands",
|
|
274
|
+
VI: "U.S. Virgin Islands",
|
|
275
|
+
VN: "Vietnam",
|
|
276
|
+
VU: "Vanuatu",
|
|
277
|
+
XK: "Kosovo",
|
|
278
|
+
YE: "Yemen",
|
|
279
|
+
ZA: "South Africa",
|
|
280
|
+
ZM: "Zambia",
|
|
281
|
+
ZW: "Zimbabwe",
|
|
187
282
|
};
|
|
188
283
|
/**
|
|
189
284
|
* Look up the expected country name for an ISO alpha-2 code,
|
|
190
285
|
* but ONLY when that code diverges from the FIPS code used in the RSS feed.
|
|
191
286
|
* Returns undefined for codes where ISO == FIPS (no title fallback needed).
|
|
192
287
|
*/
|
|
288
|
+
const normalizeCountryName = (name) => name.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[’']/g, "'").toLowerCase().replace(/^the\s+/, "").trim();
|
|
289
|
+
function titleMatchesCountry(titleCountry, expected) {
|
|
290
|
+
const title = normalizeCountryName(titleCountry);
|
|
291
|
+
const name = normalizeCountryName(expected);
|
|
292
|
+
return title === name || title.startsWith(`${name} (`);
|
|
293
|
+
}
|
|
193
294
|
function isoToCountryName(isoCode) {
|
|
194
295
|
return ISO_FIPS_DIVERGENCE[isoCode.toUpperCase()];
|
|
195
296
|
}
|
|
@@ -258,10 +359,12 @@ async function getTravelAdvisory(countryCode) {
|
|
|
258
359
|
};
|
|
259
360
|
}
|
|
260
361
|
// Title-based match: when ISO differs from FIPS, match by country name.
|
|
261
|
-
//
|
|
362
|
+
// Names match whole, ignoring case, accents, apostrophe style and a leading "The", or with a
|
|
363
|
+
// parenthetical like "Burma (Myanmar)" after them; a prefix alone is not enough
|
|
364
|
+
// ("Niger" is not "Nigeria", "Guinea" is not "Guinea-Bissau").
|
|
262
365
|
if (expectedCountryName && !titleFallbackMatch) {
|
|
263
366
|
const titleCountry = parseCountryName(title);
|
|
264
|
-
if (titleCountry
|
|
367
|
+
if (titleMatchesCountry(titleCountry, expectedCountryName)) {
|
|
265
368
|
titleFallbackMatch = {
|
|
266
369
|
countryCode,
|
|
267
370
|
countryName: titleCountry,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1307",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@ouro.bot/cli",
|
|
9
|
-
"version": "0.1.0-alpha.
|
|
9
|
+
"version": "0.1.0-alpha.1307",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|