tarsk 0.3.37 → 0.3.38

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.js CHANGED
@@ -3826,6 +3826,9 @@ class EventQueue {
3826
3826
  this.resolver = null;
3827
3827
  }
3828
3828
  }
3829
+ notify() {
3830
+ this.notifyResolver();
3831
+ }
3829
3832
  }
3830
3833
 
3831
3834
  // src/managers/pi-prompt-loader.ts
@@ -3986,7 +3989,7 @@ class PiExecutorImpl {
3986
3989
  });
3987
3990
  const promptDone = agent.prompt(userPrompt).then(() => {
3988
3991
  done = true;
3989
- eventQueue.setResolver(() => {});
3992
+ eventQueue.notify();
3990
3993
  }).catch((err) => {
3991
3994
  if (!eventQueue.errorOccurred) {
3992
3995
  eventQueue.errorOccurred = true;
@@ -4004,7 +4007,7 @@ class PiExecutorImpl {
4004
4007
  });
4005
4008
  }
4006
4009
  done = true;
4007
- eventQueue.setResolver(() => {});
4010
+ eventQueue.notify();
4008
4011
  });
4009
4012
  try {
4010
4013
  while (!done || eventQueue.length > 0) {
@@ -5100,6 +5103,7 @@ function createChatRoutes(threadManager, agentExecutor, conversationManager, pro
5100
5103
  if (!model || typeof model !== "string") {
5101
5104
  return errorResponse(c, "INVALID_REQUEST", "model is required and must be a string", 400);
5102
5105
  }
5106
+ console.log(`[chat] User message (thread: ${threadId}): ${content}`);
5103
5107
  const thread = await threadManager.getThread(threadId);
5104
5108
  if (!thread) {
5105
5109
  return errorResponse(c, "THREAD_NOT_FOUND", `Thread not found: ${threadId}`, 404);
@@ -5183,6 +5187,7 @@ User: ${content}` : content;
5183
5187
  capturedEvents.push(event);
5184
5188
  if (event.type === "message" && event.content) {
5185
5189
  fullContent += event.content;
5190
+ console.log(`[chat] Assistant (role: ${event.role ?? "assistant"}): ${event.content}`);
5186
5191
  }
5187
5192
  if (event.type === "message" && typeof event.content === "string" && (event.role === "tool" || isToolLikeContent(event.content))) {
5188
5193
  yield { type: "thinking", content: event.content };
@@ -5220,7 +5225,11 @@ User: ${content}` : content;
5220
5225
  processingStateManager.clearProcessing(threadId);
5221
5226
  }
5222
5227
  }
5223
- return streamAsyncGenerator(c, chatExecutionGenerator());
5228
+ async function* withCompleteSignal() {
5229
+ yield* chatExecutionGenerator();
5230
+ yield { type: "complete" };
5231
+ }
5232
+ return streamAsyncGenerator(c, withCompleteSignal());
5224
5233
  } catch (error) {
5225
5234
  return errorResponse(c, "REQUEST_PARSE_ERROR", "Failed to parse request body", 400, error instanceof Error ? error.message : String(error));
5226
5235
  }
@@ -5560,32 +5569,6 @@ import { Hono as Hono5 } from "hono";
5560
5569
 
5561
5570
  // src/provider-data.ts
5562
5571
  var PROVIDER_DATA = [
5563
- {
5564
- id: "aihubmix",
5565
- models: [
5566
- "DeepSeek-R1",
5567
- "DeepSeek-V3",
5568
- "claude-3-5-sonnet-20241022",
5569
- "claude-3-7-sonnet-20250219",
5570
- "claude-opus-4-1",
5571
- "claude-opus-4-20250514",
5572
- "claude-sonnet-4-20250514",
5573
- "claude-sonnet-4-5",
5574
- "gemini-2.5-flash",
5575
- "gemini-2.5-flash-lite",
5576
- "gemini-2.5-pro",
5577
- "glm-4.6",
5578
- "gpt-4",
5579
- "gpt-4.1",
5580
- "gpt-4o",
5581
- "gpt-5",
5582
- "gpt-5-mini",
5583
- "kimi-k2-thinking",
5584
- "kimi-k2-turbo-preview",
5585
- "o3-mini",
5586
- "o4-mini"
5587
- ]
5588
- },
5589
5572
  {
5590
5573
  id: "anthropic",
5591
5574
  models: [
@@ -6062,6 +6045,163 @@ async function getModelInfoForProvider(provider, modelIds, apiKey) {
6062
6045
  return result;
6063
6046
  }
6064
6047
 
6048
+ // src/generated-data.ts
6049
+ var GENERATED_DATA = [
6050
+ {
6051
+ id: "aihubmix",
6052
+ models: [
6053
+ "BAAI/bge-large-en-v1.5",
6054
+ "BAAI/bge-large-zh-v1.5",
6055
+ "DeepSeek-R1",
6056
+ "DeepSeek-V3",
6057
+ "DeepSeek-V3-Fast",
6058
+ "DeepSeek-V3.1-Fast",
6059
+ "DeepSeek-V3.1-Terminus",
6060
+ "DeepSeek-V3.1-Think",
6061
+ "DeepSeek-V3.2-Exp",
6062
+ "DeepSeek-V3.2-Exp-Think",
6063
+ "ERNIE-X1.1-Preview",
6064
+ "Kimi-K2-0905",
6065
+ "Qwen/QwQ-32B",
6066
+ "Qwen/Qwen2.5-VL-32B-Instruct",
6067
+ "baidu/ERNIE-4.5-300B-A47B",
6068
+ "bge-large-en",
6069
+ "bge-large-zh",
6070
+ "cc-MiniMax-M2",
6071
+ "cc-deepseek-v3.1",
6072
+ "cc-ernie-4.5-300b-a47b",
6073
+ "cc-kimi-k2-instruct",
6074
+ "cc-kimi-k2-instruct-0905",
6075
+ "cc-minimax-m2",
6076
+ "cc-minimax-m2.1",
6077
+ "cc-minimax-m2.5",
6078
+ "claude-3-5-haiku",
6079
+ "claude-3-5-sonnet",
6080
+ "claude-3-7-sonnet",
6081
+ "claude-haiku-4-5",
6082
+ "claude-opus-4-0",
6083
+ "claude-opus-4-1",
6084
+ "claude-opus-4-5",
6085
+ "claude-opus-4-5-think",
6086
+ "claude-opus-4-6",
6087
+ "claude-opus-4-6-think",
6088
+ "claude-sonnet-4-0",
6089
+ "claude-sonnet-4-5",
6090
+ "claude-sonnet-4-5-think",
6091
+ "claude-sonnet-4-6",
6092
+ "claude-sonnet-4-6-think",
6093
+ "coding-glm-4.6",
6094
+ "coding-glm-4.6-free",
6095
+ "coding-glm-4.7",
6096
+ "coding-glm-4.7-free",
6097
+ "coding-glm-5",
6098
+ "coding-glm-5-free",
6099
+ "coding-minimax-m2",
6100
+ "coding-minimax-m2-free",
6101
+ "coding-minimax-m2.1",
6102
+ "coding-minimax-m2.5",
6103
+ "deepseek-v3.2",
6104
+ "deepseek-v3.2-think",
6105
+ "doubao-seed-1-8",
6106
+ "doubao-seed-2-0-code-preview",
6107
+ "doubao-seed-2-0-lite",
6108
+ "doubao-seed-2-0-mini",
6109
+ "doubao-seed-2-0-pro",
6110
+ "ernie-4.5",
6111
+ "ernie-4.5-0.3b",
6112
+ "ernie-4.5-turbo-128k-preview",
6113
+ "ernie-4.5-turbo-latest",
6114
+ "ernie-4.5-turbo-vl",
6115
+ "ernie-irag-edit",
6116
+ "ernie-x1-turbo",
6117
+ "gemini-2.0-flash",
6118
+ "gemini-2.0-flash-exp-search",
6119
+ "gemini-2.0-flash-free",
6120
+ "gemini-2.5-flash",
6121
+ "gemini-2.5-flash-lite",
6122
+ "gemini-2.5-flash-lite-preview-09-2025",
6123
+ "gemini-2.5-flash-nothink",
6124
+ "gemini-2.5-flash-preview-05-20-nothink",
6125
+ "gemini-2.5-flash-preview-05-20-search",
6126
+ "gemini-2.5-flash-preview-09-2025",
6127
+ "gemini-2.5-flash-search",
6128
+ "gemini-2.5-pro",
6129
+ "gemini-2.5-pro-preview-03-25",
6130
+ "gemini-2.5-pro-preview-03-25-search",
6131
+ "gemini-2.5-pro-preview-06-05",
6132
+ "gemini-2.5-pro-preview-06-05-search",
6133
+ "gemini-2.5-pro-search",
6134
+ "gemini-3-flash-preview",
6135
+ "gemini-3-flash-preview-free",
6136
+ "gemini-3-flash-preview-search",
6137
+ "gemini-3-pro-preview",
6138
+ "gemini-3-pro-preview-search",
6139
+ "gemini-3.1-pro-preview",
6140
+ "gemini-3.1-pro-preview-customtools",
6141
+ "gemini-3.1-pro-preview-search",
6142
+ "glm-4.6",
6143
+ "glm-4.7",
6144
+ "glm-4.7-flash-free",
6145
+ "gpt-4.1",
6146
+ "gpt-4.1-free",
6147
+ "gpt-4.1-mini",
6148
+ "gpt-4.1-mini-free",
6149
+ "gpt-4.1-nano",
6150
+ "gpt-4.1-nano-free",
6151
+ "gpt-4o",
6152
+ "gpt-4o-free",
6153
+ "gpt-5",
6154
+ "gpt-5-codex",
6155
+ "gpt-5-mini",
6156
+ "gpt-5-nano",
6157
+ "gpt-5-pro",
6158
+ "gpt-5.1",
6159
+ "gpt-5.2",
6160
+ "gpt-5.2-high",
6161
+ "gpt-5.2-low",
6162
+ "gpt-5.2-pro",
6163
+ "grok-4-1-fast-non-reasoning",
6164
+ "grok-4-1-fast-reasoning",
6165
+ "grok-code-fast-1",
6166
+ "inclusionAI/Ling-1T",
6167
+ "inclusionAI/Ling-flash-2.0",
6168
+ "inclusionAI/Ling-mini-2.0",
6169
+ "inclusionAI/Ring-1T",
6170
+ "inclusionAI/Ring-flash-2.0",
6171
+ "kimi-for-coding-free",
6172
+ "kimi-k2-0711",
6173
+ "kimi-k2-thinking",
6174
+ "kimi-k2-turbo-preview",
6175
+ "llama-4-maverick",
6176
+ "llama-4-scout",
6177
+ "o3",
6178
+ "o3-pro",
6179
+ "qwen3-235b-a22b",
6180
+ "qwen3-235b-a22b-instruct-2507",
6181
+ "qwen3-235b-a22b-thinking-2507",
6182
+ "qwen3-coder-30b-a3b-instruct",
6183
+ "qwen3-coder-480b-a35b-instruct",
6184
+ "qwen3-coder-flash",
6185
+ "qwen3-coder-next",
6186
+ "qwen3-coder-plus",
6187
+ "qwen3-coder-plus-2025-07-22",
6188
+ "qwen3-max",
6189
+ "qwen3-max-preview",
6190
+ "qwen3-next-80b-a3b-instruct",
6191
+ "qwen3-next-80b-a3b-thinking",
6192
+ "qwen3-vl-235b-a22b-instruct",
6193
+ "qwen3-vl-235b-a22b-thinking",
6194
+ "qwen3-vl-30b-a3b-instruct",
6195
+ "qwen3-vl-30b-a3b-thinking",
6196
+ "qwen3-vl-flash",
6197
+ "qwen3-vl-flash-2026-01-22",
6198
+ "qwen3-vl-plus",
6199
+ "qwen3.5-397b-a17b",
6200
+ "qwen3.5-plus"
6201
+ ]
6202
+ }
6203
+ ];
6204
+
6065
6205
  // src/managers/model-manager.ts
6066
6206
  class ModelManager {
6067
6207
  metadataManager;
@@ -6070,7 +6210,10 @@ class ModelManager {
6070
6210
  }
6071
6211
  async getAvailableModels(provider) {
6072
6212
  const providerId = provider.toLowerCase();
6073
- const providerData = PROVIDER_DATA.find((p) => p.id === providerId);
6213
+ let providerData = PROVIDER_DATA.find((p) => p.id === providerId);
6214
+ if (!providerData) {
6215
+ providerData = GENERATED_DATA.find((p) => p.id === providerId);
6216
+ }
6074
6217
  if (!providerData) {
6075
6218
  throw new Error(`Provider "${provider}" is not supported`);
6076
6219
  }