business-as-code 0.2.1 → 2.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 (190) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +9 -0
  3. package/IMPLEMENTATION.md +226 -0
  4. package/README.md +1133 -193
  5. package/dist/business.d.ts +62 -0
  6. package/dist/business.d.ts.map +1 -0
  7. package/dist/business.js +109 -0
  8. package/dist/business.js.map +1 -0
  9. package/dist/dollar.d.ts +60 -0
  10. package/dist/dollar.d.ts.map +1 -0
  11. package/dist/dollar.js +107 -0
  12. package/dist/dollar.js.map +1 -0
  13. package/dist/entities/assets.d.ts +21 -0
  14. package/dist/entities/assets.d.ts.map +1 -0
  15. package/dist/entities/assets.js +323 -0
  16. package/dist/entities/assets.js.map +1 -0
  17. package/dist/entities/business.d.ts +36 -0
  18. package/dist/entities/business.d.ts.map +1 -0
  19. package/dist/entities/business.js +370 -0
  20. package/dist/entities/business.js.map +1 -0
  21. package/dist/entities/communication.d.ts +21 -0
  22. package/dist/entities/communication.d.ts.map +1 -0
  23. package/dist/entities/communication.js +255 -0
  24. package/dist/entities/communication.js.map +1 -0
  25. package/dist/entities/customers.d.ts +58 -0
  26. package/dist/entities/customers.d.ts.map +1 -0
  27. package/dist/entities/customers.js +989 -0
  28. package/dist/entities/customers.js.map +1 -0
  29. package/dist/entities/financials.d.ts +59 -0
  30. package/dist/entities/financials.d.ts.map +1 -0
  31. package/dist/entities/financials.js +932 -0
  32. package/dist/entities/financials.js.map +1 -0
  33. package/dist/entities/goals.d.ts +58 -0
  34. package/dist/entities/goals.d.ts.map +1 -0
  35. package/dist/entities/goals.js +800 -0
  36. package/dist/entities/goals.js.map +1 -0
  37. package/dist/entities/index.d.ts +299 -0
  38. package/dist/entities/index.d.ts.map +1 -0
  39. package/dist/entities/index.js +198 -0
  40. package/dist/entities/index.js.map +1 -0
  41. package/dist/entities/legal.d.ts +21 -0
  42. package/dist/entities/legal.d.ts.map +1 -0
  43. package/dist/entities/legal.js +301 -0
  44. package/dist/entities/legal.js.map +1 -0
  45. package/dist/entities/market.d.ts +21 -0
  46. package/dist/entities/market.d.ts.map +1 -0
  47. package/dist/entities/market.js +301 -0
  48. package/dist/entities/market.js.map +1 -0
  49. package/dist/entities/marketing.d.ts +67 -0
  50. package/dist/entities/marketing.d.ts.map +1 -0
  51. package/dist/entities/marketing.js +1157 -0
  52. package/dist/entities/marketing.js.map +1 -0
  53. package/dist/entities/offerings.d.ts +51 -0
  54. package/dist/entities/offerings.d.ts.map +1 -0
  55. package/dist/entities/offerings.js +727 -0
  56. package/dist/entities/offerings.js.map +1 -0
  57. package/dist/entities/operations.d.ts +58 -0
  58. package/dist/entities/operations.d.ts.map +1 -0
  59. package/dist/entities/operations.js +787 -0
  60. package/dist/entities/operations.js.map +1 -0
  61. package/dist/entities/organization.d.ts +57 -0
  62. package/dist/entities/organization.d.ts.map +1 -0
  63. package/dist/entities/organization.js +807 -0
  64. package/dist/entities/organization.js.map +1 -0
  65. package/dist/entities/partnerships.d.ts +21 -0
  66. package/dist/entities/partnerships.d.ts.map +1 -0
  67. package/dist/entities/partnerships.js +300 -0
  68. package/dist/entities/partnerships.js.map +1 -0
  69. package/dist/entities/planning.d.ts +87 -0
  70. package/dist/entities/planning.d.ts.map +1 -0
  71. package/dist/entities/planning.js +271 -0
  72. package/dist/entities/planning.js.map +1 -0
  73. package/dist/entities/projects.d.ts +25 -0
  74. package/dist/entities/projects.d.ts.map +1 -0
  75. package/dist/entities/projects.js +349 -0
  76. package/dist/entities/projects.js.map +1 -0
  77. package/dist/entities/risk.d.ts +21 -0
  78. package/dist/entities/risk.d.ts.map +1 -0
  79. package/dist/entities/risk.js +293 -0
  80. package/dist/entities/risk.js.map +1 -0
  81. package/dist/entities/sales.d.ts +72 -0
  82. package/dist/entities/sales.d.ts.map +1 -0
  83. package/dist/entities/sales.js +1248 -0
  84. package/dist/entities/sales.js.map +1 -0
  85. package/dist/financials.d.ts +130 -0
  86. package/dist/financials.d.ts.map +1 -0
  87. package/dist/financials.js +297 -0
  88. package/dist/financials.js.map +1 -0
  89. package/dist/goals.d.ts +87 -0
  90. package/dist/goals.d.ts.map +1 -0
  91. package/dist/goals.js +215 -0
  92. package/dist/goals.js.map +1 -0
  93. package/dist/index.d.ts +97 -4
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +131 -1079
  96. package/dist/index.js.map +1 -1
  97. package/dist/kpis.d.ts +118 -0
  98. package/dist/kpis.d.ts.map +1 -0
  99. package/dist/kpis.js +232 -0
  100. package/dist/kpis.js.map +1 -0
  101. package/dist/metrics.d.ts +448 -0
  102. package/dist/metrics.d.ts.map +1 -0
  103. package/dist/metrics.js +325 -0
  104. package/dist/metrics.js.map +1 -0
  105. package/dist/okrs.d.ts +123 -0
  106. package/dist/okrs.d.ts.map +1 -0
  107. package/dist/okrs.js +269 -0
  108. package/dist/okrs.js.map +1 -0
  109. package/dist/organization.d.ts +585 -0
  110. package/dist/organization.d.ts.map +1 -0
  111. package/dist/organization.js +173 -0
  112. package/dist/organization.js.map +1 -0
  113. package/dist/process.d.ts +112 -0
  114. package/dist/process.d.ts.map +1 -0
  115. package/dist/process.js +241 -0
  116. package/dist/process.js.map +1 -0
  117. package/dist/product.d.ts +85 -0
  118. package/dist/product.d.ts.map +1 -0
  119. package/dist/product.js +145 -0
  120. package/dist/product.js.map +1 -0
  121. package/dist/queries.d.ts +304 -0
  122. package/dist/queries.d.ts.map +1 -0
  123. package/dist/queries.js +415 -0
  124. package/dist/queries.js.map +1 -0
  125. package/dist/roles.d.ts +340 -0
  126. package/dist/roles.d.ts.map +1 -0
  127. package/dist/roles.js +255 -0
  128. package/dist/roles.js.map +1 -0
  129. package/dist/service.d.ts +61 -0
  130. package/dist/service.d.ts.map +1 -0
  131. package/dist/service.js +140 -0
  132. package/dist/service.js.map +1 -0
  133. package/dist/types.d.ts +459 -0
  134. package/dist/types.d.ts.map +1 -0
  135. package/dist/types.js +5 -0
  136. package/dist/types.js.map +1 -0
  137. package/dist/vision.d.ts +38 -0
  138. package/dist/vision.d.ts.map +1 -0
  139. package/dist/vision.js +68 -0
  140. package/dist/vision.js.map +1 -0
  141. package/dist/workflow.d.ts +115 -0
  142. package/dist/workflow.d.ts.map +1 -0
  143. package/dist/workflow.js +247 -0
  144. package/dist/workflow.js.map +1 -0
  145. package/examples/basic-usage.ts +307 -0
  146. package/package.json +19 -60
  147. package/src/business.ts +121 -0
  148. package/src/dollar.ts +132 -0
  149. package/src/entities/assets.ts +332 -0
  150. package/src/entities/business.ts +406 -0
  151. package/src/entities/communication.ts +264 -0
  152. package/src/entities/customers.ts +1072 -0
  153. package/src/entities/financials.ts +1011 -0
  154. package/src/entities/goals.ts +871 -0
  155. package/src/entities/index.ts +383 -0
  156. package/src/entities/legal.ts +310 -0
  157. package/src/entities/market.ts +310 -0
  158. package/src/entities/marketing.ts +1249 -0
  159. package/src/entities/offerings.ts +789 -0
  160. package/src/entities/operations.ts +861 -0
  161. package/src/entities/organization.ts +876 -0
  162. package/src/entities/partnerships.ts +309 -0
  163. package/src/entities/planning.ts +307 -0
  164. package/src/entities/projects.ts +360 -0
  165. package/src/entities/risk.ts +302 -0
  166. package/src/entities/sales.ts +1352 -0
  167. package/src/financials.ts +352 -0
  168. package/src/goals.ts +250 -0
  169. package/src/index.test.ts +336 -0
  170. package/src/index.ts +530 -0
  171. package/src/kpis.ts +275 -0
  172. package/src/metrics.ts +825 -0
  173. package/src/okrs.ts +325 -0
  174. package/src/organization.ts +909 -0
  175. package/src/process.ts +272 -0
  176. package/src/product.ts +178 -0
  177. package/src/queries.ts +767 -0
  178. package/src/roles.ts +686 -0
  179. package/src/service.ts +164 -0
  180. package/src/types.ts +493 -0
  181. package/src/vision.ts +88 -0
  182. package/src/workflow.ts +280 -0
  183. package/tsconfig.json +9 -0
  184. package/dist/loaders/index.d.ts +0 -174
  185. package/dist/loaders/index.js +0 -366
  186. package/dist/loaders/index.js.map +0 -1
  187. package/dist/schema/index.d.ts +0 -146
  188. package/dist/schema/index.js +0 -716
  189. package/dist/schema/index.js.map +0 -1
  190. package/dist/types-CJ9eGS_C.d.ts +0 -86
