@ghostlytools/cli 1.12.0 → 1.12.1

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 (63) hide show
  1. package/README.md +5 -5
  2. package/dist/assets/{api-DLzCtePC.js → api-BwEgbvvK.js} +49 -23
  3. package/dist/assets/api-BwEgbvvK.js.map +1 -0
  4. package/dist/assets/{api-DYMKyb1k.js → api-jRUXnBdX.js} +2 -2
  5. package/dist/assets/{apiKit-CVaEzKWQ.js → apiKit-BlsNk-Cx.js} +2 -2
  6. package/dist/assets/{apiKit-CVaEzKWQ.js.map → apiKit-BlsNk-Cx.js.map} +1 -1
  7. package/dist/assets/{appFetch-D56GsYuq.js → appFetch-CW9fJPHh.js} +2 -2
  8. package/dist/assets/{appFetch-D56GsYuq.js.map → appFetch-CW9fJPHh.js.map} +1 -1
  9. package/dist/assets/{apps-BPFW19Wc.js → apps-BcG4u6SM.js} +1 -1
  10. package/dist/assets/{apps-XnZ8VEuj.js → apps-CL8TXHhu.js} +6 -6
  11. package/dist/assets/{apps-XnZ8VEuj.js.map → apps-CL8TXHhu.js.map} +1 -1
  12. package/dist/assets/{backup-DpyvT9Z6.js → backup-BA41EDvh.js} +47 -8
  13. package/dist/assets/backup-BA41EDvh.js.map +1 -0
  14. package/dist/assets/{backup-COX6j1_W.js → backup-xZfV-ytw.js} +1 -1
  15. package/dist/assets/{bitcoind-DTsrd7TF.js → bitcoind-Dh7n9amb.js} +2 -2
  16. package/dist/assets/{bitcoind-DTsrd7TF.js.map → bitcoind-Dh7n9amb.js.map} +1 -1
  17. package/dist/assets/buttons-CsGdQNnR.js +1 -0
  18. package/dist/assets/{buttons-BvWqHJeh.js → buttons-SH1tNRh7.js} +6 -6
  19. package/dist/assets/buttons-SH1tNRh7.js.map +1 -0
  20. package/dist/assets/{client-kGZ3ZdUW.js → client-DGS-atRu.js} +2 -2
  21. package/dist/assets/{client-kGZ3ZdUW.js.map → client-DGS-atRu.js.map} +1 -1
  22. package/dist/assets/{endpoint-B0vE5ojY.js → endpoint-Cvu-taMs.js} +42 -5
  23. package/dist/assets/{endpoint-B0vE5ojY.js.map → endpoint-Cvu-taMs.js.map} +1 -1
  24. package/dist/assets/{groupMeta-DTQAJG50.js → groupMeta-DxuJzko_.js} +49 -28
  25. package/dist/assets/groupMeta-DxuJzko_.js.map +1 -0
  26. package/dist/assets/{host-z0FAHP9Z.js → host-BxM-HMr0.js} +62 -9
  27. package/dist/assets/host-BxM-HMr0.js.map +1 -0
  28. package/dist/assets/{hyperdhtRelay-CvsAfQRQ.js → hyperdhtRelay-DLUiwfnt.js} +32 -4
  29. package/dist/assets/hyperdhtRelay-DLUiwfnt.js.map +1 -0
  30. package/dist/assets/{irohWeb-CLBx5MIv.js → irohWeb-CbnGtUo6.js} +175 -6
  31. package/dist/assets/irohWeb-CbnGtUo6.js.map +1 -0
  32. package/dist/assets/{main-CVqkvuIo.js → main-CwTaepxR.js} +48 -31
  33. package/dist/assets/main-CwTaepxR.js.map +1 -0
  34. package/dist/assets/{ownStatus-DMEhrpkd.js → ownStatus-DtzIllg2.js} +4 -3
  35. package/dist/assets/ownStatus-DtzIllg2.js.map +1 -0
  36. package/dist/assets/{profiles-BFSGqDFC.js → profiles-BOYGlmu2.js} +2 -2
  37. package/dist/assets/{profiles-BFSGqDFC.js.map → profiles-BOYGlmu2.js.map} +1 -1
  38. package/dist/assets/{registry-B15Yg_1C.js → registry-4W1LGlCF.js} +1 -1
  39. package/dist/assets/{registry-rXgaZeNn.js → registry-Bep4umOM.js} +36 -28
  40. package/dist/assets/registry-Bep4umOM.js.map +1 -0
  41. package/dist/assets/secretGuard-Bm6nci0I.js +1 -0
  42. package/dist/assets/{secretGuard-B4-LlMjv.js → secretGuard-BrATm_gl.js} +33 -9
  43. package/dist/assets/{secretGuard-B4-LlMjv.js.map → secretGuard-BrATm_gl.js.map} +1 -1
  44. package/dist/assets/{server-CQR7NLCz.js → server-D4gf-LnD.js} +257 -43
  45. package/dist/assets/server-D4gf-LnD.js.map +1 -0
  46. package/dist/assets/{waitNotice-BGM0QOS2.js → waitNotice-DQvZgz2T.js} +2 -2
  47. package/dist/assets/{waitNotice-BGM0QOS2.js.map → waitNotice-DQvZgz2T.js.map} +1 -1
  48. package/dist/ghostly.mjs +1 -1
  49. package/npm-shrinkwrap.json +2 -2
  50. package/package.json +1 -1
  51. package/dist/assets/api-DLzCtePC.js.map +0 -1
  52. package/dist/assets/backup-DpyvT9Z6.js.map +0 -1
  53. package/dist/assets/buttons-Bq7pTXqF.js +0 -1
  54. package/dist/assets/buttons-BvWqHJeh.js.map +0 -1
  55. package/dist/assets/groupMeta-DTQAJG50.js.map +0 -1
  56. package/dist/assets/host-z0FAHP9Z.js.map +0 -1
  57. package/dist/assets/hyperdhtRelay-CvsAfQRQ.js.map +0 -1
  58. package/dist/assets/irohWeb-CLBx5MIv.js.map +0 -1
  59. package/dist/assets/main-CVqkvuIo.js.map +0 -1
  60. package/dist/assets/ownStatus-DMEhrpkd.js.map +0 -1
  61. package/dist/assets/registry-rXgaZeNn.js.map +0 -1
  62. package/dist/assets/secretGuard-BmmnEbYf.js +0 -1
  63. package/dist/assets/server-CQR7NLCz.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { B as shellWord } from "./apiKit-CVaEzKWQ.js";
