@opencxh/domain 1.238.0 → 1.239.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.
@@ -23,6 +23,21 @@ export interface AIMessageOutput {
23
23
  text: string;
24
24
  type: "text";
25
25
  }
26
+ /**
27
+ * What the user asked this turn to be, beside *who* answers it (the profile).
28
+ *
29
+ * - `"ask"` — read, do not change anything. Toolset narrows to read tools.
30
+ * - `"draft"` — prepare, do not send. Reads plus internal writes (`create_draft`).
31
+ * - `"agent"` — do the work, sending included. The profile's full toolset.
32
+ *
33
+ * **Narrowing only, and resolved server-side.** A mode can never widen what the profile allows,
34
+ * and the client never sends a tool list: `agent/runner.ts` has no approval gate, so the toolset
35
+ * is the whole guarantee. Same rule as `Procedure.tools ⊆ brain.enabledTools`.
36
+ *
37
+ * Unlike the profile — locked once a thread has turns — the mode is free per turn: asking a
38
+ * question and then having the same thread draft a reply is the normal flow.
39
+ */
40
+ export type AssistantMode = "ask" | "draft" | "agent";
26
41
  export interface AIMessage {
27
42
  id: string;
28
43
  organizationId: string;
@@ -48,6 +63,8 @@ export interface AIMessage {
48
63
  toolsDeclared?: number;
49
64
  /** Tools available in this conversation when the turn started. Absent with `toolsDeclared`. */
50
65
  toolsTotal?: number;
66
+ /** Which mode this turn ran as. Absent = `"agent"`: every row written before modes existed. */
67
+ mode?: AssistantMode;
51
68
  }
52
69
  export type AIMessageFeedback = "up" | "down";
53
70
  /**
@@ -62,14 +79,12 @@ export interface AIMessageAskPayload {
62
79
  previousExternalId?: string;
63
80
  context?: Record<string, any>;
64
81
  /**
65
- * May this turn reach outside the platform? Default `true` — today's behaviour.
82
+ * What this turn is for. Default `"agent"` — today's behaviour.
66
83
  *
67
- * `false` narrows the toolset to reads and internal writes, so the model can prepare a draft
68
- * but cannot send one. Narrowing only: it can never widen what the profile allows. The Assist
69
- * queue's instruction bar sends `false`, because a card that answers a customer while you were
70
- * still reading it is the one thing that must not happen there.
84
+ * Replaces the older `outward` boolean: that expressed only the draft lane, and a second flag
85
+ * beside this one would allow combinations nobody can explain (`"agent"` + no outward).
71
86
  */
72
- outward?: boolean;
87
+ mode?: AssistantMode;
73
88
  }
74
89
  export interface AIMessageAskResponse {
75
90
  output: AIMessageOutput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.238.0",
3
+ "version": "1.239.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",