business-as-code 0.1.0 → 0.2.0
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/README.md +202 -175
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1080 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders/index.d.ts +174 -0
- package/dist/loaders/index.js +366 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/schema/index.d.ts +146 -0
- package/dist/schema/index.js +716 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/types-CJ9eGS_C.d.ts +86 -0
- package/package.json +58 -32
- package/TODO.md +0 -32
- package/src/index.ts +0 -77
- package/src/types.ts +0 -97
- package/tsconfig.json +0 -13
- package/tsup.config.ts +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/domains/admin.ts","../../src/schema/domains/business.ts","../../src/schema/domains/product.ts","../../src/schema/domains/success.ts","../../src/schema/domains/sales.ts","../../src/schema/domains/marketing.ts","../../src/schema/domains/work.ts","../../src/schema/domains/financial.ts","../../src/schema/domains/communications.ts","../../src/schema/index.ts"],"sourcesContent":["/**\n * Admin Domain - Core system entities\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Users: NounSchema = {\n slug: 'users',\n group: 'Admin',\n titleField: 'email',\n fields: [\n { name: 'email', type: 'email', required: true, unique: true },\n { name: 'name', type: 'text' },\n { name: 'avatar', type: 'image' },\n { name: 'role', type: 'status', options: ['admin', 'user', 'viewer'] },\n ],\n}\n\nexport const Orgs: NounSchema = {\n slug: 'orgs',\n group: 'Admin',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'slug', type: 'text', required: true, unique: true },\n { name: 'logo', type: 'image' },\n { name: 'domain', type: 'text' },\n ],\n}\n\nexport const ServiceAccounts: NounSchema = {\n slug: 'service-accounts',\n group: 'Admin',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'org', type: 'ref', config: { relationTo: 'orgs' } },\n { name: 'apiKey', type: 'text', unique: true },\n { name: 'scopes', type: 'array' },\n ],\n}\n\nexport const adminNouns: NounSchema[] = [Users, Orgs, ServiceAccounts]\n","/**\n * Business Domain - Core business entities\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Businesses: NounSchema = {\n slug: 'businesses',\n group: 'Business',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'legalName', type: 'text' },\n { name: 'type', type: 'status', options: ['LLC', 'Corporation', 'Partnership', 'Sole Proprietorship', 'Nonprofit'] },\n { name: 'status', type: 'status', options: ['Active', 'Inactive', 'Dissolved'] },\n { name: 'foundedDate', type: 'date' },\n { name: 'website', type: 'url' },\n { name: 'description', type: 'rich' },\n ],\n}\n\nexport const Goals: NounSchema = {\n slug: 'goals',\n group: 'Business',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'type', type: 'status', options: ['Revenue', 'Growth', 'Retention', 'Efficiency', 'Quality'] },\n { name: 'targetValue', type: 'number' },\n { name: 'currentValue', type: 'number' },\n { name: 'unit', type: 'text' },\n { name: 'deadline', type: 'date' },\n { name: 'status', type: 'status', options: ['Not Started', 'In Progress', 'At Risk', 'Achieved'] },\n ],\n}\n\nexport const Metrics: NounSchema = {\n slug: 'metrics',\n group: 'Business',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'type', type: 'status', options: ['KPI', 'OKR', 'North Star', 'Health', 'Vanity'] },\n { name: 'value', type: 'number' },\n { name: 'unit', type: 'text' },\n { name: 'frequency', type: 'status', options: ['Real-time', 'Daily', 'Weekly', 'Monthly', 'Quarterly'] },\n ],\n}\n\nexport const Teams: NounSchema = {\n slug: 'teams',\n group: 'Business',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'type', type: 'status', options: ['Engineering', 'Product', 'Design', 'Marketing', 'Sales', 'Support', 'Operations', 'Finance', 'HR', 'Legal'] },\n { name: 'description', type: 'text' },\n ],\n}\n\nexport const Processes: NounSchema = {\n slug: 'processes',\n group: 'Business',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'type', type: 'status', options: ['Core', 'Support', 'Management'] },\n { name: 'owner', type: 'ref', config: { relationTo: 'teams' } },\n { name: 'description', type: 'rich' },\n { name: 'status', type: 'status', options: ['Draft', 'Active', 'Deprecated'] },\n ],\n}\n\nexport const businessNouns: NounSchema[] = [Businesses, Goals, Metrics, Teams, Processes]\n","/**\n * Product Domain - Products, services, and offerings\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Products: NounSchema = {\n slug: 'products',\n group: 'Product',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'type', type: 'status', options: ['API', 'App', 'CLI', 'SDK', 'MCP', 'Agent', 'Dataset', 'DataFeed', 'Function', 'Database', 'Queue', 'Storage', 'Cache', 'Platform'] },\n { name: 'description', type: 'text' },\n { name: 'isActive', type: 'boolean' },\n { name: 'stripeProductId', type: 'text', unique: true },\n ],\n}\n\nexport const Services: NounSchema = {\n slug: 'services',\n group: 'Product',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'type', type: 'status', options: ['Consulting', 'Implementation', 'Training', 'Support', 'Managed'] },\n { name: 'description', type: 'text' },\n { name: 'hourlyRate', type: 'money' },\n { name: 'isActive', type: 'boolean' },\n ],\n}\n\nexport const Offers: NounSchema = {\n slug: 'offers',\n group: 'Product',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'products', type: 'ref', config: { relationTo: 'products', hasMany: true } },\n { name: 'type', type: 'status', options: ['Trial', 'Freemium', 'Subscription', 'One-time', 'Usage-based'] },\n { name: 'description', type: 'text' },\n { name: 'isActive', type: 'boolean' },\n ],\n}\n\nexport const Prices: NounSchema = {\n slug: 'prices',\n group: 'Product',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'offer', type: 'ref', config: { relationTo: 'offers' } },\n { name: 'amount', type: 'money', required: true },\n { name: 'currency', type: 'status', options: ['USD', 'EUR', 'GBP', 'JPY'] },\n { name: 'interval', type: 'status', options: ['once', 'day', 'week', 'month', 'year'] },\n { name: 'stripePriceId', type: 'text', unique: true },\n { name: 'isActive', type: 'boolean' },\n ],\n}\n\nexport const Features: NounSchema = {\n slug: 'features',\n group: 'Product',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'product', type: 'ref', config: { relationTo: 'products' } },\n { name: 'description', type: 'text' },\n { name: 'type', type: 'status', options: ['Core', 'Premium', 'Enterprise', 'Add-on'] },\n { name: 'status', type: 'status', options: ['Planned', 'In Development', 'Beta', 'GA', 'Deprecated'] },\n ],\n}\n\nexport const productNouns: NounSchema[] = [Products, Services, Offers, Prices, Features]\n","/**\n * Success Domain - Customer success and relationships\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Customers: NounSchema = {\n slug: 'customers',\n group: 'Success',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'type', type: 'status', options: ['Business', 'Developer', 'Consumer', 'Professional'], required: true },\n { name: 'user', type: 'ref', config: { relationTo: 'users' } },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'company', type: 'text' },\n { name: 'email', type: 'email' },\n { name: 'stripeCustomerId', type: 'text', unique: true },\n { name: 'status', type: 'status', options: ['Active', 'Churned', 'Paused'] },\n { name: 'healthScore', type: 'score' },\n ],\n}\n\nexport const Contacts: NounSchema = {\n slug: 'contacts',\n group: 'Success',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'customer', type: 'ref', config: { relationTo: 'customers' } },\n { name: 'email', type: 'email' },\n { name: 'phone', type: 'text' },\n { name: 'title', type: 'text' },\n { name: 'role', type: 'status', options: ['Decision Maker', 'Influencer', 'Champion', 'End User', 'Billing'] },\n { name: 'isPrimary', type: 'boolean' },\n ],\n}\n\nexport const Subscriptions: NounSchema = {\n slug: 'subscriptions',\n group: 'Success',\n titleField: 'id',\n fields: [\n { name: 'customer', type: 'ref', config: { relationTo: 'customers' }, required: true },\n { name: 'offer', type: 'ref', config: { relationTo: 'offers' } },\n { name: 'price', type: 'ref', config: { relationTo: 'prices' } },\n { name: 'status', type: 'status', options: ['Active', 'Past Due', 'Canceled', 'Paused', 'Trialing'] },\n { name: 'stripeSubscriptionId', type: 'text', unique: true },\n { name: 'currentPeriodStart', type: 'date' },\n { name: 'currentPeriodEnd', type: 'date' },\n { name: 'canceledAt', type: 'date' },\n ],\n}\n\nexport const successNouns: NounSchema[] = [Customers, Contacts, Subscriptions]\n","/**\n * Sales Domain - Sales pipeline and deals\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Deals: NounSchema = {\n slug: 'deals',\n group: 'Sales',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'customer', type: 'ref', config: { relationTo: 'customers' } },\n { name: 'contact', type: 'ref', config: { relationTo: 'contacts' } },\n { name: 'value', type: 'money' },\n { name: 'stage', type: 'status', options: ['Qualification', 'Discovery', 'Proposal', 'Negotiation', 'Closed Won', 'Closed Lost'] },\n { name: 'probability', type: 'score' },\n { name: 'expectedCloseDate', type: 'date' },\n { name: 'actualCloseDate', type: 'date' },\n { name: 'lostReason', type: 'text' },\n ],\n}\n\nexport const Quotes: NounSchema = {\n slug: 'quotes',\n group: 'Sales',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'deal', type: 'ref', config: { relationTo: 'deals' } },\n { name: 'customer', type: 'ref', config: { relationTo: 'customers' } },\n { name: 'total', type: 'money', required: true },\n { name: 'status', type: 'status', options: ['Draft', 'Sent', 'Viewed', 'Accepted', 'Rejected', 'Expired'] },\n { name: 'validUntil', type: 'date' },\n { name: 'terms', type: 'rich' },\n ],\n}\n\nexport const Proposals: NounSchema = {\n slug: 'proposals',\n group: 'Sales',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'deal', type: 'ref', config: { relationTo: 'deals' } },\n { name: 'customer', type: 'ref', config: { relationTo: 'customers' } },\n { name: 'content', type: 'rich' },\n { name: 'status', type: 'status', options: ['Draft', 'In Review', 'Sent', 'Accepted', 'Rejected'] },\n { name: 'sentAt', type: 'date' },\n ],\n}\n\nexport const salesNouns: NounSchema[] = [Deals, Quotes, Proposals]\n","/**\n * Marketing Domain - Leads, brands, and marketing assets\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Leads: NounSchema = {\n slug: 'leads',\n group: 'Marketing',\n titleField: 'email',\n fields: [\n { name: 'email', type: 'email', required: true },\n { name: 'name', type: 'text' },\n { name: 'company', type: 'text' },\n { name: 'title', type: 'text' },\n { name: 'source', type: 'status', options: ['Website', 'Referral', 'Event', 'Ads', 'Content', 'Outbound', 'Partner'] },\n { name: 'status', type: 'status', options: ['New', 'Contacted', 'Qualified', 'Unqualified', 'Converted'] },\n { name: 'score', type: 'score' },\n { name: 'convertedTo', type: 'ref', config: { relationTo: 'customers' } },\n ],\n}\n\nexport const Brands: NounSchema = {\n slug: 'brands',\n group: 'Marketing',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'tagline', type: 'text' },\n { name: 'description', type: 'rich' },\n { name: 'logo', type: 'image' },\n { name: 'primaryColor', type: 'text' },\n { name: 'secondaryColor', type: 'text' },\n ],\n}\n\nexport const Domains: NounSchema = {\n slug: 'domains',\n group: 'Marketing',\n titleField: 'domain',\n fields: [\n { name: 'domain', type: 'text', required: true, unique: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'brand', type: 'ref', config: { relationTo: 'brands' } },\n { name: 'type', type: 'status', options: ['Primary', 'Redirect', 'Vanity', 'Product'] },\n { name: 'status', type: 'status', options: ['Active', 'Pending', 'Expired'] },\n { name: 'registrar', type: 'text' },\n { name: 'expiresAt', type: 'date' },\n ],\n}\n\nexport const Competitors: NounSchema = {\n slug: 'competitors',\n group: 'Marketing',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'website', type: 'url' },\n { name: 'description', type: 'text' },\n { name: 'strengths', type: 'rich' },\n { name: 'weaknesses', type: 'rich' },\n { name: 'threat', type: 'status', options: ['Low', 'Medium', 'High', 'Critical'] },\n ],\n}\n\nexport const marketingNouns: NounSchema[] = [Leads, Brands, Domains, Competitors]\n","/**\n * Work Domain - Projects, tasks, and workflows\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Projects: NounSchema = {\n slug: 'projects',\n group: 'Work',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'team', type: 'ref', config: { relationTo: 'teams' } },\n { name: 'description', type: 'rich' },\n { name: 'status', type: 'status', options: ['Planning', 'Active', 'On Hold', 'Completed', 'Archived'] },\n { name: 'startDate', type: 'date' },\n { name: 'targetDate', type: 'date' },\n { name: 'completedDate', type: 'date' },\n ],\n}\n\nexport const Tasks: NounSchema = {\n slug: 'tasks',\n group: 'Work',\n titleField: 'title',\n fields: [\n { name: 'title', type: 'text', required: true },\n { name: 'project', type: 'ref', config: { relationTo: 'projects' } },\n { name: 'assignee', type: 'ref', config: { relationTo: 'users' } },\n { name: 'description', type: 'rich' },\n { name: 'status', type: 'status', options: ['Backlog', 'Todo', 'In Progress', 'In Review', 'Done'] },\n { name: 'priority', type: 'status', options: ['Low', 'Medium', 'High', 'Urgent'] },\n { name: 'dueDate', type: 'date' },\n { name: 'estimatedHours', type: 'number' },\n { name: 'actualHours', type: 'number' },\n ],\n}\n\nexport const Issues: NounSchema = {\n slug: 'issues',\n group: 'Work',\n titleField: 'title',\n fields: [\n { name: 'title', type: 'text', required: true },\n { name: 'project', type: 'ref', config: { relationTo: 'projects' } },\n { name: 'reporter', type: 'ref', config: { relationTo: 'users' } },\n { name: 'assignee', type: 'ref', config: { relationTo: 'users' } },\n { name: 'description', type: 'rich' },\n { name: 'type', type: 'status', options: ['Bug', 'Feature', 'Task', 'Epic', 'Story'] },\n { name: 'status', type: 'status', options: ['Open', 'In Progress', 'Resolved', 'Closed'] },\n { name: 'priority', type: 'status', options: ['Low', 'Medium', 'High', 'Critical'] },\n ],\n}\n\nexport const Workflows: NounSchema = {\n slug: 'workflows',\n group: 'Work',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'description', type: 'text' },\n { name: 'trigger', type: 'status', options: ['Manual', 'Schedule', 'Event', 'Webhook'] },\n { name: 'status', type: 'status', options: ['Draft', 'Active', 'Paused', 'Archived'] },\n ],\n}\n\nexport const Roles: NounSchema = {\n slug: 'roles',\n group: 'Work',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'team', type: 'ref', config: { relationTo: 'teams' } },\n { name: 'description', type: 'text' },\n { name: 'level', type: 'status', options: ['Individual Contributor', 'Lead', 'Manager', 'Director', 'VP', 'C-Level'] },\n ],\n}\n\nexport const Agents: NounSchema = {\n slug: 'agents',\n group: 'Work',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'role', type: 'ref', config: { relationTo: 'roles' } },\n { name: 'type', type: 'status', options: ['AI', 'Human', 'Hybrid'] },\n { name: 'status', type: 'status', options: ['Active', 'Paused', 'Retired'] },\n { name: 'capabilities', type: 'array' },\n ],\n}\n\nexport const workNouns: NounSchema[] = [Projects, Tasks, Issues, Workflows, Roles, Agents]\n","/**\n * Financial Domain - Accounting, invoicing, and payments\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Invoices: NounSchema = {\n slug: 'invoices',\n group: 'Financial',\n titleField: 'number',\n fields: [\n { name: 'number', type: 'text', required: true, unique: true },\n { name: 'customer', type: 'ref', config: { relationTo: 'customers' } },\n { name: 'subscription', type: 'ref', config: { relationTo: 'subscriptions' } },\n { name: 'total', type: 'money', required: true },\n { name: 'tax', type: 'money' },\n { name: 'status', type: 'status', options: ['Draft', 'Sent', 'Paid', 'Void', 'Uncollectible'] },\n { name: 'dueDate', type: 'date' },\n { name: 'paidAt', type: 'date' },\n { name: 'stripeInvoiceId', type: 'text', unique: true },\n ],\n}\n\nexport const Payments: NounSchema = {\n slug: 'payments',\n group: 'Financial',\n titleField: 'id',\n fields: [\n { name: 'customer', type: 'ref', config: { relationTo: 'customers' } },\n { name: 'invoice', type: 'ref', config: { relationTo: 'invoices' } },\n { name: 'amount', type: 'money', required: true },\n { name: 'currency', type: 'status', options: ['USD', 'EUR', 'GBP', 'JPY'] },\n { name: 'status', type: 'status', options: ['Pending', 'Succeeded', 'Failed', 'Refunded'] },\n { name: 'method', type: 'status', options: ['Card', 'ACH', 'Wire', 'Check'] },\n { name: 'stripePaymentId', type: 'text', unique: true },\n ],\n}\n\nexport const Refunds: NounSchema = {\n slug: 'refunds',\n group: 'Financial',\n titleField: 'id',\n fields: [\n { name: 'payment', type: 'ref', config: { relationTo: 'payments' }, required: true },\n { name: 'amount', type: 'money', required: true },\n { name: 'reason', type: 'status', options: ['Duplicate', 'Fraudulent', 'Customer Request', 'Product Issue'] },\n { name: 'status', type: 'status', options: ['Pending', 'Succeeded', 'Failed'] },\n { name: 'notes', type: 'text' },\n ],\n}\n\nexport const ChartOfAccounts: NounSchema = {\n slug: 'chart-of-accounts',\n group: 'Financial',\n titleField: 'name',\n fields: [\n { name: 'code', type: 'text', required: true, unique: true },\n { name: 'name', type: 'text', required: true },\n { name: 'type', type: 'status', options: ['Asset', 'Liability', 'Equity', 'Revenue', 'Expense'], required: true },\n { name: 'subtype', type: 'text' },\n { name: 'description', type: 'text' },\n { name: 'isActive', type: 'boolean' },\n ],\n}\n\nexport const JournalEntries: NounSchema = {\n slug: 'journal-entries',\n group: 'Financial',\n titleField: 'reference',\n fields: [\n { name: 'reference', type: 'text', required: true },\n { name: 'date', type: 'date', required: true },\n { name: 'description', type: 'text' },\n { name: 'debitAccount', type: 'ref', config: { relationTo: 'chart-of-accounts' } },\n { name: 'creditAccount', type: 'ref', config: { relationTo: 'chart-of-accounts' } },\n { name: 'amount', type: 'money', required: true },\n { name: 'status', type: 'status', options: ['Draft', 'Posted', 'Voided'] },\n ],\n}\n\nexport const financialNouns: NounSchema[] = [Invoices, Payments, Refunds, ChartOfAccounts, JournalEntries]\n","/**\n * Communications Domain - Messaging, sequences, and engagement\n */\n\nimport type { NounSchema } from '../../types'\n\nexport const Channels: NounSchema = {\n slug: 'channels',\n group: 'Communications',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'type', type: 'status', options: ['Email', 'SMS', 'Slack', 'Discord', 'WhatsApp', 'In-App', 'Push'] },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'isActive', type: 'boolean' },\n { name: 'config', type: 'text' },\n ],\n}\n\nexport const Messages: NounSchema = {\n slug: 'messages',\n group: 'Communications',\n titleField: 'subject',\n fields: [\n { name: 'subject', type: 'text' },\n { name: 'body', type: 'rich', required: true },\n { name: 'channel', type: 'ref', config: { relationTo: 'channels' } },\n { name: 'from', type: 'text' },\n { name: 'to', type: 'text', required: true },\n { name: 'status', type: 'status', options: ['Draft', 'Queued', 'Sent', 'Delivered', 'Bounced', 'Failed'] },\n { name: 'sentAt', type: 'date' },\n { name: 'openedAt', type: 'date' },\n { name: 'clickedAt', type: 'date' },\n ],\n}\n\nexport const Sequences: NounSchema = {\n slug: 'sequences',\n group: 'Communications',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'type', type: 'status', options: ['Onboarding', 'Nurture', 'Re-engagement', 'Upsell', 'Support'] },\n { name: 'status', type: 'status', options: ['Draft', 'Active', 'Paused', 'Archived'] },\n { name: 'description', type: 'text' },\n ],\n}\n\nexport const Templates: NounSchema = {\n slug: 'templates',\n group: 'Communications',\n titleField: 'name',\n fields: [\n { name: 'name', type: 'text', required: true },\n { name: 'channel', type: 'ref', config: { relationTo: 'channels' } },\n { name: 'subject', type: 'text' },\n { name: 'body', type: 'rich', required: true },\n { name: 'type', type: 'status', options: ['Transactional', 'Marketing', 'System'] },\n { name: 'isActive', type: 'boolean' },\n ],\n}\n\nexport const Posts: NounSchema = {\n slug: 'posts',\n group: 'Communications',\n titleField: 'title',\n fields: [\n { name: 'title', type: 'text', required: true },\n { name: 'content', type: 'rich', required: true },\n { name: 'author', type: 'ref', config: { relationTo: 'users' } },\n { name: 'business', type: 'ref', config: { relationTo: 'businesses' } },\n { name: 'status', type: 'status', options: ['Draft', 'Scheduled', 'Published', 'Archived'] },\n { name: 'publishedAt', type: 'date' },\n { name: 'channels', type: 'ref', config: { relationTo: 'channels', hasMany: true } },\n ],\n}\n\nexport const communicationsNouns: NounSchema[] = [Channels, Messages, Sequences, Templates, Posts]\n","/**\n * Business Schema Module\n *\n * Exports the default business schema and utilities for working with\n * business definitions.\n */\n\nimport type { BusinessSchema, BusinessDomain, NounSchema } from '../types'\n\n// Import all domain nouns\nimport {\n adminNouns,\n businessNouns,\n productNouns,\n successNouns,\n salesNouns,\n marketingNouns,\n workNouns,\n financialNouns,\n communicationsNouns,\n} from './domains'\n\n// Re-export all domains\nexport * from './domains'\n\n/**\n * The default business schema\n *\n * This represents a complete business with all standard domains.\n * Use this as a base and extend/customize for specific use cases.\n */\nexport const defaultBusinessSchema: BusinessSchema = {\n name: 'default',\n version: '1.0.0',\n description: 'Default business schema with all standard domains',\n domains: {\n admin: adminNouns,\n business: businessNouns,\n product: productNouns,\n success: successNouns,\n sales: salesNouns,\n marketing: marketingNouns,\n work: workNouns,\n financial: financialNouns,\n communications: communicationsNouns,\n },\n}\n\n/**\n * Get all nouns from a business schema as a flat array\n */\nexport function getAllNouns(schema: BusinessSchema): NounSchema[] {\n const nouns: NounSchema[] = []\n for (const domain of Object.values(schema.domains)) {\n if (domain) {\n nouns.push(...domain)\n }\n }\n return nouns\n}\n\n/**\n * Get nouns for a specific domain\n */\nexport function getDomainNouns(\n schema: BusinessSchema,\n domain: BusinessDomain\n): NounSchema[] {\n return schema.domains[domain] || []\n}\n\n/**\n * Find a noun by slug across all domains\n */\nexport function findNounBySlug(\n schema: BusinessSchema,\n slug: string\n): NounSchema | undefined {\n for (const domain of Object.values(schema.domains)) {\n if (domain) {\n const noun = domain.find((n) => n.slug === slug)\n if (noun) return noun\n }\n }\n return undefined\n}\n\n/**\n * Get all domain names in a schema\n */\nexport function getDomains(schema: BusinessSchema): BusinessDomain[] {\n return Object.keys(schema.domains) as BusinessDomain[]\n}\n\n/**\n * Merge two business schemas\n *\n * The extension schema's nouns override the base schema's nouns\n * when they have the same slug.\n */\nexport function mergeSchemas(\n base: BusinessSchema,\n extension: Partial<BusinessSchema>\n): BusinessSchema {\n const merged: BusinessSchema = {\n name: extension.name || base.name,\n version: extension.version || base.version,\n description: extension.description || base.description,\n domains: { ...base.domains },\n }\n\n if (extension.domains) {\n for (const [domain, nouns] of Object.entries(extension.domains)) {\n if (nouns) {\n const existing = merged.domains[domain as BusinessDomain] || []\n const existingSlugs = new Set(existing.map((n) => n.slug))\n\n // Add new nouns and override existing ones\n const newNouns = nouns.filter((n) => !existingSlugs.has(n.slug))\n const overrides = nouns.filter((n) => existingSlugs.has(n.slug))\n\n merged.domains[domain as BusinessDomain] = [\n ...existing.filter((n) => !overrides.find((o) => o.slug === n.slug)),\n ...overrides,\n ...newNouns,\n ]\n }\n }\n }\n\n return merged\n}\n\n/**\n * Create a minimal business schema with only specified domains\n */\nexport function createMinimalSchema(\n domains: BusinessDomain[],\n options?: { name?: string; version?: string }\n): BusinessSchema {\n const schema: BusinessSchema = {\n name: options?.name || 'minimal',\n version: options?.version || '1.0.0',\n domains: {},\n }\n\n for (const domain of domains) {\n schema.domains[domain] = defaultBusinessSchema.domains[domain]\n }\n\n return schema\n}\n\n/**\n * Validate a business schema\n */\nexport function validateSchema(schema: BusinessSchema): string[] {\n const errors: string[] = []\n\n if (!schema.name) {\n errors.push('Schema must have a name')\n }\n\n if (!schema.version) {\n errors.push('Schema must have a version')\n }\n\n const allSlugs = new Set<string>()\n for (const [domain, nouns] of Object.entries(schema.domains)) {\n if (nouns) {\n for (const noun of nouns) {\n if (!noun.slug) {\n errors.push(`Noun in domain '${domain}' is missing a slug`)\n } else if (allSlugs.has(noun.slug)) {\n errors.push(`Duplicate slug '${noun.slug}' found in domain '${domain}'`)\n } else {\n allSlugs.add(noun.slug)\n }\n\n if (!noun.fields || noun.fields.length === 0) {\n errors.push(`Noun '${noun.slug}' has no fields`)\n }\n }\n }\n }\n\n return errors\n}\n"],"mappings":";AAMO,IAAM,QAAoB;AAAA,EAC/B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAQ;AAAA,IACN,EAAE,MAAM,SAAS,MAAM,SAAS,UAAU,MAAM,QAAQ,KAAK;AAAA,IAC7D,EAAE,MAAM,QAAQ,MAAM,OAAO;AAAA,IAC7B,EAAE,MAAM,UAAU,MAAM,QAAQ;AAAA,IAChC,EAAE,MAAM,QAAQ,MAAM,UAAU,SAAS,CAAC,SAAS,QAAQ,QAAQ,EAAE;AAAA,EACvE;AACF;AAEO,IAAM,OAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAQ;AAAA,IACN,EAAE,MAAM,QAAQ,MAAM,QAAQ,UAAU,KAAK;AAAA,IAC7C,EAAE,MAAM,QAAQ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mB,CAAC;AAE1B,MAAI,CAAC,OAAO,MAAM;AAChB,WAAO,KAAK,yBAAyB;AAAA,EACvC;AAEA,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO,KAAK,4BAA4B;AAAA,EAC1C;AAEA,QAAM,WAAW,oBAAI,IAAY;AACjC,aAAW,CAAC,QAAQ,KAAK,KAAK,OAAO,QAAQ,OAAO,OAAO,GAAG;AAC5D,QAAI,OAAO;AACT,iBAAW,QAAQ,OAAO;AACxB,YAAI,CAAC,KAAK,MAAM;AACd,iBAAO,KAAK,mBAAmB,MAAM,qBAAqB;AAAA,QAC5D,WAAW,SAAS,IAAI,KAAK,IAAI,GAAG;AAClC,iBAAO,KAAK,mBAAmB,KAAK,IAAI,sBAAsB,MAAM,GAAG;AAAA,QACzE,OAAO;AACL,mBAAS,IAAI,KAAK,IAAI;AAAA,QACxB;AAEA,YAAI,CAAC,KAAK,UAAU,KAAK,OAAO,WAAW,GAAG;AAC5C,iBAAO,KAAK,SAAS,KAAK,IAAI,iBAAiB;AAAA,QACjD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { NounSchema, FieldSchema } from 'db.sb';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Business-as-Code Type Definitions
|
|
5
|
+
*
|
|
6
|
+
* These types define the structure of a business schema that can be
|
|
7
|
+
* represented in MDX, YAML, JSON, or TypeScript code.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Business domain categories
|
|
12
|
+
*/
|
|
13
|
+
type BusinessDomain = 'admin' | 'ai' | 'business' | 'code' | 'communications' | 'content' | 'data' | 'design' | 'experiments' | 'financial' | 'integrations' | 'marketing' | 'markets' | 'product' | 'sales' | 'startup' | 'success' | 'tech' | 'web' | 'work';
|
|
14
|
+
/**
|
|
15
|
+
* A business schema is a collection of nouns organized by domain
|
|
16
|
+
*/
|
|
17
|
+
interface BusinessSchema {
|
|
18
|
+
/** Schema name/identifier */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Schema version for migrations */
|
|
21
|
+
version: string;
|
|
22
|
+
/** Optional description */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Nouns organized by domain */
|
|
25
|
+
domains: Partial<Record<BusinessDomain, NounSchema[]>>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Options for loading business schemas
|
|
29
|
+
*/
|
|
30
|
+
interface LoaderOptions {
|
|
31
|
+
/** Base context for DSL parsing */
|
|
32
|
+
context?: 'app' | 'noun' | 'field';
|
|
33
|
+
/** Whether to validate schema after loading */
|
|
34
|
+
validate?: boolean;
|
|
35
|
+
/** Custom noun resolver for inheritance */
|
|
36
|
+
resolveNoun?: (name: string) => NounSchema | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Result of loading a business schema
|
|
40
|
+
*/
|
|
41
|
+
interface LoadResult {
|
|
42
|
+
/** The loaded schema */
|
|
43
|
+
schema: BusinessSchema;
|
|
44
|
+
/** Any warnings during loading */
|
|
45
|
+
warnings?: string[];
|
|
46
|
+
/** Source format that was loaded */
|
|
47
|
+
format: 'mdx' | 'yaml' | 'json' | 'typescript';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Extension definition for customizing base schemas
|
|
51
|
+
*/
|
|
52
|
+
interface BusinessExtension {
|
|
53
|
+
/** Extension name */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Base schema to extend (defaults to 'default') */
|
|
56
|
+
extends?: string;
|
|
57
|
+
/** Nouns to add */
|
|
58
|
+
add?: Partial<Record<BusinessDomain, NounSchema[]>>;
|
|
59
|
+
/** Nouns to override (by slug) */
|
|
60
|
+
override?: Partial<Record<BusinessDomain, NounSchema[]>>;
|
|
61
|
+
/** Nouns to remove (by slug) */
|
|
62
|
+
remove?: Partial<Record<BusinessDomain, string[]>>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Field definition shorthand for MDX/YAML
|
|
66
|
+
* Allows concise field definitions like:
|
|
67
|
+
* - "email" (known type)
|
|
68
|
+
* - "text required" (type with modifier)
|
|
69
|
+
* - "status:active|inactive|pending" (select with options)
|
|
70
|
+
*/
|
|
71
|
+
type FieldShorthand = string | FieldSchema;
|
|
72
|
+
/**
|
|
73
|
+
* Noun definition shorthand for MDX/YAML
|
|
74
|
+
*/
|
|
75
|
+
interface NounShorthand {
|
|
76
|
+
/** Noun name (becomes slug in camelCase) */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Fields as shorthand or full definitions */
|
|
79
|
+
fields: Record<string, FieldShorthand>;
|
|
80
|
+
/** Admin group for UI organization */
|
|
81
|
+
group?: string;
|
|
82
|
+
/** Field to use as title in admin UI */
|
|
83
|
+
titleField?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type { BusinessSchema as B, FieldShorthand as F, LoaderOptions as L, NounShorthand as N, BusinessDomain as a, BusinessExtension as b, LoadResult as c };
|
package/package.json
CHANGED
|
@@ -1,49 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "business-as-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Define, launch, experiment, iterate, and grow your business entirely in code",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./schema": {
|
|
15
|
+
"import": "./dist/schema/index.js",
|
|
16
|
+
"types": "./dist/schema/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./loaders": {
|
|
19
|
+
"import": "./dist/loaders/index.js",
|
|
20
|
+
"types": "./dist/loaders/index.d.ts"
|
|
13
21
|
}
|
|
14
22
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"tsup": "^8.4.0"
|
|
25
|
-
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "https://github.com/drivly/primitives.org.ai.git"
|
|
29
|
-
},
|
|
30
|
-
"homepage": "https://mdx.org.ai",
|
|
31
|
-
"bugs": {
|
|
32
|
-
"url": "https://github.com/drivly/primitives.org.ai/issues"
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup",
|
|
28
|
+
"dev": "tsup --watch",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest",
|
|
31
|
+
"typecheck": "tsc --noEmit"
|
|
33
32
|
},
|
|
34
33
|
"keywords": [
|
|
35
|
-
"ai",
|
|
36
34
|
"business",
|
|
35
|
+
"schema",
|
|
36
|
+
"dsl",
|
|
37
|
+
"mdx",
|
|
38
|
+
"yaml",
|
|
39
|
+
"json",
|
|
40
|
+
"startups",
|
|
41
|
+
"platform",
|
|
42
|
+
"ai",
|
|
37
43
|
"human-ai-collaboration",
|
|
38
44
|
"organization",
|
|
39
45
|
"processes",
|
|
40
46
|
"departments",
|
|
41
|
-
"roles"
|
|
47
|
+
"roles",
|
|
48
|
+
"entities",
|
|
49
|
+
"nouns"
|
|
42
50
|
],
|
|
51
|
+
"author": "Startups.Studio",
|
|
43
52
|
"license": "MIT",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "https://github.com/StartupsStudio/db.sb",
|
|
56
|
+
"directory": "packages/business-as-code"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://business-as.code",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/StartupsStudio/db.sb/issues"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"db.sb": "workspace:^",
|
|
64
|
+
"yaml": "^2.7.0"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/node": "^22.0.0",
|
|
68
|
+
"tsup": "^8.0.0",
|
|
69
|
+
"typescript": "^5.5.0",
|
|
70
|
+
"vitest": "~3.2.0"
|
|
71
|
+
},
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=18"
|
|
48
74
|
}
|
|
49
|
-
}
|
|
75
|
+
}
|
package/TODO.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# business-as-code Implementation TODO
|
|
2
|
-
|
|
3
|
-
## Current Implementation Status
|
|
4
|
-
|
|
5
|
-
- [x] Created package structure
|
|
6
|
-
- [x] Implemented package.json with basic configuration
|
|
7
|
-
- [x] Implemented tsup.config.ts for build configuration
|
|
8
|
-
- [x] Implemented tsconfig.json
|
|
9
|
-
- [x] Created types.ts with BusinessConfig interface
|
|
10
|
-
- [x] Implemented Business function in index.ts
|
|
11
|
-
- [x] Created comprehensive README.md
|
|
12
|
-
- [ ] Implement actual dependencies for human-AI collaboration
|
|
13
|
-
- [ ] Test integration with other packages
|
|
14
|
-
|
|
15
|
-
## Technical Challenges and Blockers
|
|
16
|
-
|
|
17
|
-
- The package currently uses placeholder types for `Agent`, `Human`, and `Workflow` since the actual dependencies (`agents.do`, `humans.do`, `workflows.do`) don't exist yet
|
|
18
|
-
- Need to implement or find suitable replacements for these dependencies
|
|
19
|
-
- The Business function implementation is a proof of concept and needs to be expanded with actual functionality
|
|
20
|
-
|
|
21
|
-
## Verification Requirements
|
|
22
|
-
|
|
23
|
-
- Ensure the package builds correctly
|
|
24
|
-
- Verify TypeScript types are generated correctly
|
|
25
|
-
- Test integration with other packages when dependencies are available
|
|
26
|
-
|
|
27
|
-
## Next Steps
|
|
28
|
-
|
|
29
|
-
- Replace placeholder types with actual implementations when dependencies are available
|
|
30
|
-
- Expand the Business function with more comprehensive features
|
|
31
|
-
- Add tests for the Business function
|
|
32
|
-
- Integrate with existing systems and workflows
|
package/src/index.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Agent, Human, Workflow } from './types'
|
|
2
|
-
import { BusinessConfig, BusinessInstance, PermissionLevel, Task, BusinessEvent } from './types'
|
|
3
|
-
|
|
4
|
-
export { Agent, Human, Workflow }
|
|
5
|
-
export type { BusinessConfig, BusinessInstance, PermissionLevel, Task, BusinessEvent }
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Creates a business representation for human-AI collaboration
|
|
9
|
-
*
|
|
10
|
-
* @param config The business configuration
|
|
11
|
-
* @returns A business instance with methods for event handling, scheduling, and task management
|
|
12
|
-
*/
|
|
13
|
-
export function Business(config: BusinessConfig): BusinessInstance {
|
|
14
|
-
const eventHandlers: Record<string, Function[]> = {}
|
|
15
|
-
|
|
16
|
-
const scheduledOperations: Record<string, Function[]> = {}
|
|
17
|
-
|
|
18
|
-
const tasks: Task[] = []
|
|
19
|
-
|
|
20
|
-
const metrics: Record<string, any[]> = {}
|
|
21
|
-
|
|
22
|
-
const business: BusinessInstance = {
|
|
23
|
-
...config,
|
|
24
|
-
|
|
25
|
-
on: (event: string, handler: Function) => {
|
|
26
|
-
if (!eventHandlers[event]) {
|
|
27
|
-
eventHandlers[event] = []
|
|
28
|
-
}
|
|
29
|
-
eventHandlers[event].push(handler)
|
|
30
|
-
|
|
31
|
-
return business // For chaining
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
every: (schedule: string, operation: Function) => {
|
|
35
|
-
if (!scheduledOperations[schedule]) {
|
|
36
|
-
scheduledOperations[schedule] = []
|
|
37
|
-
}
|
|
38
|
-
scheduledOperations[schedule].push(operation)
|
|
39
|
-
|
|
40
|
-
return business // For chaining
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
assign: (taskTitle: string, to: Human | Agent) => {
|
|
44
|
-
const task: Task = {
|
|
45
|
-
id: `task_${Date.now()}`,
|
|
46
|
-
title: taskTitle,
|
|
47
|
-
assignee: to,
|
|
48
|
-
status: 'pending',
|
|
49
|
-
timestamp: new Date(),
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
tasks.push(task)
|
|
53
|
-
|
|
54
|
-
if (to instanceof Agent) {
|
|
55
|
-
task.status = 'in_progress'
|
|
56
|
-
} else {
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return task // Return task for reference
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
track: (metric: string, value: any) => {
|
|
63
|
-
if (!metrics[metric]) {
|
|
64
|
-
metrics[metric] = []
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
metrics[metric].push({
|
|
68
|
-
value,
|
|
69
|
-
timestamp: new Date(),
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
return business // For chaining
|
|
73
|
-
},
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return business
|
|
77
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export class Agent {}
|
|
2
|
-
export class Human {}
|
|
3
|
-
export class Workflow {}
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Business configuration interface
|
|
7
|
-
*/
|
|
8
|
-
export interface BusinessConfig {
|
|
9
|
-
name: string
|
|
10
|
-
url?: string
|
|
11
|
-
vision?: string
|
|
12
|
-
goals?: Array<{
|
|
13
|
-
objective: string
|
|
14
|
-
keyResults?: string[]
|
|
15
|
-
}>
|
|
16
|
-
roles?: Record<string, Human>
|
|
17
|
-
agents?: Record<string, Agent>
|
|
18
|
-
departments?: Record<
|
|
19
|
-
string,
|
|
20
|
-
{
|
|
21
|
-
name: string
|
|
22
|
-
lead: Human | Agent
|
|
23
|
-
members?: Array<Human | Agent>
|
|
24
|
-
}
|
|
25
|
-
>
|
|
26
|
-
processes?: Record<string, Workflow>
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Business instance returned by the Business function
|
|
31
|
-
*/
|
|
32
|
-
export interface BusinessInstance {
|
|
33
|
-
name: string
|
|
34
|
-
url?: string
|
|
35
|
-
vision?: string
|
|
36
|
-
goals?: Array<{
|
|
37
|
-
objective: string
|
|
38
|
-
keyResults?: string[]
|
|
39
|
-
}>
|
|
40
|
-
roles?: Record<string, Human>
|
|
41
|
-
agents?: Record<string, Agent>
|
|
42
|
-
departments?: Record<
|
|
43
|
-
string,
|
|
44
|
-
{
|
|
45
|
-
name: string
|
|
46
|
-
lead: Human | Agent
|
|
47
|
-
members?: Array<Human | Agent>
|
|
48
|
-
}
|
|
49
|
-
>
|
|
50
|
-
processes?: Record<string, Workflow>
|
|
51
|
-
|
|
52
|
-
on: (event: string, handler: Function) => void
|
|
53
|
-
|
|
54
|
-
every: (schedule: string, operation: Function) => void
|
|
55
|
-
|
|
56
|
-
assign: (task: string, to: Human | Agent) => void
|
|
57
|
-
|
|
58
|
-
track: (metric: string, value: any) => void
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Permission level enum for human-AI collaboration
|
|
63
|
-
*/
|
|
64
|
-
export enum PermissionLevel {
|
|
65
|
-
VIEW = 'view',
|
|
66
|
-
SUGGEST = 'suggest',
|
|
67
|
-
EXECUTE = 'execute',
|
|
68
|
-
APPROVE = 'approve',
|
|
69
|
-
ADMIN = 'admin',
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Task assignment interface
|
|
74
|
-
*/
|
|
75
|
-
export interface Task {
|
|
76
|
-
id: string
|
|
77
|
-
title: string
|
|
78
|
-
description?: string
|
|
79
|
-
assignee?: Human | Agent
|
|
80
|
-
dueDate?: Date
|
|
81
|
-
status?: 'pending' | 'in_progress' | 'completed' | 'blocked'
|
|
82
|
-
priority?: 'low' | 'medium' | 'high' | 'critical'
|
|
83
|
-
requiredPermission?: PermissionLevel
|
|
84
|
-
dependencies?: string[]
|
|
85
|
-
timestamp?: Date
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Event interface for business events
|
|
90
|
-
*/
|
|
91
|
-
export interface BusinessEvent {
|
|
92
|
-
type: string
|
|
93
|
-
data: any
|
|
94
|
-
source?: string
|
|
95
|
-
timestamp: Date
|
|
96
|
-
requiredApproval?: Human[]
|
|
97
|
-
}
|
package/tsconfig.json
DELETED
package/tsup.config.ts
DELETED