@ghostlytools/cli 1.8.1 → 1.10.0

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.
Files changed (111) hide show
  1. package/README.md +34 -23
  2. package/SKILL.md +9 -4
  3. package/dist/assets/{api-BpQC8dAw.js → api-BF_KwecF.js} +115 -45
  4. package/dist/assets/api-BF_KwecF.js.map +1 -0
  5. package/dist/assets/{api-CttDF-S5.js → api-DdrA86Ur.js} +2 -2
  6. package/dist/assets/{apiKit-CSMeHKgo.js → apiKit-Du1u2l4x.js} +8 -8
  7. package/dist/assets/apiKit-Du1u2l4x.js.map +1 -0
  8. package/dist/assets/{apps-DzFMdVt6.js → apps-Bti9fDoW.js} +1 -1
  9. package/dist/assets/{apps-DqTyZ40T.js → apps-DwPfp54I.js} +5 -3
  10. package/dist/assets/apps-DwPfp54I.js.map +1 -0
  11. package/dist/assets/{arkade-Cu3TbPxC.js → arkade-DOWpA2Kr.js} +2 -2
  12. package/dist/assets/{arkade-Cu3TbPxC.js.map → arkade-DOWpA2Kr.js.map} +1 -1
  13. package/dist/assets/{backup-CLZOORFC.js → backup-CeRckyl2.js} +1 -1
  14. package/dist/assets/{backup-CyTZhu28.js → backup-DZ_Q1eSu.js} +6 -6
  15. package/dist/assets/{backup-CyTZhu28.js.map → backup-DZ_Q1eSu.js.map} +1 -1
  16. package/dist/assets/{blobFiles-DOQDRdDI.js → blobFiles-BnjN_Vrz.js} +3 -3
  17. package/dist/assets/{blobFiles-DOQDRdDI.js.map → blobFiles-BnjN_Vrz.js.map} +1 -1
  18. package/dist/assets/buttons-BxIThdg9.js +332 -0
  19. package/dist/assets/buttons-BxIThdg9.js.map +1 -0
  20. package/dist/assets/buttons-D9QBHS9Y.js +2 -0
  21. package/dist/assets/client-D5E1RQYB.js +473 -0
  22. package/dist/assets/client-D5E1RQYB.js.map +1 -0
  23. package/dist/assets/{endpoint-BdaeBw2L.js → endpoint-DWHkXWVM.js} +101 -16
  24. package/dist/assets/endpoint-DWHkXWVM.js.map +1 -0
  25. package/dist/assets/{envelope-CGfUsR1m.js → envelope-CugS9qwQ.js} +2 -2
  26. package/dist/assets/{envelope-CGfUsR1m.js.map → envelope-CugS9qwQ.js.map} +1 -1
  27. package/dist/assets/{fileBytes-BPDKufla.js → fileBytes-DMzrIdCu.js} +1 -1
  28. package/dist/assets/{fileBytes-DNgrRL0R.js → fileBytes-DjBYYyXT.js} +3 -3
  29. package/dist/assets/{fileBytes-DNgrRL0R.js.map → fileBytes-DjBYYyXT.js.map} +1 -1
  30. package/dist/assets/{fileBytes-Q3ehcEr8.js → fileBytes-Douk1yOp.js} +2 -2
  31. package/dist/assets/{fileBytes-Q3ehcEr8.js.map → fileBytes-Douk1yOp.js.map} +1 -1
  32. package/dist/assets/fileBytesIdb-CD5Uv490.js +2 -0
  33. package/dist/assets/{fileBytesIdb-Dm1EyEbT.js → fileBytesIdb-CkClu9YI.js} +3 -3
  34. package/dist/assets/{fileBytesIdb-Dm1EyEbT.js.map → fileBytesIdb-CkClu9YI.js.map} +1 -1
  35. package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js → fileBytesOpfs-WryQuOgK.js} +3 -3
  36. package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js.map → fileBytesOpfs-WryQuOgK.js.map} +1 -1
  37. package/dist/assets/{fixedHosts-BiukTsd9.js → fixedHosts-B4E4VrYE.js} +4 -4
  38. package/dist/assets/{fixedHosts-BiukTsd9.js.map → fixedHosts-B4E4VrYE.js.map} +1 -1
  39. package/dist/assets/{groupFiles-CeF9nPv9.js → groupFiles-NonOYBKN.js} +380 -650
  40. package/dist/assets/groupFiles-NonOYBKN.js.map +1 -0
  41. package/dist/assets/{host-CKAehWP6.js → host-DvcVt5YI.js} +144 -33
  42. package/dist/assets/host-DvcVt5YI.js.map +1 -0
  43. package/dist/assets/{hyperdhtRelay-B8Pdykhg.js → hyperdhtRelay-Ce42sR8x.js} +2 -2
  44. package/dist/assets/{hyperdhtRelay-B8Pdykhg.js.map → hyperdhtRelay-Ce42sR8x.js.map} +1 -1
  45. package/dist/assets/{idb-BkOJES5_.js → idb-BHsAqENE.js} +37 -6
  46. package/dist/assets/idb-BHsAqENE.js.map +1 -0
  47. package/dist/assets/{irohWeb-D6tAPHZa.js → irohWeb-C9ChbD-c.js} +71 -4
  48. package/dist/assets/{irohWeb-D6tAPHZa.js.map → irohWeb-C9ChbD-c.js.map} +1 -1
  49. package/dist/assets/{main-BDY-pfpz.js → main-4qE381KM.js} +226 -280
  50. package/dist/assets/main-4qE381KM.js.map +1 -0
  51. package/dist/assets/{mainline-3ueXpFQL.js → mainline-DOwZDHVy.js} +2 -2
  52. package/dist/assets/{mainline-3ueXpFQL.js.map → mainline-DOwZDHVy.js.map} +1 -1
  53. package/dist/assets/{networkReason-DhJYOomu.js → networkReason-MInk1Y63.js} +3 -3
  54. package/dist/assets/{networkReason-DhJYOomu.js.map → networkReason-MInk1Y63.js.map} +1 -1
  55. package/dist/assets/{nwc-B1Quqda-.js → nwc-CHLWFV1R.js} +3 -3
  56. package/dist/assets/{nwc-B1Quqda-.js.map → nwc-CHLWFV1R.js.map} +1 -1
  57. package/dist/assets/{nwcProvider-DUB6xO-b.js → nwcProvider-BlkPOJen.js} +2 -2
  58. package/dist/assets/{nwcProvider-DUB6xO-b.js.map → nwcProvider-BlkPOJen.js.map} +1 -1
  59. package/dist/assets/{ownDid-BfqHJdA6.js → ownDid-yXtY_1B5.js} +3 -3
  60. package/dist/assets/ownDid-yXtY_1B5.js.map +1 -0
  61. package/dist/assets/{profiles-MFtCmJwK.js → profiles-vbXHs0Mq.js} +40 -3
  62. package/dist/assets/profiles-vbXHs0Mq.js.map +1 -0
  63. package/dist/assets/{registry-CZTmtSws.js → registry-BN9r2pR4.js} +1 -1
  64. package/dist/assets/{registry-DwlTNQjr.js → registry-chCD0KWS.js} +5 -5
  65. package/dist/assets/registry-chCD0KWS.js.map +1 -0
  66. package/dist/assets/{resolve-BVwhiYjj.js → resolve-Dtzogt2W.js} +2 -2
  67. package/dist/assets/{resolve-BVwhiYjj.js.map → resolve-Dtzogt2W.js.map} +1 -1
  68. package/dist/assets/{restoredRows-BCRCjhdF.js → restoredRows-CRYwIx3g.js} +2 -2
  69. package/dist/assets/{restoredRows-BCRCjhdF.js.map → restoredRows-CRYwIx3g.js.map} +1 -1
  70. package/dist/assets/secretGuard-CSVNxXVW.js +1081 -0
  71. package/dist/assets/secretGuard-CSVNxXVW.js.map +1 -0
  72. package/dist/assets/secretGuard-Q2BKq0q0.js +2 -0
  73. package/dist/assets/{server-Br3XPwFG.js → server-BZnsm5X5.js} +2510 -569
  74. package/dist/assets/server-BZnsm5X5.js.map +1 -0
  75. package/dist/assets/{src-C4sOH4zH.js → src-DZagapGt.js} +2015 -161
  76. package/dist/assets/src-DZagapGt.js.map +1 -0
  77. package/dist/assets/{sshForges-CQQomStK.js → sshForges-BkTgy5rx.js} +16 -9
  78. package/dist/assets/{sshForges-CQQomStK.js.map → sshForges-BkTgy5rx.js.map} +1 -1
  79. package/dist/assets/{translate-C2aNyUkR.js → translate-B9SMd6uf.js} +15 -8
  80. package/dist/assets/translate-B9SMd6uf.js.map +1 -0
  81. package/dist/assets/{usdt-CMwatDnQ.js → usdt-BU4ezonh.js} +3 -3
  82. package/dist/assets/{usdt-CMwatDnQ.js.map → usdt-BU4ezonh.js.map} +1 -1
  83. package/dist/assets/{waitNotice-Ck3el3_Z.js → waitNotice-B8D8WhbE.js} +2 -2
  84. package/dist/assets/waitNotice-B8D8WhbE.js.map +1 -0
  85. package/dist/assets/{words-CqN2KG1r.js → words-jYy7lTcb.js} +5 -2
  86. package/dist/assets/words-jYy7lTcb.js.map +1 -0
  87. package/dist/ghostly.mjs +1 -1
  88. package/examples/call-echo.mjs +7 -5
  89. package/package.json +1 -1
  90. package/dist/assets/api-BpQC8dAw.js.map +0 -1
  91. package/dist/assets/apiKit-CSMeHKgo.js.map +0 -1
  92. package/dist/assets/apps-DqTyZ40T.js.map +0 -1
  93. package/dist/assets/buttons-Bd9fR31r.js +0 -698
  94. package/dist/assets/buttons-Bd9fR31r.js.map +0 -1
  95. package/dist/assets/buttons-c4CJnL6i.js +0 -2
  96. package/dist/assets/daemonProof-DtrL5lE5.js +0 -236
  97. package/dist/assets/daemonProof-DtrL5lE5.js.map +0 -1
  98. package/dist/assets/endpoint-BdaeBw2L.js.map +0 -1
  99. package/dist/assets/fileBytesIdb-DZcESfTt.js +0 -2
  100. package/dist/assets/groupFiles-CeF9nPv9.js.map +0 -1
  101. package/dist/assets/host-CKAehWP6.js.map +0 -1
  102. package/dist/assets/idb-BkOJES5_.js.map +0 -1
  103. package/dist/assets/main-BDY-pfpz.js.map +0 -1
  104. package/dist/assets/ownDid-BfqHJdA6.js.map +0 -1
  105. package/dist/assets/profiles-MFtCmJwK.js.map +0 -1
  106. package/dist/assets/registry-DwlTNQjr.js.map +0 -1
  107. package/dist/assets/server-Br3XPwFG.js.map +0 -1
  108. package/dist/assets/src-C4sOH4zH.js.map +0 -1
  109. package/dist/assets/translate-C2aNyUkR.js.map +0 -1
  110. package/dist/assets/waitNotice-Ck3el3_Z.js.map +0 -1
  111. package/dist/assets/words-CqN2KG1r.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { t as CliError } from "./errors-R4S2SAEM.js";
