@getpochi/cli 0.5.60 → 0.5.62

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.
Files changed (2) hide show
  1. package/dist/cli.js +624 -100
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -347749,6 +347749,520 @@ var originalGenerateId = createIdGenerator({
347749
347749
  prefix: "aitxt",
347750
347750
  size: 24
347751
347751
  });
347752
+ async function generateText({
347753
+ model: modelArg,
347754
+ tools,
347755
+ toolChoice,
347756
+ system,
347757
+ prompt,
347758
+ messages,
347759
+ maxRetries: maxRetriesArg,
347760
+ abortSignal,
347761
+ headers,
347762
+ stopWhen = stepCountIs(1),
347763
+ experimental_output: output,
347764
+ experimental_telemetry: telemetry,
347765
+ providerOptions,
347766
+ experimental_activeTools,
347767
+ activeTools = experimental_activeTools,
347768
+ experimental_prepareStep,
347769
+ prepareStep = experimental_prepareStep,
347770
+ experimental_repairToolCall: repairToolCall,
347771
+ experimental_download: download2,
347772
+ experimental_context,
347773
+ _internal: {
347774
+ generateId: generateId3 = originalGenerateId,
347775
+ currentDate = () => /* @__PURE__ */ new Date
347776
+ } = {},
347777
+ onStepFinish,
347778
+ ...settings
347779
+ }) {
347780
+ const model = resolveLanguageModel(modelArg);
347781
+ const stopConditions = asArray(stopWhen);
347782
+ const { maxRetries, retry } = prepareRetries({
347783
+ maxRetries: maxRetriesArg,
347784
+ abortSignal
347785
+ });
347786
+ const callSettings = prepareCallSettings(settings);
347787
+ const headersWithUserAgent = withUserAgentSuffix(headers != null ? headers : {}, `ai/${VERSION3}`);
347788
+ const baseTelemetryAttributes = getBaseTelemetryAttributes({
347789
+ model,
347790
+ telemetry,
347791
+ headers: headersWithUserAgent,
347792
+ settings: { ...callSettings, maxRetries }
347793
+ });
347794
+ const initialPrompt = await standardizePrompt({
347795
+ system,
347796
+ prompt,
347797
+ messages
347798
+ });
347799
+ const tracer = getTracer(telemetry);
347800
+ try {
347801
+ return await recordSpan({
347802
+ name: "ai.generateText",
347803
+ attributes: selectTelemetryAttributes({
347804
+ telemetry,
347805
+ attributes: {
347806
+ ...assembleOperationName({
347807
+ operationId: "ai.generateText",
347808
+ telemetry
347809
+ }),
347810
+ ...baseTelemetryAttributes,
347811
+ "ai.model.provider": model.provider,
347812
+ "ai.model.id": model.modelId,
347813
+ "ai.prompt": {
347814
+ input: () => JSON.stringify({ system, prompt, messages })
347815
+ }
347816
+ }
347817
+ }),
347818
+ tracer,
347819
+ fn: async (span) => {
347820
+ var _a172, _b8, _c, _d, _e, _f, _g;
347821
+ const callSettings2 = prepareCallSettings(settings);
347822
+ let currentModelResponse;
347823
+ let clientToolCalls = [];
347824
+ let clientToolOutputs = [];
347825
+ const responseMessages = [];
347826
+ const steps = [];
347827
+ do {
347828
+ const stepInputMessages = [
347829
+ ...initialPrompt.messages,
347830
+ ...responseMessages
347831
+ ];
347832
+ const prepareStepResult = await (prepareStep == null ? undefined : prepareStep({
347833
+ model,
347834
+ steps,
347835
+ stepNumber: steps.length,
347836
+ messages: stepInputMessages
347837
+ }));
347838
+ const promptMessages = await convertToLanguageModelPrompt({
347839
+ prompt: {
347840
+ system: (_a172 = prepareStepResult == null ? undefined : prepareStepResult.system) != null ? _a172 : initialPrompt.system,
347841
+ messages: (_b8 = prepareStepResult == null ? undefined : prepareStepResult.messages) != null ? _b8 : stepInputMessages
347842
+ },
347843
+ supportedUrls: await model.supportedUrls,
347844
+ download: download2
347845
+ });
347846
+ const stepModel = resolveLanguageModel((_c = prepareStepResult == null ? undefined : prepareStepResult.model) != null ? _c : model);
347847
+ const { toolChoice: stepToolChoice, tools: stepTools } = prepareToolsAndToolChoice({
347848
+ tools,
347849
+ toolChoice: (_d = prepareStepResult == null ? undefined : prepareStepResult.toolChoice) != null ? _d : toolChoice,
347850
+ activeTools: (_e = prepareStepResult == null ? undefined : prepareStepResult.activeTools) != null ? _e : activeTools
347851
+ });
347852
+ currentModelResponse = await retry(() => {
347853
+ var _a18;
347854
+ return recordSpan({
347855
+ name: "ai.generateText.doGenerate",
347856
+ attributes: selectTelemetryAttributes({
347857
+ telemetry,
347858
+ attributes: {
347859
+ ...assembleOperationName({
347860
+ operationId: "ai.generateText.doGenerate",
347861
+ telemetry
347862
+ }),
347863
+ ...baseTelemetryAttributes,
347864
+ "ai.model.provider": stepModel.provider,
347865
+ "ai.model.id": stepModel.modelId,
347866
+ "ai.prompt.messages": {
347867
+ input: () => stringifyForTelemetry(promptMessages)
347868
+ },
347869
+ "ai.prompt.tools": {
347870
+ input: () => stepTools == null ? undefined : stepTools.map((tool3) => JSON.stringify(tool3))
347871
+ },
347872
+ "ai.prompt.toolChoice": {
347873
+ input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
347874
+ },
347875
+ "gen_ai.system": stepModel.provider,
347876
+ "gen_ai.request.model": stepModel.modelId,
347877
+ "gen_ai.request.frequency_penalty": settings.frequencyPenalty,
347878
+ "gen_ai.request.max_tokens": settings.maxOutputTokens,
347879
+ "gen_ai.request.presence_penalty": settings.presencePenalty,
347880
+ "gen_ai.request.stop_sequences": settings.stopSequences,
347881
+ "gen_ai.request.temperature": (_a18 = settings.temperature) != null ? _a18 : undefined,
347882
+ "gen_ai.request.top_k": settings.topK,
347883
+ "gen_ai.request.top_p": settings.topP
347884
+ }
347885
+ }),
347886
+ tracer,
347887
+ fn: async (span2) => {
347888
+ var _a19, _b22, _c2, _d2, _e2, _f2, _g2, _h;
347889
+ const result2 = await stepModel.doGenerate({
347890
+ ...callSettings2,
347891
+ tools: stepTools,
347892
+ toolChoice: stepToolChoice,
347893
+ responseFormat: output == null ? undefined : output.responseFormat,
347894
+ prompt: promptMessages,
347895
+ providerOptions,
347896
+ abortSignal,
347897
+ headers: headersWithUserAgent
347898
+ });
347899
+ const responseData = {
347900
+ id: (_b22 = (_a19 = result2.response) == null ? undefined : _a19.id) != null ? _b22 : generateId3(),
347901
+ timestamp: (_d2 = (_c2 = result2.response) == null ? undefined : _c2.timestamp) != null ? _d2 : currentDate(),
347902
+ modelId: (_f2 = (_e2 = result2.response) == null ? undefined : _e2.modelId) != null ? _f2 : stepModel.modelId,
347903
+ headers: (_g2 = result2.response) == null ? undefined : _g2.headers,
347904
+ body: (_h = result2.response) == null ? undefined : _h.body
347905
+ };
347906
+ span2.setAttributes(selectTelemetryAttributes({
347907
+ telemetry,
347908
+ attributes: {
347909
+ "ai.response.finishReason": result2.finishReason,
347910
+ "ai.response.text": {
347911
+ output: () => extractTextContent(result2.content)
347912
+ },
347913
+ "ai.response.toolCalls": {
347914
+ output: () => {
347915
+ const toolCalls = asToolCalls(result2.content);
347916
+ return toolCalls == null ? undefined : JSON.stringify(toolCalls);
347917
+ }
347918
+ },
347919
+ "ai.response.id": responseData.id,
347920
+ "ai.response.model": responseData.modelId,
347921
+ "ai.response.timestamp": responseData.timestamp.toISOString(),
347922
+ "ai.response.providerMetadata": JSON.stringify(result2.providerMetadata),
347923
+ "ai.usage.promptTokens": result2.usage.inputTokens,
347924
+ "ai.usage.completionTokens": result2.usage.outputTokens,
347925
+ "gen_ai.response.finish_reasons": [result2.finishReason],
347926
+ "gen_ai.response.id": responseData.id,
347927
+ "gen_ai.response.model": responseData.modelId,
347928
+ "gen_ai.usage.input_tokens": result2.usage.inputTokens,
347929
+ "gen_ai.usage.output_tokens": result2.usage.outputTokens
347930
+ }
347931
+ }));
347932
+ return { ...result2, response: responseData };
347933
+ }
347934
+ });
347935
+ });
347936
+ const stepToolCalls = await Promise.all(currentModelResponse.content.filter((part) => part.type === "tool-call").map((toolCall) => parseToolCall({
347937
+ toolCall,
347938
+ tools,
347939
+ repairToolCall,
347940
+ system,
347941
+ messages: stepInputMessages
347942
+ })));
347943
+ for (const toolCall of stepToolCalls) {
347944
+ if (toolCall.invalid) {
347945
+ continue;
347946
+ }
347947
+ const tool3 = tools[toolCall.toolName];
347948
+ if ((tool3 == null ? undefined : tool3.onInputAvailable) != null) {
347949
+ await tool3.onInputAvailable({
347950
+ input: toolCall.input,
347951
+ toolCallId: toolCall.toolCallId,
347952
+ messages: stepInputMessages,
347953
+ abortSignal,
347954
+ experimental_context
347955
+ });
347956
+ }
347957
+ }
347958
+ const invalidToolCalls = stepToolCalls.filter((toolCall) => toolCall.invalid && toolCall.dynamic);
347959
+ clientToolOutputs = [];
347960
+ for (const toolCall of invalidToolCalls) {
347961
+ clientToolOutputs.push({
347962
+ type: "tool-error",
347963
+ toolCallId: toolCall.toolCallId,
347964
+ toolName: toolCall.toolName,
347965
+ input: toolCall.input,
347966
+ error: getErrorMessage2(toolCall.error),
347967
+ dynamic: true
347968
+ });
347969
+ }
347970
+ clientToolCalls = stepToolCalls.filter((toolCall) => !toolCall.providerExecuted);
347971
+ if (tools != null) {
347972
+ clientToolOutputs.push(...await executeTools({
347973
+ toolCalls: clientToolCalls.filter((toolCall) => !toolCall.invalid),
347974
+ tools,
347975
+ tracer,
347976
+ telemetry,
347977
+ messages: stepInputMessages,
347978
+ abortSignal,
347979
+ experimental_context
347980
+ }));
347981
+ }
347982
+ const stepContent = asContent({
347983
+ content: currentModelResponse.content,
347984
+ toolCalls: stepToolCalls,
347985
+ toolOutputs: clientToolOutputs
347986
+ });
347987
+ responseMessages.push(...toResponseMessages({
347988
+ content: stepContent,
347989
+ tools
347990
+ }));
347991
+ const currentStepResult = new DefaultStepResult({
347992
+ content: stepContent,
347993
+ finishReason: currentModelResponse.finishReason,
347994
+ usage: currentModelResponse.usage,
347995
+ warnings: currentModelResponse.warnings,
347996
+ providerMetadata: currentModelResponse.providerMetadata,
347997
+ request: (_f = currentModelResponse.request) != null ? _f : {},
347998
+ response: {
347999
+ ...currentModelResponse.response,
348000
+ messages: structuredClone(responseMessages)
348001
+ }
348002
+ });
348003
+ logWarnings((_g = currentModelResponse.warnings) != null ? _g : []);
348004
+ steps.push(currentStepResult);
348005
+ await (onStepFinish == null ? undefined : onStepFinish(currentStepResult));
348006
+ } while (clientToolCalls.length > 0 && clientToolOutputs.length === clientToolCalls.length && !await isStopConditionMet({ stopConditions, steps }));
348007
+ span.setAttributes(selectTelemetryAttributes({
348008
+ telemetry,
348009
+ attributes: {
348010
+ "ai.response.finishReason": currentModelResponse.finishReason,
348011
+ "ai.response.text": {
348012
+ output: () => extractTextContent(currentModelResponse.content)
348013
+ },
348014
+ "ai.response.toolCalls": {
348015
+ output: () => {
348016
+ const toolCalls = asToolCalls(currentModelResponse.content);
348017
+ return toolCalls == null ? undefined : JSON.stringify(toolCalls);
348018
+ }
348019
+ },
348020
+ "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
348021
+ "ai.usage.promptTokens": currentModelResponse.usage.inputTokens,
348022
+ "ai.usage.completionTokens": currentModelResponse.usage.outputTokens
348023
+ }
348024
+ }));
348025
+ const lastStep = steps[steps.length - 1];
348026
+ return new DefaultGenerateTextResult({
348027
+ steps,
348028
+ resolvedOutput: await (output == null ? undefined : output.parseOutput({ text: lastStep.text }, {
348029
+ response: lastStep.response,
348030
+ usage: lastStep.usage,
348031
+ finishReason: lastStep.finishReason
348032
+ }))
348033
+ });
348034
+ }
348035
+ });
348036
+ } catch (error40) {
348037
+ throw wrapGatewayError(error40);
348038
+ }
348039
+ }
348040
+ async function executeTools({
348041
+ toolCalls,
348042
+ tools,
348043
+ tracer,
348044
+ telemetry,
348045
+ messages,
348046
+ abortSignal,
348047
+ experimental_context
348048
+ }) {
348049
+ const toolOutputs = await Promise.all(toolCalls.map(async ({ toolCallId, toolName, input }) => {
348050
+ const tool3 = tools[toolName];
348051
+ if ((tool3 == null ? undefined : tool3.execute) == null) {
348052
+ return;
348053
+ }
348054
+ return recordSpan({
348055
+ name: "ai.toolCall",
348056
+ attributes: selectTelemetryAttributes({
348057
+ telemetry,
348058
+ attributes: {
348059
+ ...assembleOperationName({
348060
+ operationId: "ai.toolCall",
348061
+ telemetry
348062
+ }),
348063
+ "ai.toolCall.name": toolName,
348064
+ "ai.toolCall.id": toolCallId,
348065
+ "ai.toolCall.args": {
348066
+ output: () => JSON.stringify(input)
348067
+ }
348068
+ }
348069
+ }),
348070
+ tracer,
348071
+ fn: async (span) => {
348072
+ try {
348073
+ const stream = executeTool({
348074
+ execute: tool3.execute.bind(tool3),
348075
+ input,
348076
+ options: {
348077
+ toolCallId,
348078
+ messages,
348079
+ abortSignal,
348080
+ experimental_context
348081
+ }
348082
+ });
348083
+ let output;
348084
+ for await (const part of stream) {
348085
+ if (part.type === "final") {
348086
+ output = part.output;
348087
+ }
348088
+ }
348089
+ try {
348090
+ span.setAttributes(selectTelemetryAttributes({
348091
+ telemetry,
348092
+ attributes: {
348093
+ "ai.toolCall.result": {
348094
+ output: () => JSON.stringify(output)
348095
+ }
348096
+ }
348097
+ }));
348098
+ } catch (ignored) {}
348099
+ return {
348100
+ type: "tool-result",
348101
+ toolCallId,
348102
+ toolName,
348103
+ input,
348104
+ output,
348105
+ dynamic: tool3.type === "dynamic"
348106
+ };
348107
+ } catch (error40) {
348108
+ recordErrorOnSpan(span, error40);
348109
+ return {
348110
+ type: "tool-error",
348111
+ toolCallId,
348112
+ toolName,
348113
+ input,
348114
+ error: error40,
348115
+ dynamic: tool3.type === "dynamic"
348116
+ };
348117
+ }
348118
+ }
348119
+ });
348120
+ }));
348121
+ return toolOutputs.filter((output) => output != null);
348122
+ }
348123
+ var DefaultGenerateTextResult = class {
348124
+ constructor(options) {
348125
+ this.steps = options.steps;
348126
+ this.resolvedOutput = options.resolvedOutput;
348127
+ }
348128
+ get finalStep() {
348129
+ return this.steps[this.steps.length - 1];
348130
+ }
348131
+ get content() {
348132
+ return this.finalStep.content;
348133
+ }
348134
+ get text() {
348135
+ return this.finalStep.text;
348136
+ }
348137
+ get files() {
348138
+ return this.finalStep.files;
348139
+ }
348140
+ get reasoningText() {
348141
+ return this.finalStep.reasoningText;
348142
+ }
348143
+ get reasoning() {
348144
+ return this.finalStep.reasoning;
348145
+ }
348146
+ get toolCalls() {
348147
+ return this.finalStep.toolCalls;
348148
+ }
348149
+ get staticToolCalls() {
348150
+ return this.finalStep.staticToolCalls;
348151
+ }
348152
+ get dynamicToolCalls() {
348153
+ return this.finalStep.dynamicToolCalls;
348154
+ }
348155
+ get toolResults() {
348156
+ return this.finalStep.toolResults;
348157
+ }
348158
+ get staticToolResults() {
348159
+ return this.finalStep.staticToolResults;
348160
+ }
348161
+ get dynamicToolResults() {
348162
+ return this.finalStep.dynamicToolResults;
348163
+ }
348164
+ get sources() {
348165
+ return this.finalStep.sources;
348166
+ }
348167
+ get finishReason() {
348168
+ return this.finalStep.finishReason;
348169
+ }
348170
+ get warnings() {
348171
+ return this.finalStep.warnings;
348172
+ }
348173
+ get providerMetadata() {
348174
+ return this.finalStep.providerMetadata;
348175
+ }
348176
+ get response() {
348177
+ return this.finalStep.response;
348178
+ }
348179
+ get request() {
348180
+ return this.finalStep.request;
348181
+ }
348182
+ get usage() {
348183
+ return this.finalStep.usage;
348184
+ }
348185
+ get totalUsage() {
348186
+ return this.steps.reduce((totalUsage, step) => {
348187
+ return addLanguageModelUsage(totalUsage, step.usage);
348188
+ }, {
348189
+ inputTokens: undefined,
348190
+ outputTokens: undefined,
348191
+ totalTokens: undefined,
348192
+ reasoningTokens: undefined,
348193
+ cachedInputTokens: undefined
348194
+ });
348195
+ }
348196
+ get experimental_output() {
348197
+ if (this.resolvedOutput == null) {
348198
+ throw new NoOutputSpecifiedError;
348199
+ }
348200
+ return this.resolvedOutput;
348201
+ }
348202
+ };
348203
+ function asToolCalls(content) {
348204
+ const parts = content.filter((part) => part.type === "tool-call");
348205
+ if (parts.length === 0) {
348206
+ return;
348207
+ }
348208
+ return parts.map((toolCall) => ({
348209
+ toolCallId: toolCall.toolCallId,
348210
+ toolName: toolCall.toolName,
348211
+ input: toolCall.input
348212
+ }));
348213
+ }
348214
+ function asContent({
348215
+ content,
348216
+ toolCalls,
348217
+ toolOutputs
348218
+ }) {
348219
+ return [
348220
+ ...content.map((part) => {
348221
+ switch (part.type) {
348222
+ case "text":
348223
+ case "reasoning":
348224
+ case "source":
348225
+ return part;
348226
+ case "file": {
348227
+ return {
348228
+ type: "file",
348229
+ file: new DefaultGeneratedFile(part)
348230
+ };
348231
+ }
348232
+ case "tool-call": {
348233
+ return toolCalls.find((toolCall) => toolCall.toolCallId === part.toolCallId);
348234
+ }
348235
+ case "tool-result": {
348236
+ const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
348237
+ if (toolCall == null) {
348238
+ throw new Error(`Tool call ${part.toolCallId} not found.`);
348239
+ }
348240
+ if (part.isError) {
348241
+ return {
348242
+ type: "tool-error",
348243
+ toolCallId: part.toolCallId,
348244
+ toolName: part.toolName,
348245
+ input: toolCall.input,
348246
+ error: part.result,
348247
+ providerExecuted: true,
348248
+ dynamic: toolCall.dynamic
348249
+ };
348250
+ }
348251
+ return {
348252
+ type: "tool-result",
348253
+ toolCallId: part.toolCallId,
348254
+ toolName: part.toolName,
348255
+ input: toolCall.input,
348256
+ output: part.result,
348257
+ providerExecuted: true,
348258
+ dynamic: toolCall.dynamic
348259
+ };
348260
+ }
348261
+ }
348262
+ }),
348263
+ ...toolOutputs
348264
+ ];
348265
+ }
347752
348266
  function prepareHeaders(headers, defaultHeaders) {
347753
348267
  const responseHeaders = new Headers(headers != null ? headers : {});
347754
348268
  for (const [key, value2] of Object.entries(defaultHeaders)) {
@@ -359465,7 +359979,6 @@ function createModel(vendorId, opts) {
359465
359979
 
359466
359980
  // ../vendor-pochi/src/model.ts
359467
359981
  function createPochiModel({
359468
- id,
359469
359982
  modelId,
359470
359983
  getCredentials
359471
359984
  }) {
@@ -359474,11 +359987,28 @@ function createPochiModel({
359474
359987
  provider: "pochi",
359475
359988
  modelId: modelId || "<default>",
359476
359989
  supportedUrls: {},
359477
- doGenerate: async () => Promise.reject("Not implemented"),
359478
- doStream: async ({ prompt, abortSignal, stopSequences, tools }) => {
359990
+ doGenerate: async ({ headers, ...options }) => {
359991
+ const apiClient = createApiClient(getCredentials);
359992
+ const resp = await apiClient.api.chat.$post({
359993
+ json: {
359994
+ model: modelId,
359995
+ options
359996
+ }
359997
+ }, {
359998
+ headers: headers ? i5(headers, (x) => x || "") : undefined
359999
+ });
360000
+ const data = await resp.json();
360001
+ return data;
360002
+ },
360003
+ doStream: async ({
360004
+ prompt,
360005
+ abortSignal,
360006
+ stopSequences,
360007
+ tools,
360008
+ headers
360009
+ }) => {
359479
360010
  const apiClient = createApiClient(getCredentials);
359480
360011
  const data = {
359481
- id,
359482
360012
  model: modelId,
359483
360013
  callOptions: {
359484
360014
  prompt: convertFilePartDataToBase64(prompt),
@@ -359489,6 +360019,7 @@ function createPochiModel({
359489
360019
  const resp = await apiClient.api.chat.stream.$post({
359490
360020
  json: data
359491
360021
  }, {
360022
+ headers: headers ? i5(headers, (x) => x || "") : undefined,
359492
360023
  init: {
359493
360024
  signal: abortSignal
359494
360025
  }
@@ -368440,7 +368971,7 @@ var {
368440
368971
  // package.json
368441
368972
  var package_default = {
368442
368973
  name: "@getpochi/cli",
368443
- version: "0.5.60",
368974
+ version: "0.5.62",
368444
368975
  type: "module",
368445
368976
  bin: {
368446
368977
  pochi: "src/cli.ts"
@@ -409842,6 +410373,9 @@ function toTaskError(error46) {
409842
410373
  return internalError(error46.message);
409843
410374
  }
409844
410375
 
410376
+ // ../common/src/pochi-api.ts
410377
+ var PochiTaskIdHeader = "x-pochi-task-id";
410378
+
409845
410379
  // ../livekit/src/chat/llm/generate-task-title.ts
409846
410380
  var logger18 = getLogger("generateTaskTitle");
409847
410381
  async function generateTaskTitle(options6) {
@@ -409853,6 +410387,7 @@ async function generateTaskTitle(options6) {
409853
410387
  return newTitle;
409854
410388
  }
409855
410389
  async function generateTaskTitleImpl({
410390
+ taskId,
409856
410391
  title,
409857
410392
  messages: messages2,
409858
410393
  getModel,
@@ -409870,7 +410405,7 @@ async function generateTaskTitleImpl({
409870
410405
  if (partCount >= 5 && partCount < 20 && !isTitleGeneratedByLlm(title, titleFromMessages)) {
409871
410406
  try {
409872
410407
  const model2 = getModel();
409873
- const title2 = await generateTitle2(model2, messages2, abortSignal);
410408
+ const title2 = await generateTitle2(taskId, model2, messages2, abortSignal);
409874
410409
  if (title2.length > 0) {
409875
410410
  return title2;
409876
410411
  }
@@ -409896,7 +410431,7 @@ function getTitleFromMessages(messages2) {
409896
410431
  function isTitleGeneratedByLlm(title, titleFromMessages) {
409897
410432
  return title !== titleFromMessages;
409898
410433
  }
409899
- async function generateTitle2(model2, inputMessages, abortSignal) {
410434
+ async function generateTitle2(taskId, model2, inputMessages, abortSignal) {
409900
410435
  const messages2 = [
409901
410436
  ...inputMessages,
409902
410437
  {
@@ -409910,14 +410445,17 @@ async function generateTitle2(model2, inputMessages, abortSignal) {
409910
410445
  ]
409911
410446
  }
409912
410447
  ];
409913
- const stream12 = streamText({
410448
+ const resp = await generateText({
410449
+ headers: {
410450
+ [PochiTaskIdHeader]: taskId
410451
+ },
409914
410452
  model: model2,
409915
410453
  prompt: convertToModelMessages(formatters.llm(messages2, { removeSystemReminder: true })),
409916
410454
  abortSignal,
409917
410455
  maxOutputTokens: 50,
409918
410456
  maxRetries: 0
409919
410457
  });
409920
- return (await stream12.text).trim();
410458
+ return resp.text;
409921
410459
  }
409922
410460
 
409923
410461
  // ../livekit/src/chat/background-job/manager.ts
@@ -409964,6 +410502,7 @@ async function process16({
409964
410502
  return;
409965
410503
  }
409966
410504
  const newTitle = await generateTaskTitle({
410505
+ taskId,
409967
410506
  title: task.title,
409968
410507
  messages: messages2,
409969
410508
  getModel
@@ -410050,56 +410589,33 @@ async function digest(data) {
410050
410589
  }
410051
410590
 
410052
410591
  // ../livekit/src/chat/llm/repair-tool-call.ts
410053
- var logger21 = getLogger("RepairToolCall");
410054
- var makeRepairToolCall = (model2) => async ({ toolCall, inputSchema: inputSchema2, error: error46 }) => {
410592
+ var makeRepairToolCall = (taskId, model2) => async ({ toolCall, inputSchema: inputSchema2, error: error46 }) => {
410055
410593
  if (NoSuchToolError.isInstance(error46)) {
410056
410594
  return null;
410057
410595
  }
410058
- const result2 = await streamText({
410596
+ const tools = createClientTools();
410597
+ const tool2 = tools[toolCall.toolName];
410598
+ const { object: repairedArgs } = await generateObject({
410599
+ headers: {
410600
+ [PochiTaskIdHeader]: taskId
410601
+ },
410059
410602
  model: model2,
410603
+ schema: tool2.inputSchema,
410060
410604
  prompt: [
410061
- `The model tried to call the tool "${toolCall.toolName}" with the following arguments:`,
410605
+ `The model tried to call the tool "${toolCall.toolName}" with the following inputs:`,
410062
410606
  JSON.stringify(toolCall.input),
410063
410607
  "The tool accepts the following schema:",
410064
410608
  JSON.stringify(inputSchema2(toolCall)),
410065
- "Please fix the arguments. Please ONLY output the json string, without any other text (no markdown code block wrapper, either)",
410066
- "",
410067
- "<good-example>",
410068
- '{"path": "./src/file.ts", "content": "console.log("hello");"}',
410069
- "</good-example>",
410070
- "",
410071
- "<bad-example>",
410072
- "```json",
410073
- '{"path": "./src/file.ts", "content": "console.log("hello");"}',
410074
- "```",
410075
- "</bad-example>",
410076
- "",
410077
- "<bad-example>",
410078
- "Here is the corrected JSON:",
410079
- '{"path": "./src/file.ts", "content": "console.log("hello");"}',
410080
- "</bad-example>",
410081
- "",
410082
- "<bad-example>",
410083
- "```",
410084
- '{"path": "./src/file.ts", "content": "console.log("hello");"}',
410085
- "```",
410086
- "</bad-example>",
410087
- "",
410088
- "<bad-example>",
410089
- '{"path": "./src/file.ts", "content": "console.log("hello");"} // Fixed arguments',
410090
- "</bad-example>"
410609
+ "Please fix the inputs."
410091
410610
  ].join(`
410092
- `),
410093
- maxOutputTokens: 3000,
410094
- maxRetries: 0
410611
+ `)
410095
410612
  });
410096
- const input2 = await result2.text;
410097
- logger21.debug("Repairing tool call:", toolCall.toolName, input2);
410098
- return { ...toolCall, input: input2 };
410613
+ return { ...toolCall, input: JSON.stringify(repairedArgs) };
410099
410614
  };
410100
410615
  // ../livekit/src/chat/llm/compact-task.ts
410101
- var logger22 = getLogger("compactTask");
410616
+ var logger21 = getLogger("compactTask");
410102
410617
  async function compactTask({
410618
+ taskId,
410103
410619
  model: model2,
410104
410620
  messages: messages2,
410105
410621
  abortSignal,
@@ -410110,7 +410626,7 @@ async function compactTask({
410110
410626
  throw new Error("No messages to compact");
410111
410627
  }
410112
410628
  try {
410113
- const text20 = prompts.inlineCompact(await createSummary(model2, abortSignal, messages2.slice(0, -1)), messages2.length - 1);
410629
+ const text20 = prompts.inlineCompact(await createSummary(taskId, model2, abortSignal, messages2.slice(0, -1)), messages2.length - 1);
410114
410630
  if (inline) {
410115
410631
  lastMessage.parts.unshift({
410116
410632
  type: "text",
@@ -410120,10 +410636,10 @@ async function compactTask({
410120
410636
  }
410121
410637
  return text20;
410122
410638
  } catch (err2) {
410123
- logger22.warn("Failed to create summary", err2);
410639
+ logger21.warn("Failed to create summary", err2);
410124
410640
  }
410125
410641
  }
410126
- async function createSummary(model2, abortSignal, inputMessages) {
410642
+ async function createSummary(taskId, model2, abortSignal, inputMessages) {
410127
410643
  const messages2 = [
410128
410644
  ...inputMessages,
410129
410645
  {
@@ -410137,7 +410653,10 @@ async function createSummary(model2, abortSignal, inputMessages) {
410137
410653
  ]
410138
410654
  }
410139
410655
  ];
410140
- const stream12 = streamText({
410656
+ const resp = await generateText({
410657
+ headers: {
410658
+ [PochiTaskIdHeader]: taskId
410659
+ },
410141
410660
  model: model2,
410142
410661
  prompt: convertToModelMessages(formatters.llm(messages2, {
410143
410662
  removeSystemReminder: true
@@ -410146,7 +410665,7 @@ async function createSummary(model2, abortSignal, inputMessages) {
410146
410665
  maxOutputTokens: 3000,
410147
410666
  maxRetries: 0
410148
410667
  });
410149
- return stream12.text;
410668
+ return resp.text;
410150
410669
  }
410151
410670
  // ../livekit/src/chat/mcp-utils.ts
410152
410671
  function parseMcpToolSet(store, mcpToolSet) {
@@ -410871,10 +411390,10 @@ function createStopWordStream(stop3) {
410871
411390
  });
410872
411391
  }
410873
411392
  // ../livekit/src/chat/middlewares/output-schema-middleware.ts
410874
- function createOutputSchemaMiddleware(outputSchema2) {
411393
+ function createOutputSchemaMiddleware(taskId, model2, outputSchema2) {
410875
411394
  return {
410876
411395
  middlewareVersion: "v2",
410877
- wrapStream: async ({ doStream, model: model2 }) => {
411396
+ wrapStream: async ({ doStream }) => {
410878
411397
  const { stream: stream12, ...rest } = await doStream();
410879
411398
  let toolCallId = "";
410880
411399
  const transformedStream = stream12.pipeThrough(new TransformStream({
@@ -410901,7 +411420,7 @@ function createOutputSchemaMiddleware(outputSchema2) {
410901
411420
  const { result: result2 } = parsedResult.value;
410902
411421
  const newInput = {
410903
411422
  ...parsedResult.value,
410904
- result: await ensureOutputSchema(model2, outputSchema2, result2)
411423
+ result: await ensureOutputSchema(taskId, model2, outputSchema2, result2)
410905
411424
  };
410906
411425
  controller.enqueue({
410907
411426
  ...chunk4,
@@ -410920,9 +411439,12 @@ function createOutputSchemaMiddleware(outputSchema2) {
410920
411439
  }
410921
411440
  };
410922
411441
  }
410923
- async function ensureOutputSchema(model2, schema7, content3) {
411442
+ async function ensureOutputSchema(taskId, model2, schema7, content3) {
410924
411443
  try {
410925
411444
  const { object: object4 } = await generateObject({
411445
+ headers: {
411446
+ [PochiTaskIdHeader]: taskId
411447
+ },
410926
411448
  model: model2,
410927
411449
  schema: schema7,
410928
411450
  prompt: [
@@ -411056,7 +411578,9 @@ function createVertexModel(vertex2, modelId) {
411056
411578
  project: "placeholder",
411057
411579
  location: "placeholder",
411058
411580
  baseURL: "placeholder",
411059
- fetch: async (_input, requestInit) => {
411581
+ fetch: async (input2, requestInit) => {
411582
+ const url3 = typeof input2 === "string" ? input2 : input2 instanceof URL ? input2.toString() : input2.url;
411583
+ const lastSegment = url3.split("/").at(-1);
411060
411584
  const resp = await fetch(issueUrl, {
411061
411585
  headers: {
411062
411586
  "Metadata-Flavor": "Google"
@@ -411064,7 +411588,7 @@ function createVertexModel(vertex2, modelId) {
411064
411588
  }).then((x11) => x11.json());
411065
411589
  const headers = new Headers(requestInit?.headers);
411066
411590
  headers.append("Authorization", `Bearer ${resp.access_token}`);
411067
- return fetch(modelUrl, { ...requestInit, headers });
411591
+ return fetch(`${modelUrl}/${lastSegment}`, { ...requestInit, headers });
411068
411592
  }
411069
411593
  })("placeholder");
411070
411594
  }
@@ -411097,7 +411621,7 @@ function createGoogleVertexTuningModel(llm) {
411097
411621
  }
411098
411622
 
411099
411623
  // ../livekit/src/chat/models/openai.ts
411100
- var logger23 = getLogger("openai");
411624
+ var logger22 = getLogger("openai");
411101
411625
  var OpenAIRequestParamsSchema = exports_external.object({
411102
411626
  max_tokens: exports_external.number().positive().optional(),
411103
411627
  max_completion_tokens: exports_external.number().positive().optional()
@@ -411147,7 +411671,7 @@ function overrideMaxOutputToken(body3) {
411147
411671
  const json10 = JSON.parse(body3);
411148
411672
  const result2 = OpenAIRequestParamsSchema.safeParse(json10);
411149
411673
  if (!result2.success) {
411150
- logger23.error("OpenAI request body validation failed:", result2.error);
411674
+ logger22.error("OpenAI request body validation failed:", result2.error);
411151
411675
  return;
411152
411676
  }
411153
411677
  const parsed = result2.data;
@@ -411156,7 +411680,7 @@ function overrideMaxOutputToken(body3) {
411156
411680
  }
411157
411681
  return JSON.stringify(parsed);
411158
411682
  } catch (error46) {
411159
- logger23.error("Failed to parse OpenAI request body:", error46);
411683
+ logger22.error("Failed to parse OpenAI request body:", error46);
411160
411684
  }
411161
411685
  return;
411162
411686
  }
@@ -411185,12 +411709,9 @@ function createOpenAIResponsesModel(llm) {
411185
411709
  }
411186
411710
 
411187
411711
  // ../livekit/src/chat/models/index.ts
411188
- function createModel2({
411189
- id: id5,
411190
- llm
411191
- }) {
411712
+ function createModel2({ llm }) {
411192
411713
  if (llm.type === "vendor") {
411193
- return llm.getModel(id5);
411714
+ return llm.getModel();
411194
411715
  }
411195
411716
  if (llm.type === "openai") {
411196
411717
  return createOpenAIModel(llm);
@@ -411246,6 +411767,7 @@ class FlexibleChatTransport {
411246
411767
  abortSignal,
411247
411768
  getters: this.getters
411248
411769
  });
411770
+ const model2 = createModel2({ llm });
411249
411771
  const middlewares = [];
411250
411772
  if (!this.isSubTask) {
411251
411773
  middlewares.push(createNewTaskMiddleware(this.store, environment2?.info.cwd, chatId, customAgents));
@@ -411254,7 +411776,7 @@ class FlexibleChatTransport {
411254
411776
  middlewares.push(createReasoningMiddleware());
411255
411777
  }
411256
411778
  if (this.outputSchema) {
411257
- middlewares.push(createOutputSchemaMiddleware(this.outputSchema));
411779
+ middlewares.push(createOutputSchemaMiddleware(chatId, model2, this.outputSchema));
411258
411780
  }
411259
411781
  if (llm.useToolCallMiddleware) {
411260
411782
  middlewares.push(createToolCallMiddleware());
@@ -411274,8 +411796,10 @@ class FlexibleChatTransport {
411274
411796
  return true;
411275
411797
  });
411276
411798
  const preparedMessages = await prepareMessages(messages2, environment2);
411277
- const model2 = createModel2({ id: chatId, llm });
411278
411799
  const stream12 = streamText({
411800
+ headers: {
411801
+ [PochiTaskIdHeader]: chatId
411802
+ },
411279
411803
  system: prompts.system(environment2?.info?.customRules, this.customAgent, mcpInfo?.instructions),
411280
411804
  messages: convertToModelMessages(formatters.llm(preparedMessages), { tools }),
411281
411805
  model: wrapLanguageModel({
@@ -411286,7 +411810,7 @@ class FlexibleChatTransport {
411286
411810
  tools,
411287
411811
  maxRetries: 0,
411288
411812
  onError: () => {},
411289
- experimental_repairToolCall: makeRepairToolCall(model2),
411813
+ experimental_repairToolCall: makeRepairToolCall(chatId, model2),
411290
411814
  experimental_download: async (items) => {
411291
411815
  const promises5 = items.map(async ({
411292
411816
  url: url3,
@@ -411366,7 +411890,7 @@ function estimateTotalTokens(messages2) {
411366
411890
  }
411367
411891
 
411368
411892
  // ../livekit/src/chat/live-chat-kit.ts
411369
- var logger24 = getLogger("LiveChatKit");
411893
+ var logger23 = getLogger("LiveChatKit");
411370
411894
 
411371
411895
  class LiveChatKit {
411372
411896
  taskId;
@@ -411416,15 +411940,16 @@ class LiveChatKit {
411416
411940
  const lastMessage = messages2.at(-1);
411417
411941
  if (lastMessage?.role === "user" && lastMessage.metadata?.kind === "user" && lastMessage.metadata.compact) {
411418
411942
  try {
411419
- const model2 = createModel2({ id: taskId, llm: getters.getLLM() });
411943
+ const model2 = createModel2({ llm: getters.getLLM() });
411420
411944
  await compactTask({
411945
+ taskId: this.taskId,
411421
411946
  model: model2,
411422
411947
  messages: messages2,
411423
411948
  abortSignal: abortSignal2,
411424
411949
  inline: true
411425
411950
  });
411426
411951
  } catch (err2) {
411427
- logger24.error("Failed to compact task", err2);
411952
+ logger23.error("Failed to compact task", err2);
411428
411953
  throw err2;
411429
411954
  }
411430
411955
  }
@@ -411435,8 +411960,9 @@ class LiveChatKit {
411435
411960
  this.spawn = async () => {
411436
411961
  const taskId2 = crypto.randomUUID();
411437
411962
  const { messages: messages2 } = this.chat;
411438
- const model2 = createModel2({ id: taskId2, llm: getters.getLLM() });
411963
+ const model2 = createModel2({ llm: getters.getLLM() });
411439
411964
  const summary6 = await compactTask({
411965
+ taskId: taskId2,
411440
411966
  model: model2,
411441
411967
  messages: messages2,
411442
411968
  abortSignal
@@ -411518,7 +412044,7 @@ class LiveChatKit {
411518
412044
  if (!task) {
411519
412045
  throw new Error("Task not found");
411520
412046
  }
411521
- const getModel = () => createModel2({ id: this.taskId, llm: getters.getLLM() });
412047
+ const getModel = () => createModel2({ llm: getters.getLLM() });
411522
412048
  scheduleGenerateTitleJob({
411523
412049
  taskId: this.taskId,
411524
412050
  store,
@@ -411563,7 +412089,7 @@ class LiveChatKit {
411563
412089
  }));
411564
412090
  };
411565
412091
  onError = (error46) => {
411566
- logger24.error("onError", error46);
412092
+ logger23.error("onError", error46);
411567
412093
  const lastMessage = this.chat.messages.at(-1) || null;
411568
412094
  this.store.commit(events.chatStreamFailed({
411569
412095
  id: this.taskId,
@@ -411716,7 +412242,7 @@ import * as nodePath from "node:path";
411716
412242
 
411717
412243
  // ../common/src/diff-utils.ts
411718
412244
  var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
411719
- var logger25 = getLogger("diffUtils");
412245
+ var logger24 = getLogger("diffUtils");
411720
412246
  function normalize6(content3) {
411721
412247
  return content3.replace(/\r\n/g, `
411722
412248
  `).trimEnd();
@@ -411729,7 +412255,7 @@ class DiffError extends Error {
411729
412255
  }
411730
412256
  }
411731
412257
  async function parseDiffAndApply(fileContent3, searchContent, replaceContent, expectedReplacements = 1) {
411732
- logger25.trace(`Applying diff with expectedReplacements: ${expectedReplacements}`);
412258
+ logger24.trace(`Applying diff with expectedReplacements: ${expectedReplacements}`);
411733
412259
  const isCRLF = fileContent3.includes(`\r
411734
412260
  `);
411735
412261
  const normalizedFileContent = normalize6(fileContent3);
@@ -411746,11 +412272,11 @@ async function parseDiffAndApply(fileContent3, searchContent, replaceContent, ex
411746
412272
  const matches2 = searchContentExact(normalizedFileContent, normalizedSearchContent);
411747
412273
  if (matches2.length < expectedReplacements) {
411748
412274
  matches2.push(...searchContentWithLineTrimmed(normalizedFileContent, normalizedSearchContent));
411749
- logger25.trace(`Found ${matches2.length} matches after line trimming search strategy`);
412275
+ logger24.trace(`Found ${matches2.length} matches after line trimming search strategy`);
411750
412276
  }
411751
412277
  if (matches2.length < expectedReplacements) {
411752
412278
  matches2.push(...searchContentByBlockAnchor(normalizedFileContent, normalizedSearchContent));
411753
- logger25.trace(`Found ${matches2.length} matches after block anchor search strategy`);
412279
+ logger24.trace(`Found ${matches2.length} matches after block anchor search strategy`);
411754
412280
  }
411755
412281
  if (matches2.length === 0) {
411756
412282
  throw new DiffError("Search content does not match the file content. Try to reread the file for the latest content.");
@@ -411759,7 +412285,7 @@ async function parseDiffAndApply(fileContent3, searchContent, replaceContent, ex
411759
412285
  throw new DiffError(`Expected ${expectedReplacements} occurrences but found ${matches2.length}. Please verify the search content and expectedReplacements parameter.`);
411760
412286
  }
411761
412287
  const result2 = replaceMatches(normalizedFileContent, matches2, replaceContent);
411762
- logger25.trace("Successfully applied diff");
412288
+ logger24.trace("Successfully applied diff");
411763
412289
  if (isCRLF) {
411764
412290
  return result2.replace(/\n/g, `\r
411765
412291
  `);
@@ -412113,11 +412639,11 @@ var readFile13 = () => async ({ path: path27, startLine, endLine }, { cwd: cwd2
412113
412639
 
412114
412640
  // src/tools/search-files.ts
412115
412641
  import * as fs14 from "node:fs";
412116
- var logger26 = getLogger("searchFiles");
412642
+ var logger25 = getLogger("searchFiles");
412117
412643
  var searchFiles2 = (context15) => async ({ path: path27, regex: regex3, filePattern }, { abortSignal, cwd: cwd2 }) => {
412118
412644
  const rgPath = context15.rg;
412119
412645
  if (!rgPath || !fs14.existsSync(rgPath)) {
412120
- logger26.error("Ripgrep not found at path", rgPath);
412646
+ logger25.error("Ripgrep not found at path", rgPath);
412121
412647
  throw new Error(`Ripgrep not found at path: ${rgPath}`);
412122
412648
  }
412123
412649
  return await searchFilesWithRipgrep(path27, regex3, rgPath, cwd2, filePattern, abortSignal);
@@ -412195,7 +412721,7 @@ async function executeToolCall(tool2, options6, cwd2, abortSignal) {
412195
412721
  }
412196
412722
 
412197
412723
  // src/task-runner.ts
412198
- var logger27 = getLogger("TaskRunner");
412724
+ var logger26 = getLogger("TaskRunner");
412199
412725
 
412200
412726
  class TaskRunner {
412201
412727
  cwd;
@@ -412272,9 +412798,9 @@ class TaskRunner {
412272
412798
  return this.chatKit.task?.shareId;
412273
412799
  }
412274
412800
  async run() {
412275
- logger27.debug("Starting TaskRunner...");
412801
+ logger26.debug("Starting TaskRunner...");
412276
412802
  try {
412277
- logger27.trace("Start step loop.");
412803
+ logger26.trace("Start step loop.");
412278
412804
  this.stepCount.reset();
412279
412805
  while (true) {
412280
412806
  const stepResult = await this.step();
@@ -412289,7 +412815,7 @@ class TaskRunner {
412289
412815
  }
412290
412816
  } catch (e11) {
412291
412817
  const error46 = toError2(e11);
412292
- logger27.trace("Failed:", error46);
412818
+ logger26.trace("Failed:", error46);
412293
412819
  }
412294
412820
  }
412295
412821
  async step() {
@@ -412327,24 +412853,24 @@ class TaskRunner {
412327
412853
  throw new Error("Task is not loaded");
412328
412854
  }
412329
412855
  if ((task.status === "completed" || task.status === "pending-input") && isResultMessage(message)) {
412330
- logger27.trace("Task is completed or pending input, no more steps to process.");
412856
+ logger26.trace("Task is completed or pending input, no more steps to process.");
412331
412857
  return "finished";
412332
412858
  }
412333
412859
  if (task.status === "failed") {
412334
412860
  if (task.error?.kind === "APICallError" && !task.error.isRetryable) {
412335
412861
  return "finished";
412336
412862
  }
412337
- logger27.error("Task is failed, trying to resend last message to resume it.", task.error);
412863
+ logger26.error("Task is failed, trying to resend last message to resume it.", task.error);
412338
412864
  return "retry";
412339
412865
  }
412340
412866
  if (message.role !== "assistant") {
412341
- logger27.trace("Last message is not a assistant message, resending it to resume the task.");
412867
+ logger26.trace("Last message is not a assistant message, resending it to resume the task.");
412342
412868
  return "retry";
412343
412869
  }
412344
412870
  if (isAssistantMessageWithEmptyParts(message) || isAssistantMessageWithPartialToolCalls(message) || isAssistantMessageWithOutputError(message) || lastAssistantMessageIsCompleteWithToolCalls({
412345
412871
  messages: this.chat.messages
412346
412872
  })) {
412347
- logger27.trace("Last message is assistant with empty parts or partial/completed tool calls, resending it to resume the task.");
412873
+ logger26.trace("Last message is assistant with empty parts or partial/completed tool calls, resending it to resume the task.");
412348
412874
  const processed = prepareLastMessageForRetry(message);
412349
412875
  if (processed) {
412350
412876
  this.chat.appendOrReplaceMessage(processed);
@@ -412352,28 +412878,28 @@ class TaskRunner {
412352
412878
  return "retry";
412353
412879
  }
412354
412880
  if (isAssistantMessageWithNoToolCalls(message)) {
412355
- logger27.trace("Last message is assistant with no tool calls, sending a new user reminder.");
412881
+ logger26.trace("Last message is assistant with no tool calls, sending a new user reminder.");
412356
412882
  const message2 = createUserMessage(prompts.createSystemReminder("You should use tool calls to answer the question, for example, use attemptCompletion if the job is done, or use askFollowupQuestions to clarify the request."));
412357
412883
  this.chat.appendOrReplaceMessage(message2);
412358
412884
  return "retry";
412359
412885
  }
412360
412886
  }
412361
412887
  async processToolCalls(message) {
412362
- logger27.trace("Processing tool calls in the last message.");
412888
+ logger26.trace("Processing tool calls in the last message.");
412363
412889
  for (const toolCall of message.parts.filter(isToolUIPart)) {
412364
412890
  if (toolCall.state !== "input-available")
412365
412891
  continue;
412366
412892
  const toolName = getToolName(toolCall);
412367
- logger27.trace(`Found tool call: ${toolName} with args: ${JSON.stringify(toolCall.input)}`);
412893
+ logger26.trace(`Found tool call: ${toolName} with args: ${JSON.stringify(toolCall.input)}`);
412368
412894
  const toolResult = await executeToolCall(toolCall, this.toolCallOptions, this.cwd);
412369
412895
  await this.chatKit.chat.addToolResult({
412370
412896
  tool: toolName,
412371
412897
  toolCallId: toolCall.toolCallId,
412372
412898
  output: toolResult
412373
412899
  });
412374
- logger27.trace(`Tool call result: ${JSON.stringify(toolResult)}`);
412900
+ logger26.trace(`Tool call result: ${JSON.stringify(toolResult)}`);
412375
412901
  }
412376
- logger27.trace("All tool calls processed in the last message.");
412902
+ logger26.trace("All tool calls processed in the last message.");
412377
412903
  return "next";
412378
412904
  }
412379
412905
  }
@@ -412674,8 +413200,8 @@ function registerUpgradeCommand(program5) {
412674
413200
  });
412675
413201
  }
412676
413202
  // src/cli.ts
412677
- var logger28 = getLogger("Pochi");
412678
- logger28.debug(`pochi v${package_default.version}`);
413203
+ var logger27 = getLogger("Pochi");
413204
+ logger27.debug(`pochi v${package_default.version}`);
412679
413205
  var parsePositiveInt = (input2) => {
412680
413206
  if (!input2) {
412681
413207
  return program5.error("The value for this option must be a positive integer.");
@@ -412798,8 +413324,7 @@ async function createLLMConfigWithVendors(program6, model2) {
412798
413324
  return {
412799
413325
  type: "vendor",
412800
413326
  useToolCallMiddleware: options6.useToolCallMiddleware,
412801
- getModel: (id5) => createModel(vendorId, {
412802
- id: id5,
413327
+ getModel: () => createModel(vendorId, {
412803
413328
  modelId,
412804
413329
  getCredentials: vendor2.getCredentials
412805
413330
  })
@@ -412815,8 +413340,7 @@ async function createLLMConfigWithPochi(model2) {
412815
413340
  return {
412816
413341
  type: "vendor",
412817
413342
  useToolCallMiddleware: pochiModelOptions.useToolCallMiddleware,
412818
- getModel: (id5) => createModel(vendorId, {
412819
- id: id5,
413343
+ getModel: () => createModel(vendorId, {
412820
413344
  modelId: model2,
412821
413345
  getCredentials: vendor2.getCredentials
412822
413346
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpochi/cli",
3
- "version": "0.5.60",
3
+ "version": "0.5.62",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "pochi": "dist/cli.js"