meshy-node 0.6.2 → 0.6.3
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/README.md +1 -1
- package/dashboard/assets/DashboardPage-SnCGw2xt.js +139 -0
- package/dashboard/assets/DashboardShared-BT6S17Jz.js +83 -0
- package/dashboard/assets/DiffTab-CvU4K64b.js +4 -0
- package/dashboard/assets/FilesTab-BaqQIowl.js +22 -0
- package/dashboard/assets/{PreviewTab-Bv6dERjR.js → PreviewTab-9Mfum0Jt.js} +4 -4
- package/dashboard/assets/SharedConversationPage-BHE9J9Xr.js +7 -0
- package/dashboard/assets/{file-DlRlkTFC.js → file-BS3FucfJ.js} +1 -1
- package/dashboard/assets/{folder-BmMN0Ktd.js → folder-Ogzaq0pA.js} +1 -1
- package/dashboard/assets/index-DP2pi2M_.css +1 -0
- package/dashboard/assets/index-JZIFVxcO.js +301 -0
- package/dashboard/assets/{play-CsdLI-WG.js → play-B3eo_tM3.js} +1 -1
- package/dashboard/index.html +2 -2
- package/main.cjs +300 -137
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-CLJHILHo.js +0 -134
- package/dashboard/assets/DashboardShared-h22ibsrQ.js +0 -82
- package/dashboard/assets/DiffTab-CktFHjP4.js +0 -4
- package/dashboard/assets/FilesTab-BoGft5xw.js +0 -22
- package/dashboard/assets/SharedConversationPage-BrlYNCnU.js +0 -7
- package/dashboard/assets/index-DU7NIRxO.css +0 -1
- package/dashboard/assets/index-cc0FQMdy.js +0 -301
package/main.cjs
CHANGED
|
@@ -55874,16 +55874,147 @@ var fs8 = __toESM(require("fs"), 1);
|
|
|
55874
55874
|
var os4 = __toESM(require("os"), 1);
|
|
55875
55875
|
var path7 = __toESM(require("path"), 1);
|
|
55876
55876
|
|
|
55877
|
-
// ../../packages/core/src/agents/
|
|
55877
|
+
// ../../packages/core/src/agents/codex-transcript-events.ts
|
|
55878
55878
|
function isRecord2(value) {
|
|
55879
55879
|
return typeof value === "object" && value !== null;
|
|
55880
55880
|
}
|
|
55881
|
+
function buildAssistantTextEvent(text, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55882
|
+
return {
|
|
55883
|
+
type: "assistant",
|
|
55884
|
+
message: {
|
|
55885
|
+
role: "assistant",
|
|
55886
|
+
content: [{ type: "text", text }]
|
|
55887
|
+
},
|
|
55888
|
+
timestamp
|
|
55889
|
+
};
|
|
55890
|
+
}
|
|
55891
|
+
function buildAssistantThinkingEvent(thinking, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55892
|
+
return {
|
|
55893
|
+
type: "assistant",
|
|
55894
|
+
message: {
|
|
55895
|
+
role: "assistant",
|
|
55896
|
+
content: [{ type: "thinking", thinking }]
|
|
55897
|
+
},
|
|
55898
|
+
timestamp
|
|
55899
|
+
};
|
|
55900
|
+
}
|
|
55901
|
+
function buildAssistantToolUseEvent(id, name2, input, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55902
|
+
return {
|
|
55903
|
+
type: "assistant",
|
|
55904
|
+
message: {
|
|
55905
|
+
role: "assistant",
|
|
55906
|
+
content: [{ type: "tool_use", id, name: name2, input }]
|
|
55907
|
+
},
|
|
55908
|
+
timestamp
|
|
55909
|
+
};
|
|
55910
|
+
}
|
|
55911
|
+
function extractCodexReasoningText(item) {
|
|
55912
|
+
if (typeof item.text === "string") {
|
|
55913
|
+
return item.text.trim();
|
|
55914
|
+
}
|
|
55915
|
+
if (Array.isArray(item.summary)) {
|
|
55916
|
+
return item.summary.map((entry) => {
|
|
55917
|
+
if (typeof entry === "string") return entry.trim();
|
|
55918
|
+
if (isRecord2(entry) && typeof entry.text === "string") {
|
|
55919
|
+
return entry.text.trim();
|
|
55920
|
+
}
|
|
55921
|
+
return "";
|
|
55922
|
+
}).filter(Boolean).join("\n\n");
|
|
55923
|
+
}
|
|
55924
|
+
return "";
|
|
55925
|
+
}
|
|
55926
|
+
function parseCodexToolInput(value) {
|
|
55927
|
+
if (isRecord2(value)) return value;
|
|
55928
|
+
if (typeof value !== "string") return {};
|
|
55929
|
+
const trimmed = value.trim();
|
|
55930
|
+
if (!trimmed) return {};
|
|
55931
|
+
try {
|
|
55932
|
+
const parsed = JSON.parse(trimmed);
|
|
55933
|
+
if (isRecord2(parsed)) return parsed;
|
|
55934
|
+
} catch {
|
|
55935
|
+
}
|
|
55936
|
+
return { arguments: trimmed };
|
|
55937
|
+
}
|
|
55938
|
+
function getToolCallId(payload) {
|
|
55939
|
+
for (const key of ["call_id", "id", "tool_call_id"]) {
|
|
55940
|
+
const value = payload[key];
|
|
55941
|
+
if (typeof value === "string" && value.trim()) {
|
|
55942
|
+
return value.trim();
|
|
55943
|
+
}
|
|
55944
|
+
}
|
|
55945
|
+
return "";
|
|
55946
|
+
}
|
|
55947
|
+
function getToolName(payload) {
|
|
55948
|
+
for (const key of ["name", "tool_name"]) {
|
|
55949
|
+
const value = payload[key];
|
|
55950
|
+
if (typeof value === "string" && value.trim()) {
|
|
55951
|
+
return value.trim();
|
|
55952
|
+
}
|
|
55953
|
+
}
|
|
55954
|
+
return "tool";
|
|
55955
|
+
}
|
|
55956
|
+
function getToolOutput(payload) {
|
|
55957
|
+
for (const key of ["output", "content", "result"]) {
|
|
55958
|
+
const value = payload[key];
|
|
55959
|
+
if (typeof value === "string" && value.trim()) {
|
|
55960
|
+
return value.trim();
|
|
55961
|
+
}
|
|
55962
|
+
}
|
|
55963
|
+
return "";
|
|
55964
|
+
}
|
|
55965
|
+
function convertCodexTranscriptPayload(payload, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55966
|
+
if (payload.type === "user_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
55967
|
+
return [buildTaskUserLogEvent([{ type: "text", text: payload.message.trim() }], timestamp)];
|
|
55968
|
+
}
|
|
55969
|
+
if (payload.type === "agent_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
55970
|
+
return [buildAssistantTextEvent(payload.message.trim(), timestamp)];
|
|
55971
|
+
}
|
|
55972
|
+
if (payload.type === "agent_message" && typeof payload.text === "string" && payload.text.trim()) {
|
|
55973
|
+
return [buildAssistantTextEvent(payload.text.trim(), timestamp)];
|
|
55974
|
+
}
|
|
55975
|
+
if (payload.type === "agent_reasoning" || payload.type === "reasoning") {
|
|
55976
|
+
const reasoning = extractCodexReasoningText(payload);
|
|
55977
|
+
return reasoning ? [buildAssistantThinkingEvent(reasoning, timestamp)] : [];
|
|
55978
|
+
}
|
|
55979
|
+
if (payload.type === "function_call" || payload.type === "tool_call") {
|
|
55980
|
+
const callId = getToolCallId(payload);
|
|
55981
|
+
if (!callId) return [];
|
|
55982
|
+
return [buildAssistantToolUseEvent(
|
|
55983
|
+
callId,
|
|
55984
|
+
getToolName(payload),
|
|
55985
|
+
parseCodexToolInput(payload.arguments ?? payload.input),
|
|
55986
|
+
timestamp
|
|
55987
|
+
)];
|
|
55988
|
+
}
|
|
55989
|
+
if (payload.type === "function_call_output" || payload.type === "tool_call_output") {
|
|
55990
|
+
const callId = getToolCallId(payload);
|
|
55991
|
+
const output = getToolOutput(payload);
|
|
55992
|
+
if (!callId || !output) return [];
|
|
55993
|
+
return [buildTaskUserLogEvent([{ type: "tool_result", toolUseId: callId, content: output }], timestamp)];
|
|
55994
|
+
}
|
|
55995
|
+
return [];
|
|
55996
|
+
}
|
|
55997
|
+
function convertCodexTranscriptEvent(event) {
|
|
55998
|
+
const timestamp = typeof event.timestamp === "string" ? event.timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
55999
|
+
if ((event.type === "event_msg" || event.type === "response_item") && isRecord2(event.payload)) {
|
|
56000
|
+
return convertCodexTranscriptPayload(event.payload, timestamp);
|
|
56001
|
+
}
|
|
56002
|
+
if (event.type === "item.completed" && isRecord2(event.item)) {
|
|
56003
|
+
return convertCodexTranscriptPayload(event.item, timestamp);
|
|
56004
|
+
}
|
|
56005
|
+
return [];
|
|
56006
|
+
}
|
|
56007
|
+
|
|
56008
|
+
// ../../packages/core/src/agents/copilot-transcript-events.ts
|
|
56009
|
+
function isRecord3(value) {
|
|
56010
|
+
return typeof value === "object" && value !== null;
|
|
56011
|
+
}
|
|
55881
56012
|
function extractStringContent(value) {
|
|
55882
56013
|
if (typeof value === "string") return value.trim();
|
|
55883
56014
|
if (!Array.isArray(value)) return "";
|
|
55884
56015
|
return value.map((part) => {
|
|
55885
56016
|
if (typeof part === "string") return part.trim();
|
|
55886
|
-
if (
|
|
56017
|
+
if (isRecord3(part)) {
|
|
55887
56018
|
if (typeof part.text === "string") return part.text.trim();
|
|
55888
56019
|
if (typeof part.content === "string") return part.content.trim();
|
|
55889
56020
|
}
|
|
@@ -55901,9 +56032,9 @@ function buildAssistantContentEvent(content, timestamp) {
|
|
|
55901
56032
|
};
|
|
55902
56033
|
}
|
|
55903
56034
|
function extractCopilotEventText(event) {
|
|
55904
|
-
const data =
|
|
55905
|
-
const message =
|
|
55906
|
-
const dataMessage =
|
|
56035
|
+
const data = isRecord3(event.data) ? event.data : void 0;
|
|
56036
|
+
const message = isRecord3(event.message) ? event.message : void 0;
|
|
56037
|
+
const dataMessage = isRecord3(data?.message) ? data.message : void 0;
|
|
55907
56038
|
return extractStringContent(data?.content) || extractStringContent(data?.text) || extractStringContent(dataMessage?.content) || extractStringContent(dataMessage?.text) || extractStringContent(event.content) || extractStringContent(event.text) || extractStringContent(message?.content) || extractStringContent(message?.text);
|
|
55908
56039
|
}
|
|
55909
56040
|
function getStringField(record2, field) {
|
|
@@ -55911,14 +56042,14 @@ function getStringField(record2, field) {
|
|
|
55911
56042
|
return typeof value === "string" ? value.trim() : "";
|
|
55912
56043
|
}
|
|
55913
56044
|
function normalizeCopilotToolInput(value) {
|
|
55914
|
-
if (
|
|
56045
|
+
if (isRecord3(value)) return value;
|
|
55915
56046
|
if (typeof value === "string" && value.trim()) {
|
|
55916
56047
|
return { arguments: value.trim() };
|
|
55917
56048
|
}
|
|
55918
56049
|
return {};
|
|
55919
56050
|
}
|
|
55920
56051
|
function extractCopilotAssistantContent(event) {
|
|
55921
|
-
const data =
|
|
56052
|
+
const data = isRecord3(event.data) ? event.data : void 0;
|
|
55922
56053
|
const content = [];
|
|
55923
56054
|
const reasoning = extractStringContent(data?.reasoningText) || extractStringContent(data?.reasoning);
|
|
55924
56055
|
const text = extractCopilotEventText(event);
|
|
@@ -55930,7 +56061,7 @@ function extractCopilotAssistantContent(event) {
|
|
|
55930
56061
|
}
|
|
55931
56062
|
if (Array.isArray(data?.toolRequests)) {
|
|
55932
56063
|
for (const request of data.toolRequests) {
|
|
55933
|
-
if (!
|
|
56064
|
+
if (!isRecord3(request)) continue;
|
|
55934
56065
|
const id = getStringField(request, "toolCallId") || getStringField(request, "id") || getStringField(request, "callId");
|
|
55935
56066
|
const name2 = getStringField(request, "name") || getStringField(request, "toolName");
|
|
55936
56067
|
if (!id || !name2) continue;
|
|
@@ -55945,8 +56076,8 @@ function extractCopilotAssistantContent(event) {
|
|
|
55945
56076
|
return content;
|
|
55946
56077
|
}
|
|
55947
56078
|
function extractCopilotToolResult(event) {
|
|
55948
|
-
const data =
|
|
55949
|
-
const result =
|
|
56079
|
+
const data = isRecord3(event.data) ? event.data : void 0;
|
|
56080
|
+
const result = isRecord3(data?.result) ? data.result : void 0;
|
|
55950
56081
|
const toolUseId = getStringField(data, "toolCallId") || getStringField(data, "toolUseId") || getStringField(data, "id");
|
|
55951
56082
|
const content = extractStringContent(result?.content) || extractStringContent(result?.detailedContent) || extractStringContent(data?.result) || extractStringContent(data?.content) || extractStringContent(data?.output);
|
|
55952
56083
|
if (!toolUseId || !content) {
|
|
@@ -55986,7 +56117,7 @@ function convertCopilotTranscriptEvent(event, opts = {}) {
|
|
|
55986
56117
|
}
|
|
55987
56118
|
|
|
55988
56119
|
// ../../packages/core/src/agents/native-session-history.ts
|
|
55989
|
-
function
|
|
56120
|
+
function isRecord4(value) {
|
|
55990
56121
|
return typeof value === "object" && value !== null;
|
|
55991
56122
|
}
|
|
55992
56123
|
function readJsonLines(filePath) {
|
|
@@ -56000,7 +56131,7 @@ function readJsonLines(filePath) {
|
|
|
56000
56131
|
return content.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).flatMap((line) => {
|
|
56001
56132
|
try {
|
|
56002
56133
|
const parsed = JSON.parse(line);
|
|
56003
|
-
return
|
|
56134
|
+
return isRecord4(parsed) ? [parsed] : [];
|
|
56004
56135
|
} catch {
|
|
56005
56136
|
return [];
|
|
56006
56137
|
}
|
|
@@ -56073,41 +56204,6 @@ function findFirstMatchingFile(rootDir, predicate) {
|
|
|
56073
56204
|
}
|
|
56074
56205
|
return null;
|
|
56075
56206
|
}
|
|
56076
|
-
function buildAssistantTextEvent(text, timestamp) {
|
|
56077
|
-
return {
|
|
56078
|
-
type: "assistant",
|
|
56079
|
-
message: {
|
|
56080
|
-
role: "assistant",
|
|
56081
|
-
content: [{ type: "text", text }]
|
|
56082
|
-
},
|
|
56083
|
-
...timestamp ? { timestamp } : {}
|
|
56084
|
-
};
|
|
56085
|
-
}
|
|
56086
|
-
function buildAssistantThinkingEvent(thinking, timestamp) {
|
|
56087
|
-
return {
|
|
56088
|
-
type: "assistant",
|
|
56089
|
-
message: {
|
|
56090
|
-
role: "assistant",
|
|
56091
|
-
content: [{ type: "thinking", thinking }]
|
|
56092
|
-
},
|
|
56093
|
-
...timestamp ? { timestamp } : {}
|
|
56094
|
-
};
|
|
56095
|
-
}
|
|
56096
|
-
function extractCodexReasoningText(item) {
|
|
56097
|
-
if (typeof item.text === "string") {
|
|
56098
|
-
return item.text.trim();
|
|
56099
|
-
}
|
|
56100
|
-
if (Array.isArray(item.summary)) {
|
|
56101
|
-
return item.summary.map((entry) => {
|
|
56102
|
-
if (typeof entry === "string") return entry.trim();
|
|
56103
|
-
if (isRecord3(entry) && typeof entry.text === "string") {
|
|
56104
|
-
return entry.text.trim();
|
|
56105
|
-
}
|
|
56106
|
-
return "";
|
|
56107
|
-
}).filter(Boolean).join("\n\n");
|
|
56108
|
-
}
|
|
56109
|
-
return "";
|
|
56110
|
-
}
|
|
56111
56207
|
function truncateSummary(text, maxLength = 96) {
|
|
56112
56208
|
const normalized = text.replace(/\s+/g, " ").trim();
|
|
56113
56209
|
if (!normalized) {
|
|
@@ -56126,7 +56222,7 @@ function extractTextFromClaudeMessageContent(content) {
|
|
|
56126
56222
|
return "";
|
|
56127
56223
|
}
|
|
56128
56224
|
for (const part of content) {
|
|
56129
|
-
if (!
|
|
56225
|
+
if (!isRecord4(part)) continue;
|
|
56130
56226
|
if (typeof part.text === "string" && part.text.trim()) {
|
|
56131
56227
|
return truncateSummary(part.text);
|
|
56132
56228
|
}
|
|
@@ -56168,7 +56264,7 @@ function findClaudeSessionSummary(entries, sessionId) {
|
|
|
56168
56264
|
if (!cwd && typeof entry.cwd === "string" && entry.cwd.trim()) {
|
|
56169
56265
|
cwd = entry.cwd.trim();
|
|
56170
56266
|
}
|
|
56171
|
-
if (summary || entry.type !== "user" || !
|
|
56267
|
+
if (summary || entry.type !== "user" || !isRecord4(entry.message)) {
|
|
56172
56268
|
continue;
|
|
56173
56269
|
}
|
|
56174
56270
|
const candidate = extractTextFromClaudeMessageContent(entry.message.content);
|
|
@@ -56187,6 +56283,63 @@ function findClaudeSessionSummary(entries, sessionId) {
|
|
|
56187
56283
|
updatedAt
|
|
56188
56284
|
};
|
|
56189
56285
|
}
|
|
56286
|
+
function getClaudeMessageContent(entry) {
|
|
56287
|
+
const message = entry.message;
|
|
56288
|
+
if (!isRecord4(message) || !Array.isArray(message.content)) {
|
|
56289
|
+
return [];
|
|
56290
|
+
}
|
|
56291
|
+
return message.content.filter(isRecord4);
|
|
56292
|
+
}
|
|
56293
|
+
function isClaudeToolResultEvent(entry) {
|
|
56294
|
+
if (!entry || entry.type !== "user") {
|
|
56295
|
+
return false;
|
|
56296
|
+
}
|
|
56297
|
+
const content = getClaudeMessageContent(entry);
|
|
56298
|
+
return content.length > 0 && content.every((block) => block.type === "tool_result");
|
|
56299
|
+
}
|
|
56300
|
+
function isClaudeTextOnlyUserEvent(entry) {
|
|
56301
|
+
if (entry.type !== "user") {
|
|
56302
|
+
return false;
|
|
56303
|
+
}
|
|
56304
|
+
const content = getClaudeMessageContent(entry);
|
|
56305
|
+
return content.length > 0 && content.every((block) => block.type === "text" && typeof block.text === "string");
|
|
56306
|
+
}
|
|
56307
|
+
function convertClaudeGeneratedPrompt(entry) {
|
|
56308
|
+
const content = getClaudeMessageContent(entry);
|
|
56309
|
+
const prompt = content.map((block) => typeof block.text === "string" ? block.text : "").filter(Boolean).join("\n\n").trim();
|
|
56310
|
+
if (!prompt) {
|
|
56311
|
+
return null;
|
|
56312
|
+
}
|
|
56313
|
+
const id = typeof entry.uuid === "string" && entry.uuid.trim() ? entry.uuid.trim() : typeof entry.parentUuid === "string" && entry.parentUuid.trim() ? `${entry.parentUuid.trim()}-generated-prompt` : `generated-prompt-${prompt.slice(0, 24)}`;
|
|
56314
|
+
return {
|
|
56315
|
+
...entry,
|
|
56316
|
+
type: "assistant",
|
|
56317
|
+
message: {
|
|
56318
|
+
role: "assistant",
|
|
56319
|
+
content: [{
|
|
56320
|
+
type: "tool_use",
|
|
56321
|
+
id,
|
|
56322
|
+
name: "AgentPrompt",
|
|
56323
|
+
input: { prompt }
|
|
56324
|
+
}]
|
|
56325
|
+
}
|
|
56326
|
+
};
|
|
56327
|
+
}
|
|
56328
|
+
function normalizeClaudeSessionLogs(entries) {
|
|
56329
|
+
const byUuid = /* @__PURE__ */ new Map();
|
|
56330
|
+
for (const entry of entries) {
|
|
56331
|
+
if (typeof entry.uuid === "string" && entry.uuid.trim()) {
|
|
56332
|
+
byUuid.set(entry.uuid.trim(), entry);
|
|
56333
|
+
}
|
|
56334
|
+
}
|
|
56335
|
+
return entries.map((entry) => {
|
|
56336
|
+
const parent = typeof entry.parentUuid === "string" ? byUuid.get(entry.parentUuid) : void 0;
|
|
56337
|
+
if (isClaudeTextOnlyUserEvent(entry) && isClaudeToolResultEvent(parent)) {
|
|
56338
|
+
return convertClaudeGeneratedPrompt(entry) ?? entry;
|
|
56339
|
+
}
|
|
56340
|
+
return entry;
|
|
56341
|
+
});
|
|
56342
|
+
}
|
|
56190
56343
|
function loadCodexSessionIndex() {
|
|
56191
56344
|
const indexPath = path7.join(getNativeHomeDir(), ".codex", "session_index.jsonl");
|
|
56192
56345
|
const index = /* @__PURE__ */ new Map();
|
|
@@ -56210,7 +56363,7 @@ function findCodexSessionSummary(entries, filePath, sessionIndex) {
|
|
|
56210
56363
|
if (typeof entry.timestamp === "string") {
|
|
56211
56364
|
updatedAt = entry.timestamp;
|
|
56212
56365
|
}
|
|
56213
|
-
if (entry.type === "session_meta" &&
|
|
56366
|
+
if (entry.type === "session_meta" && isRecord4(entry.payload)) {
|
|
56214
56367
|
if (typeof entry.payload.id === "string" && entry.payload.id.trim()) {
|
|
56215
56368
|
sessionId = entry.payload.id.trim();
|
|
56216
56369
|
}
|
|
@@ -56219,7 +56372,7 @@ function findCodexSessionSummary(entries, filePath, sessionIndex) {
|
|
|
56219
56372
|
}
|
|
56220
56373
|
continue;
|
|
56221
56374
|
}
|
|
56222
|
-
if (!summary && entry.type === "event_msg" &&
|
|
56375
|
+
if (!summary && entry.type === "event_msg" && isRecord4(entry.payload) && entry.payload.type === "user_message") {
|
|
56223
56376
|
if (typeof entry.payload.message === "string" && entry.payload.message.trim()) {
|
|
56224
56377
|
summary = truncateSummary(entry.payload.message);
|
|
56225
56378
|
}
|
|
@@ -56252,9 +56405,9 @@ function loadClaudeSessionHistory(sessionId) {
|
|
|
56252
56405
|
if (entry.type !== "user" && entry.type !== "assistant" || entry.isMeta === true || entry.isSidechain === true) {
|
|
56253
56406
|
return false;
|
|
56254
56407
|
}
|
|
56255
|
-
return
|
|
56408
|
+
return isRecord4(entry.message);
|
|
56256
56409
|
});
|
|
56257
|
-
return { logs, sourcePath: sessionFile };
|
|
56410
|
+
return { logs: normalizeClaudeSessionLogs(logs), sourcePath: sessionFile };
|
|
56258
56411
|
}
|
|
56259
56412
|
function loadCodexSessionHistory(sessionId) {
|
|
56260
56413
|
const sessionsDir = path7.join(getNativeHomeDir(), ".codex", "sessions");
|
|
@@ -56262,26 +56415,7 @@ function loadCodexSessionHistory(sessionId) {
|
|
|
56262
56415
|
if (!sessionFile) {
|
|
56263
56416
|
return { logs: [], sourcePath: null };
|
|
56264
56417
|
}
|
|
56265
|
-
const logs = readJsonLines(sessionFile).flatMap(
|
|
56266
|
-
if (entry.type !== "event_msg" || !isRecord3(entry.payload)) {
|
|
56267
|
-
return [];
|
|
56268
|
-
}
|
|
56269
|
-
const timestamp = typeof entry.timestamp === "string" ? entry.timestamp : void 0;
|
|
56270
|
-
const payload = entry.payload;
|
|
56271
|
-
if (payload.type === "user_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
56272
|
-
return [buildTaskUserLogEvent([{ type: "text", text: payload.message.trim() }], timestamp)];
|
|
56273
|
-
}
|
|
56274
|
-
if (payload.type === "agent_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
56275
|
-
return [buildAssistantTextEvent(payload.message.trim(), timestamp)];
|
|
56276
|
-
}
|
|
56277
|
-
if (payload.type === "agent_reasoning") {
|
|
56278
|
-
const reasoning = extractCodexReasoningText(payload);
|
|
56279
|
-
if (reasoning) {
|
|
56280
|
-
return [buildAssistantThinkingEvent(reasoning, timestamp)];
|
|
56281
|
-
}
|
|
56282
|
-
}
|
|
56283
|
-
return [];
|
|
56284
|
-
});
|
|
56418
|
+
const logs = readJsonLines(sessionFile).flatMap(convertCodexTranscriptEvent);
|
|
56285
56419
|
return { logs, sourcePath: sessionFile };
|
|
56286
56420
|
}
|
|
56287
56421
|
function findCopilotSessionDir(sessionId) {
|
|
@@ -57026,6 +57160,9 @@ function getClaudeStreamError(event) {
|
|
|
57026
57160
|
}
|
|
57027
57161
|
return null;
|
|
57028
57162
|
}
|
|
57163
|
+
function shouldSkipClaudeTranscriptEvent(event) {
|
|
57164
|
+
return event.isMeta === true || event.isSidechain === true || event.type === "attachment" || event.type === "last-prompt";
|
|
57165
|
+
}
|
|
57029
57166
|
var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
57030
57167
|
sessions = /* @__PURE__ */ new Map();
|
|
57031
57168
|
/** Rebuild in-memory sessions map from persisted task payloads. */
|
|
@@ -57082,6 +57219,9 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
57082
57219
|
try {
|
|
57083
57220
|
const event = JSON.parse(line);
|
|
57084
57221
|
streamError = getClaudeStreamError(event) ?? streamError;
|
|
57222
|
+
if (shouldSkipClaudeTranscriptEvent(event)) {
|
|
57223
|
+
return;
|
|
57224
|
+
}
|
|
57085
57225
|
if (event.type === "system" && event.subtype === "init" && typeof event.session_id === "string") {
|
|
57086
57226
|
this.sessions.set(task.id, {
|
|
57087
57227
|
sessionId: event.session_id,
|
|
@@ -57208,6 +57348,9 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
57208
57348
|
try {
|
|
57209
57349
|
const event = JSON.parse(line);
|
|
57210
57350
|
streamError = getClaudeStreamError(event) ?? streamError;
|
|
57351
|
+
if (shouldSkipClaudeTranscriptEvent(event)) {
|
|
57352
|
+
return;
|
|
57353
|
+
}
|
|
57211
57354
|
if (event.type === "system" && event.subtype === "init" && typeof event.session_id === "string") {
|
|
57212
57355
|
this.sessions.set(taskId, {
|
|
57213
57356
|
sessionId: event.session_id,
|
|
@@ -57347,40 +57490,25 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
57347
57490
|
var fs11 = __toESM(require("fs"), 1);
|
|
57348
57491
|
var path10 = __toESM(require("path"), 1);
|
|
57349
57492
|
var import_node_child_process5 = require("child_process");
|
|
57350
|
-
|
|
57351
|
-
|
|
57352
|
-
|
|
57353
|
-
message: {
|
|
57354
|
-
role: "assistant",
|
|
57355
|
-
content: [{ type: "text", text }]
|
|
57356
|
-
},
|
|
57357
|
-
timestamp
|
|
57358
|
-
};
|
|
57359
|
-
}
|
|
57360
|
-
function buildAssistantThinkingEvent2(thinking, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
57361
|
-
return {
|
|
57362
|
-
type: "assistant",
|
|
57363
|
-
message: {
|
|
57364
|
-
role: "assistant",
|
|
57365
|
-
content: [{ type: "thinking", thinking }]
|
|
57366
|
-
},
|
|
57367
|
-
timestamp
|
|
57368
|
-
};
|
|
57493
|
+
var CODEX_SESSION_MIRROR_INTERVAL_MS = 500;
|
|
57494
|
+
function isRecord5(value) {
|
|
57495
|
+
return typeof value === "object" && value !== null;
|
|
57369
57496
|
}
|
|
57370
|
-
function
|
|
57371
|
-
if (
|
|
57372
|
-
return
|
|
57497
|
+
function stableStringify(value) {
|
|
57498
|
+
if (Array.isArray(value)) {
|
|
57499
|
+
return `[${value.map((entry) => stableStringify(entry)).join(",")}]`;
|
|
57373
57500
|
}
|
|
57374
|
-
if (
|
|
57375
|
-
return
|
|
57376
|
-
if (typeof entry === "string") return entry.trim();
|
|
57377
|
-
if (typeof entry === "object" && entry !== null && typeof entry.text === "string") {
|
|
57378
|
-
return String(entry.text).trim();
|
|
57379
|
-
}
|
|
57380
|
-
return "";
|
|
57381
|
-
}).filter(Boolean).join("\n\n");
|
|
57501
|
+
if (!isRecord5(value)) {
|
|
57502
|
+
return JSON.stringify(value);
|
|
57382
57503
|
}
|
|
57383
|
-
return ""
|
|
57504
|
+
return `{${Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey)).map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
|
|
57505
|
+
}
|
|
57506
|
+
function transcriptEventSignature(event) {
|
|
57507
|
+
const message = event.message;
|
|
57508
|
+
if ((event.type === "assistant" || event.type === "user") && isRecord5(message) && Array.isArray(message.content)) {
|
|
57509
|
+
return `${event.type}:${stableStringify(message.content)}`;
|
|
57510
|
+
}
|
|
57511
|
+
return stableStringify(event);
|
|
57384
57512
|
}
|
|
57385
57513
|
function sanitizeFilename(filename) {
|
|
57386
57514
|
return filename.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
@@ -57418,6 +57546,8 @@ function buildCodexModeArgs(mode) {
|
|
|
57418
57546
|
}
|
|
57419
57547
|
var CodexEngine = class extends ExecutionEngine {
|
|
57420
57548
|
sessions = /* @__PURE__ */ new Map();
|
|
57549
|
+
nativeSessionMirrors = /* @__PURE__ */ new Map();
|
|
57550
|
+
emittedTranscriptSignatures = /* @__PURE__ */ new Map();
|
|
57421
57551
|
/** Rebuild in-memory sessions map from persisted task payloads. */
|
|
57422
57552
|
init() {
|
|
57423
57553
|
const { tasks } = this.taskEngine.listTasks();
|
|
@@ -57518,11 +57648,7 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57518
57648
|
if (!line.trim()) return;
|
|
57519
57649
|
try {
|
|
57520
57650
|
const event = JSON.parse(line);
|
|
57521
|
-
|
|
57522
|
-
if (converted) {
|
|
57523
|
-
this.emitOutput(taskId, converted);
|
|
57524
|
-
this.appendLog(taskId, converted);
|
|
57525
|
-
}
|
|
57651
|
+
this.emitConvertedEvents(taskId, this.handleEvent(taskId, title, cwd, event));
|
|
57526
57652
|
} catch {
|
|
57527
57653
|
}
|
|
57528
57654
|
};
|
|
@@ -57542,10 +57668,12 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57542
57668
|
processLine(buffer);
|
|
57543
57669
|
}
|
|
57544
57670
|
if (this.shouldSkipProcessOutcome(activeProcess)) {
|
|
57671
|
+
this.stopNativeSessionMirror(taskId);
|
|
57545
57672
|
this.releaseProcess(activeProcess);
|
|
57546
57673
|
return;
|
|
57547
57674
|
}
|
|
57548
57675
|
try {
|
|
57676
|
+
this.flushNativeSessionMirror(taskId);
|
|
57549
57677
|
if (code === 0) {
|
|
57550
57678
|
this.logger.info(isFollowUp ? "Codex follow-up completed" : "Codex task completed successfully", {
|
|
57551
57679
|
taskId,
|
|
@@ -57568,11 +57696,13 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57568
57696
|
reason: err instanceof Error ? err.message : String(err)
|
|
57569
57697
|
});
|
|
57570
57698
|
} finally {
|
|
57699
|
+
this.stopNativeSessionMirror(taskId);
|
|
57571
57700
|
this.releaseProcess(activeProcess);
|
|
57572
57701
|
}
|
|
57573
57702
|
});
|
|
57574
57703
|
proc.on("error", (err) => {
|
|
57575
57704
|
if (this.shouldSkipProcessOutcome(activeProcess)) {
|
|
57705
|
+
this.stopNativeSessionMirror(taskId);
|
|
57576
57706
|
this.releaseProcess(activeProcess);
|
|
57577
57707
|
return;
|
|
57578
57708
|
}
|
|
@@ -57588,10 +57718,54 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57588
57718
|
reason: reportErr instanceof Error ? reportErr.message : String(reportErr)
|
|
57589
57719
|
});
|
|
57590
57720
|
} finally {
|
|
57721
|
+
this.stopNativeSessionMirror(taskId);
|
|
57591
57722
|
this.releaseProcess(activeProcess);
|
|
57592
57723
|
}
|
|
57593
57724
|
});
|
|
57594
57725
|
}
|
|
57726
|
+
emitConvertedEvents(taskId, events) {
|
|
57727
|
+
if (events.length === 0) return;
|
|
57728
|
+
let emitted = this.emittedTranscriptSignatures.get(taskId);
|
|
57729
|
+
if (!emitted) {
|
|
57730
|
+
emitted = /* @__PURE__ */ new Set();
|
|
57731
|
+
this.emittedTranscriptSignatures.set(taskId, emitted);
|
|
57732
|
+
}
|
|
57733
|
+
for (const event of events) {
|
|
57734
|
+
const signature = transcriptEventSignature(event);
|
|
57735
|
+
if (emitted.has(signature)) {
|
|
57736
|
+
continue;
|
|
57737
|
+
}
|
|
57738
|
+
emitted.add(signature);
|
|
57739
|
+
this.emitOutput(taskId, event);
|
|
57740
|
+
this.appendLog(taskId, event);
|
|
57741
|
+
}
|
|
57742
|
+
}
|
|
57743
|
+
startNativeSessionMirror(taskId, sessionId) {
|
|
57744
|
+
this.stopNativeSessionMirror(taskId);
|
|
57745
|
+
const mirror = {
|
|
57746
|
+
sessionId,
|
|
57747
|
+
timer: setInterval(() => this.flushNativeSessionMirror(taskId), CODEX_SESSION_MIRROR_INTERVAL_MS)
|
|
57748
|
+
};
|
|
57749
|
+
mirror.timer.unref?.();
|
|
57750
|
+
this.nativeSessionMirrors.set(taskId, mirror);
|
|
57751
|
+
this.flushNativeSessionMirror(taskId);
|
|
57752
|
+
}
|
|
57753
|
+
stopNativeSessionMirror(taskId) {
|
|
57754
|
+
const mirror = this.nativeSessionMirrors.get(taskId);
|
|
57755
|
+
if (!mirror) return;
|
|
57756
|
+
clearInterval(mirror.timer);
|
|
57757
|
+
this.nativeSessionMirrors.delete(taskId);
|
|
57758
|
+
this.emittedTranscriptSignatures.delete(taskId);
|
|
57759
|
+
}
|
|
57760
|
+
flushNativeSessionMirror(taskId) {
|
|
57761
|
+
const mirror = this.nativeSessionMirrors.get(taskId);
|
|
57762
|
+
if (!mirror) return;
|
|
57763
|
+
try {
|
|
57764
|
+
const { logs } = loadNativeSessionHistory({ agent: "codex", sessionId: mirror.sessionId });
|
|
57765
|
+
this.emitConvertedEvents(taskId, logs);
|
|
57766
|
+
} catch {
|
|
57767
|
+
}
|
|
57768
|
+
}
|
|
57595
57769
|
/** Translate a Codex JSON event into a Meshy transcript event. */
|
|
57596
57770
|
handleEvent(taskId, title, cwd, event) {
|
|
57597
57771
|
if (event.type === "thread.started" && typeof event.thread_id === "string") {
|
|
@@ -57603,22 +57777,11 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57603
57777
|
this.persistSession(taskId, event.thread_id, cwd);
|
|
57604
57778
|
this.appendLog(taskId, event);
|
|
57605
57779
|
this.emitOutput(taskId, event);
|
|
57780
|
+
this.startNativeSessionMirror(taskId, event.thread_id);
|
|
57606
57781
|
this.logger.info("Codex session established", { taskId, sessionId: event.thread_id });
|
|
57607
|
-
return
|
|
57608
|
-
}
|
|
57609
|
-
if (event.type === "item.completed") {
|
|
57610
|
-
const item = event.item;
|
|
57611
|
-
if (item?.type === "agent_message" && typeof item.text === "string" && item.text.trim()) {
|
|
57612
|
-
return buildAssistantEvent(item.text);
|
|
57613
|
-
}
|
|
57614
|
-
if (item?.type === "reasoning" || item?.type === "agent_reasoning") {
|
|
57615
|
-
const reasoning = extractCodexReasoningText2(item);
|
|
57616
|
-
if (reasoning) {
|
|
57617
|
-
return buildAssistantThinkingEvent2(reasoning);
|
|
57618
|
-
}
|
|
57619
|
-
}
|
|
57782
|
+
return [];
|
|
57620
57783
|
}
|
|
57621
|
-
return
|
|
57784
|
+
return convertCodexTranscriptEvent(event);
|
|
57622
57785
|
}
|
|
57623
57786
|
/** Write image attachments to disk and return the text prompt + file paths. */
|
|
57624
57787
|
prepareAssets(taskId, content) {
|
|
@@ -57694,7 +57857,7 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57694
57857
|
var fs12 = __toESM(require("fs"), 1);
|
|
57695
57858
|
var path11 = __toESM(require("path"), 1);
|
|
57696
57859
|
var import_node_child_process6 = require("child_process");
|
|
57697
|
-
function
|
|
57860
|
+
function isRecord6(value) {
|
|
57698
57861
|
return typeof value === "object" && value !== null;
|
|
57699
57862
|
}
|
|
57700
57863
|
function contentToPrompt(content) {
|
|
@@ -57732,7 +57895,7 @@ function inferExtension2(mediaType) {
|
|
|
57732
57895
|
return normalized.replace(/[^a-z0-9]/g, "") || "bin";
|
|
57733
57896
|
}
|
|
57734
57897
|
function extractSessionId(event) {
|
|
57735
|
-
const data =
|
|
57898
|
+
const data = isRecord6(event.data) ? event.data : void 0;
|
|
57736
57899
|
const direct = event.session_id ?? event.sessionId ?? event.conversation_id ?? event.conversationId ?? data?.sessionId ?? data?.session_id ?? data?.conversationId ?? data?.conversation_id;
|
|
57737
57900
|
if (typeof direct === "string" && direct.trim()) return direct.trim();
|
|
57738
57901
|
const type = typeof event.type === "string" ? event.type.toLowerCase() : "";
|
|
@@ -59765,13 +59928,13 @@ function cleanDevBoxInfo(devbox) {
|
|
|
59765
59928
|
}
|
|
59766
59929
|
function normalizeMcpDevBoxList(value) {
|
|
59767
59930
|
const normalized = normalizeMcpValue(value);
|
|
59768
|
-
const record2 =
|
|
59931
|
+
const record2 = isRecord7(normalized) ? normalized : {};
|
|
59769
59932
|
const list = Array.isArray(normalized) ? normalized : Array.isArray(record2.devboxes) ? record2.devboxes : Array.isArray(record2.value) ? record2.value : [];
|
|
59770
59933
|
return list.map((item) => normalizeDevBoxResource(item, void 0)).filter((item) => Boolean(item.name));
|
|
59771
59934
|
}
|
|
59772
59935
|
function normalizeDevBoxResource(value, fallback) {
|
|
59773
59936
|
const record2 = normalizeRecord(value);
|
|
59774
|
-
const additional =
|
|
59937
|
+
const additional = isRecord7(record2.additionalProperties) ? record2.additionalProperties : {};
|
|
59775
59938
|
const fromUri = parseDevBoxUri(readString(record2, "uri"));
|
|
59776
59939
|
const status = readString(record2, "status") ?? readString(record2, "powerState") ?? readString(record2, "lastStatus") ?? fallback?.lastStatus;
|
|
59777
59940
|
const name2 = readString(record2, "name") ?? fromUri?.name ?? fallback?.name ?? "";
|
|
@@ -59825,7 +59988,7 @@ function parseDevCenterEndpoint(hostname4) {
|
|
|
59825
59988
|
}
|
|
59826
59989
|
function normalizeRecord(value) {
|
|
59827
59990
|
const normalized = normalizeMcpValue(value);
|
|
59828
|
-
return
|
|
59991
|
+
return isRecord7(normalized) ? normalized : {};
|
|
59829
59992
|
}
|
|
59830
59993
|
function normalizeMcpValue(value) {
|
|
59831
59994
|
if (Array.isArray(value)) return value;
|
|
@@ -59860,7 +60023,7 @@ function tryParseJson(text) {
|
|
|
59860
60023
|
return null;
|
|
59861
60024
|
}
|
|
59862
60025
|
}
|
|
59863
|
-
function
|
|
60026
|
+
function isRecord7(value) {
|
|
59864
60027
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
59865
60028
|
}
|
|
59866
60029
|
function readString(record2, key) {
|
|
@@ -61089,7 +61252,7 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
|
|
|
61089
61252
|
|
|
61090
61253
|
// ../../packages/api/src/node/runtime-restart-request.ts
|
|
61091
61254
|
function parseRuntimeRestartRequest(value) {
|
|
61092
|
-
const body =
|
|
61255
|
+
const body = isRecord8(value) ? value : {};
|
|
61093
61256
|
const startArgs = parseRuntimeRestartStartArgs(body.startArgs);
|
|
61094
61257
|
return {
|
|
61095
61258
|
reason: body.reason === "update" ? "update" : "restart",
|
|
@@ -61098,7 +61261,7 @@ function parseRuntimeRestartRequest(value) {
|
|
|
61098
61261
|
}
|
|
61099
61262
|
function parseRuntimeRestartStartArgs(value) {
|
|
61100
61263
|
if (value === void 0) return void 0;
|
|
61101
|
-
if (!
|
|
61264
|
+
if (!isRecord8(value)) {
|
|
61102
61265
|
throw new MeshyError("VALIDATION_ERROR", "Runtime restart startArgs must be an object", 400);
|
|
61103
61266
|
}
|
|
61104
61267
|
const startArgs = {};
|
|
@@ -61135,7 +61298,7 @@ function parseOptionalString(value, key) {
|
|
|
61135
61298
|
const trimmed = value.trim();
|
|
61136
61299
|
return trimmed || void 0;
|
|
61137
61300
|
}
|
|
61138
|
-
function
|
|
61301
|
+
function isRecord8(value) {
|
|
61139
61302
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
61140
61303
|
}
|
|
61141
61304
|
|
|
@@ -61618,7 +61781,7 @@ function toLegacyWorkerControl2(message) {
|
|
|
61618
61781
|
}
|
|
61619
61782
|
|
|
61620
61783
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
61621
|
-
function
|
|
61784
|
+
function isRecord9(value) {
|
|
61622
61785
|
return typeof value === "object" && value !== null;
|
|
61623
61786
|
}
|
|
61624
61787
|
function restoreTaskState(taskEngine, task) {
|
|
@@ -61685,7 +61848,7 @@ function normalizeStructuredValue(value) {
|
|
|
61685
61848
|
if (Array.isArray(value)) {
|
|
61686
61849
|
return value.map((entry) => normalizeStructuredValue(entry));
|
|
61687
61850
|
}
|
|
61688
|
-
if (!
|
|
61851
|
+
if (!isRecord9(value)) {
|
|
61689
61852
|
return value;
|
|
61690
61853
|
}
|
|
61691
61854
|
return Object.fromEntries(
|
|
@@ -61694,20 +61857,20 @@ function normalizeStructuredValue(value) {
|
|
|
61694
61857
|
}
|
|
61695
61858
|
function getTranscriptEventSignature(event) {
|
|
61696
61859
|
if (event.type === "user") {
|
|
61697
|
-
const signature = getTaskUserMessageSignature(
|
|
61860
|
+
const signature = getTaskUserMessageSignature(isRecord9(event.message) ? event.message.content : event.message) ?? getTaskUserMessageSignature(event.content);
|
|
61698
61861
|
return signature ? `user:${signature}` : null;
|
|
61699
61862
|
}
|
|
61700
61863
|
if (event.type === "assistant") {
|
|
61701
61864
|
if (typeof event.message === "string") {
|
|
61702
61865
|
return `assistant:${JSON.stringify(event.message)}`;
|
|
61703
61866
|
}
|
|
61704
|
-
if (
|
|
61867
|
+
if (isRecord9(event.message) && "content" in event.message) {
|
|
61705
61868
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message.content))}`;
|
|
61706
61869
|
}
|
|
61707
61870
|
if (Array.isArray(event.content)) {
|
|
61708
61871
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.content))}`;
|
|
61709
61872
|
}
|
|
61710
|
-
if (
|
|
61873
|
+
if (isRecord9(event.message)) {
|
|
61711
61874
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message))}`;
|
|
61712
61875
|
}
|
|
61713
61876
|
}
|