@bike4mind/cli 0.2.3-feat-questmaster-gpt5-function-calling.17055 → 0.2.3-feat-questmaster-gpt5-function-calling.17056

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.
@@ -7,7 +7,7 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-NH74I6GX.js";
10
+ } from "./chunk-BSDDDQF4.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
@@ -8070,6 +8070,9 @@ ALWAYS call this function to respond. Do NOT respond with plain text.`,
8070
8070
  }
8071
8071
  };
8072
8072
  function parseQuestPlanFunctionCall(args) {
8073
+ if (!args || typeof args !== "string" || args.trim() === "") {
8074
+ throw new Error("Function call arguments are empty or invalid");
8075
+ }
8073
8076
  let parsed;
8074
8077
  try {
8075
8078
  parsed = JSON.parse(args);
@@ -8080,8 +8083,8 @@ function parseQuestPlanFunctionCall(args) {
8080
8083
  throw new Error("Function call arguments must be an object");
8081
8084
  }
8082
8085
  const result = parsed;
8083
- if (!result.goal || typeof result.goal !== "string") {
8084
- throw new Error("Function call missing required field: goal");
8086
+ if (!result.goal || typeof result.goal !== "string" || result.goal.trim() === "") {
8087
+ throw new Error("Function call missing required field: goal (must be non-empty string)");
8085
8088
  }
8086
8089
  if (!Array.isArray(result.quests)) {
8087
8090
  throw new Error("Function call missing required field: quests (must be an array)");
@@ -8091,36 +8094,51 @@ function parseQuestPlanFunctionCall(args) {
8091
8094
  }
8092
8095
  for (let i = 0; i < result.quests.length; i++) {
8093
8096
  const quest = result.quests[i];
8094
- if (!quest.id || typeof quest.id !== "string") {
8095
- throw new Error(`Quest ${i} missing required field: id`);
8097
+ if (!quest || typeof quest !== "object") {
8098
+ throw new Error(`Quest ${i} is not a valid object`);
8099
+ }
8100
+ const questObj = quest;
8101
+ if (!questObj.id || typeof questObj.id !== "string" || questObj.id.trim() === "") {
8102
+ throw new Error(`Quest ${i} missing required field: id (must be non-empty string)`);
8096
8103
  }
8097
- if (!quest.title || typeof quest.title !== "string") {
8098
- throw new Error(`Quest ${i} missing required field: title`);
8104
+ if (!questObj.title || typeof questObj.title !== "string" || questObj.title.trim() === "") {
8105
+ throw new Error(`Quest ${i} missing required field: title (must be non-empty string)`);
8099
8106
  }
8100
- if (!quest.description || typeof quest.description !== "string") {
8101
- throw new Error(`Quest ${i} missing required field: description`);
8107
+ if (!questObj.description || typeof questObj.description !== "string" || questObj.description.trim() === "") {
8108
+ throw new Error(`Quest ${i} missing required field: description (must be non-empty string)`);
8102
8109
  }
8103
- if (!quest.complexity || !["Easy", "Medium", "Hard"].includes(quest.complexity)) {
8104
- throw new Error(`Quest ${i} has invalid complexity: ${quest.complexity} (must be Easy, Medium, or Hard)`);
8110
+ if (!questObj.complexity || !["Easy", "Medium", "Hard"].includes(questObj.complexity)) {
8111
+ throw new Error(`Quest ${i} has invalid complexity: ${questObj.complexity} (must be Easy, Medium, or Hard)`);
8105
8112
  }
8106
- if (!Array.isArray(quest.subQuests)) {
8107
- throw new Error(`Quest "${quest.id}" missing required field: subQuests (must be an array)`);
8113
+ if (!Array.isArray(questObj.subQuests)) {
8114
+ throw new Error(`Quest "${questObj.id}" missing required field: subQuests (must be an array)`);
8108
8115
  }
8109
- if (quest.subQuests.length === 0) {
8110
- throw new Error(`Quest "${quest.id}" has no subQuests (minimum 2 required)`);
8116
+ if (questObj.subQuests.length === 0) {
8117
+ throw new Error(`Quest "${questObj.id}" has no subQuests (minimum 2 required)`);
8111
8118
  }
8112
- for (let j = 0; j < quest.subQuests.length; j++) {
8113
- const subQuest = quest.subQuests[j];
8114
- if (!subQuest.id || typeof subQuest.id !== "string") {
8115
- throw new Error(`Quest "${quest.id}" subQuest ${j} missing required field: id`);
8119
+ for (let j = 0; j < questObj.subQuests.length; j++) {
8120
+ const subQuest = questObj.subQuests[j];
8121
+ if (!subQuest || typeof subQuest !== "object") {
8122
+ throw new Error(`Quest "${questObj.id}" subQuest ${j} is not a valid object`);
8123
+ }
8124
+ const subQuestObj = subQuest;
8125
+ if (!subQuestObj.id || typeof subQuestObj.id !== "string" || subQuestObj.id.trim() === "") {
8126
+ throw new Error(`Quest "${questObj.id}" subQuest ${j} missing required field: id (must be non-empty string)`);
8116
8127
  }
8117
- if (!subQuest.title || typeof subQuest.title !== "string") {
8118
- throw new Error(`Quest "${quest.id}" subQuest ${j} missing required field: title`);
8128
+ if (!subQuestObj.title || typeof subQuestObj.title !== "string" || subQuestObj.title.trim() === "") {
8129
+ throw new Error(`Quest "${questObj.id}" subQuest ${j} missing required field: title (must be non-empty string)`);
8119
8130
  }
8120
8131
  }
8121
8132
  }
8122
- if (result.tags !== void 0 && !Array.isArray(result.tags)) {
8123
- throw new Error("Function call field tags must be an array if provided");
8133
+ if (result.tags !== void 0) {
8134
+ if (!Array.isArray(result.tags)) {
8135
+ throw new Error("Function call field tags must be an array if provided");
8136
+ }
8137
+ for (let i = 0; i < result.tags.length; i++) {
8138
+ if (typeof result.tags[i] !== "string") {
8139
+ throw new Error(`Function call field tags[${i}] must be a string`);
8140
+ }
8141
+ }
8124
8142
  }
8125
8143
  return result;
8126
8144
  }
@@ -8178,7 +8196,7 @@ var QuestMaster = class {
8178
8196
  throw new Error("No quest context available");
8179
8197
  }
8180
8198
  let questResponse;
8181
- if (typeof input === "object") {
8199
+ if (input !== null && typeof input === "object") {
8182
8200
  this.logger.log("Processing quest plan from function calling result");
8183
8201
  questResponse = {
8184
8202
  type: "quest_plan",
@@ -8293,7 +8311,7 @@ var QuestMaster = class {
8293
8311
  title: item.quest,
8294
8312
  description: item.details,
8295
8313
  complexity: this.determineComplexity(item.details),
8296
- status: "Not Started",
8314
+ status: "not_started",
8297
8315
  subQuests: []
8298
8316
  // This will trigger a retry since we require subquests
8299
8317
  }))
@@ -8563,8 +8581,8 @@ Guidelines:
8563
8581
  toolSchema: createQuestPlanToolSchema
8564
8582
  };
8565
8583
  const options = {
8566
- temperature: retryCount > 0 ? 0.7 : 0.9,
8567
- // Lower temperature on retries
8584
+ temperature: retryCount > 0 ? 0.5 : 0.7,
8585
+ // Lower temperature for structured JSON outputs; even lower on retries
8568
8586
  n: 1,
8569
8587
  stream: false,
8570
8588
  tools: [toolDef],
@@ -8600,9 +8618,13 @@ Guidelines:
8600
8618
  }
8601
8619
  const result = functionResult;
8602
8620
  const questsWithoutSubquests = result.quests.filter((q) => !q.subQuests || q.subQuests.length === 0);
8603
- if (questsWithoutSubquests.length > 0 && retryCount < MAX_RETRIES) {
8604
- this.logger.warn(`Some quests missing subquests: ${questsWithoutSubquests.map((q) => q.id).join(", ")}, retrying...`);
8605
- return this.createQuestPlanWithFunctionCalling(model, prompt, retryCount + 1);
8621
+ if (questsWithoutSubquests.length > 0) {
8622
+ if (retryCount < MAX_RETRIES) {
8623
+ this.logger.warn(`Some quests missing subquests: ${questsWithoutSubquests.map((q) => q.id).join(", ")}, retrying...`);
8624
+ return this.createQuestPlanWithFunctionCalling(model, prompt, retryCount + 1);
8625
+ } else {
8626
+ this.logger.warn(`Returning quest plan with ${questsWithoutSubquests.length} quests missing subquests after max retries (${MAX_RETRIES}): ${questsWithoutSubquests.map((q) => q.id).join(", ")}`);
8627
+ }
8606
8628
  }
8607
8629
  this.logger.log("Successfully received GPT-5 function call result:", {
8608
8630
  goal: result.goal,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BadRequestError,
4
4
  secureParameters
5
- } from "./chunk-NH74I6GX.js";
5
+ } from "./chunk-BSDDDQF4.js";
6
6
  import {
7
7
  GenericCreditDeductTransaction,
8
8
  ImageEditUsageTransaction,
@@ -6,7 +6,7 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-NH74I6GX.js";
9
+ } from "./chunk-BSDDDQF4.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  createFabFile,
4
4
  createFabFileSchema
5
- } from "./chunk-KDBSH6HC.js";
6
- import "./chunk-NH74I6GX.js";
5
+ } from "./chunk-55HUCQWS.js";
6
+ import "./chunk-BSDDDQF4.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
8
  import "./chunk-WR6YZRQV.js";
9
9
  import "./chunk-PDX44BCA.js";
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getEffectiveApiKey,
5
5
  getOpenWeatherKey,
6
6
  getSerperKey
7
- } from "./chunk-44WCHZA2.js";
8
- import "./chunk-O2622ACK.js";
9
- import "./chunk-KDBSH6HC.js";
7
+ } from "./chunk-QGLZY6IF.js";
8
+ import "./chunk-CS24JD7W.js";
9
+ import "./chunk-55HUCQWS.js";
10
10
  import {
11
11
  BFLImageService,
12
12
  BaseStorage,
@@ -15,7 +15,7 @@ import {
15
15
  OpenAIBackend,
16
16
  OpenAIImageService,
17
17
  XAIImageService
18
- } from "./chunk-NH74I6GX.js";
18
+ } from "./chunk-BSDDDQF4.js";
19
19
  import {
20
20
  Logger
21
21
  } from "./chunk-AMDXHL6S.js";
@@ -9178,7 +9178,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
9178
9178
  // package.json
9179
9179
  var package_default = {
9180
9180
  name: "@bike4mind/cli",
9181
- version: "0.2.3-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
9181
+ version: "0.2.3-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
9182
9182
  type: "module",
9183
9183
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
9184
9184
  license: "UNLICENSED",
@@ -9280,10 +9280,10 @@ var package_default = {
9280
9280
  },
9281
9281
  devDependencies: {
9282
9282
  "@bike4mind/agents": "0.1.0",
9283
- "@bike4mind/common": "2.37.1-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
9284
- "@bike4mind/mcp": "1.19.5-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
9285
- "@bike4mind/services": "2.31.1-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
9286
- "@bike4mind/utils": "2.0.4-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
9283
+ "@bike4mind/common": "2.37.1-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
9284
+ "@bike4mind/mcp": "1.19.5-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
9285
+ "@bike4mind/services": "2.31.1-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
9286
+ "@bike4mind/utils": "2.0.4-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
9287
9287
  "@types/diff": "^5.0.9",
9288
9288
  "@types/jsonwebtoken": "^9.0.4",
9289
9289
  "@types/node": "^22.9.0",
@@ -9295,7 +9295,7 @@ var package_default = {
9295
9295
  typescript: "^5.9.3",
9296
9296
  vitest: "^3.2.4"
9297
9297
  },
9298
- gitHead: "efa3267ae1a98e505e89bb3b7e40caf68a8a1347"
9298
+ gitHead: "aaf443baeab1b87a7675e1577cc6535b2042bcdc"
9299
9299
  };
9300
9300
 
9301
9301
  // src/config/constants.ts
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-44WCHZA2.js";
6
- import "./chunk-NH74I6GX.js";
5
+ } from "./chunk-QGLZY6IF.js";
6
+ import "./chunk-BSDDDQF4.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
8
  import "./chunk-WR6YZRQV.js";
9
9
  import "./chunk-PDX44BCA.js";
@@ -120,7 +120,7 @@ import {
120
120
  validateMermaidSyntax,
121
121
  warmUpSettingsCache,
122
122
  withRetry
123
- } from "./chunk-NH74I6GX.js";
123
+ } from "./chunk-BSDDDQF4.js";
124
124
  import {
125
125
  Logger,
126
126
  NotificationDeduplicator,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-O2622ACK.js";
6
- import "./chunk-NH74I6GX.js";
5
+ } from "./chunk-CS24JD7W.js";
6
+ import "./chunk-BSDDDQF4.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
8
  import "./chunk-WR6YZRQV.js";
9
9
  import "./chunk-PDX44BCA.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.3-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
3
+ "version": "0.2.3-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "devDependencies": {
104
104
  "@bike4mind/agents": "0.1.0",
105
- "@bike4mind/common": "2.37.1-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
106
- "@bike4mind/mcp": "1.19.5-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
107
- "@bike4mind/services": "2.31.1-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
108
- "@bike4mind/utils": "2.0.4-feat-questmaster-gpt5-function-calling.17055+efa3267ae",
105
+ "@bike4mind/common": "2.37.1-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
106
+ "@bike4mind/mcp": "1.19.5-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
107
+ "@bike4mind/services": "2.31.1-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
108
+ "@bike4mind/utils": "2.0.4-feat-questmaster-gpt5-function-calling.17056+aaf443bae",
109
109
  "@types/diff": "^5.0.9",
110
110
  "@types/jsonwebtoken": "^9.0.4",
111
111
  "@types/node": "^22.9.0",
@@ -117,5 +117,5 @@
117
117
  "typescript": "^5.9.3",
118
118
  "vitest": "^3.2.4"
119
119
  },
120
- "gitHead": "efa3267ae1a98e505e89bb3b7e40caf68a8a1347"
120
+ "gitHead": "aaf443baeab1b87a7675e1577cc6535b2042bcdc"
121
121
  }