2
2
  import { execFileSync } from "node:child_process";
3
3
  import { chmodSync, closeSync, existsSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
4
- import { isAbsolute, join, resolve } from "node:path";
4
+ import { dirname, isAbsolute, join, resolve } from "node:path";
5
5
  import { createHash } from "node:crypto";
6
6
  import { homedir, tmpdir } from "node:os";
7
7
  //#region src/privateFolder.ts
@@ -49,6 +49,43 @@ function ownFolder(path, what) {
49
49
  if (!info.isDirectory() || process.getuid && info.uid !== process.getuid()) throw new Error(`${path} is not a folder of this user's: ${what}`);
50
50
  if ((info.mode & 63) !== 0) chmodSync(path, 448);
51
51
  }
52
+ /**
53
+ * A profile's folders and files, checked before a command (a one-shot as much as the daemon) takes its lock or opens
54
+ * its store, which append to the files in place and follow a link: the home and its `profiles/` must be this user's
55
+ * (a link to a folder of this user's is one); the home is closed to others' writes, `profiles/` to 0700. The profile's
56
+ * folder and its `db/` must be this user's and not links, and are closed to 0700; what is in them must be this user's
57
+ * and not a link, and a file is closed to 0600. A home, profile or journal opened up by hand, or made by another
58
+ * account in a folder it could write, was used as it was: the events journal (message texts) stayed readable by others.
59
+ */
60
+ function ownProfile(dir) {
61
+ if (process.platform === "win32") return;
62
+ const what = "ghostly will not open the profile there";
63
+ const profiles = dirname(dir), home = dirname(profiles);
64
+ const mine = (info) => !process.getuid || info.uid === process.getuid();
65
+ for (const folder of [home, profiles]) {
66
+ const info = statSync(folder);
67
+ if (!info.isDirectory() || !mine(info)) throw new CliError("refused", `${folder} is not a folder of this user's: ${what}`);
68
+ const open = folder === home ? 18 : 63;
69
+ if ((info.mode & open) !== 0) chmodSync(folder, info.mode & 511 & ~open);
70
+ }
71
+ const db = join(dir, "db");
72
+ for (const folder of [dir, db]) {
73
+ let info;
74
+ try {
75
+ info = lstatSync(folder);
76
+ } catch (error) {
77
+ if (folder === db && error.code === "ENOENT") continue;
78
+ throw error;
79
+ }
80
+ if (!info.isDirectory() || !mine(info)) throw new CliError("refused", `${folder} is not a folder of this user's: ${what}`);
81
+ if ((info.mode & 63) !== 0) chmodSync(folder, 448);
82
+ for (const name of readdirSync(folder)) {
83
+ const path = join(folder, name), entry = lstatSync(path);
84
+ if (entry.isSymbolicLink() || !mine(entry)) throw new CliError("refused", `${path} is a link or another user's: ${what}`);
85
+ if (entry.isFile() && (entry.mode & 63) !== 0) chmodSync(path, 384);
86
+ }
87
+ }
88
+ }
52
89
  /** False when `path` is there but is not a socket of this user's: nothing to connect to. */
53
90
  function ownSocket(path) {
54
91
  if (process.platform === "win32") return true;
@@ -385,6 +422,6 @@ function holder(file, lock) {
385
422
  return recorded && now !== null && now !== recorded ? null : pid;
386
423
  }
387
424
  //#endregion
388
- export { userPath as _, checkShownName as a, privateFolder as b, ghostlyHome as c, lockPath as d, profileExists as f, startingPath as g, startingDaemon as h, checkProfileName as i, listProfiles as l, selectProfile as m, RESTORED_MARK as n, createProfile as o, profilePaths as p, acquireLock as r, currentProfile as s, DEFAULT_PROFILE as t, lockOwner as u, ownFolder as v, runtimePath as x, ownSocket as y };
425
+ export { runtimePath as S, userPath as _, checkShownName as a, ownSocket as b, ghostlyHome as c, lockPath as d, profileExists as f, startingPath as g, startingDaemon as h, checkProfileName as i, listProfiles as l, selectProfile as m, RESTORED_MARK as n, createProfile as o, profilePaths as p, acquireLock as r, currentProfile as s, DEFAULT_PROFILE as t, lockOwner as u, ownFolder as v, privateFolder as x, ownProfile as y };
389
426
 
390
- //# sourceMappingURL=profiles-MFtCmJwK.js.map
427
+ //# sourceMappingURL=profiles-vbXHs0Mq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles-vbXHs0Mq.js","names":[],"sources":["../../src/privateFolder.ts","../../src/profiles.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { chmodSync, lstatSync, mkdirSync, readdirSync, statSync, type Stats } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, isAbsolute, join } from \"node:path\";\nimport { CliError } from \"./errors\";\n\n/**\n * Where a socket goes when its path in the profile is longer than a Unix socket may be: `<base>/<prefix>-<hash of the\n * profile>/<leaf>`, in `$XDG_RUNTIME_DIR` or else the temp folder (macOS gives each user one) when that folder is the\n * user's alone, so no other user can make the folder first. When neither is, or the path would still be too long:\n * `/tmp/<prefix>-<uid>-<hash>/<leaf>`. Either way `privateFolder` checks the folder before use.\n */\nexport function runtimePath(prefix: string, profileDir: string, leaf: string): string {\n const hash = createHash(\"sha256\").update(profileDir).digest(\"hex\").slice(0, 24);\n for (const base of [process.env.XDG_RUNTIME_DIR, tmpdir()]) {\n if (!base || !isAbsolute(base) || !usersAlone(base)) continue;\n const path = join(base, `${prefix}-${hash}`, leaf);\n if (Buffer.byteLength(path) <= 100) return path;\n }\n return join(\"/tmp\", `${prefix}-${process.getuid?.() ?? 0}-${hash}`, leaf);\n}\n\nfunction usersAlone(path: string): boolean {\n try {\n const info = statSync(path);\n return info.isDirectory() && (!process.getuid || info.uid === process.getuid()) && (info.mode & 0o077) === 0;\n } catch {\n return false;\n }\n}\n\n/**\n * A folder for a socket outside the profile (when the profile's path is too long for one): made owner-only, and\n * refused when it is a link, someone else made it, or anyone else may enter it.\n */\nexport function privateFolder(path: string, what: string): void {\n mkdirSync(path, { recursive: true, mode: 0o700 });\n const info = lstatSync(path);\n if (!info.isDirectory() || (process.getuid && info.uid !== process.getuid()) || (info.mode & 0o077) !== 0) {\n throw new Error(`${path} is not a folder of this user's alone: ${what}`);\n }\n}\n\n/**\n * The profile's own folder, made owner-only again before the daemon's socket goes in it: a folder made by an older\n * release, or opened up by hand, is closed rather than trusted. Refused when it is a link or someone else's.\n */\nexport function ownFolder(path: string, what: string): void {\n const info = lstatSync(path);\n if (!info.isDirectory() || (process.getuid && info.uid !== process.getuid())) throw new Error(`${path} is not a folder of this user's: ${what}`);\n if ((info.mode & 0o077) !== 0) chmodSync(path, 0o700);\n}\n\n/**\n * A profile's folders and files, checked before a command (a one-shot as much as the daemon) takes its lock or opens\n * its store, which append to the files in place and follow a link: the home and its `profiles/` must be this user's\n * (a link to a folder of this user's is one); the home is closed to others' writes, `profiles/` to 0700. The profile's\n * folder and its `db/` must be this user's and not links, and are closed to 0700; what is in them must be this user's\n * and not a link, and a file is closed to 0600. A home, profile or journal opened up by hand, or made by another\n * account in a folder it could write, was used as it was: the events journal (message texts) stayed readable by others.\n */\nexport function ownProfile(dir: string): void {\n if (process.platform === \"win32\") return;\n const what = \"ghostly will not open the profile there\";\n const profiles = dirname(dir), home = dirname(profiles);\n const mine = (info: Stats) => !process.getuid || info.uid === process.getuid();\n for (const folder of [home, profiles]) {\n const info = statSync(folder);\n if (!info.isDirectory() || !mine(info)) throw new CliError(\"refused\", `${folder} is not a folder of this user's: ${what}`);\n const open = folder === home ? 0o022 : 0o077;\n if ((info.mode & open) !== 0) chmodSync(folder, info.mode & 0o777 & ~open);\n }\n const db = join(dir, \"db\");\n for (const folder of [dir, db]) {\n let info;\n try { info = lstatSync(folder); } catch (error) { if (folder === db && (error as NodeJS.ErrnoException).code === \"ENOENT\") continue; throw error; }\n if (!info.isDirectory() || !mine(info)) throw new CliError(\"refused\", `${folder} is not a folder of this user's: ${what}`);\n if ((info.mode & 0o077) !== 0) chmodSync(folder, 0o700);\n for (const name of readdirSync(folder)) {\n const path = join(folder, name), entry = lstatSync(path);\n if (entry.isSymbolicLink() || !mine(entry)) throw new CliError(\"refused\", `${path} is a link or another user's: ${what}`);\n if (entry.isFile() && (entry.mode & 0o077) !== 0) chmodSync(path, 0o600);\n }\n }\n}\n\n/** False when `path` is there but is not a socket of this user's: nothing to connect to. */\nexport function ownSocket(path: string): boolean {\n if (process.platform === \"win32\") return true;\n let info;\n try { info = lstatSync(path); } catch { return true; }\n return info.isSocket() && (!process.getuid || info.uid === process.getuid());\n}\n","import { execFileSync } from \"node:child_process\";\nimport { closeSync, existsSync, linkSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, writeSync, type Stats } from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport { homedir } from \"node:os\";\nimport { join, resolve } from \"node:path\";\nimport { CliError } from \"./errors\";\nimport { runtimePath } from \"./privateFolder\";\n\n/**\n * Profiles on disk (WISP 1100 § Profiles and files): `<home>/profiles/<name>/`, 0700, one engine store each.\n * `<home>/current` names the profile commands use when none is given.\n */\nexport const DEFAULT_PROFILE = \"default\";\nconst NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/i;\n\n/**\n * An empty `--home` or `--profile` (an unset variable in a script) is a usage error: taken as not given, it ran the\n * command in the current folder, or as the current profile. An empty variable of the environment counts as unset.\n */\nexport function ghostlyHome(option?: string): string {\n if (option === \"\") throw new CliError(\"usage\", \"--home needs a folder\");\n return userPath(option ?? (process.env.GHOSTLY_HOME || join(homedir(), \".ghostly\")), true);\n}\n\n/**\n * A path the CLI was given, made absolute. A `~` the shell left alone (`--home=~/bots`, a quoted variable, a unit\n * file's `Environment=` line) is the user's home, as the shell reads it: it was a folder named `~` in the current one.\n * `~user/…` is a usage error, not a guess at another user's home, unless it is there under this folder. Any other name\n * that starts with `~` is a file here, as the shell and every other tool read it (`~notes.txt`, Office's\n * `~$report.docx`, a new `~cursor`): all of them were refused (agents#1604). `home`: the profiles' folder, where a bare\n * `~bob` that is not there is refused too, as a new profile would be made in a folder of that name.\n */\nexport function userPath(path: string, home = false): string {\n if (path === \"~\" || path.startsWith(\"~/\")) return join(homedir(), path.slice(1));\n if (path.startsWith(\"~\") && (home || path.includes(\"/\")) && !existsSync(resolve(path))) {\n throw new CliError(\"usage\", `${path}: ~user is not read here: write the ${home || path.endsWith(\"/\") ? \"folder\" : \"path\"} in full`);\n }\n return resolve(path);\n}\n\nexport function checkProfileName(name: string): string {\n if (!NAME.test(name) || name.includes(\"..\")) throw new CliError(\"usage\", `Not a profile name: ${JSON.stringify(name)} (letters, digits, \".\", \"_\" and \"-\", up to 64)`);\n return name;\n}\n\n/**\n * The name a profile shows its contacts, whichever command sets it (`--name`, `profile.set`, `settings set nick`):\n * trimmed, up to 64 characters on one line, as a group's name; empty is no name. `settings set nick` took any length\n * and every one took a line break, printed whole by `status`. `field` names it in the refusal.\n */\nexport function checkShownName(name: unknown, field = \"name\"): string {\n const shown = typeof name === \"string\" ? name.trim() : undefined;\n // Core's MAX_NICK_LENGTH: this file loads before any command, without the engine.\n if (shown === undefined || [...shown].length > 64 || /\\p{Cc}/u.test(shown)) {\n throw new CliError(\"bad_request\", `${field} must be up to 64 characters on one line`);\n }\n return shown;\n}\n\nexport function currentProfile(home: string, option?: string): string {\n if (option === \"\") throw new CliError(\"usage\", \"--profile needs a profile name\");\n if (option !== undefined) return checkProfileName(option);\n if (process.env.GHOSTLY_PROFILE) return checkProfileName(process.env.GHOSTLY_PROFILE);\n const file = join(home, \"current\");\n if (existsSync(file)) {\n const name = readFileSync(file, \"utf8\").trim();\n if (name) return checkProfileName(name);\n }\n return DEFAULT_PROFILE;\n}\n\nexport function profileDir(home: string, name: string): string {\n return join(home, \"profiles\", checkProfileName(name));\n}\n\nexport interface ProfilePaths { name: string; dir: string; db: string; socket: string; lock: string; events: string; files: string; log: string }\nexport function profilePaths(home: string, name: string): ProfilePaths {\n const dir = profileDir(home, name);\n return {\n name, dir, db: join(dir, \"db\"), socket: socketPath(dir), lock: lockPath(dir),\n events: join(dir, \"events.jsonl\"), files: join(dir, \"files\"), log: join(dir, \"daemon.log\"),\n };\n}\n\n/** The file that says which process holds the profile (`acquireLock`). */\nexport function lockPath(dir: string): string {\n return join(dir, \"daemon.lock\");\n}\n\n/** The file in which a daemon says it is starting: its pid, from the lock it took until its socket listens. */\nexport function startingPath(dir: string): string {\n return join(dir, \"daemon.starting\");\n}\n\n/**\n * The pid of the profile's daemon while it starts (its engine, before its socket listens): the lock's holder, when it\n * marked its start. Null otherwise: nobody holds the profile, a one-shot command does, or the mark is a dead daemon's.\n */\nexport function startingDaemon(paths: ProfilePaths): number | null {\n let pid: number;\n try { pid = Number(readFileSync(startingPath(paths.dir), \"utf8\").trim()); } catch { return null; }\n // Alive, and this profile's: the lock's holder is.\n return Number.isInteger(pid) && pid > 0 && pid === lockOwner(paths) ? pid : null;\n}\n\n/**\n * The daemon's socket: in the profile's folder, unless that path is longer than a Unix socket may be (104 bytes on\n * macOS); then in a folder of the user's runtime folder named after the profile's (`runtimePath`), which the daemon\n * makes owner-only and checks before use (`privateFolder`), and whose socket a client connects to only when it is this\n * user's (`ownSocket`).\n */\nfunction socketPath(dir: string): string {\n const inside = join(dir, \"daemon.sock\");\n if (process.platform === \"win32\") return `\\\\\\\\.\\\\pipe\\\\ghostly-${createHash(\"sha256\").update(dir).digest(\"hex\").slice(0, 24)}`;\n if (Buffer.byteLength(inside) <= 100) return inside;\n return runtimePath(\"ghostly\", dir, \"daemon.sock\");\n}\n\nfunction ensureFolder(path: string): void {\n mkdirSync(path, { recursive: true, mode: 0o700 });\n}\n\n/** Makes the profile's folder; refused when it exists and `existing` is not allowed. */\nexport function createProfile(home: string, name: string, { existing = false } = {}): ProfilePaths {\n const paths = profilePaths(home, name);\n if (existsSync(paths.dir) && !existing) throw new CliError(\"refused\", `Profile ${name} exists`);\n ensureFolder(join(home, \"profiles\"));\n ensureFolder(paths.dir);\n return paths;\n}\n\n/**\n * A file in the folder of a profile a restore made, until its engine starts for the first time: the store came back\n * whole, as the backup held it, and the money in it is then treated as every restore treats it (WISP 05 § Restoring).\n */\nexport const RESTORED_MARK = \"restored\";\n\nexport function profileExists(home: string, name: string): boolean {\n return existsSync(profileDir(home, name));\n}\n\nexport function listProfiles(home: string): string[] {\n const root = join(home, \"profiles\");\n if (!existsSync(root)) return [];\n return readdirSync(root).filter((name) => NAME.test(name) && statSync(join(root, name)).isDirectory()).sort();\n}\n\nexport function selectProfile(home: string, name: string): void {\n if (!profileExists(home, name)) throw new CliError(\"not_found\", `No profile ${name}`);\n ensureFolder(home);\n writeFileSync(join(home, \"current\"), name + \"\\n\", { mode: 0o600 });\n}\n\n/**\n * One process per profile: the daemon or a one-shot command. The lock holds the owner's pid; a lock whose\n * process is gone is taken over.\n *\n * The lock is a link to a file that already holds the pid, so it never exists empty (agents#1642): one made by\n * `openSync` + `writeSync` was empty for a moment, and another process read that as nobody's and removed it under its\n * owner. An empty lock younger than `EMPTY_LOCK_GRACE_MS` is still an older release's being written: busy. A stale\n * lock is moved aside before it is removed, and only when what was moved is the file judged stale: one that vanished,\n * or that another process made since, is no longer removed.\n *\n * The lock stays the bare pid, as older releases read it; beside it, `<lock>.<pid>.start` holds when that process\n * started (`processStart`). A lock left by a process that died without releasing it (kill -9, Ctrl-C of a one-shot, a\n * reboot) whose pid now belongs to another process is then stale too: it held the profile for good, every command busy\n * until someone found the file. It is written before the lock is placed, so a lock of this release never lacks it for\n * a moment; one without it (an older release's) is held while its pid is alive, as before.\n */\nexport function acquireLock(paths: ProfilePaths): () => void {\n const mine = String(process.pid);\n const draft = `${paths.lock}.${mine}`;\n const start = startPath(paths.lock, process.pid);\n const started = processStart(process.pid);\n let placed = false;\n writeFileSync(draft, mine, { mode: 0o600 });\n if (started !== null) writeFileSync(start, started, { mode: 0o600 });\n try {\n for (let attempt = 0; attempt < 3; attempt++) {\n if (placeLock(draft, paths.lock, mine)) {\n placed = true;\n heldHere.add(paths.lock);\n let released = false;\n return () => {\n if (released) return;\n released = true;\n heldHere.delete(paths.lock);\n try { if (readFileSync(paths.lock, \"utf8\").trim() === mine) rmSync(paths.lock, { force: true }); } catch { /* gone already */ }\n rmSync(start, { force: true });\n };\n }\n let seen: Stats;\n try { seen = lstatSync(paths.lock); } catch { continue; }\n const owner = lockOwner(paths);\n if (owner !== null) throw new CliError(\"busy\", `Profile ${paths.name} is in use by process ${owner}`, { pid: owner });\n if (seen.size === 0 && Date.now() - seen.mtimeMs < EMPTY_LOCK_GRACE_MS) break;\n removeStaleLock(paths.lock, seen);\n }\n } finally {\n rmSync(draft, { force: true });\n if (!placed) rmSync(start, { force: true });\n }\n throw new CliError(\"busy\", `Profile ${paths.name} is in use`);\n}\n\n/** The locks this process holds: a lock naming this pid that is not one of them is a dead holder's whose pid it has now. */\nconst heldHere = new Set<string>();\n\nfunction startPath(lock: string, pid: number): string {\n return `${lock}.${pid}.start`;\n}\n\n/**\n * When the process `pid` started, as a text that is the same for as long as it runs and another for the next process\n * given that pid; null where it cannot be read (Windows, a `/proc` that hides others' processes, no `ps`). On Linux the\n * boot's id and `/proc/<pid>/stat`'s start time (clock ticks since boot); elsewhere `ps -o lstart=`.\n */\nexport function processStart(pid: number): string | null {\n try {\n if (process.platform === \"linux\") {\n const stat = readFileSync(`/proc/${pid}/stat`, \"utf8\");\n // Fields after the command, which may hold spaces and parentheses: the start time is field 22.\n const ticks = stat.slice(stat.lastIndexOf(\")\") + 2).split(\" \")[19];\n if (!ticks || !/^\\d+$/.test(ticks)) return null;\n return `${readFileSync(\"/proc/sys/kernel/random/boot_id\", \"utf8\").trim()} ${ticks}`;\n }\n if (process.platform === \"win32\") return null;\n const lstart = execFileSync(\"ps\", [\"-o\", \"lstart=\", \"-p\", String(pid)], {\n encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"], timeout: 2_000, env: { ...process.env, LC_ALL: \"C\" },\n }).trim();\n return lstart || null;\n } catch {\n return null;\n }\n}\n\n/** How long an empty lock is taken for one an older release is still writing its pid into. */\nconst EMPTY_LOCK_GRACE_MS = 1_000;\n\n/**\n * Links `draft` (which holds `mine`) as the lock; false when there is a lock already. Where the file system has no\n * hard links, the lock is made in place, as before.\n */\nfunction placeLock(draft: string, lock: string, mine: string): boolean {\n try {\n linkSync(draft, lock);\n return true;\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code === \"EEXIST\") return false;\n if (![\"EPERM\", \"ENOTSUP\", \"EOPNOTSUPP\", \"ENOSYS\"].includes(code ?? \"\")) throw error;\n }\n let fd: number;\n try { fd = openSync(lock, \"wx\", 0o600); } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"EEXIST\") return false;\n throw error;\n }\n writeSync(fd, mine);\n closeSync(fd);\n return true;\n}\n\n/**\n * Removes the lock judged stale (`seen`): it is moved aside first, and removed only when what was moved is that same\n * file and holds no live pid (a freed inode is soon reused). A lock another process made in the meantime is put back.\n */\nfunction removeStaleLock(lock: string, seen: Stats): void {\n const aside = `${lock}.stale.${process.pid}`;\n try { renameSync(lock, aside); } catch { return; }\n try {\n const moved = lstatSync(aside);\n if (moved.ino === seen.ino && moved.dev === seen.dev && holder(aside, lock) === null && moved.size === seen.size) {\n const pid = lockPid(aside);\n if (pid !== null && pid !== process.pid) rmSync(startPath(lock, pid), { force: true });\n return;\n }\n try { linkSync(aside, lock); } catch { /* another lock is there already */ }\n } finally {\n rmSync(aside, { force: true });\n }\n}\n\n/**\n * The pid holding the profile, or null when nobody does: the lock's process is gone, or its pid is another process's\n * now (it started at another time than the lock's holder, or it is this process, which does not hold the lock).\n */\nexport function lockOwner(paths: ProfilePaths): number | null {\n return holder(paths.lock, paths.lock);\n}\n\nfunction lockPid(file: string): number | null {\n let pid: number;\n try { pid = Number(readFileSync(file, \"utf8\").trim()); } catch { return null; }\n return Number.isInteger(pid) && pid > 0 ? pid : null;\n}\n\n/** `file`: the lock, or the stale one moved aside; `lock`: the lock's own path, beside which its start is. */\nfunction holder(file: string, lock: string): number | null {\n const pid = lockPid(file);\n if (pid === null) return null;\n if (pid === process.pid) return heldHere.has(lock) ? pid : null;\n try { process.kill(pid, 0); } catch (error) { if ((error as NodeJS.ErrnoException).code !== \"EPERM\") return null; }\n let recorded: string;\n try { recorded = readFileSync(startPath(lock, pid), \"utf8\").trim(); } catch { return pid; }\n const now = processStart(pid);\n return recorded && now !== null && now !== recorded ? null : pid;\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,YAAY,QAAgB,YAAoB,MAAsB;CACpF,MAAM,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CAC9E,KAAK,MAAM,QAAQ,CAAC,QAAQ,IAAI,iBAAiB,OAAO,CAAC,GAAG;EAC1D,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,IAAI,GAAG;EACrD,MAAM,OAAO,KAAK,MAAM,GAAG,OAAO,GAAG,QAAQ,IAAI;EACjD,IAAI,OAAO,WAAW,IAAI,KAAK,KAAK,OAAO;CAC7C;CACA,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ,SAAS,KAAK,EAAE,GAAG,QAAQ,IAAI;AAC1E;AAEA,SAAS,WAAW,MAAuB;CACzC,IAAI;EACF,MAAM,OAAO,SAAS,IAAI;EAC1B,OAAO,KAAK,YAAY,MAAM,CAAC,QAAQ,UA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D,OAAO,OAAO,MAAM,MAAM,MAAM,IAAI;AACtC;AAEA,SAAS,QAAQ,MAA6B;CAC5C,IAAI;CACJ,IAAI;EAAE,MAAM,OAAO,aAAa,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC;CAAG,QAAQ;EAAE,OAAO;CAAM;CAC9E,OAAO,OAAO,UAAU,GAAG,KAAK,MAAM,IAAI,MAAM;AAClD;;AAGA,SAAS,OAAO,MAAc,MAA6B;CACzD,MAAM,MAAM,QAAQ,IAAI;CACxB,IAAI,QAAQ,MAAM,OAAO;CACzB,IAAI,QAAQ,QAAQ,KAAK,OAAO,SAAS,IAAI,IAAI,IAAI,MAAM;CAC3D,IAAI;EAAE,QAAQ,KAAK,KAAK,CAAC;CAAG,SAAS,OAAO;EAAE,IAAK,MAAgC,SAAS,SAAS,OAAO;CAAM;CAClH,IAAI;CACJ,IAAI;EAAE,WAAW,aAAa,UAAU,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,KAAK;CAAG,QAAQ;EAAE,OAAO;CAAK;CAC1F,MAAM,MAAM,aAAa,GAAG;CAC5B,OAAO,YAAY,QAAQ,QAAQ,QAAQ,WAAW,OAAO;AAC/D"}
@@ -1,2 +1,2 @@
1
- import { n as identityProvider, r as identityProviders, t as IDENTITY_PROVIDERS } from "./registry-DwlTNQjr.js";
1
+ import { n as identityProvider, r as identityProviders, t as IDENTITY_PROVIDERS } from "./registry-chCD0KWS.js";
2
2
  export { IDENTITY_PROVIDERS, identityProvider, identityProviders };
@@ -1,7 +1,7 @@
1
- import { $ as SshSigError, At as didSignedMessages, Bt as signingKeys, Ci as domainTxtRecord, Cn as homeserverWebEndpoint, Ct as DID_FILE_MAX_BYTES, Dt as checkDidSignature, Et as checkDidJws, Ft as didWebHost, Fu as utf8Encode, Ht as strictBase64Url, It as normalizeDid, Lt as parseDid, Mt as didWebFile, Mu as toBase64Url, Ni as wellKnownUrl, Nt as didWebFileNames, Oi as normalizeDomain, Ot as didGhostlyServiceEntry, Pt as didWebFileUrl, Pu as utf8Decode, Q as SSHSIG_NAMESPACE, Rt as parseDidDocument, Si as dnsProofName, Sn as pubkyProofPath, St as DID_DOCUMENT_MAX_BYTES, Tt as DidError, Vi as IdentityCheckUnavailable, Vt as staticDidDocument, _n as isPubkyProofFolder, _t as normalizeAtprotoHandle, at as verifyBitcoinMessage, bn as pubkyProofCapability, bt as AtprotoProofError, ct as ATPROTO_DECLARED_SCOPE, dt as ATPROTO_PROOF_SCOPE, et as parseSshPublicKey, gn as isPubkyKey, gt as isAtprotoDid, hn as PUBKY_PROOF_MAX_BYTES, ht as checkAtprotoProofRecord, hu as RELAY_PAYLOAD_MAX_BYTES, it as verifySshSignature, jt as didWebDocumentUrl, ju as randomBytes, kt as didJwsAlg, ku as fromBase64Url, lt as ATPROTO_FULL_SCOPE, mt as atprotoProofRkey, ot as BitcoinAddressError, pt as atprotoProofRecord, qt as resolveDidDht, rt as sshSignCommand, st as decodeAnyBitcoinAddress, tt as parseSshSignature, ut as ATPROTO_PROOF_COLLECTION, vn as newPubkyProofFolder, vu as openRelayPayload, wi as domainWellKnownFile, wn as pubkyHomeserverOf, xn as pubkyProofFile, xt as verifyAtprotoRecordProof, yn as normalizePubkyKey, yt as shortAtprotoDid, zt as parseDidSignaturePaste } from "./src-C4sOH4zH.js";
2
- import { c as boundedIdentityFetch, i as registeredIdentityProviders, s as reserveAdapterIds, t as ownDid, u as testBuild } from "./ownDid-BfqHJdA6.js";
3
- import { a as verifiedAtprotoHandle, c as assertDomainRecord, d as chosenResolver, f as resolverById, i as resolveAtprotoHandle, l as assertNip05, r as resolveAtprotoDid, s as DomainCheckError, t as assertPublicServer, u as assertPublicHost } from "./resolve-BVwhiYjj.js";
4
- import { a as PUBKY_RELAYS, c as isConfigured, d as providerForIssuer, i as validForgeLogin, l as issuerFor, n as SSH_FORGE_LABEL, o as audiences, r as checkSshForge, s as clientIdFor, t as SSH_FORGE_HOST, u as oidcProviders } from "./sshForges-CQQomStK.js";
1
+ import { $ as SSHSIG_NAMESPACE, At as didJwsAlg, Bt as parseDidSignaturePaste, Cn as pubkyProofPath, Ct as DID_DOCUMENT_MAX_BYTES, Dt as checkDidJws, Et as DidError, Ft as didWebFileUrl, Gu as toBase64Url, Hi as wellKnownUrl, Ht as staticDidDocument, Hu as fromBase64Url, It as didWebHost, Jt as resolveDidDht, Ju as utf8Encode, Li as normalizeDomain, Lt as normalizeDid, Mi as domainTxtRecord, Mt as didWebDocumentUrl, Ni as domainWellKnownFile, Nt as didWebFile, Ot as checkDidSignature, Ou as RELAY_PAYLOAD_MAX_BYTES, Pt as didWebFileNames, Rt as parseDid, Sn as pubkyProofFile, St as verifyAtprotoRecordProof, Tn as pubkyHomeserverOf, Ut as strictBase64Url, Vt as signingKeys, Wu as randomBytes, Xi as IdentityCheckUnavailable, _n as isPubkyKey, _t as isAtprotoDid, at as verifySshSignature, bn as normalizePubkyKey, bt as shortAtprotoDid, ct as decodeAnyBitcoinAddress, dt as ATPROTO_PROOF_COLLECTION, et as SshSigError, ft as ATPROTO_PROOF_SCOPE, gn as PUBKY_PROOF_MAX_BYTES, gt as checkAtprotoProofRecord, ht as atprotoProofRkey, it as sshSignCommand, ji as dnsProofName, jt as didSignedMessages, ju as openRelayPayload, kt as didGhostlyServiceEntry, lt as ATPROTO_DECLARED_SCOPE, mt as atprotoProofRecord, nt as parseSshSignature, ot as verifyBitcoinMessage, qu as utf8Decode, st as BitcoinAddressError, tt as parseSshPublicKey, ut as ATPROTO_FULL_SCOPE, vn as isPubkyProofFolder, vt as normalizeAtprotoHandle, wn as homeserverWebEndpoint, wt as DID_FILE_MAX_BYTES, xn as pubkyProofCapability, xt as AtprotoProofError, yn as newPubkyProofFolder, zt as parseDidDocument } from "./src-DZagapGt.js";
2
+ import { c as boundedIdentityFetch, i as registeredIdentityProviders, s as reserveAdapterIds, t as ownDid, u as testBuild } from "./ownDid-yXtY_1B5.js";
3
+ import { a as verifiedAtprotoHandle, c as assertDomainRecord, d as chosenResolver, f as resolverById, i as resolveAtprotoHandle, l as assertNip05, r as resolveAtprotoDid, s as DomainCheckError, t as assertPublicServer, u as assertPublicHost } from "./resolve-Dtzogt2W.js";
4
+ import { a as PUBKY_RELAYS, c as isConfigured, d as providerForIssuer, i as validForgeLogin, l as issuerFor, n as SSH_FORGE_LABEL, o as audiences, r as checkSshForge, s as clientIdFor, t as SSH_FORGE_HOST, u as oidcProviders } from "./sshForges-BkTgy5rx.js";
5
5
  import { ed25519 } from "@noble/curves/ed25519.js";
6
6
  import { sha256 } from "@noble/hashes/sha2.js";
7
7
  import { schnorr } from "@noble/curves/secp256k1.js";
@@ -3565,4 +3565,4 @@ function identityProvider(id, providers = identityProviders()) {
3565
3565
  //#endregion
3566
3566
  export { identityProvider as n, identityProviders as r, IDENTITY_PROVIDERS as t };
3567
3567
 
3568
- //# sourceMappingURL=registry-DwlTNQjr.js.map
3568
+ //# sourceMappingURL=registry-chCD0KWS.js.map