digital-products 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 (110) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +9 -0
  3. package/README.md +535 -0
  4. package/dist/api.d.ts +99 -0
  5. package/dist/api.d.ts.map +1 -0
  6. package/dist/api.js +129 -0
  7. package/dist/api.js.map +1 -0
  8. package/dist/app.d.ts +79 -0
  9. package/dist/app.d.ts.map +1 -0
  10. package/dist/app.js +107 -0
  11. package/dist/app.js.map +1 -0
  12. package/dist/content.d.ts +58 -0
  13. package/dist/content.d.ts.map +1 -0
  14. package/dist/content.js +78 -0
  15. package/dist/content.js.map +1 -0
  16. package/dist/data.d.ts +67 -0
  17. package/dist/data.d.ts.map +1 -0
  18. package/dist/data.js +107 -0
  19. package/dist/data.js.map +1 -0
  20. package/dist/dataset.d.ts +32 -0
  21. package/dist/dataset.d.ts.map +1 -0
  22. package/dist/dataset.js +50 -0
  23. package/dist/dataset.js.map +1 -0
  24. package/dist/entities/ai.d.ts +53 -0
  25. package/dist/entities/ai.d.ts.map +1 -0
  26. package/dist/entities/ai.js +859 -0
  27. package/dist/entities/ai.js.map +1 -0
  28. package/dist/entities/content.d.ts +52 -0
  29. package/dist/entities/content.d.ts.map +1 -0
  30. package/dist/entities/content.js +784 -0
  31. package/dist/entities/content.js.map +1 -0
  32. package/dist/entities/index.d.ts +112 -0
  33. package/dist/entities/index.d.ts.map +1 -0
  34. package/dist/entities/index.js +89 -0
  35. package/dist/entities/index.js.map +1 -0
  36. package/dist/entities/interfaces.d.ts +67 -0
  37. package/dist/entities/interfaces.d.ts.map +1 -0
  38. package/dist/entities/interfaces.js +930 -0
  39. package/dist/entities/interfaces.js.map +1 -0
  40. package/dist/entities/lifecycle.d.ts +51 -0
  41. package/dist/entities/lifecycle.d.ts.map +1 -0
  42. package/dist/entities/lifecycle.js +804 -0
  43. package/dist/entities/lifecycle.js.map +1 -0
  44. package/dist/entities/products.d.ts +53 -0
  45. package/dist/entities/products.d.ts.map +1 -0
  46. package/dist/entities/products.js +798 -0
  47. package/dist/entities/products.js.map +1 -0
  48. package/dist/entities/web.d.ts +44 -0
  49. package/dist/entities/web.d.ts.map +1 -0
  50. package/dist/entities/web.js +658 -0
  51. package/dist/entities/web.js.map +1 -0
  52. package/dist/index.d.ts +29 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +36 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/mcp.d.ts +101 -0
  57. package/dist/mcp.d.ts.map +1 -0
  58. package/dist/mcp.js +140 -0
  59. package/dist/mcp.js.map +1 -0
  60. package/dist/product.d.ts +37 -0
  61. package/dist/product.d.ts.map +1 -0
  62. package/dist/product.js +54 -0
  63. package/dist/product.js.map +1 -0
  64. package/dist/registry.d.ts +9 -0
  65. package/dist/registry.d.ts.map +1 -0
  66. package/dist/registry.js +32 -0
  67. package/dist/registry.js.map +1 -0
  68. package/dist/sdk.d.ts +99 -0
  69. package/dist/sdk.d.ts.map +1 -0
  70. package/dist/sdk.js +128 -0
  71. package/dist/sdk.js.map +1 -0
  72. package/dist/site.d.ts +85 -0
  73. package/dist/site.d.ts.map +1 -0
  74. package/dist/site.js +113 -0
  75. package/dist/site.js.map +1 -0
  76. package/dist/types.d.ts +528 -0
  77. package/dist/types.d.ts.map +1 -0
  78. package/dist/types.js +5 -0
  79. package/dist/types.js.map +1 -0
  80. package/example.ts +236 -0
  81. package/package.json +35 -0
  82. package/src/api.ts +140 -0
  83. package/src/app.ts +117 -0
  84. package/src/content.ts +82 -0
  85. package/src/data.ts +129 -0
  86. package/src/dataset.ts +53 -0
  87. package/src/entities/ai.ts +932 -0
  88. package/src/entities/content.ts +851 -0
  89. package/src/entities/index.ts +156 -0
  90. package/src/entities/interfaces.ts +1017 -0
  91. package/src/entities/lifecycle.ts +872 -0
  92. package/src/entities/products.ts +867 -0
  93. package/src/entities/web.ts +719 -0
  94. package/src/index.ts +55 -0
  95. package/src/mcp.ts +163 -0
  96. package/src/product.ts +59 -0
  97. package/src/registry.ts +41 -0
  98. package/src/sdk.ts +148 -0
  99. package/src/site.ts +127 -0
  100. package/src/types.ts +558 -0
  101. package/test/api.test.ts +247 -0
  102. package/test/app.test.ts +220 -0
  103. package/test/content.test.ts +171 -0
  104. package/test/data.test.ts +201 -0
  105. package/test/dataset.test.ts +181 -0
  106. package/test/mcp.test.ts +230 -0
  107. package/test/product.test.ts +200 -0
  108. package/test/sdk.test.ts +236 -0
  109. package/test/site.test.ts +245 -0
  110. package/tsconfig.json +9 -0