@@ -0,0 +1,876 @@
1
+ /**
2
+ * Organization Entity Types (Nouns)
3
+ *
4
+ * Organizational hierarchy: Organization, Department, Team, Position, Role.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+
9
+ import type { Noun } from 'ai-database'
10
+
11
+ // =============================================================================
12
+ // Organization
13
+ // =============================================================================
14
+
15
+ /**
16
+ * Organization entity
17
+ *
18
+ * Represents the top-level organizational structure.
19
+ */
20
+ export const Organization: Noun = {
21
+ singular: 'organization',
22
+ plural: 'organizations',
23
+ description: 'The top-level organizational structure',
24
+
25
+ properties: {
26
+ // Identity
27
+ name: {
28
+ type: 'string',
29
+ description: 'Organization name',
30
+ },
31
+ description: {
32
+ type: 'string',
33
+ optional: true,
34
+ description: 'Organization description',
35
+ },
36
+
37
+ // Type
38
+ type: {
39
+ type: 'string',
40
+ optional: true,
41
+ description: 'Organization type',
42
+ examples: ['functional', 'divisional', 'matrix', 'flat', 'holacracy'],
43
+ },
44
+
45
+ // Settings
46
+ fiscalYearStart: {
47
+ type: 'string',
48
+ optional: true,
49
+ description: 'Fiscal year start month (e.g., "January", "April")',
50
+ },
51
+ defaultCurrency: {
52
+ type: 'string',
53
+ optional: true,
54
+ description: 'Default currency code',
55
+ examples: ['USD', 'EUR', 'GBP'],
56
+ },
57
+ defaultTimezone: {
58
+ type: 'string',
59
+ optional: true,
60
+ description: 'Default timezone',
61
+ },
62
+
63
+ // Size
64
+ departmentCount: {
65
+ type: 'number',
66
+ optional: true,
67
+ description: 'Number of departments',
68
+ },
69
+ teamCount: {
70
+ type: 'number',
71
+ optional: true,
72
+ description: 'Number of teams',
73
+ },
74
+ positionCount: {
75
+ type: 'number',
76
+ optional: true,
77
+ description: 'Number of positions',
78
+ },
79
+
80
+ // Status
81
+ status: {
82
+ type: 'string',
83
+ optional: true,
84
+ description: 'Organization status',
85
+ examples: ['active', 'restructuring', 'archived'],
86
+ },
87
+ },
88
+
89
+ relationships: {
90
+ business: {
91
+ type: 'Business',
92
+ description: 'Parent business',
93
+ },
94
+ departments: {
95
+ type: 'Department[]',
96
+ description: 'Departments',
97
+ },
98
+ teams: {
99
+ type: 'Team[]',
100
+ description: 'All teams',
101
+ },
102
+ positions: {
103
+ type: 'Position[]',
104
+ description: 'All positions',
105
+ },
106
+ roles: {
107
+ type: 'Role[]',
108
+ description: 'Defined roles',
109
+ },
110
+ },
111
+
112
+ actions: [
113
+ 'create',
114
+ 'update',
115
+ 'restructure',
116
+ 'merge',
117
+ 'split',
118
+ 'archive',
119
+ ],
120
+
121
+ events: [
122
+ 'created',
123
+ 'updated',
124
+ 'restructured',
125
+ 'merged',
126
+ 'split',
127
+ 'archived',
128
+ ],
129
+ }
130
+
131
+ // =============================================================================
132
+ // Department
133
+ // =============================================================================
134
+
135
+ /**
136
+ * Department entity
137
+ *
138
+ * Represents a functional department or division.
139
+ */
140
+ export const Department: Noun = {
141
+ singular: 'department',
142
+ plural: 'departments',
143
+ description: 'A functional department or division',
144
+
145
+ properties: {
146
+ // Identity
147
+ name: {
148
+ type: 'string',
149
+ description: 'Department name',
150
+ },
151
+ code: {
152
+ type: 'string',
153
+ optional: true,
154
+ description: 'Department code (e.g., "ENG", "MKT")',
155
+ },
156
+ description: {
157
+ type: 'string',
158
+ optional: true,
159
+ description: 'Department description',
160
+ },
161
+
162
+ // Type
163
+ type: {
164
+ type: 'string',
165
+ optional: true,
166
+ description: 'Department type',
167
+ examples: ['engineering', 'product', 'design', 'marketing', 'sales', 'operations', 'finance', 'hr', 'legal', 'support'],
168
+ },
169
+
170
+ // Budget
171
+ budget: {
172
+ type: 'number',
173
+ optional: true,
174
+ description: 'Annual budget',
175
+ },
176
+ budgetCurrency: {
177
+ type: 'string',
178
+ optional: true,
179
+ description: 'Budget currency',
180
+ },
181
+ budgetPeriod: {
182
+ type: 'string',
183
+ optional: true,
184
+ description: 'Budget period',
185
+ examples: ['monthly', 'quarterly', 'yearly'],
186
+ },
187
+
188
+ // Size
189
+ headcount: {
190
+ type: 'number',
191
+ optional: true,
192
+ description: 'Number of employees',
193
+ },
194
+ teamCount: {
195
+ type: 'number',
196
+ optional: true,
197
+ description: 'Number of teams',
198
+ },
199
+
200
+ // Hierarchy
201
+ level: {
202
+ type: 'number',
203
+ optional: true,
204
+ description: 'Organizational level (1 = top)',
205
+ },
206
+
207
+ // Status
208
+ status: {
209
+ type: 'string',
210
+ optional: true,
211
+ description: 'Department status',
212
+ examples: ['active', 'forming', 'restructuring', 'dissolved'],
213
+ },
214
+ },
215
+
216
+ relationships: {
217
+ organization: {
218
+ type: 'Organization',
219
+ description: 'Parent organization',
220
+ },
221
+ parent: {
222
+ type: 'Department',
223
+ required: false,
224
+ description: 'Parent department (for sub-departments)',
225
+ },
226
+ children: {
227
+ type: 'Department[]',
228
+ description: 'Sub-departments',
229
+ },
230
+ head: {
231
+ type: 'Position',
232
+ required: false,
233
+ description: 'Department head position',
234
+ },
235
+ teams: {
236
+ type: 'Team[]',
237
+ description: 'Teams in this department',
238
+ },
239
+ goals: {
240
+ type: 'Goal[]',
241
+ description: 'Department goals',
242
+ },
243
+ budgets: {
244
+ type: 'Budget[]',
245
+ description: 'Budget allocations',
246
+ },
247
+ },
248
+
249
+ actions: [
250
+ 'create',
251
+ 'update',
252
+ 'rename',
253
+ 'setBudget',
254
+ 'addTeam',
255
+ 'removeTeam',
256
+ 'setHead',
257
+ 'merge',
258
+ 'split',
259
+ 'dissolve',
260
+ 'archive',
261
+ ],
262
+
263
+ events: [
264
+ 'created',
265
+ 'updated',
266
+ 'renamed',
267
+ 'budgetSet',
268
+ 'teamAdded',
269
+ 'teamRemoved',
270
+ 'headChanged',
271
+ 'merged',
272
+ 'split',
273
+ 'dissolved',
274
+ 'archived',
275
+ ],
276
+ }
277
+
278
+ // =============================================================================
279
+ // Team
280
+ // =============================================================================
281
+
282
+ /**
283
+ * Team entity
284
+ *
285
+ * Represents a working team within a department.
286
+ */
287
+ export const Team: Noun = {
288
+ singular: 'team',
289
+ plural: 'teams',
290
+ description: 'A working team within a department',
291
+
292
+ properties: {
293
+ // Identity
294
+ name: {
295
+ type: 'string',
296
+ description: 'Team name',
297
+ },
298
+ code: {
299
+ type: 'string',
300
+ optional: true,
301
+ description: 'Team code',
302
+ },
303
+ description: {
304
+ type: 'string',
305
+ optional: true,
306
+ description: 'Team description',
307
+ },
308
+
309
+ // Type
310
+ type: {
311
+ type: 'string',
312
+ optional: true,
313
+ description: 'Team type',
314
+ examples: ['product', 'platform', 'growth', 'infrastructure', 'support', 'project', 'tiger'],
315
+ },
316
+ methodology: {
317
+ type: 'string',
318
+ optional: true,
319
+ description: 'Working methodology',
320
+ examples: ['scrum', 'kanban', 'scrumban', 'waterfall', 'hybrid'],
321
+ },
322
+
323
+ // Size
324
+ capacity: {
325
+ type: 'number',
326
+ optional: true,
327
+ description: 'Team capacity (FTE)',
328
+ },
329
+ headcount: {
330
+ type: 'number',
331
+ optional: true,
332
+ description: 'Number of members',
333
+ },
334
+
335
+ // Communication
336
+ slackChannel: {
337
+ type: 'string',
338
+ optional: true,
339
+ description: 'Slack channel',
340
+ },
341
+ email: {
342
+ type: 'string',
343
+ optional: true,
344
+ description: 'Team email',
345
+ },
346
+
347
+ // Status
348
+ status: {
349
+ type: 'string',
350
+ optional: true,
351
+ description: 'Team status',
352
+ examples: ['active', 'forming', 'storming', 'norming', 'performing', 'adjourning'],
353
+ },
354
+ },
355
+
356
+ relationships: {
357
+ department: {
358
+ type: 'Department',
359
+ description: 'Parent department',
360
+ },
361
+ lead: {
362
+ type: 'Position',
363
+ required: false,
364
+ description: 'Team lead position',
365
+ },
366
+ positions: {
367
+ type: 'Position[]',
368
+ description: 'Team positions',
369
+ },
370
+ projects: {
371
+ type: 'Project[]',
372
+ description: 'Active projects',
373
+ },
374
+ workflows: {
375
+ type: 'Workflow[]',
376
+ description: 'Team workflows',
377
+ },
378
+ },
379
+
380
+ actions: [
381
+ 'create',
382
+ 'update',
383
+ 'rename',
384
+ 'setLead',
385
+ 'addMember',
386
+ 'removeMember',
387
+ 'setCapacity',
388
+ 'assignProject',
389
+ 'unassignProject',
390
+ 'archive',
391
+ ],
392
+
393
+ events: [
394
+ 'created',
395
+ 'updated',
396
+ 'renamed',
397
+ 'leadChanged',
398
+ 'memberAdded',
399
+ 'memberRemoved',
400
+ 'capacityChanged',
401
+ 'projectAssigned',
402
+ 'projectUnassigned',
403
+ 'archived',
404
+ ],
405
+ }
406
+
407
+ // =============================================================================
408
+ // Position
409
+ // =============================================================================
410
+
411
+ /**
412
+ * Position entity
413
+ *
414
+ * Represents a position/job within the organization.
415
+ */
416
+ export const Position: Noun = {
417
+ singular: 'position',
418
+ plural: 'positions',
419
+ description: 'A position or job within the organization',
420
+
421
+ properties: {
422
+ // Identity
423
+ title: {
424
+ type: 'string',
425
+ description: 'Position title',
426
+ },
427
+ code: {
428
+ type: 'string',
429
+ optional: true,
430
+ description: 'Position code',
431
+ },
432
+ description: {
433
+ type: 'string',
434
+ optional: true,
435
+ description: 'Position description',
436
+ },
437
+
438
+ // Classification
439
+ level: {
440
+ type: 'string',
441
+ optional: true,
442
+ description: 'Job level',
443
+ examples: ['intern', 'junior', 'mid', 'senior', 'staff', 'principal', 'director', 'vp', 'c-level'],
444
+ },
445
+ track: {
446
+ type: 'string',
447
+ optional: true,
448
+ description: 'Career track',
449
+ examples: ['individual-contributor', 'management', 'executive'],
450
+ },
451
+ grade: {
452
+ type: 'string',
453
+ optional: true,
454
+ description: 'Pay grade',
455
+ },
456
+
457
+ // Type
458
+ employmentType: {
459
+ type: 'string',
460
+ optional: true,
461
+ description: 'Employment type',
462
+ examples: ['full-time', 'part-time', 'contract', 'intern', 'advisor'],
463
+ },
464
+ workLocation: {
465
+ type: 'string',
466
+ optional: true,
467
+ description: 'Work location type',
468
+ examples: ['remote', 'office', 'hybrid'],
469
+ },
470
+
471
+ // Compensation
472
+ salaryMin: {
473
+ type: 'number',
474
+ optional: true,
475
+ description: 'Minimum salary',
476
+ },
477
+ salaryMax: {
478
+ type: 'number',
479
+ optional: true,
480
+ description: 'Maximum salary',
481
+ },
482
+ salaryCurrency: {
483
+ type: 'string',
484
+ optional: true,
485
+ description: 'Salary currency',
486
+ },
487
+ equityMin: {
488
+ type: 'number',
489
+ optional: true,
490
+ description: 'Minimum equity percentage',
491
+ },
492
+ equityMax: {
493
+ type: 'number',
494
+ optional: true,
495
+ description: 'Maximum equity percentage',
496
+ },
497
+
498
+ // Capacity
499
+ fte: {
500
+ type: 'number',
501
+ optional: true,
502
+ description: 'Full-time equivalent (0-1)',
503
+ },
504
+
505
+ // Requirements
506
+ requirements: {
507
+ type: 'string',
508
+ array: true,
509
+ optional: true,
510
+ description: 'Position requirements',
511
+ },
512
+ skills: {
513
+ type: 'string',
514
+ array: true,
515
+ optional: true,
516
+ description: 'Required skills',
517
+ },
518
+
519
+ // Status
520
+ status: {
521
+ type: 'string',
522
+ optional: true,
523
+ description: 'Position status',
524
+ examples: ['open', 'filled', 'frozen', 'eliminated'],
525
+ },
526
+ },
527
+
528
+ relationships: {
529
+ team: {
530
+ type: 'Team',
531
+ description: 'Parent team',
532
+ },
533
+ role: {
534
+ type: 'Role',
535
+ description: 'Assigned role',
536
+ },
537
+ reportsTo: {
538
+ type: 'Position',
539
+ required: false,
540
+ description: 'Reports to position',
541
+ },
542
+ directReports: {
543
+ type: 'Position[]',
544
+ description: 'Direct reports',
545
+ },
546
+ holder: {
547
+ type: 'Worker',
548
+ required: false,
549
+ description: 'Current position holder',
550
+ },
551
+ },
552
+
553
+ actions: [
554
+ 'create',
555
+ 'update',
556
+ 'open',
557
+ 'fill',
558
+ 'freeze',
559
+ 'eliminate',
560
+ 'transfer',
561
+ 'promote',
562
+ 'setCompensation',
563
+ 'archive',
564
+ ],
565
+
566
+ events: [
567
+ 'created',
568
+ 'updated',
569
+ 'opened',
570
+ 'filled',
571
+ 'frozen',
572
+ 'eliminated',
573
+ 'transferred',
574
+ 'promoted',
575
+ 'compensationChanged',
576
+ 'archived',
577
+ ],
578
+ }
579
+
580
+ // =============================================================================
581
+ // Role
582
+ // =============================================================================
583
+
584
+ /**
585
+ * Role entity
586
+ *
587
+ * Represents a role with permissions and capabilities.
588
+ */
589
+ export const Role: Noun = {
590
+ singular: 'role',
591
+ plural: 'roles',
592
+ description: 'A role with permissions and capabilities',
593
+
594
+ properties: {
595
+ // Identity
596
+ name: {
597
+ type: 'string',
598
+ description: 'Role name',
599
+ },
600
+ code: {
601
+ type: 'string',
602
+ optional: true,
603
+ description: 'Role code',
604
+ },
605
+ description: {
606
+ type: 'string',
607
+ optional: true,
608
+ description: 'Role description',
609
+ },
610
+
611
+ // Type
612
+ type: {
613
+ type: 'string',
614
+ optional: true,
615
+ description: 'Role type',
616
+ examples: ['executive', 'manager', 'lead', 'contributor', 'specialist', 'support'],
617
+ },
618
+
619
+ // Permissions
620
+ permissions: {
621
+ type: 'string',
622
+ array: true,
623
+ optional: true,
624
+ description: 'Granted permissions',
625
+ },
626
+ capabilities: {
627
+ type: 'string',
628
+ array: true,
629
+ optional: true,
630
+ description: 'Role capabilities',
631
+ },
632
+
633
+ // Approval
634
+ approvalLevel: {
635
+ type: 'number',
636
+ optional: true,
637
+ description: 'Approval authority level',
638
+ },
639
+ approvalLimit: {
640
+ type: 'number',
641
+ optional: true,
642
+ description: 'Approval spending limit',
643
+ },
644
+
645
+ // Hierarchy
646
+ level: {
647
+ type: 'number',
648
+ optional: true,
649
+ description: 'Role hierarchy level',
650
+ },
651
+
652
+ // Status
653
+ status: {
654
+ type: 'string',
655
+ optional: true,
656
+ description: 'Role status',
657
+ examples: ['active', 'deprecated'],
658
+ },
659
+ },
660
+
661
+ relationships: {
662
+ organization: {
663
+ type: 'Organization',
664
+ description: 'Parent organization',
665
+ },
666
+ parent: {
667
+ type: 'Role',
668
+ required: false,
669
+ description: 'Parent role (inherits permissions)',
670
+ },
671
+ children: {
672
+ type: 'Role[]',
673
+ description: 'Child roles',
674
+ },
675
+ positions: {
676
+ type: 'Position[]',
677
+ description: 'Positions with this role',
678
+ },
679
+ },
680
+
681
+ actions: [
682
+ 'create',
683
+ 'update',
684
+ 'grantPermission',
685
+ 'revokePermission',
686
+ 'setApprovalLimit',
687
+ 'deprecate',
688
+ 'archive',
689
+ ],
690
+
691
+ events: [
692
+ 'created',
693
+ 'updated',
694
+ 'permissionGranted',
695
+ 'permissionRevoked',
696
+ 'approvalLimitChanged',
697
+ 'deprecated',
698
+ 'archived',
699
+ ],
700
+ }
701
+
702
+ // =============================================================================
703
+ // Worker
704
+ // =============================================================================
705
+
706
+ /**
707
+ * Worker entity
708
+ *
709
+ * Represents a human employee or AI agent that fills a position.
710
+ */
711
+ export const Worker: Noun = {
712
+ singular: 'worker',
713
+ plural: 'workers',
714
+ description: 'A human employee or AI agent that fills a position',
715
+
716
+ properties: {
717
+ // Identity
718
+ name: {
719
+ type: 'string',
720
+ description: 'Worker name',
721
+ },
722
+ email: {
723
+ type: 'string',
724
+ optional: true,
725
+ description: 'Email address',
726
+ },
727
+ avatarUrl: {
728
+ type: 'url',
729
+ optional: true,
730
+ description: 'Avatar URL',
731
+ },
732
+
733
+ // Type
734
+ type: {
735
+ type: 'string',
736
+ description: 'Worker type',
737
+ examples: ['human', 'agent'],
738
+ },
739
+
740
+ // Human-specific
741
+ firstName: {
742
+ type: 'string',
743
+ optional: true,
744
+ description: 'First name',
745
+ },
746
+ lastName: {
747
+ type: 'string',
748
+ optional: true,
749
+ description: 'Last name',
750
+ },
751
+ phone: {
752
+ type: 'string',
753
+ optional: true,
754
+ description: 'Phone number',
755
+ },
756
+ location: {
757
+ type: 'string',
758
+ optional: true,
759
+ description: 'Work location',
760
+ },
761
+ timezone: {
762
+ type: 'string',
763
+ optional: true,
764
+ description: 'Timezone',
765
+ },
766
+ startDate: {
767
+ type: 'date',
768
+ optional: true,
769
+ description: 'Start date',
770
+ },
771
+
772
+ // Agent-specific
773
+ agentId: {
774
+ type: 'string',
775
+ optional: true,
776
+ description: 'AI agent identifier',
777
+ },
778
+ modelId: {
779
+ type: 'string',
780
+ optional: true,
781
+ description: 'AI model identifier',
782
+ },
783
+ capabilities: {
784
+ type: 'string',
785
+ array: true,
786
+ optional: true,
787
+ description: 'Agent capabilities',
788
+ },
789
+
790
+ // Availability
791
+ availability: {
792
+ type: 'string',
793
+ optional: true,
794
+ description: 'Availability status',
795
+ examples: ['available', 'busy', 'away', 'offline'],
796
+ },
797
+ capacity: {
798
+ type: 'number',
799
+ optional: true,
800
+ description: 'Available capacity (0-1)',
801
+ },
802
+
803
+ // Status
804
+ status: {
805
+ type: 'string',
806
+ optional: true,
807
+ description: 'Worker status',
808
+ examples: ['active', 'onboarding', 'on-leave', 'offboarding', 'inactive'],
809
+ },
810
+ },
811
+
812
+ relationships: {
813
+ position: {
814
+ type: 'Position',
815
+ required: false,
816
+ description: 'Current position',
817
+ },
818
+ manager: {
819
+ type: 'Worker',
820
+ required: false,
821
+ description: 'Direct manager',
822
+ },
823
+ directReports: {
824
+ type: 'Worker[]',
825
+ description: 'Direct reports',
826
+ },
827
+ tasks: {
828
+ type: 'Task[]',
829
+ description: 'Assigned tasks',
830
+ },
831
+ },
832
+
833
+ actions: [
834
+ 'create',
835
+ 'update',
836
+ 'onboard',
837
+ 'assign',
838
+ 'reassign',
839
+ 'setAvailability',
840
+ 'promote',
841
+ 'transfer',
842
+ 'offboard',
843
+ 'archive',
844
+ ],
845
+
846
+ events: [
847
+ 'created',
848
+ 'updated',
849
+ 'onboarded',
850
+ 'assigned',
851
+ 'reassigned',
852
+ 'availabilityChanged',
853
+ 'promoted',
854
+ 'transferred',
855
+ 'offboarded',
856
+ 'archived',
857
+ ],
858
+ }
859
+
860
+ // =============================================================================
861
+ // Exports
862
+ // =============================================================================
863
+
864
+ export const OrganizationEntities = {
865
+ Organization,
866
+ Department,
867
+ Team,
868
+ Position,
869
+ Role,
870
+ Worker,
871
+ }
872
+
873
+ export const OrganizationCategories = {
874
+ structure: ['Organization', 'Department', 'Team'],
875
+ people: ['Position', 'Role', 'Worker'],
876
+ } as const