@bike4mind/cli 0.2.12-refactor-github-mcp.17405 → 0.2.14-feat-auto-context-customization.17477

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.
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-PDX44BCA.js";
3
2
 
4
3
  // src/storage/ImageStore.ts
5
4
  import { createHash } from "crypto";
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-OHR7UCTC.js";
5
- import "./chunk-PDX44BCA.js";
4
+ } from "./chunk-PGQJWOFR.js";
6
5
 
7
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
8
7
  var ARTIFACT_TAG_REGEX = /<artifact\s+(.*?)>([\s\S]*?)<\/artifact>/gi;
@@ -2,15 +2,16 @@
2
2
  import {
3
3
  BadRequestError,
4
4
  secureParameters
5
- } from "./chunk-BU5TP3BH.js";
5
+ } from "./chunk-TJAFO6U3.js";
6
6
  import {
7
+ CompletionApiUsageTransaction,
7
8
  GenericCreditDeductTransaction,
8
9
  ImageEditUsageTransaction,
9
10
  ImageGenerationUsageTransaction,
10
11
  RealtimeVoiceUsageTransaction,
11
12
  TextGenerationUsageTransaction,
12
13
  TransferCreditTransaction
13
- } from "./chunk-OHR7UCTC.js";
14
+ } from "./chunk-PGQJWOFR.js";
14
15
 
15
16
  // ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
16
17
  import { z } from "zod";
@@ -20,6 +21,7 @@ var SubtractCreditsSchema = z.discriminatedUnion("type", [
20
21
  ImageGenerationUsageTransaction.omit({ createdAt: true, updatedAt: true }),
21
22
  RealtimeVoiceUsageTransaction.omit({ createdAt: true, updatedAt: true }),
22
23
  ImageEditUsageTransaction.omit({ createdAt: true, updatedAt: true }),
24
+ CompletionApiUsageTransaction.omit({ createdAt: true, updatedAt: true }),
23
25
  TransferCreditTransaction.omit({ createdAt: true, updatedAt: true })
24
26
  ]);
25
27
  async function subtractCredits(parameters, { db, creditHolderMethods, skipBalanceUpdate, currentCreditHolder }) {
@@ -63,6 +65,20 @@ async function subtractCredits(parameters, { db, creditHolderMethods, skipBalanc
63
65
  inputTokens: params.inputTokens,
64
66
  outputTokens: params.outputTokens
65
67
  });
68
+ } else if (type === "completion_api_usage") {
69
+ await db.creditTransactions.createTransaction("completion_api_usage", {
70
+ ownerId,
71
+ ownerType,
72
+ credits: -Math.abs(credits),
73
+ // Negative for usage
74
+ description: description || "Completion API usage",
75
+ metadata,
76
+ model: params.model,
77
+ apiKeyId: params.apiKeyId,
78
+ // Optional - present for API key auth, undefined for JWT
79
+ inputTokens: params.inputTokens,
80
+ outputTokens: params.outputTokens
81
+ });
66
82
  } else if (type === "image_generation_usage") {
67
83
  await db.creditTransactions.createTransaction("image_generation_usage", {
68
84
  ownerId,
@@ -6,12 +6,12 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-BU5TP3BH.js";
9
+ } from "./chunk-TJAFO6U3.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
13
13
  isSupportedEmbeddingModel
14
- } from "./chunk-OHR7UCTC.js";
14
+ } from "./chunk-PGQJWOFR.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
17
17
  import { z } from "zod";
