botinabox 0.2.1 → 0.2.2

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
@@ -970,6 +970,20 @@ declare const CORE_MIGRATIONS: Array<{
970
970
  sql: string;
971
971
  }>;
972
972
 
973
+ /**
974
+ * Define default entity context rendering for botinabox core tables.
975
+ * Call after defineCoreTables() and before or after init().
976
+ *
977
+ * Renders:
978
+ * - agents/ — per-agent context (AGENT.md, PROJECTS.md if agent_project exists)
979
+ * - users/ — per-user context (USER.md) — protected
980
+ * - skills/ — per-skill context (SKILL.md)
981
+ *
982
+ * Apps can override by calling db.defineEntityContext() with the same table name
983
+ * BEFORE calling defineCoreEntityContexts().
984
+ */
985
+ declare function defineCoreEntityContexts(db: DataStore): void;
986
+
973
987
  interface SanitizerOptions {
974
988
  fieldLengthLimits?: Record<string, number>;
975
989
  truncateSuffix?: string;
@@ -1357,4 +1371,4 @@ declare class SecretStore {
1357
1371
  private _toMeta;
1358
1372
  }
1359
1373
 
1360
- export { AGENT_STATUSES, type AgentConfig, type AgentDefinition, type AgentFilter, type AgentRecord, AgentRegistry, type AgentStatus, ApiExecutionAdapter, AuditEmitter, type AuditEvent, BackupManager, type BotConfig, type BudgetCheck, type BudgetConfig, BudgetController, CORE_MIGRATIONS, ChannelAdapter, ChannelRegistry, ChannelRegistryError, ChatMessage, ChatSessionManager, CliExecutionAdapter, type ColumnValidator, ColumnValidatorImpl, type ConfigLoadError, type ConfigLoadResult, DEFAULTS, DEFAULT_CONFIG, type DataConfig, DataStore, DataStoreError, EVENTS, type EntityColumnDef, type EntityConfig, type EntityContextDef, type EntityFileSpec, type EntitySource, type ExecutionAdapter, type Filter, HealthStatus, HeartbeatScheduler, HookBus, type HookHandler, type HookOptions, type HookRegistration, InboundMessage, LLMProvider, MAX_CHAIN_DEPTH, MessagePipeline, type ModelConfig, ModelInfo, ModelRouter, NdjsonLogger, NotificationQueue, type PackageMigration, type PackageUpdate, type PkLookup, ProviderRegistry, type QueryOptions, RUN_STATUSES, type RelationDef, type RenderConfig, ResolvedModel, type RetryPolicy, type Row, type RunContext, RunManager, type RunResult, type RunStatus, type SanitizerOptions, type SchemaError, type SecretInput, type SecretMeta, SecretStore, type SecurityConfig, type SeedItem, SessionKey, SessionManager, type SqliteAdapter, type StepRef, TASK_STATUSES, type TableDefinition, type TableInfoRow, type TaskDefinition, TaskQueue, type TaskRecord, type TaskStatus, TokenUsage, type Unsubscribe, UpdateChecker, type UpdateConfig, UpdateManager, type UpdateManifest, type User, type UserInput, UserRegistry, WakeupQueue, type WorkflowConfigEntry, type WorkflowDefinition$1 as WorkflowDefinition, WorkflowEngine, type WorkflowRunRecord, type WorkflowRunStatus, type WorkflowStep$1 as WorkflowStep, type WorkflowStepConfig, type WorkflowTrigger, _resetConfig, areDependenciesMet, buildAgentBindings, buildChainOrigin, checkAllowlist, checkChainDepth, checkMentionGate, chunkText, classifyUpdate, compareVersions, createConfigRevision, defineCoreTables, detectCycle, discoverChannels, discoverProviders, formatText, getConfig, initConfig, interpolate, interpolateEnv, loadConfig, parseVersion, runPackageMigrations, sanitize, topologicalSort, validateConfig };
1374
+ export { AGENT_STATUSES, type AgentConfig, type AgentDefinition, type AgentFilter, type AgentRecord, AgentRegistry, type AgentStatus, ApiExecutionAdapter, AuditEmitter, type AuditEvent, BackupManager, type BotConfig, type BudgetCheck, type BudgetConfig, BudgetController, CORE_MIGRATIONS, ChannelAdapter, ChannelRegistry, ChannelRegistryError, ChatMessage, ChatSessionManager, CliExecutionAdapter, type ColumnValidator, ColumnValidatorImpl, type ConfigLoadError, type ConfigLoadResult, DEFAULTS, DEFAULT_CONFIG, type DataConfig, DataStore, DataStoreError, EVENTS, type EntityColumnDef, type EntityConfig, type EntityContextDef, type EntityFileSpec, type EntitySource, type ExecutionAdapter, type Filter, HealthStatus, HeartbeatScheduler, HookBus, type HookHandler, type HookOptions, type HookRegistration, InboundMessage, LLMProvider, MAX_CHAIN_DEPTH, MessagePipeline, type ModelConfig, ModelInfo, ModelRouter, NdjsonLogger, NotificationQueue, type PackageMigration, type PackageUpdate, type PkLookup, ProviderRegistry, type QueryOptions, RUN_STATUSES, type RelationDef, type RenderConfig, ResolvedModel, type RetryPolicy, type Row, type RunContext, RunManager, type RunResult, type RunStatus, type SanitizerOptions, type SchemaError, type SecretInput, type SecretMeta, SecretStore, type SecurityConfig, type SeedItem, SessionKey, SessionManager, type SqliteAdapter, type StepRef, TASK_STATUSES, type TableDefinition, type TableInfoRow, type TaskDefinition, TaskQueue, type TaskRecord, type TaskStatus, TokenUsage, type Unsubscribe, UpdateChecker, type UpdateConfig, UpdateManager, type UpdateManifest, type User, type UserInput, UserRegistry, WakeupQueue, type WorkflowConfigEntry, type WorkflowDefinition$1 as WorkflowDefinition, WorkflowEngine, type WorkflowRunRecord, type WorkflowRunStatus, type WorkflowStep$1 as WorkflowStep, type WorkflowStepConfig, type WorkflowTrigger, _resetConfig, areDependenciesMet, buildAgentBindings, buildChainOrigin, checkAllowlist, checkChainDepth, checkMentionGate, chunkText, classifyUpdate, compareVersions, createConfigRevision, defineCoreEntityContexts, defineCoreTables, detectCycle, discoverChannels, discoverProviders, formatText, getConfig, initConfig, interpolate, interpolateEnv, loadConfig, parseVersion, runPackageMigrations, sanitize, topologicalSort, validateConfig };
package/dist/index.js CHANGED
@@ -1570,6 +1570,86 @@ var CORE_MIGRATIONS = [
1570
1570
  }
1571
1571
  ];
