botinabox 0.2.2 → 0.2.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
@@ -517,6 +517,8 @@ interface EntityContextDef {
517
517
  slugColumn: string;
518
518
  files: Record<string, EntityFileSpec>;
519
519
  indexFile?: string;
520
+ /** Custom index render function. If omitted, a default listing is generated. */
521
+ indexRender?: (rows: Row[]) => string;
520
522
  protectedFiles?: string[];
521
523
  /** When true, this entity's data is never rendered into other entities' context files. */
522
524
  protected?: boolean;
package/dist/index.js CHANGED
@@ -1140,7 +1140,25 @@ var DataStore = class {
1140
1140
  protectedFiles: def.protectedFiles,
1141
1141
  protected: def.protected,
1142
1142
  encrypted: def.encrypted,
1143
- index: def.indexFile ? { outputFile: def.indexFile, render: (rows) => "" } : void 0
1143
+ index: def.indexFile ? {
1144
+ outputFile: def.indexFile,
1145
+ render: def.indexRender ?? ((rows) => {
1146
+ const title = def.directory.charAt(0).toUpperCase() + def.directory.slice(1);
1147
+ if (!rows.length) return `# ${title}
1148
+
1149
+ None.
1150
+ `;
1151
+ const lines = rows.map((r) => {
1152
+ const name2 = String(r.name ?? r[def.slugColumn] ?? r.id ?? "unknown");
1153
+ const status = r.status ? ` (${r.status})` : "";
1154
+ return `- **${name2}**${status}`;
1155
+ });
1156
+ return `# ${title}
1157
+
1158
+ ${lines.join("\n")}
1159
+ `;
1160
+ })
1161
+ } : void 0
1144
1162
  });
1145
1163
  }
1146
1164
  async init(opts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botinabox",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Bot in a Box — framework for building multi-agent bots",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",