@@ -0,0 +1,859 @@
1
+ /**
2
+ * AI Entity Types (Nouns)
3
+ *
4
+ * AI-native products: AIProduct, Model, Agent, Prompt, Tool
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ // =============================================================================
9
+ // AIProduct
10
+ // =============================================================================
11
+ /**
12
+ * AIProduct entity
13
+ *
14
+ * AI-powered digital product.
15
+ */
16
+ export const AIProduct = {
17
+ singular: 'ai-product',
18
+ plural: 'ai-products',
19
+ description: 'An AI-powered digital product',
20
+ properties: {
21
+ // Identity
22
+ name: {
23
+ type: 'string',
24
+ description: 'Product name',
25
+ },
26
+ slug: {
27
+ type: 'string',
28
+ optional: true,
29
+ description: 'URL-friendly identifier',
30
+ },
31
+ description: {
32
+ type: 'string',
33
+ optional: true,
34
+ description: 'Product description',
35
+ },
36
+ // Classification
37
+ type: {
38
+ type: 'string',
39
+ description: 'AI product type',
40
+ examples: ['chatbot', 'copilot', 'assistant', 'generator', 'analyzer', 'classifier', 'recommender', 'autonomous'],
41
+ },
42
+ domain: {
43
+ type: 'string',
44
+ optional: true,
45
+ description: 'Application domain',
46
+ },
47
+ // AI Configuration
48
+ primaryModel: {
49
+ type: 'string',
50
+ optional: true,
51
+ description: 'Primary AI model',
52
+ examples: ['gpt-4', 'claude-3', 'gemini', 'llama', 'mistral', 'custom'],
53
+ },
54
+ modelProvider: {
55
+ type: 'string',
56
+ optional: true,
57
+ description: 'Model provider',
58
+ examples: ['openai', 'anthropic', 'google', 'meta', 'custom'],
59
+ },
60
+ // Capabilities
61
+ capabilities: {
62
+ type: 'string',
63
+ array: true,
64
+ optional: true,
65
+ description: 'AI capabilities',
66
+ examples: ['text-generation', 'code-generation', 'image-generation', 'speech', 'vision', 'reasoning'],
67
+ },
68
+ modalities: {
69
+ type: 'string',
70
+ array: true,
71
+ optional: true,
72
+ description: 'Supported modalities',
73
+ examples: ['text', 'image', 'audio', 'video', 'code'],
74
+ },
75
+ // Integration
76
+ hasTools: {
77
+ type: 'boolean',
78
+ optional: true,
79
+ description: 'Has tool/function calling',
80
+ },
81
+ hasRAG: {
82
+ type: 'boolean',
83
+ optional: true,
84
+ description: 'Has retrieval augmented generation',
85
+ },
86
+ hasMemory: {
87
+ type: 'boolean',
88
+ optional: true,
89
+ description: 'Has conversation memory',
90
+ },
91
+ hasAgents: {
92
+ type: 'boolean',
93
+ optional: true,
94
+ description: 'Has autonomous agents',
95
+ },
96
+ // Autonomy
97
+ autonomyLevel: {
98
+ type: 'string',
99
+ optional: true,
100
+ description: 'Level of autonomous operation',
101
+ examples: ['manual', 'assisted', 'supervised', 'autonomous'],
102
+ },
103
+ // Safety
104
+ contentFiltering: {
105
+ type: 'boolean',
106
+ optional: true,
107
+ description: 'Content filtering enabled',
108
+ },
109
+ moderationEnabled: {
110
+ type: 'boolean',
111
+ optional: true,
112
+ description: 'Moderation enabled',
113
+ },
114
+ // Metrics
115
+ requestsPerDay: {
116
+ type: 'number',
117
+ optional: true,
118
+ description: 'Average daily requests',
119
+ },
120
+ averageLatencyMs: {
121
+ type: 'number',
122
+ optional: true,
123
+ description: 'Average latency in ms',
124
+ },
125
+ // Status
126
+ status: {
127
+ type: 'string',
128
+ description: 'Product status',
129
+ examples: ['draft', 'alpha', 'beta', 'production', 'deprecated'],
130
+ },
131
+ },
132
+ relationships: {
133
+ product: {
134
+ type: 'DigitalProduct',
135
+ description: 'Parent product',
136
+ },
137
+ models: {
138
+ type: 'Model[]',
139
+ description: 'AI models used',
140
+ },
141
+ agents: {
142
+ type: 'Agent[]',
143
+ description: 'AI agents',
144
+ },
145
+ prompts: {
146
+ type: 'Prompt[]',
147
+ description: 'Prompt templates',
148
+ },
149
+ tools: {
150
+ type: 'Tool[]',
151
+ description: 'Available tools',
152
+ },
153
+ },
154
+ actions: [
155
+ 'create',
156
+ 'update',
157
+ 'deploy',
158
+ 'addModel',
159
+ 'removeModel',
160
+ 'addAgent',
161
+ 'removeAgent',
162
+ 'evaluate',
163
+ 'deprecate',
164
+ ],
165
+ events: [
166
+ 'created',
167
+ 'updated',
168
+ 'deployed',
169
+ 'modelAdded',
170
+ 'modelRemoved',
171
+ 'agentAdded',
172
+ 'agentRemoved',
173
+ 'evaluated',
174
+ 'deprecated',
175
+ ],
176
+ };
177
+ // =============================================================================
178
+ // Model
179
+ // =============================================================================
180
+ /**
181
+ * Model entity
182
+ *
183
+ * ML/AI model definition.
184
+ */
185
+ export const Model = {
186
+ singular: 'model',
187
+ plural: 'models',
188
+ description: 'An ML/AI model',
189
+ properties: {
190
+ // Identity
191
+ name: {
192
+ type: 'string',
193
+ description: 'Model name',
194
+ },
195
+ slug: {
196
+ type: 'string',
197
+ optional: true,
198
+ description: 'URL-friendly identifier',
199
+ },
200
+ description: {
201
+ type: 'string',
202
+ optional: true,
203
+ description: 'Model description',
204
+ },
205
+ // Type
206
+ type: {
207
+ type: 'string',
208
+ description: 'Model type',
209
+ examples: ['llm', 'embedding', 'classification', 'regression', 'generation', 'vision', 'speech', 'multimodal'],
210
+ },
211
+ architecture: {
212
+ type: 'string',
213
+ optional: true,
214
+ description: 'Model architecture',
215
+ examples: ['transformer', 'diffusion', 'cnn', 'rnn', 'custom'],
216
+ },
217
+ // Provider
218
+ provider: {
219
+ type: 'string',
220
+ optional: true,
221
+ description: 'Model provider',
222
+ examples: ['openai', 'anthropic', 'google', 'meta', 'mistral', 'huggingface', 'custom'],
223
+ },
224
+ modelId: {
225
+ type: 'string',
226
+ optional: true,
227
+ description: 'Provider model ID',
228
+ },
229
+ // Capabilities
230
+ contextWindow: {
231
+ type: 'number',
232
+ optional: true,
233
+ description: 'Context window size (tokens)',
234
+ },
235
+ maxOutputTokens: {
236
+ type: 'number',
237
+ optional: true,
238
+ description: 'Max output tokens',
239
+ },
240
+ supportsFunctions: {
241
+ type: 'boolean',
242
+ optional: true,
243
+ description: 'Supports function calling',
244
+ },
245
+ supportsVision: {
246
+ type: 'boolean',
247
+ optional: true,
248
+ description: 'Supports image input',
249
+ },
250
+ supportsStreaming: {
251
+ type: 'boolean',
252
+ optional: true,
253
+ description: 'Supports streaming output',
254
+ },
255
+ // Fine-tuning
256
+ fineTuned: {
257
+ type: 'boolean',
258
+ optional: true,
259
+ description: 'Is fine-tuned',
260
+ },
261
+ baseModel: {
262
+ type: 'string',
263
+ optional: true,
264
+ description: 'Base model for fine-tuning',
265
+ },
266
+ trainingDataset: {
267
+ type: 'string',
268
+ optional: true,
269
+ description: 'Training dataset',
270
+ },
271
+ // Hosting
272
+ hostingType: {
273
+ type: 'string',
274
+ optional: true,
275
+ description: 'Hosting type',
276
+ examples: ['api', 'self-hosted', 'edge', 'serverless'],
277
+ },
278
+ endpoint: {
279
+ type: 'string',
280
+ optional: true,
281
+ description: 'API endpoint',
282
+ },
283
+ // Performance
284
+ latencyP50: {
285
+ type: 'number',
286
+ optional: true,
287
+ description: 'P50 latency (ms)',
288
+ },
289
+ latencyP99: {
290
+ type: 'number',
291
+ optional: true,
292
+ description: 'P99 latency (ms)',
293
+ },
294
+ tokensPerSecond: {
295
+ type: 'number',
296
+ optional: true,
297
+ description: 'Tokens per second',
298
+ },
299
+ // Pricing
300
+ inputPricePerMillion: {
301
+ type: 'number',
302
+ optional: true,
303
+ description: 'Price per million input tokens',
304
+ },
305
+ outputPricePerMillion: {
306
+ type: 'number',
307
+ optional: true,
308
+ description: 'Price per million output tokens',
309
+ },
310
+ // Status
311
+ status: {
312
+ type: 'string',
313
+ description: 'Model status',
314
+ examples: ['training', 'evaluating', 'active', 'deprecated'],
315
+ },
316
+ version: {
317
+ type: 'string',
318
+ optional: true,
319
+ description: 'Model version',
320
+ },
321
+ },
322
+ relationships: {
323
+ aiProduct: {
324
+ type: 'AIProduct',
325
+ required: false,
326
+ description: 'Parent AI product',
327
+ },
328
+ evaluations: {
329
+ type: 'ModelEvaluation[]',
330
+ description: 'Model evaluations',
331
+ },
332
+ },
333
+ actions: [
334
+ 'create',
335
+ 'update',
336
+ 'train',
337
+ 'evaluate',
338
+ 'deploy',
339
+ 'undeploy',
340
+ 'deprecate',
341
+ ],
342
+ events: [
343
+ 'created',
344
+ 'updated',
345
+ 'trained',
346
+ 'evaluated',
347
+ 'deployed',
348
+ 'undeployed',
349
+ 'deprecated',
350
+ ],
351
+ };
352
+ // =============================================================================
353
+ // Agent
354
+ // =============================================================================
355
+ /**
356
+ * Agent entity
357
+ *
358
+ * Autonomous AI agent product.
359
+ */
360
+ export const Agent = {
361
+ singular: 'agent',
362
+ plural: 'agents',
363
+ description: 'An autonomous AI agent',
364
+ properties: {
365
+ // Identity
366
+ name: {
367
+ type: 'string',
368
+ description: 'Agent name',
369
+ },
370
+ slug: {
371
+ type: 'string',
372
+ optional: true,
373
+ description: 'URL-friendly identifier',
374
+ },
375
+ description: {
376
+ type: 'string',
377
+ optional: true,
378
+ description: 'Agent description',
379
+ },
380
+ // Purpose
381
+ role: {
382
+ type: 'string',
383
+ optional: true,
384
+ description: 'Agent role',
385
+ },
386
+ goal: {
387
+ type: 'string',
388
+ optional: true,
389
+ description: 'Agent goal',
390
+ },
391
+ backstory: {
392
+ type: 'string',
393
+ optional: true,
394
+ description: 'Agent backstory/context',
395
+ },
396
+ // Configuration
397
+ systemPrompt: {
398
+ type: 'string',
399
+ optional: true,
400
+ description: 'System prompt',
401
+ },
402
+ model: {
403
+ type: 'string',
404
+ optional: true,
405
+ description: 'AI model used',
406
+ },
407
+ temperature: {
408
+ type: 'number',
409
+ optional: true,
410
+ description: 'Model temperature',
411
+ },
412
+ // Capabilities
413
+ tools: {
414
+ type: 'string',
415
+ array: true,
416
+ optional: true,
417
+ description: 'Available tools',
418
+ },
419
+ allowedActions: {
420
+ type: 'string',
421
+ array: true,
422
+ optional: true,
423
+ description: 'Allowed actions',
424
+ },
425
+ // Autonomy
426
+ autonomyLevel: {
427
+ type: 'string',
428
+ description: 'Autonomy level',
429
+ examples: ['advisory', 'assisted', 'supervised', 'autonomous'],
430
+ },
431
+ maxIterations: {
432
+ type: 'number',
433
+ optional: true,
434
+ description: 'Max iterations per task',
435
+ },
436
+ requiresApproval: {
437
+ type: 'boolean',
438
+ optional: true,
439
+ description: 'Requires human approval',
440
+ },
441
+ approvalThreshold: {
442
+ type: 'number',
443
+ optional: true,
444
+ description: 'Confidence threshold for auto-approval',
445
+ },
446
+ // Memory
447
+ memoryEnabled: {
448
+ type: 'boolean',
449
+ optional: true,
450
+ description: 'Memory enabled',
451
+ },
452
+ memoryType: {
453
+ type: 'string',
454
+ optional: true,
455
+ description: 'Memory type',
456
+ examples: ['short-term', 'long-term', 'episodic', 'semantic'],
457
+ },
458
+ // Collaboration
459
+ canDelegate: {
460
+ type: 'boolean',
461
+ optional: true,
462
+ description: 'Can delegate to other agents',
463
+ },
464
+ canCollaborate: {
465
+ type: 'boolean',
466
+ optional: true,
467
+ description: 'Can collaborate with other agents',
468
+ },
469
+ // Safety
470
+ guardrails: {
471
+ type: 'string',
472
+ array: true,
473
+ optional: true,
474
+ description: 'Safety guardrails',
475
+ },
476
+ escalationRules: {
477
+ type: 'json',
478
+ optional: true,
479
+ description: 'Escalation rules',
480
+ },
481
+ // Status
482
+ status: {
483
+ type: 'string',
484
+ description: 'Agent status',
485
+ examples: ['draft', 'testing', 'active', 'paused', 'deprecated'],
486
+ },
487
+ },
488
+ relationships: {
489
+ aiProduct: {
490
+ type: 'AIProduct',
491
+ required: false,
492
+ description: 'Parent AI product',
493
+ },
494
+ modelRef: {
495
+ type: 'Model',
496
+ required: false,
497
+ description: 'AI model',
498
+ },
499
+ toolRefs: {
500
+ type: 'Tool[]',
501
+ description: 'Available tools',
502
+ },
503
+ crew: {
504
+ type: 'Agent[]',
505
+ description: 'Collaborating agents',
506
+ },
507
+ tasks: {
508
+ type: 'AgentTask[]',
509
+ description: 'Assigned tasks',
510
+ },
511
+ },
512
+ actions: [
513
+ 'create',
514
+ 'update',
515
+ 'activate',
516
+ 'pause',
517
+ 'assignTask',
518
+ 'execute',
519
+ 'escalate',
520
+ 'evaluate',
521
+ 'deprecate',
522
+ ],
523
+ events: [
524
+ 'created',
525
+ 'updated',
526
+ 'activated',
527
+ 'paused',
528
+ 'taskAssigned',
529
+ 'executed',
530
+ 'escalated',
531
+ 'evaluated',
532
+ 'deprecated',
533
+ ],
534
+ };
535
+ // =============================================================================
536
+ // Prompt
537
+ // =============================================================================
538
+ /**
539
+ * Prompt entity
540
+ *
541
+ * Prompt template or library.
542
+ */
543
+ export const Prompt = {
544
+ singular: 'prompt',
545
+ plural: 'prompts',
546
+ description: 'A prompt template for AI interactions',
547
+ properties: {
548
+ // Identity
549
+ name: {
550
+ type: 'string',
551
+ description: 'Prompt name',
552
+ },
553
+ slug: {
554
+ type: 'string',
555
+ optional: true,
556
+ description: 'URL-friendly identifier',
557
+ },
558
+ description: {
559
+ type: 'string',
560
+ optional: true,
561
+ description: 'Prompt description',
562
+ },
563
+ // Content
564
+ template: {
565
+ type: 'string',
566
+ description: 'Prompt template',
567
+ },
568
+ systemPrompt: {
569
+ type: 'string',
570
+ optional: true,
571
+ description: 'System prompt portion',
572
+ },
573
+ // Classification
574
+ type: {
575
+ type: 'string',
576
+ description: 'Prompt type',
577
+ examples: ['system', 'user', 'assistant', 'few-shot', 'chain-of-thought', 'function'],
578
+ },
579
+ category: {
580
+ type: 'string',
581
+ optional: true,
582
+ description: 'Prompt category',
583
+ },
584
+ // Variables
585
+ variables: {
586
+ type: 'json',
587
+ optional: true,
588
+ description: 'Template variables schema',
589
+ },
590
+ defaultValues: {
591
+ type: 'json',
592
+ optional: true,
593
+ description: 'Default variable values',
594
+ },
595
+ // Examples
596
+ exampleInput: {
597
+ type: 'string',
598
+ optional: true,
599
+ description: 'Example input',
600
+ },
601
+ exampleOutput: {
602
+ type: 'string',
603
+ optional: true,
604
+ description: 'Expected output',
605
+ },
606
+ // Target
607
+ targetModel: {
608
+ type: 'string',
609
+ optional: true,
610
+ description: 'Target model',
611
+ },
612
+ targetModels: {
613
+ type: 'string',
614
+ array: true,
615
+ optional: true,
616
+ description: 'Compatible models',
617
+ },
618
+ // Output
619
+ outputFormat: {
620
+ type: 'string',
621
+ optional: true,
622
+ description: 'Expected output format',
623
+ examples: ['text', 'json', 'markdown', 'code', 'structured'],
624
+ },
625
+ outputSchema: {
626
+ type: 'json',
627
+ optional: true,
628
+ description: 'Output schema for structured output',
629
+ },
630
+ // Metrics
631
+ averageTokens: {
632
+ type: 'number',
633
+ optional: true,
634
+ description: 'Average token usage',
635
+ },
636
+ useCount: {
637
+ type: 'number',
638
+ optional: true,
639
+ description: 'Number of uses',
640
+ },
641
+ successRate: {
642
+ type: 'number',
643
+ optional: true,
644
+ description: 'Success rate (0-1)',
645
+ },
646
+ // Status
647
+ status: {
648
+ type: 'string',
649
+ description: 'Prompt status',
650
+ examples: ['draft', 'testing', 'active', 'deprecated'],
651
+ },
652
+ version: {
653
+ type: 'string',
654
+ optional: true,
655
+ description: 'Prompt version',
656
+ },
657
+ },
658
+ relationships: {
659
+ aiProduct: {
660
+ type: 'AIProduct',
661
+ required: false,
662
+ description: 'Parent AI product',
663
+ },
664
+ mcp: {
665
+ type: 'MCP',
666
+ required: false,
667
+ description: 'MCP server',
668
+ },
669
+ versions: {
670
+ type: 'PromptVersion[]',
671
+ description: 'Prompt versions',
672
+ },
673
+ },
674
+ actions: [
675
+ 'create',
676
+ 'update',
677
+ 'test',
678
+ 'publish',
679
+ 'version',
680
+ 'deprecate',
681
+ ],
682
+ events: [
683
+ 'created',
684
+ 'updated',
685
+ 'tested',
686
+ 'published',
687
+ 'versioned',
688
+ 'deprecated',
689
+ ],
690
+ };
691
+ // =============================================================================
692
+ // Tool
693
+ // =============================================================================
694
+ /**
695
+ * Tool entity
696
+ *
697
+ * AI tool definition for function calling.
698
+ */
699
+ export const Tool = {
700
+ singular: 'tool',
701
+ plural: 'tools',
702
+ description: 'A tool for AI function calling',
703
+ properties: {
704
+ // Identity
705
+ name: {
706
+ type: 'string',
707
+ description: 'Tool name',
708
+ },
709
+ description: {
710
+ type: 'string',
711
+ description: 'Tool description for AI',
712
+ },
713
+ // Classification
714
+ type: {
715
+ type: 'string',
716
+ description: 'Tool type',
717
+ examples: ['function', 'api', 'database', 'file', 'web', 'system', 'custom'],
718
+ },
719
+ category: {
720
+ type: 'string',
721
+ optional: true,
722
+ description: 'Tool category',
723
+ },
724
+ // Interface
725
+ inputSchema: {
726
+ type: 'json',
727
+ description: 'Input parameters schema',
728
+ },
729
+ outputSchema: {
730
+ type: 'json',
731
+ optional: true,
732
+ description: 'Output schema',
733
+ },
734
+ // Execution
735
+ handler: {
736
+ type: 'string',
737
+ optional: true,
738
+ description: 'Handler function/endpoint',
739
+ },
740
+ async: {
741
+ type: 'boolean',
742
+ optional: true,
743
+ description: 'Async execution',
744
+ },
745
+ timeoutMs: {
746
+ type: 'number',
747
+ optional: true,
748
+ description: 'Execution timeout',
749
+ },
750
+ // Permissions
751
+ requiresAuth: {
752
+ type: 'boolean',
753
+ optional: true,
754
+ description: 'Requires authentication',
755
+ },
756
+ requiredScopes: {
757
+ type: 'string',
758
+ array: true,
759
+ optional: true,
760
+ description: 'Required permission scopes',
761
+ },
762
+ dangerous: {
763
+ type: 'boolean',
764
+ optional: true,
765
+ description: 'Potentially dangerous operation',
766
+ },
767
+ requiresConfirmation: {
768
+ type: 'boolean',
769
+ optional: true,
770
+ description: 'Requires user confirmation',
771
+ },
772
+ // Rate Limiting
773
+ rateLimit: {
774
+ type: 'number',
775
+ optional: true,
776
+ description: 'Rate limit per minute',
777
+ },
778
+ cooldownMs: {
779
+ type: 'number',
780
+ optional: true,
781
+ description: 'Cooldown between calls',
782
+ },
783
+ // Metrics
784
+ callCount: {
785
+ type: 'number',
786
+ optional: true,
787
+ description: 'Total call count',
788
+ },
789
+ successRate: {
790
+ type: 'number',
791
+ optional: true,
792
+ description: 'Success rate (0-1)',
793
+ },
794
+ averageLatencyMs: {
795
+ type: 'number',
796
+ optional: true,
797
+ description: 'Average latency',
798
+ },
799
+ // Status
800
+ status: {
801
+ type: 'string',
802
+ description: 'Tool status',
803
+ examples: ['draft', 'active', 'deprecated'],
804
+ },
805
+ },
806
+ relationships: {
807
+ aiProduct: {
808
+ type: 'AIProduct',
809
+ required: false,
810
+ description: 'Parent AI product',
811
+ },
812
+ mcp: {
813
+ type: 'MCP',
814
+ required: false,
815
+ description: 'MCP server',
816
+ },
817
+ agent: {
818
+ type: 'Agent',
819
+ required: false,
820
+ description: 'Assigned agent',
821
+ },
822
+ },
823
+ actions: [
824
+ 'create',
825
+ 'update',
826
+ 'enable',
827
+ 'disable',
828
+ 'execute',
829
+ 'test',
830
+ 'deprecate',
831
+ ],
832
+ events: [
833
+ 'created',
834
+ 'updated',
835
+ 'enabled',
836
+ 'disabled',
837
+ 'executed',
838
+ 'tested',
839
+ 'deprecated',
840
+ ],
841
+ };
842
+ // =============================================================================
843
+ // Exports
844
+ // =============================================================================
845
+ export const AIEntities = {
846
+ AIProduct,
847
+ Model,
848
+ Agent,
849
+ Prompt,
850
+ Tool,
851
+ };
852
+ export const AICategories = {
853
+ products: ['AIProduct'],
854
+ models: ['Model'],
855
+ agents: ['Agent'],
856
+ prompts: ['Prompt'],
857
+ tools: ['Tool'],
858
+ };
859
+ //# sourceMappingURL=ai.js.map