@morty-build/cli 0.4.25 → 0.4.27
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/{chunk-W2BJCOIK.js → chunk-GWFNC4EE.js} +2 -2
- package/dist/{chunk-W2BJCOIK.js.map → chunk-GWFNC4EE.js.map} +1 -1
- package/dist/{chunk-6A4OP5YI.js → chunk-MLX3QFGN.js} +329 -81
- package/dist/{chunk-6A4OP5YI.js.map → chunk-MLX3QFGN.js.map} +4 -4
- package/dist/{cli-OXWTNQXD.js → cli-CZVTD2M2.js} +3 -3
- package/dist/cli.js +2 -2
- package/dist/engine/runtime/command/registry/interactions.d.ts.map +1 -1
- package/dist/engine/runtime/command/registry/interactions.js +113 -35
- package/dist/engine/runtime/command/registry/interactions.js.map +1 -1
- package/dist/engine/runtime/command/registry/prompt.d.ts.map +1 -1
- package/dist/engine/runtime/command/registry/prompt.js +38 -7
- package/dist/engine/runtime/command/registry/prompt.js.map +1 -1
- package/dist/engine/runtime/command/turn-replies.d.ts +27 -0
- package/dist/engine/runtime/command/turn-replies.d.ts.map +1 -0
- package/dist/engine/runtime/command/turn-replies.js +44 -0
- package/dist/engine/runtime/command/turn-replies.js.map +1 -0
- package/dist/engine/runtime/relay/run-relay-connection.d.ts.map +1 -1
- package/dist/engine/runtime/relay/run-relay-connection.js +25 -1
- package/dist/engine/runtime/relay/run-relay-connection.js.map +1 -1
- package/dist/engine/runtime/relay/session-event-publisher.d.ts +0 -1
- package/dist/engine/runtime/relay/session-event-publisher.d.ts.map +1 -1
- package/dist/engine/runtime/relay/session-event-publisher.js +0 -3
- package/dist/engine/runtime/relay/session-event-publisher.js.map +1 -1
- package/dist/engine/session/api/session-api.d.ts +0 -1
- package/dist/engine/session/api/session-api.d.ts.map +1 -1
- package/dist/engine/session/api/session-layer.d.ts.map +1 -1
- package/dist/engine/session/api/session-layer.js +1 -2
- package/dist/engine/session/api/session-layer.js.map +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.d.ts +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.d.ts.map +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.js +3 -9
- package/dist/engine/session/prompt/prompt-lifecycle.js.map +1 -1
- package/dist/engine/session/turn/execution-receipts.d.ts +6 -0
- package/dist/engine/session/turn/execution-receipts.d.ts.map +1 -1
- package/dist/engine/session/turn/execution-receipts.js +56 -6
- package/dist/engine/session/turn/execution-receipts.js.map +1 -1
- package/dist/engine.js +2 -2
- package/package.json +1 -1
- /package/dist/{cli-OXWTNQXD.js.map → cli-CZVTD2M2.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__export,
|
|
4
4
|
__using,
|
|
5
5
|
package_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GWFNC4EE.js";
|
|
7
7
|
|
|
8
8
|
// src/engine/runtime/relay/runtime-revocation.ts
|
|
9
9
|
var runtimeRevocationCloseCode = 1008;
|
|
@@ -20402,6 +20402,7 @@ var SESSION_PERMISSION_RESOLVED_KIND = "session.permission.resolved";
|
|
|
20402
20402
|
var SESSION_ELICITATION_REQUESTED_KIND = "session.elicitation.requested";
|
|
20403
20403
|
var SESSION_ELICITATION_RESPOND_KIND = "session.elicitation.respond";
|
|
20404
20404
|
var SESSION_ELICITATION_RESOLVED_KIND = "session.elicitation.resolved";
|
|
20405
|
+
var SESSION_INTERACTION_ANSWERED_KIND = "session.interaction.answered";
|
|
20405
20406
|
var permissionOptionSchema = external_exports.object({
|
|
20406
20407
|
kind: external_exports.enum(["allow_once", "allow_always", "reject_once", "reject_always"]),
|
|
20407
20408
|
name: external_exports.string().min(1).max(255),
|
|
@@ -20451,6 +20452,7 @@ var sessionPermissionRespondCommandSchema = external_exports.object({
|
|
|
20451
20452
|
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
20452
20453
|
optionId: external_exports.string().max(255),
|
|
20453
20454
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
20455
|
+
requestId: identifierStringSchema,
|
|
20454
20456
|
sessionId: identifierStringSchema
|
|
20455
20457
|
}).readonly();
|
|
20456
20458
|
var sessionPermissionResolvedEventSchema = external_exports.object({
|
|
@@ -20477,6 +20479,7 @@ var sessionElicitationRespondCommandSchema = external_exports.object({
|
|
|
20477
20479
|
content: external_exports.string().max(1e5),
|
|
20478
20480
|
interactionId: identifierStringSchema,
|
|
20479
20481
|
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
20482
|
+
requestId: identifierStringSchema,
|
|
20480
20483
|
sessionId: identifierStringSchema
|
|
20481
20484
|
}).readonly();
|
|
20482
20485
|
var sessionElicitationResolvedEventSchema = external_exports.object({
|
|
@@ -20485,10 +20488,18 @@ var sessionElicitationResolvedEventSchema = external_exports.object({
|
|
|
20485
20488
|
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
20486
20489
|
sessionId: identifierStringSchema
|
|
20487
20490
|
}).readonly();
|
|
20491
|
+
var sessionInteractionAnsweredEventSchema = external_exports.object({
|
|
20492
|
+
interactionId: identifierStringSchema,
|
|
20493
|
+
kind: external_exports.literal(SESSION_INTERACTION_ANSWERED_KIND),
|
|
20494
|
+
requestId: identifierStringSchema,
|
|
20495
|
+
sessionId: identifierStringSchema
|
|
20496
|
+
}).readonly();
|
|
20488
20497
|
var decodeSessionPermissionRespondCommand = (encoded) => decodeZodMessage(encoded, sessionPermissionRespondCommandSchema);
|
|
20489
20498
|
var encodeSessionPermissionRespondCommand = (message) => encodeZodMessage(message, sessionPermissionRespondCommandSchema);
|
|
20490
20499
|
var decodeSessionElicitationRespondCommand = (encoded) => decodeZodMessage(encoded, sessionElicitationRespondCommandSchema);
|
|
20491
20500
|
var encodeSessionElicitationRespondCommand = (message) => encodeZodMessage(message, sessionElicitationRespondCommandSchema);
|
|
20501
|
+
var decodeSessionInteractionAnsweredEvent = (encoded) => decodeZodMessage(encoded, sessionInteractionAnsweredEventSchema);
|
|
20502
|
+
var encodeSessionInteractionAnsweredEvent = (message) => encodeZodMessage(message, sessionInteractionAnsweredEventSchema);
|
|
20492
20503
|
|
|
20493
20504
|
// ../client/src/protocol/session/events/index.ts
|
|
20494
20505
|
var MAX_EVENT_COUNT = 1e4;
|
|
@@ -21316,6 +21327,9 @@ var SESSION_PROMPT_KIND = "session.prompt";
|
|
|
21316
21327
|
var SESSION_PROMPT_DISPOSITION_KIND = "session.prompt.disposition";
|
|
21317
21328
|
var SESSION_CANCEL_KIND = "session.cancel";
|
|
21318
21329
|
var SESSION_CANCEL_BEFORE_START_KIND = "session.cancel-before-start";
|
|
21330
|
+
var SESSION_PROMPT_STEERED_KIND = "session.prompt.steered";
|
|
21331
|
+
var SESSION_TURN_STOPPED_KIND = "session.turn.stopped";
|
|
21332
|
+
var SESSION_TURN_WITHDRAWN_KIND = "session.turn.withdrawn";
|
|
21319
21333
|
var SessionPromptDisposition = Object.freeze({
|
|
21320
21334
|
Append: "append",
|
|
21321
21335
|
Steer: "steer"
|
|
@@ -21332,6 +21346,7 @@ function decodeSessionCancelBeforeStartCommand(encoded) {
|
|
|
21332
21346
|
return {
|
|
21333
21347
|
commandId: readIdentifier(value, "commandId"),
|
|
21334
21348
|
kind: SESSION_CANCEL_BEFORE_START_KIND,
|
|
21349
|
+
requestId: readIdentifier(value, "requestId"),
|
|
21335
21350
|
sessionId: readIdentifier(value, "sessionId")
|
|
21336
21351
|
};
|
|
21337
21352
|
}
|
|
@@ -21407,6 +21422,7 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
21407
21422
|
return {
|
|
21408
21423
|
commandId: readIdentifier(value, "commandId"),
|
|
21409
21424
|
kind: SESSION_CANCEL_KIND,
|
|
21425
|
+
requestId: readIdentifier(value, "requestId"),
|
|
21410
21426
|
sessionId: readIdentifier(value, "sessionId")
|
|
21411
21427
|
};
|
|
21412
21428
|
}
|
|
@@ -21420,6 +21436,7 @@ function decodeSessionPromptDispositionCommand(encoded) {
|
|
|
21420
21436
|
commandId: readIdentifier(value, "commandId"),
|
|
21421
21437
|
disposition: SessionPromptDisposition.Steer,
|
|
21422
21438
|
kind: SESSION_PROMPT_DISPOSITION_KIND,
|
|
21439
|
+
requestId: readIdentifier(value, "requestId"),
|
|
21423
21440
|
sessionId: readIdentifier(value, "sessionId")
|
|
21424
21441
|
};
|
|
21425
21442
|
}
|
|
@@ -21432,6 +21449,20 @@ function encodeSessionCancelCommand(message) {
|
|
|
21432
21449
|
function encodeSessionPromptDispositionCommand(message) {
|
|
21433
21450
|
return JSON.stringify(decodeSessionPromptDispositionCommand(JSON.stringify(message)));
|
|
21434
21451
|
}
|
|
21452
|
+
var turnReplyFields = {
|
|
21453
|
+
commandId: identifierStringSchema,
|
|
21454
|
+
requestId: identifierStringSchema,
|
|
21455
|
+
sessionId: identifierStringSchema
|
|
21456
|
+
};
|
|
21457
|
+
var sessionPromptSteeredEventSchema = external_exports.object({ ...turnReplyFields, kind: external_exports.literal(SESSION_PROMPT_STEERED_KIND) }).readonly();
|
|
21458
|
+
var sessionTurnStoppedEventSchema = external_exports.object({ ...turnReplyFields, kind: external_exports.literal(SESSION_TURN_STOPPED_KIND), stopReason: external_exports.string().min(1).max(128) }).readonly();
|
|
21459
|
+
var sessionTurnWithdrawnEventSchema = external_exports.object({ ...turnReplyFields, kind: external_exports.literal(SESSION_TURN_WITHDRAWN_KIND) }).readonly();
|
|
21460
|
+
var decodeSessionPromptSteeredEvent = (encoded) => decodeZodMessage(encoded, sessionPromptSteeredEventSchema);
|
|
21461
|
+
var encodeSessionPromptSteeredEvent = (message) => encodeZodMessage(message, sessionPromptSteeredEventSchema);
|
|
21462
|
+
var decodeSessionTurnStoppedEvent = (encoded) => decodeZodMessage(encoded, sessionTurnStoppedEventSchema);
|
|
21463
|
+
var encodeSessionTurnStoppedEvent = (message) => encodeZodMessage(message, sessionTurnStoppedEventSchema);
|
|
21464
|
+
var decodeSessionTurnWithdrawnEvent = (encoded) => decodeZodMessage(encoded, sessionTurnWithdrawnEventSchema);
|
|
21465
|
+
var encodeSessionTurnWithdrawnEvent = (message) => encodeZodMessage(message, sessionTurnWithdrawnEventSchema);
|
|
21435
21466
|
|
|
21436
21467
|
// ../client/src/protocol/session/native/index.ts
|
|
21437
21468
|
var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
@@ -22051,6 +22082,26 @@ var daemonToServiceSignatures = {
|
|
|
22051
22082
|
encodeSessionPromptAcceptedEvent,
|
|
22052
22083
|
decodeSessionPromptAcceptedEvent
|
|
22053
22084
|
),
|
|
22085
|
+
[SESSION_PROMPT_STEERED_KIND]: defineMessageSignature(
|
|
22086
|
+
SESSION_PROMPT_STEERED_KIND,
|
|
22087
|
+
encodeSessionPromptSteeredEvent,
|
|
22088
|
+
decodeSessionPromptSteeredEvent
|
|
22089
|
+
),
|
|
22090
|
+
[SESSION_TURN_STOPPED_KIND]: defineMessageSignature(
|
|
22091
|
+
SESSION_TURN_STOPPED_KIND,
|
|
22092
|
+
encodeSessionTurnStoppedEvent,
|
|
22093
|
+
decodeSessionTurnStoppedEvent
|
|
22094
|
+
),
|
|
22095
|
+
[SESSION_TURN_WITHDRAWN_KIND]: defineMessageSignature(
|
|
22096
|
+
SESSION_TURN_WITHDRAWN_KIND,
|
|
22097
|
+
encodeSessionTurnWithdrawnEvent,
|
|
22098
|
+
decodeSessionTurnWithdrawnEvent
|
|
22099
|
+
),
|
|
22100
|
+
[SESSION_INTERACTION_ANSWERED_KIND]: defineMessageSignature(
|
|
22101
|
+
SESSION_INTERACTION_ANSWERED_KIND,
|
|
22102
|
+
encodeSessionInteractionAnsweredEvent,
|
|
22103
|
+
decodeSessionInteractionAnsweredEvent
|
|
22104
|
+
),
|
|
22054
22105
|
[SESSION_HISTORY_PAGE_LOADED_KIND]: defineMessageSignature(
|
|
22055
22106
|
SESSION_HISTORY_PAGE_LOADED_KIND,
|
|
22056
22107
|
encodeSessionHistoryPageLoaded,
|
|
@@ -92717,7 +92768,7 @@ var PromptLifecycle = class {
|
|
|
92717
92768
|
if (request?.sessionId !== sessionId || this.#executions.isTerminalExecution(commandId, sessionId)) {
|
|
92718
92769
|
return;
|
|
92719
92770
|
}
|
|
92720
|
-
|
|
92771
|
+
await this.#recordLifecycle(sessionId, {
|
|
92721
92772
|
type: "lifecycle-metadata",
|
|
92722
92773
|
payload: {
|
|
92723
92774
|
kind: "prompt.completed",
|
|
@@ -92726,14 +92777,6 @@ var PromptLifecycle = class {
|
|
|
92726
92777
|
...this.#executions.hasStarted(commandId, sessionId) ? {} : { execution: "not-started" }
|
|
92727
92778
|
}
|
|
92728
92779
|
});
|
|
92729
|
-
if (!recorded) {
|
|
92730
|
-
this.#sink.publishOperationFailure(
|
|
92731
|
-
sessionId,
|
|
92732
|
-
commandId,
|
|
92733
|
-
"cancelled",
|
|
92734
|
-
"The prompt was cancelled before execution"
|
|
92735
|
-
);
|
|
92736
|
-
}
|
|
92737
92780
|
};
|
|
92738
92781
|
/**
|
|
92739
92782
|
* Settles a failed command; whether it failed before or after starting is its receipt's fact. The unsettled
|
|
@@ -92744,13 +92787,10 @@ var PromptLifecycle = class {
|
|
|
92744
92787
|
if (this.#executions.findUnsettledAttemptId(commandId, sessionId) === null) {
|
|
92745
92788
|
return;
|
|
92746
92789
|
}
|
|
92747
|
-
|
|
92790
|
+
await this.#recordLifecycle(sessionId, {
|
|
92748
92791
|
type: "lifecycle-metadata",
|
|
92749
92792
|
payload: this.#executions.hasStarted(commandId, sessionId) ? { kind: "prompt.failed", attemptId, commandId, code, message } : { kind: "prompt.failed-before-start", commandId, code, message }
|
|
92750
92793
|
});
|
|
92751
|
-
if (!recorded || code === SESSION_CLOSED_ERROR_CODE) {
|
|
92752
|
-
this.#sink.publishOperationFailure(sessionId, commandId, code, message);
|
|
92753
|
-
}
|
|
92754
92794
|
};
|
|
92755
92795
|
/** The recorded terminal events of the Session's settled prompts that name the user message they recorded. */
|
|
92756
92796
|
promptOutcomes = (sessionId) => this.#executions.promptOutcomes(sessionId);
|
|
@@ -92860,6 +92900,8 @@ var ExecutionReceipts = class {
|
|
|
92860
92900
|
* ledger keeps the commands unsettled and the next process reports that the restart interrupted them.
|
|
92861
92901
|
*/
|
|
92862
92902
|
#shutdownSettlements = /* @__PURE__ */ new Map();
|
|
92903
|
+
/** Requests waiting for a command's next transition; each listener hears every transition until removed. */
|
|
92904
|
+
#watchers = /* @__PURE__ */ new Map();
|
|
92863
92905
|
#closing = false;
|
|
92864
92906
|
constructor(ledger, onCount = () => void 0) {
|
|
92865
92907
|
this.#ledger = ledger;
|
|
@@ -92881,6 +92923,11 @@ var ExecutionReceipts = class {
|
|
|
92881
92923
|
}
|
|
92882
92924
|
return this.#agentOutcomes.get(commandId) ?? fate.outcome;
|
|
92883
92925
|
};
|
|
92926
|
+
#notify = (commandId, progress) => {
|
|
92927
|
+
for (const listener of [...this.#watchers.get(commandId) ?? []]) {
|
|
92928
|
+
listener(progress);
|
|
92929
|
+
}
|
|
92930
|
+
};
|
|
92884
92931
|
#publishCount = () => {
|
|
92885
92932
|
this.#onCount(this.#ledger.unsettled().filter((commandId) => !this.#shutdownSettlements.has(commandId)).length);
|
|
92886
92933
|
};
|
|
@@ -92898,10 +92945,55 @@ var ExecutionReceipts = class {
|
|
|
92898
92945
|
}
|
|
92899
92946
|
}
|
|
92900
92947
|
this.#publishCount();
|
|
92948
|
+
this.#notify(commandId, "settled");
|
|
92901
92949
|
};
|
|
92902
92950
|
beginShutdown = () => {
|
|
92903
92951
|
this.#closing = true;
|
|
92904
92952
|
};
|
|
92953
|
+
/** Waits for the first transition of the command that `accepts`; the waiter is released when `signal` aborts. */
|
|
92954
|
+
#transition = (commandId, accepts, signal) => new Promise((resolve19, reject2) => {
|
|
92955
|
+
if (signal.aborted) {
|
|
92956
|
+
reject2(signal.reason);
|
|
92957
|
+
return;
|
|
92958
|
+
}
|
|
92959
|
+
const watchers = this.#watchers.get(commandId) ?? /* @__PURE__ */ new Set();
|
|
92960
|
+
const release2 = () => {
|
|
92961
|
+
signal.removeEventListener("abort", aborted2);
|
|
92962
|
+
watchers.delete(listener);
|
|
92963
|
+
if (watchers.size === 0) {
|
|
92964
|
+
this.#watchers.delete(commandId);
|
|
92965
|
+
}
|
|
92966
|
+
};
|
|
92967
|
+
const listener = (progress) => {
|
|
92968
|
+
if (accepts(progress)) {
|
|
92969
|
+
release2();
|
|
92970
|
+
resolve19(progress);
|
|
92971
|
+
}
|
|
92972
|
+
};
|
|
92973
|
+
const aborted2 = () => {
|
|
92974
|
+
release2();
|
|
92975
|
+
reject2(signal.reason);
|
|
92976
|
+
};
|
|
92977
|
+
watchers.add(listener);
|
|
92978
|
+
this.#watchers.set(commandId, watchers);
|
|
92979
|
+
signal.addEventListener("abort", aborted2, { once: true });
|
|
92980
|
+
});
|
|
92981
|
+
/** Where the command stands now, or its next transition: `started` once it started, `settled` once it has ended. */
|
|
92982
|
+
progress = async (commandId, sessionId, signal) => {
|
|
92983
|
+
if (this.isTerminalExecution(commandId, sessionId)) {
|
|
92984
|
+
return "settled";
|
|
92985
|
+
}
|
|
92986
|
+
if (this.hasStarted(commandId, sessionId)) {
|
|
92987
|
+
return "started";
|
|
92988
|
+
}
|
|
92989
|
+
return await this.#transition(commandId, () => true, signal);
|
|
92990
|
+
};
|
|
92991
|
+
/** Resolves once the command has ended. */
|
|
92992
|
+
settlement = async (commandId, sessionId, signal) => {
|
|
92993
|
+
if (!this.isTerminalExecution(commandId, sessionId)) {
|
|
92994
|
+
await this.#transition(commandId, (progress) => progress === "settled", signal);
|
|
92995
|
+
}
|
|
92996
|
+
};
|
|
92905
92997
|
outcome = (commandId) => this.restatedOutcome(commandId)?.event;
|
|
92906
92998
|
/** The outcome the ledger keeps for the command, with the time it was recorded. */
|
|
92907
92999
|
restatedOutcome = (commandId) => {
|
|
@@ -93042,13 +93134,7 @@ var ExecutionReceipts = class {
|
|
|
93042
93134
|
return standing;
|
|
93043
93135
|
}
|
|
93044
93136
|
const outcome = cancelledBeforeStartOutcome(commandId);
|
|
93045
|
-
const commandHash = createHash8("sha256").update(
|
|
93046
|
-
encodeSessionCancelBeforeStartCommand({
|
|
93047
|
-
commandId,
|
|
93048
|
-
kind: "session.cancel-before-start",
|
|
93049
|
-
sessionId
|
|
93050
|
-
})
|
|
93051
|
-
).digest("hex");
|
|
93137
|
+
const commandHash = createHash8("sha256").update(JSON.stringify({ commandId, kind: "session.cancel-before-start", sessionId })).digest("hex");
|
|
93052
93138
|
for (const dropped of this.#ledger.admitCancelled(
|
|
93053
93139
|
{ attemptId: randomUUID15(), commandHash, commandId, sessionId },
|
|
93054
93140
|
JSON.stringify({ ...outcome, recordedAt: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -93069,6 +93155,7 @@ var ExecutionReceipts = class {
|
|
|
93069
93155
|
const payload = event.payload;
|
|
93070
93156
|
if (payload.kind === "prompt.started") {
|
|
93071
93157
|
this.#ledger.start(payload.commandId, event.recordedAt);
|
|
93158
|
+
this.#notify(payload.commandId, "started");
|
|
93072
93159
|
return;
|
|
93073
93160
|
}
|
|
93074
93161
|
if (!isPromptTerminal(payload)) {
|
|
@@ -93171,6 +93258,7 @@ var ExecutionReceipts = class {
|
|
|
93171
93258
|
return command2?.sessionId === sessionId && !isUnsettled(command2.fate);
|
|
93172
93259
|
};
|
|
93173
93260
|
close = () => {
|
|
93261
|
+
this.#watchers.clear();
|
|
93174
93262
|
this.#agentOutcomes.clear();
|
|
93175
93263
|
this.#shutdownSettlements.clear();
|
|
93176
93264
|
};
|
|
@@ -93830,12 +93918,11 @@ function buildSessionLayer(options) {
|
|
|
93830
93918
|
sink,
|
|
93831
93919
|
async (sessionId, event) => {
|
|
93832
93920
|
if (await manager.recordLifecycleEvent(sessionId, event)) {
|
|
93833
|
-
return
|
|
93921
|
+
return;
|
|
93834
93922
|
}
|
|
93835
93923
|
const recorded = events.append(sessionId, event);
|
|
93836
93924
|
operations.record(recorded);
|
|
93837
93925
|
eventProjection.record(recorded);
|
|
93838
|
-
return true;
|
|
93839
93926
|
},
|
|
93840
93927
|
(sessionId, event, recordedAt) => events.append(sessionId, event, recordedAt),
|
|
93841
93928
|
activeSessions.recordSessionEvent,
|
|
@@ -94586,7 +94673,7 @@ var RelayConnectionDiagnostics = class {
|
|
|
94586
94673
|
};
|
|
94587
94674
|
|
|
94588
94675
|
// src/engine/runtime/relay/run-relay-connection.ts
|
|
94589
|
-
import { WebSocket as
|
|
94676
|
+
import { WebSocket as WebSocket9 } from "undici";
|
|
94590
94677
|
|
|
94591
94678
|
// src/engine/runtime/catalog/handle-agent-catalog-discovery.ts
|
|
94592
94679
|
import { WebSocket as WebSocket3 } from "undici";
|
|
@@ -95694,67 +95781,157 @@ var previewHistoryPageLoadCommand = {
|
|
|
95694
95781
|
}
|
|
95695
95782
|
};
|
|
95696
95783
|
|
|
95784
|
+
// src/engine/runtime/command/turn-replies.ts
|
|
95785
|
+
import { WebSocket as WebSocket6 } from "undici";
|
|
95786
|
+
function settledCommand(operations, commandId) {
|
|
95787
|
+
const outcome = operations.outcome(commandId);
|
|
95788
|
+
if (outcome?.type !== "lifecycle-metadata") {
|
|
95789
|
+
return { kind: "unavailable" };
|
|
95790
|
+
}
|
|
95791
|
+
const payload = outcome.payload;
|
|
95792
|
+
switch (payload.kind) {
|
|
95793
|
+
case "prompt.completed":
|
|
95794
|
+
return {
|
|
95795
|
+
kind: "completed",
|
|
95796
|
+
stopReason: payload.stopReason,
|
|
95797
|
+
cancelledBeforeStart: promptCompletion(payload).kind === "cancelled"
|
|
95798
|
+
};
|
|
95799
|
+
case "prompt.failed":
|
|
95800
|
+
case "prompt.failed-before-start":
|
|
95801
|
+
return { kind: "failed", code: payload.code, message: payload.message };
|
|
95802
|
+
default:
|
|
95803
|
+
return { kind: "unavailable" };
|
|
95804
|
+
}
|
|
95805
|
+
}
|
|
95806
|
+
function reply(socket, message) {
|
|
95807
|
+
if (socket.readyState === WebSocket6.OPEN) {
|
|
95808
|
+
send(socket, message);
|
|
95809
|
+
}
|
|
95810
|
+
}
|
|
95811
|
+
function replyFailure(socket, requestId, sessionId, code, message) {
|
|
95812
|
+
reply(socket, { code, kind: "session.operation.failed", message, requestId, sessionId });
|
|
95813
|
+
}
|
|
95814
|
+
function replySettledFailure(socket, requestId, sessionId, settled) {
|
|
95815
|
+
if (settled.kind === "failed") {
|
|
95816
|
+
replyFailure(socket, requestId, sessionId, settled.code, settled.message);
|
|
95817
|
+
return;
|
|
95818
|
+
}
|
|
95819
|
+
replyFailure(
|
|
95820
|
+
socket,
|
|
95821
|
+
requestId,
|
|
95822
|
+
sessionId,
|
|
95823
|
+
"command_result_expired",
|
|
95824
|
+
"The command ended, but its result is no longer available."
|
|
95825
|
+
);
|
|
95826
|
+
}
|
|
95827
|
+
|
|
95697
95828
|
// src/engine/runtime/command/registry/interactions.ts
|
|
95829
|
+
function replyStopped({ operations, socket }, {
|
|
95830
|
+
commandId,
|
|
95831
|
+
requestId,
|
|
95832
|
+
sessionId
|
|
95833
|
+
}) {
|
|
95834
|
+
const settled = settledCommand(operations, commandId);
|
|
95835
|
+
if (settled.kind === "completed") {
|
|
95836
|
+
reply(socket, {
|
|
95837
|
+
commandId,
|
|
95838
|
+
kind: SESSION_TURN_STOPPED_KIND,
|
|
95839
|
+
requestId,
|
|
95840
|
+
sessionId,
|
|
95841
|
+
stopReason: settled.stopReason
|
|
95842
|
+
});
|
|
95843
|
+
return;
|
|
95844
|
+
}
|
|
95845
|
+
replySettledFailure(socket, requestId, sessionId, settled);
|
|
95846
|
+
}
|
|
95698
95847
|
var sessionCancelCommand = {
|
|
95699
95848
|
kind: SESSION_CANCEL_KIND,
|
|
95700
|
-
handle: (
|
|
95849
|
+
handle: (context, message) => {
|
|
95701
95850
|
if (message.kind !== SESSION_CANCEL_KIND) {
|
|
95702
95851
|
throw new Error("Command kind mismatch");
|
|
95703
95852
|
}
|
|
95704
|
-
const
|
|
95705
|
-
|
|
95706
|
-
|
|
95707
|
-
|
|
95708
|
-
|
|
95709
|
-
|
|
95710
|
-
|
|
95711
|
-
|
|
95712
|
-
|
|
95713
|
-
|
|
95714
|
-
|
|
95715
|
-
|
|
95716
|
-
|
|
95853
|
+
const { eventProjection, operations, sessions, sessionTurns, signal, socket } = context;
|
|
95854
|
+
const { commandId, requestId, sessionId } = message;
|
|
95855
|
+
const turn = sessionTurns.get(commandId, sessionId);
|
|
95856
|
+
const stop = async () => {
|
|
95857
|
+
if (turn === void 0) {
|
|
95858
|
+
await settleAbandonedTurn(eventProjection, operations, message);
|
|
95859
|
+
if (!operations.isTerminalExecution(commandId, sessionId)) {
|
|
95860
|
+
replyFailure(socket, requestId, sessionId, "turn_not_active", "The turn is not running.");
|
|
95861
|
+
return;
|
|
95862
|
+
}
|
|
95863
|
+
} else {
|
|
95864
|
+
const cancellation = turn.requestCancellation();
|
|
95865
|
+
if (cancellation.kind === "running") {
|
|
95866
|
+
await sessions.cancelPrompt(sessionId, cancellation.execution, signal);
|
|
95867
|
+
}
|
|
95868
|
+
await operations.settlement(commandId, sessionId, signal);
|
|
95869
|
+
}
|
|
95870
|
+
replyStopped(context, message);
|
|
95871
|
+
};
|
|
95872
|
+
void stop().catch((error62) => {
|
|
95873
|
+
if (!signal.aborted) {
|
|
95874
|
+
reportOperationFailure(socket, requestId, sessionId, error62);
|
|
95875
|
+
}
|
|
95717
95876
|
});
|
|
95718
95877
|
}
|
|
95719
95878
|
};
|
|
95720
95879
|
var sessionCancelBeforeStartCommand = {
|
|
95721
95880
|
kind: SESSION_CANCEL_BEFORE_START_KIND,
|
|
95722
|
-
handle: ({ eventProjection, operations, sessionTurns, socket }, message) => {
|
|
95881
|
+
handle: ({ eventProjection, operations, sessionTurns, signal, socket }, message) => {
|
|
95723
95882
|
if (message.kind !== SESSION_CANCEL_BEFORE_START_KIND) {
|
|
95724
95883
|
throw new Error("Command kind mismatch");
|
|
95725
95884
|
}
|
|
95726
|
-
|
|
95727
|
-
|
|
95728
|
-
|
|
95729
|
-
|
|
95730
|
-
|
|
95731
|
-
|
|
95732
|
-
)
|
|
95885
|
+
const { commandId, requestId, sessionId } = message;
|
|
95886
|
+
const withdrawn = () => reply(socket, { commandId, kind: SESSION_TURN_WITHDRAWN_KIND, requestId, sessionId });
|
|
95887
|
+
const alreadyStarted = () => reportOperationFailure(
|
|
95888
|
+
socket,
|
|
95889
|
+
requestId,
|
|
95890
|
+
sessionId,
|
|
95891
|
+
new SessionError("turn_already_started", "The message already started and could not be withdrawn")
|
|
95892
|
+
);
|
|
95893
|
+
if (operations.hasStarted(commandId, sessionId)) {
|
|
95894
|
+
alreadyStarted();
|
|
95733
95895
|
return;
|
|
95734
95896
|
}
|
|
95735
|
-
const turn = sessionTurns.get(
|
|
95897
|
+
const turn = sessionTurns.get(commandId, sessionId);
|
|
95736
95898
|
if (turn === void 0) {
|
|
95737
|
-
const cancelled = operations.recordCancellationBeforeAdmission(
|
|
95899
|
+
const cancelled = operations.recordCancellationBeforeAdmission(commandId, sessionId);
|
|
95738
95900
|
const outcome = cancelled.kind === "unavailable" || cancelled.kind === "expired" ? void 0 : cancelled.kind === "restated" ? cancelled.outcome.event : cancelled.outcome;
|
|
95739
95901
|
if (outcome?.type === "lifecycle-metadata" && outcome.payload.kind === "prompt.completed" && promptCompletion(outcome.payload).kind === "cancelled") {
|
|
95740
95902
|
if (cancelled.kind === "restated") {
|
|
95741
|
-
eventProjection.restateOutcome(
|
|
95903
|
+
eventProjection.restateOutcome(sessionId, cancelled.outcome);
|
|
95904
|
+
withdrawn();
|
|
95742
95905
|
return;
|
|
95743
95906
|
}
|
|
95744
|
-
void eventProjection.recordOutcome(
|
|
95745
|
-
reportOperationFailure(socket,
|
|
95907
|
+
void eventProjection.recordOutcome(sessionId, outcome).then(withdrawn).catch((error62) => {
|
|
95908
|
+
reportOperationFailure(socket, requestId, sessionId, error62);
|
|
95746
95909
|
});
|
|
95747
95910
|
return;
|
|
95748
95911
|
}
|
|
95749
95912
|
reportOperationFailure(
|
|
95750
95913
|
socket,
|
|
95751
|
-
|
|
95752
|
-
|
|
95914
|
+
requestId,
|
|
95915
|
+
sessionId,
|
|
95753
95916
|
new SessionError("turn_not_active", "The command is not waiting to start")
|
|
95754
95917
|
);
|
|
95755
95918
|
return;
|
|
95756
95919
|
}
|
|
95757
95920
|
turn.requestCancellation();
|
|
95921
|
+
void operations.progress(commandId, sessionId, signal).then((progress) => {
|
|
95922
|
+
if (progress === "started") {
|
|
95923
|
+
alreadyStarted();
|
|
95924
|
+
return;
|
|
95925
|
+
}
|
|
95926
|
+
const settled = settledCommand(operations, commandId);
|
|
95927
|
+
if (settled.kind !== "completed") {
|
|
95928
|
+
replySettledFailure(socket, requestId, sessionId, settled);
|
|
95929
|
+
} else if (settled.cancelledBeforeStart) {
|
|
95930
|
+
withdrawn();
|
|
95931
|
+
} else {
|
|
95932
|
+
alreadyStarted();
|
|
95933
|
+
}
|
|
95934
|
+
}).catch(() => void 0);
|
|
95758
95935
|
}
|
|
95759
95936
|
};
|
|
95760
95937
|
var sessionCloseCommand = {
|
|
@@ -95772,23 +95949,42 @@ var sessionCloseCommand = {
|
|
|
95772
95949
|
};
|
|
95773
95950
|
var promptDispositionCommand = {
|
|
95774
95951
|
kind: SESSION_PROMPT_DISPOSITION_KIND,
|
|
95775
|
-
handle: ({ diagnostics, operations, sessionTurns, socket }, message) => {
|
|
95952
|
+
handle: ({ diagnostics, operations, sessionTurns, signal, socket }, message) => {
|
|
95776
95953
|
if (message.kind !== SESSION_PROMPT_DISPOSITION_KIND) {
|
|
95777
95954
|
throw new Error("Command kind mismatch");
|
|
95778
95955
|
}
|
|
95779
|
-
const
|
|
95956
|
+
const { commandId, requestId, sessionId } = message;
|
|
95957
|
+
const turn = sessionTurns.get(commandId, sessionId);
|
|
95780
95958
|
const result = turn?.promoteQueuedPrompt(message) ?? "unavailable";
|
|
95781
95959
|
if (result === "accepted") {
|
|
95960
|
+
void operations.progress(commandId, sessionId, signal).then((progress) => {
|
|
95961
|
+
if (progress === "started") {
|
|
95962
|
+
reply(socket, { commandId, kind: SESSION_PROMPT_STEERED_KIND, requestId, sessionId });
|
|
95963
|
+
return;
|
|
95964
|
+
}
|
|
95965
|
+
const settled = settledCommand(operations, commandId);
|
|
95966
|
+
if (settled.kind !== "completed") {
|
|
95967
|
+
replySettledFailure(socket, requestId, sessionId, settled);
|
|
95968
|
+
return;
|
|
95969
|
+
}
|
|
95970
|
+
replyFailure(
|
|
95971
|
+
socket,
|
|
95972
|
+
requestId,
|
|
95973
|
+
sessionId,
|
|
95974
|
+
"turn_not_active",
|
|
95975
|
+
"The message ended before it was steered."
|
|
95976
|
+
);
|
|
95977
|
+
}).catch(() => void 0);
|
|
95782
95978
|
return;
|
|
95783
95979
|
}
|
|
95784
|
-
const started = result === "already-started" || operations.hasStarted(
|
|
95980
|
+
const started = result === "already-started" || operations.hasStarted(commandId, sessionId);
|
|
95785
95981
|
const error62 = started ? new SessionError("turn_already_started", "The message already left the queue and could not be steered") : new SessionError("turn_not_active", "The message is no longer waiting to be steered");
|
|
95786
|
-
diagnostics.daemonDiagnostic("session_prompt_disposition_failed",
|
|
95982
|
+
diagnostics.daemonDiagnostic("session_prompt_disposition_failed", commandId, {
|
|
95787
95983
|
code: error62.code,
|
|
95788
|
-
commandId
|
|
95789
|
-
sessionId
|
|
95984
|
+
commandId,
|
|
95985
|
+
sessionId
|
|
95790
95986
|
});
|
|
95791
|
-
reportOperationFailure(socket,
|
|
95987
|
+
reportOperationFailure(socket, requestId, sessionId, error62);
|
|
95792
95988
|
}
|
|
95793
95989
|
};
|
|
95794
95990
|
var permissionRespondCommand = {
|
|
@@ -95797,8 +95993,9 @@ var permissionRespondCommand = {
|
|
|
95797
95993
|
if (message.kind !== SESSION_PERMISSION_RESPOND_KIND) {
|
|
95798
95994
|
throw new Error("Command kind mismatch");
|
|
95799
95995
|
}
|
|
95800
|
-
|
|
95801
|
-
|
|
95996
|
+
const { interactionId, requestId, sessionId } = message;
|
|
95997
|
+
void sessions.respondPermission(message).then(() => reply(socket, { interactionId, kind: SESSION_INTERACTION_ANSWERED_KIND, requestId, sessionId })).catch((error62) => {
|
|
95998
|
+
reportOperationFailure(socket, requestId, sessionId, error62);
|
|
95802
95999
|
});
|
|
95803
96000
|
}
|
|
95804
96001
|
};
|
|
@@ -95808,14 +96005,15 @@ var elicitationRespondCommand = {
|
|
|
95808
96005
|
if (message.kind !== SESSION_ELICITATION_RESPOND_KIND) {
|
|
95809
96006
|
throw new Error("Command kind mismatch");
|
|
95810
96007
|
}
|
|
95811
|
-
|
|
95812
|
-
|
|
96008
|
+
const { interactionId, requestId, sessionId } = message;
|
|
96009
|
+
void sessions.respondElicitation(message).then(() => reply(socket, { interactionId, kind: SESSION_INTERACTION_ANSWERED_KIND, requestId, sessionId })).catch((error62) => {
|
|
96010
|
+
reportOperationFailure(socket, requestId, sessionId, error62);
|
|
95813
96011
|
});
|
|
95814
96012
|
}
|
|
95815
96013
|
};
|
|
95816
96014
|
|
|
95817
96015
|
// src/engine/runtime/command/native-session-requests.ts
|
|
95818
|
-
import { WebSocket as
|
|
96016
|
+
import { WebSocket as WebSocket7 } from "undici";
|
|
95819
96017
|
function createNativeSessionRequestHandler(dependencies) {
|
|
95820
96018
|
const { diagnostics, nativeSessions, signal, socket, timer } = dependencies;
|
|
95821
96019
|
const pending = /* @__PURE__ */ new Map();
|
|
@@ -95866,7 +96064,7 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
95866
96064
|
}
|
|
95867
96065
|
operationSignal.throwIfAborted();
|
|
95868
96066
|
const result = await nativeSessions.execute(command2, operationSignal);
|
|
95869
|
-
if (socket.readyState ===
|
|
96067
|
+
if (socket.readyState === WebSocket7.OPEN) {
|
|
95870
96068
|
send(socket, result);
|
|
95871
96069
|
}
|
|
95872
96070
|
} catch (error62) {
|
|
@@ -96286,7 +96484,7 @@ var sessionPromptCommand = {
|
|
|
96286
96484
|
return;
|
|
96287
96485
|
}
|
|
96288
96486
|
if (receipt.kind === "duplicate") {
|
|
96289
|
-
|
|
96487
|
+
reply(context.socket, {
|
|
96290
96488
|
kind: "session.prompt.accepted",
|
|
96291
96489
|
requestId: message.commandId,
|
|
96292
96490
|
sessionId: message.sessionId,
|
|
@@ -96310,8 +96508,34 @@ var sessionPromptCommand = {
|
|
|
96310
96508
|
}
|
|
96311
96509
|
const turn = context.sessionTurns.start(message, receipt.attemptId);
|
|
96312
96510
|
context.eventProjection.requested(message);
|
|
96511
|
+
const { commandId, sessionId } = message;
|
|
96512
|
+
let answered = false;
|
|
96513
|
+
const accepted = (state) => {
|
|
96514
|
+
if (!answered) {
|
|
96515
|
+
answered = true;
|
|
96516
|
+
reply(context.socket, { kind: "session.prompt.accepted", requestId: commandId, sessionId, state });
|
|
96517
|
+
}
|
|
96518
|
+
};
|
|
96519
|
+
const ended = () => {
|
|
96520
|
+
if (answered) {
|
|
96521
|
+
return;
|
|
96522
|
+
}
|
|
96523
|
+
const settled = settledCommand(context.operations, commandId);
|
|
96524
|
+
if (settled.kind === "completed") {
|
|
96525
|
+
accepted("settled");
|
|
96526
|
+
return;
|
|
96527
|
+
}
|
|
96528
|
+
answered = true;
|
|
96529
|
+
replySettledFailure(context.socket, commandId, sessionId, settled);
|
|
96530
|
+
};
|
|
96531
|
+
const waiting = new AbortController();
|
|
96532
|
+
context.operations.progress(commandId, sessionId, AbortSignal.any([waiting.signal, context.signal])).then((progress) => {
|
|
96533
|
+
if (progress === "started") {
|
|
96534
|
+
accepted("running");
|
|
96535
|
+
}
|
|
96536
|
+
}).catch(() => void 0);
|
|
96313
96537
|
const queueChanged = () => {
|
|
96314
|
-
void context.eventProjection.queueChanged(
|
|
96538
|
+
void context.eventProjection.queueChanged(sessionId, commandId).catch((error62) => {
|
|
96315
96539
|
console.error("Could not record queue change", error62);
|
|
96316
96540
|
});
|
|
96317
96541
|
};
|
|
@@ -96337,12 +96561,15 @@ var sessionPromptCommand = {
|
|
|
96337
96561
|
epoch: turn.epoch,
|
|
96338
96562
|
waitForSessionAdmission: (signal) => context.sessionTurns.admitAndWait(turn, signal, () => {
|
|
96339
96563
|
queueChanged();
|
|
96564
|
+
accepted("queued");
|
|
96340
96565
|
}),
|
|
96341
96566
|
signal: turn.signal,
|
|
96342
96567
|
cancellationRequested: turn.cancellationRequested
|
|
96343
96568
|
}).catch((error62) => {
|
|
96344
96569
|
console.error("Morty daemon turn failed", error62);
|
|
96345
96570
|
}).finally(() => {
|
|
96571
|
+
waiting.abort();
|
|
96572
|
+
ended();
|
|
96346
96573
|
context.sessionTurns.finish(turn);
|
|
96347
96574
|
context.eventProjection.publishTerminal(message.sessionId, message.commandId);
|
|
96348
96575
|
if (turn.enteredQueue()) {
|
|
@@ -96923,7 +97150,7 @@ function createRuntimeCommandDispatcher(options) {
|
|
|
96923
97150
|
}
|
|
96924
97151
|
|
|
96925
97152
|
// src/engine/runtime/relay/connect.ts
|
|
96926
|
-
import { WebSocket as
|
|
97153
|
+
import { WebSocket as WebSocket8 } from "undici";
|
|
96927
97154
|
var CONNECTION_TIMEOUT_MILLISECONDS = 6e4;
|
|
96928
97155
|
var RelayConnectionError = class extends Error {
|
|
96929
97156
|
code;
|
|
@@ -96995,7 +97222,7 @@ function connectRelay(url2, signal, transportFailed = () => void 0) {
|
|
|
96995
97222
|
const endpoint = new URL(url2);
|
|
96996
97223
|
const headers = relayAuthorization(endpoint);
|
|
96997
97224
|
endpoint.searchParams.delete("token");
|
|
96998
|
-
const socket = new
|
|
97225
|
+
const socket = new WebSocket8(endpoint, {
|
|
96999
97226
|
dispatcher,
|
|
97000
97227
|
headers
|
|
97001
97228
|
});
|
|
@@ -97236,7 +97463,7 @@ async function runRelayConnection({
|
|
|
97236
97463
|
timer
|
|
97237
97464
|
});
|
|
97238
97465
|
void reportUpgradeAvailability((result) => {
|
|
97239
|
-
if (socket.readyState ===
|
|
97466
|
+
if (socket.readyState === WebSocket9.OPEN) {
|
|
97240
97467
|
send(socket, result);
|
|
97241
97468
|
}
|
|
97242
97469
|
}, signal).catch((cause) => {
|
|
@@ -97287,14 +97514,14 @@ async function runRelayConnection({
|
|
|
97287
97514
|
};
|
|
97288
97515
|
const connectionLiveness = new RelayConnectionLiveness(timer, {
|
|
97289
97516
|
send: (message) => {
|
|
97290
|
-
if (socket.readyState !==
|
|
97517
|
+
if (socket.readyState !== WebSocket9.OPEN) {
|
|
97291
97518
|
return false;
|
|
97292
97519
|
}
|
|
97293
97520
|
try {
|
|
97294
97521
|
send(socket, message);
|
|
97295
97522
|
return true;
|
|
97296
97523
|
} catch (error62) {
|
|
97297
|
-
if (socket.readyState !==
|
|
97524
|
+
if (socket.readyState !== WebSocket9.OPEN) {
|
|
97298
97525
|
return false;
|
|
97299
97526
|
}
|
|
97300
97527
|
throw error62;
|
|
@@ -97353,6 +97580,7 @@ async function runRelayConnection({
|
|
|
97353
97580
|
diagnostics.daemonDiagnostic("protocol_message_discarded", "unknown", {
|
|
97354
97581
|
reason: "unsupported_message"
|
|
97355
97582
|
});
|
|
97583
|
+
refuseUnsupportedRequest(socket, encoded);
|
|
97356
97584
|
return;
|
|
97357
97585
|
}
|
|
97358
97586
|
const kind = message.kind;
|
|
@@ -97394,9 +97622,32 @@ async function runRelayConnection({
|
|
|
97394
97622
|
relay.release(new Error("Relay connection released"));
|
|
97395
97623
|
}
|
|
97396
97624
|
}
|
|
97625
|
+
function refuseUnsupportedRequest(socket, encoded) {
|
|
97626
|
+
let value;
|
|
97627
|
+
try {
|
|
97628
|
+
value = JSON.parse(encoded);
|
|
97629
|
+
} catch {
|
|
97630
|
+
return;
|
|
97631
|
+
}
|
|
97632
|
+
if (typeof value !== "object" || value === null) {
|
|
97633
|
+
return;
|
|
97634
|
+
}
|
|
97635
|
+
const requestId = Reflect.get(value, "requestId");
|
|
97636
|
+
const sessionId = Reflect.get(value, "sessionId");
|
|
97637
|
+
if (!isIdentifier(requestId)) {
|
|
97638
|
+
return;
|
|
97639
|
+
}
|
|
97640
|
+
replyFailure(
|
|
97641
|
+
socket,
|
|
97642
|
+
requestId,
|
|
97643
|
+
isIdentifier(sessionId) ? sessionId : "",
|
|
97644
|
+
"unsupported_operation",
|
|
97645
|
+
"This Morty Runtime does not support the requested operation."
|
|
97646
|
+
);
|
|
97647
|
+
}
|
|
97397
97648
|
|
|
97398
97649
|
// src/engine/runtime/relay/session-event-publisher.ts
|
|
97399
|
-
import { WebSocket as
|
|
97650
|
+
import { WebSocket as WebSocket10 } from "undici";
|
|
97400
97651
|
var MAX_BUFFERED_BYTES = 32 * 1024 * 1024;
|
|
97401
97652
|
var MAX_PENDING_BYTES2 = 32 * 1024 * 1024;
|
|
97402
97653
|
var MAX_EVENT_BATCH_BYTES = 1024 * 1024;
|
|
@@ -97440,9 +97691,6 @@ var RuntimeSessionEventPublisher = class {
|
|
|
97440
97691
|
this.flushEvents(this.#connection.socket);
|
|
97441
97692
|
}
|
|
97442
97693
|
};
|
|
97443
|
-
publishOperationFailure = (sessionId, requestId, code, message) => {
|
|
97444
|
-
this.#send({ kind: "session.operation.failed", sessionId, requestId, code, message });
|
|
97445
|
-
};
|
|
97446
97694
|
publishStatus = (event) => this.#send(event);
|
|
97447
97695
|
publishInfo = (event) => this.#send(event);
|
|
97448
97696
|
publishClosed = (event) => {
|
|
@@ -97451,7 +97699,7 @@ var RuntimeSessionEventPublisher = class {
|
|
|
97451
97699
|
};
|
|
97452
97700
|
#send = (message) => {
|
|
97453
97701
|
const connection = this.#connection;
|
|
97454
|
-
if (connection.kind !== "connected" || connection.socket.readyState !==
|
|
97702
|
+
if (connection.kind !== "connected" || connection.socket.readyState !== WebSocket10.OPEN) {
|
|
97455
97703
|
return;
|
|
97456
97704
|
}
|
|
97457
97705
|
const socket = connection.socket;
|
|
@@ -97513,7 +97761,7 @@ var RuntimeSessionEventPublisher = class {
|
|
|
97513
97761
|
});
|
|
97514
97762
|
}
|
|
97515
97763
|
const connection = this.#connection;
|
|
97516
|
-
if (connection.kind !== "connected" || connection.socket.readyState !==
|
|
97764
|
+
if (connection.kind !== "connected" || connection.socket.readyState !== WebSocket10.OPEN) {
|
|
97517
97765
|
return;
|
|
97518
97766
|
}
|
|
97519
97767
|
const socket = connection.socket;
|
|
@@ -97552,7 +97800,7 @@ var RuntimeSessionEventPublisher = class {
|
|
|
97552
97800
|
flushEvents = (socket) => {
|
|
97553
97801
|
this.cancelFlush();
|
|
97554
97802
|
const connection = this.#connection;
|
|
97555
|
-
if (connection.kind !== "connected" || connection.socket !== socket || socket.readyState !==
|
|
97803
|
+
if (connection.kind !== "connected" || connection.socket !== socket || socket.readyState !== WebSocket10.OPEN) {
|
|
97556
97804
|
return;
|
|
97557
97805
|
}
|
|
97558
97806
|
let sent = 0;
|
|
@@ -98048,4 +98296,4 @@ export {
|
|
|
98048
98296
|
* MIT Licensed
|
|
98049
98297
|
*)
|
|
98050
98298
|
*/
|
|
98051
|
-
//# sourceMappingURL=chunk-
|
|
98299
|
+
//# sourceMappingURL=chunk-MLX3QFGN.js.map
|