societyai 0.0.1

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.
Files changed (114) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/LICENSE +21 -0
  3. package/README.md +879 -0
  4. package/dist/builder.d.ts +181 -0
  5. package/dist/builder.d.ts.map +1 -0
  6. package/dist/builder.js +667 -0
  7. package/dist/builder.js.map +1 -0
  8. package/dist/config.d.ts +43 -0
  9. package/dist/config.d.ts.map +1 -0
  10. package/dist/config.js +11 -0
  11. package/dist/config.js.map +1 -0
  12. package/dist/context.d.ts +107 -0
  13. package/dist/context.d.ts.map +1 -0
  14. package/dist/context.js +319 -0
  15. package/dist/context.js.map +1 -0
  16. package/dist/errors.d.ts +31 -0
  17. package/dist/errors.d.ts.map +1 -0
  18. package/dist/errors.js +85 -0
  19. package/dist/errors.js.map +1 -0
  20. package/dist/events.d.ts +219 -0
  21. package/dist/events.d.ts.map +1 -0
  22. package/dist/events.js +395 -0
  23. package/dist/events.js.map +1 -0
  24. package/dist/graph.d.ts +104 -0
  25. package/dist/graph.d.ts.map +1 -0
  26. package/dist/graph.js +366 -0
  27. package/dist/graph.js.map +1 -0
  28. package/dist/index.d.ts +28 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +113 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/logger.d.ts +13 -0
  33. package/dist/logger.d.ts.map +1 -0
  34. package/dist/logger.js +78 -0
  35. package/dist/logger.js.map +1 -0
  36. package/dist/memory.d.ts +146 -0
  37. package/dist/memory.d.ts.map +1 -0
  38. package/dist/memory.js +353 -0
  39. package/dist/memory.js.map +1 -0
  40. package/dist/metrics.d.ts +143 -0
  41. package/dist/metrics.d.ts.map +1 -0
  42. package/dist/metrics.js +271 -0
  43. package/dist/metrics.js.map +1 -0
  44. package/dist/middleware.d.ts +147 -0
  45. package/dist/middleware.d.ts.map +1 -0
  46. package/dist/middleware.js +484 -0
  47. package/dist/middleware.js.map +1 -0
  48. package/dist/models.d.ts +32 -0
  49. package/dist/models.d.ts.map +1 -0
  50. package/dist/models.js +211 -0
  51. package/dist/models.js.map +1 -0
  52. package/dist/patterns.d.ts +6 -0
  53. package/dist/patterns.d.ts.map +1 -0
  54. package/dist/patterns.js +68 -0
  55. package/dist/patterns.js.map +1 -0
  56. package/dist/pipeline.d.ts +84 -0
  57. package/dist/pipeline.d.ts.map +1 -0
  58. package/dist/pipeline.js +569 -0
  59. package/dist/pipeline.js.map +1 -0
  60. package/dist/retry.d.ts +5 -0
  61. package/dist/retry.d.ts.map +1 -0
  62. package/dist/retry.js +70 -0
  63. package/dist/retry.js.map +1 -0
  64. package/dist/society.d.ts +94 -0
  65. package/dist/society.d.ts.map +1 -0
  66. package/dist/society.js +721 -0
  67. package/dist/society.js.map +1 -0
  68. package/dist/strategies.d.ts +55 -0
  69. package/dist/strategies.d.ts.map +1 -0
  70. package/dist/strategies.js +678 -0
  71. package/dist/strategies.js.map +1 -0
  72. package/dist/tools.d.ts +88 -0
  73. package/dist/tools.d.ts.map +1 -0
  74. package/dist/tools.js +366 -0
  75. package/dist/tools.js.map +1 -0
  76. package/dist/types.d.ts +213 -0
  77. package/dist/types.d.ts.map +1 -0
  78. package/dist/types.js +19 -0
  79. package/dist/types.js.map +1 -0
  80. package/dist/validation.d.ts +64 -0
  81. package/dist/validation.d.ts.map +1 -0
  82. package/dist/validation.js +334 -0
  83. package/dist/validation.js.map +1 -0
  84. package/dist/worker-pool.d.ts +17 -0
  85. package/dist/worker-pool.d.ts.map +1 -0
  86. package/dist/worker-pool.js +80 -0
  87. package/dist/worker-pool.js.map +1 -0
  88. package/docs/README.md +468 -0
  89. package/docs/advanced.md +616 -0
  90. package/docs/aggregation-strategies.md +926 -0
  91. package/docs/api-reference.md +771 -0
  92. package/docs/architecture.md +648 -0
  93. package/docs/context-system.md +642 -0
  94. package/docs/event-system.md +1047 -0
  95. package/docs/examples.md +576 -0
  96. package/docs/getting-started.md +564 -0
  97. package/docs/graph-execution.md +389 -0
  98. package/docs/memory-system.md +497 -0
  99. package/docs/metrics-observability.md +560 -0
  100. package/docs/middleware-system.md +1038 -0
  101. package/docs/migration.md +296 -0
  102. package/docs/pipeline-patterns.md +761 -0
  103. package/docs/structured-output.md +612 -0
  104. package/docs/tool-calling.md +491 -0
  105. package/docs/workflows.md +740 -0
  106. package/examples/README.md +234 -0
  107. package/examples/advanced-patterns.ts +115 -0
  108. package/examples/complete-integration.ts +327 -0
  109. package/examples/graph-workflow.ts +161 -0
  110. package/examples/memory-system.ts +155 -0
  111. package/examples/metrics-tracking.ts +243 -0
  112. package/examples/structured-output.ts +231 -0
  113. package/examples/tool-calling.ts +163 -0
  114. package/package.json +94 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,111 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.0.1] - 2026-02-01
