@vymalo/opencode-devtools 0.12.0 → 0.14.1
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/dist/catalog.d.ts +7 -7
- package/dist/catalog.js +27 -26
- package/dist/catalog.js.map +1 -1
- package/dist/groups/codec.js +162 -135
- package/dist/groups/codec.js.map +1 -1
- package/dist/groups/convert.js +116 -89
- package/dist/groups/convert.js.map +1 -1
- package/dist/groups/crypto.js +247 -186
- package/dist/groups/crypto.js.map +1 -1
- package/dist/groups/datetime.js +265 -215
- package/dist/groups/datetime.js.map +1 -1
- package/dist/groups/http.d.ts +6 -6
- package/dist/groups/http.js +272 -248
- package/dist/groups/http.js.map +1 -1
- package/dist/groups/math.js +157 -127
- package/dist/groups/math.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib.js +1 -0
- package/dist/lib.js.map +1 -1
- package/dist/logging.d.ts +6 -6
- package/dist/logging.js +59 -62
- package/dist/logging.js.map +1 -1
- package/dist/opencode.d.ts +4 -4
- package/dist/opencode.js +71 -75
- package/dist/opencode.js.map +1 -1
- package/dist/schema.d.ts +41 -41
- package/dist/schema.js +43 -48
- package/dist/schema.js.map +1 -1
- package/dist/tool-spec.d.ts +27 -27
- package/dist/tool-spec.js +24 -16
- package/dist/tool-spec.js.map +1 -1
- package/dist/tools.d.ts +8 -8
- package/dist/tools.js +80 -73
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +27 -27
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
package/dist/groups/datetime.js
CHANGED
|
@@ -2,228 +2,278 @@ import { CronExpressionParser } from "cron-parser";
|
|
|
2
2
|
import cronstrue from "cronstrue";
|
|
3
3
|
import { DateTime, Duration } from "luxon";
|
|
4
4
|
import { json, optString, reqString } from "../tool-spec.js";
|
|
5
|
-
const DEFAULT_DIFF_UNITS = [
|
|
5
|
+
const DEFAULT_DIFF_UNITS = [
|
|
6
|
+
"years",
|
|
7
|
+
"months",
|
|
8
|
+
"days",
|
|
9
|
+
"hours",
|
|
10
|
+
"minutes",
|
|
11
|
+
"seconds"
|
|
12
|
+
];
|
|
6
13
|
/** Parse an instant from ISO, RFC 2822, SQL, epoch-millis, or an explicit format. */
|
|
7
14
|
function parseInstant(input, zone, format) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
const opts = zone ? { zone } : {};
|
|
16
|
+
if (format) {
|
|
17
|
+
return DateTime.fromFormat(input, format, opts);
|
|
18
|
+
}
|
|
19
|
+
const trimmed = input.trim();
|
|
20
|
+
if (/^-?\d{10,}$/.test(trimmed)) {
|
|
21
|
+
return DateTime.fromMillis(Number(trimmed), opts);
|
|
22
|
+
}
|
|
23
|
+
const iso = DateTime.fromISO(trimmed, opts);
|
|
24
|
+
if (iso.isValid) {
|
|
25
|
+
return iso;
|
|
26
|
+
}
|
|
27
|
+
const rfc = DateTime.fromRFC2822(trimmed, opts);
|
|
28
|
+
if (rfc.isValid) {
|
|
29
|
+
return rfc;
|
|
30
|
+
}
|
|
31
|
+
const sql = DateTime.fromSQL(trimmed, opts);
|
|
32
|
+
if (sql.isValid) {
|
|
33
|
+
return sql;
|
|
34
|
+
}
|
|
35
|
+
return iso;
|
|
29
36
|
}
|
|
30
37
|
function ensureValid(dt, label) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
if (!dt.isValid) {
|
|
39
|
+
throw new Error(`${label} is not a valid date/time (${dt.invalidReason ?? "unknown"})`);
|
|
40
|
+
}
|
|
41
|
+
return dt;
|
|
35
42
|
}
|
|
36
43
|
function describe(dt) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
return {
|
|
45
|
+
iso: dt.toISO(),
|
|
46
|
+
epochMs: dt.toMillis(),
|
|
47
|
+
epochSeconds: Math.floor(dt.toMillis() / 1e3),
|
|
48
|
+
zone: dt.zoneName,
|
|
49
|
+
weekday: dt.weekdayLong,
|
|
50
|
+
components: {
|
|
51
|
+
year: dt.year,
|
|
52
|
+
month: dt.month,
|
|
53
|
+
day: dt.day,
|
|
54
|
+
hour: dt.hour,
|
|
55
|
+
minute: dt.minute,
|
|
56
|
+
second: dt.second
|
|
57
|
+
}
|
|
58
|
+
};
|
|
52
59
|
}
|
|
53
60
|
export const DATETIME_TOOLS = [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
61
|
+
{
|
|
62
|
+
name: "datetime_now",
|
|
63
|
+
group: "datetime",
|
|
64
|
+
description: "Get the current date and time, optionally in a specific IANA timezone.",
|
|
65
|
+
input: { zone: {
|
|
66
|
+
type: "string",
|
|
67
|
+
optional: true,
|
|
68
|
+
description: "IANA timezone, e.g. \"Europe/Paris\" (default system zone)."
|
|
69
|
+
} },
|
|
70
|
+
handler: (args, ctx) => {
|
|
71
|
+
const zone = optString(args, "zone");
|
|
72
|
+
let dt = DateTime.fromJSDate(ctx.now());
|
|
73
|
+
if (zone) {
|
|
74
|
+
dt = dt.setZone(zone);
|
|
75
|
+
ensureValid(dt, `zone "${zone}"`);
|
|
76
|
+
}
|
|
77
|
+
return json(describe(dt), `${dt.toISO()} (${dt.zoneName})`);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "datetime_parse",
|
|
82
|
+
group: "datetime",
|
|
83
|
+
description: "Parse a date/time string (ISO 8601, RFC 2822, SQL, epoch-millis, or a custom format) into a normalized ISO timestamp plus its components.",
|
|
84
|
+
input: {
|
|
85
|
+
input: {
|
|
86
|
+
type: "string",
|
|
87
|
+
description: "The date/time string to parse."
|
|
88
|
+
},
|
|
89
|
+
format: {
|
|
90
|
+
type: "string",
|
|
91
|
+
optional: true,
|
|
92
|
+
description: "Optional Luxon parse format, e.g. \"dd/MM/yyyy HH:mm\"."
|
|
93
|
+
},
|
|
94
|
+
zone: {
|
|
95
|
+
type: "string",
|
|
96
|
+
optional: true,
|
|
97
|
+
description: "IANA timezone to interpret the input in."
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
handler: (args) => {
|
|
101
|
+
const input = reqString(args, "input");
|
|
102
|
+
const dt = ensureValid(parseInstant(input, optString(args, "zone"), optString(args, "format")), "input");
|
|
103
|
+
return json(describe(dt), `${dt.toISO()} (${dt.zoneName})`);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "datetime_format",
|
|
108
|
+
group: "datetime",
|
|
109
|
+
description: "Reformat a date/time into a chosen representation: a Luxon format string, or a preset (iso, rfc2822, http, sql, relative).",
|
|
110
|
+
input: {
|
|
111
|
+
input: {
|
|
112
|
+
type: "string",
|
|
113
|
+
description: "The date/time to format (ISO, epoch-millis, …)."
|
|
114
|
+
},
|
|
115
|
+
format: {
|
|
116
|
+
type: "string",
|
|
117
|
+
description: "Luxon format token string, or one of: iso, rfc2822, http, sql, relative."
|
|
118
|
+
},
|
|
119
|
+
zone: {
|
|
120
|
+
type: "string",
|
|
121
|
+
optional: true,
|
|
122
|
+
description: "IANA timezone for the output."
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
handler: (args, ctx) => {
|
|
126
|
+
const input = reqString(args, "input");
|
|
127
|
+
const format = reqString(args, "format");
|
|
128
|
+
let dt = ensureValid(parseInstant(input, undefined, undefined), "input");
|
|
129
|
+
const zone = optString(args, "zone");
|
|
130
|
+
if (zone) {
|
|
131
|
+
dt = dt.setZone(zone);
|
|
132
|
+
ensureValid(dt, `zone "${zone}"`);
|
|
133
|
+
}
|
|
134
|
+
let out;
|
|
135
|
+
switch (format) {
|
|
136
|
+
case "iso":
|
|
137
|
+
out = dt.toISO();
|
|
138
|
+
break;
|
|
139
|
+
case "rfc2822":
|
|
140
|
+
out = dt.toRFC2822();
|
|
141
|
+
break;
|
|
142
|
+
case "http":
|
|
143
|
+
out = dt.toHTTP();
|
|
144
|
+
break;
|
|
145
|
+
case "sql":
|
|
146
|
+
out = dt.toSQL();
|
|
147
|
+
break;
|
|
148
|
+
case "relative":
|
|
149
|
+
out = dt.toRelative({ base: DateTime.fromJSDate(ctx.now()) });
|
|
150
|
+
break;
|
|
151
|
+
default: out = dt.toFormat(format);
|
|
152
|
+
}
|
|
153
|
+
return json({
|
|
154
|
+
input,
|
|
155
|
+
format,
|
|
156
|
+
result: out
|
|
157
|
+
}, out ?? "");
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "datetime_diff",
|
|
162
|
+
group: "datetime",
|
|
163
|
+
description: "Compute the duration between two date/times, broken down into the requested units (default years→seconds).",
|
|
164
|
+
input: {
|
|
165
|
+
from: {
|
|
166
|
+
type: "string",
|
|
167
|
+
description: "Start date/time."
|
|
168
|
+
},
|
|
169
|
+
to: {
|
|
170
|
+
type: "string",
|
|
171
|
+
description: "End date/time."
|
|
172
|
+
},
|
|
173
|
+
units: {
|
|
174
|
+
type: "array",
|
|
175
|
+
optional: true,
|
|
176
|
+
items: { type: "string" },
|
|
177
|
+
description: "Units to break the duration into, e.g. [\"days\",\"hours\"]."
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
handler: (args) => {
|
|
181
|
+
const from = ensureValid(parseInstant(reqString(args, "from"), undefined, undefined), "from");
|
|
182
|
+
const to = ensureValid(parseInstant(reqString(args, "to"), undefined, undefined), "to");
|
|
183
|
+
const units = Array.isArray(args.units) ? args.units.filter((u) => typeof u === "string") : DEFAULT_DIFF_UNITS;
|
|
184
|
+
const diff = to.diff(from, units);
|
|
185
|
+
const obj = diff.toObject();
|
|
186
|
+
return json({
|
|
187
|
+
from: from.toISO(),
|
|
188
|
+
to: to.toISO(),
|
|
189
|
+
milliseconds: diff.toMillis(),
|
|
190
|
+
duration: obj
|
|
191
|
+
}, `${Duration.fromObject(obj).toHuman()} (${diff.toMillis()} ms)`);
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "datetime_convert_tz",
|
|
196
|
+
group: "datetime",
|
|
197
|
+
description: "Convert a date/time from one IANA timezone to another (the instant is preserved).",
|
|
198
|
+
input: {
|
|
199
|
+
input: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description: "The date/time to convert."
|
|
202
|
+
},
|
|
203
|
+
toZone: {
|
|
204
|
+
type: "string",
|
|
205
|
+
description: "Target IANA timezone, e.g. \"Asia/Tokyo\"."
|
|
206
|
+
},
|
|
207
|
+
fromZone: {
|
|
208
|
+
type: "string",
|
|
209
|
+
optional: true,
|
|
210
|
+
description: "Source timezone if `input` has no offset (default system zone)."
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
handler: (args) => {
|
|
214
|
+
const input = reqString(args, "input");
|
|
215
|
+
const toZone = reqString(args, "toZone");
|
|
216
|
+
const fromZone = optString(args, "fromZone");
|
|
217
|
+
const src = ensureValid(parseInstant(input, fromZone, undefined), "input");
|
|
218
|
+
const dst = src.setZone(toZone);
|
|
219
|
+
ensureValid(dst, `toZone "${toZone}"`);
|
|
220
|
+
return json({
|
|
221
|
+
from: {
|
|
222
|
+
iso: src.toISO(),
|
|
223
|
+
zone: src.zoneName
|
|
224
|
+
},
|
|
225
|
+
to: {
|
|
226
|
+
iso: dst.toISO(),
|
|
227
|
+
zone: dst.zoneName
|
|
228
|
+
}
|
|
229
|
+
}, `${src.toISO()} (${src.zoneName}) → ${dst.toISO()} (${dst.zoneName})`);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: "datetime_cron",
|
|
234
|
+
group: "datetime",
|
|
235
|
+
description: "Explain a cron expression in plain English and list its next N run times (in an optional IANA timezone).",
|
|
236
|
+
input: {
|
|
237
|
+
expression: {
|
|
238
|
+
type: "string",
|
|
239
|
+
description: "Cron expression, e.g. \"0 9 * * 1-5\"."
|
|
240
|
+
},
|
|
241
|
+
count: {
|
|
242
|
+
type: "number",
|
|
243
|
+
optional: true,
|
|
244
|
+
description: "How many upcoming runs to list (default 5)."
|
|
245
|
+
},
|
|
246
|
+
zone: {
|
|
247
|
+
type: "string",
|
|
248
|
+
optional: true,
|
|
249
|
+
description: "IANA timezone to compute runs in."
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
handler: (args, ctx) => {
|
|
253
|
+
const expression = reqString(args, "expression");
|
|
254
|
+
const count = typeof args.count === "number" ? Math.min(50, Math.max(1, Math.floor(args.count))) : 5;
|
|
255
|
+
const zone = optString(args, "zone");
|
|
256
|
+
let englishDescription;
|
|
257
|
+
try {
|
|
258
|
+
englishDescription = cronstrue.toString(expression, { throwExceptionOnParseError: true });
|
|
259
|
+
} catch (err) {
|
|
260
|
+
throw new Error(`invalid cron expression: ${err instanceof Error ? err.message : String(err)}`);
|
|
261
|
+
}
|
|
262
|
+
const interval = CronExpressionParser.parse(expression, {
|
|
263
|
+
currentDate: ctx.now(),
|
|
264
|
+
...zone ? { tz: zone } : {}
|
|
265
|
+
});
|
|
266
|
+
const next = [];
|
|
267
|
+
for (let i = 0; i < count; i++) {
|
|
268
|
+
next.push(interval.next().toDate().toISOString());
|
|
269
|
+
}
|
|
270
|
+
return json({
|
|
271
|
+
expression,
|
|
272
|
+
description: englishDescription,
|
|
273
|
+
next
|
|
274
|
+
}, `${englishDescription}\nNext ${count}:\n${next.join("\n")}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
228
277
|
];
|
|
278
|
+
|
|
229
279
|
//# sourceMappingURL=datetime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAS,4BAA4B;AACrC,OAAO,eAAe;AACtB,SAAS,UAAU,gBAAgB;AAEnC,SAAS,MAAM,WAAW,iBAAgC;AAE1D,MAAM,qBAAqB;CAAC;CAAS;CAAU;CAAQ;CAAS;CAAW;AAAS;;AAGpF,SAAS,aACP,OACA,MACA,QACU;CACV,MAAM,OAAO,OAAO,EAAE,KAAK,IAAI,CAAC;CAChC,IAAI,QAAQ;EACV,OAAO,SAAS,WAAW,OAAO,QAAQ,IAAI;CAChD;CACA,MAAM,UAAU,MAAM,KAAK;CAC3B,IA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pD,GAAG,mBAAmB,SAAS,MAAM,KAAK,KAAK,KAAK,IAAI,GAC1D;EACF;CACF;AACF","names":[],"sources":["../../src/groups/datetime.ts"],"version":3,"file":"datetime.js","sourceRoot":""}
|
package/dist/groups/http.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ToolSpec } from "../tool-spec.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
* Reject loopback / private / link-local destinations. IPv6-prefix and IPv4
|
|
4
|
+
* range checks only run on actual IP *literals* — a DNS name like `fdroid.org`
|
|
5
|
+
* (which starts with `fd`) is NOT an IPv6 ULA and must not be blocked. This is
|
|
6
|
+
* still a literal-host guard: it does not resolve DNS, so a public name that
|
|
7
|
+
* resolves to a private IP (DNS rebinding) is not caught — see docs/devtools.md.
|
|
8
|
+
*/
|
|
9
9
|
export declare function isBlockedHost(hostname: string): boolean;
|
|
10
10
|
export declare const HTTP_TOOLS: readonly ToolSpec[];
|