@bringg/dashboard-sdk 9.82.0-pre.1 → 9.82.0-pre.3

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.
@@ -9,9 +9,29 @@
9
9
  * stripPath: true
10
10
  *
11
11
  * `stripPath: true` means the gateway strips the prefix before forwarding, so the service receives
12
- * `/threads/search` rather than `/analyst-service/threads/search`.
12
+ * `/analyst/threads` rather than `/analyst-service/analyst/threads`.
13
13
  */
14
14
  export declare const GATEWAY_PATH = "/analyst-service";
15
+ /**
16
+ * The graph this chat talks to, and the first segment of every path below.
17
+ *
18
+ * The service mounts one path per graph, so the URL - not a request field - is what selects the
19
+ * agent. That is why the old `agent_id` on the request body no longer exists.
20
+ */
21
+ export declare const GRAPH = "analyst";
22
+ /**
23
+ * Routes from the ag-ui contract (Confluence 5278728195, §3).
24
+ *
25
+ * `CHAT` is declared here for completeness but is **not** called from this package: it is the ag-ui
26
+ * protocol endpoint, opened by the consumer's `HttpAgent` as a streaming POST. It is exposed through
27
+ * {@link AnalystClientConfig.chatUrl} instead, so the URL is still built in one place.
28
+ *
29
+ * Note the paths deliberately do not say `agui`. If the protocol is replaced again, these do not
30
+ * have to change.
31
+ */
15
32
  export declare const Routes: {
16
- SEARCH_THREADS: string;
33
+ CHAT: string;
34
+ CANCEL_RUN: string;
35
+ THREADS: string;
36
+ THREAD: string;
17
37
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Routes = exports.GATEWAY_PATH = void 0;
3
+ exports.Routes = exports.GRAPH = exports.GATEWAY_PATH = void 0;
4
4
  /**
5
5
  * api-gateway path prefix the analyst service is registered under.
6
6
  *
@@ -12,10 +12,30 @@ exports.Routes = exports.GATEWAY_PATH = void 0;
12
12
  * stripPath: true
13
13
  *
14
14
  * `stripPath: true` means the gateway strips the prefix before forwarding, so the service receives
15
- * `/threads/search` rather than `/analyst-service/threads/search`.
15
+ * `/analyst/threads` rather than `/analyst-service/analyst/threads`.
16
16
  */
17
17
  exports.GATEWAY_PATH = '/analyst-service';
18
+ /**
19
+ * The graph this chat talks to, and the first segment of every path below.
20
+ *
21
+ * The service mounts one path per graph, so the URL - not a request field - is what selects the
22
+ * agent. That is why the old `agent_id` on the request body no longer exists.
23
+ */
24
+ exports.GRAPH = 'analyst';
25
+ /**
26
+ * Routes from the ag-ui contract (Confluence 5278728195, §3).
27
+ *
28
+ * `CHAT` is declared here for completeness but is **not** called from this package: it is the ag-ui
29
+ * protocol endpoint, opened by the consumer's `HttpAgent` as a streaming POST. It is exposed through
30
+ * {@link AnalystClientConfig.chatUrl} instead, so the URL is still built in one place.
31
+ *
32
+ * Note the paths deliberately do not say `agui`. If the protocol is replaced again, these do not
33
+ * have to change.
34
+ */
18
35
  exports.Routes = {
19
- SEARCH_THREADS: "".concat(exports.GATEWAY_PATH, "/threads/search")
36
+ CHAT: "".concat(exports.GATEWAY_PATH, "/").concat(exports.GRAPH, "/chat"),
37
+ CANCEL_RUN: "".concat(exports.GATEWAY_PATH, "/").concat(exports.GRAPH, "/chat/cancel"),
38
+ THREADS: "".concat(exports.GATEWAY_PATH, "/").concat(exports.GRAPH, "/threads"),
39
+ THREAD: "".concat(exports.GATEWAY_PATH, "/").concat(exports.GRAPH, "/threads/{:threadId}")
20
40
  };
21
41
  //# sourceMappingURL=Analyst.consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Analyst.consts.js","sourceRoot":"","sources":["../../src/Analyst/Analyst.consts.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACU,QAAA,YAAY,GAAG,kBAAkB,CAAC;AAElC,QAAA,MAAM,GAAG;IACrB,cAAc,EAAE,UAAG,oBAAY,oBAAiB;CAChD,CAAC"}
1
+ {"version":3,"file":"Analyst.consts.js","sourceRoot":"","sources":["../../src/Analyst/Analyst.consts.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACU,QAAA,YAAY,GAAG,kBAAkB,CAAC;AAE/C;;;;;GAKG;AACU,QAAA,KAAK,GAAG,SAAS,CAAC;AAE/B;;;;;;;;;GASG;AACU,QAAA,MAAM,GAAG;IACrB,IAAI,EAAE,UAAG,oBAAY,cAAI,aAAK,UAAO;IACrC,UAAU,EAAE,UAAG,oBAAY,cAAI,aAAK,iBAAc;IAClD,OAAO,EAAE,UAAG,oBAAY,cAAI,aAAK,aAAU;IAC3C,MAAM,EAAE,UAAG,oBAAY,cAAI,aAAK,yBAAsB;CACtD,CAAC"}
@@ -7,8 +7,10 @@ import Session from '../Services/Identity/Session';
7
7
  * itself - see the note on {@link Analyst}.
8
8
  */
9
9
  export interface AnalystClientConfig {
10
- /** Base URL the LangGraph protocol is spoken against. */
10
+ /** Host and gateway prefix, with no graph or endpoint path on it. */
11
11
  apiUrl: string;
12
+ /** The exact URL a turn is posted to. Built here so no consumer concatenates the path itself. */
13
+ chatUrl: string;
12
14
  /** Applied to every request. */
13
15
  defaultHeaders: Record<string, string>;
14
16
  }
@@ -21,19 +23,20 @@ export interface AnalystClientConfig {
21
23
  * we send the same `Authorization: Token token=...` plus `Client` that every other non-hagmonia
22
24
  * call sends.
23
25
  *
24
- * **Why config and not a client.** The protocol client lives in `@langchain/langgraph-sdk`, which
25
- * pulls in `@langchain/core` and, through it, Node built-ins that this bundle cannot resolve for
26
- * the browser. Since the only consumer is `@langchain/react`'s `useStream` - a React hook, which
27
- * cannot live here anyway - the split falls naturally: this package owns *where and how to
26
+ * **Why config and not a client.** Under ag-ui the chat is a single streaming POST, opened by
27
+ * `HttpAgent` from `@ag-ui/client` and answered with `text/event-stream` until the turn ends. A
28
+ * method returning a `Promise` cannot express that, and the client that can is a browser concern
29
+ * bound to a React lifecycle. So the split falls naturally: this package owns *where and how to
28
30
  * connect*, which it already knows from `Session`, and the consumer owns the transport.
29
31
  *
30
32
  * ```ts
31
- * const stream = useStream({ ...sdk.analyst.getClientConfig(), assistantId: 'analyst' });
33
+ * const { chatUrl, defaultHeaders } = sdk.analyst.getClientConfig();
34
+ * const agent = new HttpAgent({ url: chatUrl, headers: defaultHeaders });
32
35
  * ```
33
36
  *
34
- * Everything the dashboard requests *itself* - today just the conversation list - is an ordinary
35
- * SDK call on this class, typed from the `AnalystChat` contract in `@bringg/types` so the shape is
36
- * enforced by the compiler in both this repo and analyst-service.
37
+ * Everything the dashboard requests *itself* - the thread list, one thread, cancelling a run - is an
38
+ * ordinary SDK call on this class, typed from the `AnalystChat` contract in `@bringg/types` so the
39
+ * shape is enforced by the compiler in both this repo and analyst-service.
37
40
  */
38
41
  export declare class Analyst {
39
42
  private readonly session;
@@ -41,31 +44,47 @@ export declare class Analyst {
41
44
  private readonly entity;
42
45
  constructor(session: Session);
43
46
  /**
44
- * The signed-in user's conversations, most recently updated first.
47
+ * The signed-in user's conversations, most recently active first.
45
48
  *
46
49
  * Carries no messages - the History list stays cheap, and opening a conversation hydrates it
47
- * through the protocol client.
50
+ * through {@link getThread}.
48
51
  */
49
52
  listThreads(): Promise<AnalystChat.ThreadSummary[]>;
53
+ /**
54
+ * One conversation, with its messages and whether a run is executing on it right now.
55
+ *
56
+ * `activeRun` is the load-bearing field: a run belongs to the server and outlives the connection
57
+ * that started it, so a caller opening a thread has to attach to that run rather than ask a new
58
+ * question - and must not accept typing meanwhile, because a normal post to a busy thread is
59
+ * answered with the running turn's feed and the typed message is discarded.
60
+ *
61
+ * Rejects on 404, which is also the answer for a thread belonging to someone else: the service
62
+ * deliberately does not distinguish "not yours" from "not there".
63
+ */
64
+ getThread(threadId: string): Promise<AnalystChat.ThreadDetail>;
65
+ /**
66
+ * Cancel the run in flight on a thread.
67
+ *
68
+ * Aborting the stream client-side stops events arriving but leaves the agent running, so Stop has
69
+ * to be this call rather than an abort. `cancelled: false` means the thread was already idle -
70
+ * a normal answer, not a failure.
71
+ *
72
+ * A cancelled run ends with no terminal event: the stream simply closes, with neither
73
+ * `RUN_FINISHED` nor `RUN_ERROR`. Callers that drive their loading state off terminal events
74
+ * alone will hang, and must treat stream close as its own case.
75
+ */
76
+ cancelRun(threadId: string): Promise<AnalystChat.CancelRunResponse>;
50
77
  /**
51
78
  * Returns the **same object** while the values are unchanged.
52
79
  *
53
- * Referential stability is load-bearing, not a micro-optimisation: `useStream` treats
54
- * `defaultHeaders` as a client dependency and rebuilds its client whenever the identity
55
- * changes. A fresh object per call rebuilds on every render, which refetches, which renders
56
- * again - an endless loop of `/commands` and `/state`.
80
+ * Referential stability is load-bearing, not a micro-optimisation: a protocol client treats its
81
+ * config as a dependency and rebuilds itself whenever the identity changes. A fresh object per
82
+ * call rebuilds on every render, which refetches, which renders again - a loop.
57
83
  *
58
84
  * Recomputed each call and compared by value, so a changed session (login, region switch,
59
85
  * impersonation) still produces a new config rather than a stale one.
60
86
  */
61
87
  getClientConfig(): AnalystClientConfig;
62
- /**
63
- * `{api endpoint}/analyst-service`, resolved from the **signed-in user's region**.
64
- *
65
- * A user's region can differ from the environment default, and resolving against the default
66
- * would point them at the wrong cluster.
67
- */
68
- private getApiUrl;
69
88
  /** Matches the headers `ServiceRequest` builds for every other service. */
70
89
  private getDefaultHeaders;
71
90
  }
@@ -43,7 +43,7 @@ exports.Analyst = void 0;
43
43
  var Analyst_consts_1 = require("./Analyst.consts");
44
44
  var AnalystEntity_1 = __importDefault(require("./Entity/AnalystEntity"));
45
45
  var isSameConfig = function (a, b) {
46
- if (a.apiUrl !== b.apiUrl) {
46
+ if (a.apiUrl !== b.apiUrl || a.chatUrl !== b.chatUrl) {
47
47
  return false;
48
48
  }
49
49
  var keys = Object.keys(a.defaultHeaders);
@@ -59,19 +59,20 @@ var isSameConfig = function (a, b) {
59
59
  * we send the same `Authorization: Token token=...` plus `Client` that every other non-hagmonia
60
60
  * call sends.
61
61
  *
62
- * **Why config and not a client.** The protocol client lives in `@langchain/langgraph-sdk`, which
63
- * pulls in `@langchain/core` and, through it, Node built-ins that this bundle cannot resolve for
64
- * the browser. Since the only consumer is `@langchain/react`'s `useStream` - a React hook, which
65
- * cannot live here anyway - the split falls naturally: this package owns *where and how to
62
+ * **Why config and not a client.** Under ag-ui the chat is a single streaming POST, opened by
63
+ * `HttpAgent` from `@ag-ui/client` and answered with `text/event-stream` until the turn ends. A
64
+ * method returning a `Promise` cannot express that, and the client that can is a browser concern
65
+ * bound to a React lifecycle. So the split falls naturally: this package owns *where and how to
66
66
  * connect*, which it already knows from `Session`, and the consumer owns the transport.
67
67
  *
68
68
  * ```ts
69
- * const stream = useStream({ ...sdk.analyst.getClientConfig(), assistantId: 'analyst' });
69
+ * const { chatUrl, defaultHeaders } = sdk.analyst.getClientConfig();
70
+ * const agent = new HttpAgent({ url: chatUrl, headers: defaultHeaders });
70
71
  * ```
71
72
  *
72
- * Everything the dashboard requests *itself* - today just the conversation list - is an ordinary
73
- * SDK call on this class, typed from the `AnalystChat` contract in `@bringg/types` so the shape is
74
- * enforced by the compiler in both this repo and analyst-service.
73
+ * Everything the dashboard requests *itself* - the thread list, one thread, cancelling a run - is an
74
+ * ordinary SDK call on this class, typed from the `AnalystChat` contract in `@bringg/types` so the
75
+ * shape is enforced by the compiler in both this repo and analyst-service.
75
76
  */
76
77
  var Analyst = /** @class */ (function () {
77
78
  function Analyst(session) {
@@ -79,32 +80,71 @@ var Analyst = /** @class */ (function () {
79
80
  this.entity = new AnalystEntity_1.default(session);
80
81
  }
81
82
  /**
82
- * The signed-in user's conversations, most recently updated first.
83
+ * The signed-in user's conversations, most recently active first.
83
84
  *
84
85
  * Carries no messages - the History list stays cheap, and opening a conversation hydrates it
85
- * through the protocol client.
86
+ * through {@link getThread}.
86
87
  */
87
88
  Analyst.prototype.listThreads = function () {
88
89
  return __awaiter(this, void 0, void 0, function () {
89
90
  return __generator(this, function (_a) {
90
- return [2 /*return*/, this.entity.searchThreads()];
91
+ return [2 /*return*/, this.entity.listThreads()];
92
+ });
93
+ });
94
+ };
95
+ /**
96
+ * One conversation, with its messages and whether a run is executing on it right now.
97
+ *
98
+ * `activeRun` is the load-bearing field: a run belongs to the server and outlives the connection
99
+ * that started it, so a caller opening a thread has to attach to that run rather than ask a new
100
+ * question - and must not accept typing meanwhile, because a normal post to a busy thread is
101
+ * answered with the running turn's feed and the typed message is discarded.
102
+ *
103
+ * Rejects on 404, which is also the answer for a thread belonging to someone else: the service
104
+ * deliberately does not distinguish "not yours" from "not there".
105
+ */
106
+ Analyst.prototype.getThread = function (threadId) {
107
+ return __awaiter(this, void 0, void 0, function () {
108
+ return __generator(this, function (_a) {
109
+ return [2 /*return*/, this.entity.getThread(threadId)];
110
+ });
111
+ });
112
+ };
113
+ /**
114
+ * Cancel the run in flight on a thread.
115
+ *
116
+ * Aborting the stream client-side stops events arriving but leaves the agent running, so Stop has
117
+ * to be this call rather than an abort. `cancelled: false` means the thread was already idle -
118
+ * a normal answer, not a failure.
119
+ *
120
+ * A cancelled run ends with no terminal event: the stream simply closes, with neither
121
+ * `RUN_FINISHED` nor `RUN_ERROR`. Callers that drive their loading state off terminal events
122
+ * alone will hang, and must treat stream close as its own case.
123
+ */
124
+ Analyst.prototype.cancelRun = function (threadId) {
125
+ return __awaiter(this, void 0, void 0, function () {
126
+ return __generator(this, function (_a) {
127
+ return [2 /*return*/, this.entity.cancelRun(threadId)];
91
128
  });
92
129
  });
93
130
  };
94
131
  /**
95
132
  * Returns the **same object** while the values are unchanged.
96
133
  *
97
- * Referential stability is load-bearing, not a micro-optimisation: `useStream` treats
98
- * `defaultHeaders` as a client dependency and rebuilds its client whenever the identity
99
- * changes. A fresh object per call rebuilds on every render, which refetches, which renders
100
- * again - an endless loop of `/commands` and `/state`.
134
+ * Referential stability is load-bearing, not a micro-optimisation: a protocol client treats its
135
+ * config as a dependency and rebuilds itself whenever the identity changes. A fresh object per
136
+ * call rebuilds on every render, which refetches, which renders again - a loop.
101
137
  *
102
138
  * Recomputed each call and compared by value, so a changed session (login, region switch,
103
139
  * impersonation) still produces a new config rather than a stale one.
104
140
  */
105
141
  Analyst.prototype.getClientConfig = function () {
142
+ // Resolved from the SIGNED-IN USER's region, not the environment default: a user's region can
143
+ // differ from it, and resolving against the default points them at the wrong cluster.
144
+ var apiEndpoint = this.session.config.getApiEndpoint().encode();
106
145
  var next = {
107
- apiUrl: this.getApiUrl(),
146
+ apiUrl: "".concat(apiEndpoint).concat(Analyst_consts_1.GATEWAY_PATH),
147
+ chatUrl: "".concat(apiEndpoint).concat(Analyst_consts_1.Routes.CHAT),
108
148
  defaultHeaders: this.getDefaultHeaders()
109
149
  };
110
150
  if (this.cached && isSameConfig(this.cached, next)) {
@@ -113,15 +153,6 @@ var Analyst = /** @class */ (function () {
113
153
  this.cached = next;
114
154
  return next;
115
155
  };
116
- /**
117
- * `{api endpoint}/analyst-service`, resolved from the **signed-in user's region**.
118
- *
119
- * A user's region can differ from the environment default, and resolving against the default
120
- * would point them at the wrong cluster.
121
- */
122
- Analyst.prototype.getApiUrl = function () {
123
- return "".concat(this.session.config.getApiEndpoint().encode()).concat(Analyst_consts_1.GATEWAY_PATH);
124
- };
125
156
  /** Matches the headers `ServiceRequest` builds for every other service. */
126
157
  Analyst.prototype.getDefaultHeaders = function () {
127
158
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"Analyst.js","sourceRoot":"","sources":["../../src/Analyst/Analyst.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,mDAAgD;AAChD,yEAAmD;AAenD,IAAM,YAAY,GAAG,UAAC,CAAsB,EAAE,CAAsB;IACnE,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE;QAC1B,OAAO,KAAK,CAAC;KACb;IAED,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAE3C,OAAO,CACN,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM;QACpD,IAAI,CAAC,KAAK,CAAC,UAAA,GAAG,IAAI,OAAA,CAAC,CAAC,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A6FC;AA7FY,0BAAO;AA+FpB,kBAAe,OAAO,CAAC"}
@@ -4,32 +4,35 @@ import type Session from '../../Services/Identity/Session';
4
4
  /**
5
5
  * The Analyst REST surface.
6
6
  *
7
- * **Why this is the only endpoint declared here.** The analyst service exposes four more -
8
- * `POST /threads/:id/commands`, `POST /threads/:id/stream/events`, `GET /threads/:id/state` and
9
- * cancel - and none of them can become an SDK method. The dividing line is not REST versus
10
- * streaming, it is *who decides to make the call*:
7
+ * **Why the chat endpoint is not here.** The ag-ui contract has four endpoints, and exactly one of
8
+ * them is the protocol: `POST /analyst/chat` is a streaming POST that answers with `text/event-stream`
9
+ * until the turn ends. A method returning a `Promise` cannot express that, and re-implementing SSE
10
+ * framing here would duplicate the transport we are deferring to - so the consumer's `HttpAgent`
11
+ * opens it, and this package's contribution is {@link Analyst.getClientConfig}: where to connect and
12
+ * how to authenticate.
11
13
  *
12
- * - `/commands` - the protocol client builds the JSON-RPC envelope, allocates the command id and
13
- * correlates the returned run. It sends this itself, on submit.
14
- * - `/stream/events` - a long-lived SSE connection. The client opens it, splits frames, ignores
15
- * keep-alives, dedupes by `event_id` and resumes from `seq` after a drop. A method returning a
16
- * `Promise` cannot express a stream, and re-implementing the framing here would duplicate the
17
- * very transport we are deferring to.
18
- * - `/state` - called by the client during its own hydrate lifecycle, not when we ask.
19
- * - cancel - keyed to the run id the client is tracking internally.
20
- *
21
- * All four are initiated *by the client*, so wrapping them would produce methods nothing calls.
22
- * The SDK's contribution to those is {@link Analyst.getClientConfig} - where to connect and how to
23
- * authenticate - and the client does the rest.
24
- *
25
- * `POST /threads/search` is different: the dashboard decides to ask for it, when the user opens
26
- * the History tab. That makes it ours, and it is the only one.
14
+ * The other three carry no protocol content at all. They are ordinary JSON over REST, and the
15
+ * dashboard - not the protocol client - decides when to call them: the History tab asks for the
16
+ * list, opening a conversation asks for one thread, and pressing Stop cancels the run. That makes
17
+ * them ours.
27
18
  */
28
19
  export default class AnalystEntity extends Entity<AnalystChat.ThreadSummary> {
29
20
  constructor(session: Session);
21
+ /** The signed-in user's threads, most recently active first. A bare array, no envelope. */
22
+ listThreads(): Promise<AnalystChat.ThreadSummary[]>;
23
+ /**
24
+ * One thread, with its messages and whether a run is currently executing on it.
25
+ *
26
+ * A thread belonging to another user answers **404**, never 403 - so a rejected id is
27
+ * indistinguishable from a missing one, by design.
28
+ */
29
+ getThread(threadId: string): Promise<AnalystChat.ThreadDetail>;
30
30
  /**
31
- * Unwraps the `threads` envelope so callers receive entities directly, matching how the rest
32
- * of the SDK reads (`getInsights()` returns insights, not a response wrapper).
31
+ * Cancel the run in flight on a thread.
32
+ *
33
+ * Needed because a run belongs to the server, not to the connection that started it: aborting the
34
+ * stream client-side stops the events arriving but leaves the agent working. `cancelled: false`
35
+ * means the thread was already idle, which is a normal answer rather than a failure.
33
36
  */
34
- searchThreads(): Promise<AnalystChat.ThreadSummary[]>;
37
+ cancelRun(threadId: string): Promise<AnalystChat.CancelRunResponse>;
35
38
  }
@@ -59,26 +59,17 @@ var Analyst_consts_1 = require("../Analyst.consts");
59
59
  /**
60
60
  * The Analyst REST surface.
61
61
  *
62
- * **Why this is the only endpoint declared here.** The analyst service exposes four more -
63
- * `POST /threads/:id/commands`, `POST /threads/:id/stream/events`, `GET /threads/:id/state` and
64
- * cancel - and none of them can become an SDK method. The dividing line is not REST versus
65
- * streaming, it is *who decides to make the call*:
62
+ * **Why the chat endpoint is not here.** The ag-ui contract has four endpoints, and exactly one of
63
+ * them is the protocol: `POST /analyst/chat` is a streaming POST that answers with `text/event-stream`
64
+ * until the turn ends. A method returning a `Promise` cannot express that, and re-implementing SSE
65
+ * framing here would duplicate the transport we are deferring to - so the consumer's `HttpAgent`
66
+ * opens it, and this package's contribution is {@link Analyst.getClientConfig}: where to connect and
67
+ * how to authenticate.
66
68
  *
67
- * - `/commands` - the protocol client builds the JSON-RPC envelope, allocates the command id and
68
- * correlates the returned run. It sends this itself, on submit.
69
- * - `/stream/events` - a long-lived SSE connection. The client opens it, splits frames, ignores
70
- * keep-alives, dedupes by `event_id` and resumes from `seq` after a drop. A method returning a
71
- * `Promise` cannot express a stream, and re-implementing the framing here would duplicate the
72
- * very transport we are deferring to.
73
- * - `/state` - called by the client during its own hydrate lifecycle, not when we ask.
74
- * - cancel - keyed to the run id the client is tracking internally.
75
- *
76
- * All four are initiated *by the client*, so wrapping them would produce methods nothing calls.
77
- * The SDK's contribution to those is {@link Analyst.getClientConfig} - where to connect and how to
78
- * authenticate - and the client does the rest.
79
- *
80
- * `POST /threads/search` is different: the dashboard decides to ask for it, when the user opens
81
- * the History tab. That makes it ours, and it is the only one.
69
+ * The other three carry no protocol content at all. They are ordinary JSON over REST, and the
70
+ * dashboard - not the protocol client - decides when to call them: the History tab asks for the
71
+ * list, opening a conversation asks for one thread, and pressing Stop cancels the run. That makes
72
+ * them ours.
82
73
  */
83
74
  var AnalystEntity = /** @class */ (function (_super) {
84
75
  __extends(AnalystEntity, _super);
@@ -89,28 +80,60 @@ var AnalystEntity = /** @class */ (function (_super) {
89
80
  routePrefix: 'analyst-service'
90
81
  }) || this;
91
82
  }
92
- /**
93
- * Unwraps the `threads` envelope so callers receive entities directly, matching how the rest
94
- * of the SDK reads (`getInsights()` returns insights, not a response wrapper).
95
- */
96
- AnalystEntity.prototype.searchThreads = function () {
97
- var _a;
83
+ /** The signed-in user's threads, most recently active first. A bare array, no envelope. */
84
+ AnalystEntity.prototype.listThreads = function () {
98
85
  return __awaiter(this, void 0, void 0, function () {
99
- var response;
100
- return __generator(this, function (_b) {
101
- switch (_b.label) {
86
+ var threads;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
102
89
  case 0: return [4 /*yield*/, this.service.routeGenerator
103
- .post(Analyst_consts_1.Routes.SEARCH_THREADS)
104
- .withPayload({})
90
+ .get(Analyst_consts_1.Routes.THREADS)
105
91
  .setException('Failed to fetch analyst chat threads')
106
92
  .invoke()];
107
93
  case 1:
108
- response = _b.sent();
109
- return [2 /*return*/, (_a = response === null || response === void 0 ? void 0 : response.threads) !== null && _a !== void 0 ? _a : []];
94
+ threads = _a.sent();
95
+ return [2 /*return*/, threads !== null && threads !== void 0 ? threads : []];
110
96
  }
111
97
  });
112
98
  });
113
99
  };
100
+ /**
101
+ * One thread, with its messages and whether a run is currently executing on it.
102
+ *
103
+ * A thread belonging to another user answers **404**, never 403 - so a rejected id is
104
+ * indistinguishable from a missing one, by design.
105
+ */
106
+ AnalystEntity.prototype.getThread = function (threadId) {
107
+ return __awaiter(this, void 0, void 0, function () {
108
+ return __generator(this, function (_a) {
109
+ return [2 /*return*/, this.service.routeGenerator
110
+ .get(Analyst_consts_1.Routes.THREAD)
111
+ .withRouteParams({ threadId: threadId })
112
+ .setException('Failed to fetch analyst chat thread')
113
+ .invoke()];
114
+ });
115
+ });
116
+ };
117
+ /**
118
+ * Cancel the run in flight on a thread.
119
+ *
120
+ * Needed because a run belongs to the server, not to the connection that started it: aborting the
121
+ * stream client-side stops the events arriving but leaves the agent working. `cancelled: false`
122
+ * means the thread was already idle, which is a normal answer rather than a failure.
123
+ */
124
+ AnalystEntity.prototype.cancelRun = function (threadId) {
125
+ return __awaiter(this, void 0, void 0, function () {
126
+ var payload;
127
+ return __generator(this, function (_a) {
128
+ payload = { threadId: threadId };
129
+ return [2 /*return*/, this.service.routeGenerator
130
+ .post(Analyst_consts_1.Routes.CANCEL_RUN)
131
+ .withPayload(payload)
132
+ .setException('Failed to cancel the analyst chat run')
133
+ .invoke()];
134
+ });
135
+ });
136
+ };
114
137
  return AnalystEntity;
115
138
  }(Entity_1.default));
116
139
  exports.default = AnalystEntity;
@@ -1 +1 @@
1
- {"version":3,"file":"AnalystEntity.js","sourceRoot":"","sources":["../../../src/Analyst/Entity/AnalystEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6DAAuC;AAEvC,oDAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAA2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B,QAAgB;;;gBAC/B,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,uBAAM,CAAC,MAAM,CAAC;yBAClB,eAAe,CAAC,EAAE,QAAQ,UAAA,EAAE,CAAC;yBAC7B,YAAY,CAAC,qCAAqC,CAAC;yBACnD,MAAM,EAAsD,EAAC;;;KAC/D;IAED;;;;;;OAMG;IACG,iCAAS,GAAf,UAAgB,QAAgB;;;;gBACzB,OAAO,GAAiC,EAAE,QAAQ,UAAA,EAAE,CAAC;gBAE3D,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,IAAI,CAAC,uBAAM,CAAC,UAAU,CAAC;yBACvB,WAAW,CAAC,OAAO,CAAC;yBACpB,YAAY,CAAC,uCAAuC,CAAC;yBACrD,MAAM,EAAgE,EAAC;;;KACzE;IACF,oBAAC;AAAD,CAAC,AAjDD,CAA2C,gBAAM,GAiDhD"}
@@ -8,4 +8,5 @@ export default class ShiftsEntity extends Entity<ShiftsEntity> {
8
8
  getBreaks(teamId: number): Promise<BreaksResponse>;
9
9
  updateBreaks(teamId: number, configuration: ShiftsConfiguration[]): Promise<BreaksResponse>;
10
10
  startShift(userId: number, teamId?: number): Promise<StartShiftResponse>;
11
+ endShift(userId: number): Promise<boolean>;
11
12
  }
@@ -117,6 +117,20 @@ var ShiftsEntity = /** @class */ (function (_super) {
117
117
  });
118
118
  });
119
119
  };
120
+ // A business rejection, for instance no shift is open, arrives as 200 with success false, which the
121
+ // request layer turns into a BringgException carrying the server message. So this resolves only on
122
+ // a real success and callers handle the failure wording by catching.
123
+ ShiftsEntity.prototype.endShift = function (userId) {
124
+ return __awaiter(this, void 0, void 0, function () {
125
+ return __generator(this, function (_a) {
126
+ return [2 /*return*/, this.service.routeGenerator
127
+ .delete("/users/".concat(userId, "/shift"))
128
+ .withExtractor(function (response) { return response.success; })
129
+ .setException('Failed end user shift')
130
+ .invoke()];
131
+ });
132
+ });
133
+ };
120
134
  return ShiftsEntity;
121
135
  }(Entity_1.default));
122
136
  exports.default = ShiftsEntity;
@@ -1 +1 @@
1
- {"version":3,"file":"Shifts.js","sourceRoot":"","sources":["../../../src/Shifts/Entity/Shifts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAuC;AAUvC;IAA0C,gCAAoB;IAC7D,sBAAY,OAAgB;eAC3B,kBAAM,EAAE,OAAO,SAAA,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;IACzC,CAAC;IAEY,gCAAS,GAAtB,UAAuB,MAAc;;;gBACpC,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,iBAAU,MAAM,sBAAmB,CAAC;yBACxC,YAAY,CAAC,+BAA+B,CAAC;yBAC7C,MAAM,EAAE,EAAC;;;KACX;IAEY,mCAAY,GAAzB,UAA0B,MAAc,EAAE,aAAoC;;;;gBACvE,OAAO,GAAwB,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,eAAA,EAAE,CAAC;gBAEnE,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,iBAAU,MAAM,qBAAkB,CAAC;yBACvC,WAAW,CAAC,OAAO,CAAC;yBACpB,YAAY,CAAC,+BAA+B,CAAC;yBAC7C,MAAM,EAAuC,EAAC;;;KAChD;IAEY,gCAAS,GAAtB,UAAuB,MAAc;;;gBACpC,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,iBAAU,MAAM,uBAAoB,CAAC;yBACzC,YAAY,CAAC,6BAA6B,CAAC;yBAC3C,MAAM,EAAE,EAAC;;;KACX;IAEY,mCAAY,GAAzB,UAA0B,MAAc,EAAE,aAAoC;;;;gBACvE,OAAO,GAAwB,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,eAAA,EAAE,CAAC;gBAEnE,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,G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(teamId: number): Promise<BreaksResponse>;
9
9
  updateBreaks(teamId: number, configuration: ShiftsConfiguration[]): Promise<BreaksResponse>;
10
10
  startShift(userId: number, teamId?: number): Promise<StartShiftResponse>;
11
+ endShift(userId: number): Promise<boolean>;
11
12
  }
@@ -23,6 +23,9 @@ var ShiftsApi = /** @class */ (function () {
23
23
  ShiftsApi.prototype.startShift = function (userId, teamId) {
24
24
  return this.shiftsEntity.startShift(userId, teamId);
25
25
  };
26
+ ShiftsApi.prototype.endShift = function (userId) {
27
+ return this.shiftsEntity.endShift(userId);
28
+ };
26
29
  return ShiftsApi;
27
30
  }());
28
31
  exports.default = ShiftsApi;
@@ -1 +1 @@
1
- {"version":3,"file":"ShiftsApi.js","sourceRoot":"","sources":["../../src/Shifts/ShiftsApi.ts"],"names":[],"mappings":";;;;;AACA,2DAAqC;AAGrC;IAGC,mBAAY,OAAgB;QAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,gBAAM,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,6BAAS,GAAhB,UAAiB,MAAc;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,gCAAY,GAAnB,UAAoB,MAAc,EAAE,aAAoC;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9D,CAAC;IAEM,6BAAS,GAAhB,UAAiB,MAAc;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,gCAAY,GAAnB,UAAoB,MAAc,EAAE,aAAoC;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9D,CAAC;IAEM,8BAAU,GAAjB,UAAkB,MAAc,EAAE,MAAe;QAChD,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IACF,gBAAC;AAAD,CAAC,AA1BD,IA0BC"}
1
+ {"version":3,"file":"ShiftsApi.js","sourceRoot":"","sources":["../../src/Shifts/ShiftsApi.ts"],"names":[],"mappings":";;;;;AACA,2DAAqC;AAGrC;IAGC,mBAAY,OAAgB;QAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,gBAAM,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,6BAAS,GAAhB,UAAiB,MAAc;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,gCAAY,GAAnB,UAAoB,MAAc,EAAE,aAAoC;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9D,CAAC;IAEM,6BAAS,GAAhB,UAAiB,MAAc;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,gCAAY,GAAnB,UAAoB,MAAc,EAAE,aAAoC;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9D,CAAC;IAEM,8BAAU,GAAjB,UAAkB,MAAc,EAAE,MAAe;QAChD,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAEM,4BAAQ,GAAf,UAAgB,MAAc;QAC7B,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IACF,gBAAC;AAAD,CAAC,AA9BD,IA8BC"}
@@ -55,6 +55,11 @@ export declare enum UsersScopes {
55
55
  }
56
56
  export type AllUsersKeysetPaginationResponse = KeysetPaginationResponse<'users', User[]>;
57
57
  export type AllDriversResponse = KeysetPaginationResponse<'users', Driver[]>;
58
+ export interface DriverQrTokenResponse {
59
+ access_token: string;
60
+ secret: string;
61
+ region: string;
62
+ }
58
63
  export declare const defaultExtractor: (response: any) => any;
59
64
  export declare const userExtractor: (response: any) => any;
60
65
  export declare const usersExtractor: (response: any) => any;
@@ -74,6 +79,9 @@ export declare const ROUTES: {
74
79
  INVITE: string;
75
80
  CLOSED_TASKS: string;
76
81
  TOTAL_TASKS: string;
82
+ GOT_HOME: string;
83
+ LEFT_HOME: string;
84
+ DRIVER_QR_TOKEN: string;
77
85
  };
78
86
  export declare enum UserEvents {
79
87
  CURRENT_USER_UPDATED = "currentUserUpdated"
@@ -44,7 +44,10 @@ exports.ROUTES = {
44
44
  GET_USERS_WITH_USER_TYPE: '/user_types/{:userTypeId}/users',
45
45
  INVITE: '/users/{:userId}/reinvite',
46
46
  CLOSED_TASKS: '/users/{:userId}/tasks/closed_tasks',
47
- TOTAL_TASKS: '/users/{:userId}/tasks/count'
47
+ TOTAL_TASKS: '/users/{:userId}/tasks/count',
48
+ GOT_HOME: "".concat(exports.baseRoute, "/{:userId}/got_home"),
49
+ LEFT_HOME: "".concat(exports.baseRoute, "/{:userId}/left_home"),
50
+ DRIVER_QR_TOKEN: '/tokens/gen_driver_qr_code'
48
51
  };
49
52
  var UserEvents;
50
53
  (function (UserEvents) {
@@ -1 +1 @@
1
- {"version":3,"file":"User.consts.js","sourceRoot":"","sources":["../../src/User/User.consts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,6CAA4C;AA4D5C,IAAY,WAMX;AAND,WAAY,WAAW;IACtB,kCAAmB,CAAA;IACnB,0CAA2B,CAAA;IAC3B,gCAAiB,CAAA;IACjB,sCAAuB,CAAA;IACvB,oDAAqC,CAAA;AACtC,CAAC,EANW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAMtB;AAKM,IAAM,gBAAgB,GAAG,UAAC,QAAa,IAAK,OAAA,QAAQ,EAAR,CAAQ,CAAC;AAA/C,QAAA,gBAAgB,oBAA+B;AACrD,IAAM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