@celljs/ta-client 4.13.0 → 4.14.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/esm/common/session-reducer.d.ts +2 -0
- package/esm/common/session-store.js +10 -4
- package/esm/common/ta-connection.d.ts +3 -1
- package/esm/common/ta-connection.js +3 -1
- package/lib/common/session-reducer.d.ts +2 -0
- package/lib/common/session-store.js +10 -4
- package/lib/common/ta-connection.d.ts +3 -1
- package/lib/common/ta-connection.js +2 -0
- package/package.json +4 -4
|
@@ -33,6 +33,8 @@ export interface SessionState {
|
|
|
33
33
|
messages: SessionMessage[];
|
|
34
34
|
/** Where `messages` start in the whole conversation: those before are loaded with `SessionStore.loadEarlier`. */
|
|
35
35
|
start: number;
|
|
36
|
+
/** Earlier messages are on their way (`SessionStore.loadEarlier`): `start` above 0 alone does not say so. */
|
|
37
|
+
loadingEarlier?: boolean;
|
|
36
38
|
/** By tool call id. */
|
|
37
39
|
tools: Record<string, ToolRun>;
|
|
38
40
|
/** Dialogs waiting for an answer. */
|
|
@@ -332,13 +332,18 @@ export class SessionStore {
|
|
|
332
332
|
* at once when it has them all. Called again while they come, it waits for the same.
|
|
333
333
|
*/
|
|
334
334
|
loadEarlier() {
|
|
335
|
-
var _a;
|
|
336
335
|
if (this.current.start === 0) {
|
|
337
336
|
return Promise.resolve();
|
|
338
337
|
}
|
|
339
|
-
|
|
340
|
-
this.loadingEarlier
|
|
341
|
-
|
|
338
|
+
if (!this.loadingEarlier) {
|
|
339
|
+
this.update({ ...this.current, loadingEarlier: true });
|
|
340
|
+
this.loadingEarlier = this.fetchEarlier().finally(() => {
|
|
341
|
+
this.loadingEarlier = undefined;
|
|
342
|
+
if (this.current.loadingEarlier) {
|
|
343
|
+
this.update({ ...this.current, loadingEarlier: false });
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
342
347
|
return this.loadingEarlier;
|
|
343
348
|
}
|
|
344
349
|
/** All the messages of the conversation, for what needs the whole of it (an export). */
|
|
@@ -365,6 +370,7 @@ export class SessionStore {
|
|
|
365
370
|
...this.current,
|
|
366
371
|
messages: [...page.messages, ...this.current.messages],
|
|
367
372
|
start: page.start,
|
|
373
|
+
loadingEarlier: false,
|
|
368
374
|
runStart: runStart === undefined ? undefined : runStart + page.messages.length,
|
|
369
375
|
});
|
|
370
376
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TaAccessServer, type TaAuthEvent, type TaAuthServer, TaErrorCode, type TaErrorData, type TaEventEnvelope, type TaGatewayServer, type TaPackageServer, type TaRelayServer, type TaRemoteEvent, type TaRemoteServer, type TaRoomEvent, type TaRoomServer, type TaServer, type TaSessionInfo, type TaSettingsServer, type TaTerminalServer, type TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
1
|
+
import { type TaAccessServer, type TaAuthEvent, type TaAuthServer, TaErrorCode, type TaErrorData, type TaEventEnvelope, type TaGatewayServer, type TaPackageServer, type TaPresenceServer, type TaRelayServer, type TaRemoteEvent, type TaRemoteServer, type TaRoomEvent, type TaRoomServer, type TaServer, type TaSessionInfo, type TaSettingsServer, type TaTerminalServer, type TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
2
2
|
/**
|
|
3
3
|
* A failed call. `code` is set for failures the server names; `rpcCode` is the code of JSON-RPC's error,
|
|
4
4
|
* by which a client tells a method an older ta serve does not have (`TaRemoteError.METHOD_NOT_FOUND`).
|
|
@@ -123,6 +123,8 @@ export declare class TaConnection {
|
|
|
123
123
|
readonly relay: TaRelayServer;
|
|
124
124
|
readonly remote: TaRemoteServer;
|
|
125
125
|
readonly rooms: TaRoomServer;
|
|
126
|
+
/** What this page is at, for the others in the same Ta (docs/design/ta-team.md 7). */
|
|
127
|
+
readonly presence: TaPresenceServer;
|
|
126
128
|
protected socket?: TaSocket;
|
|
127
129
|
protected closed: boolean;
|
|
128
130
|
protected attempts: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TA_ACCESS_SERVICE, TA_AUTH_SERVICE, TA_CLIENT_SERVICE, TA_GATEWAY_SERVICE, TA_PACKAGE_SERVICE, TA_RELAY_SERVICE, TA_REMOTE_SERVICE, TA_ROOM_SERVICE, TA_SERVER_SERVICE, TA_SETTINGS_SERVICE, TA_TERMINAL_SERVICE, TA_WORKSPACE_SERVICE, TaErrorCode, } from '@celljs/ta-protocol';
|
|
1
|
+
import { TA_ACCESS_SERVICE, TA_AUTH_SERVICE, TA_CLIENT_SERVICE, TA_GATEWAY_SERVICE, TA_PACKAGE_SERVICE, TA_PRESENCE_SERVICE, TA_RELAY_SERVICE, TA_REMOTE_SERVICE, TA_ROOM_SERVICE, TA_SERVER_SERVICE, TA_SETTINGS_SERVICE, TA_TERMINAL_SERVICE, TA_WORKSPACE_SERVICE, TaErrorCode, } from '@celljs/ta-protocol';
|
|
2
2
|
/**
|
|
3
3
|
* A failed call. `code` is set for failures the server names; `rpcCode` is the code of JSON-RPC's error,
|
|
4
4
|
* by which a client tells a method an older ta serve does not have (`TaRemoteError.METHOD_NOT_FOUND`).
|
|
@@ -77,6 +77,8 @@ export class TaConnection {
|
|
|
77
77
|
this.relay = this.service(TA_RELAY_SERVICE);
|
|
78
78
|
this.remote = this.service(TA_REMOTE_SERVICE);
|
|
79
79
|
this.rooms = this.service(TA_ROOM_SERVICE);
|
|
80
|
+
/** What this page is at, for the others in the same Ta (docs/design/ta-team.md 7). */
|
|
81
|
+
this.presence = this.service(TA_PRESENCE_SERVICE);
|
|
80
82
|
this.closed = false;
|
|
81
83
|
this.attempts = 0;
|
|
82
84
|
this.nextId = 0;
|
|
@@ -33,6 +33,8 @@ export interface SessionState {
|
|
|
33
33
|
messages: SessionMessage[];
|
|
34
34
|
/** Where `messages` start in the whole conversation: those before are loaded with `SessionStore.loadEarlier`. */
|
|
35
35
|
start: number;
|
|
36
|
+
/** Earlier messages are on their way (`SessionStore.loadEarlier`): `start` above 0 alone does not say so. */
|
|
37
|
+
loadingEarlier?: boolean;
|
|
36
38
|
/** By tool call id. */
|
|
37
39
|
tools: Record<string, ToolRun>;
|
|
38
40
|
/** Dialogs waiting for an answer. */
|
|
@@ -335,13 +335,18 @@ class SessionStore {
|
|
|
335
335
|
* at once when it has them all. Called again while they come, it waits for the same.
|
|
336
336
|
*/
|
|
337
337
|
loadEarlier() {
|
|
338
|
-
var _a;
|
|
339
338
|
if (this.current.start === 0) {
|
|
340
339
|
return Promise.resolve();
|
|
341
340
|
}
|
|
342
|
-
|
|
343
|
-
this.loadingEarlier
|
|
344
|
-
|
|
341
|
+
if (!this.loadingEarlier) {
|
|
342
|
+
this.update({ ...this.current, loadingEarlier: true });
|
|
343
|
+
this.loadingEarlier = this.fetchEarlier().finally(() => {
|
|
344
|
+
this.loadingEarlier = undefined;
|
|
345
|
+
if (this.current.loadingEarlier) {
|
|
346
|
+
this.update({ ...this.current, loadingEarlier: false });
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
345
350
|
return this.loadingEarlier;
|
|
346
351
|
}
|
|
347
352
|
/** All the messages of the conversation, for what needs the whole of it (an export). */
|
|
@@ -368,6 +373,7 @@ class SessionStore {
|
|
|
368
373
|
...this.current,
|
|
369
374
|
messages: [...page.messages, ...this.current.messages],
|
|
370
375
|
start: page.start,
|
|
376
|
+
loadingEarlier: false,
|
|
371
377
|
runStart: runStart === undefined ? undefined : runStart + page.messages.length,
|
|
372
378
|
});
|
|
373
379
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TaAccessServer, type TaAuthEvent, type TaAuthServer, TaErrorCode, type TaErrorData, type TaEventEnvelope, type TaGatewayServer, type TaPackageServer, type TaRelayServer, type TaRemoteEvent, type TaRemoteServer, type TaRoomEvent, type TaRoomServer, type TaServer, type TaSessionInfo, type TaSettingsServer, type TaTerminalServer, type TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
1
|
+
import { type TaAccessServer, type TaAuthEvent, type TaAuthServer, TaErrorCode, type TaErrorData, type TaEventEnvelope, type TaGatewayServer, type TaPackageServer, type TaPresenceServer, type TaRelayServer, type TaRemoteEvent, type TaRemoteServer, type TaRoomEvent, type TaRoomServer, type TaServer, type TaSessionInfo, type TaSettingsServer, type TaTerminalServer, type TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
2
2
|
/**
|
|
3
3
|
* A failed call. `code` is set for failures the server names; `rpcCode` is the code of JSON-RPC's error,
|
|
4
4
|
* by which a client tells a method an older ta serve does not have (`TaRemoteError.METHOD_NOT_FOUND`).
|
|
@@ -123,6 +123,8 @@ export declare class TaConnection {
|
|
|
123
123
|
readonly relay: TaRelayServer;
|
|
124
124
|
readonly remote: TaRemoteServer;
|
|
125
125
|
readonly rooms: TaRoomServer;
|
|
126
|
+
/** What this page is at, for the others in the same Ta (docs/design/ta-team.md 7). */
|
|
127
|
+
readonly presence: TaPresenceServer;
|
|
126
128
|
protected socket?: TaSocket;
|
|
127
129
|
protected closed: boolean;
|
|
128
130
|
protected attempts: number;
|
|
@@ -81,6 +81,8 @@ class TaConnection {
|
|
|
81
81
|
this.relay = this.service(ta_protocol_1.TA_RELAY_SERVICE);
|
|
82
82
|
this.remote = this.service(ta_protocol_1.TA_REMOTE_SERVICE);
|
|
83
83
|
this.rooms = this.service(ta_protocol_1.TA_ROOM_SERVICE);
|
|
84
|
+
/** What this page is at, for the others in the same Ta (docs/design/ta-team.md 7). */
|
|
85
|
+
this.presence = this.service(ta_protocol_1.TA_PRESENCE_SERVICE);
|
|
84
86
|
this.closed = false;
|
|
85
87
|
this.attempts = 0;
|
|
86
88
|
this.nextId = 0;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0",
|
|
4
4
|
"description": "A client of ta serve for any JavaScript runtime: connection and UI-independent session state",
|
|
5
|
-
"homepage": "https://github.com/cellbang/
|
|
5
|
+
"homepage": "https://github.com/cellbang/ta",
|
|
6
6
|
"bugs": {
|
|
7
|
-
"url": "https://github.com/cellbang/
|
|
7
|
+
"url": "https://github.com/cellbang/ta/issues"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@celljs/ta-protocol": "4.
|
|
32
|
+
"@celljs/ta-protocol": "4.14.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@earendil-works/pi-ai": "^1.5.2",
|