botinabox 2.4.1 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1244,6 +1244,12 @@ interface DomainEntityContextOptions {
1244
1244
  files?: boolean;
1245
1245
  channels?: boolean;
1246
1246
  rules?: boolean;
1247
+ /** Column used as directory name for each entity type. Default: 'id'. */
1248
+ orgSlugColumn?: string;
1249
+ projectSlugColumn?: string;
1250
+ clientSlugColumn?: string;
1251
+ fileSlugColumn?: string;
1252
+ channelSlugColumn?: string;
1247
1253
  }
1248
1254
  /**
1249
1255
  * Define entity context rendering for standard domain tables.
package/dist/index.js CHANGED
@@ -2271,8 +2271,8 @@ ${ctx2}`;
2271
2271
  }
2272
2272
  toolResults.push({
2273
2273
  type: "tool_result",
2274
- id: toolUse.id,
2275
- text: result
2274
+ tool_use_id: toolUse.id,
2275
+ content: result
2276
2276
  });
2277
2277
  } catch (err) {
2278
2278
  toolResults.push({
@@ -2317,7 +2317,24 @@ ${ctx2}`;
2317
2317
  const maxChars = 16e3;
2318
2318
  let charCount = 0;
2319
2319
  for (const row of rows) {
2320
- const body = row.body ?? "";
2320
+ const rawBody = row.body;
2321
+ if (!rawBody) continue;
2322
+ let body;
2323
+ if (rawBody.startsWith("[") || rawBody.startsWith("{")) {
2324
+ try {
2325
+ const parsed = JSON.parse(rawBody);
2326
+ if (Array.isArray(parsed)) {
2327
+ body = parsed.filter((b) => b.type === "text").map((b) => b.text ?? "").join("");
2328
+ } else {
2329
+ body = rawBody;
2330
+ }
2331
+ } catch {
2332
+ body = rawBody;
2333
+ }
2334
+ } else {
2335
+ body = rawBody;
2336
+ }
2337
+ if (!body) continue;
2321
2338
  const direction = row.direction;
2322
2339
  if (!includeAssistant && direction !== "inbound") continue;
2323
2340
  if (charCount + body.length > maxChars) break;
@@ -3584,7 +3601,7 @@ function defineDomainEntityContexts(db, options = {}) {
3584
3601
  db.defineEntityContext("org", {
3585
3602
  table: "org",
3586
3603
  directory: "orgs",
3587
- slugColumn: "id",
3604
+ slugColumn: opts.orgSlugColumn ?? "id",
3588
3605
  indexFile: "orgs/ORGS.md",
3589
3606
  files: {
3590
3607
  "ORG.md": {
@@ -3610,7 +3627,7 @@ ${o.description}` : null,
3610
3627
  db.defineEntityContext("project", {
3611
3628
  table: "project",
3612
3629
  directory: "projects",
3613
- slugColumn: "id",
3630
+ slugColumn: opts.projectSlugColumn ?? "id",
3614
3631
  indexFile: "projects/PROJECTS.md",
3615
3632
  files: {
3616
3633
  "PROJECT.md": {
@@ -3734,7 +3751,7 @@ ${lines.join("\n")}
3734
3751
  db.defineEntityContext("client", {
3735
3752
  table: "client",
3736
3753
  directory: "clients",
3737
- slugColumn: "id",
3754
+ slugColumn: opts.clientSlugColumn ?? "id",
3738
3755
  indexFile: "clients/CLIENTS.md",
3739
3756
  files: {
3740
3757
  "CLIENT.md": {
@@ -3821,7 +3838,7 @@ ${lines.join("\n")}
3821
3838
  db.defineEntityContext("file", {
3822
3839
  table: "file",
3823
3840
  directory: "files",
3824
- slugColumn: "id",
3841
+ slugColumn: opts.fileSlugColumn ?? "id",
3825
3842
  indexFile: "files/FILES.md",
3826
3843
  files: {
3827
3844
  "FILE.md": {
@@ -3848,7 +3865,7 @@ ${f.description}` : null,
3848
3865
  db.defineEntityContext("channel", {
3849
3866
  table: "channel",
3850
3867
  directory: "channels",
3851
- slugColumn: "id",
3868
+ slugColumn: opts.channelSlugColumn ?? "id",
3852
3869
  indexFile: "channels/CHANNELS.md",
3853
3870
  files: {
3854
3871
  "CHANNEL.md": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botinabox",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "Bot in a Box — framework for building multi-agent bots",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",