replicas-cli 0.2.667 → 0.2.668
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/index.cjs +27 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22817,6 +22817,21 @@ function coerceAuthFallbackPayload(payload) {
|
|
|
22817
22817
|
}
|
|
22818
22818
|
|
|
22819
22819
|
// ../shared/src/engine/v1.ts
|
|
22820
|
+
var CHAT_STREAM_RESYNC_EVENT_TYPE = "chat.stream.resync";
|
|
22821
|
+
function isChatStreamEvent(value) {
|
|
22822
|
+
return isRecord(value) && typeof value.id === "string" && typeof value.ts === "string" && typeof value.type === "string" && value.type.startsWith("chat.") && isRecord(value.payload);
|
|
22823
|
+
}
|
|
22824
|
+
var ENGINE_CHAT_EVENTS_PUSH_MAX_EVENTS = 500;
|
|
22825
|
+
var chatScopedEngineEventSchema = external_exports.custom(
|
|
22826
|
+
(value) => isChatStreamEvent(value) && value.type !== CHAT_STREAM_RESYNC_EVENT_TYPE
|
|
22827
|
+
);
|
|
22828
|
+
var engineChatEventsPushRequestSchema = external_exports.object({
|
|
22829
|
+
epoch: external_exports.string().min(1).max(64),
|
|
22830
|
+
events: external_exports.array(external_exports.object({
|
|
22831
|
+
seq: external_exports.number().int().positive(),
|
|
22832
|
+
event: chatScopedEngineEventSchema
|
|
22833
|
+
})).max(ENGINE_CHAT_EVENTS_PUSH_MAX_EVENTS)
|
|
22834
|
+
});
|
|
22820
22835
|
function getChatExecutionProvider(chat) {
|
|
22821
22836
|
return chat.provider === "relay" ? chat.relayBaseProvider ?? DEFAULT_RELAY_BASE_PROVIDER : chat.provider;
|
|
22822
22837
|
}
|
|
@@ -26242,11 +26257,13 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
26242
26257
|
const messageKey = messageId || event.timestamp;
|
|
26243
26258
|
const streamRefs = messageId ? partialIndexes.get(messageId) : void 0;
|
|
26244
26259
|
if (messageId) {
|
|
26245
|
-
completedStreamIds.add(messageId);
|
|
26246
26260
|
if (liveStreamId !== null && liveStreamId !== messageId) {
|
|
26247
26261
|
supersededStreamIds.add(liveStreamId);
|
|
26248
26262
|
}
|
|
26249
|
-
|
|
26263
|
+
if (contentBlocks.some((block) => block.type === "text" && block.text)) {
|
|
26264
|
+
completedStreamIds.add(messageId);
|
|
26265
|
+
liveStreamId = null;
|
|
26266
|
+
}
|
|
26250
26267
|
}
|
|
26251
26268
|
const thinkingBlocks = contentBlocks.flatMap(
|
|
26252
26269
|
(block) => block.type === "thinking" && typeof block.thinking === "string" ? [block.thinking] : []
|
|
@@ -27275,7 +27292,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
|
|
|
27275
27292
|
});
|
|
27276
27293
|
|
|
27277
27294
|
// ../shared/src/cli-version.ts
|
|
27278
|
-
var CLI_VERSION = "0.2.
|
|
27295
|
+
var CLI_VERSION = "0.2.668";
|
|
27279
27296
|
|
|
27280
27297
|
// ../shared/src/version.ts
|
|
27281
27298
|
function compareVersions(v1, v2) {
|
|
@@ -27888,14 +27905,17 @@ var memoryGenerationManifestSchema = external_exports.object({
|
|
|
27888
27905
|
// ../shared/src/sse.ts
|
|
27889
27906
|
function parseSseChunk(chunk) {
|
|
27890
27907
|
let data = "";
|
|
27908
|
+
let id = null;
|
|
27891
27909
|
for (const line of chunk.split("\n")) {
|
|
27892
27910
|
if (line.startsWith("data: ")) {
|
|
27893
27911
|
data += line.slice(6);
|
|
27912
|
+
} else if (line.startsWith("id: ")) {
|
|
27913
|
+
id = line.slice(4);
|
|
27894
27914
|
}
|
|
27895
27915
|
}
|
|
27896
27916
|
if (!data) return null;
|
|
27897
27917
|
try {
|
|
27898
|
-
return JSON.parse(data);
|
|
27918
|
+
return { event: JSON.parse(data), id };
|
|
27899
27919
|
} catch {
|
|
27900
27920
|
return null;
|
|
27901
27921
|
}
|
|
@@ -27912,9 +27932,9 @@ async function readSseStream(body, onEvent, shouldContinue = () => true) {
|
|
|
27912
27932
|
buffer = chunks.pop() ?? "";
|
|
27913
27933
|
for (const chunk of chunks) {
|
|
27914
27934
|
if (!shouldContinue()) break;
|
|
27915
|
-
const
|
|
27916
|
-
if (!
|
|
27917
|
-
await onEvent(event);
|
|
27935
|
+
const parsed = parseSseChunk(chunk);
|
|
27936
|
+
if (!parsed) continue;
|
|
27937
|
+
await onEvent(parsed.event, parsed.id);
|
|
27918
27938
|
}
|
|
27919
27939
|
}
|
|
27920
27940
|
}
|