@ever-works/hermes-agent-plugin 1.0.14 → 1.0.16
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/index.cjs +287 -22
- package/dist/index.js +287 -22
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -503,7 +503,11 @@ var TASK_RESERVED_LABELS = Object.freeze([
|
|
|
503
503
|
"release:promotion",
|
|
504
504
|
"release:revert"
|
|
505
505
|
]);
|
|
506
|
-
var TASK_RESERVED_LABEL_PREFIXES = Object.freeze([
|
|
506
|
+
var TASK_RESERVED_LABEL_PREFIXES = Object.freeze([
|
|
507
|
+
"release:",
|
|
508
|
+
"provision-attempt-",
|
|
509
|
+
"fleet:"
|
|
510
|
+
]);
|
|
507
511
|
var PLATFORM_DEFAULT_MERGE_POLICY = Object.freeze({
|
|
508
512
|
allowAgentMerge: false,
|
|
509
513
|
requireGreenGate: true,
|
|
@@ -1273,7 +1277,18 @@ var FLEET_JOB_DEFAULT_QUEUED_MAX_AGE_SEC = Object.freeze({
|
|
|
1273
1277
|
// fails closed to), so an older reader's "unknown kind" answer is unchanged.
|
|
1274
1278
|
// A control the owner no longer wants is cancelled with its child's row.
|
|
1275
1279
|
"vm-create": 2 * 60 * 60,
|
|
1276
|
-
"vm-control": 2 * 60 * 60
|
|
1280
|
+
"vm-control": 2 * 60 * 60,
|
|
1281
|
+
// Usage scan (FL-20). The plan proposed 15 minutes (one scan interval); like
|
|
1282
|
+
// the kinds above it does NOT undercut the shortest existing default (the
|
|
1283
|
+
// fallback an unknown kind fails closed to). A scan nobody leased is simply
|
|
1284
|
+
// superseded: the dispatcher never enqueues a second while one is queued.
|
|
1285
|
+
"usage-scan": 2 * 60 * 60,
|
|
1286
|
+
// Actions runners on computers (FL-18). The plan proposed an hour for an
|
|
1287
|
+
// install and ten minutes for a control; like FL-16's kinds they do NOT
|
|
1288
|
+
// undercut the shortest existing default (the fallback an unknown kind fails
|
|
1289
|
+
// closed to), so an older reader's answer for an unknown kind is unchanged.
|
|
1290
|
+
"runner-install": 2 * 60 * 60,
|
|
1291
|
+
"runner-control": 2 * 60 * 60
|
|
1277
1292
|
});
|
|
1278
1293
|
var FLEET_JOB_MAX_QUEUED_MAX_AGE_SEC = 7 * 24 * 60 * 60;
|
|
1279
1294
|
var FLEET_AGENT_EXECUTION_MAX_INSTRUCTIONS_BYTES = 160 * 1024;
|
|
@@ -1615,7 +1630,7 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1615
1630
|
route: GET("/api/fleet/nodes/{id}/desktop/screenshot"),
|
|
1616
1631
|
cli: "fleet desktop screenshot"
|
|
1617
1632
|
}),
|
|
1618
|
-
read("fleet_desktop_displays", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "
|
|
1633
|
+
read("fleet_desktop_displays", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "live", {
|
|
1619
1634
|
route: GET("/api/fleet/nodes/{id}/desktop/displays"),
|
|
1620
1635
|
cli: "fleet desktop displays"
|
|
1621
1636
|
}),
|
|
@@ -1889,6 +1904,9 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1889
1904
|
route: GET("/api/fleet/checkouts/{id}/changes"),
|
|
1890
1905
|
cli: "fleet checkouts changes"
|
|
1891
1906
|
}),
|
|
1907
|
+
read("fleet_checkouts_pull_request_get", "checkouts", "FL-06", "FLEET_CHECKOUTS_ENABLED", "planned", {
|
|
1908
|
+
route: GET("/api/fleet/checkouts/{id}/pull-request")
|
|
1909
|
+
}),
|
|
1892
1910
|
act("fleet_checkouts_create", "checkouts", "FL-14", "FLEET_CHECKOUTS_ENABLED", "live", plain("machine.run"), {
|
|
1893
1911
|
route: POST("/api/fleet/checkouts"),
|
|
1894
1912
|
cli: "fleet checkouts create",
|
|
@@ -1969,9 +1987,9 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1969
1987
|
waitable: true,
|
|
1970
1988
|
alwaysHeld: true
|
|
1971
1989
|
}),
|
|
1972
|
-
// ── cloud (FL-17) ── P1 shipped
|
|
1973
|
-
// change and a destroy are held for the
|
|
1974
|
-
// (`agent-fleet-cloud-tools.ts`)
|
|
1990
|
+
// ── cloud (FL-17) ── P1 shipped providers, create, power, destroy, usage; P2 the idle policy
|
|
1991
|
+
// (`PUT` answers the same as `PATCH`). A create, a power change and a destroy are held for the
|
|
1992
|
+
// owner's approval by the Agent tools (`agent-fleet-cloud-tools.ts`).
|
|
1975
1993
|
read("fleet_cloud_list", "view", "FL-17", "FLEET_CLOUD_ENABLED", "live", {
|
|
1976
1994
|
phase: "P3",
|
|
1977
1995
|
route: GET("/api/fleet/cloud"),
|
|
@@ -2010,18 +2028,20 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
2010
2028
|
waitable: true,
|
|
2011
2029
|
alwaysHeld: true
|
|
2012
2030
|
}),
|
|
2013
|
-
act("fleet_cloud_idle_policy", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "
|
|
2031
|
+
act("fleet_cloud_idle_policy", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "live", plain("machine.admin"), {
|
|
2014
2032
|
phase: "P3",
|
|
2015
2033
|
route: PATCH("/api/fleet/cloud/{id}/idle-policy"),
|
|
2016
2034
|
cli: "fleet cloud idle-policy"
|
|
2017
2035
|
}),
|
|
2018
|
-
// ── runners (FL-18) ──
|
|
2019
|
-
|
|
2036
|
+
// ── runners (FL-18) ── P1 shipped: list, install, start / stop / restart, remove. An install, a
|
|
2037
|
+
// stop, a restart and a remove asked by an Agent are held for the owner's approval
|
|
2038
|
+
// (`agent-fleet-runners-tools.ts`). P2: the Actions jobs read and Cancel workflow run (always held for an Agent).
|
|
2039
|
+
read("fleet_runners_list", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "live", {
|
|
2020
2040
|
phase: "P3",
|
|
2021
2041
|
route: GET("/api/fleet/nodes/{id}/runners"),
|
|
2022
2042
|
cli: "fleet runners list"
|
|
2023
2043
|
}),
|
|
2024
|
-
read("fleet_runners_jobs", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "
|
|
2044
|
+
read("fleet_runners_jobs", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "live", {
|
|
2025
2045
|
phase: "P3",
|
|
2026
2046
|
route: GET("/api/fleet/runners/jobs"),
|
|
2027
2047
|
cli: "fleet runners jobs"
|
|
@@ -2031,23 +2051,29 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
2031
2051
|
"machines",
|
|
2032
2052
|
"FL-18",
|
|
2033
2053
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
2034
|
-
"
|
|
2054
|
+
"live",
|
|
2035
2055
|
confirm("machine.admin"),
|
|
2036
|
-
{
|
|
2056
|
+
{
|
|
2057
|
+
phase: "P3",
|
|
2058
|
+
route: POST("/api/fleet/nodes/{id}/runners"),
|
|
2059
|
+
cli: "fleet runners install",
|
|
2060
|
+
waitable: true,
|
|
2061
|
+
alwaysHeld: true
|
|
2062
|
+
}
|
|
2037
2063
|
),
|
|
2038
2064
|
act(
|
|
2039
2065
|
"fleet_runners_action",
|
|
2040
2066
|
"machines",
|
|
2041
2067
|
"FL-18",
|
|
2042
2068
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
2043
|
-
"
|
|
2069
|
+
"live",
|
|
2044
2070
|
confirm("machine.admin"),
|
|
2045
2071
|
{
|
|
2046
2072
|
phase: "P3",
|
|
2047
2073
|
route: POST("/api/fleet/nodes/{id}/runners/{runnerId}/{action}"),
|
|
2048
2074
|
cli: "fleet runners action",
|
|
2049
2075
|
waitable: true,
|
|
2050
|
-
confirmationNote: "plain to start; confirm to stop and restart"
|
|
2076
|
+
confirmationNote: "plain to start; confirm to stop and restart (an Agent's stop or restart is held for the owner)"
|
|
2051
2077
|
}
|
|
2052
2078
|
),
|
|
2053
2079
|
act(
|
|
@@ -2055,21 +2081,34 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
2055
2081
|
"machines",
|
|
2056
2082
|
"FL-18",
|
|
2057
2083
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
2058
|
-
"
|
|
2084
|
+
"live",
|
|
2059
2085
|
typed("write.destructive"),
|
|
2060
|
-
{
|
|
2086
|
+
{
|
|
2087
|
+
phase: "P3",
|
|
2088
|
+
route: POST("/api/fleet/nodes/{id}/runners/{runnerId}/remove"),
|
|
2089
|
+
cli: "fleet runners remove",
|
|
2090
|
+
waitable: true,
|
|
2091
|
+
alwaysHeld: true
|
|
2092
|
+
}
|
|
2061
2093
|
),
|
|
2062
2094
|
act(
|
|
2063
2095
|
"fleet_runners_cancel_run",
|
|
2064
2096
|
"machines",
|
|
2065
2097
|
"FL-18",
|
|
2066
2098
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
2067
|
-
"
|
|
2099
|
+
"live",
|
|
2068
2100
|
confirm("machine.admin"),
|
|
2069
|
-
{
|
|
2101
|
+
{
|
|
2102
|
+
phase: "P3",
|
|
2103
|
+
route: POST("/api/fleet/runners/jobs/cancel"),
|
|
2104
|
+
cli: "fleet runners cancel-run",
|
|
2105
|
+
alwaysHeld: true
|
|
2106
|
+
}
|
|
2070
2107
|
),
|
|
2071
|
-
// ── usage (FL-20) ──
|
|
2072
|
-
|
|
2108
|
+
// ── usage (FL-20) ── P1 shipped: the Usage object (totals, by model, by computer, busiest
|
|
2109
|
+
// checkouts, sessions) every surface renders, read-only, with the payer sentence in `note`.
|
|
2110
|
+
read("fleet_usage_get", "view", "FL-20", "FLEET_USAGE_SCAN_ENABLED", "live", {
|
|
2111
|
+
phase: "P3",
|
|
2073
2112
|
route: GET("/api/fleet/usage"),
|
|
2074
2113
|
cli: "fleet usage"
|
|
2075
2114
|
}),
|
|
@@ -2240,10 +2279,74 @@ var FLEET_VIRTUAL_SYSTEMS = [
|
|
|
2240
2279
|
approxDownloadGiB: 0.7
|
|
2241
2280
|
}
|
|
2242
2281
|
];
|
|
2243
|
-
var FLEET_VIRTUAL_SYSTEM_IDS = FLEET_VIRTUAL_SYSTEMS.map(
|
|
2282
|
+
var FLEET_VIRTUAL_SYSTEM_IDS = FLEET_VIRTUAL_SYSTEMS.map(
|
|
2283
|
+
(system) => system.id
|
|
2284
|
+
);
|
|
2244
2285
|
var FLEET_VIRTUAL_ENROLL_TIMEOUT_MS = 20 * 60 * 1e3;
|
|
2245
2286
|
var FLEET_CLOUD_OPTIONS_CACHE_MS = 10 * 60 * 1e3;
|
|
2246
2287
|
var HOUR_MS2 = 60 * 60 * 1e3;
|
|
2288
|
+
var FLEET_CLOUD_USAGE_FRESH_MS = 5 * 60 * 1e3;
|
|
2289
|
+
var FLEET_USAGE_SCAN_INTERVAL_MS = 15 * 60 * 1e3;
|
|
2290
|
+
var FLEET_USAGE_REPORT_MAX_BYTES = 192 * 1024;
|
|
2291
|
+
var FLEET_USAGE_ZERO_TOKENS = Object.freeze({
|
|
2292
|
+
in: 0,
|
|
2293
|
+
out: 0,
|
|
2294
|
+
cacheRead: 0,
|
|
2295
|
+
cacheWrite: 0
|
|
2296
|
+
});
|
|
2297
|
+
var FLEET_ACTIONS_RUNNERS_CLOSED_REFRESH_MS = 5 * 6e4;
|
|
2298
|
+
var FLEET_ACTIONS_RUNNER_DOWNLOADS_CACHE_MS = 60 * 6e4;
|
|
2299
|
+
var FLEET_DESKTOP_CONTROL_REASON_FIXES = Object.freeze({
|
|
2300
|
+
"control-not-allowed": { command: "ever-works-node helper control allow" },
|
|
2301
|
+
"permission-accessibility": { settingsPath: "System Settings \u2192 Privacy & Security \u2192 Accessibility" },
|
|
2302
|
+
"input-unavailable": {}
|
|
2303
|
+
});
|
|
2304
|
+
var FLEET_DESKTOP_REASONS = [
|
|
2305
|
+
"kind-unsupported",
|
|
2306
|
+
"wayland-unsupported",
|
|
2307
|
+
"helper-missing",
|
|
2308
|
+
"helper-unadmitted",
|
|
2309
|
+
"helper-untrusted",
|
|
2310
|
+
"no-display-session",
|
|
2311
|
+
"permission-screen-recording",
|
|
2312
|
+
"permission-accessibility"
|
|
2313
|
+
];
|
|
2314
|
+
var FLEET_DESKTOP_WATCH_REASONS = FLEET_DESKTOP_REASONS.filter(
|
|
2315
|
+
(reason) => reason !== "permission-accessibility"
|
|
2316
|
+
);
|
|
2317
|
+
var FLEET_DESKTOP_MAX_REASONS = FLEET_DESKTOP_REASONS.length;
|
|
2318
|
+
var FLEET_DESKTOP_REASON_FIXES = Object.freeze({
|
|
2319
|
+
"kind-unsupported": Object.freeze({}),
|
|
2320
|
+
"wayland-unsupported": Object.freeze({}),
|
|
2321
|
+
"helper-missing": Object.freeze({ command: "ever-works-node helper install" }),
|
|
2322
|
+
"helper-unadmitted": Object.freeze({ command: "ever-works-node helper admit" }),
|
|
2323
|
+
"helper-untrusted": Object.freeze({ command: "ever-works-node helper status" }),
|
|
2324
|
+
"no-display-session": Object.freeze({}),
|
|
2325
|
+
"permission-screen-recording": Object.freeze({
|
|
2326
|
+
settingsPath: "System Settings \u2192 Privacy & Security \u2192 Screen Recording"
|
|
2327
|
+
}),
|
|
2328
|
+
"permission-accessibility": Object.freeze({ settingsPath: "System Settings \u2192 Privacy & Security \u2192 Accessibility" })
|
|
2329
|
+
});
|
|
2330
|
+
var FLEET_DESKTOP_BLOCKER_CODES = Object.freeze({
|
|
2331
|
+
"kill-switch": "kill_switch",
|
|
2332
|
+
"kind-unsupported": "unsupported_on_node",
|
|
2333
|
+
offline: "unreachable",
|
|
2334
|
+
"consent-missing": "consent_missing",
|
|
2335
|
+
"permission-denied": "permission_denied",
|
|
2336
|
+
"wayland-unsupported": "unsupported_on_node",
|
|
2337
|
+
"helper-missing": "unsupported_on_node",
|
|
2338
|
+
"helper-unadmitted": "unsupported_on_node",
|
|
2339
|
+
"helper-untrusted": "unsupported_on_node",
|
|
2340
|
+
"no-display-session": "unsupported_on_node",
|
|
2341
|
+
"permission-screen-recording": "unsupported_on_node",
|
|
2342
|
+
"link-unavailable": "unreachable"
|
|
2343
|
+
});
|
|
2344
|
+
var FLEET_DESKTOP_VIEW_CEILING_MS = 4 * 60 * 6e4;
|
|
2345
|
+
var FLEET_DESKTOP_MAX_PUBLISH_BYTES = 512 * 1024;
|
|
2346
|
+
var FLEET_DESKTOP_RECORDING_MAX_BYTES = 200 * 1024 * 1024;
|
|
2347
|
+
var FLEET_DESKTOP_RECORDING_MAX_MS = 4 * 60 * 6e4;
|
|
2348
|
+
var FLEET_DESKTOP_RECORDING_MAGIC = new Uint8Array([69, 87, 82, 49]);
|
|
2349
|
+
var FLEET_DESKTOP_RECORDING_MAX_CHUNK_BYTES = 64 * 1024 * 1024;
|
|
2247
2350
|
var EMAIL_INBOX_DEFAULT_DAILY_CAP = 100;
|
|
2248
2351
|
var EMAIL_INBOX_BURST_SENDS = 10;
|
|
2249
2352
|
var EMAIL_INBOX_BURST_RECIPIENTS = 20;
|
|
@@ -3623,7 +3726,14 @@ var PLUGIN_CAPABILITIES = {
|
|
|
3623
3726
|
// `capabilities/machine-provider.interface.ts`. Appended **last**, so every
|
|
3624
3727
|
// existing constant keeps its value and its position, and landed in the same
|
|
3625
3728
|
// change as the `machine-provider` category in `plugin-manifest.types.ts`.
|
|
3626
|
-
MACHINE_PROVIDER: "machine-provider"
|
|
3729
|
+
MACHINE_PROVIDER: "machine-provider",
|
|
3730
|
+
// Actions runners on computers (FL-18, CONTRACTS R-14) — GitHub's self-hosted
|
|
3731
|
+
// runner API through the Ever Works GitHub App (`github-actions-runners`),
|
|
3732
|
+
// consumed only through `ActionsRunnersFacadeService`; see
|
|
3733
|
+
// `capabilities/actions-runners.interface.ts`. Appended last, so every
|
|
3734
|
+
// existing constant keeps its value and its position; no category is added
|
|
3735
|
+
// (the plugin is an `integration`, which exists).
|
|
3736
|
+
ACTIONS_RUNNERS: "actions-runners"
|
|
3627
3737
|
};
|
|
3628
3738
|
var ALL_PLUGIN_CAPABILITIES = Object.values(PLUGIN_CAPABILITIES);
|
|
3629
3739
|
function validateRequiredItemFields(data) {
|
|
@@ -3715,6 +3825,161 @@ function substituteVariables(template, variables) {
|
|
|
3715
3825
|
return value !== void 0 ? value : match;
|
|
3716
3826
|
});
|
|
3717
3827
|
}
|
|
3828
|
+
function zod3ParsedType(data) {
|
|
3829
|
+
switch (typeof data) {
|
|
3830
|
+
case "undefined":
|
|
3831
|
+
return "undefined";
|
|
3832
|
+
case "string":
|
|
3833
|
+
return "string";
|
|
3834
|
+
case "number":
|
|
3835
|
+
return Number.isNaN(data) ? "nan" : "number";
|
|
3836
|
+
case "boolean":
|
|
3837
|
+
return "boolean";
|
|
3838
|
+
case "function":
|
|
3839
|
+
return "function";
|
|
3840
|
+
case "bigint":
|
|
3841
|
+
return "bigint";
|
|
3842
|
+
case "symbol":
|
|
3843
|
+
return "symbol";
|
|
3844
|
+
case "object": {
|
|
3845
|
+
if (Array.isArray(data)) return "array";
|
|
3846
|
+
if (data === null) return "null";
|
|
3847
|
+
const thenable = data;
|
|
3848
|
+
if (typeof thenable.then === "function" && typeof thenable.catch === "function") return "promise";
|
|
3849
|
+
if (data instanceof Map) return "map";
|
|
3850
|
+
if (data instanceof Set) return "set";
|
|
3851
|
+
if (data instanceof Date) return "date";
|
|
3852
|
+
return "object";
|
|
3853
|
+
}
|
|
3854
|
+
default:
|
|
3855
|
+
return "unknown";
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
function joinValues(values, separator = " | ") {
|
|
3859
|
+
return values.map((value) => typeof value === "string" ? `'${value}'` : value).join(separator);
|
|
3860
|
+
}
|
|
3861
|
+
function bigIntSafe(_key, value) {
|
|
3862
|
+
return typeof value === "bigint" ? value.toString() : value;
|
|
3863
|
+
}
|
|
3864
|
+
function schemaType(issue) {
|
|
3865
|
+
return issue.inst?._zod?.def?.type;
|
|
3866
|
+
}
|
|
3867
|
+
var ZOD3_EXPECTED = {
|
|
3868
|
+
record: "object",
|
|
3869
|
+
tuple: "array"
|
|
3870
|
+
};
|
|
3871
|
+
var ZOD3_FORMAT = {
|
|
3872
|
+
guid: "uuid",
|
|
3873
|
+
ipv4: "ip",
|
|
3874
|
+
ipv6: "ip",
|
|
3875
|
+
cidrv4: "cidr",
|
|
3876
|
+
cidrv6: "cidr"
|
|
3877
|
+
};
|
|
3878
|
+
var ZOD4_ONLY_FORMATS = /* @__PURE__ */ new Set(["lowercase", "uppercase", "e164", "ksuid", "xid", "mac", "hex", "hash"]);
|
|
3879
|
+
function invalidType(issue) {
|
|
3880
|
+
if (issue.input === void 0) return "Required";
|
|
3881
|
+
if (issue.expected === "date" && issue.input instanceof Date) return "Invalid date";
|
|
3882
|
+
const received = zod3ParsedType(issue.input);
|
|
3883
|
+
if (issue.expected === "int") {
|
|
3884
|
+
return typeof issue.input === "number" ? "Expected integer, received float" : `Expected number, received ${received}`;
|
|
3885
|
+
}
|
|
3886
|
+
const expected = ZOD3_EXPECTED[issue.expected ?? ""] ?? issue.expected;
|
|
3887
|
+
return `Expected ${expected}, received ${received}`;
|
|
3888
|
+
}
|
|
3889
|
+
function invalidValue(issue) {
|
|
3890
|
+
const values = issue.values ?? [];
|
|
3891
|
+
if (schemaType(issue) === "literal") {
|
|
3892
|
+
return `Invalid literal value, expected ${JSON.stringify(values.length === 1 ? values[0] : values, bigIntSafe)}`;
|
|
3893
|
+
}
|
|
3894
|
+
if (issue.input === void 0) return "Required";
|
|
3895
|
+
const stringEnum = values.every((value) => typeof value === "string");
|
|
3896
|
+
const input = issue.input;
|
|
3897
|
+
if (stringEnum && typeof input !== "string" || typeof input !== "string" && typeof input !== "number") {
|
|
3898
|
+
return `Expected ${joinValues(values)}, received ${zod3ParsedType(input)}`;
|
|
3899
|
+
}
|
|
3900
|
+
return `Invalid enum value. Expected ${joinValues(values)}, received '${String(input)}'`;
|
|
3901
|
+
}
|
|
3902
|
+
function invalidFormat(issue) {
|
|
3903
|
+
const format = issue.format ?? "";
|
|
3904
|
+
switch (format) {
|
|
3905
|
+
case "regex":
|
|
3906
|
+
return "Invalid";
|
|
3907
|
+
case "starts_with":
|
|
3908
|
+
return `Invalid input: must start with "${issue.prefix}"`;
|
|
3909
|
+
case "ends_with":
|
|
3910
|
+
return `Invalid input: must end with "${issue.suffix}"`;
|
|
3911
|
+
case "includes":
|
|
3912
|
+
return `Invalid input: must include "${issue.includes}"`;
|
|
3913
|
+
default:
|
|
3914
|
+
if (!format || ZOD4_ONLY_FORMATS.has(format)) return void 0;
|
|
3915
|
+
return `Invalid ${ZOD3_FORMAT[format] ?? format}`;
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
function tooSmall(issue) {
|
|
3919
|
+
const { exact, inclusive, minimum } = issue;
|
|
3920
|
+
switch (issue.origin) {
|
|
3921
|
+
case "array":
|
|
3922
|
+
return `Array must contain ${exact ? "exactly" : inclusive ? "at least" : "more than"} ${minimum} element(s)`;
|
|
3923
|
+
case "string":
|
|
3924
|
+
return `String must contain ${exact ? "exactly" : inclusive ? "at least" : "over"} ${minimum} character(s)`;
|
|
3925
|
+
case "number":
|
|
3926
|
+
case "int":
|
|
3927
|
+
case "bigint":
|
|
3928
|
+
return `Number must be ${exact ? "exactly equal to " : inclusive ? "greater than or equal to " : "greater than "}${minimum}`;
|
|
3929
|
+
case "date":
|
|
3930
|
+
return `Date must be ${exact ? "exactly equal to " : inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(minimum))}`;
|
|
3931
|
+
default:
|
|
3932
|
+
return "Invalid input";
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3935
|
+
function tooBig(issue) {
|
|
3936
|
+
const { exact, inclusive, maximum } = issue;
|
|
3937
|
+
switch (issue.origin) {
|
|
3938
|
+
case "array":
|
|
3939
|
+
return `Array must contain ${exact ? "exactly" : inclusive ? "at most" : "less than"} ${maximum} element(s)`;
|
|
3940
|
+
case "string":
|
|
3941
|
+
return `String must contain ${exact ? "exactly" : inclusive ? "at most" : "under"} ${maximum} character(s)`;
|
|
3942
|
+
case "number":
|
|
3943
|
+
case "int":
|
|
3944
|
+
return `Number must be ${exact ? "exactly" : inclusive ? "less than or equal to" : "less than"} ${maximum}`;
|
|
3945
|
+
case "bigint":
|
|
3946
|
+
return `BigInt must be ${exact ? "exactly" : inclusive ? "less than or equal to" : "less than"} ${maximum}`;
|
|
3947
|
+
case "date":
|
|
3948
|
+
return `Date must be ${exact ? "exactly" : inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(maximum))}`;
|
|
3949
|
+
default:
|
|
3950
|
+
return "Invalid input";
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
function zod3ErrorMessage(issue) {
|
|
3954
|
+
switch (issue.code) {
|
|
3955
|
+
case "invalid_type":
|
|
3956
|
+
return invalidType(issue);
|
|
3957
|
+
case "invalid_value":
|
|
3958
|
+
return invalidValue(issue);
|
|
3959
|
+
case "unrecognized_keys":
|
|
3960
|
+
return `Unrecognized key(s) in object: ${joinValues(issue.keys ?? [], ", ")}`;
|
|
3961
|
+
case "invalid_union":
|
|
3962
|
+
if (issue.discriminator !== void 0 && issue.options) {
|
|
3963
|
+
return `Invalid discriminator value. Expected ${joinValues(issue.options)}`;
|
|
3964
|
+
}
|
|
3965
|
+
return "Invalid input";
|
|
3966
|
+
case "invalid_format":
|
|
3967
|
+
return invalidFormat(issue);
|
|
3968
|
+
case "too_small":
|
|
3969
|
+
return tooSmall(issue);
|
|
3970
|
+
case "too_big":
|
|
3971
|
+
return tooBig(issue);
|
|
3972
|
+
case "not_multiple_of":
|
|
3973
|
+
return `Number must be a multiple of ${issue.divisor}`;
|
|
3974
|
+
case "custom":
|
|
3975
|
+
return "Invalid input";
|
|
3976
|
+
case "invalid_key":
|
|
3977
|
+
return issue.issues?.[0]?.message;
|
|
3978
|
+
default:
|
|
3979
|
+
return void 0;
|
|
3980
|
+
}
|
|
3981
|
+
}
|
|
3982
|
+
var ZOD3_ERROR_MESSAGES = Object.freeze({ error: zod3ErrorMessage });
|
|
3718
3983
|
|
|
3719
3984
|
// src/types.ts
|
|
3720
3985
|
var os = __toESM(require("os"), 1);
|
package/dist/index.js
CHANGED
|
@@ -464,7 +464,11 @@ var TASK_RESERVED_LABELS = Object.freeze([
|
|
|
464
464
|
"release:promotion",
|
|
465
465
|
"release:revert"
|
|
466
466
|
]);
|
|
467
|
-
var TASK_RESERVED_LABEL_PREFIXES = Object.freeze([
|
|
467
|
+
var TASK_RESERVED_LABEL_PREFIXES = Object.freeze([
|
|
468
|
+
"release:",
|
|
469
|
+
"provision-attempt-",
|
|
470
|
+
"fleet:"
|
|
471
|
+
]);
|
|
468
472
|
var PLATFORM_DEFAULT_MERGE_POLICY = Object.freeze({
|
|
469
473
|
allowAgentMerge: false,
|
|
470
474
|
requireGreenGate: true,
|
|
@@ -1234,7 +1238,18 @@ var FLEET_JOB_DEFAULT_QUEUED_MAX_AGE_SEC = Object.freeze({
|
|
|
1234
1238
|
// fails closed to), so an older reader's "unknown kind" answer is unchanged.
|
|
1235
1239
|
// A control the owner no longer wants is cancelled with its child's row.
|
|
1236
1240
|
"vm-create": 2 * 60 * 60,
|
|
1237
|
-
"vm-control": 2 * 60 * 60
|
|
1241
|
+
"vm-control": 2 * 60 * 60,
|
|
1242
|
+
// Usage scan (FL-20). The plan proposed 15 minutes (one scan interval); like
|
|
1243
|
+
// the kinds above it does NOT undercut the shortest existing default (the
|
|
1244
|
+
// fallback an unknown kind fails closed to). A scan nobody leased is simply
|
|
1245
|
+
// superseded: the dispatcher never enqueues a second while one is queued.
|
|
1246
|
+
"usage-scan": 2 * 60 * 60,
|
|
1247
|
+
// Actions runners on computers (FL-18). The plan proposed an hour for an
|
|
1248
|
+
// install and ten minutes for a control; like FL-16's kinds they do NOT
|
|
1249
|
+
// undercut the shortest existing default (the fallback an unknown kind fails
|
|
1250
|
+
// closed to), so an older reader's answer for an unknown kind is unchanged.
|
|
1251
|
+
"runner-install": 2 * 60 * 60,
|
|
1252
|
+
"runner-control": 2 * 60 * 60
|
|
1238
1253
|
});
|
|
1239
1254
|
var FLEET_JOB_MAX_QUEUED_MAX_AGE_SEC = 7 * 24 * 60 * 60;
|
|
1240
1255
|
var FLEET_AGENT_EXECUTION_MAX_INSTRUCTIONS_BYTES = 160 * 1024;
|
|
@@ -1576,7 +1591,7 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1576
1591
|
route: GET("/api/fleet/nodes/{id}/desktop/screenshot"),
|
|
1577
1592
|
cli: "fleet desktop screenshot"
|
|
1578
1593
|
}),
|
|
1579
|
-
read("fleet_desktop_displays", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "
|
|
1594
|
+
read("fleet_desktop_displays", "desktop", "FL-07", "FLEET_DESKTOP_ENABLED", "live", {
|
|
1580
1595
|
route: GET("/api/fleet/nodes/{id}/desktop/displays"),
|
|
1581
1596
|
cli: "fleet desktop displays"
|
|
1582
1597
|
}),
|
|
@@ -1850,6 +1865,9 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1850
1865
|
route: GET("/api/fleet/checkouts/{id}/changes"),
|
|
1851
1866
|
cli: "fleet checkouts changes"
|
|
1852
1867
|
}),
|
|
1868
|
+
read("fleet_checkouts_pull_request_get", "checkouts", "FL-06", "FLEET_CHECKOUTS_ENABLED", "planned", {
|
|
1869
|
+
route: GET("/api/fleet/checkouts/{id}/pull-request")
|
|
1870
|
+
}),
|
|
1853
1871
|
act("fleet_checkouts_create", "checkouts", "FL-14", "FLEET_CHECKOUTS_ENABLED", "live", plain("machine.run"), {
|
|
1854
1872
|
route: POST("/api/fleet/checkouts"),
|
|
1855
1873
|
cli: "fleet checkouts create",
|
|
@@ -1930,9 +1948,9 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1930
1948
|
waitable: true,
|
|
1931
1949
|
alwaysHeld: true
|
|
1932
1950
|
}),
|
|
1933
|
-
// ── cloud (FL-17) ── P1 shipped
|
|
1934
|
-
// change and a destroy are held for the
|
|
1935
|
-
// (`agent-fleet-cloud-tools.ts`)
|
|
1951
|
+
// ── cloud (FL-17) ── P1 shipped providers, create, power, destroy, usage; P2 the idle policy
|
|
1952
|
+
// (`PUT` answers the same as `PATCH`). A create, a power change and a destroy are held for the
|
|
1953
|
+
// owner's approval by the Agent tools (`agent-fleet-cloud-tools.ts`).
|
|
1936
1954
|
read("fleet_cloud_list", "view", "FL-17", "FLEET_CLOUD_ENABLED", "live", {
|
|
1937
1955
|
phase: "P3",
|
|
1938
1956
|
route: GET("/api/fleet/cloud"),
|
|
@@ -1971,18 +1989,20 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1971
1989
|
waitable: true,
|
|
1972
1990
|
alwaysHeld: true
|
|
1973
1991
|
}),
|
|
1974
|
-
act("fleet_cloud_idle_policy", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "
|
|
1992
|
+
act("fleet_cloud_idle_policy", "machines", "FL-17", "FLEET_CLOUD_ENABLED", "live", plain("machine.admin"), {
|
|
1975
1993
|
phase: "P3",
|
|
1976
1994
|
route: PATCH("/api/fleet/cloud/{id}/idle-policy"),
|
|
1977
1995
|
cli: "fleet cloud idle-policy"
|
|
1978
1996
|
}),
|
|
1979
|
-
// ── runners (FL-18) ──
|
|
1980
|
-
|
|
1997
|
+
// ── runners (FL-18) ── P1 shipped: list, install, start / stop / restart, remove. An install, a
|
|
1998
|
+
// stop, a restart and a remove asked by an Agent are held for the owner's approval
|
|
1999
|
+
// (`agent-fleet-runners-tools.ts`). P2: the Actions jobs read and Cancel workflow run (always held for an Agent).
|
|
2000
|
+
read("fleet_runners_list", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "live", {
|
|
1981
2001
|
phase: "P3",
|
|
1982
2002
|
route: GET("/api/fleet/nodes/{id}/runners"),
|
|
1983
2003
|
cli: "fleet runners list"
|
|
1984
2004
|
}),
|
|
1985
|
-
read("fleet_runners_jobs", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "
|
|
2005
|
+
read("fleet_runners_jobs", "view", "FL-18", "FLEET_ACTIONS_RUNNERS_ENABLED", "live", {
|
|
1986
2006
|
phase: "P3",
|
|
1987
2007
|
route: GET("/api/fleet/runners/jobs"),
|
|
1988
2008
|
cli: "fleet runners jobs"
|
|
@@ -1992,23 +2012,29 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
1992
2012
|
"machines",
|
|
1993
2013
|
"FL-18",
|
|
1994
2014
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
1995
|
-
"
|
|
2015
|
+
"live",
|
|
1996
2016
|
confirm("machine.admin"),
|
|
1997
|
-
{
|
|
2017
|
+
{
|
|
2018
|
+
phase: "P3",
|
|
2019
|
+
route: POST("/api/fleet/nodes/{id}/runners"),
|
|
2020
|
+
cli: "fleet runners install",
|
|
2021
|
+
waitable: true,
|
|
2022
|
+
alwaysHeld: true
|
|
2023
|
+
}
|
|
1998
2024
|
),
|
|
1999
2025
|
act(
|
|
2000
2026
|
"fleet_runners_action",
|
|
2001
2027
|
"machines",
|
|
2002
2028
|
"FL-18",
|
|
2003
2029
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
2004
|
-
"
|
|
2030
|
+
"live",
|
|
2005
2031
|
confirm("machine.admin"),
|
|
2006
2032
|
{
|
|
2007
2033
|
phase: "P3",
|
|
2008
2034
|
route: POST("/api/fleet/nodes/{id}/runners/{runnerId}/{action}"),
|
|
2009
2035
|
cli: "fleet runners action",
|
|
2010
2036
|
waitable: true,
|
|
2011
|
-
confirmationNote: "plain to start; confirm to stop and restart"
|
|
2037
|
+
confirmationNote: "plain to start; confirm to stop and restart (an Agent's stop or restart is held for the owner)"
|
|
2012
2038
|
}
|
|
2013
2039
|
),
|
|
2014
2040
|
act(
|
|
@@ -2016,21 +2042,34 @@ var FLEET_TOOL_CATALOGUE = Object.freeze([
|
|
|
2016
2042
|
"machines",
|
|
2017
2043
|
"FL-18",
|
|
2018
2044
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
2019
|
-
"
|
|
2045
|
+
"live",
|
|
2020
2046
|
typed("write.destructive"),
|
|
2021
|
-
{
|
|
2047
|
+
{
|
|
2048
|
+
phase: "P3",
|
|
2049
|
+
route: POST("/api/fleet/nodes/{id}/runners/{runnerId}/remove"),
|
|
2050
|
+
cli: "fleet runners remove",
|
|
2051
|
+
waitable: true,
|
|
2052
|
+
alwaysHeld: true
|
|
2053
|
+
}
|
|
2022
2054
|
),
|
|
2023
2055
|
act(
|
|
2024
2056
|
"fleet_runners_cancel_run",
|
|
2025
2057
|
"machines",
|
|
2026
2058
|
"FL-18",
|
|
2027
2059
|
"FLEET_ACTIONS_RUNNERS_ENABLED",
|
|
2028
|
-
"
|
|
2060
|
+
"live",
|
|
2029
2061
|
confirm("machine.admin"),
|
|
2030
|
-
{
|
|
2062
|
+
{
|
|
2063
|
+
phase: "P3",
|
|
2064
|
+
route: POST("/api/fleet/runners/jobs/cancel"),
|
|
2065
|
+
cli: "fleet runners cancel-run",
|
|
2066
|
+
alwaysHeld: true
|
|
2067
|
+
}
|
|
2031
2068
|
),
|
|
2032
|
-
// ── usage (FL-20) ──
|
|
2033
|
-
|
|
2069
|
+
// ── usage (FL-20) ── P1 shipped: the Usage object (totals, by model, by computer, busiest
|
|
2070
|
+
// checkouts, sessions) every surface renders, read-only, with the payer sentence in `note`.
|
|
2071
|
+
read("fleet_usage_get", "view", "FL-20", "FLEET_USAGE_SCAN_ENABLED", "live", {
|
|
2072
|
+
phase: "P3",
|
|
2034
2073
|
route: GET("/api/fleet/usage"),
|
|
2035
2074
|
cli: "fleet usage"
|
|
2036
2075
|
}),
|
|
@@ -2201,10 +2240,74 @@ var FLEET_VIRTUAL_SYSTEMS = [
|
|
|
2201
2240
|
approxDownloadGiB: 0.7
|
|
2202
2241
|
}
|
|
2203
2242
|
];
|
|
2204
|
-
var FLEET_VIRTUAL_SYSTEM_IDS = FLEET_VIRTUAL_SYSTEMS.map(
|
|
2243
|
+
var FLEET_VIRTUAL_SYSTEM_IDS = FLEET_VIRTUAL_SYSTEMS.map(
|
|
2244
|
+
(system) => system.id
|
|
2245
|
+
);
|
|
2205
2246
|
var FLEET_VIRTUAL_ENROLL_TIMEOUT_MS = 20 * 60 * 1e3;
|
|
2206
2247
|
var FLEET_CLOUD_OPTIONS_CACHE_MS = 10 * 60 * 1e3;
|
|
2207
2248
|
var HOUR_MS2 = 60 * 60 * 1e3;
|
|
2249
|
+
var FLEET_CLOUD_USAGE_FRESH_MS = 5 * 60 * 1e3;
|
|
2250
|
+
var FLEET_USAGE_SCAN_INTERVAL_MS = 15 * 60 * 1e3;
|
|
2251
|
+
var FLEET_USAGE_REPORT_MAX_BYTES = 192 * 1024;
|
|
2252
|
+
var FLEET_USAGE_ZERO_TOKENS = Object.freeze({
|
|
2253
|
+
in: 0,
|
|
2254
|
+
out: 0,
|
|
2255
|
+
cacheRead: 0,
|
|
2256
|
+
cacheWrite: 0
|
|
2257
|
+
});
|
|
2258
|
+
var FLEET_ACTIONS_RUNNERS_CLOSED_REFRESH_MS = 5 * 6e4;
|
|
2259
|
+
var FLEET_ACTIONS_RUNNER_DOWNLOADS_CACHE_MS = 60 * 6e4;
|
|
2260
|
+
var FLEET_DESKTOP_CONTROL_REASON_FIXES = Object.freeze({
|
|
2261
|
+
"control-not-allowed": { command: "ever-works-node helper control allow" },
|
|
2262
|
+
"permission-accessibility": { settingsPath: "System Settings \u2192 Privacy & Security \u2192 Accessibility" },
|
|
2263
|
+
"input-unavailable": {}
|
|
2264
|
+
});
|
|
2265
|
+
var FLEET_DESKTOP_REASONS = [
|
|
2266
|
+
"kind-unsupported",
|
|
2267
|
+
"wayland-unsupported",
|
|
2268
|
+
"helper-missing",
|
|
2269
|
+
"helper-unadmitted",
|
|
2270
|
+
"helper-untrusted",
|
|
2271
|
+
"no-display-session",
|
|
2272
|
+
"permission-screen-recording",
|
|
2273
|
+
"permission-accessibility"
|
|
2274
|
+
];
|
|
2275
|
+
var FLEET_DESKTOP_WATCH_REASONS = FLEET_DESKTOP_REASONS.filter(
|
|
2276
|
+
(reason) => reason !== "permission-accessibility"
|
|
2277
|
+
);
|
|
2278
|
+
var FLEET_DESKTOP_MAX_REASONS = FLEET_DESKTOP_REASONS.length;
|
|
2279
|
+
var FLEET_DESKTOP_REASON_FIXES = Object.freeze({
|
|
2280
|
+
"kind-unsupported": Object.freeze({}),
|
|
2281
|
+
"wayland-unsupported": Object.freeze({}),
|
|
2282
|
+
"helper-missing": Object.freeze({ command: "ever-works-node helper install" }),
|
|
2283
|
+
"helper-unadmitted": Object.freeze({ command: "ever-works-node helper admit" }),
|
|
2284
|
+
"helper-untrusted": Object.freeze({ command: "ever-works-node helper status" }),
|
|
2285
|
+
"no-display-session": Object.freeze({}),
|
|
2286
|
+
"permission-screen-recording": Object.freeze({
|
|
2287
|
+
settingsPath: "System Settings \u2192 Privacy & Security \u2192 Screen Recording"
|
|
2288
|
+
}),
|
|
2289
|
+
"permission-accessibility": Object.freeze({ settingsPath: "System Settings \u2192 Privacy & Security \u2192 Accessibility" })
|
|
2290
|
+
});
|
|
2291
|
+
var FLEET_DESKTOP_BLOCKER_CODES = Object.freeze({
|
|
2292
|
+
"kill-switch": "kill_switch",
|
|
2293
|
+
"kind-unsupported": "unsupported_on_node",
|
|
2294
|
+
offline: "unreachable",
|
|
2295
|
+
"consent-missing": "consent_missing",
|
|
2296
|
+
"permission-denied": "permission_denied",
|
|
2297
|
+
"wayland-unsupported": "unsupported_on_node",
|
|
2298
|
+
"helper-missing": "unsupported_on_node",
|
|
2299
|
+
"helper-unadmitted": "unsupported_on_node",
|
|
2300
|
+
"helper-untrusted": "unsupported_on_node",
|
|
2301
|
+
"no-display-session": "unsupported_on_node",
|
|
2302
|
+
"permission-screen-recording": "unsupported_on_node",
|
|
2303
|
+
"link-unavailable": "unreachable"
|
|
2304
|
+
});
|
|
2305
|
+
var FLEET_DESKTOP_VIEW_CEILING_MS = 4 * 60 * 6e4;
|
|
2306
|
+
var FLEET_DESKTOP_MAX_PUBLISH_BYTES = 512 * 1024;
|
|
2307
|
+
var FLEET_DESKTOP_RECORDING_MAX_BYTES = 200 * 1024 * 1024;
|
|
2308
|
+
var FLEET_DESKTOP_RECORDING_MAX_MS = 4 * 60 * 6e4;
|
|
2309
|
+
var FLEET_DESKTOP_RECORDING_MAGIC = new Uint8Array([69, 87, 82, 49]);
|
|
2310
|
+
var FLEET_DESKTOP_RECORDING_MAX_CHUNK_BYTES = 64 * 1024 * 1024;
|
|
2208
2311
|
var EMAIL_INBOX_DEFAULT_DAILY_CAP = 100;
|
|
2209
2312
|
var EMAIL_INBOX_BURST_SENDS = 10;
|
|
2210
2313
|
var EMAIL_INBOX_BURST_RECIPIENTS = 20;
|
|
@@ -3584,7 +3687,14 @@ var PLUGIN_CAPABILITIES = {
|
|
|
3584
3687
|
// `capabilities/machine-provider.interface.ts`. Appended **last**, so every
|
|
3585
3688
|
// existing constant keeps its value and its position, and landed in the same
|
|
3586
3689
|
// change as the `machine-provider` category in `plugin-manifest.types.ts`.
|
|
3587
|
-
MACHINE_PROVIDER: "machine-provider"
|
|
3690
|
+
MACHINE_PROVIDER: "machine-provider",
|
|
3691
|
+
// Actions runners on computers (FL-18, CONTRACTS R-14) — GitHub's self-hosted
|
|
3692
|
+
// runner API through the Ever Works GitHub App (`github-actions-runners`),
|
|
3693
|
+
// consumed only through `ActionsRunnersFacadeService`; see
|
|
3694
|
+
// `capabilities/actions-runners.interface.ts`. Appended last, so every
|
|
3695
|
+
// existing constant keeps its value and its position; no category is added
|
|
3696
|
+
// (the plugin is an `integration`, which exists).
|
|
3697
|
+
ACTIONS_RUNNERS: "actions-runners"
|
|
3588
3698
|
};
|
|
3589
3699
|
var ALL_PLUGIN_CAPABILITIES = Object.values(PLUGIN_CAPABILITIES);
|
|
3590
3700
|
function validateRequiredItemFields(data) {
|
|
@@ -3676,6 +3786,161 @@ function substituteVariables(template, variables) {
|
|
|
3676
3786
|
return value !== void 0 ? value : match;
|
|
3677
3787
|
});
|
|
3678
3788
|
}
|
|
3789
|
+
function zod3ParsedType(data) {
|
|
3790
|
+
switch (typeof data) {
|
|
3791
|
+
case "undefined":
|
|
3792
|
+
return "undefined";
|
|
3793
|
+
case "string":
|
|
3794
|
+
return "string";
|
|
3795
|
+
case "number":
|
|
3796
|
+
return Number.isNaN(data) ? "nan" : "number";
|
|
3797
|
+
case "boolean":
|
|
3798
|
+
return "boolean";
|
|
3799
|
+
case "function":
|
|
3800
|
+
return "function";
|
|
3801
|
+
case "bigint":
|
|
3802
|
+
return "bigint";
|
|
3803
|
+
case "symbol":
|
|
3804
|
+
return "symbol";
|
|
3805
|
+
case "object": {
|
|
3806
|
+
if (Array.isArray(data)) return "array";
|
|
3807
|
+
if (data === null) return "null";
|
|
3808
|
+
const thenable = data;
|
|
3809
|
+
if (typeof thenable.then === "function" && typeof thenable.catch === "function") return "promise";
|
|
3810
|
+
if (data instanceof Map) return "map";
|
|
3811
|
+
if (data instanceof Set) return "set";
|
|
3812
|
+
if (data instanceof Date) return "date";
|
|
3813
|
+
return "object";
|
|
3814
|
+
}
|
|
3815
|
+
default:
|
|
3816
|
+
return "unknown";
|
|
3817
|
+
}
|
|
3818
|
+
}
|
|
3819
|
+
function joinValues(values, separator = " | ") {
|
|
3820
|
+
return values.map((value) => typeof value === "string" ? `'${value}'` : value).join(separator);
|
|
3821
|
+
}
|
|
3822
|
+
function bigIntSafe(_key, value) {
|
|
3823
|
+
return typeof value === "bigint" ? value.toString() : value;
|
|
3824
|
+
}
|
|
3825
|
+
function schemaType(issue) {
|
|
3826
|
+
return issue.inst?._zod?.def?.type;
|
|
3827
|
+
}
|
|
3828
|
+
var ZOD3_EXPECTED = {
|
|
3829
|
+
record: "object",
|
|
3830
|
+
tuple: "array"
|
|
3831
|
+
};
|
|
3832
|
+
var ZOD3_FORMAT = {
|
|
3833
|
+
guid: "uuid",
|
|
3834
|
+
ipv4: "ip",
|
|
3835
|
+
ipv6: "ip",
|
|
3836
|
+
cidrv4: "cidr",
|
|
3837
|
+
cidrv6: "cidr"
|
|
3838
|
+
};
|
|
3839
|
+
var ZOD4_ONLY_FORMATS = /* @__PURE__ */ new Set(["lowercase", "uppercase", "e164", "ksuid", "xid", "mac", "hex", "hash"]);
|
|
3840
|
+
function invalidType(issue) {
|
|
3841
|
+
if (issue.input === void 0) return "Required";
|
|
3842
|
+
if (issue.expected === "date" && issue.input instanceof Date) return "Invalid date";
|
|
3843
|
+
const received = zod3ParsedType(issue.input);
|
|
3844
|
+
if (issue.expected === "int") {
|
|
3845
|
+
return typeof issue.input === "number" ? "Expected integer, received float" : `Expected number, received ${received}`;
|
|
3846
|
+
}
|
|
3847
|
+
const expected = ZOD3_EXPECTED[issue.expected ?? ""] ?? issue.expected;
|
|
3848
|
+
return `Expected ${expected}, received ${received}`;
|
|
3849
|
+
}
|
|
3850
|
+
function invalidValue(issue) {
|
|
3851
|
+
const values = issue.values ?? [];
|
|
3852
|
+
if (schemaType(issue) === "literal") {
|
|
3853
|
+
return `Invalid literal value, expected ${JSON.stringify(values.length === 1 ? values[0] : values, bigIntSafe)}`;
|
|
3854
|
+
}
|
|
3855
|
+
if (issue.input === void 0) return "Required";
|
|
3856
|
+
const stringEnum = values.every((value) => typeof value === "string");
|
|
3857
|
+
const input = issue.input;
|
|
3858
|
+
if (stringEnum && typeof input !== "string" || typeof input !== "string" && typeof input !== "number") {
|
|
3859
|
+
return `Expected ${joinValues(values)}, received ${zod3ParsedType(input)}`;
|
|
3860
|
+
}
|
|
3861
|
+
return `Invalid enum value. Expected ${joinValues(values)}, received '${String(input)}'`;
|
|
3862
|
+
}
|
|
3863
|
+
function invalidFormat(issue) {
|
|
3864
|
+
const format = issue.format ?? "";
|
|
3865
|
+
switch (format) {
|
|
3866
|
+
case "regex":
|
|
3867
|
+
return "Invalid";
|
|
3868
|
+
case "starts_with":
|
|
3869
|
+
return `Invalid input: must start with "${issue.prefix}"`;
|
|
3870
|
+
case "ends_with":
|
|
3871
|
+
return `Invalid input: must end with "${issue.suffix}"`;
|
|
3872
|
+
case "includes":
|
|
3873
|
+
return `Invalid input: must include "${issue.includes}"`;
|
|
3874
|
+
default:
|
|
3875
|
+
if (!format || ZOD4_ONLY_FORMATS.has(format)) return void 0;
|
|
3876
|
+
return `Invalid ${ZOD3_FORMAT[format] ?? format}`;
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
function tooSmall(issue) {
|
|
3880
|
+
const { exact, inclusive, minimum } = issue;
|
|
3881
|
+
switch (issue.origin) {
|
|
3882
|
+
case "array":
|
|
3883
|
+
return `Array must contain ${exact ? "exactly" : inclusive ? "at least" : "more than"} ${minimum} element(s)`;
|
|
3884
|
+
case "string":
|
|
3885
|
+
return `String must contain ${exact ? "exactly" : inclusive ? "at least" : "over"} ${minimum} character(s)`;
|
|
3886
|
+
case "number":
|
|
3887
|
+
case "int":
|
|
3888
|
+
case "bigint":
|
|
3889
|
+
return `Number must be ${exact ? "exactly equal to " : inclusive ? "greater than or equal to " : "greater than "}${minimum}`;
|
|
3890
|
+
case "date":
|
|
3891
|
+
return `Date must be ${exact ? "exactly equal to " : inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(minimum))}`;
|
|
3892
|
+
default:
|
|
3893
|
+
return "Invalid input";
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
function tooBig(issue) {
|
|
3897
|
+
const { exact, inclusive, maximum } = issue;
|
|
3898
|
+
switch (issue.origin) {
|
|
3899
|
+
case "array":
|
|
3900
|
+
return `Array must contain ${exact ? "exactly" : inclusive ? "at most" : "less than"} ${maximum} element(s)`;
|
|
3901
|
+
case "string":
|
|
3902
|
+
return `String must contain ${exact ? "exactly" : inclusive ? "at most" : "under"} ${maximum} character(s)`;
|
|
3903
|
+
case "number":
|
|
3904
|
+
case "int":
|
|
3905
|
+
return `Number must be ${exact ? "exactly" : inclusive ? "less than or equal to" : "less than"} ${maximum}`;
|
|
3906
|
+
case "bigint":
|
|
3907
|
+
return `BigInt must be ${exact ? "exactly" : inclusive ? "less than or equal to" : "less than"} ${maximum}`;
|
|
3908
|
+
case "date":
|
|
3909
|
+
return `Date must be ${exact ? "exactly" : inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(maximum))}`;
|
|
3910
|
+
default:
|
|
3911
|
+
return "Invalid input";
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
function zod3ErrorMessage(issue) {
|
|
3915
|
+
switch (issue.code) {
|
|
3916
|
+
case "invalid_type":
|
|
3917
|
+
return invalidType(issue);
|
|
3918
|
+
case "invalid_value":
|
|
3919
|
+
return invalidValue(issue);
|
|
3920
|
+
case "unrecognized_keys":
|
|
3921
|
+
return `Unrecognized key(s) in object: ${joinValues(issue.keys ?? [], ", ")}`;
|
|
3922
|
+
case "invalid_union":
|
|
3923
|
+
if (issue.discriminator !== void 0 && issue.options) {
|
|
3924
|
+
return `Invalid discriminator value. Expected ${joinValues(issue.options)}`;
|
|
3925
|
+
}
|
|
3926
|
+
return "Invalid input";
|
|
3927
|
+
case "invalid_format":
|
|
3928
|
+
return invalidFormat(issue);
|
|
3929
|
+
case "too_small":
|
|
3930
|
+
return tooSmall(issue);
|
|
3931
|
+
case "too_big":
|
|
3932
|
+
return tooBig(issue);
|
|
3933
|
+
case "not_multiple_of":
|
|
3934
|
+
return `Number must be a multiple of ${issue.divisor}`;
|
|
3935
|
+
case "custom":
|
|
3936
|
+
return "Invalid input";
|
|
3937
|
+
case "invalid_key":
|
|
3938
|
+
return issue.issues?.[0]?.message;
|
|
3939
|
+
default:
|
|
3940
|
+
return void 0;
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
var ZOD3_ERROR_MESSAGES = Object.freeze({ error: zod3ErrorMessage });
|
|
3679
3944
|
|
|
3680
3945
|
// src/types.ts
|
|
3681
3946
|
import * as os from "os";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ever-works/hermes-agent-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Hermes Agent pipeline plugin for Ever Works",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ever Co. LTD",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"test:coverage": "vitest run --coverage"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@ever-works/plugin": "^1.2.
|
|
36
|
+
"@ever-works/plugin": "^1.2.12"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@ever-works/plugin": "^1.2.
|
|
39
|
+
"@ever-works/plugin": "^1.2.12",
|
|
40
40
|
"@types/node": "^26.6.4",
|
|
41
41
|
"tsup": "^8.0.0",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"url": "https://github.com/ever-works/ever-works/issues"
|
|
74
74
|
},
|
|
75
75
|
"everworksRelease": {
|
|
76
|
-
"contentHash": "sha256:
|
|
77
|
-
"commit": "
|
|
78
|
-
"source": "https://github.com/ever-works/ever-works/tree/
|
|
76
|
+
"contentHash": "sha256:12511a58188161eba121e5601bfe5e968c698eda836b9980c96aa356f41e824a",
|
|
77
|
+
"commit": "4b0b642a5bf671c9b0480d49307c2c4442730f28",
|
|
78
|
+
"source": "https://github.com/ever-works/ever-works/tree/4b0b642a5bf671c9b0480d49307c2c4442730f28/packages/plugins/hermes-agent"
|
|
79
79
|
}
|
|
80
80
|
}
|