1572
1572
 
1573
+ // src/core/data/core-entity-contexts.ts
1574
+ function defineCoreEntityContexts(db) {
1575
+ db.defineEntityContext("agents", {
1576
+ table: "agents",
1577
+ directory: "agents",
1578
+ slugColumn: "slug",
1579
+ indexFile: "agents/AGENTS.md",
1580
+ files: {
1581
+ "AGENT.md": {
1582
+ source: { type: "self" },
1583
+ render: (rows) => {
1584
+ const a = rows[0];
1585
+ if (!a) return "";
1586
+ return [
1587
+ `# ${a.name}`,
1588
+ "",
1589
+ a.role ? `**Role:** ${a.role}` : null,
1590
+ a.status ? `**Status:** ${a.status}` : null,
1591
+ a.cwd ? `**Working Directory:** ${a.cwd}` : null,
1592
+ a.reports_to ? `**Reports To:** ${a.reports_to}` : null,
1593
+ ""
1594
+ ].filter(Boolean).join("\n");
1595
+ }
1596
+ }
1597
+ }
1598
+ });
1599
+ db.defineEntityContext("users", {
1600
+ table: "users",
1601
+ directory: "users",
1602
+ slugColumn: "name",
1603
+ protected: true,
1604
+ indexFile: "users/USERS.md",
1605
+ files: {
1606
+ "USER.md": {
1607
+ source: { type: "self" },
1608
+ render: (rows) => {
1609
+ const u = rows[0];
1610
+ if (!u) return "";
1611
+ return [
1612
+ `# ${u.name}`,
1613
+ "",
1614
+ u.role ? `**Role:** ${u.role}` : null,
1615
+ u.title ? `**Title:** ${u.title}` : null,
1616
+ u.email ? `**Email:** ${u.email}` : null,
1617
+ u.timezone ? `**Timezone:** ${u.timezone}` : null,
1618
+ ""
1619
+ ].filter(Boolean).join("\n");
1620
+ }
1621
+ }
1622
+ }
1623
+ });
1624
+ db.defineEntityContext("skills", {
1625
+ table: "skills",
1626
+ directory: "skills",
1627
+ slugColumn: "slug",
1628
+ indexFile: "skills/SKILLS.md",
1629
+ files: {
1630
+ "SKILL.md": {
1631
+ source: { type: "self" },
1632
+ render: (rows) => {
1633
+ const s = rows[0];
1634
+ if (!s) return "";
1635
+ return [
1636
+ `# ${s.name}`,
1637
+ "",
1638
+ s.category ? `**Category:** ${s.category}` : null,
1639
+ s.description ? `
1640
+ ${s.description}` : null,
1641
+ s.definition ? `
1642
+ ## Definition
1643
+
1644
+ ${s.definition}` : null,
1645
+ ""
1646
+ ].filter(Boolean).join("\n");
1647
+ }
1648
+ }
1649
+ }
1650
+ });
1651
+ }
1652
+
1573
1653
  // src/core/security/sanitizer.ts
1574
1654
  import { Buffer as Buffer2 } from "buffer";
1575
1655
  var DEFAULT_FIELD_LIMIT = 65535;
@@ -3179,6 +3259,7 @@ export {
3179
3259
  classifyUpdate,
3180
3260
  compareVersions,
3181
3261
  createConfigRevision,
3262
+ defineCoreEntityContexts,
3182
3263
  defineCoreTables,
3183
3264
  detectCycle,
3184
3265
  discoverChannels,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botinabox",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Bot in a Box — framework for building multi-agent bots",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",