@tylerl0706/ahpx 0.2.8 → 0.2.10
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/dist/bin.js +13 -7
- package/dist/{chunk-B6RV43UP.js → chunk-646D2XNX.js} +119 -3
- package/dist/index.d.ts +20 -18
- package/dist/index.js +25 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createLogger,
|
|
12
12
|
ensureFileUri,
|
|
13
13
|
setVerbose
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-646D2XNX.js";
|
|
15
15
|
|
|
16
16
|
// src/bin.ts
|
|
17
17
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
@@ -2680,26 +2680,32 @@ async function resolveOrCreateSession(client, serverInfo, opts, cfg, cwd, gitRoo
|
|
|
2680
2680
|
function waitForReady(client, sessionUri) {
|
|
2681
2681
|
return new Promise((resolve3, reject) => {
|
|
2682
2682
|
const timeout = setTimeout(() => {
|
|
2683
|
+
cleanup();
|
|
2683
2684
|
reject(new TimeoutError("Timed out waiting for session to be ready"));
|
|
2684
2685
|
}, 3e4);
|
|
2685
|
-
|
|
2686
|
+
const onAction = (envelope) => {
|
|
2686
2687
|
const action = envelope.action;
|
|
2687
2688
|
if (action.type === "session/ready" /* SessionReady */ && action.session === sessionUri) {
|
|
2688
|
-
|
|
2689
|
+
cleanup();
|
|
2689
2690
|
resolve3();
|
|
2690
2691
|
} else if (action.type === "session/creationFailed" /* SessionCreationFailed */ && action.session === sessionUri) {
|
|
2691
|
-
|
|
2692
|
+
cleanup();
|
|
2692
2693
|
const sessionState2 = client.state.getSession(sessionUri);
|
|
2693
2694
|
const errMsg = sessionState2?.creationError?.message ?? "Unknown error";
|
|
2694
2695
|
reject(new AhpxError(`Session creation failed: ${errMsg}`, ExitCode.Error));
|
|
2695
2696
|
}
|
|
2696
|
-
}
|
|
2697
|
+
};
|
|
2698
|
+
const cleanup = () => {
|
|
2699
|
+
clearTimeout(timeout);
|
|
2700
|
+
client.removeListener("action", onAction);
|
|
2701
|
+
};
|
|
2702
|
+
client.on("action", onAction);
|
|
2697
2703
|
const sessionState = client.state.getSession(sessionUri);
|
|
2698
2704
|
if (sessionState?.lifecycle === "ready") {
|
|
2699
|
-
|
|
2705
|
+
cleanup();
|
|
2700
2706
|
resolve3();
|
|
2701
2707
|
} else if (sessionState?.lifecycle === "creationFailed") {
|
|
2702
|
-
|
|
2708
|
+
cleanup();
|
|
2703
2709
|
const errMsg = sessionState?.creationError?.message ?? "Unknown error";
|
|
2704
2710
|
reject(new AhpxError(`Session creation failed: ${errMsg}`, ExitCode.Error));
|
|
2705
2711
|
}
|
|
@@ -39,6 +39,19 @@ var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
|
39
39
|
return ActionType2;
|
|
40
40
|
})(ActionType || {});
|
|
41
41
|
|
|
42
|
+
// src/protocol/notifications.ts
|
|
43
|
+
var AuthRequiredReason = /* @__PURE__ */ ((AuthRequiredReason2) => {
|
|
44
|
+
AuthRequiredReason2["Required"] = "required";
|
|
45
|
+
AuthRequiredReason2["Expired"] = "expired";
|
|
46
|
+
return AuthRequiredReason2;
|
|
47
|
+
})(AuthRequiredReason || {});
|
|
48
|
+
var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
|
|
49
|
+
NotificationType2["SessionAdded"] = "notify/sessionAdded";
|
|
50
|
+
NotificationType2["SessionRemoved"] = "notify/sessionRemoved";
|
|
51
|
+
NotificationType2["AuthRequired"] = "notify/authRequired";
|
|
52
|
+
return NotificationType2;
|
|
53
|
+
})(NotificationType || {});
|
|
54
|
+
|
|
42
55
|
// src/client/protocol.ts
|
|
43
56
|
import { EventEmitter } from "events";
|
|
44
57
|
var RpcError = class extends Error {
|
|
@@ -139,6 +152,12 @@ var ProtocolLayer = class extends EventEmitter {
|
|
|
139
152
|
};
|
|
140
153
|
|
|
141
154
|
// src/protocol/state.ts
|
|
155
|
+
var PolicyState = /* @__PURE__ */ ((PolicyState2) => {
|
|
156
|
+
PolicyState2["Enabled"] = "enabled";
|
|
157
|
+
PolicyState2["Disabled"] = "disabled";
|
|
158
|
+
PolicyState2["Unconfigured"] = "unconfigured";
|
|
159
|
+
return PolicyState2;
|
|
160
|
+
})(PolicyState || {});
|
|
142
161
|
var PendingMessageKind = /* @__PURE__ */ ((PendingMessageKind2) => {
|
|
143
162
|
PendingMessageKind2["Steering"] = "steering";
|
|
144
163
|
PendingMessageKind2["Queued"] = "queued";
|
|
@@ -156,6 +175,18 @@ var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
|
|
|
156
175
|
SessionStatus2["Error"] = "error";
|
|
157
176
|
return SessionStatus2;
|
|
158
177
|
})(SessionStatus || {});
|
|
178
|
+
var TurnState = /* @__PURE__ */ ((TurnState2) => {
|
|
179
|
+
TurnState2["Complete"] = "complete";
|
|
180
|
+
TurnState2["Cancelled"] = "cancelled";
|
|
181
|
+
TurnState2["Error"] = "error";
|
|
182
|
+
return TurnState2;
|
|
183
|
+
})(TurnState || {});
|
|
184
|
+
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
185
|
+
AttachmentType2["File"] = "file";
|
|
186
|
+
AttachmentType2["Directory"] = "directory";
|
|
187
|
+
AttachmentType2["Selection"] = "selection";
|
|
188
|
+
return AttachmentType2;
|
|
189
|
+
})(AttachmentType || {});
|
|
159
190
|
var ResponsePartKind = /* @__PURE__ */ ((ResponsePartKind2) => {
|
|
160
191
|
ResponsePartKind2["Markdown"] = "markdown";
|
|
161
192
|
ResponsePartKind2["ContentRef"] = "contentRef";
|
|
@@ -172,6 +203,32 @@ var ToolCallStatus = /* @__PURE__ */ ((ToolCallStatus2) => {
|
|
|
172
203
|
ToolCallStatus2["Cancelled"] = "cancelled";
|
|
173
204
|
return ToolCallStatus2;
|
|
174
205
|
})(ToolCallStatus || {});
|
|
206
|
+
var ToolCallConfirmationReason = /* @__PURE__ */ ((ToolCallConfirmationReason2) => {
|
|
207
|
+
ToolCallConfirmationReason2["NotNeeded"] = "not-needed";
|
|
208
|
+
ToolCallConfirmationReason2["UserAction"] = "user-action";
|
|
209
|
+
ToolCallConfirmationReason2["Setting"] = "setting";
|
|
210
|
+
return ToolCallConfirmationReason2;
|
|
211
|
+
})(ToolCallConfirmationReason || {});
|
|
212
|
+
var ToolCallCancellationReason = /* @__PURE__ */ ((ToolCallCancellationReason2) => {
|
|
213
|
+
ToolCallCancellationReason2["Denied"] = "denied";
|
|
214
|
+
ToolCallCancellationReason2["Skipped"] = "skipped";
|
|
215
|
+
ToolCallCancellationReason2["ResultDenied"] = "result-denied";
|
|
216
|
+
return ToolCallCancellationReason2;
|
|
217
|
+
})(ToolCallCancellationReason || {});
|
|
218
|
+
var ToolResultContentType = /* @__PURE__ */ ((ToolResultContentType2) => {
|
|
219
|
+
ToolResultContentType2["Text"] = "text";
|
|
220
|
+
ToolResultContentType2["EmbeddedResource"] = "embeddedResource";
|
|
221
|
+
ToolResultContentType2["Resource"] = "resource";
|
|
222
|
+
ToolResultContentType2["FileEdit"] = "fileEdit";
|
|
223
|
+
return ToolResultContentType2;
|
|
224
|
+
})(ToolResultContentType || {});
|
|
225
|
+
var CustomizationStatus = /* @__PURE__ */ ((CustomizationStatus2) => {
|
|
226
|
+
CustomizationStatus2["Loading"] = "loading";
|
|
227
|
+
CustomizationStatus2["Loaded"] = "loaded";
|
|
228
|
+
CustomizationStatus2["Degraded"] = "degraded";
|
|
229
|
+
CustomizationStatus2["Error"] = "error";
|
|
230
|
+
return CustomizationStatus2;
|
|
231
|
+
})(CustomizationStatus || {});
|
|
175
232
|
|
|
176
233
|
// src/client/session-handle.ts
|
|
177
234
|
import { randomUUID } from "crypto";
|
|
@@ -604,17 +661,41 @@ function sessionReducer(state, action, log7) {
|
|
|
604
661
|
}
|
|
605
662
|
return next;
|
|
606
663
|
}
|
|
607
|
-
case "session/delta" /* SessionDelta */:
|
|
608
|
-
|
|
664
|
+
case "session/delta" /* SessionDelta */: {
|
|
665
|
+
const updated = updateResponsePart(state, action.turnId, action.partId, (part) => {
|
|
609
666
|
if (part.kind === "markdown" /* Markdown */) {
|
|
610
667
|
return { ...part, content: part.content + action.content };
|
|
611
668
|
}
|
|
612
669
|
return part;
|
|
613
670
|
});
|
|
614
|
-
|
|
671
|
+
if (updated === state && state.activeTurn && state.activeTurn.id === action.turnId) {
|
|
672
|
+
return {
|
|
673
|
+
...state,
|
|
674
|
+
activeTurn: {
|
|
675
|
+
...state.activeTurn,
|
|
676
|
+
responseParts: [
|
|
677
|
+
...state.activeTurn.responseParts,
|
|
678
|
+
{ kind: "markdown" /* Markdown */, id: action.partId, content: action.content }
|
|
679
|
+
]
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
return updated;
|
|
684
|
+
}
|
|
685
|
+
case "session/responsePart" /* SessionResponsePart */: {
|
|
615
686
|
if (!state.activeTurn || state.activeTurn.id !== action.turnId) {
|
|
616
687
|
return state;
|
|
617
688
|
}
|
|
689
|
+
const newPartId = action.part.kind === "toolCall" /* ToolCall */ ? action.part.toolCall.toolCallId : "id" in action.part ? action.part.id : void 0;
|
|
690
|
+
if (newPartId !== void 0) {
|
|
691
|
+
const exists = state.activeTurn.responseParts.some((p) => {
|
|
692
|
+
const id = p.kind === "toolCall" /* ToolCall */ ? p.toolCall.toolCallId : "id" in p ? p.id : void 0;
|
|
693
|
+
return id === newPartId;
|
|
694
|
+
});
|
|
695
|
+
if (exists) {
|
|
696
|
+
return state;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
618
699
|
return {
|
|
619
700
|
...state,
|
|
620
701
|
activeTurn: {
|
|
@@ -622,6 +703,7 @@ function sessionReducer(state, action, log7) {
|
|
|
622
703
|
responseParts: [...state.activeTurn.responseParts, action.part]
|
|
623
704
|
}
|
|
624
705
|
};
|
|
706
|
+
}
|
|
625
707
|
case "session/turnComplete" /* SessionTurnComplete */:
|
|
626
708
|
return endTurn(state, action.turnId, "complete" /* Complete */, "idle" /* Idle */);
|
|
627
709
|
case "session/turnCancelled" /* SessionTurnCancelled */:
|
|
@@ -904,6 +986,7 @@ var StateMirror = class {
|
|
|
904
986
|
rootState = { agents: [] };
|
|
905
987
|
sessions = /* @__PURE__ */ new Map();
|
|
906
988
|
serverSeq = 0;
|
|
989
|
+
pendingActions = /* @__PURE__ */ new Map();
|
|
907
990
|
/** Current root state (agents, active session count). */
|
|
908
991
|
get root() {
|
|
909
992
|
return this.rootState;
|
|
@@ -922,6 +1005,7 @@ var StateMirror = class {
|
|
|
922
1005
|
}
|
|
923
1006
|
/**
|
|
924
1007
|
* Load a snapshot (from initialize, reconnect, or subscribe).
|
|
1008
|
+
* After registering a session, replays any actions that arrived before the snapshot.
|
|
925
1009
|
*/
|
|
926
1010
|
applySnapshot(snapshot) {
|
|
927
1011
|
if (snapshot.fromSeq > this.serverSeq) {
|
|
@@ -932,6 +1016,21 @@ var StateMirror = class {
|
|
|
932
1016
|
} else if ("summary" in snapshot.state) {
|
|
933
1017
|
const sessionState = snapshot.state;
|
|
934
1018
|
this.sessions.set(snapshot.resource, sessionState);
|
|
1019
|
+
const buffered = this.pendingActions.get(snapshot.resource);
|
|
1020
|
+
if (buffered) {
|
|
1021
|
+
this.pendingActions.delete(snapshot.resource);
|
|
1022
|
+
for (const env of buffered) {
|
|
1023
|
+
if (env.serverSeq > snapshot.fromSeq) {
|
|
1024
|
+
const current = this.sessions.get(snapshot.resource);
|
|
1025
|
+
if (current) {
|
|
1026
|
+
this.sessions.set(
|
|
1027
|
+
snapshot.resource,
|
|
1028
|
+
sessionReducer(current, env.action)
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
935
1034
|
}
|
|
936
1035
|
}
|
|
937
1036
|
/**
|
|
@@ -949,6 +1048,13 @@ var StateMirror = class {
|
|
|
949
1048
|
const current = this.sessions.get(sessionUri);
|
|
950
1049
|
if (current) {
|
|
951
1050
|
this.sessions.set(sessionUri, sessionReducer(current, sessionAction));
|
|
1051
|
+
} else {
|
|
1052
|
+
let buffer = this.pendingActions.get(sessionUri);
|
|
1053
|
+
if (!buffer) {
|
|
1054
|
+
buffer = [];
|
|
1055
|
+
this.pendingActions.set(sessionUri, buffer);
|
|
1056
|
+
}
|
|
1057
|
+
buffer.push(envelope);
|
|
952
1058
|
}
|
|
953
1059
|
}
|
|
954
1060
|
}
|
|
@@ -958,6 +1064,7 @@ var StateMirror = class {
|
|
|
958
1064
|
*/
|
|
959
1065
|
removeSession(uri) {
|
|
960
1066
|
this.sessions.delete(uri);
|
|
1067
|
+
this.pendingActions.delete(uri);
|
|
961
1068
|
}
|
|
962
1069
|
};
|
|
963
1070
|
|
|
@@ -2354,14 +2461,23 @@ function encodeFilePathComponents(filePath) {
|
|
|
2354
2461
|
|
|
2355
2462
|
export {
|
|
2356
2463
|
ActionType,
|
|
2464
|
+
AuthRequiredReason,
|
|
2465
|
+
NotificationType,
|
|
2357
2466
|
RpcError,
|
|
2358
2467
|
RpcTimeoutError,
|
|
2359
2468
|
ProtocolLayer,
|
|
2469
|
+
PolicyState,
|
|
2360
2470
|
PendingMessageKind,
|
|
2361
2471
|
SessionLifecycle,
|
|
2362
2472
|
SessionStatus,
|
|
2473
|
+
TurnState,
|
|
2474
|
+
AttachmentType,
|
|
2363
2475
|
ResponsePartKind,
|
|
2364
2476
|
ToolCallStatus,
|
|
2477
|
+
ToolCallConfirmationReason,
|
|
2478
|
+
ToolCallCancellationReason,
|
|
2479
|
+
ToolResultContentType,
|
|
2480
|
+
CustomizationStatus,
|
|
2365
2481
|
SessionHandle,
|
|
2366
2482
|
StateMirror,
|
|
2367
2483
|
Transport,
|
package/dist/index.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ interface IProtectedResourceMetadata {
|
|
|
111
111
|
*
|
|
112
112
|
* @category Root State
|
|
113
113
|
*/
|
|
114
|
-
declare
|
|
114
|
+
declare enum PolicyState {
|
|
115
115
|
Enabled = "enabled",
|
|
116
116
|
Disabled = "disabled",
|
|
117
117
|
Unconfigured = "unconfigured"
|
|
@@ -181,7 +181,7 @@ interface ISessionModelInfo {
|
|
|
181
181
|
*
|
|
182
182
|
* @category Pending Message Types
|
|
183
183
|
*/
|
|
184
|
-
declare
|
|
184
|
+
declare enum PendingMessageKind {
|
|
185
185
|
/** Injected into the current turn at a convenient point */
|
|
186
186
|
Steering = "steering",
|
|
187
187
|
/** Sent automatically as a new turn after the current turn finishes */
|
|
@@ -207,7 +207,7 @@ interface IPendingMessage {
|
|
|
207
207
|
*
|
|
208
208
|
* @category Session State
|
|
209
209
|
*/
|
|
210
|
-
declare
|
|
210
|
+
declare enum SessionLifecycle {
|
|
211
211
|
Creating = "creating",
|
|
212
212
|
Ready = "ready",
|
|
213
213
|
CreationFailed = "creationFailed"
|
|
@@ -217,7 +217,7 @@ declare const enum SessionLifecycle {
|
|
|
217
217
|
*
|
|
218
218
|
* @category Session State
|
|
219
219
|
*/
|
|
220
|
-
declare
|
|
220
|
+
declare enum SessionStatus {
|
|
221
221
|
Idle = "idle",
|
|
222
222
|
InProgress = "in-progress",
|
|
223
223
|
Error = "error"
|
|
@@ -300,7 +300,7 @@ interface ISessionSummary {
|
|
|
300
300
|
*
|
|
301
301
|
* @category Turn Types
|
|
302
302
|
*/
|
|
303
|
-
declare
|
|
303
|
+
declare enum TurnState {
|
|
304
304
|
Complete = "complete",
|
|
305
305
|
Cancelled = "cancelled",
|
|
306
306
|
Error = "error"
|
|
@@ -310,7 +310,7 @@ declare const enum TurnState {
|
|
|
310
310
|
*
|
|
311
311
|
* @category Turn Types
|
|
312
312
|
*/
|
|
313
|
-
declare
|
|
313
|
+
declare enum AttachmentType {
|
|
314
314
|
File = "file",
|
|
315
315
|
Directory = "directory",
|
|
316
316
|
Selection = "selection"
|
|
@@ -383,7 +383,7 @@ interface IMessageAttachment {
|
|
|
383
383
|
*
|
|
384
384
|
* @category Response Parts
|
|
385
385
|
*/
|
|
386
|
-
declare
|
|
386
|
+
declare enum ResponsePartKind {
|
|
387
387
|
Markdown = "markdown",
|
|
388
388
|
ContentRef = "contentRef",
|
|
389
389
|
ToolCall = "toolCall",
|
|
@@ -457,7 +457,7 @@ type IResponsePart = IMarkdownResponsePart | IResourceReponsePart | IToolCallRes
|
|
|
457
457
|
*
|
|
458
458
|
* @category Tool Call Types
|
|
459
459
|
*/
|
|
460
|
-
declare
|
|
460
|
+
declare enum ToolCallStatus {
|
|
461
461
|
Streaming = "streaming",
|
|
462
462
|
PendingConfirmation = "pending-confirmation",
|
|
463
463
|
Running = "running",
|
|
@@ -474,7 +474,7 @@ declare const enum ToolCallStatus {
|
|
|
474
474
|
*
|
|
475
475
|
* @category Tool Call Types
|
|
476
476
|
*/
|
|
477
|
-
declare
|
|
477
|
+
declare enum ToolCallConfirmationReason {
|
|
478
478
|
NotNeeded = "not-needed",
|
|
479
479
|
UserAction = "user-action",
|
|
480
480
|
Setting = "setting"
|
|
@@ -484,7 +484,7 @@ declare const enum ToolCallConfirmationReason {
|
|
|
484
484
|
*
|
|
485
485
|
* @category Tool Call Types
|
|
486
486
|
*/
|
|
487
|
-
declare
|
|
487
|
+
declare enum ToolCallCancellationReason {
|
|
488
488
|
Denied = "denied",
|
|
489
489
|
Skipped = "skipped",
|
|
490
490
|
ResultDenied = "result-denied"
|
|
@@ -709,7 +709,7 @@ interface IToolAnnotations {
|
|
|
709
709
|
*
|
|
710
710
|
* @category Tool Result Content
|
|
711
711
|
*/
|
|
712
|
-
declare
|
|
712
|
+
declare enum ToolResultContentType {
|
|
713
713
|
Text = "text",
|
|
714
714
|
EmbeddedResource = "embeddedResource",
|
|
715
715
|
Resource = "resource",
|
|
@@ -824,7 +824,7 @@ interface ICustomizationRef {
|
|
|
824
824
|
*
|
|
825
825
|
* @category Customization Types
|
|
826
826
|
*/
|
|
827
|
-
declare
|
|
827
|
+
declare enum CustomizationStatus {
|
|
828
828
|
/** Plugin is being loaded */
|
|
829
829
|
Loading = "loading",
|
|
830
830
|
/** Plugin is fully operational */
|
|
@@ -906,7 +906,7 @@ interface ISnapshot {
|
|
|
906
906
|
*
|
|
907
907
|
* @category Actions
|
|
908
908
|
*/
|
|
909
|
-
declare
|
|
909
|
+
declare enum ActionType {
|
|
910
910
|
RootAgentsChanged = "root/agentsChanged",
|
|
911
911
|
RootActiveSessionsChanged = "root/activeSessionsChanged",
|
|
912
912
|
SessionReady = "session/ready",
|
|
@@ -1551,7 +1551,7 @@ interface IInitializeResult {
|
|
|
1551
1551
|
*
|
|
1552
1552
|
* @category Commands
|
|
1553
1553
|
*/
|
|
1554
|
-
declare
|
|
1554
|
+
declare enum ReconnectResultType {
|
|
1555
1555
|
Replay = "replay",
|
|
1556
1556
|
Snapshot = "snapshot"
|
|
1557
1557
|
}
|
|
@@ -1718,7 +1718,7 @@ interface IListSessionsResult {
|
|
|
1718
1718
|
*
|
|
1719
1719
|
* @category Commands
|
|
1720
1720
|
*/
|
|
1721
|
-
declare
|
|
1721
|
+
declare enum ContentEncoding {
|
|
1722
1722
|
Base64 = "base64",
|
|
1723
1723
|
Utf8 = "utf-8"
|
|
1724
1724
|
}
|
|
@@ -2058,7 +2058,7 @@ interface IAuthenticateResult {
|
|
|
2058
2058
|
*
|
|
2059
2059
|
* @category Protocol Notifications
|
|
2060
2060
|
*/
|
|
2061
|
-
declare
|
|
2061
|
+
declare enum AuthRequiredReason {
|
|
2062
2062
|
/** The client has not yet authenticated for the resource */
|
|
2063
2063
|
Required = "required",
|
|
2064
2064
|
/** A previously valid token has expired or been revoked */
|
|
@@ -2069,7 +2069,7 @@ declare const enum AuthRequiredReason {
|
|
|
2069
2069
|
*
|
|
2070
2070
|
* @category Protocol Notifications
|
|
2071
2071
|
*/
|
|
2072
|
-
declare
|
|
2072
|
+
declare enum NotificationType {
|
|
2073
2073
|
SessionAdded = "notify/sessionAdded",
|
|
2074
2074
|
SessionRemoved = "notify/sessionRemoved",
|
|
2075
2075
|
AuthRequired = "notify/authRequired"
|
|
@@ -2450,6 +2450,7 @@ declare class StateMirror {
|
|
|
2450
2450
|
private rootState;
|
|
2451
2451
|
private sessions;
|
|
2452
2452
|
private serverSeq;
|
|
2453
|
+
private pendingActions;
|
|
2453
2454
|
/** Current root state (agents, active session count). */
|
|
2454
2455
|
get root(): IRootState;
|
|
2455
2456
|
/** Current server sequence number. */
|
|
@@ -2460,6 +2461,7 @@ declare class StateMirror {
|
|
|
2460
2461
|
get sessionUris(): URI[];
|
|
2461
2462
|
/**
|
|
2462
2463
|
* Load a snapshot (from initialize, reconnect, or subscribe).
|
|
2464
|
+
* After registering a session, replays any actions that arrived before the snapshot.
|
|
2463
2465
|
*/
|
|
2464
2466
|
applySnapshot(snapshot: ISnapshot): void;
|
|
2465
2467
|
/**
|
|
@@ -3394,4 +3396,4 @@ declare function ensureFileUri(pathOrUri: string): string;
|
|
|
3394
3396
|
*/
|
|
3395
3397
|
declare function fileUriToDisplayPath(uri: string): string;
|
|
3396
3398
|
|
|
3397
|
-
export { ActionType, ActiveClientManager, AhpClient, type AhpClientEvents, type AhpClientOptions, type AhpxEvent, AuthHandler, type AuthHandlerOptions, ConnectionPool, type ConnectionPoolOptions, type ConnectionProfile, ContentEncoding, type EventForwarder, FleetManager, type FleetManagerOptions, ForwardingFormatter, type ForwardingFormatterOptions, HealthChecker, type IActionEnvelope, type IActiveTurn, type IAgentInfo, type ICreateSessionParams, type ICustomizationRef, type IErrorInfo, type IFetchTurnsResult, type IInitializeResult, type IListSessionsResult, type IMarkdownResponsePart, type IPendingMessage, type IProtocolNotification, type IReasoningResponsePart, type IResourceCopyParams, type IResourceCopyResult, type IResourceDeleteParams, type IResourceDeleteResult, type IResourceListResult, type IResourceMoveParams, type IResourceMoveResult, type IResourceReadResult, type IResourceWriteParams, type IResourceWriteResult, type IResponsePart, type IRootState, type ISessionCustomization, type ISessionForkSource, type ISessionState, type ISessionSummary, type ISnapshot, type IStateAction, type ISubscribeResult, type IToolAnnotations, type IToolCallResponsePart, type IToolCallState, type IToolDefinition, type ITurn, type IUsageInfo, type IUserMessage, type Icon, type OpenSessionOptions, PendingMessageKind, type PromptOptions, ProtocolLayer, type ProtocolLayerOptions, ReconnectManager, type ReconnectOptions, type ReconnectOutcome, ResponsePartKind, type ResumeOutcome, type RoutingStrategy, RpcError, RpcTimeoutError, type ServerHealth, type ServerRequirements, type SessionFilter, SessionHandle, type SessionHandleEvents, SessionLifecycle, SessionPersistence, type SessionRecord, SessionStatus, SessionStore, type TurnResult as SessionTurnResult, StateMirror, type SyncResult, ToolCallStatus, Transport, type TransportOptions, type TurnSummary, type URI, WebSocketForwarder, type WebSocketForwarderOptions, WebhookForwarder, type WebhookForwarderOptions, buildTurnSummary, ensureFileUri, fileUriToDisplayPath, truncatePreview };
|
|
3399
|
+
export { ActionType, ActiveClientManager, AhpClient, type AhpClientEvents, type AhpClientOptions, type AhpxEvent, AttachmentType, AuthHandler, type AuthHandlerOptions, AuthRequiredReason, ConnectionPool, type ConnectionPoolOptions, type ConnectionProfile, ContentEncoding, CustomizationStatus, type EventForwarder, FleetManager, type FleetManagerOptions, ForwardingFormatter, type ForwardingFormatterOptions, HealthChecker, type IActionEnvelope, type IActiveTurn, type IAgentInfo, type ICreateSessionParams, type ICustomizationRef, type IErrorInfo, type IFetchTurnsResult, type IInitializeResult, type IListSessionsResult, type IMarkdownResponsePart, type IPendingMessage, type IProtocolNotification, type IReasoningResponsePart, type IResourceCopyParams, type IResourceCopyResult, type IResourceDeleteParams, type IResourceDeleteResult, type IResourceListResult, type IResourceMoveParams, type IResourceMoveResult, type IResourceReadResult, type IResourceWriteParams, type IResourceWriteResult, type IResponsePart, type IRootState, type ISessionCustomization, type ISessionForkSource, type ISessionState, type ISessionSummary, type ISnapshot, type IStateAction, type ISubscribeResult, type IToolAnnotations, type IToolCallResponsePart, type IToolCallState, type IToolDefinition, type ITurn, type IUsageInfo, type IUserMessage, type Icon, NotificationType, type OpenSessionOptions, PendingMessageKind, PolicyState, type PromptOptions, ProtocolLayer, type ProtocolLayerOptions, ReconnectManager, type ReconnectOptions, type ReconnectOutcome, ReconnectResultType, ResponsePartKind, type ResumeOutcome, type RoutingStrategy, RpcError, RpcTimeoutError, type ServerHealth, type ServerRequirements, type SessionFilter, SessionHandle, type SessionHandleEvents, SessionLifecycle, SessionPersistence, type SessionRecord, SessionStatus, SessionStore, type TurnResult as SessionTurnResult, StateMirror, type SyncResult, ToolCallCancellationReason, ToolCallConfirmationReason, ToolCallStatus, ToolResultContentType, Transport, type TransportOptions, TurnState, type TurnSummary, type URI, WebSocketForwarder, type WebSocketForwarderOptions, WebhookForwarder, type WebhookForwarderOptions, buildTurnSummary, ensureFileUri, fileUriToDisplayPath, truncatePreview };
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,15 @@ import {
|
|
|
2
2
|
ActionType,
|
|
3
3
|
ActiveClientManager,
|
|
4
4
|
AhpClient,
|
|
5
|
+
AttachmentType,
|
|
5
6
|
AuthHandler,
|
|
7
|
+
AuthRequiredReason,
|
|
8
|
+
CustomizationStatus,
|
|
6
9
|
ForwardingFormatter,
|
|
7
10
|
HealthChecker,
|
|
11
|
+
NotificationType,
|
|
8
12
|
PendingMessageKind,
|
|
13
|
+
PolicyState,
|
|
9
14
|
ProtocolLayer,
|
|
10
15
|
ReconnectManager,
|
|
11
16
|
ResponsePartKind,
|
|
@@ -17,15 +22,19 @@ import {
|
|
|
17
22
|
SessionStatus,
|
|
18
23
|
SessionStore,
|
|
19
24
|
StateMirror,
|
|
25
|
+
ToolCallCancellationReason,
|
|
26
|
+
ToolCallConfirmationReason,
|
|
20
27
|
ToolCallStatus,
|
|
28
|
+
ToolResultContentType,
|
|
21
29
|
Transport,
|
|
30
|
+
TurnState,
|
|
22
31
|
WebSocketForwarder,
|
|
23
32
|
WebhookForwarder,
|
|
24
33
|
buildTurnSummary,
|
|
25
34
|
ensureFileUri,
|
|
26
35
|
fileUriToDisplayPath,
|
|
27
36
|
truncatePreview
|
|
28
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-646D2XNX.js";
|
|
29
38
|
|
|
30
39
|
// src/client/connection-pool.ts
|
|
31
40
|
var ConnectionPool = class {
|
|
@@ -191,6 +200,11 @@ var FleetManager = class {
|
|
|
191
200
|
};
|
|
192
201
|
|
|
193
202
|
// src/protocol/commands.ts
|
|
203
|
+
var ReconnectResultType = /* @__PURE__ */ ((ReconnectResultType2) => {
|
|
204
|
+
ReconnectResultType2["Replay"] = "replay";
|
|
205
|
+
ReconnectResultType2["Snapshot"] = "snapshot";
|
|
206
|
+
return ReconnectResultType2;
|
|
207
|
+
})(ReconnectResultType || {});
|
|
194
208
|
var ContentEncoding = /* @__PURE__ */ ((ContentEncoding2) => {
|
|
195
209
|
ContentEncoding2["Base64"] = "base64";
|
|
196
210
|
ContentEncoding2["Utf8"] = "utf-8";
|
|
@@ -200,15 +214,21 @@ export {
|
|
|
200
214
|
ActionType,
|
|
201
215
|
ActiveClientManager,
|
|
202
216
|
AhpClient,
|
|
217
|
+
AttachmentType,
|
|
203
218
|
AuthHandler,
|
|
219
|
+
AuthRequiredReason,
|
|
204
220
|
ConnectionPool,
|
|
205
221
|
ContentEncoding,
|
|
222
|
+
CustomizationStatus,
|
|
206
223
|
FleetManager,
|
|
207
224
|
ForwardingFormatter,
|
|
208
225
|
HealthChecker,
|
|
226
|
+
NotificationType,
|
|
209
227
|
PendingMessageKind,
|
|
228
|
+
PolicyState,
|
|
210
229
|
ProtocolLayer,
|
|
211
230
|
ReconnectManager,
|
|
231
|
+
ReconnectResultType,
|
|
212
232
|
ResponsePartKind,
|
|
213
233
|
RpcError,
|
|
214
234
|
RpcTimeoutError,
|
|
@@ -218,8 +238,12 @@ export {
|
|
|
218
238
|
SessionStatus,
|
|
219
239
|
SessionStore,
|
|
220
240
|
StateMirror,
|
|
241
|
+
ToolCallCancellationReason,
|
|
242
|
+
ToolCallConfirmationReason,
|
|
221
243
|
ToolCallStatus,
|
|
244
|
+
ToolResultContentType,
|
|
222
245
|
Transport,
|
|
246
|
+
TurnState,
|
|
223
247
|
WebSocketForwarder,
|
|
224
248
|
WebhookForwarder,
|
|
225
249
|
buildTurnSummary,
|
package/package.json
CHANGED