1
+ import { B as shellWord } from "./apiKit-BlsNk-Cx.js";
2
2
  import { basename } from "node:path";
3
3
  // src/waitNotice.ts
4
4
  /** What happens next to what a wait was waiting on: a daemon goes on, a one-shot's profile closes now. */
@@ -123,4 +123,4 @@ function waitNotice(method, given, mode) {
123
123
  }
124
124
  export { waitsFor as i, goesOn as n, waitNotice as r, chatState as t };
125
125
 
126
- //# sourceMappingURL=waitNotice-BGM0QOS2.js.map
126
+ //# sourceMappingURL=waitNotice-DQvZgz2T.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitNotice-BGM0QOS2.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\nimport { basename } from \"node:path\";\nimport { shellWord } from \"./shellWord\";\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 wait a one-shot does when no `--wait` is given (`ctx.mode === \"one-shot\"` defaults in api.ts, files.ts, buttons.ts\n * and statusCards.ts): what is not out yet leaves with the process, so it stays. A daemon answers those at once. A ref\n * written `group:<id>` is a group's, whose file, card or button press does not wait; a group named otherwise is told\n * only by the engine, and its notice comes only if the call is still going after WAIT_NOTICE_MS.\n */\nfunction oneShotWait(method: string, params: Record<string, unknown>): string | undefined {\n const group = typeof params.group === \"string\" || (typeof params.chat === \"string\" && params.chat.startsWith(\"group:\"));\n switch (method) {\n // On a chat nobody joined yet these answer at once (apiKit `oneShotWaits`); a notice comes only if a call is still\n // going after WAIT_NOTICE_MS.\n case \"chat.send\": return \"sent\";\n case \"chat.edit\": return \"confirmed\";\n case \"file.send\": case \"task.send\": case \"routine.send\": case \"button.press\": return group ? undefined : \"sent\";\n // `--all` reports to each 1:1 chat in turn, each waiting as one named would.\n case \"usage.send\": return group ? undefined : \"sent\";\n case \"task.update\": case \"routine.update\": return group ? undefined : \"confirmed\";\n case \"chat.react\": return \"confirmed\";\n case \"group.react\": return \"sent\";\n case \"chat.pin\": return group ? \"sent\" : \"confirmed\";\n case \"chat.delete\": return params.everyone !== true ? undefined : group ? \"sent\" : \"confirmed\";\n default: return undefined;\n }\n}\n\n/** The call's `wait`: the one given, or the one-shot's own default. */\nfunction waitOf(method: string, params: Record<string, unknown>, mode: \"daemon\" | \"one-shot\"): Record<string, unknown> {\n if (params.wait !== undefined || mode !== \"one-shot\") return params;\n const wait = oneShotWait(method, params);\n return wait === undefined ? params : { ...params, wait };\n}\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/**\n * A state `chat wait --until` waits for, as a sentence says it (`to`: the wait's timeout and notice, `not`: Ctrl-C).\n * The flag's word after \"to be\" read \"to be text\" and \"was not text yet\".\n */\nconst CHAT_STATES: Record<string, { to: string; not: string }> = {\n live: { to: \"to be live\", not: \"was not live yet\" },\n text: { to: \"to carry text\", not: \"could not carry text yet\" },\n paired: { to: \"to be paired\", not: \"was not paired yet\" },\n};\nexport const chatState = (until: string): { to: string; not: string } => CHAT_STATES[until] ?? { to: `to be ${until}`, not: `was not ${until} yet` };\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, given: Record<string, unknown>, mode: \"daemon\" | \"one-shot\"): WaitNotice | null {\n // A one-shot join by a group's link waits to be let in (api.ts `letIn`); through a daemon it answers at once.\n if (method === \"group.join\") return mode === \"one-shot\"\n ? { waiting: \"waiting for a member's app to let this profile in (up to 60 s; Ctrl-C stops waiting)\", stopped: \"not let in yet: the knock goes on while this profile is running (ghostly daemon --detach)\" }\n : null;\n const params = waitOf(method, given, mode);\n // A daemon's file send answers once it has copied the file into the profile (files.ts `stage`): 6-30 s for 1 GiB, said\n // nothing, and read as a hung daemon. Ctrl-C there stops the send (files.ts `stageWhileAsked`): nothing goes.\n if (method === \"file.send\" && mode === \"daemon\" && params.wait !== \"sent\") {\n const file = word(params.name) ?? (word(params.path) ? basename(params.path as string) : \"the file\");\n const chatRef = word(params.chat) ?? \"the chat\", chat = chatRef.startsWith(\"group:\") ? `group ${chatRef.slice(\"group:\".length)}` : chatRef;\n return { waiting: `copying ${file} into the profile before it goes to ${chat} (Ctrl-C stops the send)`, stopped: `${file} was not sent to ${chat}: send it again when you want it` };\n }\n const waits = waitsFor(method, params);\n if (waits === undefined) return null;\n const seconds = typeof params.timeout === \"number\" ? params.timeout : waits;\n // One that waits for the contact (`--wait sent`, a one-shot's own wait) copies the file in first as well, and Ctrl-C\n // then stops the send (a daemon's `stageWhileAsked`, a one-shot's profile closing under the copy): it said \"it is kept\n // here and still goes\" with nothing in the chat. Which of the two it was, only the chat's file list tells.\n if (method === \"file.send\") {\n const file = word(params.name) ?? (word(params.path) ? basename(params.path as string) : \"the file\");\n const chatRef = word(params.chat), chat = chatRef ?? \"the contact\";\n const list = chatRef ? ` (ghostly file list ${shellWord(chatRef, \"<chat>\")} says which)` : \"\";\n return {\n waiting: `copying ${file} into the profile, then waiting for it to go out to ${chat} (up to ${seconds} s; Ctrl-C stops the send while it is copied in, then only the waiting)`,\n stopped: `${file} was not sent to ${chat} if it was still being copied in; if it was in the chat, it is kept here and ${goesOn(mode)}${list}`,\n };\n }\n const upTo = `up to ${seconds} s; Ctrl-C stops waiting`;\n if (method === \"chat.wait\") {\n const chat = word(params.chat) ?? \"the chat\", state = chatState(word(params.until) ?? \"live\");\n return { waiting: `waiting for chat ${chat} ${state.to} (${upTo})`, stopped: `chat ${chat} ${state.not}` };\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 chatRef = word(params.chat);\n // A forward's `chat` is where the messages come from; they go to `to`.\n const group = word(params.group) ?? (method.startsWith(\"group.\") ? chatRef\n : method !== \"chat.forward\" && chatRef?.startsWith(\"group:\") ? chatRef.slice(\"group:\".length) : undefined);\n const to = Array.isArray(params.to) ? params.to.filter((t): t is string => typeof t === \"string\").join(\", \") : undefined;\n const chat = (to || undefined) ?? chatRef ?? (params.all === true ? \"each contact\" : \"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":";;;;AAUA,IAAa,UAAU,SAAwC,SAAS,aACpE,4FACA;;;;;;;AAQJ,SAAS,YAAY,QAAgB,QAAqD;CACxF,MAAM,QAAQ,OAAO,OAAO,UAAU,YAAa,OAAO,OAAO,SAAS,YAAY,OAAO,KAAK,WAAW,QAAQ;CACrH,QAAQ,QAAR;EAGE,KAAK,aAAa,OAAO;EACzB,KAAK,aAAa,OAAO;EACzB,KAAK;EAAa,KAAK;EAAa,KAAK;EAAgB,KAAK,gBAAgB,OAAO,QAAQ,KAAA,IAAY;EAEzG,KAAK,cAAc,OAAO,QAAQ,KAAA,IAAY;EAC9C,KAAK;EAAe,KAAK,kBAAkB,OAAO,QAAQ,KAAA,IAAY;EACtE,KAAK,cAAc,OAAO;EAC1B,KAAK,eAAe,OAAO;EAC3B,KAAK,YAAY,OAAO,QAAQ,SAAS;EACzC,KAAK,eAAe,OAAO,OAAO,aAAa,OAAO,KAAA,IAAY,QAAQ,SAAS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AAQ,MAAM,CAAe,IAAI,KAAA;CAElG,MAAM,SADK,MAAM,QAAQ,OAAO,EAAE,IAAI,OAAO,GAAG,QAAQ,MAAmB,OAAO,MAAM,QAAQ,CAAC,CAAC,KAAK,IAAI,IAAI,KAAA,MAC3F,KAAA,MAAc,YAAY,OAAO,QAAQ,OAAO,iBAAiB;CAIrF,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
+ {"version":3,"file":"waitNotice-DQvZgz2T.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\nimport { basename } from \"node:path\";\nimport { shellWord } from \"./shellWord\";\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 wait a one-shot does when no `--wait` is given (`ctx.mode === \"one-shot\"` defaults in api.ts, files.ts, buttons.ts\n * and statusCards.ts): what is not out yet leaves with the process, so it stays. A daemon answers those at once. A ref\n * written `group:<id>` is a group's, whose file, card or button press does not wait; a group named otherwise is told\n * only by the engine, and its notice comes only if the call is still going after WAIT_NOTICE_MS.\n */\nfunction oneShotWait(method: string, params: Record<string, unknown>): string | undefined {\n const group = typeof params.group === \"string\" || (typeof params.chat === \"string\" && params.chat.startsWith(\"group:\"));\n switch (method) {\n // On a chat nobody joined yet these answer at once (apiKit `oneShotWaits`); a notice comes only if a call is still\n // going after WAIT_NOTICE_MS.\n case \"chat.send\": return \"sent\";\n case \"chat.edit\": return \"confirmed\";\n case \"file.send\": case \"task.send\": case \"routine.send\": case \"button.press\": return group ? undefined : \"sent\";\n // `--all` reports to each 1:1 chat in turn, each waiting as one named would.\n case \"usage.send\": return group ? undefined : \"sent\";\n case \"task.update\": case \"routine.update\": return group ? undefined : \"confirmed\";\n case \"chat.react\": return \"confirmed\";\n case \"group.react\": return \"sent\";\n case \"chat.pin\": return group ? \"sent\" : \"confirmed\";\n case \"chat.delete\": return params.everyone !== true ? undefined : group ? \"sent\" : \"confirmed\";\n default: return undefined;\n }\n}\n\n/** The call's `wait`: the one given, or the one-shot's own default. */\nfunction waitOf(method: string, params: Record<string, unknown>, mode: \"daemon\" | \"one-shot\"): Record<string, unknown> {\n if (params.wait !== undefined || mode !== \"one-shot\") return params;\n const wait = oneShotWait(method, params);\n return wait === undefined ? params : { ...params, wait };\n}\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/**\n * A state `chat wait --until` waits for, as a sentence says it (`to`: the wait's timeout and notice, `not`: Ctrl-C).\n * The flag's word after \"to be\" read \"to be text\" and \"was not text yet\".\n */\nconst CHAT_STATES: Record<string, { to: string; not: string }> = {\n live: { to: \"to be live\", not: \"was not live yet\" },\n text: { to: \"to carry text\", not: \"could not carry text yet\" },\n paired: { to: \"to be paired\", not: \"was not paired yet\" },\n};\nexport const chatState = (until: string): { to: string; not: string } => CHAT_STATES[until] ?? { to: `to be ${until}`, not: `was not ${until} yet` };\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, given: Record<string, unknown>, mode: \"daemon\" | \"one-shot\"): WaitNotice | null {\n // A one-shot join by a group's link waits to be let in (api.ts `letIn`); through a daemon it answers at once.\n if (method === \"group.join\") return mode === \"one-shot\"\n ? { waiting: \"waiting for a member's app to let this profile in (up to 60 s; Ctrl-C stops waiting)\", stopped: \"not let in yet: the knock goes on while this profile is running (ghostly daemon --detach)\" }\n : null;\n const params = waitOf(method, given, mode);\n // A daemon's file send answers once it has copied the file into the profile (files.ts `stage`): 6-30 s for 1 GiB, said\n // nothing, and read as a hung daemon. Ctrl-C there stops the send (files.ts `stageWhileAsked`): nothing goes.\n if (method === \"file.send\" && mode === \"daemon\" && params.wait !== \"sent\") {\n const file = word(params.name) ?? (word(params.path) ? basename(params.path as string) : \"the file\");\n const chatRef = word(params.chat) ?? \"the chat\", chat = chatRef.startsWith(\"group:\") ? `group ${chatRef.slice(\"group:\".length)}` : chatRef;\n return { waiting: `copying ${file} into the profile before it goes to ${chat} (Ctrl-C stops the send)`, stopped: `${file} was not sent to ${chat}: send it again when you want it` };\n }\n const waits = waitsFor(method, params);\n if (waits === undefined) return null;\n const seconds = typeof params.timeout === \"number\" ? params.timeout : waits;\n // One that waits for the contact (`--wait sent`, a one-shot's own wait) copies the file in first as well, and Ctrl-C\n // then stops the send (a daemon's `stageWhileAsked`, a one-shot's profile closing under the copy): it said \"it is kept\n // here and still goes\" with nothing in the chat. Which of the two it was, only the chat's file list tells.\n if (method === \"file.send\") {\n const file = word(params.name) ?? (word(params.path) ? basename(params.path as string) : \"the file\");\n const chatRef = word(params.chat), chat = chatRef ?? \"the contact\";\n const list = chatRef ? ` (ghostly file list ${shellWord(chatRef, \"<chat>\")} says which)` : \"\";\n return {\n waiting: `copying ${file} into the profile, then waiting for it to go out to ${chat} (up to ${seconds} s; Ctrl-C stops the send while it is copied in, then only the waiting)`,\n stopped: `${file} was not sent to ${chat} if it was still being copied in; if it was in the chat, it is kept here and ${goesOn(mode)}${list}`,\n };\n }\n const upTo = `up to ${seconds} s; Ctrl-C stops waiting`;\n if (method === \"chat.wait\") {\n const chat = word(params.chat) ?? \"the chat\", state = chatState(word(params.until) ?? \"live\");\n return { waiting: `waiting for chat ${chat} ${state.to} (${upTo})`, stopped: `chat ${chat} ${state.not}` };\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 chatRef = word(params.chat);\n // A forward's `chat` is where the messages come from; they go to `to`.\n const group = word(params.group) ?? (method.startsWith(\"group.\") ? chatRef\n : method !== \"chat.forward\" && chatRef?.startsWith(\"group:\") ? chatRef.slice(\"group:\".length) : undefined);\n const to = Array.isArray(params.to) ? params.to.filter((t): t is string => typeof t === \"string\").join(\", \") : undefined;\n const chat = (to || undefined) ?? chatRef ?? (params.all === true ? \"each contact\" : \"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":";;;;AAUA,IAAa,UAAU,SAAwC,SAAS,aACpE,4FACA;;;;;;;AAQJ,SAAS,YAAY,QAAgB,QAAqD;CACxF,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F,OAAO;GAAE,SAAS,oBAAoB,KAAK,GAAG,MAAM,GAAG,IAAI,KAAK;GAAI,SAAS,QAAQ,KAAK,GAAG,MAAM;EAAM;CAC3G;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,UAAU,KAAK,OAAO,IAAI;CAEhC,MAAM,QAAQ,KAAK,OAAO,KAAK,MAAM,OAAO,WAAW,QAAQ,IAAI,UAC/D,WAAW,kBAAkB,SAAS,WAAW,QAAQ,IAAI,QAAQ,MAAM,CAAe,IAAI,KAAA;CAElG,MAAM,SADK,MAAM,QAAQ,OAAO,EAAE,IAAI,OAAO,GAAG,QAAQ,MAAmB,OAAO,MAAM,QAAQ,CAAC,CAAC,KAAK,IAAI,IAAI,KAAA,MAC3F,KAAA,MAAc,YAAY,OAAO,QAAQ,OAAO,iBAAiB;CAIrF,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"}
package/dist/ghostly.mjs CHANGED
@@ -23,7 +23,7 @@ function quietWebStorage(scope = globalThis, execArgv = process.execArgv, nodeOp
23
23
  // src/bin.ts
24
24
  quietWebStorage();
25
25
  enableCompileCache();
26
- var { run } = await import("./assets/main-CVqkvuIo.js");
26
+ var { run } = await import("./assets/main-CwTaepxR.js");
27
27
  run(process.argv.slice(2));
28
28
  export {};
29
29
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ghostlytools/cli",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ghostlytools/cli",
9
- "version": "1.12.0",
9
+ "version": "1.12.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@arkade-os/sdk": "0.5.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostlytools/cli",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
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",