@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
@@ -8,7 +8,7 @@ var goesOn = (mode) => mode === "one-shot" ? "goes with this profile's next comm
8
8
  */
9
9
  function waitsFor(method, params) {
10
10
  if (method === "chat.wait") return 60;
11
- if (method === "file.wait" || method === "file.save" && params.wait === true) return 300;
11
+ if (method === "file.wait" || method === "file.save" && params.wait === true || method === "file.send" && params.wait === "sent") return 300;
12
12
  if (typeof params.wait === "string" && params.wait !== "none") return 30;
13
13
  }
14
14
  var word = (value) => typeof value === "string" && value.trim() ? value : void 0;
@@ -42,4 +42,4 @@ function waitNotice(method, params, mode) {
42
42
  //#endregion
43
43
  export { waitNotice as n, waitsFor as r, goesOn as t };
44
44
 
45
- //# sourceMappingURL=waitNotice-Ck3el3_Z.js.map
45
+ //# sourceMappingURL=waitNotice-B8D8WhbE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitNotice-B8D8WhbE.js","names":[],"sources":["../../src/waitNotice.ts"],"sourcesContent":["/*\n * What a command that waits says while it waits and when Ctrl-C ends it (agents#2354). Kept apart from waits.ts, which\n * runs in the daemon or the one-shot's engine: this is read by the command's own process, which loads no engine module\n * for a command a daemon answers.\n */\n\n/** What happens next to what a wait was waiting on: a daemon goes on, a one-shot's profile closes now. */\nexport const goesOn = (mode: \"daemon\" | \"one-shot\"): string => mode === \"one-shot\"\n ? \"goes with this profile's next command, or keep it online with `ghostly daemon --detach`\"\n : \"still goes by itself while this profile is online\";\n\n/**\n * The seconds a call without `--timeout` waits for the contact: the daemon's defaults (`num(params, \"timeout\", …)` in\n * api.ts, files.ts, buttons.ts and statusCards.ts), so that a bot's `chat wait` or `send --wait sent` on a daemon that\n * stopped answering ends when the wait would have (main.ts `answerWithin`). A call that does not wait is none.\n */\nexport function waitsFor(method: string, params: Record<string, unknown>): number | undefined {\n if (method === \"chat.wait\") return 60;\n if (method === \"file.wait\" || (method === \"file.save\" && params.wait === true) || (method === \"file.send\" && params.wait === \"sent\")) return 300;\n // send, edit, forward, a button, a task or routine card: `--wait sent|confirmed|delivered`, 30 s each.\n if (typeof params.wait === \"string\" && params.wait !== \"none\") return 30;\n return undefined;\n}\n\nexport interface WaitNotice {\n /** Said on stderr (a terminal's only) when the wait has gone on for a moment: what it waits for. */\n waiting: string;\n /** Said after \"stopped waiting (Ctrl-C): \" when Ctrl-C ends the wait: what becomes of what it waited on. */\n stopped: string;\n}\n\nconst word = (value: unknown): string | undefined => typeof value === \"string\" && value.trim() ? value : undefined;\n\n/** What a call waits for, in a person's words, or null for a call that does not wait. */\nexport function waitNotice(method: string, params: Record<string, unknown>, mode: \"daemon\" | \"one-shot\"): WaitNotice | null {\n const waits = waitsFor(method, params);\n if (waits === undefined) return null;\n const seconds = typeof params.timeout === \"number\" ? params.timeout : waits;\n const upTo = `up to ${seconds} s; Ctrl-C stops waiting`;\n if (method === \"chat.wait\") {\n const chat = word(params.chat) ?? \"the chat\", until = word(params.until) ?? \"live\";\n return { waiting: `waiting for chat ${chat} to be ${until} (${upTo})`, stopped: `chat ${chat} was not ${until} yet` };\n }\n if (method === \"file.wait\" || method === \"file.save\") {\n const file = word(params.file) ?? \"the file\";\n const on = mode === \"one-shot\" ? \"goes on while this profile is online (`ghostly daemon --detach`)\" : \"goes on while this profile is online\";\n return { waiting: `waiting for file ${file}'s transfer to end (${upTo}; the transfer ${on})`, stopped: `file ${file}'s transfer ${on}` };\n }\n const group = word(params.group) ?? (method.startsWith(\"group.\") ? word(params.chat) : undefined);\n const to = Array.isArray(params.to) ? params.to.filter((t): t is string => typeof t === \"string\").join(\", \") : undefined;\n // A forward's `chat` is where the messages come from; they go to `to`.\n const chat = (to || undefined) ?? word(params.chat) ?? \"the contact\";\n const what = group !== undefined ? `a member's edge in group ${group} to take it`\n : params.wait === \"sent\" ? `it to go out to ${chat}`\n : `${chat}'s app to confirm it`;\n return { waiting: `waiting for ${what} (${upTo}, it still goes)`, stopped: `it is kept here and ${goesOn(mode)}` };\n}\n"],"mappings":";;AAOA,IAAa,UAAU,SAAwC,SAAS,aACpE,4FACA;;;;;;AAOJ,SAAgB,SAAS,QAAgB,QAAqD;CAC5F,IAAI,WAAW,aAAa,OAAO;CACnC,IAAI,WAAW,eAAgB,WAAW,eAAe,OAAO,SAAS,QAAU,WAAW,eAAe,OAAO,SAAS,QAAS,OAAO;CAE7I,IAAI,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS,QAAQ,OAAO;AAExE;AASA,IAAM,QAAQ,UAAuC,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,QAAQ,KAAA;;AAGzG,SAAgB,WAAW,QAAgB,QAAiC,MAAgD;CAC1H,MAAM,QAAQ,SAAS,QAAQ,MAAM;CACrC,IAAI,UAAU,KAAA,GAAW,OAAO;CAEhC,MAAM,OAAO,SADG,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU,MACxC;CAC9B,IAAI,WAAW,aAAa;EAC1B,MAAM,OAAO,KAAK,OAAO,IAAI,KAAK,YAAY,QAAQ,KAAK,OAAO,KAAK,KAAK;EAC5E,OAAO;GAAE,SAAS,oBAAoB,KAAK,SAAS,MAAM,IAAI,KAAK;GAAI,SAAS,QAAQ,KAAK,WAAW,MAAM;EAAM;CACtH;CACA,IAAI,WAAW,eAAe,WAAW,aAAa;EACpD,MAAM,OAAO,KAAK,OAAO,IAAI,KAAK;EAClC,MAAM,KAAK,SAAS,aAAa,qEAAqE;EACtG,OAAO;GAAE,SAAS,oBAAoB,KAAK,sBAAsB,KAAK,iBAAiB,GAAG;GAAI,SAAS,QAAQ,KAAK,cAAc;EAAK;CACzI;CACA,MAAM,QAAQ,KAAK,OAAO,KAAK,MAAM,OAAO,WAAW,QAAQ,IAAI,KAAK,OAAO,IAAI,IAAI,KAAA;CAGvF,MAAM,SAFK,MAAM,QAAQ,OAAO,EAAE,IAAI,OAAO,GAAG,QAAQ,MAAmB,OAAO,MAAM,QAAQ,CAAC,CAAC,KAAK,IAAI,IAAI,KAAA,MAE3F,KAAA,MAAc,KAAK,OAAO,IAAI,KAAK;CAIvD,OAAO;EAAE,SAAS,eAHL,UAAU,KAAA,IAAY,4BAA4B,MAAM,eACjE,OAAO,SAAS,SAAS,mBAAmB,SAC5C,GAAG,KAAK,sBAC0B,IAAI,KAAK;EAAmB,SAAS,uBAAuB,OAAO,IAAI;CAAI;AACnH"}
@@ -1,4 +1,4 @@
1
- import { c as findGroup, h as node, i as chatOrGroup, y as state } from "./apiKit-CSMeHKgo.js";
1
+ import { c as findGroup, h as node, i as chatOrGroup, y as state } from "./apiKit-Du1u2l4x.js";
2
2
  import { createHash } from "node:crypto";
3
3
  //#region src/engineMethods.ts
4
4
  /**
@@ -175,6 +175,8 @@ var ENGINE_PARAMS = {
175
175
  inviteToGroup: "{ groupId, linkId }",
176
176
  acceptGroupInvitation: "{ groupId }",
177
177
  declineGroupInvitation: "{ groupId }",
178
+ keepGroup: "{ groupId }",
179
+ switchGroup: "{ groupId, to }",
178
180
  enableGroupLink: "{ groupId, reset? }",
179
181
  disableGroupLink: "{ groupId }",
180
182
  joinGroupByLink: "{ link }",
@@ -223,6 +225,7 @@ var ENGINE_PARAMS = {
223
225
  deviceForkDiscard: "{ database }",
224
226
  deviceRestoreStartOwn: "",
225
227
  deviceRemove: "{ key }",
228
+ deviceRename: "{ key, name }",
226
229
  deviceNewSecret: "",
227
230
  deviceSecretOfferDismiss: "",
228
231
  deviceTurnCheck: "",
@@ -417,4 +420,4 @@ var TRANSPORT_NAMES = {
417
420
  //#endregion
418
421
  export { WALLET_TYPES as a, DESTRUCTIVE_CALLS as c, ENGINE_READS as d, READ_PARAMS as f, TRANSPORT_NAMES as i, ENGINE_METHODS as l, engineParamsProblem as m, CHAT_METHODS as n, turnRef as o, SECRET_RESULTS as p, PAY_METHODS as r, withStoredIds as s, ADDRESS_TYPES as t, ENGINE_PARAMS as u };
419
422
 
420
- //# sourceMappingURL=words-CqN2KG1r.js.map
423
+ //# sourceMappingURL=words-jYy7lTcb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"words-jYy7lTcb.js","names":[],"sources":["../../src/engineMethods.ts","../../src/turnRefs.ts","../../src/words.ts"],"sourcesContent":["/**\n * What each call of the app's `EngineApi` (packages/browser/src/shared/rpc.ts) takes, as `engine --list --verbose`\n * shows it: `{ linkId, label }` an object with these keys (`?` an optional one), a type's name for an object of that\n * type, \"\" nothing; a trailing `?` when the object may be left out. `engineMethods.test.ts` reads it out of rpc.ts and\n * keeps the two equal. The device calls (WISP 06): a CLI profile is always on one device, so they answer `single` or refuse.\n */\nexport const ENGINE_PARAMS: Readonly<Record<string, string>> = {\n usdtCreate: \"UsdtCreate\",\n usdtUnlock: \"{ password, network? }\",\n usdtReveal: \"{ password?, network? }\",\n usdtLock: \"{ network? }?\",\n usdtRefresh: \"{ network? }?\",\n usdtExportBackup: \"{ password, network? }\",\n usdtRestoreBackup: \"{ text, password, network? }\",\n arkCreate: \"ArkCreate\",\n arkUnlock: \"{ password, network? }\",\n arkLock: \"{ network? }?\",\n arkBackup: \"{ password?, network? }\",\n arkExportBackup: \"{ password, network? }\",\n arkRestoreBackup: \"{ text, password, network? }\",\n arkRefresh: \"{ network? }?\",\n arkRecover: \"{ network? }?\",\n barkCreate: \"BarkCreate\",\n barkBackup: \"{ network? }?\",\n barkExportBackup: \"{ password, network? }\",\n barkRestoreBackup: \"{ text, password, network? }\",\n barkRefresh: \"{ network? }?\",\n barkBoard: \"{ network? }?\",\n fedimintPreview: \"{ invite, network? }\",\n fedimintJoin: \"{ invite, recover?, network? }\",\n fedimintLeave: \"{ federation }\",\n fedimintRefresh: \"{ network? }?\",\n fedimintSpendNotes: \"{ federation, amount, confirmedReal? }\",\n fedimintReceiveNotes: \"{ notes, network? }\",\n fedimintInvoice: \"{ federation, amount, memo? }\",\n fedimintTakeBack: \"{ federation, operation }\",\n fedimintBackup: \"{ network? }?\",\n fedimintExportBackup: \"{ password, network? }\",\n fedimintRestoreBackup: \"{ text, password, network? }\",\n fedimintRestorePhrase: \"{ mnemonic, invites, network? }\",\n sparkCreate: \"SparkCreate\",\n sparkBackup: \"{ network? }?\",\n sparkExportBackup: \"{ password, network? }\",\n sparkRestoreBackup: \"{ text, password, apiKey?, network? }\",\n sparkRefresh: \"{ network? }?\",\n sparkUseForLightning: \"{ network? }?\",\n preparePayment: \"{ target, amount, feeCap, payee, linkId?, requestId?, memo?, network? }\",\n approvePayment: \"{ id, confirmedReal? }\",\n reconcilePayment: \"{ id }\",\n cancelPayment: \"{ id }\",\n refreshPublicProfiles: \"{ linkId, force? }\",\n choosePublicProfile: \"{ linkId, choice }\",\n preparePeerProof: \"{ linkId, externalKey, adapter? }\",\n submitPeerProof: \"{ linkId, challenge, event }\",\n withdrawPeerProof: \"{ linkId, adapter? }\",\n beginIdentityProof: \"{ provider, subject, validityDays? }\",\n completeIdentityProof: \"{ draftId, evidence }\",\n cancelIdentityProof: \"{ draftId }\",\n removeIdentityProof: \"{ id }\",\n shareIdentityProof: \"{ linkId, id }\",\n withdrawIdentityProof: \"{ linkId, id }\",\n recheckIdentityProof: \"{ linkId, id }\",\n lookupIdentityDisplay: \"{ linkId, id }\",\n loadPublicProfile: \"{ provider, subject, force? }\",\n loadPublicPosts: \"{ provider, subject, more?, force? }\",\n loadPublicGraph: \"{ provider, subject, force? }\",\n loadPublicPostImage: \"{ provider, subject, postId, index }\",\n clearProfileData: \"\",\n setDidListed: \"{ id, listed }\",\n nostrLoadContact: \"{ linkId, subject, what, more? }\",\n nostrForgetContact: \"{ linkId, subject }\",\n nostrLoadOwn: \"{ subject }\",\n nostrOwnFollows: \"{ subject }\",\n nostrContactNotes: \"{ linkId, subject }\",\n nostrLookup: \"NostrLookupRequest\",\n nostrDraft: \"NostrDraftRequest\",\n nostrPublish: \"{ draftId, event }\",\n createLink: \"\",\n takeInvite: \"\",\n joinLink: \"{ inviteCode }\",\n ensureLink: \"LinkParams & { inviteCode?: string }\",\n confirmPair: \"{ linkId, code }\",\n pollNow: \"{ linkId }\",\n removeLink: \"{ linkId }\",\n renameLink: \"{ linkId, label }\",\n setActiveLink: \"{ linkId }\",\n sendMessage: \"{ linkId, text, timestamp?, preview?, replyTo?, card? }\",\n editMessage: \"{ linkId, messageId, text, preview?, mentions?, card? }\",\n retryMessage: \"{ linkId, messageId }\",\n react: \"{ linkId, messageId, emoji }\",\n pinMessage: \"{ linkId, messageId?, remove? }\",\n appId: \"{ linkId, ref }\",\n appOpen: \"{ linkId, ref, version, digest? }\",\n appClose: \"{ linkId, ref }\",\n appSend: \"{ linkId, ref, data, digest? }\",\n appServe: \"{ linkId, ref, file, digest? }\",\n appUnserve: \"{ linkId, serve }\",\n appRangeAnswer: \"{ linkId, app, request, bytes?, size?, error? }\",\n appRemoteRead: \"{ linkId, ref, serve, offset, length, digest? }\",\n messageDetails: \"{ linkId, messageId }\",\n deleteMessage: \"{ linkId, messageId }\",\n removeMessage: \"{ linkId, messageId }\",\n exportLinks: \"\",\n sendFile: \"{ linkId, file, timestamp, replyTo?, forwarded? }\",\n sendGroupFile: \"{ groupId, file, caption?, replyTo?, forwarded? }\",\n groupFileCheck: \"{ groupId }\",\n forwardMessages: \"{ linkId, messageIds, to }\",\n fileAction: \"{ linkId, fileId, action }\",\n setDeliveryMode: \"{ linkId, mode }\",\n setTransportPreference: \"{ linkId, preferred, fallback }\",\n setChatTransport: \"{ linkId, transport }\",\n setChatPaymentMethods: \"{ linkId, methods, networks? }\",\n setChatHold: \"{ linkId, enabled }\",\n connect: \"{ linkId }\",\n walletAddMint: \"{ url, primary?, network? }\",\n walletCreate: \"WalletCreate\",\n walletRemove: \"WalletRemove\",\n walletTestCoins: \"WalletTestCoins\",\n walletSetupRetry: \"{ type }\",\n walletSetupDismiss: \"{ type }\",\n wake: \"{ network? }?\",\n peekProfile: \"{ profile, dbName }\",\n walletSetPrimaryMint: \"{ url }\",\n walletRemoveMint: \"{ url, acceptLoss? }\",\n walletReceiveLightning: \"{ amount, via?, network?, card? }\",\n walletWatchInvoice: \"{ invoice, network? }\",\n walletQuoteInvoice: \"{ invoice, via?, network?, card?, amount? }\",\n walletPayQuote: \"{ quote, mint, note?, confirmedReal?, linkId?, invoice? }\",\n lnurlResolve: \"{ text, network? }\",\n lnurlInvoice: \"{ id, amount, comment?, network? }\",\n checkPayment: \"{ linkId, paymentId }\",\n lightningSetSource: \"{ providerId, values, network?, card? }\",\n lightningClearSource: \"{ network?, card? }?\",\n lightningRetrySource: \"{ network?, card? }?\",\n lightningReconfigureSource: \"{ values, network?, card? }\",\n lightningRefresh: \"{ network?, card? }?\",\n lightningSetReceive: \"{ network, card }\",\n lightningRename: \"{ network, card, name }\",\n bitcoinSetSource: \"{ providerId, values, network? }\",\n bitcoinClearSource: \"{ network? }?\",\n bitcoinRetrySource: \"{ network? }?\",\n bitcoinReconfigureSource: \"{ values, network? }\",\n bitcoinReceiveAddress: \"{ network? }?\",\n bitcoinRefresh: \"{ network? }?\",\n walletReceiveToken: \"{ token }\",\n walletInspectCashu: \"{ text }\",\n walletExport: \"{ network? }?\",\n walletBackupReminder: \"{ event: \\\"later\\\"; wallet: string } | { event: \\\"profile\\\" }\",\n sendPayment: \"{ linkId, amount, memo?, timestamp, network?, confirmedReal? }\",\n requestPayment: \"{ linkId, amount, memo?, timestamp, method?, rail?, network?, card? }\",\n requestGroupPayment: \"{ groupId, amount, memo?, timestamp, rail, network?, card? }\",\n groupPaymentHello: \"{ groupId, member }\",\n askToPay: \"{ linkId, amount, method, memo?, timestamp, network? }\",\n payRequest: \"{ linkId, paymentId, via?, maxFee?, network?, confirmedReal?, card? }\",\n reclaimPayment: \"{ paymentId }\",\n disconnect: \"{ linkId }\",\n addService: \"{ name, target }\",\n removeService: \"{ serviceId }\",\n setServiceEnabled: \"{ serviceId, enabled }\",\n setServiceShared: \"{ serviceId, peerPubKeyZ32, shared }\",\n updateSettings: \"{ settings }\",\n setCallSignal: \"{ linkId, signal }\",\n setTyping: \"{ linkId, typing, kind?, status? }\",\n setGroupTyping: \"{ groupId, typing, kind?, status? }\",\n setWakeSubscription: \"{ subscription }\",\n wakeConfirm: \"{ endpoint }\",\n setWakeMuted: \"{ linkId, muted }\",\n wakeForCall: \"{ linkId }\",\n setCallOn: \"{ on }\",\n setFastPoll: \"{ linkId, fast }\",\n createGroup: \"{ name, profile? }\",\n inviteToGroup: \"{ groupId, linkId }\",\n acceptGroupInvitation: \"{ groupId }\",\n declineGroupInvitation: \"{ groupId }\",\n keepGroup: \"{ groupId }\",\n switchGroup: \"{ groupId, to }\",\n enableGroupLink: \"{ groupId, reset? }\",\n disableGroupLink: \"{ groupId }\",\n joinGroupByLink: \"{ link }\",\n sendGroupMessage: \"{ groupId, text, mentions?, replyTo?, card? }\",\n pressButton: \"{ linkId, messageId, buttonId }\",\n groupTaken: \"{ groupId, messageId, edit? }\",\n chatUnconfirmed: \"{ linkId }\",\n groupMessages: \"{ groupId }\",\n messagePage: \"{ linkId, limit?, before?, after? }\",\n chatsFound: \"{ query, linkIds }\",\n statusCardIndex: \"\",\n saveMessage: \"{ linkId, messageId, remove? }\",\n savedMessages: \"\",\n leaveGroup: \"{ groupId }\",\n removeGroupMember: \"{ groupId, key }\",\n makeGroupAdmin: \"{ groupId, key }\",\n setGroupHub: \"{ groupId, key, role }\",\n rotateGroup: \"{ groupId }\",\n setGroupPicture: \"{ groupId, picture }\",\n renameGroup: \"{ groupId, name }\",\n forgetGroup: \"{ groupId }\",\n setGroupManage: \"{ groupId, on }\",\n deviceEnrollInvite: \"{ name }\",\n deviceEnrollConfirm: \"{ match }\",\n deviceEnrollCancel: \"\",\n deviceEnrollView: \"\",\n deviceEnrollJoin: \"{ code, name, kind?, app? }\",\n deviceEnrollReady: \"\",\n deviceEnrollFinish: \"\",\n deviceEnrollRemove: \"\",\n deviceSet: \"\",\n devicePing: \"{ key }\",\n devicePushState: \"\",\n devicePushSet: \"{ subscription }\",\n deviceHandoffVerifier: \"{ password, current? }\",\n deviceHandoffPush: \"{ key }\",\n deviceHandoffPull: \"{ password, later? }\",\n deviceHandoffAccept: \"{ later? }\",\n deviceHandoffSettle: \"\",\n deviceHandoffCancel: \"\",\n deviceHandoffView: \"\",\n deviceHandoffAllow: \"{ key }\",\n deviceTakeoverInfo: \"\",\n deviceTakeover: \"{ password, name, lost? }\",\n deviceTurnPeek: \"{ d }\",\n deviceForkDiscard: \"{ database }\",\n deviceRestoreStartOwn: \"\",\n deviceRemove: \"{ key }\",\n deviceRename: \"{ key, name }\",\n deviceNewSecret: \"\",\n deviceSecretOfferDismiss: \"\",\n deviceTurnCheck: \"\",\n deviceSetNoticeSeen: \"{ wrong? }\",\n appList: \"\",\n appBuiltIns: \"\",\n appStoreList: \"\",\n appStorePreview: \"{ url }\",\n appStoreAdd: \"{ url, key? }\",\n appStoreRemove: \"{ key }\",\n appStoreRefresh: \"{ key? }?\",\n appPreview: \"AppSource\",\n appInstall: \"{ digest, grant }\",\n appUpdateAccept: \"{ ref }\",\n appCheckUpdates: \"\",\n appUninstall: \"{ ref }\",\n appRunCheck: \"{ ref }\",\n appFetchFiles: \"{ ref }\",\n appEntry: \"{ ref, runAnyway? }\",\n appFile: \"{ ref, path, digest? }\",\n appFileAt: \"{ ref, path, digest? }\",\n appStorageGet: \"{ ref, scope, key, digest? }\",\n appStorageSet: \"{ ref, scope, key, value, digest? }\",\n appStorageDelete: \"{ ref, scope, key, digest? }\",\n appStorageKeys: \"{ ref, scope, digest? }\",\n appDataExport: \"{ ref }\",\n appDataExportText: \"{ ref }\",\n};\n\n/**\n * The engine's calls the daemon passes through as `engine.<method>` (WISP 1100 § Local control API): exactly the\n * app's `EngineApi`, plus two reads every host has. Nothing else on the engine object is reachable.\n */\nexport const ENGINE_METHODS: readonly string[] = Object.keys(ENGINE_PARAMS);\n\n/** Reads the hosts use outside `EngineApi`: the whole state, and one chat's stored messages. */\nexport const ENGINE_READS: readonly string[] = [\"getState\", \"getMessages\"];\n\n/** What the two reads take, in `ENGINE_PARAMS`' words. */\nexport const READ_PARAMS: Readonly<Record<string, string>> = { getState: \"\", getMessages: \"{ linkId }\" };\n\n/**\n * Why `params` is not what `method` takes: missing when it takes some, or a key it needs not there (a key holding\n * null is there: `setActiveLink { linkId: null }`). Undefined when it is, or when the shape names a type, which is not\n * looked into here.\n */\nexport function engineParamsProblem(method: string, params: Record<string, unknown> | undefined): string | undefined {\n const takes = ENGINE_PARAMS[method] ?? READ_PARAMS[method];\n if (!takes) return undefined;\n if (params === undefined) return takes.endsWith(\"?\") ? undefined : \"no parameters given\";\n const keys = /^\\{ ([\\w?, ]*) \\}\\??$/.exec(takes)?.[1].split(\", \") ?? [];\n const missing = keys.filter((key) => !key.endsWith(\"?\") && params[key] === undefined);\n return missing.length ? `${missing.join(\", \")} missing` : undefined;\n}\n\n/**\n * Calls that delete what this device holds, by what they delete: they go only with `--yes` (`yes: true` over the\n * socket), as `chat remove`, `group leave` and `group forget` ask for it.\n */\nexport const DESTRUCTIVE_CALLS: ReadonlyMap<string, string> = new Map([\n [\"clearProfileData\", \"deletes every chat and group on this device (the wallets stay)\"],\n [\"removeLink\", \"deletes a chat's keys and history on this device\"],\n [\"leaveGroup\", \"deletes a group's history and files on this device\"],\n [\"forgetGroup\", \"deletes a group's history on this device\"],\n [\"deviceRemove\", \"takes a device off this profile\"],\n]);\n\n/**\n * Calls whose answer holds a secret (chat seeds, wallet phrases and keys, ecash, backups): the CLI prints their\n * result only with `--show-secret`.\n */\nexport const SECRET_RESULTS: ReadonlySet<string> = new Set([\n \"exportLinks\", \"takeInvite\", \"walletExport\", \"usdtReveal\",\n \"arkBackup\", \"barkBackup\", \"sparkBackup\", \"fedimintBackup\",\n \"usdtExportBackup\", \"arkExportBackup\", \"barkExportBackup\", \"sparkExportBackup\", \"fedimintExportBackup\",\n \"fedimintSpendNotes\",\n]);\n","import { createHash } from \"node:crypto\";\nimport { chatOrGroup, findGroup, node, state, type ApiContext, type Params } from \"./apiKit\";\n\n/**\n * The id an agent turn names its message by (docs/CLI.md § Agent turns). A message is stored under an id its sender\n * chose most of (`peer_<the id they sent>`), so a turn carries this one instead, made here from the chat (or group) and\n * that id: `t_` and 32 hex digits, in which nobody can write a word. Every command that takes a message's id takes it.\n */\nexport function turnRef(where: string, messageId: string): string {\n return \"t_\" + createHash(\"sha256\").update(`${where}\\n${messageId}`).digest(\"hex\").slice(0, 32);\n}\n\nconst TURN_REF = /^t_[0-9a-f]{32}$/;\nconst isRef = (value: unknown): value is string => typeof value === \"string\" && TURN_REF.test(value);\n\n/**\n * `params` with each turn's id in `message`, `reply` and `messages` as the id its message is stored under: looked for\n * among the chat's (or group's) newest messages first, where a turn's almost always is, then in all of them. One that\n * names no message stays as given, and its command says so as for any unknown id.\n */\nexport async function withStoredIds(ctx: ApiContext, params: Params): Promise<Params> {\n const wanted = new Set([params.message, params.reply, ...(Array.isArray(params.messages) ? params.messages : [])].filter(isRef));\n if (!wanted.size) return params;\n let target: { id: string; linkId: string; group: boolean } | null = null;\n try {\n if (typeof params.group === \"string\") { const group = findGroup(state(ctx).groups, params.group); target = { id: group.id, linkId: `group:${group.id}`, group: true }; }\n else if (typeof params.chat === \"string\") target = chatOrGroup(ctx, params.chat);\n } catch { /* the command says what is wrong with its chat or group */ }\n if (!target) return params;\n const { id, linkId, group } = target;\n const found = new Map<string, string>();\n const look = (messages: readonly { id: string }[]) => {\n for (const message of messages) { const ref = turnRef(id, message.id); if (wanted.has(ref)) found.set(ref, message.id); }\n return found.size === wanted.size;\n };\n if (!look((await node(ctx).messagePage({ linkId, limit: 200 })).messages)) look(group ? await node(ctx).groupMessages({ groupId: id }) : await node(ctx).getMessages(linkId));\n const stored = (value: unknown) => (isRef(value) ? found.get(value) ?? value : value);\n return {\n ...params,\n ...(params.message !== undefined && { message: stored(params.message) }),\n ...(params.reply !== undefined && { reply: stored(params.reply) }),\n ...(Array.isArray(params.messages) && { messages: params.messages.map(stored) }),\n };\n}\n","import type { PairedTransport } from \"@ghostly/core\";\n\n/**\n * The words an argument takes, for the API's methods and the command table both: the command line refuses any other\n * before the profile opens (`commands/index.ts` positionals), and the socket keeps its own refusal for its callers.\n * Its own module, with no code from the package: the command table is read by every command.\n */\n\nexport const WALLET_TYPES = [\"cashu\", \"lightning\", \"arkade\", \"bark\", \"spark\", \"bitcoin\", \"fedimint\", \"usdt\"] as const;\n/** The wallets that have an address to be paid on (`wallet address`). */\nexport const ADDRESS_TYPES = [\"bitcoin\", \"arkade\", \"spark\", \"usdt\"] as const;\n/** What a payment request may name as its way of paying (`chat request --method`). */\nexport const PAY_METHODS = [\"cashu\", \"arkade\", \"usdt\", \"bark\", \"bitcoin\", \"fedimint\", \"spark\"] as const;\n/** The ways of paying a chat takes (`chat accept`). */\nexport const CHAT_METHODS = [\"cashu\", \"lightning\", ...PAY_METHODS.filter((m) => m !== \"cashu\")] as const;\n\n/** A chat's transport by the name the command line gives it (`chat transport`). */\nexport const TRANSPORT_NAMES: Record<string, PairedTransport | \"auto\" | \"dht\"> = {\n auto: \"auto\", dht: \"dht\", webrtc: \"webrtc/1\", iroh: \"iroh/1\", hyperdht: \"hyperdht/1\",\n \"webrtc/1\": \"webrtc/1\", \"iroh/1\": \"iroh/1\", \"hyperdht/1\": \"hyperdht/1\",\n};\n"],"mappings":";;;;;;;;;AAMA,IAAa,gBAAkD;CAC7D,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,WAAW;CACX,SAAS;CACT,WAAW;CACX,iBAAiB;CACjB,kBAAkB;CAClB,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,kBAAkB;CAClB,mBAAmB;CACnB,aAAa;CACb,WAAW;CACX,iBAAiB;CACjB,cAAc;CACd,eAAe;CACf,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,sBAAsB;CACtB,uBAAuB;CACvB,uBAAuB;CACvB,aAAa;CACb,aAAa;CACb,mBAAmB;CACnB,oBAAoB;CACpB,cAAc;CACd,sBAAsB;CACtB,gBAAgB;CAChB,gBAAgB;CAChB,kBAAkB;CAClB,eAAe;CACf,uBAAuB;CACvB,qBAAqB;CACrB,kBAAkB;CAClB,iBAAiB;CACjB,mBAAmB;CACnB,oBAAoB;CACpB,uBAAuB;CACvB,qBAAqB;CACrB,qBAAqB;CACrB,oBAAoB;CACpB,uBAAuB;CACvB,sBAAsB;CACtB,uBAAuB;CACvB,mBAAmB;CACnB,iBAAiB;CACjB,iBAAiB;CACjB,qBAAqB;CACrB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,cAAc;CACd,iBAAiB;CACjB,mBAAmB;CACnB,aAAa;CACb,YAAY;CACZ,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,aAAa;CACb,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,eAAe;CACf,aAAa;CACb,aAAa;CACb,cA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S;CAAa,GAAG,YAAY,QAAQ,MAAM,MAAM,OAAO;AAAC;;AAG9F,IAAa,kBAAoE;CAC/E,MAAM;CAAQ,KAAK;CAAO,QAAQ;CAAY,MAAM;CAAU,UAAU;CACxE,YAAY;CAAY,UAAU;CAAU,cAAc;AAC5D"}
package/dist/ghostly.mjs CHANGED
@@ -24,7 +24,7 @@ function quietWebStorage(scope = globalThis, execArgv = process.execArgv, nodeOp
24
24
  //#region src/bin.ts
25
25
  quietWebStorage();
26
26
  enableCompileCache();
27
- var { run } = await import("./assets/main-BDY-pfpz.js");
27
+ var { run } = await import("./assets/main-4qE381KM.js");
28
28
  run(process.argv.slice(2));
29
29
  //#endregion
30
30
  export {};
@@ -7,8 +7,8 @@
7
7
  // node call-echo.mjs [greeting.wav]
8
8
  //
9
9
  // GHOSTLY_SOCKET names the daemon's socket (`ghostly daemon status` prints it; left out, the bot asks). The call's
10
- // audio is raw PCM on a socket of its own: s16le, mono, at the call's rate, 20 ms frames from the call, any amount to
11
- // it (WISP 1100 § Calls).
10
+ // audio is raw PCM on a socket of its own, after the call's token and a line feed: s16le, mono, at the call's rate,
11
+ // 20 ms frames from the call, any amount to it (WISP 1100 § Calls).
12
12
  import { execFileSync } from "node:child_process";
13
13
  import { readFileSync } from "node:fs";
14
14
  import { connect } from "node:net";
@@ -39,11 +39,11 @@ createInterface({ input: socket }).on("line", async (line) => {
39
39
  }
40
40
  const event = message.event;
41
41
  // With `ghostly call auto on`, the daemon answers by itself (`auto: true`): the audio socket comes with call.connected.
42
- if (event?.type === "call.connected" && !talking.has(event.call)) talk(event.call, event.audio.socket);
42
+ if (event?.type === "call.connected" && !talking.has(event.call)) talk(event.call, event.audio);
43
43
  if (event?.type === "call.incoming" && !event.auto) {
44
44
  try {
45
45
  const answered = await call("call.answer", { call: event.call, rate: RATE });
46
- talk(answered.call, answered.audio.socket);
46
+ talk(answered.call, answered.audio);
47
47
  } catch (error) {
48
48
  console.error("answer:", error.message);
49
49
  }
@@ -53,12 +53,14 @@ createInterface({ input: socket }).on("line", async (line) => {
53
53
 
54
54
  /** One call: the greeting, then the echo. */
55
55
  const talking = new Set();
56
- function talk(id, path) {
56
+ function talk(id, { socket: path, token }) {
57
57
  if (talking.has(id)) return;
58
58
  talking.add(id);
59
59
  const audio = connect(path);
60
60
  let greetingUntil = 0;
61
61
  audio.on("connect", () => {
62
+ // The call's token first: until it comes, the socket gives this bot nothing (required on Windows).
63
+ audio.write(`${token}\n`);
62
64
  console.log(`call ${id}: connected`);
63
65
  if (greeting) {
64
66
  // Written at once: the call plays it at real time and sends silence after it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostlytools/cli",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "description": "Ghostly for bots and terminals: the app's own engine, headless on Node, behind a daemon and a `ghostly` command with JSON output.",
6
6
  "license": "MIT",