@contractspec/module.ai-chat 1.44.0

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 (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +169 -0
  3. package/dist/ai-chat.feature.d.ts +12 -0
  4. package/dist/ai-chat.feature.d.ts.map +1 -0
  5. package/dist/ai-chat.feature.js +95 -0
  6. package/dist/ai-chat.feature.js.map +1 -0
  7. package/dist/ai-chat.operations.d.ts +243 -0
  8. package/dist/ai-chat.operations.d.ts.map +1 -0
  9. package/dist/ai-chat.operations.js +174 -0
  10. package/dist/ai-chat.operations.js.map +1 -0
  11. package/dist/context/context-builder.d.ts +57 -0
  12. package/dist/context/context-builder.d.ts.map +1 -0
  13. package/dist/context/context-builder.js +148 -0
  14. package/dist/context/context-builder.js.map +1 -0
  15. package/dist/context/file-operations.d.ts +100 -0
  16. package/dist/context/file-operations.d.ts.map +1 -0
  17. package/dist/context/file-operations.js +175 -0
  18. package/dist/context/file-operations.js.map +1 -0
  19. package/dist/context/index.d.ts +4 -0
  20. package/dist/context/index.js +5 -0
  21. package/dist/context/workspace-context.d.ts +117 -0
  22. package/dist/context/workspace-context.d.ts.map +1 -0
  23. package/dist/context/workspace-context.js +124 -0
  24. package/dist/context/workspace-context.js.map +1 -0
  25. package/dist/core/chat-service.d.ts +73 -0
  26. package/dist/core/chat-service.d.ts.map +1 -0
  27. package/dist/core/chat-service.js +227 -0
  28. package/dist/core/chat-service.js.map +1 -0
  29. package/dist/core/conversation-store.d.ts +74 -0
  30. package/dist/core/conversation-store.d.ts.map +1 -0
  31. package/dist/core/conversation-store.js +109 -0
  32. package/dist/core/conversation-store.js.map +1 -0
  33. package/dist/core/index.d.ts +4 -0
  34. package/dist/core/index.js +4 -0
  35. package/dist/core/message-types.d.ts +150 -0
  36. package/dist/core/message-types.d.ts.map +1 -0
  37. package/dist/events.d.ts +115 -0
  38. package/dist/events.d.ts.map +1 -0
  39. package/dist/events.js +100 -0
  40. package/dist/events.js.map +1 -0
  41. package/dist/index.d.ts +21 -0
  42. package/dist/index.js +23 -0
  43. package/dist/libs/schema/dist/EnumType.js +2 -0
  44. package/dist/libs/schema/dist/FieldType.js +50 -0
  45. package/dist/libs/schema/dist/FieldType.js.map +1 -0
  46. package/dist/libs/schema/dist/GraphQLSchemaType.js +1 -0
  47. package/dist/libs/schema/dist/JsonSchemaType.js +1 -0
  48. package/dist/libs/schema/dist/ScalarTypeEnum.js +237 -0
  49. package/dist/libs/schema/dist/ScalarTypeEnum.js.map +1 -0
  50. package/dist/libs/schema/dist/SchemaModel.js +40 -0
  51. package/dist/libs/schema/dist/SchemaModel.js.map +1 -0
  52. package/dist/libs/schema/dist/ZodSchemaType.js +1 -0
  53. package/dist/libs/schema/dist/entity/defineEntity.js +1 -0
  54. package/dist/libs/schema/dist/entity/index.js +2 -0
  55. package/dist/libs/schema/dist/entity/types.js +1 -0
  56. package/dist/libs/schema/dist/index.js +9 -0
  57. package/dist/presentation/components/ChatContainer.d.ts +21 -0
  58. package/dist/presentation/components/ChatContainer.d.ts.map +1 -0
  59. package/dist/presentation/components/ChatContainer.js +63 -0
  60. package/dist/presentation/components/ChatContainer.js.map +1 -0
  61. package/dist/presentation/components/ChatInput.d.ts +35 -0
  62. package/dist/presentation/components/ChatInput.d.ts.map +1 -0
  63. package/dist/presentation/components/ChatInput.js +149 -0
  64. package/dist/presentation/components/ChatInput.js.map +1 -0
  65. package/dist/presentation/components/ChatMessage.d.ts +24 -0
  66. package/dist/presentation/components/ChatMessage.d.ts.map +1 -0
  67. package/dist/presentation/components/ChatMessage.js +136 -0
  68. package/dist/presentation/components/ChatMessage.js.map +1 -0
  69. package/dist/presentation/components/CodePreview.d.ts +40 -0
  70. package/dist/presentation/components/CodePreview.d.ts.map +1 -0
  71. package/dist/presentation/components/CodePreview.js +127 -0
  72. package/dist/presentation/components/CodePreview.js.map +1 -0
  73. package/dist/presentation/components/ContextIndicator.d.ts +26 -0
  74. package/dist/presentation/components/ContextIndicator.d.ts.map +1 -0
  75. package/dist/presentation/components/ContextIndicator.js +97 -0
  76. package/dist/presentation/components/ContextIndicator.js.map +1 -0
  77. package/dist/presentation/components/ModelPicker.d.ts +39 -0
  78. package/dist/presentation/components/ModelPicker.d.ts.map +1 -0
  79. package/dist/presentation/components/ModelPicker.js +202 -0
  80. package/dist/presentation/components/ModelPicker.js.map +1 -0
  81. package/dist/presentation/components/index.d.ts +7 -0
  82. package/dist/presentation/components/index.js +8 -0
  83. package/dist/presentation/hooks/index.d.ts +3 -0
  84. package/dist/presentation/hooks/index.js +4 -0
  85. package/dist/presentation/hooks/useChat.d.ts +67 -0
  86. package/dist/presentation/hooks/useChat.d.ts.map +1 -0
  87. package/dist/presentation/hooks/useChat.js +172 -0
  88. package/dist/presentation/hooks/useChat.js.map +1 -0
  89. package/dist/presentation/hooks/useProviders.d.ts +38 -0
  90. package/dist/presentation/hooks/useProviders.d.ts.map +1 -0
  91. package/dist/presentation/hooks/useProviders.js +41 -0
  92. package/dist/presentation/hooks/useProviders.js.map +1 -0
  93. package/dist/presentation/index.d.ts +11 -0
  94. package/dist/presentation/index.js +12 -0
  95. package/dist/providers/chat-utilities.d.ts +15 -0
  96. package/dist/providers/chat-utilities.d.ts.map +1 -0
  97. package/dist/providers/chat-utilities.js +17 -0
  98. package/dist/providers/chat-utilities.js.map +1 -0
  99. package/dist/providers/index.d.ts +3 -0
  100. package/dist/providers/index.js +4 -0
  101. package/dist/schema.d.ts +222 -0
  102. package/dist/schema.d.ts.map +1 -0
  103. package/dist/schema.js +102 -0
  104. package/dist/schema.js.map +1 -0
  105. package/package.json +80 -0
package/dist/schema.js ADDED
@@ -0,0 +1,102 @@
1
+ import { ScalarTypeEnum } from "./libs/schema/dist/ScalarTypeEnum.js";
2
+ import { defineSchemaModel } from "./libs/schema/dist/SchemaModel.js";
3
+ import "./libs/schema/dist/index.js";
4
+
5
+ //#region src/schema.ts
6
+ const ChatMessageModel = defineSchemaModel({
7
+ name: "ChatMessage",
8
+ fields: {
9
+ id: {
10
+ type: ScalarTypeEnum.String_unsecure(),
11
+ isOptional: false
12
+ },
13
+ role: {
14
+ type: ScalarTypeEnum.String_unsecure(),
15
+ isOptional: false
16
+ },
17
+ content: {
18
+ type: ScalarTypeEnum.String_unsecure(),
19
+ isOptional: false
20
+ },
21
+ status: {
22
+ type: ScalarTypeEnum.String_unsecure(),
23
+ isOptional: false
24
+ },
25
+ createdAt: {
26
+ type: ScalarTypeEnum.DateTime(),
27
+ isOptional: false
28
+ }
29
+ }
30
+ });
31
+ const ChatConversationModel = defineSchemaModel({
32
+ name: "ChatConversation",
33
+ fields: {
34
+ id: {
35
+ type: ScalarTypeEnum.String_unsecure(),
36
+ isOptional: false
37
+ },
38
+ title: {
39
+ type: ScalarTypeEnum.String_unsecure(),
40
+ isOptional: true
41
+ },
42
+ status: {
43
+ type: ScalarTypeEnum.String_unsecure(),
44
+ isOptional: false
45
+ },
46
+ messages: {
47
+ type: ChatMessageModel,
48
+ isArray: true,
49
+ isOptional: false
50
+ },
51
+ provider: {
52
+ type: ScalarTypeEnum.String_unsecure(),
53
+ isOptional: false
54
+ },
55
+ model: {
56
+ type: ScalarTypeEnum.String_unsecure(),
57
+ isOptional: false
58
+ }
59
+ }
60
+ });
61
+ const SendMessageInputModel = defineSchemaModel({
62
+ name: "SendMessageInput",
63
+ fields: {
64
+ conversationId: {
65
+ type: ScalarTypeEnum.String_unsecure(),
66
+ isOptional: true
67
+ },
68
+ content: {
69
+ type: ScalarTypeEnum.String_unsecure(),
70
+ isOptional: false
71
+ },
72
+ stream: {
73
+ type: ScalarTypeEnum.Boolean(),
74
+ isOptional: true
75
+ }
76
+ }
77
+ });
78
+ const SendMessageOutputModel = defineSchemaModel({
79
+ name: "SendMessageOutput",
80
+ fields: {
81
+ message: {
82
+ type: ChatMessageModel,
83
+ isOptional: false
84
+ },
85
+ conversation: {
86
+ type: ChatConversationModel,
87
+ isOptional: false
88
+ }
89
+ }
90
+ });
91
+ const ListConversationsOutputModel = defineSchemaModel({
92
+ name: "ListConversationsOutput",
93
+ fields: { conversations: {
94
+ type: ChatConversationModel,
95
+ isArray: true,
96
+ isOptional: false
97
+ } }
98
+ });
99
+
100
+ //#endregion
101
+ export { ChatConversationModel, ChatMessageModel, ListConversationsOutputModel, SendMessageInputModel, SendMessageOutputModel };
102
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\n\nexport const ChatMessageModel = defineSchemaModel({\n name: 'ChatMessage',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n role: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const ChatConversationModel = defineSchemaModel({\n name: 'ChatConversation',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n messages: { type: ChatMessageModel, isArray: true, isOptional: false },\n provider: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n model: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const SendMessageInputModel = defineSchemaModel({\n name: 'SendMessageInput',\n fields: {\n conversationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stream: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\nexport const SendMessageOutputModel = defineSchemaModel({\n name: 'SendMessageOutput',\n fields: {\n message: { type: ChatMessageModel, isOptional: false },\n conversation: { type: ChatConversationModel, isOptional: false },\n },\n});\n\nexport const ListConversationsOutputModel = defineSchemaModel({\n name: 'ListConversationsOutput',\n fields: {\n conversations: {\n type: ChatConversationModel,\n isArray: true,\n isOptional: false,\n },\n },\n});\n"],"mappings":";;;;;AAEA,MAAa,mBAAmB,kBAAkB;CAChD,MAAM;CACN,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,UAAU;GAAE,MAAM;GAAkB,SAAS;GAAM,YAAY;GAAO;EACtE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE;CACF,CAAC;AAEF,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,QAAQ;EACN,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAM;EAC7D;CACF,CAAC;AAEF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM;GAAkB,YAAY;GAAO;EACtD,cAAc;GAAE,MAAM;GAAuB,YAAY;GAAO;EACjE;CACF,CAAC;AAEF,MAAa,+BAA+B,kBAAkB;CAC5D,MAAM;CACN,QAAQ,EACN,eAAe;EACb,MAAM;EACN,SAAS;EACT,YAAY;EACb,EACF;CACF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@contractspec/module.ai-chat",
3
+ "version": "1.44.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "scripts": {
13
+ "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
14
+ "publish:pkg:canary": "bun publish:pkg --tag canary",
15
+ "build": "bun build:types && bun build:bundle",
16
+ "build:bundle": "tsdown",
17
+ "build:types": "tsc --noEmit",
18
+ "dev": "bun build:bundle --watch",
19
+ "clean": "rimraf dist .turbo",
20
+ "lint": "bun lint:fix",
21
+ "lint:fix": "eslint src --fix",
22
+ "lint:check": "eslint src",
23
+ "test": "bun test"
24
+ },
25
+ "dependencies": {
26
+ "@contractspec/lib.ai-agent": "1.44.0",
27
+ "@contractspec/lib.ai-providers": "1.44.0",
28
+ "@contractspec/lib.contracts": "1.44.0",
29
+ "@contractspec/lib.metering": "1.44.0",
30
+ "@contractspec/lib.cost-tracking": "1.44.0",
31
+ "@contractspec/lib.design-system": "1.44.0",
32
+ "@contractspec/lib.ui-kit-web": "1.44.0",
33
+ "@ai-sdk/react": "3.0.3",
34
+ "ai": "6.0.3",
35
+ "lucide-react": "^0.562.0",
36
+ "react": "19.2.3",
37
+ "zod": "^4.1.13"
38
+ },
39
+ "devDependencies": {
40
+ "@contractspec/tool.tsdown": "1.44.0",
41
+ "@contractspec/tool.typescript": "1.44.0",
42
+ "@types/react": "^19.0.14",
43
+ "tsdown": "^0.18.3",
44
+ "typescript": "^5.9.3"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=18.0.0"
48
+ },
49
+ "exports": {
50
+ ".": "./dist/index.js",
51
+ "./context": "./dist/context/index.js",
52
+ "./core": "./dist/core/index.js",
53
+ "./presentation": "./dist/presentation/index.js",
54
+ "./presentation/components": "./dist/presentation/components/index.js",
55
+ "./presentation/hooks": "./dist/presentation/hooks/index.js",
56
+ "./providers": "./dist/providers/index.js",
57
+ "./*": "./*"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public",
61
+ "exports": {
62
+ ".": "./dist/index.js",
63
+ "./context": "./dist/context/index.js",
64
+ "./core": "./dist/core/index.js",
65
+ "./presentation": "./dist/presentation/index.js",
66
+ "./presentation/components": "./dist/presentation/components/index.js",
67
+ "./presentation/hooks": "./dist/presentation/hooks/index.js",
68
+ "./providers": "./dist/providers/index.js",
69
+ "./*": "./*"
70
+ },
71
+ "registry": "https://registry.npmjs.org/"
72
+ },
73
+ "license": "MIT",
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "https://github.com/lssm-tech/contractspec.git",
77
+ "directory": "packages/modules/ai-chat"
78
+ },
79
+ "homepage": "https://contractspec.io"
80
+ }