Shared types for the @dotdo ecosystem and *.do packages
npm install @dotdo/types
The universal shared type system for the .do ecosystem — enabling Business-as-Code and Services-as-Software.
The .do platform enables every aspect of a business to be defined, configured, and operated as code. Traditional services that require humans (accounting, legal, sales, support, HR) are delivered as software through typed, composable, autonomous agents.
```
.org.ai (think) → Ontologies & abstractions for the AI-native future
.as (define) → Typed interface definitions & schemas
.do (execute) → Infrastructure & platform for Business-as-Code
.studio (create) → AI-operated startups studio built on .do
This package provides the TypeScript types, interfaces, and runtime constants that power the entire stack — from semantic primitives to autonomous startup creation.
`bash`
pnpm add @dotdo/types
`typescript
// Import core primitives
import type { Thing, Noun, Verb, Event, Action } from '@dotdo/types/things'
// Import platform primitives
import type { Fn, CodeFunction, GenerativeFunction } from '@dotdo/types/functions'
import type { Workflow } from '@dotdo/types/workflows'
import type { Database, Collection } from '@dotdo/types/database'
// Import high-level business abstractions
import type { Business } from '@dotdo/types/businesses'
import type { Startup } from '@dotdo/types/startups'
import type { SaaS, Tenant } from '@dotdo/types/saas'
import type { Service } from '@dotdo/types/services'
import type { Product } from '@dotdo/types/products'
import type { App } from '@dotdo/types/apps'
import type { API } from '@dotdo/types/apis'
import type { SDK } from '@dotdo/types/sdk'
// Import agent types
import type { Agent, AgentConfig } from '@dotdo/types/agents'
import type { Role } from '@dotdo/types/roles'
import type { Team } from '@dotdo/types/teams'
// Import runtime context
import type { DOContext } from '@dotdo/types/context'
// Runtime constants - discover domains, relationships, definitions
import { domains, relationships, definitions } from '@dotdo/types/domains'
`
The type system follows a layered hierarchy from ontological primitives up to autonomous business creation:
The semantic foundation everything builds on. Based on six universal primitives from .org.ai:
| Primitive | Purpose | Example |
|-----------|---------|---------|
| Thing | Universal base type | Any entity in the system |
| Noun | Entity/object definitions | Customer, Product, Invoice |
| Verb | Operation/action definitions | Create, Process, Deploy |
| Event | Immutable occurrence records | OrderPlaced, PaymentReceived |
| Action | Discrete executable operations | SendEmail, ChargeCard |
| Domain | Namespace/context boundaries | Finance, Engineering, Sales |
Plus: Properties, Relationships, Cascade operators (->, ~>, <-, <~), Identity ($id), Semantics ($type, $context, JSON-LD/MDXLD).
The .do infrastructure that makes everything executable:
| Module | Domain | Purpose |
|--------|--------|---------|
| functions/ | functions.do | Computation (Code, Generative, Agentic, Human) |workflows/
| | workflows.do | Orchestration, scheduling, state machines |database/
| | database.do | Persistence (Relational, Document, Graph, Analytics) |events/
| | events.do | Reactivity, triggers, webhooks |rpc/
| | rpc.do | Communication, transports, proxying |auth/
| | oauth.do | Identity, OAuth, keys, RBAC, FGA |workers/
| | workers.do | Runtime (Durable Objects, colo, sandboxing) |context/
| | context.do | The unified $ runtime object |
| Module | Domain | Purpose |
|--------|--------|---------|
| ai/ | llm.do | LLM completion & streaming |
| | embeddings.do | Vector embeddings |
| | vectors.do | Similarity search |
| | models.do | Model registry |
| | evals.do | Evaluation & benchmarks |
| Module | Domain | Purpose |
|--------|--------|---------|
| agents/ | agents.do | Agent definitions, tools, memory |roles/
| | roles.do | Executive (CTO, CMO), IC (SWE, BDR) |teams/
| | teams.do | Agent composition (devs.do, engineers.do) |
| Module | Domain | Purpose |
|--------|--------|---------|
| apis/ | apis.do | API definitions, REST, MCP, discovery |sdk/
| | sdk.do, cli.do | SDK generation, CLI commands |apps/
| | apps.as | Applications, dashboards |services/
| | services.do | Services-as-Software |products/
| | products.do | Product definitions, roadmaps |sites/
| | sites.do | Web presence, blogs, directories |
| Module | Domain | Purpose |
|--------|--------|---------|
| businesses/ | businesses.do | Business entities, accounting, financials |startups/
| | startups.do | Startup formation, fundraising, validation |saas/
| | saas.as | Multi-tenancy, plans, usage metering |payments/
| | payments.do | Charges, accounts, cards, treasury |communications/
| | calls.do, texts.do, emails.do | Voice, SMS, email, messaging |
| Module | Domain | Purpose |
|--------|--------|---------|
| content/ | mdx.do, blogs.do | MDX/MDXLD, media, publishing, generation |
| Module | Domain | Purpose |
|--------|--------|---------|
| integrations/ | *.do | Database, platform, payment, messaging integrations |
| Module | Domain | Purpose |
|--------|--------|---------|
| builder/ | startups.studio | Factory for creating new businesses/products/services |
| Module | Purpose |
|--------|---------|
| domains/ | Runtime constants: domain registry, relationships, .as definitions |
The .do ecosystem contains 300+ domains organized by category:
- Agents (~85) — Named AI workers (priya.do, tom.do, sally.do, mark.do...)
- Roles (~15) — Job functions (cto.do, cmo.do, swe.do, devs.do...)
- Primitives (~50) — Core platform (functions.do, workflows.do, database.do, events.do...)
- Business (~25) — Business-as-Code (payments.do, accounting.do, startups.do...)
- AI (~15) — Intelligence services (llm.do, embeddings.do, vectors.do, evals.do...)
- Content (~20) — Media & publishing (blogs.do, images.do, videos.do, mdx.do...)
- Infrastructure (~20) — Platform infra (browsers.do, tunnels.do, deployments.do...)
- Integrations (~30) — External (postgres.do, stripe.do, cloudflare.do, slack.do...)
- Utilities (~10) — Kits & tools (startupkit.do, agentkit.do, chatkit.do...)
- Definitions/.as (~36) — Interface schemas (agent.as, functions.as, workflows.as...)
`typescript
// .as defines WHAT something must be (interface)
import type { Agent } from '@dotdo/types/agents' // agent.as
// .do defines HOW it works (implementation types)
import type { AgentRuntime } from '@dotdo/types/agents' // agents.do
`
Every .do service has access to a typed runtime context:
`typescript`
interface DOContext {
ai: AIContext // $.ai.generate(), $.ai.embed()
db: DBContext // $.db.collection(), $.db.query()
on: OnContext // $.on.event(), $.on.schedule()
every: EveryContext // $.every.hour(), $.every.day()
email: EmailContext // $.email.send()
slack: SlackContext // $.slack.post()
sms: SMSContext // $.sms.send()
call: CallContext // $.call.start()
pay: PayContext // $.pay.charge(), $.pay.transfer()
}
Functions span from pure code to fully autonomous:
`typescript
// Tier 1: Pure computation
const add: CodeFunction
// Tier 2: AI-powered generation
const summarize: GenerativeFunction
// Tier 3: Multi-step agent reasoning
const research: AgenticFunction
// Tier 4: Human-in-the-loop
const approve: HumanFunction
`
Every business operation is typed and composable:
`typescript
import type { Business, Startup, SaaS } from '@dotdo/types'
// A startup is a typed business entity
const myStartup: Startup = {
name: 'Acme',
stage: 'seed',
hypothesis: 'SMBs need automated invoicing',
team: ['priya.do', 'tom.do', 'sally.do'],
products: [invoiceApp],
metrics: { mrr: 0, customers: 0 }
}
`
Traditional services delivered through autonomous agents:
`typescript
// sally.do - Sales agent
const sally: Agent = {
role: 'sales',
capabilities: ['prospect', 'qualify', 'close'],
tools: ['emails.do', 'calls.do', 'crm'],
autonomy: 'SemiAutonomous'
}
// accounting.do - Accounting service
const accounting: Service = {
type: 'financial',
capabilities: ['JournalEntries', 'FinancialReports', 'Reconciliation'],
requires: ['payments.do', 'llm.do']
}
`
Agents can create new businesses, products, and services:
`typescript
import type { StartupFactory, Template } from '@dotdo/types/builder'
// An agent creating a new startup
const factory: StartupFactory = {
template: 'saas',
config: {
name: 'InvoiceBot',
product: { type: 'app', framework: 'next' },
services: ['payments.do', 'emails.do'],
agents: ['priya.do', 'tom.do', 'sally.do'],
infrastructure: { database: 'postgres', hosting: 'cloudflare' }
}
}
`
Types include relationship semantics for knowledge graphs:
| Category | Predicates |
|----------|-----------|
| Taxonomic | isA, instanceOf, subtypeOf, typeOf |partOf
| Compositional | , memberOf, belongsTo, owns |uses
| Dependency | , requires, enables, dependsOn |extends
| Structural | , implements, inheritsFrom |wraps
| Integration | , integrates, connectsTo |synonymOf
| Semantic | , relatedTo, antonymOf |provides
| Capability | , exposes |brandedAs
| Branding | , aliasOf |
This package supports TypeScript 5.0 and later. CI tests against multiple TypeScript versions:
| TypeScript Version | Status | Notes |
|-------------------|--------|-------|
| 5.0.x | Supported | Minimum supported version |
| 5.4.x | Supported | Stable LTS |
| 5.7.x | Supported | Latest features |
- TypeScript 5.0+: Required for verbatimModuleSyntax and modern moduleResolution: bundlerNoInfer
- TypeScript 5.4+: Improved utility type, better generic inference
- TypeScript 5.7+: Latest type system improvements
Run type checks against all supported versions:
`bash`
pnpm test:ts-compat
This will install and test TypeScript 5.0, 5.4, and 5.7 in sequence.
This repository uses a doctest system that validates all @example blocks in JSDoc comments. Every documented example is automatically tested to ensure documentation stays accurate.
`bashRun all doctest examples
pnpm test:e2e
See tests/e2e/README.md for more details.
Contributing
This package is the foundation of the entire
.do` ecosystem. Changes here affect every service, agent, and application in the platform.MIT