@kinotic-ai/core 5.0.0-beta.27 → 5.0.0-beta.29
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/LICENSE +202 -0
- package/dist/index.cjs +22 -14
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +22 -14
- package/package.json +3 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/dist/index.cjs
CHANGED
|
@@ -194,14 +194,19 @@ class StompActivation {
|
|
|
194
194
|
preparedSocket = null;
|
|
195
195
|
attempt = null;
|
|
196
196
|
failPending = null;
|
|
197
|
+
abortController = new AbortController;
|
|
197
198
|
subscriptions = [];
|
|
198
199
|
get ended() {
|
|
199
200
|
return this._ended;
|
|
200
201
|
}
|
|
202
|
+
get signal() {
|
|
203
|
+
return this.abortController.signal;
|
|
204
|
+
}
|
|
201
205
|
end() {
|
|
202
206
|
this._ended = true;
|
|
203
207
|
this.wake?.();
|
|
204
208
|
this.wake = null;
|
|
209
|
+
this.abortController.abort();
|
|
205
210
|
}
|
|
206
211
|
delay(ms) {
|
|
207
212
|
return new Promise((resolve) => {
|
|
@@ -349,9 +354,9 @@ class StompConnectionManager {
|
|
|
349
354
|
activation.own(this.rxStomp.webSocketErrors$.subscribe((value) => {
|
|
350
355
|
this.lastWebsocketError = value;
|
|
351
356
|
}));
|
|
352
|
-
activation.own(this.rxStomp.stompErrors$.subscribe(
|
|
357
|
+
activation.own(this.rxStomp.stompErrors$.subscribe((frame) => {
|
|
353
358
|
const stompError = new Error(frame.headers["message"], { cause: frame });
|
|
354
|
-
|
|
359
|
+
this.failConnection(activation, new Error("STOMP connection error", { cause: stompError }));
|
|
355
360
|
}));
|
|
356
361
|
activation.own(this.rxStomp.connected$.subscribe(() => {
|
|
357
362
|
activation.established();
|
|
@@ -359,19 +364,19 @@ class StompConnectionManager {
|
|
|
359
364
|
this.connectionAttempts = 0;
|
|
360
365
|
}));
|
|
361
366
|
activation.pending(reject);
|
|
362
|
-
activation.own(this.rxStomp.serverHeaders$.pipe(import_operators.skip(this.rxStompHasConnected ? 1 : 0)).subscribe(
|
|
367
|
+
activation.own(this.rxStomp.serverHeaders$.pipe(import_operators.skip(this.rxStompHasConnected ? 1 : 0)).subscribe((value) => {
|
|
363
368
|
this.rxStompHasConnected = true;
|
|
364
369
|
const connectedInfoJson = value["connected-info" /* CONNECTED_INFO_HEADER */];
|
|
365
370
|
if (connectedInfoJson == null) {
|
|
366
371
|
if (!this.initialConnectionSuccessful) {
|
|
367
|
-
|
|
372
|
+
this.failConnection(activation, new Error("Server did not return proper data for successful login"));
|
|
368
373
|
}
|
|
369
374
|
return;
|
|
370
375
|
}
|
|
371
376
|
const connectedInfo = JSON.parse(connectedInfoJson);
|
|
372
377
|
if (connectedInfo.replyToId == null) {
|
|
373
378
|
if (!this.initialConnectionSuccessful) {
|
|
374
|
-
|
|
379
|
+
this.failConnection(activation, new Error("Server did not return a replyToId for successful login"));
|
|
375
380
|
}
|
|
376
381
|
return;
|
|
377
382
|
}
|
|
@@ -409,9 +414,12 @@ class StompConnectionManager {
|
|
|
409
414
|
if (!usesPreparedSocket) {
|
|
410
415
|
const sessionCheckUrl = buildServerUrl(server, "http") + SESSION_CHECK_PATH;
|
|
411
416
|
try {
|
|
412
|
-
const res = await fetch(sessionCheckUrl, {
|
|
417
|
+
const res = await fetch(sessionCheckUrl, {
|
|
418
|
+
credentials: "include",
|
|
419
|
+
signal: AbortSignal.any([activation.signal, AbortSignal.timeout(this.CONNECTION_TIMEOUT)])
|
|
420
|
+
});
|
|
413
421
|
if (res.status === 401) {
|
|
414
|
-
|
|
422
|
+
this.failConnection(activation, new Error("Authentication required"));
|
|
415
423
|
return;
|
|
416
424
|
}
|
|
417
425
|
} catch (e) {
|
|
@@ -429,19 +437,19 @@ class StompConnectionManager {
|
|
|
429
437
|
try {
|
|
430
438
|
activation.preparedSocket = await userWebSocketFactory();
|
|
431
439
|
} catch (e) {
|
|
432
|
-
|
|
440
|
+
this.failConnection(activation, new Error("WebSocket factory failed", { cause: e }));
|
|
433
441
|
}
|
|
434
442
|
} else if (headerAuth) {
|
|
435
443
|
try {
|
|
436
444
|
const resolved = await credentialsResolver.resolve(server);
|
|
437
445
|
if (resolved?.authHeaders == null) {
|
|
438
|
-
|
|
446
|
+
this.failConnection(activation, new Error("Credentials resolver no longer supplies auth headers: " + credentialsResolver.name));
|
|
439
447
|
} else {
|
|
440
448
|
const WS = WebSocket;
|
|
441
449
|
activation.preparedSocket = new WS(url, { headers: resolved.authHeaders });
|
|
442
450
|
}
|
|
443
451
|
} catch (e) {
|
|
444
|
-
|
|
452
|
+
this.failConnection(activation, new Error("Credential resolution failed", { cause: e }));
|
|
445
453
|
}
|
|
446
454
|
}
|
|
447
455
|
if (activation.ended && activation.preparedSocket) {
|
|
@@ -481,10 +489,10 @@ class StompConnectionManager {
|
|
|
481
489
|
await activation.delay(randomJitter);
|
|
482
490
|
}
|
|
483
491
|
}
|
|
484
|
-
|
|
492
|
+
failConnection(activation, err) {
|
|
485
493
|
if (!activation.ended) {
|
|
486
494
|
this.debugLogger("Connection failed, ending it: %O", err);
|
|
487
|
-
|
|
495
|
+
this.deactivate(undefined, err).catch((e) => this.debugLogger("Closing the failed connection failed: %O", e));
|
|
488
496
|
}
|
|
489
497
|
}
|
|
490
498
|
}
|
|
@@ -1306,7 +1314,7 @@ var import_api2 = __toESM(require("@opentelemetry/api"), 1);
|
|
|
1306
1314
|
// packages/core/package.json
|
|
1307
1315
|
var package_default = {
|
|
1308
1316
|
name: "@kinotic-ai/core",
|
|
1309
|
-
version: "5.0.0-beta.
|
|
1317
|
+
version: "5.0.0-beta.29",
|
|
1310
1318
|
type: "module",
|
|
1311
1319
|
files: [
|
|
1312
1320
|
"dist"
|
|
@@ -1343,7 +1351,7 @@ var package_default = {
|
|
|
1343
1351
|
url: "git+https://github.com/kinotic-ai/kinotic.git",
|
|
1344
1352
|
directory: "kinotic-js/workspace/packages/core"
|
|
1345
1353
|
},
|
|
1346
|
-
license: "
|
|
1354
|
+
license: "Apache-2.0",
|
|
1347
1355
|
publishConfig: {
|
|
1348
1356
|
access: "public"
|
|
1349
1357
|
},
|
package/dist/index.d.cts
CHANGED
|
@@ -712,7 +712,7 @@ interface IKinotic {
|
|
|
712
712
|
eventBus: IEventBus;
|
|
713
713
|
/**
|
|
714
714
|
* The zone prefix every service published by this client registers under, such as
|
|
715
|
-
* `app.<organizationId>.<applicationId>` for an application or `system` for a
|
|
715
|
+
* `app.<organizationId>.<applicationId>` for an application or `system` for a system
|
|
716
716
|
* workload. Must be set from static configuration before service classes are instantiated.
|
|
717
717
|
* When null, services register at un-zoned legacy addresses.
|
|
718
718
|
*/
|
|
@@ -1477,7 +1477,7 @@ declare class ParticipantConstants {
|
|
|
1477
1477
|
static readonly PARTICIPANT_TYPE_USER: string;
|
|
1478
1478
|
/** A client (CLI, MCP host) acting on behalf of a user that authorized it. */
|
|
1479
1479
|
static readonly PARTICIPANT_TYPE_DELEGATE: string;
|
|
1480
|
-
/** A non-human caller with its own credential — a
|
|
1480
|
+
/** A non-human caller with its own credential — a system daemon or an external API client. */
|
|
1481
1481
|
static readonly PARTICIPANT_TYPE_MACHINE: string;
|
|
1482
1482
|
/** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
|
|
1483
1483
|
static readonly CLI_PARTICIPANT_ID: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -712,7 +712,7 @@ interface IKinotic {
|
|
|
712
712
|
eventBus: IEventBus;
|
|
713
713
|
/**
|
|
714
714
|
* The zone prefix every service published by this client registers under, such as
|
|
715
|
-
* `app.<organizationId>.<applicationId>` for an application or `system` for a
|
|
715
|
+
* `app.<organizationId>.<applicationId>` for an application or `system` for a system
|
|
716
716
|
* workload. Must be set from static configuration before service classes are instantiated.
|
|
717
717
|
* When null, services register at un-zoned legacy addresses.
|
|
718
718
|
*/
|
|
@@ -1477,7 +1477,7 @@ declare class ParticipantConstants {
|
|
|
1477
1477
|
static readonly PARTICIPANT_TYPE_USER: string;
|
|
1478
1478
|
/** A client (CLI, MCP host) acting on behalf of a user that authorized it. */
|
|
1479
1479
|
static readonly PARTICIPANT_TYPE_DELEGATE: string;
|
|
1480
|
-
/** A non-human caller with its own credential — a
|
|
1480
|
+
/** A non-human caller with its own credential — a system daemon or an external API client. */
|
|
1481
1481
|
static readonly PARTICIPANT_TYPE_MACHINE: string;
|
|
1482
1482
|
/** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
|
|
1483
1483
|
static readonly CLI_PARTICIPANT_ID: string;
|
package/dist/index.js
CHANGED
|
@@ -75,14 +75,19 @@ class StompActivation {
|
|
|
75
75
|
preparedSocket = null;
|
|
76
76
|
attempt = null;
|
|
77
77
|
failPending = null;
|
|
78
|
+
abortController = new AbortController;
|
|
78
79
|
subscriptions = [];
|
|
79
80
|
get ended() {
|
|
80
81
|
return this._ended;
|
|
81
82
|
}
|
|
83
|
+
get signal() {
|
|
84
|
+
return this.abortController.signal;
|
|
85
|
+
}
|
|
82
86
|
end() {
|
|
83
87
|
this._ended = true;
|
|
84
88
|
this.wake?.();
|
|
85
89
|
this.wake = null;
|
|
90
|
+
this.abortController.abort();
|
|
86
91
|
}
|
|
87
92
|
delay(ms) {
|
|
88
93
|
return new Promise((resolve) => {
|
|
@@ -230,9 +235,9 @@ class StompConnectionManager {
|
|
|
230
235
|
activation.own(this.rxStomp.webSocketErrors$.subscribe((value) => {
|
|
231
236
|
this.lastWebsocketError = value;
|
|
232
237
|
}));
|
|
233
|
-
activation.own(this.rxStomp.stompErrors$.subscribe(
|
|
238
|
+
activation.own(this.rxStomp.stompErrors$.subscribe((frame) => {
|
|
234
239
|
const stompError = new Error(frame.headers["message"], { cause: frame });
|
|
235
|
-
|
|
240
|
+
this.failConnection(activation, new Error("STOMP connection error", { cause: stompError }));
|
|
236
241
|
}));
|
|
237
242
|
activation.own(this.rxStomp.connected$.subscribe(() => {
|
|
238
243
|
activation.established();
|
|
@@ -240,19 +245,19 @@ class StompConnectionManager {
|
|
|
240
245
|
this.connectionAttempts = 0;
|
|
241
246
|
}));
|
|
242
247
|
activation.pending(reject);
|
|
243
|
-
activation.own(this.rxStomp.serverHeaders$.pipe(skip(this.rxStompHasConnected ? 1 : 0)).subscribe(
|
|
248
|
+
activation.own(this.rxStomp.serverHeaders$.pipe(skip(this.rxStompHasConnected ? 1 : 0)).subscribe((value) => {
|
|
244
249
|
this.rxStompHasConnected = true;
|
|
245
250
|
const connectedInfoJson = value["connected-info" /* CONNECTED_INFO_HEADER */];
|
|
246
251
|
if (connectedInfoJson == null) {
|
|
247
252
|
if (!this.initialConnectionSuccessful) {
|
|
248
|
-
|
|
253
|
+
this.failConnection(activation, new Error("Server did not return proper data for successful login"));
|
|
249
254
|
}
|
|
250
255
|
return;
|
|
251
256
|
}
|
|
252
257
|
const connectedInfo = JSON.parse(connectedInfoJson);
|
|
253
258
|
if (connectedInfo.replyToId == null) {
|
|
254
259
|
if (!this.initialConnectionSuccessful) {
|
|
255
|
-
|
|
260
|
+
this.failConnection(activation, new Error("Server did not return a replyToId for successful login"));
|
|
256
261
|
}
|
|
257
262
|
return;
|
|
258
263
|
}
|
|
@@ -290,9 +295,12 @@ class StompConnectionManager {
|
|
|
290
295
|
if (!usesPreparedSocket) {
|
|
291
296
|
const sessionCheckUrl = buildServerUrl(server, "http") + SESSION_CHECK_PATH;
|
|
292
297
|
try {
|
|
293
|
-
const res = await fetch(sessionCheckUrl, {
|
|
298
|
+
const res = await fetch(sessionCheckUrl, {
|
|
299
|
+
credentials: "include",
|
|
300
|
+
signal: AbortSignal.any([activation.signal, AbortSignal.timeout(this.CONNECTION_TIMEOUT)])
|
|
301
|
+
});
|
|
294
302
|
if (res.status === 401) {
|
|
295
|
-
|
|
303
|
+
this.failConnection(activation, new Error("Authentication required"));
|
|
296
304
|
return;
|
|
297
305
|
}
|
|
298
306
|
} catch (e) {
|
|
@@ -310,19 +318,19 @@ class StompConnectionManager {
|
|
|
310
318
|
try {
|
|
311
319
|
activation.preparedSocket = await userWebSocketFactory();
|
|
312
320
|
} catch (e) {
|
|
313
|
-
|
|
321
|
+
this.failConnection(activation, new Error("WebSocket factory failed", { cause: e }));
|
|
314
322
|
}
|
|
315
323
|
} else if (headerAuth) {
|
|
316
324
|
try {
|
|
317
325
|
const resolved = await credentialsResolver.resolve(server);
|
|
318
326
|
if (resolved?.authHeaders == null) {
|
|
319
|
-
|
|
327
|
+
this.failConnection(activation, new Error("Credentials resolver no longer supplies auth headers: " + credentialsResolver.name));
|
|
320
328
|
} else {
|
|
321
329
|
const WS = WebSocket;
|
|
322
330
|
activation.preparedSocket = new WS(url, { headers: resolved.authHeaders });
|
|
323
331
|
}
|
|
324
332
|
} catch (e) {
|
|
325
|
-
|
|
333
|
+
this.failConnection(activation, new Error("Credential resolution failed", { cause: e }));
|
|
326
334
|
}
|
|
327
335
|
}
|
|
328
336
|
if (activation.ended && activation.preparedSocket) {
|
|
@@ -362,10 +370,10 @@ class StompConnectionManager {
|
|
|
362
370
|
await activation.delay(randomJitter);
|
|
363
371
|
}
|
|
364
372
|
}
|
|
365
|
-
|
|
373
|
+
failConnection(activation, err) {
|
|
366
374
|
if (!activation.ended) {
|
|
367
375
|
this.debugLogger("Connection failed, ending it: %O", err);
|
|
368
|
-
|
|
376
|
+
this.deactivate(undefined, err).catch((e) => this.debugLogger("Closing the failed connection failed: %O", e));
|
|
369
377
|
}
|
|
370
378
|
}
|
|
371
379
|
}
|
|
@@ -1187,7 +1195,7 @@ import opentelemetry, { context as context2, propagation as propagation2, trace,
|
|
|
1187
1195
|
// packages/core/package.json
|
|
1188
1196
|
var package_default = {
|
|
1189
1197
|
name: "@kinotic-ai/core",
|
|
1190
|
-
version: "5.0.0-beta.
|
|
1198
|
+
version: "5.0.0-beta.29",
|
|
1191
1199
|
type: "module",
|
|
1192
1200
|
files: [
|
|
1193
1201
|
"dist"
|
|
@@ -1224,7 +1232,7 @@ var package_default = {
|
|
|
1224
1232
|
url: "git+https://github.com/kinotic-ai/kinotic.git",
|
|
1225
1233
|
directory: "kinotic-js/workspace/packages/core"
|
|
1226
1234
|
},
|
|
1227
|
-
license: "
|
|
1235
|
+
license: "Apache-2.0",
|
|
1228
1236
|
publishConfig: {
|
|
1229
1237
|
access: "public"
|
|
1230
1238
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "git+https://github.com/kinotic-ai/kinotic.git",
|
|
38
38
|
"directory": "kinotic-js/workspace/packages/core"
|
|
39
39
|
},
|
|
40
|
-
"license": "
|
|
40
|
+
"license": "Apache-2.0",
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"vitest": "^4.1.4"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@kinotic-ai/idl": "^5.0.0-beta.
|
|
72
|
+
"@kinotic-ai/idl": "^5.0.0-beta.6",
|
|
73
73
|
"@opentelemetry/api": "^1.9.1",
|
|
74
74
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
75
75
|
"@stomp/rx-stomp": "^2.4.0",
|