@org.ai/types
v2.4.0
Published
Shared type definitions for AI primitives packages
Readme
@org.ai/types
Foundation type definitions for the AI primitives ecosystem.
Note for Consumers: This is an internal foundation package. For application development, use
org.aiinstead, which re-exports all types from this package plus additional organizational types (Role, Team, Goal, KPI, OKR).
Package Relationship
@org.ai/types (foundation - internal)
└── Provides base types used by all packages
org.ai (consumer-facing)
├── Re-exports ALL of @org.ai/types
└── Adds organizational types (Role, Team, Goal, KPI, OKR)
Consumers should:
import { Thing, Agent, Role, Team } from 'org.ai' // Correct
NOT:
import { Thing, Agent } from '@org.ai/types' // Internal use onlyWhen to Use This Package
- Internal packages in the monorepo that need foundation types
- Building new packages that extend the type system
For application development, always use org.ai:
// Recommended for applications
import type { Thing, Agent, Human, Role, Team, Goal } from 'org.ai'Foundation Types
This package provides the core type definitions:
Entity Types
Thing,ThingDO- Base entity types with URL-based identityThings,ThingsDO,Collection- Collection typesNoun,Verb,StandardVerbs- Schema types
Worker Types
WorkerType- Base worker interfaceAgentType- AI agent with model, autonomy settingsHumanType- Human worker with role, department, availability
Event Types (5W+H)
Event- Full event with all dimensionsEventWhat,EventWho,EventWhen,EventWhere,EventWhy,EventHow
Tool Types
ToolType- Tool definitionToolParameterType,ToolInputType,ToolOutputTypeExecutableToolType,ValidatableToolTypeToolsType,ToolboxType
Business Framework Types
LeanCanvasType- 9-box business model canvasStoryBrandType- 7-part narrative frameworkFounderType- Founding team memberStartupType- Startup with lifecycle stagesICPType- Ideal Customer Profile
Utility Types
AIFunctionType<TOutput, TInput, TConfig>- Generic AI functionEventHandlerType<TOutput, TInput>- Workflow event handlersWorkflowContextType- Workflow execution contextRelationshipOperatorType- Database relationship operatorsParsedFieldType- Schema field definitionsListOptions,ListResult,PaginationInfo- Pagination types
Type Guards
isWorker,isAgent,isHumanisTool,isToolParameter,isToolExecutionResultisStartup,isICPisLeanCanvas,isStoryBrand,isFounder
Factory Functions
createAgent(opts)- Create an AI agentcreateHuman(opts)- Create a human worker
Installation (for internal packages)
pnpm add @org.ai/typesUsage (for internal packages)
import type {
Thing,
AgentType,
HumanType,
WorkflowContextType,
} from '@org.ai/types'
import { isAgent, createAgent } from '@org.ai/types'Type Reference
| Type | Purpose |
|------|---------|
| AIFunctionType<TOutput, TInput, TConfig> | Generic AI function with output-first parameter order |
| EventHandlerType<TOutput, TInput> | Workflow event handlers with typed context |
| WorkflowContextType | The $ workflow proxy with send, try, do, on, every |
| RelationshipOperatorType | Database relationship operators (->, ~>, <-, <~) |
| ParsedFieldType | Schema field definitions with relationship metadata |
Why Output-First Generics?
Just like Promise<T> puts the important part first, AIFunctionType<TOutput> leads with what matters most:
// Natural reading order: "an AI function that returns a Summary"
type Summarizer = AIFunctionType<Summary>
// vs the awkward alternative
type Summarizer = AIFunctionType<Document, Summary> // Wait, which is which?License
MIT
