@wabot-dev/framework 0.1.0-beta.13 → 0.1.0-beta.14
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/dist/src/ai/claude/ClaudeChatBotAdapter.js +1 -3
- package/package.json +1 -1
- package/dist/src/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js +0 -221
- package/dist/src/node_modules/@anthropic-ai/sdk/client.js +0 -540
- package/dist/src/node_modules/@anthropic-ai/sdk/core/api-promise.js +0 -74
- package/dist/src/node_modules/@anthropic-ai/sdk/core/error.js +0 -100
- package/dist/src/node_modules/@anthropic-ai/sdk/core/pagination.js +0 -119
- package/dist/src/node_modules/@anthropic-ai/sdk/core/resource.js +0 -8
- package/dist/src/node_modules/@anthropic-ai/sdk/core/streaming.js +0 -283
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/constants.js +0 -16
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.js +0 -37
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/decoders/line.js +0 -110
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/detect-platform.js +0 -159
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/errors.js +0 -37
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/headers.js +0 -71
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/parse.js +0 -53
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/request-options.js +0 -11
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/shims.js +0 -86
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/to-file.js +0 -94
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/tslib.js +0 -14
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/uploads.js +0 -113
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/utils/bytes.js +0 -27
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/utils/env.js +0 -19
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/utils/log.js +0 -82
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/utils/path.js +0 -76
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js +0 -4
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/utils/uuid.js +0 -16
- package/dist/src/node_modules/@anthropic-ai/sdk/internal/utils/values.js +0 -48
- package/dist/src/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +0 -588
- package/dist/src/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +0 -582
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +0 -19
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/beta/files.js +0 -120
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js +0 -202
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js +0 -85
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/beta/models.js +0 -58
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/completions.js +0 -21
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/messages/batches.js +0 -151
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/messages/messages.js +0 -71
- package/dist/src/node_modules/@anthropic-ai/sdk/resources/models.js +0 -43
- package/dist/src/node_modules/@anthropic-ai/sdk/version.js +0 -3
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { injectable } from '../../injection/index.js';
|
|
3
|
-
import { Anthropic } from '
|
|
4
|
-
import '../../node_modules/@anthropic-ai/sdk/core/api-promise.js';
|
|
5
|
-
import '../../node_modules/@anthropic-ai/sdk/core/pagination.js';
|
|
3
|
+
import { Anthropic } from '@anthropic-ai/sdk';
|
|
6
4
|
import 'uuid';
|
|
7
5
|
import '../../chatbot/metadata/ChatBotMetadataStore.js';
|
|
8
6
|
import '../../chatbot/ChatBot.js';
|
package/package.json
CHANGED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
const tokenize = (input) => {
|
|
2
|
-
let current = 0;
|
|
3
|
-
let tokens = [];
|
|
4
|
-
while (current < input.length) {
|
|
5
|
-
let char = input[current];
|
|
6
|
-
if (char === '\\') {
|
|
7
|
-
current++;
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
if (char === '{') {
|
|
11
|
-
tokens.push({
|
|
12
|
-
type: 'brace',
|
|
13
|
-
value: '{',
|
|
14
|
-
});
|
|
15
|
-
current++;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (char === '}') {
|
|
19
|
-
tokens.push({
|
|
20
|
-
type: 'brace',
|
|
21
|
-
value: '}',
|
|
22
|
-
});
|
|
23
|
-
current++;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (char === '[') {
|
|
27
|
-
tokens.push({
|
|
28
|
-
type: 'paren',
|
|
29
|
-
value: '[',
|
|
30
|
-
});
|
|
31
|
-
current++;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (char === ']') {
|
|
35
|
-
tokens.push({
|
|
36
|
-
type: 'paren',
|
|
37
|
-
value: ']',
|
|
38
|
-
});
|
|
39
|
-
current++;
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (char === ':') {
|
|
43
|
-
tokens.push({
|
|
44
|
-
type: 'separator',
|
|
45
|
-
value: ':',
|
|
46
|
-
});
|
|
47
|
-
current++;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (char === ',') {
|
|
51
|
-
tokens.push({
|
|
52
|
-
type: 'delimiter',
|
|
53
|
-
value: ',',
|
|
54
|
-
});
|
|
55
|
-
current++;
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (char === '"') {
|
|
59
|
-
let value = '';
|
|
60
|
-
let danglingQuote = false;
|
|
61
|
-
char = input[++current];
|
|
62
|
-
while (char !== '"') {
|
|
63
|
-
if (current === input.length) {
|
|
64
|
-
danglingQuote = true;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
if (char === '\\') {
|
|
68
|
-
current++;
|
|
69
|
-
if (current === input.length) {
|
|
70
|
-
danglingQuote = true;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
value += char + input[current];
|
|
74
|
-
char = input[++current];
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
value += char;
|
|
78
|
-
char = input[++current];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
char = input[++current];
|
|
82
|
-
if (!danglingQuote) {
|
|
83
|
-
tokens.push({
|
|
84
|
-
type: 'string',
|
|
85
|
-
value,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
let WHITESPACE = /\s/;
|
|
91
|
-
if (char && WHITESPACE.test(char)) {
|
|
92
|
-
current++;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
let NUMBERS = /[0-9]/;
|
|
96
|
-
if ((char && NUMBERS.test(char)) || char === '-' || char === '.') {
|
|
97
|
-
let value = '';
|
|
98
|
-
if (char === '-') {
|
|
99
|
-
value += char;
|
|
100
|
-
char = input[++current];
|
|
101
|
-
}
|
|
102
|
-
while ((char && NUMBERS.test(char)) || char === '.') {
|
|
103
|
-
value += char;
|
|
104
|
-
char = input[++current];
|
|
105
|
-
}
|
|
106
|
-
tokens.push({
|
|
107
|
-
type: 'number',
|
|
108
|
-
value,
|
|
109
|
-
});
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
let LETTERS = /[a-z]/i;
|
|
113
|
-
if (char && LETTERS.test(char)) {
|
|
114
|
-
let value = '';
|
|
115
|
-
while (char && LETTERS.test(char)) {
|
|
116
|
-
if (current === input.length) {
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
value += char;
|
|
120
|
-
char = input[++current];
|
|
121
|
-
}
|
|
122
|
-
if (value == 'true' || value == 'false' || value === 'null') {
|
|
123
|
-
tokens.push({
|
|
124
|
-
type: 'name',
|
|
125
|
-
value,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
// unknown token, e.g. `nul` which isn't quite `null`
|
|
130
|
-
current++;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
current++;
|
|
136
|
-
}
|
|
137
|
-
return tokens;
|
|
138
|
-
}, strip = (tokens) => {
|
|
139
|
-
if (tokens.length === 0) {
|
|
140
|
-
return tokens;
|
|
141
|
-
}
|
|
142
|
-
let lastToken = tokens[tokens.length - 1];
|
|
143
|
-
switch (lastToken.type) {
|
|
144
|
-
case 'separator':
|
|
145
|
-
tokens = tokens.slice(0, tokens.length - 1);
|
|
146
|
-
return strip(tokens);
|
|
147
|
-
case 'number':
|
|
148
|
-
let lastCharacterOfLastToken = lastToken.value[lastToken.value.length - 1];
|
|
149
|
-
if (lastCharacterOfLastToken === '.' || lastCharacterOfLastToken === '-') {
|
|
150
|
-
tokens = tokens.slice(0, tokens.length - 1);
|
|
151
|
-
return strip(tokens);
|
|
152
|
-
}
|
|
153
|
-
case 'string':
|
|
154
|
-
let tokenBeforeTheLastToken = tokens[tokens.length - 2];
|
|
155
|
-
if (tokenBeforeTheLastToken?.type === 'delimiter') {
|
|
156
|
-
tokens = tokens.slice(0, tokens.length - 1);
|
|
157
|
-
return strip(tokens);
|
|
158
|
-
}
|
|
159
|
-
else if (tokenBeforeTheLastToken?.type === 'brace' && tokenBeforeTheLastToken.value === '{') {
|
|
160
|
-
tokens = tokens.slice(0, tokens.length - 1);
|
|
161
|
-
return strip(tokens);
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
|
-
case 'delimiter':
|
|
165
|
-
tokens = tokens.slice(0, tokens.length - 1);
|
|
166
|
-
return strip(tokens);
|
|
167
|
-
}
|
|
168
|
-
return tokens;
|
|
169
|
-
}, unstrip = (tokens) => {
|
|
170
|
-
let tail = [];
|
|
171
|
-
tokens.map((token) => {
|
|
172
|
-
if (token.type === 'brace') {
|
|
173
|
-
if (token.value === '{') {
|
|
174
|
-
tail.push('}');
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
tail.splice(tail.lastIndexOf('}'), 1);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (token.type === 'paren') {
|
|
181
|
-
if (token.value === '[') {
|
|
182
|
-
tail.push(']');
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
tail.splice(tail.lastIndexOf(']'), 1);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
if (tail.length > 0) {
|
|
190
|
-
tail.reverse().map((item) => {
|
|
191
|
-
if (item === '}') {
|
|
192
|
-
tokens.push({
|
|
193
|
-
type: 'brace',
|
|
194
|
-
value: '}',
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
else if (item === ']') {
|
|
198
|
-
tokens.push({
|
|
199
|
-
type: 'paren',
|
|
200
|
-
value: ']',
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
return tokens;
|
|
206
|
-
}, generate = (tokens) => {
|
|
207
|
-
let output = '';
|
|
208
|
-
tokens.map((token) => {
|
|
209
|
-
switch (token.type) {
|
|
210
|
-
case 'string':
|
|
211
|
-
output += '"' + token.value + '"';
|
|
212
|
-
break;
|
|
213
|
-
default:
|
|
214
|
-
output += token.value;
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
return output;
|
|
219
|
-
}, partialParse = (input) => JSON.parse(generate(unstrip(strip(tokenize(input)))));
|
|
220
|
-
|
|
221
|
-
export { partialParse };
|