@larkup/workspace-server 0.0.0-stage → 0.2.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.
- package/LICENSE +176 -0
- package/README.md +2 -2
- package/dist-types/app/api/chat/feedback/route.d.ts +4 -0
- package/dist-types/app/api/chat/feedback/route.d.ts.map +1 -0
- package/dist-types/app/api/chat/route.d.ts +3 -0
- package/dist-types/app/api/chat/route.d.ts.map +1 -0
- package/dist-types/app/api/chat/tools.d.ts +67 -0
- package/dist-types/app/api/chat/tools.d.ts.map +1 -0
- package/dist-types/app/api/config/test-embedding/route.d.ts +3 -0
- package/dist-types/app/api/config/test-embedding/route.d.ts.map +1 -0
- package/dist-types/app/api/config/verify/route.d.ts +3 -0
- package/dist-types/app/api/config/verify/route.d.ts.map +1 -0
- package/dist-types/app/api/describe-image/route.d.ts +4 -0
- package/dist-types/app/api/describe-image/route.d.ts.map +1 -0
- package/dist-types/app/api/doc-editor/edit/route.d.ts +10 -0
- package/dist-types/app/api/doc-editor/edit/route.d.ts.map +1 -0
- package/dist-types/app/api/doc-editor/export/route.d.ts +9 -0
- package/dist-types/app/api/doc-editor/export/route.d.ts.map +1 -0
- package/dist-types/app/api/doc-editor/parse/route.d.ts +10 -0
- package/dist-types/app/api/doc-editor/parse/route.d.ts.map +1 -0
- package/dist-types/app/api/doc-editor/restore/route.d.ts +2 -0
- package/dist-types/app/api/doc-editor/restore/route.d.ts.map +1 -0
- package/dist-types/app/api/document/sign/route.d.ts +2 -0
- package/dist-types/app/api/document/sign/route.d.ts.map +1 -0
- package/dist-types/app/api/files/remote/route.d.ts +5 -0
- package/dist-types/app/api/files/remote/route.d.ts.map +1 -0
- package/dist-types/app/api/mcp/[connectionId]/route.d.ts +9 -0
- package/dist-types/app/api/mcp/[connectionId]/route.d.ts.map +1 -0
- package/dist-types/app/api/mcp/[connectionId]/test/route.d.ts +8 -0
- package/dist-types/app/api/mcp/[connectionId]/test/route.d.ts.map +1 -0
- package/dist-types/app/api/mcp/route.d.ts +4 -0
- package/dist-types/app/api/mcp/route.d.ts.map +1 -0
- package/dist-types/app/api/parse-file/route.d.ts +6 -0
- package/dist-types/app/api/parse-file/route.d.ts.map +1 -0
- package/dist-types/app/api/pdf-page/route.d.ts +4 -0
- package/dist-types/app/api/pdf-page/route.d.ts.map +1 -0
- package/dist-types/app/api/proxy/verify/route.d.ts +4 -0
- package/dist-types/app/api/proxy/verify/route.d.ts.map +1 -0
- package/dist-types/app/api/search/bing/route.d.ts +5 -0
- package/dist-types/app/api/search/bing/route.d.ts.map +1 -0
- package/dist-types/app/api/search/brave/route.d.ts +5 -0
- package/dist-types/app/api/search/brave/route.d.ts.map +1 -0
- package/dist-types/app/api/search/exa/route.d.ts +5 -0
- package/dist-types/app/api/search/exa/route.d.ts.map +1 -0
- package/dist-types/app/api/search/google/route.d.ts +30 -0
- package/dist-types/app/api/search/google/route.d.ts.map +1 -0
- package/dist-types/app/api/search/route.d.ts +7 -0
- package/dist-types/app/api/search/route.d.ts.map +1 -0
- package/dist-types/app/api/search/tavily/route.d.ts +5 -0
- package/dist-types/app/api/search/tavily/route.d.ts.map +1 -0
- package/dist-types/app/api/search/verify/route.d.ts +4 -0
- package/dist-types/app/api/search/verify/route.d.ts.map +1 -0
- package/dist-types/app/api/tabular/route.d.ts +9 -0
- package/dist-types/app/api/tabular/route.d.ts.map +1 -0
- package/dist-types/lib/chat/assistant-source-scope.d.ts +10 -0
- package/dist-types/lib/chat/assistant-source-scope.d.ts.map +1 -0
- package/dist-types/lib/chat/conversation-memory.d.ts +80 -0
- package/dist-types/lib/chat/conversation-memory.d.ts.map +1 -0
- package/dist-types/lib/chat/gateway-fallbacks.d.ts +7 -0
- package/dist-types/lib/chat/gateway-fallbacks.d.ts.map +1 -0
- package/dist-types/lib/chat/image-description.d.ts +10 -0
- package/dist-types/lib/chat/image-description.d.ts.map +1 -0
- package/dist-types/lib/chat/media-retrieval-routing.d.ts +14 -0
- package/dist-types/lib/chat/media-retrieval-routing.d.ts.map +1 -0
- package/dist-types/lib/chat/media-source-routing.d.ts +53 -0
- package/dist-types/lib/chat/media-source-routing.d.ts.map +1 -0
- package/dist-types/lib/chat/message-input.d.ts +8 -0
- package/dist-types/lib/chat/message-input.d.ts.map +1 -0
- package/dist-types/lib/chat/model-provider.d.ts +23 -0
- package/dist-types/lib/chat/model-provider.d.ts.map +1 -0
- package/dist-types/lib/chat/response-style.d.ts +2 -0
- package/dist-types/lib/chat/response-style.d.ts.map +1 -0
- package/dist-types/lib/chat/retrieval-ranking.d.ts +32 -0
- package/dist-types/lib/chat/retrieval-ranking.d.ts.map +1 -0
- package/dist-types/lib/chat/retrieval-routing.d.ts +39 -0
- package/dist-types/lib/chat/retrieval-routing.d.ts.map +1 -0
- package/dist-types/lib/chat/tabular-dataset-routing.d.ts +15 -0
- package/dist-types/lib/chat/tabular-dataset-routing.d.ts.map +1 -0
- package/dist-types/lib/chat/tabular-query-plan.d.ts +12 -0
- package/dist-types/lib/chat/tabular-query-plan.d.ts.map +1 -0
- package/dist-types/lib/chat/tabular-routing.d.ts +41 -0
- package/dist-types/lib/chat/tabular-routing.d.ts.map +1 -0
- package/dist-types/lib/chat/tabular-sandbox-files.d.ts +33 -0
- package/dist-types/lib/chat/tabular-sandbox-files.d.ts.map +1 -0
- package/dist-types/lib/chat/tabular-visualization.d.ts +31 -0
- package/dist-types/lib/chat/tabular-visualization.d.ts.map +1 -0
- package/dist-types/lib/chat/tool-call-repair.d.ts +11 -0
- package/dist-types/lib/chat/tool-call-repair.d.ts.map +1 -0
- package/dist-types/lib/chat/tool-context.d.ts +72 -0
- package/dist-types/lib/chat/tool-context.d.ts.map +1 -0
- package/dist-types/lib/chat/tool-registry.d.ts +3 -0
- package/dist-types/lib/chat/tool-registry.d.ts.map +1 -0
- package/dist-types/lib/chat/video-rag-routing.d.ts +33 -0
- package/dist-types/lib/chat/video-rag-routing.d.ts.map +1 -0
- package/dist-types/lib/chat/visual-routing.d.ts +53 -0
- package/dist-types/lib/chat/visual-routing.d.ts.map +1 -0
- package/dist-types/lib/enterprise-client.d.ts +31 -0
- package/dist-types/lib/enterprise-client.d.ts.map +1 -0
- package/dist-types/lib/marketplace/tool-runtime-config.d.ts +7 -0
- package/dist-types/lib/marketplace/tool-runtime-config.d.ts.map +1 -0
- package/dist-types/lib/media/knowledge.d.ts +47 -0
- package/dist-types/lib/media/knowledge.d.ts.map +1 -0
- package/dist-types/lib/media/pdf-inspection.d.ts +30 -0
- package/dist-types/lib/media/pdf-inspection.d.ts.map +1 -0
- package/dist-types/lib/media/source-identity.d.ts +12 -0
- package/dist-types/lib/media/source-identity.d.ts.map +1 -0
- package/dist-types/lib/media/source-utils.d.ts +157 -0
- package/dist-types/lib/media/source-utils.d.ts.map +1 -0
- package/dist-types/lib/media/video/quick-look.d.ts +60 -0
- package/dist-types/lib/media/video/quick-look.d.ts.map +1 -0
- package/dist-types/lib/media/video-intelligence-adapter.d.ts +521 -0
- package/dist-types/lib/media/video-intelligence-adapter.d.ts.map +1 -0
- package/dist-types/lib/media/video-intelligence-connection.d.ts +32 -0
- package/dist-types/lib/media/video-intelligence-connection.d.ts.map +1 -0
- package/dist-types/lib/remote-files.d.ts +12 -0
- package/dist-types/lib/remote-files.d.ts.map +1 -0
- package/dist-types/lib/search/provider-verification.d.ts +5 -0
- package/dist-types/lib/search/provider-verification.d.ts.map +1 -0
- package/dist-types/runtime-host.d.ts +20 -0
- package/dist-types/runtime-host.d.ts.map +1 -0
- package/package.json +338 -3
- package/src/app/api/chat/feedback/route.ts +77 -0
- package/src/app/api/chat/route.ts +2277 -0
- package/src/app/api/chat/tools.ts +3563 -0
- package/src/app/api/config/test-embedding/route.ts +39 -0
- package/src/app/api/config/verify/route.ts +309 -0
- package/src/app/api/describe-image/route.ts +108 -0
- package/src/app/api/doc-editor/edit/route.ts +87 -0
- package/src/app/api/doc-editor/export/route.ts +32 -0
- package/src/app/api/doc-editor/parse/route.ts +74 -0
- package/src/app/api/doc-editor/restore/route.ts +70 -0
- package/src/app/api/document/sign/route.ts +55 -0
- package/src/app/api/files/remote/route.ts +32 -0
- package/src/app/api/mcp/[connectionId]/route.ts +29 -0
- package/src/app/api/mcp/[connectionId]/test/route.ts +13 -0
- package/src/app/api/mcp/route.ts +22 -0
- package/src/app/api/parse-file/route.ts +86 -0
- package/src/app/api/pdf-page/route.ts +40 -0
- package/src/app/api/proxy/verify/route.ts +78 -0
- package/src/app/api/search/bing/route.ts +86 -0
- package/src/app/api/search/brave/route.ts +88 -0
- package/src/app/api/search/exa/route.ts +100 -0
- package/src/app/api/search/google/route.ts +147 -0
- package/src/app/api/search/route.ts +28 -0
- package/src/app/api/search/tavily/route.ts +93 -0
- package/src/app/api/search/verify/route.ts +27 -0
- package/src/app/api/tabular/route.ts +68 -0
- package/src/lib/chat/assistant-source-scope.ts +32 -0
- package/src/lib/chat/conversation-memory.ts +621 -0
- package/src/lib/chat/gateway-fallbacks.ts +12 -0
- package/src/lib/chat/image-description.ts +21 -0
- package/src/lib/chat/media-retrieval-routing.ts +37 -0
- package/src/lib/chat/media-source-routing.ts +100 -0
- package/src/lib/chat/message-input.ts +48 -0
- package/src/lib/chat/model-provider.ts +157 -0
- package/src/lib/chat/response-style.ts +3 -0
- package/src/lib/chat/retrieval-ranking.ts +126 -0
- package/src/lib/chat/retrieval-routing.ts +221 -0
- package/src/lib/chat/tabular-dataset-routing.ts +93 -0
- package/src/lib/chat/tabular-query-plan.ts +195 -0
- package/src/lib/chat/tabular-routing.ts +122 -0
- package/src/lib/chat/tabular-sandbox-files.ts +78 -0
- package/src/lib/chat/tabular-visualization.ts +165 -0
- package/src/lib/chat/tool-call-repair.ts +84 -0
- package/src/lib/chat/tool-context.ts +1222 -0
- package/src/lib/chat/tool-registry.ts +6 -0
- package/src/lib/chat/video-rag-routing.ts +149 -0
- package/src/lib/chat/visual-routing.ts +225 -0
- package/src/lib/enterprise-client.ts +96 -0
- package/src/lib/marketplace/tool-runtime-config.ts +155 -0
- package/src/lib/media/knowledge.ts +489 -0
- package/src/lib/media/pdf-inspection.ts +280 -0
- package/src/lib/media/source-identity.ts +50 -0
- package/src/lib/media/source-utils.ts +1156 -0
- package/src/lib/media/video/quick-look.ts +368 -0
- package/src/lib/media/video-intelligence-adapter.ts +1946 -0
- package/src/lib/media/video-intelligence-connection.ts +151 -0
- package/src/lib/remote-files.ts +182 -0
- package/src/lib/search/provider-verification.ts +95 -0
- package/src/runtime-host.ts +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,341 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup/workspace-server",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"src",
|
|
7
|
+
"README.md",
|
|
8
|
+
"dist-types"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
"./app/api/chat/route": {
|
|
12
|
+
"types": "./dist-types/app/api/chat/route.d.ts",
|
|
13
|
+
"import": "./src/app/api/chat/route.ts",
|
|
14
|
+
"default": "./src/app/api/chat/route.ts"
|
|
15
|
+
},
|
|
16
|
+
"./app/api/chat/tools": {
|
|
17
|
+
"types": "./dist-types/app/api/chat/tools.d.ts",
|
|
18
|
+
"import": "./src/app/api/chat/tools.ts",
|
|
19
|
+
"default": "./src/app/api/chat/tools.ts"
|
|
20
|
+
},
|
|
21
|
+
"./app/api/search/bing/route": {
|
|
22
|
+
"types": "./dist-types/app/api/search/bing/route.d.ts",
|
|
23
|
+
"import": "./src/app/api/search/bing/route.ts",
|
|
24
|
+
"default": "./src/app/api/search/bing/route.ts"
|
|
25
|
+
},
|
|
26
|
+
"./app/api/search/brave/route": {
|
|
27
|
+
"types": "./dist-types/app/api/search/brave/route.d.ts",
|
|
28
|
+
"import": "./src/app/api/search/brave/route.ts",
|
|
29
|
+
"default": "./src/app/api/search/brave/route.ts"
|
|
30
|
+
},
|
|
31
|
+
"./app/api/search/exa/route": {
|
|
32
|
+
"types": "./dist-types/app/api/search/exa/route.d.ts",
|
|
33
|
+
"import": "./src/app/api/search/exa/route.ts",
|
|
34
|
+
"default": "./src/app/api/search/exa/route.ts"
|
|
35
|
+
},
|
|
36
|
+
"./app/api/search/google/route": {
|
|
37
|
+
"types": "./dist-types/app/api/search/google/route.d.ts",
|
|
38
|
+
"import": "./src/app/api/search/google/route.ts",
|
|
39
|
+
"default": "./src/app/api/search/google/route.ts"
|
|
40
|
+
},
|
|
41
|
+
"./app/api/search/route": {
|
|
42
|
+
"types": "./dist-types/app/api/search/route.d.ts",
|
|
43
|
+
"import": "./src/app/api/search/route.ts",
|
|
44
|
+
"default": "./src/app/api/search/route.ts"
|
|
45
|
+
},
|
|
46
|
+
"./app/api/search/tavily/route": {
|
|
47
|
+
"types": "./dist-types/app/api/search/tavily/route.d.ts",
|
|
48
|
+
"import": "./src/app/api/search/tavily/route.ts",
|
|
49
|
+
"default": "./src/app/api/search/tavily/route.ts"
|
|
50
|
+
},
|
|
51
|
+
"./lib/chat/assistant-source-scope": {
|
|
52
|
+
"types": "./dist-types/lib/chat/assistant-source-scope.d.ts",
|
|
53
|
+
"import": "./src/lib/chat/assistant-source-scope.ts",
|
|
54
|
+
"default": "./src/lib/chat/assistant-source-scope.ts"
|
|
55
|
+
},
|
|
56
|
+
"./lib/chat/conversation-memory": {
|
|
57
|
+
"types": "./dist-types/lib/chat/conversation-memory.d.ts",
|
|
58
|
+
"import": "./src/lib/chat/conversation-memory.ts",
|
|
59
|
+
"default": "./src/lib/chat/conversation-memory.ts"
|
|
60
|
+
},
|
|
61
|
+
"./lib/chat/gateway-fallbacks": {
|
|
62
|
+
"types": "./dist-types/lib/chat/gateway-fallbacks.d.ts",
|
|
63
|
+
"import": "./src/lib/chat/gateway-fallbacks.ts",
|
|
64
|
+
"default": "./src/lib/chat/gateway-fallbacks.ts"
|
|
65
|
+
},
|
|
66
|
+
"./lib/chat/media-retrieval-routing": {
|
|
67
|
+
"types": "./dist-types/lib/chat/media-retrieval-routing.d.ts",
|
|
68
|
+
"import": "./src/lib/chat/media-retrieval-routing.ts",
|
|
69
|
+
"default": "./src/lib/chat/media-retrieval-routing.ts"
|
|
70
|
+
},
|
|
71
|
+
"./lib/chat/media-source-routing": {
|
|
72
|
+
"types": "./dist-types/lib/chat/media-source-routing.d.ts",
|
|
73
|
+
"import": "./src/lib/chat/media-source-routing.ts",
|
|
74
|
+
"default": "./src/lib/chat/media-source-routing.ts"
|
|
75
|
+
},
|
|
76
|
+
"./lib/chat/message-input": {
|
|
77
|
+
"types": "./dist-types/lib/chat/message-input.d.ts",
|
|
78
|
+
"import": "./src/lib/chat/message-input.ts",
|
|
79
|
+
"default": "./src/lib/chat/message-input.ts"
|
|
80
|
+
},
|
|
81
|
+
"./lib/chat/model-provider": {
|
|
82
|
+
"types": "./dist-types/lib/chat/model-provider.d.ts",
|
|
83
|
+
"import": "./src/lib/chat/model-provider.ts",
|
|
84
|
+
"default": "./src/lib/chat/model-provider.ts"
|
|
85
|
+
},
|
|
86
|
+
"./lib/chat/response-style": {
|
|
87
|
+
"types": "./dist-types/lib/chat/response-style.d.ts",
|
|
88
|
+
"import": "./src/lib/chat/response-style.ts",
|
|
89
|
+
"default": "./src/lib/chat/response-style.ts"
|
|
90
|
+
},
|
|
91
|
+
"./lib/chat/retrieval-ranking": {
|
|
92
|
+
"types": "./dist-types/lib/chat/retrieval-ranking.d.ts",
|
|
93
|
+
"import": "./src/lib/chat/retrieval-ranking.ts",
|
|
94
|
+
"default": "./src/lib/chat/retrieval-ranking.ts"
|
|
95
|
+
},
|
|
96
|
+
"./lib/chat/retrieval-routing": {
|
|
97
|
+
"types": "./dist-types/lib/chat/retrieval-routing.d.ts",
|
|
98
|
+
"import": "./src/lib/chat/retrieval-routing.ts",
|
|
99
|
+
"default": "./src/lib/chat/retrieval-routing.ts"
|
|
100
|
+
},
|
|
101
|
+
"./lib/chat/tabular-dataset-routing": {
|
|
102
|
+
"types": "./dist-types/lib/chat/tabular-dataset-routing.d.ts",
|
|
103
|
+
"import": "./src/lib/chat/tabular-dataset-routing.ts",
|
|
104
|
+
"default": "./src/lib/chat/tabular-dataset-routing.ts"
|
|
105
|
+
},
|
|
106
|
+
"./lib/chat/tabular-query-plan": {
|
|
107
|
+
"types": "./dist-types/lib/chat/tabular-query-plan.d.ts",
|
|
108
|
+
"import": "./src/lib/chat/tabular-query-plan.ts",
|
|
109
|
+
"default": "./src/lib/chat/tabular-query-plan.ts"
|
|
110
|
+
},
|
|
111
|
+
"./lib/chat/tabular-routing": {
|
|
112
|
+
"types": "./dist-types/lib/chat/tabular-routing.d.ts",
|
|
113
|
+
"import": "./src/lib/chat/tabular-routing.ts",
|
|
114
|
+
"default": "./src/lib/chat/tabular-routing.ts"
|
|
115
|
+
},
|
|
116
|
+
"./lib/chat/tabular-sandbox-files": {
|
|
117
|
+
"types": "./dist-types/lib/chat/tabular-sandbox-files.d.ts",
|
|
118
|
+
"import": "./src/lib/chat/tabular-sandbox-files.ts",
|
|
119
|
+
"default": "./src/lib/chat/tabular-sandbox-files.ts"
|
|
120
|
+
},
|
|
121
|
+
"./lib/chat/tabular-visualization": {
|
|
122
|
+
"types": "./dist-types/lib/chat/tabular-visualization.d.ts",
|
|
123
|
+
"import": "./src/lib/chat/tabular-visualization.ts",
|
|
124
|
+
"default": "./src/lib/chat/tabular-visualization.ts"
|
|
125
|
+
},
|
|
126
|
+
"./lib/chat/tool-call-repair": {
|
|
127
|
+
"types": "./dist-types/lib/chat/tool-call-repair.d.ts",
|
|
128
|
+
"import": "./src/lib/chat/tool-call-repair.ts",
|
|
129
|
+
"default": "./src/lib/chat/tool-call-repair.ts"
|
|
130
|
+
},
|
|
131
|
+
"./lib/chat/tool-context": {
|
|
132
|
+
"types": "./dist-types/lib/chat/tool-context.d.ts",
|
|
133
|
+
"import": "./src/lib/chat/tool-context.ts",
|
|
134
|
+
"default": "./src/lib/chat/tool-context.ts"
|
|
135
|
+
},
|
|
136
|
+
"./lib/chat/tool-registry": {
|
|
137
|
+
"types": "./dist-types/lib/chat/tool-registry.d.ts",
|
|
138
|
+
"import": "./src/lib/chat/tool-registry.ts",
|
|
139
|
+
"default": "./src/lib/chat/tool-registry.ts"
|
|
140
|
+
},
|
|
141
|
+
"./lib/chat/video-rag-routing": {
|
|
142
|
+
"types": "./dist-types/lib/chat/video-rag-routing.d.ts",
|
|
143
|
+
"import": "./src/lib/chat/video-rag-routing.ts",
|
|
144
|
+
"default": "./src/lib/chat/video-rag-routing.ts"
|
|
145
|
+
},
|
|
146
|
+
"./lib/chat/visual-routing": {
|
|
147
|
+
"types": "./dist-types/lib/chat/visual-routing.d.ts",
|
|
148
|
+
"import": "./src/lib/chat/visual-routing.ts",
|
|
149
|
+
"default": "./src/lib/chat/visual-routing.ts"
|
|
150
|
+
},
|
|
151
|
+
"./lib/enterprise-client": {
|
|
152
|
+
"types": "./dist-types/lib/enterprise-client.d.ts",
|
|
153
|
+
"import": "./src/lib/enterprise-client.ts",
|
|
154
|
+
"default": "./src/lib/enterprise-client.ts"
|
|
155
|
+
},
|
|
156
|
+
"./lib/marketplace/tool-runtime-config": {
|
|
157
|
+
"types": "./dist-types/lib/marketplace/tool-runtime-config.d.ts",
|
|
158
|
+
"import": "./src/lib/marketplace/tool-runtime-config.ts",
|
|
159
|
+
"default": "./src/lib/marketplace/tool-runtime-config.ts"
|
|
160
|
+
},
|
|
161
|
+
"./lib/media/knowledge": {
|
|
162
|
+
"types": "./dist-types/lib/media/knowledge.d.ts",
|
|
163
|
+
"import": "./src/lib/media/knowledge.ts",
|
|
164
|
+
"default": "./src/lib/media/knowledge.ts"
|
|
165
|
+
},
|
|
166
|
+
"./lib/media/pdf-inspection": {
|
|
167
|
+
"types": "./dist-types/lib/media/pdf-inspection.d.ts",
|
|
168
|
+
"import": "./src/lib/media/pdf-inspection.ts",
|
|
169
|
+
"default": "./src/lib/media/pdf-inspection.ts"
|
|
170
|
+
},
|
|
171
|
+
"./lib/media/source-identity": {
|
|
172
|
+
"types": "./dist-types/lib/media/source-identity.d.ts",
|
|
173
|
+
"import": "./src/lib/media/source-identity.ts",
|
|
174
|
+
"default": "./src/lib/media/source-identity.ts"
|
|
175
|
+
},
|
|
176
|
+
"./lib/media/source-utils": {
|
|
177
|
+
"types": "./dist-types/lib/media/source-utils.d.ts",
|
|
178
|
+
"import": "./src/lib/media/source-utils.ts",
|
|
179
|
+
"default": "./src/lib/media/source-utils.ts"
|
|
180
|
+
},
|
|
181
|
+
"./lib/media/video/quick-look": {
|
|
182
|
+
"types": "./dist-types/lib/media/video/quick-look.d.ts",
|
|
183
|
+
"import": "./src/lib/media/video/quick-look.ts",
|
|
184
|
+
"default": "./src/lib/media/video/quick-look.ts"
|
|
185
|
+
},
|
|
186
|
+
"./lib/media/video-intelligence-adapter": {
|
|
187
|
+
"types": "./dist-types/lib/media/video-intelligence-adapter.d.ts",
|
|
188
|
+
"import": "./src/lib/media/video-intelligence-adapter.ts",
|
|
189
|
+
"default": "./src/lib/media/video-intelligence-adapter.ts"
|
|
190
|
+
},
|
|
191
|
+
"./lib/media/video-intelligence-connection": {
|
|
192
|
+
"types": "./dist-types/lib/media/video-intelligence-connection.d.ts",
|
|
193
|
+
"import": "./src/lib/media/video-intelligence-connection.ts",
|
|
194
|
+
"default": "./src/lib/media/video-intelligence-connection.ts"
|
|
195
|
+
},
|
|
196
|
+
"./runtime-host": {
|
|
197
|
+
"types": "./dist-types/runtime-host.d.ts",
|
|
198
|
+
"import": "./src/runtime-host.ts",
|
|
199
|
+
"default": "./src/runtime-host.ts"
|
|
200
|
+
},
|
|
201
|
+
"./app/api/tabular/route": {
|
|
202
|
+
"types": "./dist-types/app/api/tabular/route.d.ts",
|
|
203
|
+
"import": "./src/app/api/tabular/route.ts",
|
|
204
|
+
"default": "./src/app/api/tabular/route.ts"
|
|
205
|
+
},
|
|
206
|
+
"./app/api/parse-file/route": {
|
|
207
|
+
"types": "./dist-types/app/api/parse-file/route.d.ts",
|
|
208
|
+
"import": "./src/app/api/parse-file/route.ts",
|
|
209
|
+
"default": "./src/app/api/parse-file/route.ts"
|
|
210
|
+
},
|
|
211
|
+
"./app/api/chat/feedback/route": {
|
|
212
|
+
"types": "./dist-types/app/api/chat/feedback/route.d.ts",
|
|
213
|
+
"import": "./src/app/api/chat/feedback/route.ts",
|
|
214
|
+
"default": "./src/app/api/chat/feedback/route.ts"
|
|
215
|
+
},
|
|
216
|
+
"./app/api/config/verify/route": {
|
|
217
|
+
"types": "./dist-types/app/api/config/verify/route.d.ts",
|
|
218
|
+
"import": "./src/app/api/config/verify/route.ts",
|
|
219
|
+
"default": "./src/app/api/config/verify/route.ts"
|
|
220
|
+
},
|
|
221
|
+
"./app/api/config/test-embedding/route": {
|
|
222
|
+
"types": "./dist-types/app/api/config/test-embedding/route.d.ts",
|
|
223
|
+
"import": "./src/app/api/config/test-embedding/route.ts",
|
|
224
|
+
"default": "./src/app/api/config/test-embedding/route.ts"
|
|
225
|
+
},
|
|
226
|
+
"./app/api/proxy/verify/route": {
|
|
227
|
+
"types": "./dist-types/app/api/proxy/verify/route.d.ts",
|
|
228
|
+
"import": "./src/app/api/proxy/verify/route.ts",
|
|
229
|
+
"default": "./src/app/api/proxy/verify/route.ts"
|
|
230
|
+
},
|
|
231
|
+
"./lib/chat/image-description": {
|
|
232
|
+
"types": "./dist-types/lib/chat/image-description.d.ts",
|
|
233
|
+
"import": "./src/lib/chat/image-description.ts",
|
|
234
|
+
"default": "./src/lib/chat/image-description.ts"
|
|
235
|
+
},
|
|
236
|
+
"./app/api/describe-image/route": {
|
|
237
|
+
"types": "./dist-types/app/api/describe-image/route.d.ts",
|
|
238
|
+
"import": "./src/app/api/describe-image/route.ts",
|
|
239
|
+
"default": "./src/app/api/describe-image/route.ts"
|
|
240
|
+
},
|
|
241
|
+
"./app/api/doc-editor/parse/route": {
|
|
242
|
+
"types": "./dist-types/app/api/doc-editor/parse/route.d.ts",
|
|
243
|
+
"import": "./src/app/api/doc-editor/parse/route.ts",
|
|
244
|
+
"default": "./src/app/api/doc-editor/parse/route.ts"
|
|
245
|
+
},
|
|
246
|
+
"./app/api/doc-editor/edit/route": {
|
|
247
|
+
"types": "./dist-types/app/api/doc-editor/edit/route.d.ts",
|
|
248
|
+
"import": "./src/app/api/doc-editor/edit/route.ts",
|
|
249
|
+
"default": "./src/app/api/doc-editor/edit/route.ts"
|
|
250
|
+
},
|
|
251
|
+
"./app/api/doc-editor/export/route": {
|
|
252
|
+
"types": "./dist-types/app/api/doc-editor/export/route.d.ts",
|
|
253
|
+
"import": "./src/app/api/doc-editor/export/route.ts",
|
|
254
|
+
"default": "./src/app/api/doc-editor/export/route.ts"
|
|
255
|
+
},
|
|
256
|
+
"./app/api/doc-editor/restore/route": {
|
|
257
|
+
"types": "./dist-types/app/api/doc-editor/restore/route.d.ts",
|
|
258
|
+
"import": "./src/app/api/doc-editor/restore/route.ts",
|
|
259
|
+
"default": "./src/app/api/doc-editor/restore/route.ts"
|
|
260
|
+
},
|
|
261
|
+
"./app/api/document/sign/route": {
|
|
262
|
+
"types": "./dist-types/app/api/document/sign/route.d.ts",
|
|
263
|
+
"import": "./src/app/api/document/sign/route.ts",
|
|
264
|
+
"default": "./src/app/api/document/sign/route.ts"
|
|
265
|
+
},
|
|
266
|
+
"./lib/search/provider-verification": {
|
|
267
|
+
"types": "./dist-types/lib/search/provider-verification.d.ts",
|
|
268
|
+
"import": "./src/lib/search/provider-verification.ts",
|
|
269
|
+
"default": "./src/lib/search/provider-verification.ts"
|
|
270
|
+
},
|
|
271
|
+
"./app/api/search/verify/route": {
|
|
272
|
+
"types": "./dist-types/app/api/search/verify/route.d.ts",
|
|
273
|
+
"import": "./src/app/api/search/verify/route.ts",
|
|
274
|
+
"default": "./src/app/api/search/verify/route.ts"
|
|
275
|
+
},
|
|
276
|
+
"./app/api/mcp/route": {
|
|
277
|
+
"types": "./dist-types/app/api/mcp/route.d.ts",
|
|
278
|
+
"import": "./src/app/api/mcp/route.ts",
|
|
279
|
+
"default": "./src/app/api/mcp/route.ts"
|
|
280
|
+
},
|
|
281
|
+
"./app/api/mcp/[connectionId]/route": {
|
|
282
|
+
"types": "./dist-types/app/api/mcp/[connectionId]/route.d.ts",
|
|
283
|
+
"import": "./src/app/api/mcp/[connectionId]/route.ts",
|
|
284
|
+
"default": "./src/app/api/mcp/[connectionId]/route.ts"
|
|
285
|
+
},
|
|
286
|
+
"./app/api/mcp/[connectionId]/test/route": {
|
|
287
|
+
"types": "./dist-types/app/api/mcp/[connectionId]/test/route.d.ts",
|
|
288
|
+
"import": "./src/app/api/mcp/[connectionId]/test/route.ts",
|
|
289
|
+
"default": "./src/app/api/mcp/[connectionId]/test/route.ts"
|
|
290
|
+
},
|
|
291
|
+
"./lib/remote-files": {
|
|
292
|
+
"types": "./dist-types/lib/remote-files.d.ts",
|
|
293
|
+
"import": "./src/lib/remote-files.ts",
|
|
294
|
+
"default": "./src/lib/remote-files.ts"
|
|
295
|
+
},
|
|
296
|
+
"./app/api/files/remote/route": {
|
|
297
|
+
"types": "./dist-types/app/api/files/remote/route.d.ts",
|
|
298
|
+
"import": "./src/app/api/files/remote/route.ts",
|
|
299
|
+
"default": "./src/app/api/files/remote/route.ts"
|
|
300
|
+
},
|
|
301
|
+
"./app/api/pdf-page/route": {
|
|
302
|
+
"types": "./dist-types/app/api/pdf-page/route.d.ts",
|
|
303
|
+
"import": "./src/app/api/pdf-page/route.ts",
|
|
304
|
+
"default": "./src/app/api/pdf-page/route.ts"
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"publishConfig": {
|
|
308
|
+
"access": "public"
|
|
309
|
+
},
|
|
310
|
+
"dependencies": {
|
|
311
|
+
"@ffprobe-installer/ffprobe": "2.1.2",
|
|
312
|
+
"@ai-sdk/anthropic": "^4.0.15",
|
|
313
|
+
"@ai-sdk/cohere": "4.0.58",
|
|
314
|
+
"@ai-sdk/deepseek": "3.0.62",
|
|
315
|
+
"@ai-sdk/gateway": "4.0.108",
|
|
316
|
+
"@ai-sdk/google": "4.0.92",
|
|
317
|
+
"@ai-sdk/mistral": "4.0.61",
|
|
318
|
+
"@ai-sdk/openai": "4.0.89",
|
|
319
|
+
"@ai-sdk/openai-compatible": "3.0.66",
|
|
320
|
+
"@larkup/core": "^0.8.1",
|
|
321
|
+
"@larkup/tool-doc-editor": "^0.3.1",
|
|
322
|
+
"ai": "7.0.133",
|
|
323
|
+
"pdf-parse": "2.4.5",
|
|
324
|
+
"zod": "^4.4.3",
|
|
325
|
+
"mammoth": "^1.12.0",
|
|
326
|
+
"@larkup/marketplace": "0.3.10",
|
|
327
|
+
"@larkup/sandbox": "0.1.8",
|
|
328
|
+
"@larkup/scraper": "0.2.1",
|
|
329
|
+
"@larkup/vector-stores": "0.1.27"
|
|
330
|
+
},
|
|
331
|
+
"devDependencies": {
|
|
332
|
+
"typescript": "^7.0.2",
|
|
333
|
+
"tsx": "^4.23.5",
|
|
334
|
+
"@types/node": "^26"
|
|
335
|
+
},
|
|
336
|
+
"scripts": {
|
|
337
|
+
"type-check": "tsc --noEmit",
|
|
338
|
+
"test": "node --import tsx --test tests/*.test.ts",
|
|
339
|
+
"build": "tsc -p tsconfig.build.json"
|
|
340
|
+
}
|
|
6
341
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { readConfig } from '@larkup/core/config-store';
|
|
2
|
+
import { readDocuments } from '@larkup/core/documents-store';
|
|
3
|
+
import { readGroups } from '@larkup/core/groups-store';
|
|
4
|
+
import { filterDocumentsAvailableToAssistant } from '@larkup/core/assistant-data-scope';
|
|
5
|
+
import {
|
|
6
|
+
deleteGroundedAnswerCacheEntry,
|
|
7
|
+
saveGroundedAnswerCacheEntry,
|
|
8
|
+
} from '@larkup/core/grounded-answer-cache';
|
|
9
|
+
import { runWithProject } from '@larkup/core/project-store';
|
|
10
|
+
import { assistantSourceScopeFingerprint } from '@larkup/workspace-server/lib/chat/assistant-source-scope';
|
|
11
|
+
|
|
12
|
+
export const runtime = 'nodejs';
|
|
13
|
+
export const dynamic = 'force-dynamic';
|
|
14
|
+
|
|
15
|
+
const noStoreHeaders = { 'Cache-Control': 'no-store' };
|
|
16
|
+
|
|
17
|
+
export async function POST(request: Request) {
|
|
18
|
+
try {
|
|
19
|
+
const body = (await request.json()) as Record<string, unknown>;
|
|
20
|
+
const projectId = typeof body.projectId === 'string' ? body.projectId.trim() : '';
|
|
21
|
+
const feedback = body.feedback;
|
|
22
|
+
const question = typeof body.question === 'string' ? body.question.trim() : '';
|
|
23
|
+
const answer = typeof body.answer === 'string' ? body.answer.trim() : '';
|
|
24
|
+
const claimedFingerprint =
|
|
25
|
+
typeof body.sourceScopeFingerprint === 'string' ? body.sourceScopeFingerprint : undefined;
|
|
26
|
+
if (!question || question.length > 8_000) {
|
|
27
|
+
return Response.json(
|
|
28
|
+
{ error: 'A valid question is required.' },
|
|
29
|
+
{ status: 400, headers: noStoreHeaders },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const updateCache = async () => {
|
|
34
|
+
if (feedback !== 'liked' && feedback !== 'disliked') {
|
|
35
|
+
const removed = await deleteGroundedAnswerCacheEntry(question);
|
|
36
|
+
return { cached: false, removed };
|
|
37
|
+
}
|
|
38
|
+
if (feedback === 'liked' && (!answer || answer.length > 100_000)) {
|
|
39
|
+
throw new Error('A valid answer is required to cache feedback.');
|
|
40
|
+
}
|
|
41
|
+
if (feedback === 'disliked') {
|
|
42
|
+
const removed = await deleteGroundedAnswerCacheEntry(question);
|
|
43
|
+
return { cached: false, removed };
|
|
44
|
+
}
|
|
45
|
+
const [documents, groups, config] = await Promise.all([
|
|
46
|
+
readDocuments(),
|
|
47
|
+
readGroups(),
|
|
48
|
+
readConfig(),
|
|
49
|
+
]);
|
|
50
|
+
const currentFingerprint = assistantSourceScopeFingerprint(
|
|
51
|
+
filterDocumentsAvailableToAssistant(documents, groups),
|
|
52
|
+
{ configUpdatedAt: config.updatedAt },
|
|
53
|
+
);
|
|
54
|
+
if (feedback === 'liked' && claimedFingerprint && claimedFingerprint !== currentFingerprint) {
|
|
55
|
+
return { cached: false, stale: true };
|
|
56
|
+
}
|
|
57
|
+
const entry = await saveGroundedAnswerCacheEntry({
|
|
58
|
+
question,
|
|
59
|
+
answer,
|
|
60
|
+
sourceScopeFingerprint: currentFingerprint,
|
|
61
|
+
});
|
|
62
|
+
return { cached: true, entry };
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const result = projectId ? await runWithProject(projectId, updateCache) : await updateCache();
|
|
66
|
+
if ('stale' in result) {
|
|
67
|
+
return Response.json(result, { status: 409, headers: noStoreHeaders });
|
|
68
|
+
}
|
|
69
|
+
return Response.json(result, { headers: noStoreHeaders });
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error('[chat-feedback] failed to update grounded answer cache:', error);
|
|
72
|
+
return Response.json(
|
|
73
|
+
{ error: error instanceof Error ? error.message : 'Could not save answer feedback.' },
|
|
74
|
+
{ status: 500, headers: noStoreHeaders },
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|