@bike4mind/cli 0.2.0 → 0.2.1-epic-lattice.16998
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/{artifactExtractor-GXQ5YZF7.js → artifactExtractor-GVWMTFQ5.js} +1 -1
- package/dist/chunk-AMDXHL6S.js +0 -0
- package/dist/chunk-BDQBOLYG.js +0 -0
- package/dist/chunk-BPFEGDC7.js +0 -0
- package/dist/{chunk-LZMRYJ3B.js → chunk-CVF7NYCS.js} +2 -2
- package/dist/{chunk-U3GPYBTD.js → chunk-HVS5VSDY.js} +1 -1
- package/dist/chunk-PDX44BCA.js +0 -0
- package/dist/{chunk-QXGU6KYI.js → chunk-RAG4OWCW.js} +2 -2
- package/dist/{chunk-WR6YZRQV.js → chunk-RVGWNNDF.js} +708 -186
- package/dist/{chunk-F3ETXO5N.js → chunk-WTHIDKNC.js} +2 -2
- package/dist/{create-YUYXTEIS.js → create-2BFWR7P6.js} +3 -3
- package/dist/formatConverter-I7EIUVDY.js +0 -0
- package/dist/index.js +476 -13
- package/dist/{llmMarkdownGenerator-4ZR3FLEQ.js → llmMarkdownGenerator-ZLW7KP6R.js} +1 -1
- package/dist/{markdownGenerator-7WE7WKME.js → markdownGenerator-OTSVN5CO.js} +1 -1
- package/dist/{mementoService-2BDIT6PH.js → mementoService-4MR3S6PT.js} +3 -3
- package/dist/notificationDeduplicator-UW7D75QS.js +0 -0
- package/dist/{src-6J6LFPZ6.js → src-D33LHN23.js} +125 -1
- package/dist/{src-VLP2EHKE.js → src-RIBKTVFS.js} +2 -2
- package/dist/{subtractCredits-NNYIS5XZ.js → subtractCredits-YAIS5LLN.js} +3 -3
- package/dist/utils-JPMDGUBL.js +0 -0
- package/package.json +16 -14
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HVS5VSDY.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RVGWNNDF.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-WTHIDKNC.js";
|
|
6
|
+
import "./chunk-HVS5VSDY.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-RVGWNNDF.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
|
10
10
|
export {
|
|
11
11
|
createFabFile,
|
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-RAG4OWCW.js";
|
|
8
|
+
import "./chunk-CVF7NYCS.js";
|
|
9
|
+
import "./chunk-WTHIDKNC.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-
|
|
18
|
+
} from "./chunk-HVS5VSDY.js";
|
|
19
19
|
import {
|
|
20
20
|
Logger
|
|
21
21
|
} from "./chunk-AMDXHL6S.js";
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
XAI_IMAGE_MODELS,
|
|
73
73
|
b4mLLMTools,
|
|
74
74
|
getMcpProviderMetadata
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-RVGWNNDF.js";
|
|
76
76
|
import {
|
|
77
77
|
__require
|
|
78
78
|
} from "./chunk-PDX44BCA.js";
|
|
@@ -7238,6 +7238,461 @@ var deleteFileTool = {
|
|
|
7238
7238
|
})
|
|
7239
7239
|
};
|
|
7240
7240
|
|
|
7241
|
+
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/lattice/index.js
|
|
7242
|
+
var latticeCreateModelTool = {
|
|
7243
|
+
name: "lattice_create_model",
|
|
7244
|
+
implementation: () => ({
|
|
7245
|
+
toolFn: async (params) => {
|
|
7246
|
+
const { name, description, modelType = "custom" } = params;
|
|
7247
|
+
const modelId = `lattice_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
7248
|
+
return JSON.stringify({
|
|
7249
|
+
success: true,
|
|
7250
|
+
action: "CREATE_MODEL",
|
|
7251
|
+
modelId,
|
|
7252
|
+
data: {
|
|
7253
|
+
name,
|
|
7254
|
+
description,
|
|
7255
|
+
modelType
|
|
7256
|
+
},
|
|
7257
|
+
message: `Created new ${modelType} model "${name}" with ID ${modelId}. You can now add entities and rules to this model.`
|
|
7258
|
+
});
|
|
7259
|
+
},
|
|
7260
|
+
toolSchema: {
|
|
7261
|
+
name: "lattice_create_model",
|
|
7262
|
+
description: `Create a new Lattice financial model. This is the first step when building a pro-forma or financial analysis.
|
|
7263
|
+
|
|
7264
|
+
**When to use:** When the user wants to:
|
|
7265
|
+
- Create a new financial model, spreadsheet, or pro-forma
|
|
7266
|
+
- Start building an income statement, balance sheet, or cash flow
|
|
7267
|
+
- Set up a SaaS metrics dashboard
|
|
7268
|
+
- Begin any structured numerical analysis
|
|
7269
|
+
|
|
7270
|
+
**Model types:**
|
|
7271
|
+
- income_statement: P&L with revenue, expenses, profits
|
|
7272
|
+
- balance_sheet: Assets, liabilities, equity
|
|
7273
|
+
- cashflow: Operating, investing, financing cash flows
|
|
7274
|
+
- saas_metrics: MRR, ARR, churn, CAC, LTV
|
|
7275
|
+
- custom: Any other structured model
|
|
7276
|
+
|
|
7277
|
+
After creating a model, add entities with \`lattice_add_entity\` and define formulas with \`lattice_create_rule\`.`,
|
|
7278
|
+
parameters: {
|
|
7279
|
+
type: "object",
|
|
7280
|
+
properties: {
|
|
7281
|
+
name: {
|
|
7282
|
+
type: "string",
|
|
7283
|
+
description: 'Name of the model (e.g., "2024 Budget", "Q1 Forecast")'
|
|
7284
|
+
},
|
|
7285
|
+
description: {
|
|
7286
|
+
type: "string",
|
|
7287
|
+
description: "Optional description of what this model represents"
|
|
7288
|
+
},
|
|
7289
|
+
modelType: {
|
|
7290
|
+
type: "string",
|
|
7291
|
+
enum: ["income_statement", "balance_sheet", "cashflow", "saas_metrics", "custom"],
|
|
7292
|
+
description: "Type of financial model to create"
|
|
7293
|
+
}
|
|
7294
|
+
},
|
|
7295
|
+
required: ["name"]
|
|
7296
|
+
}
|
|
7297
|
+
}
|
|
7298
|
+
})
|
|
7299
|
+
};
|
|
7300
|
+
var latticeAddEntityTool = {
|
|
7301
|
+
name: "lattice_add_entity",
|
|
7302
|
+
implementation: () => ({
|
|
7303
|
+
toolFn: async (params) => {
|
|
7304
|
+
const { modelId, name, type, displayName, initialValues = [] } = params;
|
|
7305
|
+
const entityId = name.toLowerCase().replace(/\s+/g, "_");
|
|
7306
|
+
return JSON.stringify({
|
|
7307
|
+
success: true,
|
|
7308
|
+
action: "ADD_ENTITY",
|
|
7309
|
+
modelId,
|
|
7310
|
+
entityId,
|
|
7311
|
+
data: {
|
|
7312
|
+
name,
|
|
7313
|
+
type,
|
|
7314
|
+
displayName: displayName || name,
|
|
7315
|
+
attributes: initialValues.map((v) => ({
|
|
7316
|
+
key: v.key,
|
|
7317
|
+
value: v.value,
|
|
7318
|
+
dataType: v.dataType || (typeof v.value === "number" ? "number" : "string"),
|
|
7319
|
+
isComputed: false
|
|
7320
|
+
}))
|
|
7321
|
+
},
|
|
7322
|
+
message: `Added ${type} "${displayName || name}" to model. ${initialValues.length > 0 ? `Set initial values: ${initialValues.map((v) => `${v.key}=${v.value}`).join(", ")}` : "No initial values set."}`
|
|
7323
|
+
});
|
|
7324
|
+
},
|
|
7325
|
+
toolSchema: {
|
|
7326
|
+
name: "lattice_add_entity",
|
|
7327
|
+
description: `Add a line item, account, period, or other entity to a Lattice model.
|
|
7328
|
+
|
|
7329
|
+
**When to use:** When the user mentions:
|
|
7330
|
+
- Adding a revenue line, expense category, or account
|
|
7331
|
+
- Creating periods (Q1, Q2, Jan, Feb, etc.)
|
|
7332
|
+
- Adding any measurable item to their model
|
|
7333
|
+
|
|
7334
|
+
**Entity types:**
|
|
7335
|
+
- line_item: Revenue streams, expense lines, KPIs
|
|
7336
|
+
- account: Cash, AR, AP, inventory, etc.
|
|
7337
|
+
- period: Q1 2024, Jan, FY2025, etc.
|
|
7338
|
+
- category: Groups of line items (Operating Expenses)
|
|
7339
|
+
- scenario: Base case, upside, downside
|
|
7340
|
+
- custom: Any other structured element
|
|
7341
|
+
|
|
7342
|
+
**Examples:**
|
|
7343
|
+
- "Add Revenue" \u2192 line_item named "Revenue"
|
|
7344
|
+
- "Create a Marketing Expenses category" \u2192 category named "Marketing Expenses"
|
|
7345
|
+
- "Add quarters Q1 through Q4" \u2192 4 period entities`,
|
|
7346
|
+
parameters: {
|
|
7347
|
+
type: "object",
|
|
7348
|
+
properties: {
|
|
7349
|
+
modelId: {
|
|
7350
|
+
type: "string",
|
|
7351
|
+
description: "ID of the model to add the entity to"
|
|
7352
|
+
},
|
|
7353
|
+
name: {
|
|
7354
|
+
type: "string",
|
|
7355
|
+
description: "Internal name for the entity (used in formulas)"
|
|
7356
|
+
},
|
|
7357
|
+
type: {
|
|
7358
|
+
type: "string",
|
|
7359
|
+
enum: ["line_item", "account", "period", "category", "scenario", "custom"],
|
|
7360
|
+
description: "Type of entity"
|
|
7361
|
+
},
|
|
7362
|
+
displayName: {
|
|
7363
|
+
type: "string",
|
|
7364
|
+
description: "Human-readable display name (defaults to name)"
|
|
7365
|
+
},
|
|
7366
|
+
initialValues: {
|
|
7367
|
+
type: "array",
|
|
7368
|
+
items: {
|
|
7369
|
+
type: "object",
|
|
7370
|
+
properties: {
|
|
7371
|
+
key: { type: "string", description: 'Period or attribute key (e.g., "Q1_2024")' },
|
|
7372
|
+
value: { type: "string", description: "The value (number or string)" },
|
|
7373
|
+
dataType: {
|
|
7374
|
+
type: "string",
|
|
7375
|
+
enum: ["number", "currency", "percentage", "string"],
|
|
7376
|
+
description: "Data type for the value"
|
|
7377
|
+
}
|
|
7378
|
+
},
|
|
7379
|
+
required: ["key", "value"]
|
|
7380
|
+
},
|
|
7381
|
+
description: "Optional initial values for this entity"
|
|
7382
|
+
}
|
|
7383
|
+
},
|
|
7384
|
+
required: ["modelId", "name", "type"]
|
|
7385
|
+
}
|
|
7386
|
+
}
|
|
7387
|
+
})
|
|
7388
|
+
};
|
|
7389
|
+
var latticeSetValueTool = {
|
|
7390
|
+
name: "lattice_set_value",
|
|
7391
|
+
implementation: () => ({
|
|
7392
|
+
toolFn: async (params) => {
|
|
7393
|
+
const { modelId, entityName, attributeKey, value: rawValue } = params;
|
|
7394
|
+
let value = rawValue;
|
|
7395
|
+
const numValue = parseFloat(rawValue);
|
|
7396
|
+
if (!isNaN(numValue)) {
|
|
7397
|
+
value = numValue;
|
|
7398
|
+
} else if (rawValue.toLowerCase() === "true") {
|
|
7399
|
+
value = true;
|
|
7400
|
+
} else if (rawValue.toLowerCase() === "false") {
|
|
7401
|
+
value = false;
|
|
7402
|
+
}
|
|
7403
|
+
return JSON.stringify({
|
|
7404
|
+
success: true,
|
|
7405
|
+
action: "SET_VALUE",
|
|
7406
|
+
modelId,
|
|
7407
|
+
data: {
|
|
7408
|
+
entityName,
|
|
7409
|
+
attributeKey,
|
|
7410
|
+
value
|
|
7411
|
+
},
|
|
7412
|
+
message: `Set ${entityName}.${attributeKey} = ${value}`
|
|
7413
|
+
});
|
|
7414
|
+
},
|
|
7415
|
+
toolSchema: {
|
|
7416
|
+
name: "lattice_set_value",
|
|
7417
|
+
description: `Set a specific value in a Lattice model.
|
|
7418
|
+
|
|
7419
|
+
**When to use:** When the user provides a specific number:
|
|
7420
|
+
- "Revenue in Q1 is 150,000"
|
|
7421
|
+
- "Set marketing spend to 50k for January"
|
|
7422
|
+
- "COGS is 40% of revenue" (use lattice_create_rule for formulas)
|
|
7423
|
+
|
|
7424
|
+
**Important:** This tool is for setting raw input values. For calculated values (formulas), use \`lattice_create_rule\` instead.
|
|
7425
|
+
|
|
7426
|
+
**Examples:**
|
|
7427
|
+
- "Q1 revenue is $100,000" \u2192 entityName="Revenue", attributeKey="Q1", value=100000
|
|
7428
|
+
- "Set headcount to 25" \u2192 entityName="Headcount", attributeKey="current", value=25`,
|
|
7429
|
+
parameters: {
|
|
7430
|
+
type: "object",
|
|
7431
|
+
properties: {
|
|
7432
|
+
modelId: {
|
|
7433
|
+
type: "string",
|
|
7434
|
+
description: "ID of the model"
|
|
7435
|
+
},
|
|
7436
|
+
entityName: {
|
|
7437
|
+
type: "string",
|
|
7438
|
+
description: "Name of the entity (line item, account, etc.)"
|
|
7439
|
+
},
|
|
7440
|
+
attributeKey: {
|
|
7441
|
+
type: "string",
|
|
7442
|
+
description: 'Period or attribute key (e.g., "Q1_2024", "current", "budget")'
|
|
7443
|
+
},
|
|
7444
|
+
value: {
|
|
7445
|
+
type: "string",
|
|
7446
|
+
description: "The value to set (will be parsed as number if numeric)"
|
|
7447
|
+
}
|
|
7448
|
+
},
|
|
7449
|
+
required: ["modelId", "entityName", "attributeKey", "value"]
|
|
7450
|
+
}
|
|
7451
|
+
}
|
|
7452
|
+
})
|
|
7453
|
+
};
|
|
7454
|
+
var latticeCreateRuleTool = {
|
|
7455
|
+
name: "lattice_create_rule",
|
|
7456
|
+
implementation: () => ({
|
|
7457
|
+
toolFn: async (params) => {
|
|
7458
|
+
const { modelId, name, description, formula } = params;
|
|
7459
|
+
const parsedRule = parseFormula(formula);
|
|
7460
|
+
return JSON.stringify({
|
|
7461
|
+
success: true,
|
|
7462
|
+
action: "CREATE_RULE",
|
|
7463
|
+
modelId,
|
|
7464
|
+
ruleId: `rule_${Date.now()}`,
|
|
7465
|
+
data: {
|
|
7466
|
+
name,
|
|
7467
|
+
description,
|
|
7468
|
+
formula,
|
|
7469
|
+
parsed: parsedRule
|
|
7470
|
+
},
|
|
7471
|
+
message: `Created rule "${name}": ${formula}`
|
|
7472
|
+
});
|
|
7473
|
+
},
|
|
7474
|
+
toolSchema: {
|
|
7475
|
+
name: "lattice_create_rule",
|
|
7476
|
+
description: `Create a formula or calculation rule in a Lattice model.
|
|
7477
|
+
|
|
7478
|
+
**When to use:** When the user defines a calculation:
|
|
7479
|
+
- "Gross profit equals revenue minus COGS"
|
|
7480
|
+
- "Net margin is net income divided by revenue times 100"
|
|
7481
|
+
- "Total expenses is the sum of all expense line items"
|
|
7482
|
+
|
|
7483
|
+
**Formula syntax (natural language):**
|
|
7484
|
+
- Arithmetic: "X equals Y plus Z", "A minus B", "C times D"
|
|
7485
|
+
- Aggregation: "sum of", "average of", "total"
|
|
7486
|
+
- Percentage: "X percent of Y", "as a percentage"
|
|
7487
|
+
- Comparison: "if X is greater than Y then A else B"
|
|
7488
|
+
|
|
7489
|
+
**Examples:**
|
|
7490
|
+
- "Gross Profit = Revenue - COGS"
|
|
7491
|
+
- "Gross Margin = Gross Profit / Revenue * 100"
|
|
7492
|
+
- "Total OpEx = sum of all Operating Expenses"
|
|
7493
|
+
- "YoY Growth = (Current Year - Prior Year) / Prior Year * 100"`,
|
|
7494
|
+
parameters: {
|
|
7495
|
+
type: "object",
|
|
7496
|
+
properties: {
|
|
7497
|
+
modelId: {
|
|
7498
|
+
type: "string",
|
|
7499
|
+
description: "ID of the model"
|
|
7500
|
+
},
|
|
7501
|
+
name: {
|
|
7502
|
+
type: "string",
|
|
7503
|
+
description: 'Name for this rule (e.g., "Gross Profit Calculation")'
|
|
7504
|
+
},
|
|
7505
|
+
description: {
|
|
7506
|
+
type: "string",
|
|
7507
|
+
description: "Optional description of what this rule calculates"
|
|
7508
|
+
},
|
|
7509
|
+
formula: {
|
|
7510
|
+
type: "string",
|
|
7511
|
+
description: "The formula in natural language or equation format"
|
|
7512
|
+
}
|
|
7513
|
+
},
|
|
7514
|
+
required: ["modelId", "name", "formula"]
|
|
7515
|
+
}
|
|
7516
|
+
}
|
|
7517
|
+
})
|
|
7518
|
+
};
|
|
7519
|
+
var latticeQueryTool = {
|
|
7520
|
+
name: "lattice_query",
|
|
7521
|
+
implementation: () => ({
|
|
7522
|
+
toolFn: async (params) => {
|
|
7523
|
+
const { modelId, query } = params;
|
|
7524
|
+
const parsedQuery = parseQuery(query);
|
|
7525
|
+
return JSON.stringify({
|
|
7526
|
+
success: true,
|
|
7527
|
+
action: "QUERY",
|
|
7528
|
+
modelId,
|
|
7529
|
+
data: {
|
|
7530
|
+
query,
|
|
7531
|
+
parsed: parsedQuery
|
|
7532
|
+
},
|
|
7533
|
+
message: `Querying model for: ${query}`
|
|
7534
|
+
});
|
|
7535
|
+
},
|
|
7536
|
+
toolSchema: {
|
|
7537
|
+
name: "lattice_query",
|
|
7538
|
+
description: `Query a Lattice model for specific values or aggregations.
|
|
7539
|
+
|
|
7540
|
+
**When to use:** When the user asks about values in the model:
|
|
7541
|
+
- "What's Q1 gross margin?"
|
|
7542
|
+
- "Show me total revenue for 2024"
|
|
7543
|
+
- "What are all the expense categories?"
|
|
7544
|
+
- "Compare Q1 vs Q2 performance"
|
|
7545
|
+
|
|
7546
|
+
**Query types:**
|
|
7547
|
+
- Single value: "What is [entity] for [period]?"
|
|
7548
|
+
- Aggregation: "Total [entity] for [range]"
|
|
7549
|
+
- Comparison: "Compare [entity] across [periods]"
|
|
7550
|
+
- List: "Show all [entity type]"
|
|
7551
|
+
|
|
7552
|
+
**Examples:**
|
|
7553
|
+
- "What's Q2 revenue?" \u2192 Returns specific value
|
|
7554
|
+
- "Total revenue for 2024" \u2192 Sums Q1-Q4
|
|
7555
|
+
- "Compare gross margin Q1 vs Q2" \u2192 Side-by-side comparison`,
|
|
7556
|
+
parameters: {
|
|
7557
|
+
type: "object",
|
|
7558
|
+
properties: {
|
|
7559
|
+
modelId: {
|
|
7560
|
+
type: "string",
|
|
7561
|
+
description: "ID of the model to query"
|
|
7562
|
+
},
|
|
7563
|
+
query: {
|
|
7564
|
+
type: "string",
|
|
7565
|
+
description: "Natural language query about the model"
|
|
7566
|
+
}
|
|
7567
|
+
},
|
|
7568
|
+
required: ["modelId", "query"]
|
|
7569
|
+
}
|
|
7570
|
+
}
|
|
7571
|
+
})
|
|
7572
|
+
};
|
|
7573
|
+
var latticeExplainTool = {
|
|
7574
|
+
name: "lattice_explain",
|
|
7575
|
+
implementation: () => ({
|
|
7576
|
+
toolFn: async (params) => {
|
|
7577
|
+
const { modelId, entityName, attributeKey } = params;
|
|
7578
|
+
return JSON.stringify({
|
|
7579
|
+
success: true,
|
|
7580
|
+
action: "EXPLAIN",
|
|
7581
|
+
modelId,
|
|
7582
|
+
data: {
|
|
7583
|
+
entityName,
|
|
7584
|
+
attributeKey
|
|
7585
|
+
},
|
|
7586
|
+
message: `Explaining calculation for ${entityName}.${attributeKey}`
|
|
7587
|
+
});
|
|
7588
|
+
},
|
|
7589
|
+
toolSchema: {
|
|
7590
|
+
name: "lattice_explain",
|
|
7591
|
+
description: `Explain how a value in a Lattice model was calculated.
|
|
7592
|
+
|
|
7593
|
+
**When to use:** When the user wants to understand a calculation:
|
|
7594
|
+
- "How did you calculate gross profit?"
|
|
7595
|
+
- "Explain the Q2 margin number"
|
|
7596
|
+
- "Show me the formula for total expenses"
|
|
7597
|
+
- "Why is this number so high?"
|
|
7598
|
+
|
|
7599
|
+
This tool traces the calculation chain from the target value back through all its inputs and rules, providing a step-by-step explanation.`,
|
|
7600
|
+
parameters: {
|
|
7601
|
+
type: "object",
|
|
7602
|
+
properties: {
|
|
7603
|
+
modelId: {
|
|
7604
|
+
type: "string",
|
|
7605
|
+
description: "ID of the model"
|
|
7606
|
+
},
|
|
7607
|
+
entityName: {
|
|
7608
|
+
type: "string",
|
|
7609
|
+
description: "Name of the entity containing the value to explain"
|
|
7610
|
+
},
|
|
7611
|
+
attributeKey: {
|
|
7612
|
+
type: "string",
|
|
7613
|
+
description: "Period or attribute key of the value to explain"
|
|
7614
|
+
}
|
|
7615
|
+
},
|
|
7616
|
+
required: ["modelId", "entityName", "attributeKey"]
|
|
7617
|
+
}
|
|
7618
|
+
}
|
|
7619
|
+
})
|
|
7620
|
+
};
|
|
7621
|
+
function parseFormula(formula) {
|
|
7622
|
+
const normalized = formula.toLowerCase().trim();
|
|
7623
|
+
const equalsMatch = normalized.match(/^(\w+)\s*(?:=|equals?)\s*(.+)$/i);
|
|
7624
|
+
if (equalsMatch) {
|
|
7625
|
+
const [, output, expression] = equalsMatch;
|
|
7626
|
+
if (expression.includes("+") || expression.includes("plus")) {
|
|
7627
|
+
return {
|
|
7628
|
+
operation: "ADD",
|
|
7629
|
+
outputEntity: output,
|
|
7630
|
+
inputs: expression.split(/[+]|plus/i).map((s) => s.trim())
|
|
7631
|
+
};
|
|
7632
|
+
}
|
|
7633
|
+
if (expression.includes("-") || expression.includes("minus")) {
|
|
7634
|
+
return {
|
|
7635
|
+
operation: "SUBTRACT",
|
|
7636
|
+
outputEntity: output,
|
|
7637
|
+
inputs: expression.split(/[-]|minus/i).map((s) => s.trim())
|
|
7638
|
+
};
|
|
7639
|
+
}
|
|
7640
|
+
if (expression.includes("*") || expression.includes("times") || expression.includes("x")) {
|
|
7641
|
+
return {
|
|
7642
|
+
operation: "MULTIPLY",
|
|
7643
|
+
outputEntity: output,
|
|
7644
|
+
inputs: expression.split(/[*x]|times/i).map((s) => s.trim())
|
|
7645
|
+
};
|
|
7646
|
+
}
|
|
7647
|
+
if (expression.includes("/") || expression.includes("divided")) {
|
|
7648
|
+
return {
|
|
7649
|
+
operation: "DIVIDE",
|
|
7650
|
+
outputEntity: output,
|
|
7651
|
+
inputs: expression.split(/[/]|divided by/i).map((s) => s.trim())
|
|
7652
|
+
};
|
|
7653
|
+
}
|
|
7654
|
+
if (expression.includes("sum")) {
|
|
7655
|
+
return {
|
|
7656
|
+
operation: "SUM",
|
|
7657
|
+
outputEntity: output,
|
|
7658
|
+
inputs: [expression.replace(/sum of/i, "").trim()]
|
|
7659
|
+
};
|
|
7660
|
+
}
|
|
7661
|
+
}
|
|
7662
|
+
return {
|
|
7663
|
+
operation: "REFERENCE",
|
|
7664
|
+
outputEntity: "unknown",
|
|
7665
|
+
inputs: [formula]
|
|
7666
|
+
};
|
|
7667
|
+
}
|
|
7668
|
+
function parseQuery(query) {
|
|
7669
|
+
const normalized = query.toLowerCase();
|
|
7670
|
+
let type = "single_value";
|
|
7671
|
+
if (normalized.includes("total") || normalized.includes("sum")) {
|
|
7672
|
+
type = "aggregation";
|
|
7673
|
+
} else if (normalized.includes("compare") || normalized.includes("vs")) {
|
|
7674
|
+
type = "comparison";
|
|
7675
|
+
} else if (normalized.includes("list") || normalized.includes("show all")) {
|
|
7676
|
+
type = "list";
|
|
7677
|
+
}
|
|
7678
|
+
const entities = [];
|
|
7679
|
+
const periods = [];
|
|
7680
|
+
const periodPatterns = [/q[1-4]/gi, /\d{4}/g, /jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/gi];
|
|
7681
|
+
for (const pattern of periodPatterns) {
|
|
7682
|
+
const matches = query.match(pattern);
|
|
7683
|
+
if (matches) {
|
|
7684
|
+
periods.push(...matches);
|
|
7685
|
+
}
|
|
7686
|
+
}
|
|
7687
|
+
const commonEntities = ["revenue", "expenses", "profit", "margin", "income", "cost", "cogs", "ebitda"];
|
|
7688
|
+
for (const entity of commonEntities) {
|
|
7689
|
+
if (normalized.includes(entity)) {
|
|
7690
|
+
entities.push(entity);
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
return { type, entities, periods };
|
|
7694
|
+
}
|
|
7695
|
+
|
|
7241
7696
|
// ../../b4m-core/packages/services/dist/src/llm/tools/index.js
|
|
7242
7697
|
var tools = {
|
|
7243
7698
|
dice_roll: diceRollTool,
|
|
@@ -7265,7 +7720,14 @@ var tools = {
|
|
|
7265
7720
|
create_file: createFileTool,
|
|
7266
7721
|
glob_files: globFilesTool,
|
|
7267
7722
|
grep_search: grepSearchTool,
|
|
7268
|
-
delete_file: deleteFileTool
|
|
7723
|
+
delete_file: deleteFileTool,
|
|
7724
|
+
// Lattice financial modeling tools
|
|
7725
|
+
lattice_create_model: latticeCreateModelTool,
|
|
7726
|
+
lattice_add_entity: latticeAddEntityTool,
|
|
7727
|
+
lattice_set_value: latticeSetValueTool,
|
|
7728
|
+
lattice_create_rule: latticeCreateRuleTool,
|
|
7729
|
+
lattice_query: latticeQueryTool,
|
|
7730
|
+
lattice_explain: latticeExplainTool
|
|
7269
7731
|
};
|
|
7270
7732
|
var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorage, statusUpdate, onStart, onFinish, llm, config, model) => {
|
|
7271
7733
|
const context = {
|
|
@@ -8758,7 +9220,7 @@ var ApiClient = class {
|
|
|
8758
9220
|
// package.json
|
|
8759
9221
|
var package_default = {
|
|
8760
9222
|
name: "@bike4mind/cli",
|
|
8761
|
-
version: "0.2.
|
|
9223
|
+
version: "0.2.1-epic-lattice.16998+1c9b90db0",
|
|
8762
9224
|
type: "module",
|
|
8763
9225
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
8764
9226
|
license: "UNLICENSED",
|
|
@@ -8854,11 +9316,11 @@ var package_default = {
|
|
|
8854
9316
|
zustand: "^4.5.4"
|
|
8855
9317
|
},
|
|
8856
9318
|
devDependencies: {
|
|
8857
|
-
"@bike4mind/agents": "
|
|
8858
|
-
"@bike4mind/common": "
|
|
8859
|
-
"@bike4mind/mcp": "
|
|
8860
|
-
"@bike4mind/services": "
|
|
8861
|
-
"@bike4mind/utils": "
|
|
9319
|
+
"@bike4mind/agents": "0.1.0",
|
|
9320
|
+
"@bike4mind/common": "2.36.1-epic-lattice.16998+1c9b90db0",
|
|
9321
|
+
"@bike4mind/mcp": "1.19.4-epic-lattice.16998+1c9b90db0",
|
|
9322
|
+
"@bike4mind/services": "2.29.1-epic-lattice.16998+1c9b90db0",
|
|
9323
|
+
"@bike4mind/utils": "2.0.3-epic-lattice.16998+1c9b90db0",
|
|
8862
9324
|
"@types/diff": "^5.0.9",
|
|
8863
9325
|
"@types/jsonwebtoken": "^9.0.4",
|
|
8864
9326
|
"@types/node": "^22.9.0",
|
|
@@ -8868,7 +9330,8 @@ var package_default = {
|
|
|
8868
9330
|
tsup: "^8.5.1",
|
|
8869
9331
|
tsx: "^4.21.0",
|
|
8870
9332
|
typescript: "^5.9.3"
|
|
8871
|
-
}
|
|
9333
|
+
},
|
|
9334
|
+
gitHead: "1c9b90db0a9c1960d484fb1a3cea7608cd339946"
|
|
8872
9335
|
};
|
|
8873
9336
|
|
|
8874
9337
|
// src/index.tsx
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-RAG4OWCW.js";
|
|
6
|
+
import "./chunk-HVS5VSDY.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-RVGWNNDF.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
|
10
10
|
export {
|
|
11
11
|
findMostSimilarMemento,
|
|
File without changes
|