@s2script/sdk 0.6.0 → 0.7.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.
package/commands.d.ts CHANGED
@@ -13,7 +13,16 @@ export type ReplySource = "server" | "console" | "chat";
13
13
 
14
14
  /**
15
15
  * The parsed invocation handed to a command callback: who called it, its arguments (multiple typed
16
- * accessors), and a caller-appropriate `reply` channel. Valid only for the duration of the callback.
16
+ * accessors), and a caller-appropriate `reply` channel. It is a plain object that captures no native
17
+ * handle, so it MAY be retained and used after an `await`/`.then` — a deferred `reply` (e.g. from
18
+ * inside `delay(...).then(...)` or an async DB/HTTP call) is safe to call once the awaited work
19
+ * completes.
20
+ *
21
+ * What it captures, though, is the caller's **slot** — not a stable identity. If the original caller
22
+ * disconnects before the deferred reply runs and a different player has since taken that slot, the
23
+ * reply routes to (or targets the console/chat channel of) whoever now occupies it, not the original
24
+ * caller. Prefer replying synchronously where the timing matters, or re-check the caller (e.g. via
25
+ * their user id) before trusting a slot held across a long-running await.
17
26
  */
18
27
  export interface CommandInvocation {
19
28
  /** 0-based caller slot, or -1 for the server console. */