@@ -160,7 +160,7 @@ var notifyEventLogsToSlack = async ({ event, stage, slackUrl, throttlingSlackUrl
160
160
  if (!allowedStages.includes(stage))
161
161
  return;
162
162
  const logEvents = logData.logEvents;
163
- const { notificationDeduplicator: notificationDeduplicator2 } = await import("./notificationDeduplicator-UW7D75QS.js");
163
+ const { notificationDeduplicator: notificationDeduplicator2 } = await import("./notificationDeduplicator-UTHJHMSZ.js");
164
164
  for (const logEvent of logEvents) {
165
165
  try {
166
166
  let message;
@@ -232,6 +232,8 @@ var b4mLLMTools = z3.enum([
232
232
  "glob_files",
233
233
  "grep_search",
234
234
  "delete_file",
235
+ // Knowledge base search
236
+ "search_knowledge_base",
235
237
  // Shell execution
236
238
  "bash_execute"
237
239
  ]);
@@ -673,6 +675,14 @@ var RealtimeVoiceUsageTransaction = BaseCreditTransaction.extend({
673
675
  model: z7.string(),
674
676
  sessionId: z7.string()
675
677
  });
678
+ var CompletionApiUsageTransaction = BaseCreditTransaction.extend({
679
+ type: z7.literal("completion_api_usage"),
680
+ model: z7.string(),
681
+ apiKeyId: z7.string().optional(),
682
+ // Optional - present for API key auth, undefined for JWT
683
+ inputTokens: z7.number(),
684
+ outputTokens: z7.number()
685
+ });
676
686
  var TransferCreditTransaction = BaseCreditTransaction.extend({
677
687
  type: z7.literal("transfer_credit"),
678
688
  recipientId: z7.string(),
@@ -687,6 +697,7 @@ var CreditTransaction = z7.discriminatedUnion("type", [
687
697
  ImageGenerationUsageTransaction,
688
698
  ImageEditUsageTransaction,
689
699
  RealtimeVoiceUsageTransaction,
700
+ CompletionApiUsageTransaction,
690
701
  TransferCreditTransaction,
691
702
  ReceivedCreditTransaction
692
703
  ]);
@@ -701,6 +712,7 @@ var CREDIT_DEDUCT_TRANSACTION_TYPES = [
701
712
  "image_generation_usage",
702
713
  "image_edit_usage",
703
714
  "realtime_voice_usage",
715
+ "completion_api_usage",
704
716
  "transfer_credit",
705
717
  "generic_deduct"
706
718
  ];
@@ -3831,6 +3843,8 @@ var AiEvents;
3831
3843
  AiEvents2["NOTEBOOK_SUMMARIZATION"] = "Notebook Summarization Completed";
3832
3844
  AiEvents2["AI_VOICE_SESSION_STARTED"] = "AI Voice Session Started";
3833
3845
  AiEvents2["WHATS_NEW_MODAL_GENERATED"] = "What's New Modal Generated";
3846
+ AiEvents2["COMPLETION_API_COMPLETED"] = "Completion API Completed";
3847
+ AiEvents2["COMPLETION_API_FAILED"] = "Completion API Failed";
3834
3848
  })(AiEvents || (AiEvents = {}));
3835
3849
 
3836
3850
  // ../../b4m-core/packages/common/dist/src/schemas/analytics/events/apiKeys.js
@@ -6187,6 +6201,7 @@ export {
6187
6201
  ImageGenerationUsageTransaction,
6188
6202
  ImageEditUsageTransaction,
6189
6203
  RealtimeVoiceUsageTransaction,
6204
+ CompletionApiUsageTransaction,
6190
6205
  TransferCreditTransaction,
6191
6206
  CreditTransaction,
6192
6207
  CREDIT_ADD_TRANSACTION_TYPES,
@@ -7,11 +7,11 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-BU5TP3BH.js";
10
+ } from "./chunk-TJAFO6U3.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
14
- } from "./chunk-OHR7UCTC.js";
14
+ } from "./chunk-PGQJWOFR.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/fabFileService/create.js
17
17
  import { z } from "zod";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Logger
4
- } from "./chunk-AMDXHL6S.js";
4
+ } from "./chunk-OCYRD7D6.js";
5
5
  import {
6
6
  BedrockEmbeddingModel,
7
7
  ChatModels,
@@ -16,7 +16,7 @@ import {
16
16
  dayjsConfig_default,
17
17
  extractSnippetMeta,
18
18
  settingsMap
19
- } from "./chunk-OHR7UCTC.js";
19
+ } from "./chunk-PGQJWOFR.js";
20
20
 
21
21
  // ../../b4m-core/packages/utils/dist/src/storage/S3Storage.js
22
22
  import { S3Client, PutObjectCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
@@ -536,6 +536,15 @@ var AnthropicBackend = class {
536
536
  };
537
537
  if (options.tools?.length) {
538
538
  apiParams.tools = this.formatTools(options.tools);
539
+ if (options.tool_choice) {
540
+ if (options.tool_choice === "auto") {
541
+ apiParams.tool_choice = { type: "auto" };
542
+ } else if (options.tool_choice === "required") {
543
+ apiParams.tool_choice = { type: "any" };
544
+ } else if (typeof options.tool_choice === "object" && options.tool_choice.function?.name) {
545
+ apiParams.tool_choice = { type: "tool", name: options.tool_choice.function.name };
546
+ }
547
+ }
539
548
  }
540
549
  const modelInfo = await this.getModelInfo();
541
550
  const currentModelInfo = modelInfo.find((m) => m.id === model);
@@ -742,6 +751,14 @@ var AnthropicBackend = class {
742
751
  }
743
752
  }
744
753
  }
754
+ for (const tool of func) {
755
+ if (tool?.name && tool?.parameters) {
756
+ toolsUsed.push({
757
+ name: tool.name,
758
+ arguments: tool.parameters
759
+ });
760
+ }
761
+ }
745
762
  await cb(streamedText, { toolsUsed });
746
763
  if (func.some((f) => f && f.name)) {
747
764
  if (options.executeTools !== false) {
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createFabFile,
4
+ createFabFileSchema
5
+ } from "./chunk-QPYHK4UF.js";
6
+ import "./chunk-TJAFO6U3.js";
7
+ import "./chunk-OCYRD7D6.js";
8
+ import "./chunk-PGQJWOFR.js";
9
+ export {
10
+ createFabFile,
11
+ createFabFileSchema
12
+ };
@@ -2,7 +2,6 @@
2
2
  import {
3
3
  FormatConverter
4
4
  } from "./chunk-BPFEGDC7.js";
5
- import "./chunk-PDX44BCA.js";
6
5
  export {
7
6
  FormatConverter
8
7
  };