agent-first-data 0.13.1 → 0.13.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 +1 -1
- package/dist/format.d.ts +7 -2
- package/dist/format.js +46 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ console.log(outputJson(value));
|
|
|
20
20
|
console.log(outputPlain(value));
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Useful names use TypeScript casing: `outputJson`, `outputYaml`, `outputPlain`, `outputJsonWithOptions`, `redactedValue`, `redactSecretsInPlace`, `redactUrlSecrets`, `parseSize`, `normalizeUtcOffset`, `cliParseOutput`, `cliOutput`, `buildCliError`, `buildCliVersion`, and `cliHandleVersionOrContinue`.
|
|
23
|
+
Useful names use TypeScript casing: `outputJson`, `outputYaml`, `outputPlain`, `outputJsonWithOptions`, `redactedValue`, `redactSecretsInPlace`, `redactUrlSecrets`, `parseSize`, `normalizeUtcOffset`, `isValidRfc3339Date`, `isValidRfc3339Time`, `cliParseOutput`, `cliOutput`, `buildCliError`, `buildCliVersion`, and `cliHandleVersionOrContinue`.
|
|
24
24
|
|
|
25
25
|
Logging is available through `initJson`, `initPlain`, `initYaml`, `span`, and `log`.
|
|
26
26
|
|
package/dist/format.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AFDATA output formatting and protocol templates.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 21 public APIs and 4 types: protocol builders, value redactors (copy and
|
|
5
5
|
* in-place; cover _secret and _url fields), output formatters, URL-string
|
|
6
6
|
* redactors (redactUrlSecrets / WithOptions), parseSize, normalizeUtcOffset,
|
|
7
|
-
*
|
|
7
|
+
* isValidRfc3339Date, isValidRfc3339Time, RedactionPolicy, RedactionOptions,
|
|
8
|
+
* OutputStyle, and OutputOptions.
|
|
8
9
|
*/
|
|
9
10
|
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
10
11
|
[key: string]: JsonValue;
|
|
@@ -94,3 +95,7 @@ export declare function parseSize(s: string): number | null;
|
|
|
94
95
|
* are intentionally out of scope.
|
|
95
96
|
*/
|
|
96
97
|
export declare function normalizeUtcOffset(value: string): string | null;
|
|
98
|
+
/** Return true when value is an RFC 3339 full-date (YYYY-MM-DD). */
|
|
99
|
+
export declare function isValidRfc3339Date(value: string): boolean;
|
|
100
|
+
/** Return true when value is an RFC 3339 partial-time (HH:MM:SS[.fraction]). */
|
|
101
|
+
export declare function isValidRfc3339Time(value: string): boolean;
|
package/dist/format.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AFDATA output formatting and protocol templates.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 21 public APIs and 4 types: protocol builders, value redactors (copy and
|
|
5
5
|
* in-place; cover _secret and _url fields), output formatters, URL-string
|
|
6
6
|
* redactors (redactUrlSecrets / WithOptions), parseSize, normalizeUtcOffset,
|
|
7
|
-
*
|
|
7
|
+
* isValidRfc3339Date, isValidRfc3339Time, RedactionPolicy, RedactionOptions,
|
|
8
|
+
* OutputStyle, and OutputOptions.
|
|
8
9
|
*/
|
|
9
10
|
// ═══════════════════════════════════════════
|
|
10
11
|
// Public API: Protocol Builders
|
|
@@ -202,6 +203,32 @@ export function normalizeUtcOffset(value) {
|
|
|
202
203
|
return "UTC";
|
|
203
204
|
return `${s[0]}${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
|
|
204
205
|
}
|
|
206
|
+
/** Return true when value is an RFC 3339 full-date (YYYY-MM-DD). */
|
|
207
|
+
export function isValidRfc3339Date(value) {
|
|
208
|
+
if (value.length !== 10 || value[4] !== "-" || value[7] !== "-")
|
|
209
|
+
return false;
|
|
210
|
+
const year = parseFixedDigits(value.slice(0, 4));
|
|
211
|
+
const month = parseFixedDigits(value.slice(5, 7));
|
|
212
|
+
const day = parseFixedDigits(value.slice(8, 10));
|
|
213
|
+
if (year === null || month === null || day === null)
|
|
214
|
+
return false;
|
|
215
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth(year, month);
|
|
216
|
+
}
|
|
217
|
+
/** Return true when value is an RFC 3339 partial-time (HH:MM:SS[.fraction]). */
|
|
218
|
+
export function isValidRfc3339Time(value) {
|
|
219
|
+
if (value.length < 8 || value[2] !== ":" || value[5] !== ":")
|
|
220
|
+
return false;
|
|
221
|
+
const hour = parseFixedDigits(value.slice(0, 2));
|
|
222
|
+
const minute = parseFixedDigits(value.slice(3, 5));
|
|
223
|
+
const second = parseFixedDigits(value.slice(6, 8));
|
|
224
|
+
if (hour === null || minute === null || second === null)
|
|
225
|
+
return false;
|
|
226
|
+
if (hour > 23 || minute > 59 || second > 59)
|
|
227
|
+
return false;
|
|
228
|
+
if (value.length === 8)
|
|
229
|
+
return true;
|
|
230
|
+
return value[8] === "." && value.length > 9 && /^[0-9]+$/.test(value.slice(9));
|
|
231
|
+
}
|
|
205
232
|
function parseUtcOffsetBody(body) {
|
|
206
233
|
if (!body)
|
|
207
234
|
return null;
|
|
@@ -224,6 +251,23 @@ function parseUtcOffsetBody(body) {
|
|
|
224
251
|
return [Number(body.slice(0, 2)), Number(body.slice(2))];
|
|
225
252
|
return null;
|
|
226
253
|
}
|
|
254
|
+
function parseFixedDigits(value) {
|
|
255
|
+
if (!/^[0-9]+$/.test(value))
|
|
256
|
+
return null;
|
|
257
|
+
return Number(value);
|
|
258
|
+
}
|
|
259
|
+
function daysInMonth(year, month) {
|
|
260
|
+
if ([1, 3, 5, 7, 8, 10, 12].includes(month))
|
|
261
|
+
return 31;
|
|
262
|
+
if ([4, 6, 9, 11].includes(month))
|
|
263
|
+
return 30;
|
|
264
|
+
if (month === 2)
|
|
265
|
+
return isLeapYear(year) ? 29 : 28;
|
|
266
|
+
return 0;
|
|
267
|
+
}
|
|
268
|
+
function isLeapYear(year) {
|
|
269
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
270
|
+
}
|
|
227
271
|
const DEFAULT_CONTEXT = {
|
|
228
272
|
secretNames: new Set(),
|
|
229
273
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent-First Data (AFDATA) — suffix-driven output formatting and protocol templates.
|
|
3
3
|
*/
|
|
4
|
-
export { buildJsonOk, buildJsonError, buildJson, type JsonValue, RedactionPolicy, type RedactionOptions, OutputStyle, type OutputOptions, outputJson, outputJsonWith, outputJsonWithOptions, outputYaml, outputYamlWithOptions, outputPlain, outputPlainWithOptions, redactSecretsInPlace, redactSecretsInPlaceWithOptions, redactedValue, redactedValueWith, redactedValueWithOptions, redactUrlSecrets, redactUrlSecretsWithOptions, parseSize, normalizeUtcOffset, } from "./format.js";
|
|
4
|
+
export { buildJsonOk, buildJsonError, buildJson, type JsonValue, RedactionPolicy, type RedactionOptions, OutputStyle, type OutputOptions, outputJson, outputJsonWith, outputJsonWithOptions, outputYaml, outputYamlWithOptions, outputPlain, outputPlainWithOptions, redactSecretsInPlace, redactSecretsInPlaceWithOptions, redactedValue, redactedValueWith, redactedValueWithOptions, redactUrlSecrets, redactUrlSecretsWithOptions, parseSize, normalizeUtcOffset, isValidRfc3339Date, isValidRfc3339Time, } from "./format.js";
|
|
5
5
|
export { log, span, initJson, initPlain, initYaml } from "./afdata_logging.js";
|
|
6
6
|
export { type OutputFormat, cliParseOutput, cliParseLogFilters, cliOutput, cliOutputWithOptions, buildCliError, buildCliVersion, cliRenderVersion, cliHandleVersionOrContinue, } from "./cli.js";
|
|
7
7
|
export { type SkillSpec, type SkillAction, type SkillScope, type SkillAgentSelection, type SkillAgent, type SkillOptions, type SkillTargetStatus, type SkillUninstallStatus, type SkillReport, SkillError, runSkillAdmin, } from "./skill.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent-First Data (AFDATA) — suffix-driven output formatting and protocol templates.
|
|
3
3
|
*/
|
|
4
|
-
export { buildJsonOk, buildJsonError, buildJson, RedactionPolicy, OutputStyle, outputJson, outputJsonWith, outputJsonWithOptions, outputYaml, outputYamlWithOptions, outputPlain, outputPlainWithOptions, redactSecretsInPlace, redactSecretsInPlaceWithOptions, redactedValue, redactedValueWith, redactedValueWithOptions, redactUrlSecrets, redactUrlSecretsWithOptions, parseSize, normalizeUtcOffset, } from "./format.js";
|
|
4
|
+
export { buildJsonOk, buildJsonError, buildJson, RedactionPolicy, OutputStyle, outputJson, outputJsonWith, outputJsonWithOptions, outputYaml, outputYamlWithOptions, outputPlain, outputPlainWithOptions, redactSecretsInPlace, redactSecretsInPlaceWithOptions, redactedValue, redactedValueWith, redactedValueWithOptions, redactUrlSecrets, redactUrlSecretsWithOptions, parseSize, normalizeUtcOffset, isValidRfc3339Date, isValidRfc3339Time, } from "./format.js";
|
|
5
5
|
export { log, span, initJson, initPlain, initYaml } from "./afdata_logging.js";
|
|
6
6
|
export { cliParseOutput, cliParseLogFilters, cliOutput, cliOutputWithOptions, buildCliError, buildCliVersion, cliRenderVersion, cliHandleVersionOrContinue, } from "./cli.js";
|
|
7
7
|
export { SkillError, runSkillAdmin, } from "./skill.js";
|