11
+
12
+ ### Initial Release
13
+
14
+ This is the initial pre-release version of SocietyAI.
15
+
16
+ ### Added - Major Features (Phase 1-3)
17
+
18
+ #### ๐ŸŽฏ Phase 1: Unified Execution Engine
19
+
20
+ - **SocietyGraph** - Graph-based execution engine with DAG/Cyclic support
21
+ - 8 node types: START, END, AGENT, PARALLEL, AGGREGATE, CONDITION, TRANSFORM, LOOP
22
+ - Conditional branching and dynamic routing
23
+ - Loop support with termination conditions
24
+ - Parallel execution optimization via WorkerPool
25
+ - Graph visualization for debugging
26
+ - **Streaming Support** - Added `stream()` method to AIModel interface for real-time output
27
+ - **GraphBuilder** - Fluent API for constructing complex execution graphs
28
+
29
+ #### ๐Ÿ› ๏ธ Phase 2: Agent Capabilities
30
+
31
+ - **Tool Calling System** - Enable agents to interact with external functions
32
+ - ToolRegistry for centralized tool management
33
+ - ToolExecutor with automatic retry loop
34
+ - JSON Schema validation for parameters
35
+ - BuiltInTools: calculator, stringManipulation, storage
36
+ - Parallel tool execution support
37
+ - **Multi-Level Memory System** - Intelligent context management
38
+ - ShortTermMemory with auto-summarization and decay
39
+ - LongTermMemory with semantic search (RAG) support
40
+ - EntityMemory for tracking entities and facts
41
+ - MemorySystem unified interface
42
+ - Importance scoring and time-based decay
43
+
44
+ #### ๐ŸŽฏ Phase 3: Production Robustness
45
+
46
+ - **Structured Output Validation** - Ensure AI outputs conform to schemas
47
+ - JSON Schema validation with automatic retry
48
+ - Error feedback loop for self-correction
49
+ - Support for complex nested objects, arrays, patterns
50
+ - Helper functions: validateJSON(), createSchema()
51
+ - **Comprehensive Metrics & Observability** - Track performance and costs
52
+ - MetricsTracker for workflow execution tracking
53
+ - TokenCounter with estimation (~4 chars/token)
54
+ - Cost calculation for major models (GPT-4, Claude, etc.)
55
+ - PerformanceProfiler with mark/measure API
56
+ - OpenTelemetry export format support
57
+ - Custom metrics support
58
+
59
+ ### Added - Examples & Documentation
60
+
61
+ - ๐Ÿ“š 6 comprehensive examples demonstrating all new features:
62
+ - graph-workflow.ts - Complex workflows with conditional logic
63
+ - tool-calling.ts - Agent function calling
64
+ - memory-system.ts - Multi-level context management
65
+ - structured-output.ts - Output validation with retry
66
+ - metrics-tracking.ts - Performance and cost tracking
67
+ - complete-integration.ts - Full integration example
68
+ - ๐Ÿ“– examples/README.md with setup instructions and troubleshooting
69
+
70
+ ### Added - Testing
71
+
72
+ - โœ… 5 new test suites with 100+ test cases:
73
+ - graph.test.ts - Graph execution engine tests
74
+ - tools.test.ts - Tool calling system tests
75
+ - memory.test.ts - Memory system tests (30+ cases)
76
+ - validation.test.ts - Validation tests (25+ cases)
77
+ - metrics.test.ts - Metrics tracking tests (20+ cases)
78
+ - Total: 138 tests across 10 test suites
79
+
80
+ ### Changed
81
+
82
+ - Updated exports in index.ts to include all new modules
83
+ - Improved tool extraction logic to handle JSON outputs correctly
84
+
85
+ ## [0.0.1] - Unreleased
86
+
87
+ First public pre-release.
88
+
89
+ ### Added
90
+
91
+ - ๐ŸŽ‰ Initial release of SocietyAI โ€“ TypeScript multi-agent orchestration framework
92
+ - ๐Ÿค– Multi-agent execution patterns: sequential, parallel, collaborative, conditional
93
+ - ๐Ÿงฑ Workflow configuration builders: `RoleBuilder`, `AgentBuilder`, `StepBuilder`, `WorkflowConfigBuilder`
94
+ - ๐Ÿ—๏ธ Fluent Society builder (`Society.create()`) with pipeline helpers (`Pipelines`, `Strategies`)
95
+ - ๐Ÿ”Œ Model abstraction via `StandardModelBase` and adapter-style integrations
96
+ - โšก Worker pool for parallel execution
97
+ - ๐Ÿ”„ Retry with exponential backoff and jitter (`RetryExecutor`)
98
+ - โฑ๏ธ Cancellation/timeouts via `AbortSignal`
99
+ - ๐Ÿ“Š Logging + observer hooks for lifecycle monitoring
100
+ - ๐Ÿ”Œ Middleware system for models and workflow steps
101
+ - ๐Ÿ“š Full documentation and API reference in `docs/`
102
+ - ๐Ÿงช Jest test suite (49 tests)
103
+
104
+ ### Removed
105
+
106
+ - Legacy function-based API (`society()`, `societyCollaborative()`, `runSociety*()`, etc.) โ€“ use the workflow/builder API instead.
107
+
108
+ ### Fixed
109
+
110
+ - Documentation language consistency
111
+ - Builder API exports (`createRole()`, `createAgent()` helpers exposed)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SocietyAI Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.