@butlerbot/sdk 0.0.44 → 0.0.45

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.
@@ -120,6 +120,8 @@ export type LinkClientPayloads = {
120
120
  model?: string;
121
121
  instructions?: string;
122
122
  personality?: string;
123
+ /** Why Alfred is speaking on this one turn: a line for its system prompt, at most 500 characters. */
124
+ wake?: string;
123
125
  };
124
126
  "conversation.end": {
125
127
  sessionId: string;
@@ -27,6 +27,14 @@ export type DialogueRequestParams = {
27
27
  address?: ConversationAddress;
28
28
  /** Custom personality configuration for the AI */
29
29
  personality?: string;
30
+ /**
31
+ * Why Alfred is speaking on this turn, when something other than the message is the
32
+ * reason — for example "You are joining because a rule of the user's matched: ...".
33
+ * A line added to this one turn's system prompt and never written to the conversation,
34
+ * so it is passed per `send()`/`ask()` rather than set on the conversation. At most
35
+ * 500 characters; the server refuses a longer one. Left off when blank.
36
+ */
37
+ wake?: string;
30
38
  };
31
39
  export type DialogueRequestOptions = Omit<Omit<DialogueRequestParams, "message">, "chatId">;
32
40
  export interface RequestResponseByVersion {
@@ -58,6 +58,8 @@ export type TransportTurnRequest = {
58
58
  /** Where on the platform the conversation is: on Discord, the channel and thread. */
59
59
  address?: ConversationAddress;
60
60
  personality?: string;
61
+ /** Why Alfred is speaking on this one turn: a line for its system prompt, at most 500 characters. */
62
+ wake?: string;
61
63
  };
62
64
  export type TransportHandlers = {
63
65
  /** One payload of the stream, already in the shape callers expect. */
@@ -184,6 +184,8 @@ class LinkConversationTransport {
184
184
  ...(request.model ? { model: request.model } : {}),
185
185
  ...(request.instructions ? { instructions: request.instructions } : {}),
186
186
  ...(request.personality ? { personality: request.personality } : {}),
187
+ // Per turn, never on the session: it says why Alfred was woken for this one.
188
+ ...(request.wake?.trim() ? { wake: request.wake.trim() } : {}),
187
189
  }, {
188
190
  // A turn takes as long as it takes; only the transport dying ends it early.
189
191
  timeoutMs: 0,
@@ -120,5 +120,8 @@ function asQuery(request) {
120
120
  query.address = JSON.stringify(request.address);
121
121
  if (request.personality)
122
122
  query.personality = request.personality;
123
+ const wake = request.wake?.trim();
124
+ if (wake)
125
+ query.wake = wake;
123
126
  return query;
124
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@butlerbot/sdk",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "The official ButlerBot SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",