@hasna/skills 0.8.9 → 0.8.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/README.md +51 -0
- package/bin/index.js +8124 -6361
- package/bin/mcp.js +279 -152
- package/bin/migrate.js +2 -1
- package/bin/server.js +2 -1
- package/bin/worker.js +2 -1
- package/dist/cli/commands/plugin-admission.d.ts +2 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +23482 -22258
- package/dist/lib/agent-adapters.d.ts +1 -0
- package/dist/lib/agent-codex-trust.d.ts +42 -0
- package/dist/lib/agent-discovery.d.ts +4 -2
- package/dist/lib/codex-hook-rpc.d.ts +13 -0
- package/dist/lib/codex-hook-trust-files.d.ts +15 -0
- package/dist/lib/codex-hook-trust-identity.d.ts +16 -0
- package/dist/lib/codex-hook-trust-layout.d.ts +3 -0
- package/dist/lib/plugin-admission.d.ts +101 -0
- package/dist/lib/plugin-discovery.d.ts +13 -0
- package/dist/lib/plugin-projection-store.d.ts +14 -0
- package/dist/lib/plugin-projection.d.ts +80 -0
- package/dist/lib/profile-client.d.ts +10 -0
- package/dist/lib/remote-client.d.ts +4 -1
- package/dist/lib/remote-customer-operations.d.ts +1 -1
- package/dist/lib/remote-permissions.d.ts +24 -0
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +2851 -1652
- package/docs/plugin-admission.md +198 -0
- package/package.json +2 -1
package/bin/mcp.js
CHANGED
|
@@ -20019,7 +20019,7 @@ var package_default;
|
|
|
20019
20019
|
var init_package = __esm(() => {
|
|
20020
20020
|
package_default = {
|
|
20021
20021
|
name: "@hasna/skills",
|
|
20022
|
-
version: "0.8.
|
|
20022
|
+
version: "0.8.10",
|
|
20023
20023
|
description: "Skills library for AI coding agents",
|
|
20024
20024
|
type: "module",
|
|
20025
20025
|
bin: {
|
|
@@ -20057,6 +20057,7 @@ var init_package = __esm(() => {
|
|
|
20057
20057
|
"bin/",
|
|
20058
20058
|
"migrations/",
|
|
20059
20059
|
"docs/skill-standard.md",
|
|
20060
|
+
"docs/plugin-admission.md",
|
|
20060
20061
|
"schemas/",
|
|
20061
20062
|
"LICENSE",
|
|
20062
20063
|
"README.md",
|
|
@@ -39811,7 +39812,18 @@ function assertAgentPolicyCollections(policy) {
|
|
|
39811
39812
|
text(source.path);
|
|
39812
39813
|
requireBound(source.sha256 === null || typeof source.sha256 === "string" && /^[a-f0-9]{64}$/.test(source.sha256));
|
|
39813
39814
|
if (source.hashMode !== undefined)
|
|
39814
|
-
requireBound(["bytes", "path-bytes"].includes(source.hashMode) && source.format === undefined && source.fields === undefined && (source.hashMode
|
|
39815
|
+
requireBound(["bytes", "path-bytes", "claude-plugin-registry"].includes(source.hashMode) && source.format === undefined && source.fields === undefined && (source.hashMode === "bytes" || source.sha256 !== null));
|
|
39816
|
+
if (source.hashMode === "claude-plugin-registry") {
|
|
39817
|
+
requireBound(agent === "claude");
|
|
39818
|
+
const managed = array3(source.managedPlugins, 64);
|
|
39819
|
+
requireBound(managed.length > 0);
|
|
39820
|
+
for (const entry of managed) {
|
|
39821
|
+
requireBound(object4(entry) && Object.keys(entry).every((key) => ["bindingId", "storeRoot"].includes(key)));
|
|
39822
|
+
text(entry.storeRoot);
|
|
39823
|
+
requireBound(typeof entry.bindingId === "string" && /^[a-f0-9]{64}$/.test(entry.bindingId));
|
|
39824
|
+
}
|
|
39825
|
+
} else
|
|
39826
|
+
requireBound(source.managedPlugins === undefined);
|
|
39815
39827
|
if (source.format !== undefined)
|
|
39816
39828
|
requireBound(["json", "toml", "yaml"].includes(source.format));
|
|
39817
39829
|
if (source.fields !== undefined)
|
|
@@ -40036,10 +40048,10 @@ class HttpProfileClient {
|
|
|
40036
40048
|
this.origin = normalizeSkillsApiOrigin(origin);
|
|
40037
40049
|
this.authority = skillsApiRequestUrl(this.origin, "/api/v1/").replace(/\/+$/, "");
|
|
40038
40050
|
}
|
|
40039
|
-
async
|
|
40051
|
+
async requestRoute(route, init = {}) {
|
|
40040
40052
|
let response;
|
|
40041
40053
|
try {
|
|
40042
|
-
response = await fetch(skillsApiRequestUrl(this.origin,
|
|
40054
|
+
response = await fetch(skillsApiRequestUrl(this.origin, route), {
|
|
40043
40055
|
...init,
|
|
40044
40056
|
redirect: "error",
|
|
40045
40057
|
credentials: "omit",
|
|
@@ -40060,6 +40072,9 @@ class HttpProfileClient {
|
|
|
40060
40072
|
}
|
|
40061
40073
|
return response;
|
|
40062
40074
|
}
|
|
40075
|
+
request(path, init = {}) {
|
|
40076
|
+
return this.requestRoute(`/api/v1${path}`, init);
|
|
40077
|
+
}
|
|
40063
40078
|
async read(response, limit = MAX_PROFILE_DOCUMENT_BYTES) {
|
|
40064
40079
|
try {
|
|
40065
40080
|
return JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, limit)));
|
|
@@ -40085,6 +40100,12 @@ class HttpProfileClient {
|
|
|
40085
40100
|
invalid();
|
|
40086
40101
|
return result;
|
|
40087
40102
|
}
|
|
40103
|
+
async resolvePrincipal() {
|
|
40104
|
+
const result = await this.read(await this.requestRoute("/api/auth/whoami"), 16 * 1024);
|
|
40105
|
+
if (!object5(result) || Object.keys(result).sort().join(",") !== "organization,user" || !object5(result.user) || Object.keys(result.user).sort().join(",") !== "email,id,role" || !object5(result.organization) || Object.keys(result.organization).sort().join(",") !== "id,name,slug" || !identifier(result.user.id) || typeof result.user.email !== "string" || !result.user.email.trim() || !["owner", "admin", "member", "viewer"].includes(String(result.user.role)) || !identifier(result.organization.id) || !identifier(result.organization.slug) || typeof result.organization.name !== "string" || !result.organization.name.trim())
|
|
40106
|
+
invalid();
|
|
40107
|
+
return { userId: result.user.id, accountId: result.organization.id, role: result.user.role };
|
|
40108
|
+
}
|
|
40088
40109
|
async recordStation(id, input2) {
|
|
40089
40110
|
if (!identifier(id) || !identifier(input2.profileId) || !identifier(input2.profileRevision) || !Array.isArray(input2.selections) || input2.selections.length > MAX_PROFILE_SELECTIONS)
|
|
40090
40111
|
throw new Error("Invalid station state");
|
|
@@ -47371,6 +47392,66 @@ var init_agent_discovery_path_bytes = __esm(() => {
|
|
|
47371
47392
|
init_agent_discovery_bytes();
|
|
47372
47393
|
});
|
|
47373
47394
|
|
|
47395
|
+
// src/lib/plugin-projection.ts
|
|
47396
|
+
var PLUGIN_PROJECTION_LIMITS;
|
|
47397
|
+
var init_plugin_projection = __esm(() => {
|
|
47398
|
+
init_selection_cache();
|
|
47399
|
+
PLUGIN_PROJECTION_LIMITS = Object.freeze({ files: 1024, bytes: 64 * 1024 * 1024, fileBytes: 16 * 1024 * 1024, metadataBytes: 512 * 1024, registrations: 64, history: 128 });
|
|
47400
|
+
});
|
|
47401
|
+
|
|
47402
|
+
// src/lib/plugin-projection-store.ts
|
|
47403
|
+
import { constants as constants5, closeSync as closeSync8, fchmodSync, fstatSync as fstatSync8, fsyncSync, linkSync, lstatSync as lstatSync8, mkdirSync as mkdirSync6, openSync as openSync8, opendirSync, readSync as readSync4, renameSync as renameSync3, rmdirSync as rmdirSync2, rmSync as rmSync2, unlinkSync as unlinkSync3, writeSync as writeSync2 } from "fs";
|
|
47404
|
+
var READ_FLAGS, WRITE_FLAGS;
|
|
47405
|
+
var init_plugin_projection_store = __esm(() => {
|
|
47406
|
+
init_plugin_projection();
|
|
47407
|
+
READ_FLAGS = constants5.O_RDONLY | constants5.O_NOFOLLOW | constants5.O_NONBLOCK;
|
|
47408
|
+
WRITE_FLAGS = constants5.O_WRONLY | constants5.O_CREAT | constants5.O_EXCL | constants5.O_NOFOLLOW | constants5.O_NONBLOCK;
|
|
47409
|
+
});
|
|
47410
|
+
|
|
47411
|
+
// src/lib/selected-manifest.ts
|
|
47412
|
+
function jsonEntry(entries, path) {
|
|
47413
|
+
const entry = entries.find((candidate) => candidate.path === path);
|
|
47414
|
+
if (!entry)
|
|
47415
|
+
return {};
|
|
47416
|
+
try {
|
|
47417
|
+
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(entry.bytes));
|
|
47418
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
47419
|
+
throw new Error;
|
|
47420
|
+
return value;
|
|
47421
|
+
} catch {
|
|
47422
|
+
throw new SkillSelectionError("INVALID_SKILL_MANIFEST", "The selected skill has an invalid execution manifest.");
|
|
47423
|
+
}
|
|
47424
|
+
}
|
|
47425
|
+
function describeEntries(entries) {
|
|
47426
|
+
const manifest = jsonEntry(entries, "skill.json"), packageJson = jsonEntry(entries, "package.json");
|
|
47427
|
+
const docs = entries.find((entry) => entry.path === "SKILL.md");
|
|
47428
|
+
const frontmatter = docs ? parseSkillFrontmatter(new TextDecoder().decode(docs.bytes)) : null;
|
|
47429
|
+
const kind = frontmatter?.kind === "instruction" || manifest.kind === "instruction" || packageJson.skills?.kind === "instruction" ? "instruction" : "executable";
|
|
47430
|
+
return { kind, manifest, packageJson };
|
|
47431
|
+
}
|
|
47432
|
+
var init_selected_manifest = __esm(() => {
|
|
47433
|
+
init_skill_validation();
|
|
47434
|
+
init_selection_cache();
|
|
47435
|
+
});
|
|
47436
|
+
|
|
47437
|
+
// src/lib/plugin-admission.ts
|
|
47438
|
+
var init_plugin_admission = __esm(() => {
|
|
47439
|
+
init_profile_client();
|
|
47440
|
+
init_skill_bundle();
|
|
47441
|
+
init_selection_cache();
|
|
47442
|
+
init_selection_resolver();
|
|
47443
|
+
init_plugin_projection();
|
|
47444
|
+
init_plugin_projection_store();
|
|
47445
|
+
init_selected_manifest();
|
|
47446
|
+
});
|
|
47447
|
+
|
|
47448
|
+
// src/lib/plugin-discovery.ts
|
|
47449
|
+
var init_plugin_discovery = __esm(() => {
|
|
47450
|
+
init_plugin_admission();
|
|
47451
|
+
init_plugin_projection();
|
|
47452
|
+
init_plugin_projection_store();
|
|
47453
|
+
});
|
|
47454
|
+
|
|
47374
47455
|
// src/lib/agent-discovery.ts
|
|
47375
47456
|
var init_agent_discovery = __esm(() => {
|
|
47376
47457
|
init_agent_policy_limits();
|
|
@@ -47378,6 +47459,8 @@ var init_agent_discovery = __esm(() => {
|
|
|
47378
47459
|
init_agent_discovery_directories();
|
|
47379
47460
|
init_agent_discovery_bytes();
|
|
47380
47461
|
init_agent_discovery_path_bytes();
|
|
47462
|
+
init_plugin_discovery();
|
|
47463
|
+
init_plugin_admission();
|
|
47381
47464
|
init_agent_discovery_directories();
|
|
47382
47465
|
});
|
|
47383
47466
|
|
|
@@ -47418,7 +47501,7 @@ function normalizeSkillName(name) {
|
|
|
47418
47501
|
}
|
|
47419
47502
|
|
|
47420
47503
|
// src/lib/project-state.ts
|
|
47421
|
-
import { existsSync as existsSync10, mkdirSync as
|
|
47504
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync12, writeFileSync as writeFileSync5 } from "fs";
|
|
47422
47505
|
import { join as join16 } from "path";
|
|
47423
47506
|
function getProjectStateDir(targetDir = process.cwd()) {
|
|
47424
47507
|
return join16(targetDir, SKILLS_PROJECT_DIR);
|
|
@@ -47452,7 +47535,7 @@ function ensureProjectConfig(targetDir = process.cwd()) {
|
|
|
47452
47535
|
}
|
|
47453
47536
|
function saveProjectConfig(config2, targetDir = process.cwd()) {
|
|
47454
47537
|
const dir = getProjectStateDir(targetDir);
|
|
47455
|
-
|
|
47538
|
+
mkdirSync7(dir, { recursive: true });
|
|
47456
47539
|
const normalized = normalizeProjectConfig({ ...config2, updatedAt: new Date().toISOString() });
|
|
47457
47540
|
writeFileSync5(getProjectConfigPath(targetDir), JSON.stringify(normalized, null, 2) + `
|
|
47458
47541
|
`);
|
|
@@ -47539,7 +47622,7 @@ var init_project_state = __esm(() => {
|
|
|
47539
47622
|
});
|
|
47540
47623
|
|
|
47541
47624
|
// src/lib/installer.ts
|
|
47542
|
-
import { existsSync as existsSync11, readFileSync as readFileSync13, rmSync as
|
|
47625
|
+
import { existsSync as existsSync11, readFileSync as readFileSync13, rmSync as rmSync3 } from "fs";
|
|
47543
47626
|
import { join as join17 } from "path";
|
|
47544
47627
|
import { homedir as homedir2 } from "os";
|
|
47545
47628
|
function getSkillPath(name) {
|
|
@@ -48877,7 +48960,7 @@ var init_remote_workspace_leave = __esm(() => {
|
|
|
48877
48960
|
});
|
|
48878
48961
|
|
|
48879
48962
|
// src/lib/auth-store.ts
|
|
48880
|
-
import { chmodSync, existsSync as existsSync13, mkdirSync as
|
|
48963
|
+
import { chmodSync, existsSync as existsSync13, mkdirSync as mkdirSync8, readFileSync as readFileSync15, renameSync as renameSync4, statSync as statSync8, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
48881
48964
|
import { basename as basename4, dirname as dirname6, join as join19 } from "path";
|
|
48882
48965
|
function getAuthFilePath(env = process.env) {
|
|
48883
48966
|
return skillsCredentialFilePath(env);
|
|
@@ -49135,6 +49218,61 @@ var init_remote_quote_errors = __esm(() => {
|
|
|
49135
49218
|
});
|
|
49136
49219
|
});
|
|
49137
49220
|
|
|
49221
|
+
// src/lib/remote-permissions.ts
|
|
49222
|
+
function parseSkillsAccess(value) {
|
|
49223
|
+
if (value === undefined)
|
|
49224
|
+
return {};
|
|
49225
|
+
if (!record7(value))
|
|
49226
|
+
throw new Error("Invalid Skills permission contract");
|
|
49227
|
+
const result = {};
|
|
49228
|
+
if (value.scopes !== undefined) {
|
|
49229
|
+
if (!Array.isArray(value.scopes) || value.scopes.length > 256 || value.scopes.some((scope) => typeof scope !== "string" || scope.length > 128 || !/^(?:\*|[a-z][a-z0-9.-]*:[a-z0-9.*-]+)$/.test(scope)))
|
|
49230
|
+
throw new Error("Invalid Skills scope contract");
|
|
49231
|
+
result.scopes = [...value.scopes];
|
|
49232
|
+
}
|
|
49233
|
+
if (value.permissions !== undefined) {
|
|
49234
|
+
if (!record7(value.permissions))
|
|
49235
|
+
throw new Error("Invalid Skills permission contract");
|
|
49236
|
+
result.permissions = {};
|
|
49237
|
+
for (const name of permissionNames) {
|
|
49238
|
+
const permission = value.permissions[name];
|
|
49239
|
+
if (permission === undefined)
|
|
49240
|
+
continue;
|
|
49241
|
+
if (typeof permission !== "boolean")
|
|
49242
|
+
throw new Error("Invalid Skills permission contract");
|
|
49243
|
+
result.permissions[name] = permission;
|
|
49244
|
+
}
|
|
49245
|
+
}
|
|
49246
|
+
return result;
|
|
49247
|
+
}
|
|
49248
|
+
function assertSkillsPermission(access, permission) {
|
|
49249
|
+
if (access.permissions?.[permission] === false)
|
|
49250
|
+
throw new RemoteSkillsPermissionError(permission);
|
|
49251
|
+
}
|
|
49252
|
+
var permissionNames, record7 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), RemoteSkillsPermissionError;
|
|
49253
|
+
var init_remote_permissions = __esm(() => {
|
|
49254
|
+
permissionNames = [
|
|
49255
|
+
"read",
|
|
49256
|
+
"publish",
|
|
49257
|
+
"profilesWrite",
|
|
49258
|
+
"stationStateWrite",
|
|
49259
|
+
"cloudSubmit",
|
|
49260
|
+
"executionGrantsRead",
|
|
49261
|
+
"executionGrantsWrite",
|
|
49262
|
+
"executionGrantsResolve"
|
|
49263
|
+
];
|
|
49264
|
+
RemoteSkillsPermissionError = class RemoteSkillsPermissionError extends Error {
|
|
49265
|
+
permission;
|
|
49266
|
+
code = "SKILLS_PERMISSION_DENIED";
|
|
49267
|
+
status = 403;
|
|
49268
|
+
constructor(permission) {
|
|
49269
|
+
super(`The current Skills credential cannot ${permission === "publish" ? "publish skills" : "write shared profiles"}. ` + "Workspace role does not override credential permissions. Ask the workspace administrator to authorize this credential, " + "then check skills auth whoami or skills capabilities. This write request was not sent.");
|
|
49270
|
+
this.permission = permission;
|
|
49271
|
+
this.name = "RemoteSkillsPermissionError";
|
|
49272
|
+
}
|
|
49273
|
+
};
|
|
49274
|
+
});
|
|
49275
|
+
|
|
49138
49276
|
// src/lib/remote-client.ts
|
|
49139
49277
|
var exports_remote_client = {};
|
|
49140
49278
|
__export(exports_remote_client, {
|
|
@@ -49253,15 +49391,23 @@ class RemoteSkillsClient {
|
|
|
49253
49391
|
}, { quoteRefusal: true });
|
|
49254
49392
|
return parseRemoteRunQuote(await response.json());
|
|
49255
49393
|
}
|
|
49256
|
-
getCapabilities() {
|
|
49257
|
-
if (!this.capabilities)
|
|
49394
|
+
getCapabilities(options = {}) {
|
|
49395
|
+
if (!this.capabilities || options.refresh)
|
|
49258
49396
|
this.capabilities = (async () => {
|
|
49259
|
-
const
|
|
49397
|
+
const response = await this.requestNewRoute("/api/v1/capabilities");
|
|
49398
|
+
let value;
|
|
49399
|
+
try {
|
|
49400
|
+
value = await response.json();
|
|
49401
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
49402
|
+
throw new Error;
|
|
49403
|
+
} catch {
|
|
49404
|
+
throw new Error("Invalid Skills capability response");
|
|
49405
|
+
}
|
|
49260
49406
|
if (value.contractVersion !== 1 || value.apiVersion !== 1 || !Array.isArray(value.capabilities) || value.capabilities.some((item) => typeof item !== "string"))
|
|
49261
49407
|
throw new Error("Unsupported Skills server capability contract");
|
|
49262
49408
|
const billing = value.billing;
|
|
49263
49409
|
const recurringConsents = parseRecurringCapability(value.recurringConsents);
|
|
49264
|
-
return { contractVersion: 1, apiVersion: 1, capabilities: value.capabilities, ...billing ? { billing } : {}, ...recurringConsents ? { recurringConsents } : {} };
|
|
49410
|
+
return { contractVersion: 1, apiVersion: 1, capabilities: value.capabilities, ...parseSkillsAccess(value), ...billing ? { billing } : {}, ...recurringConsents ? { recurringConsents } : {} };
|
|
49265
49411
|
})();
|
|
49266
49412
|
return this.capabilities;
|
|
49267
49413
|
}
|
|
@@ -49728,6 +49874,12 @@ class RemoteSkillsClient {
|
|
|
49728
49874
|
}
|
|
49729
49875
|
}
|
|
49730
49876
|
async publishSkill(manifest, bundle, ifMatch) {
|
|
49877
|
+
try {
|
|
49878
|
+
assertSkillsPermission(await this.getCapabilities({ refresh: true }), "publish");
|
|
49879
|
+
} catch (error61) {
|
|
49880
|
+
if (!(error61 instanceof RemoteRouteUnsupportedError))
|
|
49881
|
+
throw error61;
|
|
49882
|
+
}
|
|
49731
49883
|
const form = new FormData;
|
|
49732
49884
|
form.set("manifest", JSON.stringify(manifest));
|
|
49733
49885
|
if (bundle) {
|
|
@@ -49822,13 +49974,13 @@ class RemoteSkillsClient {
|
|
|
49822
49974
|
return normalizeUpdatedSincePage(await response.json());
|
|
49823
49975
|
}
|
|
49824
49976
|
}
|
|
49825
|
-
function requireOptionalString(
|
|
49826
|
-
if (
|
|
49977
|
+
function requireOptionalString(record8, field) {
|
|
49978
|
+
if (record8[field] === undefined)
|
|
49827
49979
|
return;
|
|
49828
|
-
if (typeof
|
|
49980
|
+
if (typeof record8[field] !== "string") {
|
|
49829
49981
|
throw new Error(`Remote payload did not match the expected contract (${field} must be a string when present)`);
|
|
49830
49982
|
}
|
|
49831
|
-
return
|
|
49983
|
+
return record8[field];
|
|
49832
49984
|
}
|
|
49833
49985
|
function isVersionRecord(value) {
|
|
49834
49986
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -49850,19 +50002,19 @@ function normalizePin(entry) {
|
|
|
49850
50002
|
if (!entry || typeof entry !== "object") {
|
|
49851
50003
|
throw new Error("Remote pin payload did not match the expected contract (expected an object)");
|
|
49852
50004
|
}
|
|
49853
|
-
const
|
|
49854
|
-
const slug2 = typeof
|
|
50005
|
+
const record8 = entry;
|
|
50006
|
+
const slug2 = typeof record8.slug === "string" && record8.slug.trim() ? record8.slug.trim() : undefined;
|
|
49855
50007
|
if (!slug2) {
|
|
49856
50008
|
throw new Error("Remote pin payload did not match the expected contract (missing slug)");
|
|
49857
50009
|
}
|
|
49858
50010
|
let metadata;
|
|
49859
|
-
if (
|
|
49860
|
-
if (!
|
|
50011
|
+
if (record8.metadata !== undefined) {
|
|
50012
|
+
if (!record8.metadata || typeof record8.metadata !== "object" || Array.isArray(record8.metadata)) {
|
|
49861
50013
|
throw new Error("Remote pin payload did not match the expected contract (metadata must be a JSON object when present)");
|
|
49862
50014
|
}
|
|
49863
|
-
metadata =
|
|
50015
|
+
metadata = record8.metadata;
|
|
49864
50016
|
}
|
|
49865
|
-
const pinnedAt = requireOptionalString(
|
|
50017
|
+
const pinnedAt = requireOptionalString(record8, "pinnedAt");
|
|
49866
50018
|
return {
|
|
49867
50019
|
slug: slug2,
|
|
49868
50020
|
...pinnedAt !== undefined ? { pinnedAt } : {},
|
|
@@ -49879,16 +50031,16 @@ function normalizeSkillSummary(entry) {
|
|
|
49879
50031
|
if (!entry || typeof entry !== "object") {
|
|
49880
50032
|
throw new Error("Remote skill payload did not match the expected contract (expected an object)");
|
|
49881
50033
|
}
|
|
49882
|
-
const
|
|
49883
|
-
const slug2 = typeof
|
|
50034
|
+
const record8 = entry;
|
|
50035
|
+
const slug2 = typeof record8.slug === "string" && record8.slug.trim() ? record8.slug.trim() : undefined;
|
|
49884
50036
|
if (!slug2) {
|
|
49885
50037
|
throw new Error("Remote skill payload did not match the expected contract (missing slug)");
|
|
49886
50038
|
}
|
|
49887
50039
|
return {
|
|
49888
50040
|
slug: slug2,
|
|
49889
|
-
...requireOptionalString(
|
|
49890
|
-
...requireOptionalString(
|
|
49891
|
-
...requireOptionalString(
|
|
50041
|
+
...requireOptionalString(record8, "name") !== undefined ? { name: requireOptionalString(record8, "name") } : {},
|
|
50042
|
+
...requireOptionalString(record8, "version") !== undefined ? { version: requireOptionalString(record8, "version") } : {},
|
|
50043
|
+
...requireOptionalString(record8, "updatedAt") !== undefined ? { updatedAt: requireOptionalString(record8, "updatedAt") } : {}
|
|
49892
50044
|
};
|
|
49893
50045
|
}
|
|
49894
50046
|
function normalizeSkillSummaryList(payload) {
|
|
@@ -49941,12 +50093,12 @@ function normalizeUpdatedSincePage(payload) {
|
|
|
49941
50093
|
if (!payload || typeof payload !== "object") {
|
|
49942
50094
|
throw new Error("Updated-since payload did not match the expected contract (expected an object)");
|
|
49943
50095
|
}
|
|
49944
|
-
const
|
|
49945
|
-
if (!Array.isArray(
|
|
50096
|
+
const record8 = payload;
|
|
50097
|
+
if (!Array.isArray(record8.skills)) {
|
|
49946
50098
|
throw new Error("Updated-since payload did not match the expected contract (missing skills array)");
|
|
49947
50099
|
}
|
|
49948
|
-
const skills =
|
|
49949
|
-
const nextCursor =
|
|
50100
|
+
const skills = record8.skills.map(normalizeSkillSummary);
|
|
50101
|
+
const nextCursor = record8.nextCursor === undefined || record8.nextCursor === null ? null : record8.nextCursor;
|
|
49950
50102
|
if (nextCursor !== null && typeof nextCursor !== "string") {
|
|
49951
50103
|
throw new Error("Updated-since payload did not match the expected contract (nextCursor must be a string or absent)");
|
|
49952
50104
|
}
|
|
@@ -49972,6 +50124,7 @@ var init_remote_client = __esm(() => {
|
|
|
49972
50124
|
init_remote_account();
|
|
49973
50125
|
init_remote_files();
|
|
49974
50126
|
init_remote_quote_errors();
|
|
50127
|
+
init_remote_permissions();
|
|
49975
50128
|
RemoteRouteUnsupportedError = class RemoteRouteUnsupportedError extends Error {
|
|
49976
50129
|
path;
|
|
49977
50130
|
status;
|
|
@@ -50041,7 +50194,7 @@ function invitationEmailIds(invitationId, challengeId) {
|
|
|
50041
50194
|
}
|
|
50042
50195
|
function invitationEmailInput(action, input2) {
|
|
50043
50196
|
const keys = ["invitationId", "token", "challengeId", "confirm", ...action === "accept" ? ["code"] : []];
|
|
50044
|
-
if (!
|
|
50197
|
+
if (!record8(input2) || Object.keys(input2).length !== keys.length || keys.some((key) => !Object.hasOwn(input2, key)))
|
|
50045
50198
|
throw new InvitationEmailInputError;
|
|
50046
50199
|
const value = { ...input2 };
|
|
50047
50200
|
const ids = invitationEmailIds(value.invitationId, value.challengeId);
|
|
@@ -50070,12 +50223,12 @@ async function requestInvitationEmail(origin, action, input2) {
|
|
|
50070
50223
|
signal: AbortSignal.timeout(15000)
|
|
50071
50224
|
});
|
|
50072
50225
|
const parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(await readBoundedResponse(response, 4096)));
|
|
50073
|
-
if (!response.ok &&
|
|
50226
|
+
if (!response.ok && record8(parsed) && typeof parsed.code === "string" && Object.hasOwn(refusals, parsed.code)) {
|
|
50074
50227
|
const code = parsed.code;
|
|
50075
50228
|
if (response.status === refusals[code][0])
|
|
50076
50229
|
throw new RemoteInvitationEmailError(code);
|
|
50077
50230
|
}
|
|
50078
|
-
if (!
|
|
50231
|
+
if (!record8(parsed))
|
|
50079
50232
|
throw new RemoteInvitationEmailUnconfirmedError(action);
|
|
50080
50233
|
if (action === "challenge" && response.status === 202 && parsed.challengeId === value.challengeId && parsed.expiresIn === 600 && typeof parsed.message === "string" && parsed.message.length <= 256) {
|
|
50081
50234
|
return { challengeId: value.challengeId, message: "If this invitation is eligible, a verification code will arrive. Delivery is not confirmed.", expiresIn: 600 };
|
|
@@ -50094,7 +50247,7 @@ function invitationEmailCustomerError(error61) {
|
|
|
50094
50247
|
return { code: error61.code, error: error61.message };
|
|
50095
50248
|
return { code: "INVITATION_EMAIL_UNAVAILABLE", error: "Unable to prepare this recovery action. Check the explicit server and stable profile. No credential was saved." };
|
|
50096
50249
|
}
|
|
50097
|
-
var InvitationEmailInputError, refusals, RemoteInvitationEmailError, RemoteInvitationEmailUnconfirmedError,
|
|
50250
|
+
var InvitationEmailInputError, refusals, RemoteInvitationEmailError, RemoteInvitationEmailUnconfirmedError, record8 = (v) => !!v && typeof v === "object" && !Array.isArray(v), uuid11 = (v) => typeof v === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v);
|
|
50098
50251
|
var init_remote_invitation_recovery = __esm(() => {
|
|
50099
50252
|
init_fleet_credentials();
|
|
50100
50253
|
init_remote_files();
|
|
@@ -50141,7 +50294,7 @@ function checkedPublicationDeclaration(value) {
|
|
|
50141
50294
|
return bad();
|
|
50142
50295
|
try {
|
|
50143
50296
|
const manifest = JSON.parse(value.manifestText);
|
|
50144
|
-
if (!
|
|
50297
|
+
if (!record9(manifest) || manifest.version !== value.version || validatePortableManifestContract(manifest, { strict: true }).length || !hash3(manifest.provenance?.content_hash))
|
|
50145
50298
|
return bad();
|
|
50146
50299
|
} catch {
|
|
50147
50300
|
return bad();
|
|
@@ -50199,7 +50352,7 @@ async function boundedJson(url2, init, token, mutation, budget2 = 15000, signal)
|
|
|
50199
50352
|
return invalid4();
|
|
50200
50353
|
}
|
|
50201
50354
|
if (!response.ok) {
|
|
50202
|
-
const code =
|
|
50355
|
+
const code = record9(body) && typeof body.code === "string" && Object.hasOwn(failures2, body.code) ? body.code : null;
|
|
50203
50356
|
if (code && failures2[code][0] === response.status)
|
|
50204
50357
|
throw new PrivatePublicationError(code, failures2[code][1], mutation && code === "PUBLICATION_UNCERTAIN", response.status);
|
|
50205
50358
|
throw new PrivatePublicationError("PUBLICATION_REQUEST_FAILED", "The publication request was refused. Inspect its status before retrying.", mutation && response.status >= 500, response.status);
|
|
@@ -50254,8 +50407,8 @@ class RemotePrivatePublicationsClient {
|
|
|
50254
50407
|
if (options.timeoutMs !== undefined && (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs < 1 || options.timeoutMs > 15000))
|
|
50255
50408
|
return bad();
|
|
50256
50409
|
const response = await boundedJson(skillsApiRequestUrl(this.apiOrigin, "/api/v1/capabilities"), {}, this.#token, false, options.timeoutMs, options.signal);
|
|
50257
|
-
const p =
|
|
50258
|
-
if (!
|
|
50410
|
+
const p = record9(response) && response.privatePublishing;
|
|
50411
|
+
if (!record9(response) || response.contractVersion !== 1 || response.apiVersion !== 1 || !exact(p, ["contractVersion", "enabled", "authentication", "maxArchiveBytes", "uploadMaxTtlSeconds", "executionEnabled"]) || p.contractVersion !== 1 || typeof p.enabled !== "boolean" || p.authentication !== "interactive-session" || p.maxArchiveBytes !== PRIVATE_PUBLICATION_MAX_BYTES || p.uploadMaxTtlSeconds !== 300 || typeof p.executionEnabled !== "boolean")
|
|
50259
50412
|
throw new PrivatePublicationError("PUBLICATION_CONTRACT_UNAVAILABLE", "This server does not support the hosted private publication contract.");
|
|
50260
50413
|
return Object.freeze({ ...p });
|
|
50261
50414
|
}
|
|
@@ -50271,7 +50424,7 @@ class RemotePrivatePublicationsClient {
|
|
|
50271
50424
|
async#view(path, method, skillId, intentId, declaration, options = {}) {
|
|
50272
50425
|
const value = await boundedJson(path, { method, ...method === "GET" ? {} : { body: JSON.stringify(declaration ?? {}) } }, this.#token, method !== "GET", options.timeoutMs, options.signal);
|
|
50273
50426
|
try {
|
|
50274
|
-
if (!
|
|
50427
|
+
if (!record9(value) || !Object.keys(value).every((k) => k === "upload" || k === "changed") || value.changed !== undefined && typeof value.changed !== "boolean")
|
|
50275
50428
|
return invalid4();
|
|
50276
50429
|
return checkedPublicationView(value.upload, skillId, intentId, declaration);
|
|
50277
50430
|
} catch (error61) {
|
|
@@ -50396,7 +50549,7 @@ var PRIVATE_PUBLICATION_MAX_BYTES, failures2, PrivatePublicationError, bad = ()
|
|
|
50396
50549
|
throw new PrivatePublicationError("INVALID_PUBLICATION_INPUT", "Invalid publication input or recovery data.");
|
|
50397
50550
|
}, invalid4 = () => {
|
|
50398
50551
|
throw new PrivatePublicationError("INVALID_PUBLICATION_RESPONSE", "The server returned an invalid publication result.");
|
|
50399
|
-
}, publicationUuid = (v) => typeof v === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v), hash3 = (v) => typeof v === "string" && /^[a-f0-9]{64}$/.test(v),
|
|
50552
|
+
}, publicationUuid = (v) => typeof v === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v), hash3 = (v) => typeof v === "string" && /^[a-f0-9]{64}$/.test(v), record9 = (v) => !!v && typeof v === "object" && !Array.isArray(v), exact = (v, keys) => record9(v) && Object.keys(v).sort().join(",") === keys.sort().join(","), date6 = (v) => typeof v === "string" && /^\d{4}-\d\d-\d\dT[0-9:.]+(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(v) && Number.isFinite(Date.parse(v)), publicationSha256 = (bytes) => createHash7("sha256").update(bytes).digest("hex");
|
|
50400
50553
|
var init_remote_private_publications = __esm(() => {
|
|
50401
50554
|
init_fleet_credentials();
|
|
50402
50555
|
init_remote_workspace_selection();
|
|
@@ -50460,10 +50613,10 @@ async function requestAuthApi(instance, path, options) {
|
|
|
50460
50613
|
const text3 = await res.text();
|
|
50461
50614
|
const body = text3 ? parseJsonBody(text3) : {};
|
|
50462
50615
|
if (!res.ok) {
|
|
50463
|
-
const
|
|
50464
|
-
const detail = typeof
|
|
50465
|
-
const error61 = typeof
|
|
50466
|
-
const code = typeof
|
|
50616
|
+
const record10 = isRecord5(body) ? body : {};
|
|
50617
|
+
const detail = typeof record10.detail === "string" ? record10.detail : undefined;
|
|
50618
|
+
const error61 = typeof record10.error === "string" ? record10.error : undefined;
|
|
50619
|
+
const code = typeof record10.code === "string" ? record10.code : undefined;
|
|
50467
50620
|
throw new HostedApiError(detail || error61 || `${res.status} ${res.statusText}`, {
|
|
50468
50621
|
status: res.status,
|
|
50469
50622
|
code,
|
|
@@ -50673,10 +50826,10 @@ var init_remote_auth = __esm(() => {
|
|
|
50673
50826
|
});
|
|
50674
50827
|
|
|
50675
50828
|
// src/lib/workspace-profile.ts
|
|
50676
|
-
import { constants as
|
|
50829
|
+
import { constants as constants6, closeSync as closeSync9, fstatSync as fstatSync9, lstatSync as lstatSync9, mkdirSync as mkdirSync9, mkdtempSync as mkdtempSync2, openSync as openSync9, readFileSync as readFileSync16, renameSync as renameSync5, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
50677
50830
|
function stat(path) {
|
|
50678
50831
|
try {
|
|
50679
|
-
return
|
|
50832
|
+
return lstatSync9(path);
|
|
50680
50833
|
} catch (error61) {
|
|
50681
50834
|
if (error61.code === "ENOENT")
|
|
50682
50835
|
return null;
|
|
@@ -50686,14 +50839,14 @@ function stat(path) {
|
|
|
50686
50839
|
function safeText(file2) {
|
|
50687
50840
|
if (stat(file2) === null)
|
|
50688
50841
|
return null;
|
|
50689
|
-
const fd =
|
|
50842
|
+
const fd = openSync9(file2, constants6.O_RDONLY | constants6.O_NOFOLLOW | constants6.O_NONBLOCK);
|
|
50690
50843
|
try {
|
|
50691
|
-
const s =
|
|
50844
|
+
const s = fstatSync9(fd);
|
|
50692
50845
|
if (!s.isFile() || s.size > 65536 || ![256, 384].includes(s.mode & 4095) || process.getuid && s.uid !== process.getuid())
|
|
50693
50846
|
return fail("The selected profile must use bounded owner-only regular files.");
|
|
50694
50847
|
return readFileSync16(fd, "utf8");
|
|
50695
50848
|
} finally {
|
|
50696
|
-
|
|
50849
|
+
closeSync9(fd);
|
|
50697
50850
|
}
|
|
50698
50851
|
}
|
|
50699
50852
|
function checkIdentityMetadata(file2, identity2) {
|
|
@@ -50905,7 +51058,7 @@ var init_recurring_customer = __esm(() => {
|
|
|
50905
51058
|
});
|
|
50906
51059
|
|
|
50907
51060
|
// src/lib/recurring-recovery.ts
|
|
50908
|
-
import { constants as
|
|
51061
|
+
import { constants as constants7, closeSync as closeSync10, fsyncSync as fsyncSync2, fstatSync as fstatSync10, lstatSync as lstatSync10, mkdirSync as mkdirSync10, openSync as openSync10, readSync as readSync5, realpathSync as realpathSync4, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
50909
51062
|
import { dirname as dirname7, isAbsolute as isAbsolute4, join as join20, resolve as resolve4 } from "path";
|
|
50910
51063
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
50911
51064
|
|
|
@@ -50917,7 +51070,7 @@ class RecoveryOwner {
|
|
|
50917
51070
|
if (!isAbsolute4(directory) || resolve4(directory) !== directory || realpathSync4(directory) !== directory)
|
|
50918
51071
|
invalid5();
|
|
50919
51072
|
for (let path = directory;; path = dirname7(path)) {
|
|
50920
|
-
const stat2 =
|
|
51073
|
+
const stat2 = lstatSync10(path);
|
|
50921
51074
|
if (!stat2.isDirectory() || stat2.isSymbolicLink())
|
|
50922
51075
|
invalid5();
|
|
50923
51076
|
this.parents.push({ path, dev: stat2.dev, ino: stat2.ino });
|
|
@@ -50930,59 +51083,59 @@ class RecoveryOwner {
|
|
|
50930
51083
|
if (realpathSync4(this.directory) !== this.directory)
|
|
50931
51084
|
invalid5();
|
|
50932
51085
|
for (const prior of this.parents) {
|
|
50933
|
-
const now =
|
|
51086
|
+
const now = lstatSync10(prior.path);
|
|
50934
51087
|
if (!now.isDirectory() || now.isSymbolicLink() || now.dev !== prior.dev || now.ino !== prior.ino)
|
|
50935
51088
|
invalid5();
|
|
50936
51089
|
}
|
|
50937
|
-
const own2 =
|
|
51090
|
+
const own2 = lstatSync10(this.directory);
|
|
50938
51091
|
if ((own2.mode & 511) !== 448 || (own2.mode & 3584) !== 0 || process.getuid && own2.uid !== process.getuid())
|
|
50939
51092
|
invalid5();
|
|
50940
51093
|
}
|
|
50941
51094
|
read(name) {
|
|
50942
51095
|
this.assert();
|
|
50943
|
-
const fd =
|
|
51096
|
+
const fd = openSync10(join20(this.directory, name), constants7.O_RDONLY | constants7.O_NOFOLLOW | constants7.O_NONBLOCK);
|
|
50944
51097
|
try {
|
|
50945
|
-
const before =
|
|
51098
|
+
const before = fstatSync10(fd);
|
|
50946
51099
|
if (!before.isFile() || before.nlink !== 1 || (before.mode & 4095) !== 384 || before.size < 1 || before.size > 8192 || process.getuid && before.uid !== process.getuid())
|
|
50947
51100
|
invalid5();
|
|
50948
51101
|
const bytes = Buffer.alloc(before.size + 1);
|
|
50949
51102
|
let size = 0;
|
|
50950
51103
|
while (size < bytes.length) {
|
|
50951
|
-
const n2 =
|
|
51104
|
+
const n2 = readSync5(fd, bytes, size, bytes.length - size, size);
|
|
50952
51105
|
if (!n2)
|
|
50953
51106
|
break;
|
|
50954
51107
|
size += n2;
|
|
50955
51108
|
}
|
|
50956
|
-
const after =
|
|
51109
|
+
const after = fstatSync10(fd), path = lstatSync10(join20(this.directory, name));
|
|
50957
51110
|
if (size !== before.size || after.size !== before.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || path.dev !== before.dev || path.ino !== before.ino || !path.isFile() || path.isSymbolicLink())
|
|
50958
51111
|
invalid5();
|
|
50959
51112
|
this.assert();
|
|
50960
51113
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(0, size));
|
|
50961
51114
|
} finally {
|
|
50962
|
-
|
|
51115
|
+
closeSync10(fd);
|
|
50963
51116
|
}
|
|
50964
51117
|
}
|
|
50965
51118
|
write(name, value) {
|
|
50966
51119
|
this.assert();
|
|
50967
51120
|
const bytes = canonicalJson(value, 8192) + `
|
|
50968
51121
|
`;
|
|
50969
|
-
const fd =
|
|
51122
|
+
const fd = openSync10(join20(this.directory, name), constants7.O_WRONLY | constants7.O_CREAT | constants7.O_EXCL | constants7.O_NOFOLLOW, 384);
|
|
50970
51123
|
try {
|
|
50971
51124
|
writeFileSync8(fd, bytes);
|
|
50972
|
-
|
|
51125
|
+
fsyncSync2(fd);
|
|
50973
51126
|
} finally {
|
|
50974
|
-
|
|
51127
|
+
closeSync10(fd);
|
|
50975
51128
|
}
|
|
50976
51129
|
this.assert();
|
|
50977
51130
|
this.sync();
|
|
50978
51131
|
}
|
|
50979
51132
|
sync() {
|
|
50980
51133
|
this.assert();
|
|
50981
|
-
const fd =
|
|
51134
|
+
const fd = openSync10(this.directory, constants7.O_RDONLY | constants7.O_NOFOLLOW);
|
|
50982
51135
|
try {
|
|
50983
|
-
|
|
51136
|
+
fsyncSync2(fd);
|
|
50984
51137
|
} finally {
|
|
50985
|
-
|
|
51138
|
+
closeSync10(fd);
|
|
50986
51139
|
}
|
|
50987
51140
|
}
|
|
50988
51141
|
saveState(state, expected) {
|
|
@@ -50993,30 +51146,30 @@ class RecoveryOwner {
|
|
|
50993
51146
|
if (this.read("state.json") !== expected)
|
|
50994
51147
|
invalid5();
|
|
50995
51148
|
this.assert();
|
|
50996
|
-
|
|
51149
|
+
renameSync6(join20(this.directory, name), join20(this.directory, "state.json"));
|
|
50997
51150
|
this.sync();
|
|
50998
51151
|
}
|
|
50999
51152
|
async locked(action) {
|
|
51000
51153
|
this.assert();
|
|
51001
51154
|
let fd;
|
|
51002
51155
|
try {
|
|
51003
|
-
fd =
|
|
51156
|
+
fd = openSync10(join20(this.directory, "operation.lock"), constants7.O_WRONLY | constants7.O_CREAT | constants7.O_EXCL | constants7.O_NOFOLLOW, 384);
|
|
51004
51157
|
} catch {
|
|
51005
51158
|
throw new RecurringCustomerError("RECURRING_RECOVERY_BUSY", "Recovery is locked. Confirm the original process has stopped before explicitly reconciling the retained lock; no request was retried.");
|
|
51006
51159
|
}
|
|
51007
|
-
const owner =
|
|
51160
|
+
const owner = fstatSync10(fd);
|
|
51008
51161
|
try {
|
|
51009
51162
|
writeFileSync8(fd, JSON.stringify({ pid: process.pid }));
|
|
51010
|
-
|
|
51163
|
+
fsyncSync2(fd);
|
|
51011
51164
|
this.sync();
|
|
51012
51165
|
return await action();
|
|
51013
51166
|
} finally {
|
|
51014
|
-
|
|
51167
|
+
closeSync10(fd);
|
|
51015
51168
|
this.assert();
|
|
51016
|
-
const now =
|
|
51169
|
+
const now = lstatSync10(join20(this.directory, "operation.lock"));
|
|
51017
51170
|
if (owner.dev !== now.dev || owner.ino !== now.ino || !now.isFile() || now.isSymbolicLink())
|
|
51018
51171
|
invalid5();
|
|
51019
|
-
|
|
51172
|
+
unlinkSync5(join20(this.directory, "operation.lock"));
|
|
51020
51173
|
this.sync();
|
|
51021
51174
|
}
|
|
51022
51175
|
}
|
|
@@ -51051,7 +51204,7 @@ function base(customer, organizationId) {
|
|
|
51051
51204
|
function create(directory, intent) {
|
|
51052
51205
|
if (!isAbsolute4(directory) || resolve4(directory) !== directory || realpathSync4(dirname7(directory)) !== dirname7(directory))
|
|
51053
51206
|
invalid5();
|
|
51054
|
-
|
|
51207
|
+
mkdirSync10(directory, { mode: 448 });
|
|
51055
51208
|
const owner = new RecoveryOwner(directory), checked = intentSchema.parse(intent), intentSha256 = canonicalJsonSha256(checked);
|
|
51056
51209
|
owner.write(`intent-${intentSha256}.json`, checked);
|
|
51057
51210
|
owner.write("state.json", { contractVersion: 1, intentSha256, phase: "prepared", consentId: null });
|
|
@@ -53147,7 +53300,7 @@ var init_credential_state = __esm(() => {
|
|
|
53147
53300
|
|
|
53148
53301
|
// src/lib/run-state.ts
|
|
53149
53302
|
import { createHash as createHash8, randomBytes } from "crypto";
|
|
53150
|
-
import { existsSync as existsSync14, mkdirSync as
|
|
53303
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync11, readFileSync as readFileSync17, readdirSync as readdirSync8, statSync as statSync9, writeFileSync as writeFileSync9 } from "fs";
|
|
53151
53304
|
import { extname, join as join21, relative as relative5 } from "path";
|
|
53152
53305
|
function createSkillRun(params, targetDir = process.cwd()) {
|
|
53153
53306
|
const now = new Date;
|
|
@@ -53158,10 +53311,10 @@ function createSkillRun(params, targetDir = process.cwd()) {
|
|
|
53158
53311
|
const runDir = join21(root, "runs", day, id);
|
|
53159
53312
|
const logsDir = join21(runDir, "logs");
|
|
53160
53313
|
const exportDir = join21(root, "exports", skillName, id);
|
|
53161
|
-
|
|
53162
|
-
|
|
53163
|
-
|
|
53164
|
-
const
|
|
53314
|
+
mkdirSync11(logsDir, { recursive: true });
|
|
53315
|
+
mkdirSync11(exportDir, { recursive: true });
|
|
53316
|
+
mkdirSync11(join21(root, "tmp"), { recursive: true });
|
|
53317
|
+
const record10 = {
|
|
53165
53318
|
id,
|
|
53166
53319
|
skill: skillName,
|
|
53167
53320
|
status: params.status ?? "running",
|
|
@@ -53179,10 +53332,10 @@ function createSkillRun(params, targetDir = process.cwd()) {
|
|
|
53179
53332
|
logsDir: toProjectRelative(targetDir, logsDir)
|
|
53180
53333
|
}
|
|
53181
53334
|
};
|
|
53182
|
-
const context2 = { targetDir, runDir, exportDir, logsDir, record:
|
|
53335
|
+
const context2 = { targetDir, runDir, exportDir, logsDir, record: record10 };
|
|
53183
53336
|
writeRunRecord(context2);
|
|
53184
53337
|
writeArtifactsManifest(context2, []);
|
|
53185
|
-
appendRunEvent(context2, "created", { status:
|
|
53338
|
+
appendRunEvent(context2, "created", { status: record10.status });
|
|
53186
53339
|
return context2;
|
|
53187
53340
|
}
|
|
53188
53341
|
function completeSkillRun(context2, patch) {
|
|
@@ -53227,9 +53380,9 @@ function findSkillRun(runId, targetDir = process.cwd()) {
|
|
|
53227
53380
|
if (!existsSync14(runsRoot))
|
|
53228
53381
|
return null;
|
|
53229
53382
|
for (const day of readdirSync8(runsRoot)) {
|
|
53230
|
-
const
|
|
53231
|
-
if (
|
|
53232
|
-
return
|
|
53383
|
+
const record10 = readRunRecord(join21(runsRoot, day, runId));
|
|
53384
|
+
if (record10)
|
|
53385
|
+
return record10;
|
|
53233
53386
|
}
|
|
53234
53387
|
return null;
|
|
53235
53388
|
}
|
|
@@ -53378,7 +53531,7 @@ var init_run_routing = __esm(() => {
|
|
|
53378
53531
|
// node_modules/@hasna/secrets/dist/sdk.js
|
|
53379
53532
|
import { isIP as isIP2 } from "net";
|
|
53380
53533
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
53381
|
-
import { closeSync as
|
|
53534
|
+
import { closeSync as closeSync11, fstatSync as fstatSync11, openSync as openSync11, readFileSync as readFileSync18 } from "fs";
|
|
53382
53535
|
import { O_NOFOLLOW as O_NOFOLLOW3, O_NONBLOCK as O_NONBLOCK3, O_RDONLY as O_RDONLY3 } from "constants";
|
|
53383
53536
|
import { createRequire as createRequire2 } from "module";
|
|
53384
53537
|
import { hostname as osHostname2 } from "os";
|
|
@@ -53483,7 +53636,7 @@ function readAppConfigFile2(path) {
|
|
|
53483
53636
|
};
|
|
53484
53637
|
let fd = -1;
|
|
53485
53638
|
try {
|
|
53486
|
-
fd =
|
|
53639
|
+
fd = openSync11(path, O_RDONLY3 | O_NOFOLLOW3 | O_NONBLOCK3);
|
|
53487
53640
|
} catch (error61) {
|
|
53488
53641
|
const code2 = error61.code;
|
|
53489
53642
|
if (code2 === "ENOENT" || code2 === "ENOTDIR")
|
|
@@ -53493,7 +53646,7 @@ function readAppConfigFile2(path) {
|
|
|
53493
53646
|
unsafe(`the path could not be opened (${code2 ?? "unknown error"})`);
|
|
53494
53647
|
}
|
|
53495
53648
|
try {
|
|
53496
|
-
const before =
|
|
53649
|
+
const before = fstatSync11(fd);
|
|
53497
53650
|
if (!before.isFile())
|
|
53498
53651
|
unsafe("the path is not a regular file");
|
|
53499
53652
|
if (!configFileModeAllowed2(before.mode)) {
|
|
@@ -53505,14 +53658,14 @@ function readAppConfigFile2(path) {
|
|
|
53505
53658
|
if (before.size > MAX_CREDENTIAL_FILE_BYTES2)
|
|
53506
53659
|
unsafe("the file exceeds the size limit");
|
|
53507
53660
|
const bytes = readFileSync18(fd);
|
|
53508
|
-
const after =
|
|
53661
|
+
const after = fstatSync11(fd);
|
|
53509
53662
|
if (!configFileReadsCoherent2(before, after)) {
|
|
53510
53663
|
unsafe("the file changed while being read");
|
|
53511
53664
|
}
|
|
53512
53665
|
return parseEnvFile2(bytes.toString("utf8"));
|
|
53513
53666
|
} finally {
|
|
53514
53667
|
if (fd !== -1)
|
|
53515
|
-
|
|
53668
|
+
closeSync11(fd);
|
|
53516
53669
|
}
|
|
53517
53670
|
}
|
|
53518
53671
|
function readCredentialFile2(path, apiKeyKeys) {
|
|
@@ -54678,7 +54831,7 @@ var init_sdk = __esm(() => {
|
|
|
54678
54831
|
});
|
|
54679
54832
|
|
|
54680
54833
|
// src/lib/execution-secrets.ts
|
|
54681
|
-
import { constants as
|
|
54834
|
+
import { constants as constants8, closeSync as closeSync12, fstatSync as fstatSync12, openSync as openSync12, readSync as readSync6, realpathSync as realpathSync5 } from "fs";
|
|
54682
54835
|
import { hostname as stationHostname } from "os";
|
|
54683
54836
|
function selectedSecretBindingsTemplate(scope, names, createClient = createSecretsClientFromEnv) {
|
|
54684
54837
|
let secretsAuthority;
|
|
@@ -54699,7 +54852,7 @@ function selectedSecretBindingsTemplate(scope, names, createClient = createSecre
|
|
|
54699
54852
|
function refuse(code2, message) {
|
|
54700
54853
|
throw new SkillSelectionError(code2, message);
|
|
54701
54854
|
}
|
|
54702
|
-
function
|
|
54855
|
+
function record10(value) {
|
|
54703
54856
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
54704
54857
|
}
|
|
54705
54858
|
function exactKeys(value, keys) {
|
|
@@ -54720,7 +54873,7 @@ function declaredSecretNames(value) {
|
|
|
54720
54873
|
return value;
|
|
54721
54874
|
}
|
|
54722
54875
|
function validateSelectedSecretBindings(value, scope, names) {
|
|
54723
|
-
if (!
|
|
54876
|
+
if (!record10(value) || !exactKeys(value, ["schema", "selection", "consumer", "secretsAuthority", "bindings"]) || value.schema !== "hasna.skills-secret-bindings.v1" || !record10(value.selection) || !exactKeys(value.selection, ["authority", "workspaceId", "profileId", "profileRevision", "slug", "version", "bundleDigest"]) || !record10(value.consumer) || !exactKeys(value.consumer, ["stationId", "workspaceDirectory"]) || !record10(value.bindings)) {
|
|
54724
54877
|
return refuse("INVALID_SECRET_BINDINGS", "Secret bindings do not match the hasna.skills-secret-bindings.v1 contract.");
|
|
54725
54878
|
}
|
|
54726
54879
|
for (const [key, expected] of Object.entries({ authority: scope.selection.authority, workspaceId: scope.selection.workspaceId, profileId: scope.profileId, profileRevision: scope.selection.profileRevision, slug: scope.selection.slug, version: scope.selection.version, bundleDigest: scope.selection.bundleDigest })) {
|
|
@@ -54913,32 +55066,6 @@ var init_execution_grant_client = __esm(() => {
|
|
|
54913
55066
|
init_execution_grants();
|
|
54914
55067
|
});
|
|
54915
55068
|
|
|
54916
|
-
// src/lib/selected-manifest.ts
|
|
54917
|
-
function jsonEntry(entries, path) {
|
|
54918
|
-
const entry = entries.find((candidate) => candidate.path === path);
|
|
54919
|
-
if (!entry)
|
|
54920
|
-
return {};
|
|
54921
|
-
try {
|
|
54922
|
-
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(entry.bytes));
|
|
54923
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
54924
|
-
throw new Error;
|
|
54925
|
-
return value;
|
|
54926
|
-
} catch {
|
|
54927
|
-
throw new SkillSelectionError("INVALID_SKILL_MANIFEST", "The selected skill has an invalid execution manifest.");
|
|
54928
|
-
}
|
|
54929
|
-
}
|
|
54930
|
-
function describeEntries(entries) {
|
|
54931
|
-
const manifest = jsonEntry(entries, "skill.json"), packageJson = jsonEntry(entries, "package.json");
|
|
54932
|
-
const docs = entries.find((entry) => entry.path === "SKILL.md");
|
|
54933
|
-
const frontmatter = docs ? parseSkillFrontmatter(new TextDecoder().decode(docs.bytes)) : null;
|
|
54934
|
-
const kind = frontmatter?.kind === "instruction" || manifest.kind === "instruction" || packageJson.skills?.kind === "instruction" ? "instruction" : "executable";
|
|
54935
|
-
return { kind, manifest, packageJson };
|
|
54936
|
-
}
|
|
54937
|
-
var init_selected_manifest = __esm(() => {
|
|
54938
|
-
init_skill_validation();
|
|
54939
|
-
init_selection_cache();
|
|
54940
|
-
});
|
|
54941
|
-
|
|
54942
55069
|
// src/lib/selected-run.ts
|
|
54943
55070
|
var exports_selected_run = {};
|
|
54944
55071
|
__export(exports_selected_run, {
|
|
@@ -54948,7 +55075,7 @@ __export(exports_selected_run, {
|
|
|
54948
55075
|
});
|
|
54949
55076
|
import { createHash as createHash9 } from "crypto";
|
|
54950
55077
|
import { spawn } from "child_process";
|
|
54951
|
-
import { mkdirSync as
|
|
55078
|
+
import { mkdirSync as mkdirSync12, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync10, realpathSync as realpathSync6 } from "fs";
|
|
54952
55079
|
import { dirname as dirname8, join as join23, resolve as resolve5 } from "path";
|
|
54953
55080
|
import { tmpdir, hostname as stationHostname2 } from "os";
|
|
54954
55081
|
async function resolveSelectedRun(spec, profileId, options = {}) {
|
|
@@ -55038,7 +55165,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
55038
55165
|
throw new SkillSelectionError("INVALID_BUNDLE_PATH", "The execution bundle path exceeds its limit.");
|
|
55039
55166
|
});
|
|
55040
55167
|
const destination = join23(runDirectory, entry.path);
|
|
55041
|
-
|
|
55168
|
+
mkdirSync12(dirname8(destination), { recursive: true, mode: 448 });
|
|
55042
55169
|
writeFileSync10(destination, entry.bytes, { flag: "wx", mode: entry.mode & 511 });
|
|
55043
55170
|
}
|
|
55044
55171
|
env.SKILLS_INPUT_JSON = input2;
|
|
@@ -55946,7 +56073,7 @@ var init_operation_tools = __esm(() => {
|
|
|
55946
56073
|
});
|
|
55947
56074
|
|
|
55948
56075
|
// src/lib/feedback.ts
|
|
55949
|
-
import { appendFileSync, existsSync as existsSync16, mkdirSync as
|
|
56076
|
+
import { appendFileSync, existsSync as existsSync16, mkdirSync as mkdirSync13 } from "fs";
|
|
55950
56077
|
import { dirname as dirname9, join as join25 } from "path";
|
|
55951
56078
|
import { Database } from "bun:sqlite";
|
|
55952
56079
|
function getFeedbackDbPath() {
|
|
@@ -55956,7 +56083,7 @@ function getFeedbackDb() {
|
|
|
55956
56083
|
const dbPath = getFeedbackDbPath();
|
|
55957
56084
|
const dir = dirname9(dbPath);
|
|
55958
56085
|
if (!existsSync16(dir))
|
|
55959
|
-
|
|
56086
|
+
mkdirSync13(dir, { recursive: true });
|
|
55960
56087
|
const db = new Database(dbPath);
|
|
55961
56088
|
db.exec("PRAGMA journal_mode = WAL");
|
|
55962
56089
|
db.exec([
|
|
@@ -55985,7 +56112,7 @@ function saveFeedback(input2) {
|
|
|
55985
56112
|
const path = join25(getDataDir(), "feedback.jsonl");
|
|
55986
56113
|
const dir = dirname9(path);
|
|
55987
56114
|
if (!existsSync16(dir))
|
|
55988
|
-
|
|
56115
|
+
mkdirSync13(dir, { recursive: true });
|
|
55989
56116
|
appendFileSync(path, JSON.stringify({ message, category, email: input2.email ?? null, agent: input2.agent ?? null, version: input2.version ?? null, createdAt: new Date().toISOString() }) + `
|
|
55990
56117
|
`);
|
|
55991
56118
|
return { saved: true, category, path };
|
|
@@ -56146,7 +56273,7 @@ var init_resource_meta_tools = __esm(() => {
|
|
|
56146
56273
|
});
|
|
56147
56274
|
|
|
56148
56275
|
// src/lib/scheduler.ts
|
|
56149
|
-
import { existsSync as existsSync17, readFileSync as readFileSync19, writeFileSync as writeFileSync11, mkdirSync as
|
|
56276
|
+
import { existsSync as existsSync17, readFileSync as readFileSync19, writeFileSync as writeFileSync11, mkdirSync as mkdirSync14 } from "fs";
|
|
56150
56277
|
import { join as join26 } from "path";
|
|
56151
56278
|
function getSchedulesPath(targetDir = process.cwd()) {
|
|
56152
56279
|
return join26(targetDir, ".skills", "schedules.json");
|
|
@@ -56164,7 +56291,7 @@ function saveSchedules(data, targetDir = process.cwd()) {
|
|
|
56164
56291
|
const path = getSchedulesPath(targetDir);
|
|
56165
56292
|
const dir = join26(targetDir, ".skills");
|
|
56166
56293
|
if (!existsSync17(dir))
|
|
56167
|
-
|
|
56294
|
+
mkdirSync14(dir, { recursive: true });
|
|
56168
56295
|
writeFileSync11(path, JSON.stringify(data, null, 2));
|
|
56169
56296
|
}
|
|
56170
56297
|
function validateCronField(expr, min, max, label) {
|
|
@@ -56437,7 +56564,7 @@ var init_schedule_tools = __esm(() => {
|
|
|
56437
56564
|
import { createHash as createHash10, createHmac } from "crypto";
|
|
56438
56565
|
import {
|
|
56439
56566
|
existsSync as existsSync18,
|
|
56440
|
-
mkdirSync as
|
|
56567
|
+
mkdirSync as mkdirSync15,
|
|
56441
56568
|
readFileSync as readFileSync20,
|
|
56442
56569
|
readdirSync as readdirSync10,
|
|
56443
56570
|
statSync as statSync11,
|
|
@@ -56803,20 +56930,20 @@ var init_private_publication_customer = __esm(() => {
|
|
|
56803
56930
|
});
|
|
56804
56931
|
|
|
56805
56932
|
// src/lib/private-publication-recovery.ts
|
|
56806
|
-
import { constants as
|
|
56933
|
+
import { constants as constants9, closeSync as closeSync13, fsyncSync as fsyncSync3, fstatSync as fstatSync13, lstatSync as lstatSync11, mkdirSync as mkdirSync16, openSync as openSync13, readSync as readSync7, realpathSync as realpathSync7, renameSync as renameSync7, unlinkSync as unlinkSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
56807
56934
|
import { dirname as dirname11, isAbsolute as isAbsolute7, join as join28, resolve as resolve6 } from "path";
|
|
56808
56935
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
56809
56936
|
function safeDirectory(directory2) {
|
|
56810
56937
|
if (!isAbsolute7(directory2) || directory2 !== resolve6(directory2) || realpathSync7(directory2) !== directory2)
|
|
56811
56938
|
return fail2();
|
|
56812
56939
|
for (let path = directory2;; path = dirname11(path)) {
|
|
56813
|
-
const stat2 =
|
|
56940
|
+
const stat2 = lstatSync11(path);
|
|
56814
56941
|
if (!stat2.isDirectory() || stat2.isSymbolicLink())
|
|
56815
56942
|
return fail2();
|
|
56816
56943
|
if (path === dirname11(path))
|
|
56817
56944
|
break;
|
|
56818
56945
|
}
|
|
56819
|
-
const own2 =
|
|
56946
|
+
const own2 = lstatSync11(directory2);
|
|
56820
56947
|
if ((own2.mode & 63) !== 0 || process.getuid && own2.uid !== process.getuid())
|
|
56821
56948
|
return fail2();
|
|
56822
56949
|
return { dev: own2.dev, ino: own2.ino };
|
|
@@ -56828,35 +56955,35 @@ function unchangedDirectory(directory2, identity2) {
|
|
|
56828
56955
|
}
|
|
56829
56956
|
function readOwned(directory2, name, max) {
|
|
56830
56957
|
const identity2 = safeDirectory(directory2), file2 = join28(directory2, name);
|
|
56831
|
-
const fd =
|
|
56958
|
+
const fd = openSync13(file2, constants9.O_RDONLY | constants9.O_NOFOLLOW);
|
|
56832
56959
|
try {
|
|
56833
|
-
const stat2 =
|
|
56960
|
+
const stat2 = fstatSync13(fd);
|
|
56834
56961
|
if (!stat2.isFile() || stat2.nlink !== 1 || stat2.size > max || stat2.size < 1 || (stat2.mode & 63) !== 0 || process.getuid && stat2.uid !== process.getuid())
|
|
56835
56962
|
return fail2();
|
|
56836
56963
|
const buffer = Buffer.alloc(Math.min(max, stat2.size) + 1);
|
|
56837
56964
|
let length = 0;
|
|
56838
56965
|
while (length < buffer.length) {
|
|
56839
|
-
const count =
|
|
56966
|
+
const count = readSync7(fd, buffer, length, buffer.length - length, length);
|
|
56840
56967
|
if (count === 0)
|
|
56841
56968
|
break;
|
|
56842
56969
|
length += count;
|
|
56843
56970
|
}
|
|
56844
|
-
const bytes = buffer.subarray(0, length), after =
|
|
56971
|
+
const bytes = buffer.subarray(0, length), after = fstatSync13(fd);
|
|
56845
56972
|
unchangedDirectory(directory2, identity2);
|
|
56846
56973
|
if (bytes.length !== stat2.size || stat2.size !== after.size || stat2.mtimeMs !== after.mtimeMs || stat2.ctimeMs !== after.ctimeMs)
|
|
56847
56974
|
return fail2();
|
|
56848
56975
|
return bytes;
|
|
56849
56976
|
} finally {
|
|
56850
|
-
|
|
56977
|
+
closeSync13(fd);
|
|
56851
56978
|
}
|
|
56852
56979
|
}
|
|
56853
56980
|
function writeOwned(directory2, name, bytes) {
|
|
56854
|
-
const fd =
|
|
56981
|
+
const fd = openSync13(join28(directory2, name), constants9.O_WRONLY | constants9.O_CREAT | constants9.O_EXCL | constants9.O_NOFOLLOW, 384);
|
|
56855
56982
|
try {
|
|
56856
56983
|
writeFileSync13(fd, bytes);
|
|
56857
|
-
|
|
56984
|
+
fsyncSync3(fd);
|
|
56858
56985
|
} finally {
|
|
56859
|
-
|
|
56986
|
+
closeSync13(fd);
|
|
56860
56987
|
}
|
|
56861
56988
|
}
|
|
56862
56989
|
function save(directory2, value) {
|
|
@@ -56864,12 +56991,12 @@ function save(directory2, value) {
|
|
|
56864
56991
|
writeOwned(directory2, temporary, JSON.stringify(value) + `
|
|
56865
56992
|
`);
|
|
56866
56993
|
unchangedDirectory(directory2, identity2);
|
|
56867
|
-
|
|
56868
|
-
const fd =
|
|
56994
|
+
renameSync7(join28(directory2, temporary), join28(directory2, "receipt.json"));
|
|
56995
|
+
const fd = openSync13(directory2, constants9.O_RDONLY | constants9.O_NOFOLLOW);
|
|
56869
56996
|
try {
|
|
56870
|
-
|
|
56997
|
+
fsyncSync3(fd);
|
|
56871
56998
|
} finally {
|
|
56872
|
-
|
|
56999
|
+
closeSync13(fd);
|
|
56873
57000
|
}
|
|
56874
57001
|
}
|
|
56875
57002
|
function bind(client, receipt) {
|
|
@@ -56880,23 +57007,23 @@ async function locked(directory2, action) {
|
|
|
56880
57007
|
const identity2 = safeDirectory(directory2), file2 = join28(directory2, "operation.lock");
|
|
56881
57008
|
let fd;
|
|
56882
57009
|
try {
|
|
56883
|
-
fd =
|
|
57010
|
+
fd = openSync13(file2, constants9.O_WRONLY | constants9.O_CREAT | constants9.O_EXCL | constants9.O_NOFOLLOW, 384);
|
|
56884
57011
|
} catch {
|
|
56885
57012
|
throw new PrivatePublicationError("PUBLICATION_RECOVERY_BUSY", "Another operation holds this recovery directory. If it crashed, confirm that process has stopped before explicitly removing operation.lock and resuming.");
|
|
56886
57013
|
}
|
|
56887
|
-
const lock =
|
|
57014
|
+
const lock = fstatSync13(fd);
|
|
56888
57015
|
try {
|
|
56889
57016
|
writeFileSync13(fd, JSON.stringify({ pid: process.pid }) + `
|
|
56890
57017
|
`);
|
|
56891
|
-
|
|
57018
|
+
fsyncSync3(fd);
|
|
56892
57019
|
return await action();
|
|
56893
57020
|
} finally {
|
|
56894
|
-
|
|
57021
|
+
closeSync13(fd);
|
|
56895
57022
|
unchangedDirectory(directory2, identity2);
|
|
56896
|
-
const now =
|
|
57023
|
+
const now = lstatSync11(file2);
|
|
56897
57024
|
if (now.dev !== lock.dev || now.ino !== lock.ino || !now.isFile() || now.isSymbolicLink())
|
|
56898
57025
|
fail2();
|
|
56899
|
-
|
|
57026
|
+
unlinkSync6(file2);
|
|
56900
57027
|
}
|
|
56901
57028
|
}
|
|
56902
57029
|
function readPrivatePublicationRecovery(directory2) {
|
|
@@ -56947,13 +57074,13 @@ async function preparePrivatePublication(client, sourceDirectory, recoveryDirect
|
|
|
56947
57074
|
};
|
|
56948
57075
|
if (!isAbsolute7(recoveryDirectory) || resolve6(recoveryDirectory) !== recoveryDirectory || realpathSync7(dirname11(recoveryDirectory)) !== dirname11(recoveryDirectory))
|
|
56949
57076
|
return fail2();
|
|
56950
|
-
|
|
57077
|
+
mkdirSync16(recoveryDirectory, { mode: 448 });
|
|
56951
57078
|
safeDirectory(recoveryDirectory);
|
|
56952
|
-
const parent =
|
|
57079
|
+
const parent = openSync13(dirname11(recoveryDirectory), constants9.O_RDONLY | constants9.O_NOFOLLOW);
|
|
56953
57080
|
try {
|
|
56954
|
-
|
|
57081
|
+
fsyncSync3(parent);
|
|
56955
57082
|
} finally {
|
|
56956
|
-
|
|
57083
|
+
closeSync13(parent);
|
|
56957
57084
|
}
|
|
56958
57085
|
writeOwned(recoveryDirectory, "bundle.tgz", packed.bytes);
|
|
56959
57086
|
save(recoveryDirectory, receipt);
|
|
@@ -57474,7 +57601,7 @@ var WSContext = class {
|
|
|
57474
57601
|
var init_websocket = () => {};
|
|
57475
57602
|
|
|
57476
57603
|
// node_modules/@hono/node-server/dist/index.mjs
|
|
57477
|
-
import { Http2ServerRequest, constants as
|
|
57604
|
+
import { Http2ServerRequest, constants as constants10 } from "http2";
|
|
57478
57605
|
import { Readable } from "stream";
|
|
57479
57606
|
async function readWithoutBlocking(readPromise) {
|
|
57480
57607
|
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(undefined))]);
|
|
@@ -57889,7 +58016,7 @@ var RequestError, nonJoinedHeaders, validHeaderName, isHttpWhitespace = (code2)
|
|
|
57889
58016
|
incomingWithDrainState[incomingDraining] = true;
|
|
57890
58017
|
if (incoming instanceof Http2ServerRequest) {
|
|
57891
58018
|
try {
|
|
57892
|
-
incoming.stream?.close?.(
|
|
58019
|
+
incoming.stream?.close?.(constants10.NGHTTP2_NO_ERROR);
|
|
57893
58020
|
} catch {}
|
|
57894
58021
|
return;
|
|
57895
58022
|
}
|