echospace 0.1.0-alpha.2 → 0.1.0-alpha.5

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>EchoSpace</title>
7
7
  <link rel="icon" type="image/svg+xml" href="/echospace-logo.svg">
8
- <script type="module" crossorigin src="/assets/index-ja1djPyy.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DFTLQ23A.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-gZkfzHQ0.css">
10
10
  </head>
11
11
  <body style="width: 100%; height: 100%; margin: 0; overflow: hidden">
@@ -34,7 +34,7 @@ function normalizeMessage(message) {
34
34
  const needsPartNormalization = msg.parts.some((p) => {
35
35
  if (p.type !== "tool_result") return false;
36
36
  const r = p;
37
- return !r.tool_call_id && (r.id || r.tool_use_id);
37
+ return !r.tool_call_id && (r.id || r.tool_use_id || r.call_id);
38
38
  });
39
39
  if (needsPartNormalization) {
40
40
  msg = {
@@ -42,9 +42,9 @@ function normalizeMessage(message) {
42
42
  parts: msg.parts.map((p) => {
43
43
  if (p.type !== "tool_result") return p;
44
44
  const r = p;
45
- if (!r.tool_call_id && (r.id || r.tool_use_id)) {
46
- const { id, tool_use_id, ...rest } = r;
47
- return { ...rest, tool_call_id: id ?? tool_use_id };
45
+ if (!r.tool_call_id && (r.id || r.tool_use_id || r.call_id)) {
46
+ const { id, tool_use_id, call_id, ...rest } = r;
47
+ return { ...rest, tool_call_id: id ?? tool_use_id ?? call_id };
48
48
  }
49
49
  return p;
50
50
  })
@@ -7,7 +7,7 @@ import {
7
7
  withRemovedMessage,
8
8
  withUpdatedMessage,
9
9
  withUpdatedMeta
10
- } from "../chunk-LGVA3Y5G.js";
10
+ } from "../chunk-OSTGBTLV.js";
11
11
  export {
12
12
  createConversation,
13
13
  getMessageText,
@@ -246,20 +246,23 @@ var googleAdapter = {
246
246
  };
247
247
 
248
248
  // src/core/providers/openai.ts
249
- function toOpenAIMessage(msg) {
250
- const result = { role: msg.role };
249
+ function toOpenAIMessages(msg) {
251
250
  const textParts = msg.parts.filter((p) => p.type === "text");
252
251
  const toolCalls = msg.parts.filter((p) => p.type === "tool_call");
253
252
  const toolResults = msg.parts.filter((p) => p.type === "tool_result");
254
253
  const thinkingParts = msg.parts.filter((p) => p.type === "thinking");
255
254
  if (msg.role === "tool" && toolResults.length > 0) {
256
- const tr = toolResults[0];
257
- result.content = typeof tr.output === "string" ? tr.output : JSON.stringify(tr.output);
258
- result.tool_call_id = tr.tool_call_id;
259
- return result;
255
+ return toolResults.map((tr) => ({
256
+ role: "tool",
257
+ tool_call_id: tr.tool_call_id,
258
+ content: typeof tr.output === "string" ? tr.output : JSON.stringify(tr.output)
259
+ }));
260
260
  }
261
261
  if (msg.role === "assistant") {
262
- result.content = textParts.map((p) => p.text).join("") || null;
262
+ const result = {
263
+ role: "assistant",
264
+ content: textParts.map((p) => p.text).join("") || null
265
+ };
263
266
  if (thinkingParts.length > 0) {
264
267
  result.reasoning_content = thinkingParts.map((p) => p.text).join("");
265
268
  }
@@ -273,10 +276,9 @@ function toOpenAIMessage(msg) {
273
276
  }
274
277
  }));
275
278
  }
276
- return result;
279
+ return [result];
277
280
  }
278
- result.content = textParts.map((p) => p.text).join("");
279
- return result;
281
+ return [{ role: msg.role, content: textParts.map((p) => p.text).join("") }];
280
282
  }
281
283
  var openaiAdapter = {
282
284
  type: "openai",
@@ -285,7 +287,7 @@ var openaiAdapter = {
285
287
  const url = `${baseUrl.replace(/\/$/, "")}/chat/completions`;
286
288
  const body = {
287
289
  model: settings.model ?? config.models[0],
288
- messages: messages.map(toOpenAIMessage),
290
+ messages: messages.flatMap(toOpenAIMessages),
289
291
  stream: true
290
292
  };
291
293
  if (settings.temperature != null) body.temperature = settings.temperature;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseEcho
3
- } from "../chunk-LGVA3Y5G.js";
3
+ } from "../chunk-OSTGBTLV.js";
4
4
 
5
5
  // src/core/smart-paste/detector.ts
6
6
  function detectFormat(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echospace",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.5",
4
4
  "type": "module",
5
5
  "description": "Open-source, local-first prompt debugging workspace for LLM developers",
6
6
  "license": "MIT",