teralomaniac commited on
Commit
d70d08b
1 Parent(s): 570b4b8

Upload 23 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ lib/bin/clewd-superfetch-android-arm filter=lfs diff=lfs merge=lfs -text
37
+ lib/bin/clewd-superfetch-linux-amd64 filter=lfs diff=lfs merge=lfs -text
38
+ lib/bin/clewd-superfetch-linux-arm64 filter=lfs diff=lfs merge=lfs -text
39
+ lib/bin/clewd-superfetch-mac-amd64 filter=lfs diff=lfs merge=lfs -text
40
+ lib/bin/clewd-superfetch-win-amd64.exe filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+
8
+ # Developer
9
+ *_dev.js
10
+ *.dev.js
11
+
12
+ # Clewd
13
+ cookies.json
14
+ cookies.js
15
+ cookies.ini
16
+ config.js
17
+ log.txt
18
+
19
+ # npm
20
+ package-lock.json
21
+
22
+ # Runtime data
23
+ pids
24
+ *.pid
25
+ *.seed
26
+ *.pid.lock
27
+
28
+ # Directory for instrumented libs generated by jscoverage/JSCover
29
+ lib-cov
30
+
31
+ # Coverage directory used by tools like istanbul
32
+ coverage
33
+
34
+ # nyc test coverage
35
+ .nyc_output
36
+
37
+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
38
+ .grunt
39
+
40
+ # Bower dependency directory (https://bower.io/)
41
+ bower_components
42
+
43
+ # node-waf configuration
44
+ .lock-wscript
45
+
46
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
47
+ build/Release
48
+
49
+ # Dependency directories
50
+ node_modules/
51
+ jspm_packages/
52
+
53
+ # TypeScript v1 declaration files
54
+ typings/
55
+
56
+ # Optional npm cache directory
57
+ .npm
58
+
59
+ # Optional eslint cache
60
+ .eslintcache
61
+
62
+ # Optional REPL history
63
+ .node_repl_history
64
+
65
+ # Output of 'npm pack'
66
+ *.tgz
67
+
68
+ # Yarn Integrity file
69
+ .yarn-integrity
70
+
71
+ # dotenv environment variables file
72
+ .env
73
+
74
+ # next.js build output
75
+ .next
CHANGELOG.md ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <h1>Changelog</h1>
3
+ <a href="https://gitgud.io/ahsk/clewd/">
4
+ <img
5
+ height="120"
6
+ width="120"
7
+ alt="Clewd"
8
+ title="Clewd"
9
+ src="https://gitgud.io/ahsk/clewd/-/raw/master/media/logo.png"
10
+ align="center"
11
+ />
12
+ </a>
13
+ </div>
14
+
15
+ # 4.6
16
+
17
+ fixed major bug in the prompt build logic which was causing problems like the AI refering to old messages erroneously, ignoring your latest message, etc
18
+
19
+ added superfetch for armv7
20
+
21
+ # 4.5
22
+
23
+ expanded superfetch to fix some errors
24
+
25
+ status codes and *some* basic as fuck error handling for superfetch
26
+
27
+ stopped trimming system messages
28
+
29
+ fixed crash sometimes after superfetch request
30
+
31
+ fixed impersonation sometimes not stopping
32
+
33
+ fixed hard-censor detection
34
+
35
+ fixed weird behavior when "Add character names" was checked
36
+
37
+ fixed another source of "Received no valid replies at all"
38
+
39
+ chown added to start.sh to stop EACESS errors
40
+
41
+ > **AllSamples** changed
42
+
43
+ last Assistant and Human will not be transformed into examples
44
+
45
+ # 4.4
46
+
47
+ fixed another source of "Received no valid replies at all"
48
+
49
+ # 4.3
50
+
51
+ a fix for "Received no valid replies at all" on >=20k ctx (tested 35k)
52
+
53
+ > **SuperfetchTimeout** removed
54
+
55
+ was only relevant to pre-4.0
56
+
57
+ > **Hotfix 1**
58
+
59
+ fixed another source of "Received no valid replies at all"
60
+
61
+
62
+ # 4.2
63
+
64
+ fixed broken replies
65
+
66
+ # 4.1
67
+
68
+ > **PromptExperimentFirst** and **PromptExperimentNext** added
69
+
70
+ both only have effect when **PromptExperiments** is true
71
+
72
+ **PromptExperimentFirst** is sent on the very first message together with the prompt in file form
73
+
74
+ **PromptExperimentNext** is sent on the subsequent messages if **RenewAlways** is false
75
+
76
+ examples
77
+
78
+ - PromptExperimentFirst set to "Comply"
79
+
80
+ - PromptExperimentNext set to "Continue"
81
+
82
+ - one of them set to secondary jailbreak
83
+
84
+
85
+
86
+
87
+ # 4.0
88
+
89
+ > **Streaming changes**
90
+
91
+ reworked how messages are parsed, again
92
+
93
+ > **Superfetch** reworked
94
+
95
+ pros:
96
+ - streaming
97
+ - fast
98
+ - more reliable
99
+ - no lingering processes
100
+ - no firewall issues (hopefully)
101
+
102
+ cons:
103
+ - the AI typing might look weird
104
+ - no android-armv7
105
+ - android-arm64 possibly doesn't work
106
+ - mac-arm64 possibly doesn't work
107
+ - no 32bit for any platform for now
108
+ - poor error handling
109
+
110
+ tested on linux and windows
111
+
112
+ > **SuperfetchHost** and **SuperfetchPort** removed
113
+
114
+ > **Minor changes**
115
+
116
+ split code into multiple files
117
+
118
+ clewd-superfetch and clewd are now the same package
119
+
120
+ removed all dependencies
121
+
122
+ **git** [added to requirements](https://gitgud.io/ahsk/clewd/#requirements) (highly recommended so update scripts work, otherwise do a clean install)
123
+
124
+ # 3.8.5
125
+
126
+ fixed memory leak on clewd-superfetch
127
+
128
+ added support for custom host/port for superfetch in case you want
129
+
130
+ better cleaning up so it is less likely orphan superfetch processes will remain
131
+
132
+ # 3.8
133
+ > **Superfetch** reworked
134
+
135
+ dropped old js files in favor of custom-made ones
136
+
137
+ i believe firewalls may block the binaries from connecting to port 443
138
+
139
+ also, you should see "superfetch-load *{PATH}*" followed by "superfetch-spawn"
140
+
141
+ > **SuperfetchTimeout** added
142
+
143
+ controls how much time in seconds until it times out
144
+
145
+ default 120
146
+
147
+ > **Minor changes**
148
+
149
+ new binaries for windows/linux/mac/arm/freebsd
150
+
151
+ # 3.7
152
+
153
+ <s>using custom library to see if termux works</s>
154
+
155
+ # 3.6
156
+ > ### **Superfetch** added (defaults true)
157
+
158
+ if set to true, will use an alternate method to get past the *"We are unable to serve your request"* error
159
+
160
+ if set to false it's the old clewd behavior (if you don't struggle with that error you can keep it on false)
161
+
162
+ > **Streaming changes**
163
+
164
+ both streaming on/off working
165
+
166
+ > **RetryRegen** changed
167
+
168
+ now also works with Superfetch
169
+
170
+ > **Minor changes**
171
+
172
+ error handling for Superfetch (can't do much)
173
+
174
+ support name prefixes for group chats when "Add character names" is enabled
175
+
176
+ > if you were having trouble with 3.5 but 3.1 or 3.4 were fine, update to this and enable/disable **Superfetch** as you see fit
177
+
178
+ # 3.5
179
+ > **Streaming changes**
180
+
181
+ fixed the dreaded bug, shit is unstable don't expect much
182
+
183
+ keep streaming enabled for now
184
+
185
+ can try to fix non-stream later, same with error handling and **RetryRegenerate**
186
+
187
+ lastly, fuck you rats ;)
188
+
189
+ # 3.4
190
+ > **Streaming changes**
191
+
192
+ turns out I could've fixed the broken formatting long ago, should work great now
193
+
194
+ > Prompt conversion and **SystemExperiments** reworked
195
+
196
+ > **Prompts** (PromptMain, PromptReminder, PromptContinue) from 3.0 removed
197
+
198
+ most frontends are implementing prompt managers so that hack is not needed
199
+
200
+ > **PersonalityFormat** and **ScenarioFormat** added
201
+
202
+ those are hardcoded on ST and will stay available until they're not
203
+
204
+ scenarios and char description are extracted from their hardcoded strings and replaced by the format you set
205
+
206
+ - **RealChatPrefix** default is now empty
207
+
208
+ > **AllSamples** changed
209
+
210
+ no longer excludes the last two messages when transforming
211
+
212
+ > **LogMessages** changed
213
+
214
+ moved to Settings
215
+
216
+ > **Minor changes**
217
+
218
+ - Error handling changes
219
+
220
+ - RenewAlways is now more stable when set to false. still, regenerate once if you swap characters
221
+
222
+ # 3.3
223
+ added \[DONE\] to end of streams
224
+
225
+ changed more things to support [RisuAI](https://files.catbox.moe/l243nm.png)
226
+
227
+ # 3.2
228
+ small streaming change to try to fix \n bullshit again
229
+
230
+ > **PreserveChats** added (defaults false)
231
+
232
+ if set to true, prevents the deletion of chats at any point
233
+
234
+ # 3.1
235
+ > **Streaming changes**
236
+
237
+ if the user did not enable streaming, clewd will **fake** a non-stream response for compatibility
238
+
239
+ > **LogMessages** added (defaults false)
240
+
241
+ if set to true, will log the prompt and then the reply to a `log.txt` file
242
+
243
+ # 3.0
244
+ > ### **Clewd requires setting your "Chat Completion source" to OpenAI now. Enable the "External" models option aswell.**
245
+
246
+ > ### A config.js file will be generated when first ran, edit it to set your cookie and customize settings
247
+
248
+ > **Streaming changes**
249
+
250
+ streaming is now enforced by the website so no point supporting the other mode
251
+
252
+ Clewd streaming was reworked to behave more like [NBSX](https://gitgud.io/ahsk/nbsx)
253
+
254
+ > **AntiStall**, **StallTrigger**, **StallTriggerMax** removed
255
+
256
+ no longer needed since streaming is enforced
257
+
258
+ > **DeleteChats** removed
259
+
260
+ now cleans up by default other than a few cases like when `RenewAlways` is set to false
261
+
262
+ > **RecycleChats** removed
263
+
264
+ replaced by another system that is activated only if `RenewAlways` is set to false
265
+
266
+ > **ReplaceSamples** removed
267
+
268
+ replaced by **NoSamples** *or* **AllSamples*
269
+
270
+ > **RetryRegenerate** changed
271
+
272
+ trigger should be more consistent now
273
+
274
+ > **StripAssistant** and **StripHuman** changed
275
+
276
+ they remove the Human/Assistant prefixes from the last messages, keeping the message contents
277
+
278
+ > **RenewAlways** added (defaults true)
279
+
280
+ if set to true, this is the default pre-3.0 clewd behavior
281
+
282
+ if set to false, check the `Prompts` section below
283
+
284
+ > **NoSamples** added (defaults false)
285
+
286
+ if set to true, replaces every previous message with H/A prefix from your frontend into Human/Assistant
287
+
288
+ mutually exclusive with `AllSamples`
289
+
290
+ (only outgoing)
291
+
292
+ > **AllSamples** added (defaults false)
293
+
294
+ if set to true, replaces every Human/Assistant prefix from your frontend **except the last two** into H/A
295
+
296
+ mutually exclusive with `NoSamples`
297
+
298
+ (only outgoing)
299
+
300
+ > **SystemExperiments** (defaults true) and **Prompts** added (Main, Reminder, Continue)
301
+
302
+ instead of sending a pre-written chunk of text to the AI, now you can customize exactly (almost) how the prompt is formatted before it is sent
303
+
304
+ if `RenewAlways` is set to true:
305
+ - `Main` is **always** the one being used.
306
+
307
+ if `RenewAlways` is set to false:
308
+ - `Main` is sent on conversation start
309
+ - `Continue` is sent on the next message, as long as no *impersonation* happened
310
+ - every `SystemInterval` of messages, `Reminder` is sent once
311
+
312
+ ---
313
+
314
+ if `SystemExperiments` is set to true:
315
+ uses Main then alternates between Reminder and Continue
316
+
317
+ if `SystemExperiments` is set to false:
318
+ uses Main then Reminder
319
+
320
+ sometimes it will renew anyway when detecting some oddity
321
+
322
+ ---
323
+
324
+ example of custom `Main` prompt with XML tags wrapping around
325
+
326
+ - character description
327
+ - scenario
328
+ - main prompt
329
+ - example messages
330
+ - real messages
331
+
332
+ ```
333
+ <chat>
334
+ {{MAIN_AND_CHARACTER}}
335
+ {{CHAT_EXAMPLE}}
336
+ {{CHAT_LOG}}
337
+ </chat>
338
+ {{JAILBREAK}}
339
+ ```
340
+
341
+ > **Minor changes**
342
+
343
+ - Clewd errors now should show as such on your frontend
344
+
345
+ - flags now show how many days until they expire
346
+
347
+ - the message limit error now shows how many hours until the restriction is lifted
348
+
349
+ - settings that aren't on their default are now displayed in yellow on startup
350
+
351
+ - "[Start a new chat]" is excluded from system prompts
352
+
353
+
354
+ # 2.7
355
+ > Fixed broken newlines
356
+
357
+
358
+ # 2.6
359
+ > **AdaptClaude** removed
360
+
361
+ > **ReplaceSamples** added (defaults false)
362
+
363
+ If set to true, will replace any cases of **outgoing** H/A, to Human/Assistant
364
+
365
+ now has **no effect** on incoming, [more info](https://docs.anthropic.com/claude/docs/prompt-troubleshooting-checklist#the-prompt-is-formatted-correctly)
366
+
367
+ >**PreventImperson** updated
368
+
369
+ now also stops on A: or Assistant:
370
+ another check added, *should* impersonate less often
371
+
372
+
373
+ # 2.5
374
+ > Changed some defaults around
375
+
376
+ refer to the [README](https://gitgud.io/ahsk/clewd/#defaults) for the reasoning behind each
377
+
378
+ > **DeleteChats** bugfix
379
+
380
+
381
+ # 2.4
382
+ > **DeleteChats** added (defaults false)
383
+
384
+ for privacy, deletes old chats on startup and deletes any new ones after receiving a reply
385
+
386
+ > **PreventImperson** bugfix
387
+
388
+ should be more accurate now
389
+
390
+ > **RetryRegenerate** no longer defaults true
391
+
392
+
393
+ # 2.0 to 2.2
394
+ > **RetryRegenerate** added (defaults true)
395
+
396
+ uses the AI's own retry mechanism when you regenerate on your frontend, if you change anything from your last prompt before regenerating it will default to old behavior
397
+
398
+ > **PromptExperiments** added (defaults true)
399
+
400
+ an alternative way to send your prompt to the AI, through a file. set to false if it's bad
401
+ both enabled: https://files.catbox.moe/io1q53.webm
402
+
403
+
404
+ # 1.6 to 2.0
405
+ > **AdaptClaude** now should work better with streaming on
406
+
407
+ > **AntiStall 2**
408
+
409
+ now returns up to the first AI reply instead of the second, **AntiStall 1** sends the whole schizophrenia (good chance of some spicy things being included)
410
+
411
+ > **PreventImperson**
412
+
413
+ added, stops the bot immediately once it starts pretending to be you (you can use this as kind of a AntiStall, chance of missing some spicy things)
414
+
415
+ > **PassParams** added (defaults false)
416
+
417
+ now whatever temperature <=1 you set on SillyTavern will be forwarded to claude (if you get errors turn this shit off), also, no idea if this does anything but they accept it
418
+
419
+ ---
420
+
421
+ > [README](https://gitgud.io/ahsk/clewd/#defaults)
clewd.js ADDED
@@ -0,0 +1,863 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * https://rentry.org/teralomaniac_clewd
3
+ * https://github.com/teralomaniac/clewd
4
+ */
5
+ 'use strict';
6
+
7
+ const {createServer: Server, IncomingMessage, ServerResponse} = require('node:http'), {createHash: Hash, randomUUID, randomInt, randomBytes} = require('node:crypto'), {TransformStream, ReadableStream} = require('node:stream/web'), {Readable, Writable} = require('node:stream'), {Blob} = require('node:buffer'), {existsSync: exists, writeFileSync: write, createWriteStream} = require('node:fs'), {join: joinP} = require('node:path'), {ClewdSuperfetch: Superfetch, SuperfetchAvailable} = require('./lib/clewd-superfetch'), {AI, fileName, genericFixes, bytesToSize, setTitle, checkResErr, Replacements, Main} = require('./lib/clewd-utils'), ClewdStream = require('./lib/clewd-stream');
8
+
9
+ /******************************************************* */
10
+ let currentIndex, Firstlogin = true, changeflag = 0, changetime = 0, totaltime, uuidOrgArray = [];
11
+
12
+ const events = require('events'), CookieChanger = new events.EventEmitter();
13
+ require('events').EventEmitter.defaultMaxListeners = 0;
14
+
15
+ CookieChanger.on('ChangeCookie', () => {
16
+ Proxy && Proxy.close();
17
+ console.log(`Changing Cookie...\n`);
18
+ Proxy.listen(Config.Port, Config.Ip, onListen);
19
+ Proxy.on('error', (err => {
20
+ console.error('Proxy error\n%o', err);
21
+ }));
22
+ });
23
+
24
+ const simpletokenizer = (prompt) => {
25
+ let byteLength = 0;
26
+ for (let i = 0; i < prompt.length; i++) {
27
+ let code = prompt.charCodeAt(i);
28
+ if (code <= 0xFF) {
29
+ byteLength += 0.6;
30
+ } else if (code <= 0xFFFF) {
31
+ byteLength += 1;
32
+ } else {
33
+ byteLength += 1.5;
34
+ }
35
+ }
36
+ return byteLength;
37
+ }, padtxt = (content) => {
38
+ if (Config.padtxt_placeholder.length > 0) {
39
+ var placeholder = Config.padtxt_placeholder;
40
+ } else {
41
+ const bytes = randomInt(5, 15);
42
+ var placeholder = randomBytes(bytes).toString('hex');
43
+ }
44
+ let count = Math.floor((Config.Settings.padtxt - simpletokenizer(content)) / simpletokenizer(placeholder));
45
+
46
+ // 生成占位符字符串
47
+ let padding = '';
48
+ for (let i = 0; i < count; i++) {
49
+ padding += placeholder;
50
+ }
51
+
52
+ // 在prompt前面添加占位符, 在末尾增加空行然后添加prompt
53
+ content = padding + '\n\n\n' + content;
54
+
55
+ return content.trim();
56
+ }, xmlPlot = (content) => {
57
+ // 检查内容中是否包含"<card>"
58
+ if (!content.includes('<card>')) {
59
+ content = content.replace(/(\n\n|^)xmlPlot:\s*/gm, '$1');
60
+ content = content.replace(/(<reply>\n|\n<\/reply>)/g, '');
61
+ return content.replace(/<customname>(.*?)<\/customname>/gm, '$1');
62
+ }
63
+
64
+ //群组
65
+ content = content.replace(/(<reply>\n|\n<\/reply>)\1*/g, '$1');
66
+ content = content.replace(/<customname>(.*?)<\/customname>:/gm, '$1:\n');
67
+
68
+ //role合并
69
+ if (!content.includes('<\!-- Merge Disable -->')) {
70
+ if (!content.includes('<\!-- Merge Human Disable -->')) {
71
+ content = content.replace(/(\n\n|^)xmlPlot:/g, '$1Human:');
72
+ content = content.replace(/(?:\n\n|^)Human:(.*?(?:\n\nAssistant:|$))/gs, function(match, p1) {return '\n\nHuman:' + p1.replace(/\n\nHuman:\s*/g, '\n\n')});
73
+ content = content.replace(/^\s*Human:\s*/, '');
74
+ }
75
+ if (!content.includes('<\!-- Merge Assistant Disable -->')) {
76
+ content = content.replace(/\n\nAssistant:(.*?(?:\n\nHuman:|$))/gs, function(match, p1) {return '\n\nAssistant:' + p1.replace(/\n\nAssistant:\s*/g, '\n\n')});
77
+ }
78
+ }
79
+ content = content.replace(/(\n\n|^)xmlPlot:\s*/gm, '$1');
80
+ content = content.replace(/<\!-- Merge.*?Disable -->/gm, '');
81
+
82
+ //格式顺序交换&越狱倒置
83
+ content = content.replace(/<Prev(Assistant|Human)>.*?<\/Prev\1>/gs, function(match) {return match.replace(/\n\n(Assistant|Human):/g, '\n\ntemp$1:')});
84
+ let segcontentAssistant = content.split('\n\nAssistant:');
85
+ let processedsegAssistant = segcontentAssistant.map(seg => {
86
+ return seg.replace(/(\n\nHuman:.*?)<PrevAssistant>(.*?)<\/PrevAssistant>/gs, '\n\n$2$1');
87
+ });
88
+ content = processedsegAssistant.join('\n\nAssistant:');
89
+ let segcontentHuman = content.split('\n\nHuman:');
90
+ const seglength = segcontentHuman.length;
91
+ for (let i = 1; i < seglength; i++) {
92
+ const match = segcontentHuman[i].match(/<PrevHuman>.*?<\/PrevHuman>/s);
93
+ if (match) {
94
+ segcontentHuman[i - 1] += match[0].replace(/<PrevHuman>(.*?)<\/PrevHuman>/s, '\n\n$1');
95
+ segcontentHuman[i] = segcontentHuman[i].replace(match[0], '');
96
+ }
97
+ }
98
+ if (/Assistant: *.$/.test(content) && seglength > 1 && !segcontentHuman[seglength - 2].includes('\n\nAssistant:')) {
99
+ segcontentHuman[seglength - 2] = segcontentHuman.splice(seglength - 1, 1, segcontentHuman[seglength - 2])[0];
100
+ }
101
+ content = segcontentHuman.join('\n\nHuman:');
102
+ content = content.replace(/\n\ntemp(Assistant|Human):/g, '\n\n$1:');
103
+
104
+ //给开头加上</file-attachment-contents>用于截断附加文件标识
105
+ content.includes('<file-attachment-contents>') && (content = '</file-attachment-contents>\n\n' + content);
106
+
107
+ // 在第一个"[Start a new"前面加上"<example>",在最后一个"[Start a new"前面加上"</example>\n\n<plot>\n\n"
108
+ const exampleNote = content.match(/(?<=<example-note>).*(?=<\/example-note>)/) || '';
109
+ const cardtag = content.match(/(?=\n\n<\/card>)/) || '</card>';
110
+ const exampletag = content.match(/(?=\n\n<\/example>)/) || '</example>';
111
+ const plot = content.includes('</plot>') ? '<plot>' : '';
112
+ content = content.replace(/<example-note>.*<\/example-note>/, '');
113
+ const firstChatStart = content.indexOf('\n\n[Start a new');
114
+ const lastChatStart = content.lastIndexOf('\n\n[Start a new');
115
+ firstChatStart != -1 && firstChatStart === lastChatStart && (content = content.slice(0, firstChatStart) + `\n\n${cardtag}` + content.slice(firstChatStart));
116
+ firstChatStart != lastChatStart && (content = content.slice(0, firstChatStart) + `\n\n${cardtag}\n\n${exampleNote}\n<example>` + content.slice(firstChatStart, lastChatStart) + `\n\n${exampletag}\n\n${plot}` + content.slice(lastChatStart));
117
+
118
+ //Plain Prompt
119
+ segcontentHuman = content.split('\n\nHuman:');
120
+ let segcontentlastIndex = segcontentHuman.length - 1;
121
+ if (segcontentlastIndex >= 2 && segcontentHuman[segcontentlastIndex].includes('<!-- Plain Prompt Enable -->') && !content.includes('\n\nPlainPrompt:')) {
122
+ content = segcontentHuman.slice(0, segcontentlastIndex).join('\n\nHuman:') + '\n\nPlainPrompt:' + segcontentHuman.slice(segcontentlastIndex).join('\n\nHuman:');
123
+ }
124
+ content = content.replace(/<\!-- Plain Prompt Enable -->/, '');
125
+ content = content.replace(/\n\nHuman:.*PlainPrompt:/, '\n\nPlainPrompt:');
126
+
127
+ //消除空XML tags或多余的\n
128
+ content = content.replace(/\n<\/(hidden|META)>\s+?<\1>\n/g, '');
129
+ content = content.replace(/\n<(card|example|hidden|plot|META)>\s+?<\1>/g, '\n<$1>');
130
+ content = content.replace(/(?:<!--.*?-->)?\n<(card|example|hidden|plot|META)>\s+?<\/\1>/g, '');
131
+ content = content.replace(/(?<=(: |\n)<(card|hidden|example|plot|META)>\n)\s*/g, '');
132
+ content = content.replace(/\s*(?=\n<\/(card|hidden|example|plot|META)>(\n|$))/g, '');
133
+ content = content.replace(/(?<=\n)\n(?=\n)/g, '');
134
+
135
+ return content.trim();
136
+ };
137
+ /******************************************************* */
138
+
139
+ let ChangedSettings, UnknownSettings, Logger;
140
+
141
+ const ConfigPath = joinP(__dirname, './config.js'), LogPath = joinP(__dirname, './log.txt'), Conversation = {
142
+ char: null,
143
+ uuid: null,
144
+ depth: 0
145
+ }, cookies = {};
146
+
147
+ let uuidOrg, curPrompt = {}, prevPrompt = {}, prevMessages = [], prevImpersonated = false, Config = {
148
+ Cookie: '',
149
+ CookieArray: [],
150
+ Cookiecounter: 0,
151
+ CookieIndex: 0,
152
+ Ip: (process.env.Cookie || process.env.CookieArray) ? '0.0.0.0' : '127.0.0.1',
153
+ Port: process.env.PORT || 8444,
154
+ localtunnel: false,
155
+ BufferSize: 1,
156
+ SystemInterval: 3,
157
+ rProxy: AI.end(),
158
+ padtxt_placeholder: '',
159
+ PromptExperimentFirst: '',
160
+ PromptExperimentNext: '',
161
+ PersonalityFormat: '{{char}}\'s personality: {{personality}}',
162
+ ScenarioFormat: 'Dialogue scenario: {{scenario}}',
163
+ Settings: {
164
+ RenewAlways: true,
165
+ RetryRegenerate: false,
166
+ PromptExperiments: true,
167
+ SystemExperiments: true,
168
+ PreventImperson: false,
169
+ AllSamples: false,
170
+ NoSamples: false,
171
+ StripAssistant: false,
172
+ StripHuman: false,
173
+ PassParams: false,
174
+ ClearFlags: true,
175
+ PreserveChats: true,
176
+ LogMessages: true,
177
+ FullColon: true,
178
+ padtxt: 13500,
179
+ xmlPlot: true,
180
+ Superfetch: true
181
+ }
182
+ };
183
+
184
+ ServerResponse.prototype.json = async function(body, statusCode = 200, headers) {
185
+ body = body instanceof Promise ? await body : body;
186
+ this.headersSent || this.writeHead(statusCode, {
187
+ 'Content-Type': 'application/json',
188
+ ...headers && headers
189
+ });
190
+ this.end('object' == typeof body ? JSON.stringify(body) : body);
191
+ return this;
192
+ };
193
+
194
+ Array.prototype.sample = function() {
195
+ return this[Math.floor(Math.random() * this.length)];
196
+ };
197
+
198
+ const updateParams = res => {
199
+ updateCookies(res);
200
+ }, updateCookies = res => {
201
+ let cookieNew = '';
202
+ res instanceof Response ? cookieNew = res.headers?.get('set-cookie') : res?.superfetch ? cookieNew = res.headers?.['set-cookie'] : 'string' == typeof res && (cookieNew = res.split('\n').join(''));
203
+ if (!cookieNew) {
204
+ return;
205
+ }
206
+ let cookieArr = cookieNew.split(/;\s?/gi).filter((prop => false === /^(path|expires|domain|HttpOnly|Secure|SameSite)[=;]*/i.test(prop)));
207
+ for (const cookie of cookieArr) {
208
+ const divide = cookie.split(/^(.*?)=\s*(.*)/), cookieName = divide[1], cookieVal = divide[2];
209
+ cookies[cookieName] = cookieVal;
210
+ }
211
+ }, getCookies = () => {
212
+ const cookieNames = Object.keys(cookies);
213
+ return cookieNames.map(((name, idx) => `${name}=${cookies[name]}${idx === cookieNames.length - 1 ? '' : ';'}`)).join(' ').replace(/(\s+)$/gi, '');
214
+ }, deleteChat = async uuid => {
215
+ if (!uuid) {
216
+ return;
217
+ }
218
+ if (uuid === Conversation.uuid) {
219
+ Conversation.uuid = null;
220
+ Conversation.depth = 0;
221
+ }
222
+ if (Config.Settings.PreserveChats) {
223
+ return;
224
+ }
225
+ const res = await fetch(`${Config.rProxy}/api/organizations/${uuidOrg}/chat_conversations/${uuid}`, {
226
+ headers: {
227
+ ...AI.hdr(),
228
+ Cookie: getCookies()
229
+ },
230
+ method: 'DELETE'
231
+ });
232
+ updateParams(res);
233
+ }, onListen = async () => {
234
+ /***************************** */
235
+ if (Firstlogin) {
236
+ Firstlogin = false;
237
+ console.log(`${Main}\nhttp://${Config.Ip}:${Config.Port}/v1\n\n${Object.keys(Config.Settings).map((setting => UnknownSettings.includes(setting) ? `??? ${setting}: ${Config.Settings[setting]}` : `${setting}: ${ChangedSettings.includes(setting) ? '' : ''}${Config.Settings[setting]}`)).sort().join('\n')}\n`);
238
+ Config.Settings.Superfetch && SuperfetchAvailable(true);
239
+ if (Config.localtunnel) {
240
+ const localtunnel = require('localtunnel');
241
+ localtunnel({ port: Config.Port })
242
+ .then((tunnel) => {
243
+ console.log(`\nTunnel URL for outer websites: ${tunnel.url}/v1\n`);
244
+ })
245
+ }
246
+ totaltime = Config.CookieArray.length;
247
+ }
248
+ if (Config.CookieArray?.length > 0) {
249
+ Config.Cookie = Config.CookieArray[currentIndex];
250
+ currentIndex = (currentIndex + 1) % Config.CookieArray.length;
251
+ changetime += 1;
252
+ }
253
+ let percentage = ((changetime + Config.CookieIndex) / totaltime) * 100
254
+ if (Config.Cookiecounter < 0 && percentage > 100) {
255
+ console.log(`\n※※※Cookie cleanup completed※※※\n\n`);
256
+ return process.exit();
257
+ }
258
+ /***************************** */
259
+ if ('SET YOUR COOKIE HERE' === Config.Cookie || Config.Cookie?.length < 1) {
260
+ throw Error('Set your cookie inside config.js');
261
+ }
262
+ updateCookies(Config.Cookie);
263
+ //console.log(`${Main}\nhttp://${Config.Ip}:${Config.Port}/v1\n\n${Object.keys(Config.Settings).map((setting => UnknownSettings.includes(setting) ? `??? ${setting}: ${Config.Settings[setting]}` : `${setting}: ${ChangedSettings.includes(setting) ? '' : ''}${Config.Settings[setting]}`)).sort().join('\n')}\n`);
264
+ //Config.Settings.Superfetch && SuperfetchAvailable(true);
265
+ const accRes = await fetch(Config.rProxy + '/api/organizations', {
266
+ method: 'GET',
267
+ headers: {
268
+ ...AI.hdr(),
269
+ Cookie: getCookies()
270
+ }
271
+ });
272
+ /**************************** */
273
+ if (accRes.statusText === 'Forbidden' && Config.CookieArray?.length > 0) {
274
+ Config.CookieArray = Config.CookieArray.filter(item => item !== Config.Cookie);
275
+ !process.env.Cookie && !process.env.CookieArray && writeSettings(Config);
276
+ currentIndex = (currentIndex - 1 + Config.CookieArray.length) % Config.CookieArray.length;
277
+ console.log(`Expired!`);
278
+ Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
279
+ CookieChanger.emit('ChangeCookie');
280
+ return;
281
+ }
282
+ /**************************** */
283
+ await checkResErr(accRes);
284
+ const accInfo = (await accRes.json())?.[0];
285
+ if (!accInfo || accInfo.error) {
286
+ throw Error(`Couldn't get account info: "${accInfo?.error?.message || accRes.statusText}"`);
287
+ }
288
+ if (!accInfo?.uuid) {
289
+ throw Error('Invalid account id');
290
+ }
291
+ setTitle('ok');
292
+ updateParams(accRes);
293
+ console.log(Config.CookieArray?.length > 0 ? `(index: ${currentIndex || Config.CookieArray.length}) Logged in %o` : 'Logged in %o', { //console.log('Logged in %o', {
294
+ name: accInfo.name?.split('@')?.[0],
295
+ capabilities: accInfo.capabilities,
296
+ });
297
+ uuidOrg = accInfo?.uuid;
298
+ /************************* */
299
+ if (uuidOrgArray.includes(uuidOrg)) {
300
+ console.log(`Overlap!`);
301
+ currentIndex = (currentIndex - 1 + Config.CookieArray.length) % Config.CookieArray.length;
302
+ Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
303
+ Config.CookieArray = Config.CookieArray.filter(item => item !== Config.Cookie);
304
+ !process.env.Cookie && !process.env.CookieArray && writeSettings(Config);
305
+ CookieChanger.emit('ChangeCookie');
306
+ return;
307
+ } else {
308
+ uuidOrgArray.push(uuidOrg);
309
+ }
310
+ /************************* */
311
+ if (accInfo?.active_flags.length > 0) {
312
+ const now = new Date, formattedFlags = accInfo.active_flags.map((flag => {
313
+ const days = ((new Date(flag.expires_at).getTime() - now.getTime()) / 864e5).toFixed(2);
314
+ return {
315
+ type: flag.type,
316
+ remaining_days: days
317
+ };
318
+ }));
319
+ console.warn('Your account has warnings %o', formattedFlags); //console.warn('Your account has warnings %o', formattedFlags);
320
+ await Promise.all(accInfo.active_flags.map((flag => (async type => {
321
+ if (!Config.Settings.ClearFlags) {
322
+ return;
323
+ }
324
+ if ('consumer_restricted_mode' === type) {
325
+ return;
326
+ }
327
+ const req = await (Config.Settings.Superfetch ? Superfetch : fetch)(`${Config.rProxy}/api/organizations/${uuidOrg}/flags/${type}/dismiss`, {
328
+ headers: {
329
+ ...AI.hdr(),
330
+ Cookie: getCookies()
331
+ },
332
+ method: 'POST'
333
+ });
334
+ updateParams(req);
335
+ const json = await req.json();
336
+ console.log(`${type}: ${json.error ? json.error.message || json.error.type || json.detail : 'OK'}`);
337
+ })(flag.type))));
338
+ /***************************** */
339
+ if (Config.CookieArray?.length > 0) {
340
+ console.log(`Restricted!`);
341
+ Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
342
+ CookieChanger.emit('ChangeCookie');
343
+ return;
344
+ }
345
+ }
346
+ if (Config.CookieArray.length > 0) {
347
+ const allres = await fetch(`${Config.rProxy}`, {
348
+ headers: {
349
+ ...AI.hdr(),
350
+ Cookie: getCookies()
351
+ },
352
+ method: 'GET'
353
+ }), accountinfo = await allres.text();
354
+ updateParams(allres);
355
+ const Unverified = accountinfo.includes('\\"completed_verification_at\\":null');
356
+ const Banned = accountinfo.includes('\\"gate\":\\"segment:abuse\\",\\"gateValue\\":\\"true\\",');
357
+ const Exceededlimit = /\\"messageLimit\\":{\\"type\\":\\"(approaching_limit\\",\\"remaining\\":0|exceeded_limit)\\",/.test(accountinfo);
358
+ const Remain = /\\"messageLimit\\":{\\"type\\":\\"approaching_limit\\",\\"remaining\\":\d+\\",/.exec(accountinfo);
359
+ Remain && (changeflag = Math.max(Config.Cookiecounter - Remain[0], changeflag));
360
+ if (Unverified || Banned) {
361
+ Config.CookieArray = Config.CookieArray.filter(item => item !== Config.Cookie);
362
+ !process.env.Cookie && !process.env.CookieArray && writeSettings(Config);
363
+ currentIndex = (currentIndex - 1 + Config.CookieArray.length) % Config.CookieArray.length;
364
+ }
365
+ Unverified && console.log(`Unverified!`);
366
+ Banned && console.log(`Banned!`);
367
+ Exceededlimit && console.log(`Exceeded limit!`);
368
+ Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}`);
369
+ if (Unverified || Banned || Exceededlimit || Config.Cookiecounter < 0) {
370
+ console.log('');
371
+ CookieChanger.emit('ChangeCookie');
372
+ return;
373
+ }
374
+ /***************************** */
375
+ }
376
+ const convRes = await fetch(`${Config.rProxy}/api/organizations/${uuidOrg}/chat_conversations`, {
377
+ method: 'GET',
378
+ headers: {
379
+ ...AI.hdr(),
380
+ Cookie: getCookies()
381
+ }
382
+ }), conversations = await convRes.json();
383
+ updateParams(convRes);
384
+ conversations.length > 0 && await Promise.all(conversations.map((conv => deleteChat(conv.uuid))));
385
+ }, writeSettings = async (config, firstRun = false) => {
386
+ write(ConfigPath, `/*\n* https://rentry.org/teralomaniac_clewd\n* https://github.com/teralomaniac/clewd\n*/\n\n// SET YOUR COOKIE BELOW\n\nmodule.exports = ${JSON.stringify(config, null, 4)}\n\n/*\n BufferSize\n * How many characters will be buffered before the AI types once\n * lower = less chance of \`PreventImperson\` working properly\n\n ---\n\n SystemInterval\n * How many messages until \`SystemExperiments alternates\`\n\n ---\n\n Other settings\n * https://gitgud.io/ahsk/clewd/#defaults\n * and\n * https://gitgud.io/ahsk/clewd/-/blob/master/CHANGELOG.md\n */`.trim().replace(/((?<!\r)\n|\r(?!\n))/g, '\r\n'));
387
+ if (firstRun) {
388
+ console.warn('config file created!\nedit config.js to set your settings and restart the program');
389
+ process.exit(0);
390
+ }
391
+ }, Proxy = Server((async (req, res) => {
392
+ if ('OPTIONS' === req.method) {
393
+ return ((req, res) => {
394
+ res.writeHead(200, {
395
+ 'Access-Control-Allow-Origin': '*',
396
+ 'Access-Control-Allow-Headers': 'Authorization, Content-Type',
397
+ 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS'
398
+ }).end();
399
+ })(0, res);
400
+ }
401
+ switch (req.url) {
402
+ case '/v1/models':
403
+ res.json({
404
+ data: [ {
405
+ id: AI.mdl()
406
+ } ]
407
+ });
408
+ break;
409
+
410
+ case '/v1/chat/completions':
411
+ ((req, res) => {
412
+ setTitle('recv...');
413
+ let fetchAPI, changer; //let fetchAPI;
414
+ const abortControl = new AbortController, {signal} = abortControl;
415
+ res.socket.on('close', (async () => {
416
+ abortControl.signal.aborted || abortControl.abort();
417
+ }));
418
+ const buffer = [];
419
+ req.on('data', (chunk => {
420
+ buffer.push(chunk);
421
+ }));
422
+ req.on('end', (async () => {
423
+ let clewdStream, titleTimer, samePrompt = false, shouldRenew = true, retryRegen = false;
424
+ try {
425
+ const body = JSON.parse(Buffer.concat(buffer).toString()), temperature = Math.max(.1, Math.min(1, body.temperature));
426
+ let {messages} = body;
427
+ if (messages?.length < 1) {
428
+ throw Error('Select OpenAI as completion source');
429
+ }
430
+ if (!body.stream && 1 === messages.length && JSON.stringify(messages.sort() || []) === JSON.stringify([ {
431
+ role: 'user',
432
+ content: 'Hi'
433
+ } ].sort())) {
434
+ return res.json({
435
+ choices: [ {
436
+ message: {
437
+ content: Main
438
+ }
439
+ } ]
440
+ });
441
+ }
442
+ res.setHeader('Access-Control-Allow-Origin', '*');
443
+ body.stream && res.setHeader('Content-Type', 'text/event-stream');
444
+ if (!body.stream && messages?.[0]?.content?.startsWith('From the list below, choose a word that best represents a character\'s outfit description, action, or emotion in their dialogue')) {
445
+ return res.json({
446
+ choices: [ {
447
+ message: {
448
+ content: 'neutral'
449
+ }
450
+ } ]
451
+ });
452
+ }
453
+ if (Config.Settings.AllSamples && Config.Settings.NoSamples) {
454
+ console.log('having AllSamples and NoSamples both set to true is not supported');
455
+ throw Error('Only one can be used at the same time: AllSamples/NoSamples');
456
+ }
457
+ const model = AI.mdl();
458
+ curPrompt = {
459
+ firstUser: messages.find((message => 'user' === message.role)),
460
+ firstSystem: messages.find((message => 'system' === message.role)),
461
+ firstAssistant: messages.find((message => 'assistant' === message.role)),
462
+ lastUser: messages.findLast((message => 'user' === message.role)),
463
+ lastSystem: messages.findLast((message => 'system' === message.role && '[Start a new chat]' !== message.content)),
464
+ lastAssistant: messages.findLast((message => 'assistant' === message.role))
465
+ };
466
+ prevPrompt = {
467
+ ...prevMessages.length > 0 && {
468
+ firstUser: prevMessages.find((message => 'user' === message.role)),
469
+ firstSystem: prevMessages.find((message => 'system' === message.role)),
470
+ firstAssistant: prevMessages.find((message => 'assistant' === message.role)),
471
+ lastUser: prevMessages.findLast((message => 'user' === message.role)),
472
+ lastSystem: prevMessages.find((message => 'system' === message.role && '[Start a new chat]' !== message.content)),
473
+ lastAssistant: prevMessages.findLast((message => 'assistant' === message.role))
474
+ }
475
+ };
476
+ samePrompt = JSON.stringify(messages.filter((message => 'system' !== message.role)).sort()) === JSON.stringify(prevMessages.filter((message => 'system' !== message.role)).sort());
477
+ const sameCharDiffChat = !samePrompt && curPrompt.firstSystem?.content === prevPrompt.firstSystem?.content && curPrompt.firstUser?.content !== prevPrompt.firstUser?.content;
478
+ shouldRenew = Config.Settings.RenewAlways || !Conversation.uuid || prevImpersonated || !Config.Settings.RenewAlways && samePrompt || sameCharDiffChat;
479
+ retryRegen = Config.Settings.RetryRegenerate && samePrompt && null != Conversation.uuid;
480
+ samePrompt || (prevMessages = JSON.parse(JSON.stringify(messages)));
481
+ let type = '';
482
+ if (retryRegen) {
483
+ type = 'R';
484
+ fetchAPI = await (async (signal, model) => {
485
+ let res;
486
+ const body = {
487
+ completion: {
488
+ prompt: '',
489
+ timezone: AI.zone(),
490
+ model: model || AI.mdl()
491
+ },
492
+ organization_uuid: uuidOrg,
493
+ conversation_uuid: Conversation.uuid,
494
+ text: ''
495
+ };
496
+ let headers = {
497
+ ...AI.hdr(Conversation.uuid || ''),
498
+ Accept: 'text/event-stream',
499
+ Cookie: getCookies()
500
+ };
501
+ if (Config.Settings.Superfetch) {
502
+ const names = Object.keys(headers), values = Object.values(headers);
503
+ headers = names.map(((header, idx) => `${header}: ${values[idx]}`));
504
+ }
505
+ res = await (Config.Settings.Superfetch ? Superfetch : fetch)(Config.rProxy + '/api/retry_message', {
506
+ stream: true,
507
+ signal,
508
+ method: 'POST',
509
+ body: JSON.stringify(body),
510
+ headers
511
+ });
512
+ updateParams(res);
513
+ await checkResErr(res);
514
+ return res;
515
+ })(signal, model);
516
+ } else if (shouldRenew) {
517
+ Conversation.uuid && await deleteChat(Conversation.uuid);
518
+ fetchAPI = await (async signal => {
519
+ Conversation.uuid = randomUUID().toString();
520
+ Conversation.depth = 0;
521
+ const res = await (Config.Settings.Superfetch ? Superfetch : fetch)(`${Config.rProxy}/api/organizations/${uuidOrg}/chat_conversations`, {
522
+ signal,
523
+ headers: {
524
+ ...AI.hdr(),
525
+ Cookie: getCookies()
526
+ },
527
+ method: 'POST',
528
+ body: JSON.stringify({
529
+ uuid: Conversation.uuid,
530
+ name: ''
531
+ })
532
+ });
533
+ updateParams(res);
534
+ await checkResErr(res);
535
+ return res;
536
+ })(signal);
537
+ type = 'r';
538
+ } else if (samePrompt) {} else {
539
+ const systemExperiment = !Config.Settings.RenewAlways && Config.Settings.SystemExperiments;
540
+ if (!systemExperiment || systemExperiment && Conversation.depth >= Config.SystemInterval) {
541
+ type = 'c-r';
542
+ Conversation.depth = 0;
543
+ } else {
544
+ type = 'c-c';
545
+ Conversation.depth++;
546
+ }
547
+ }
548
+ let {prompt, systems} = ((messages, type) => {
549
+ const rgxScenario = /^\[Circumstances and context of the dialogue: ([\s\S]+?)\.?\]$/i, rgxPerson = /^\[([\s\S]+?)'s personality: ([\s\S]+?)\]$/i, messagesClone = JSON.parse(JSON.stringify(messages)), realLogs = messagesClone.filter((message => [ 'user', 'assistant' ].includes(message.role))), sampleLogs = messagesClone.filter((message => message.name)), mergedLogs = [ ...sampleLogs, ...realLogs ];
550
+ mergedLogs.forEach(((message, idx) => {
551
+ const next = mergedLogs[idx + 1];
552
+ message.customname = (message => [ 'assistant', 'user' ].includes(message.role) && null != message.name && !(message.name in Replacements))(message);
553
+ if (next && !Config.Settings.xmlPlot) { //if (next) {
554
+ if ('name' in message && 'name' in next) {
555
+ if (message.name === next.name) {
556
+ message.content += '\n\n' + next.content; //message.content += '\n' + next.content;
557
+ next.merged = true;
558
+ }
559
+ } else if ('system' !== next.role) {
560
+ if (next.role === message.role) {
561
+ message.content += '\n\n' + next.content; //message.content += '\n' + next.content;
562
+ next.merged = true;
563
+ }
564
+ } else {
565
+ message.content += '\n\n' + next.content; //message.content += '\n' + next.content;
566
+ next.merged = true;
567
+ }
568
+ }
569
+ }));
570
+ const lastAssistant = realLogs.findLast((message => !message.merged && 'assistant' === message.role));
571
+ lastAssistant && Config.Settings.StripAssistant && (lastAssistant.strip = true);
572
+ const lastUser = realLogs.findLast((message => !message.merged && 'user' === message.role));
573
+ lastUser && Config.Settings.StripHuman && (lastUser.strip = true);
574
+ const systemMessages = messagesClone.filter((message => 'system' === message.role && !('name' in message)));
575
+ systemMessages.forEach(((message, idx) => {
576
+ const scenario = message.content.match(rgxScenario)?.[1], personality = message.content.match(rgxPerson);
577
+ if (scenario) {
578
+ message.content = Config.ScenarioFormat.replace(/{{scenario}}/gim, scenario);
579
+ message.scenario = true;
580
+ }
581
+ if (3 === personality?.length) {
582
+ message.content = Config.PersonalityFormat.replace(/{{char}}/gim, personality[1]).replace(/{{personality}}/gim, personality[2]);
583
+ message.personality = true;
584
+ }
585
+ message.main = 0 === idx;
586
+ message.jailbreak = idx === systemMessages.length - 1;
587
+ ' ' === message.content && (message.discard = true);
588
+ }));
589
+ Config.Settings.AllSamples && !Config.Settings.NoSamples && realLogs.forEach((message => {
590
+ if (![ lastUser, lastAssistant ].includes(message)) {
591
+ if ('user' === message.role) {
592
+ message.name = message.customname ? message.name : 'example_user';
593
+ message.role = 'system';
594
+ } else if ('assistant' === message.role) {
595
+ message.name = message.customname ? message.name : 'example_assistant';
596
+ message.role = 'system';
597
+ } else if (!message.customname) {
598
+ throw Error('Invalid role ' + message.name);
599
+ }
600
+ }
601
+ }));
602
+ Config.Settings.NoSamples && !Config.Settings.AllSamples && sampleLogs.forEach((message => {
603
+ if ('example_user' === message.name) {
604
+ message.role = 'user';
605
+ } else if ('example_assistant' === message.name) {
606
+ message.role = 'assistant';
607
+ } else if (!message.customname) {
608
+ throw Error('Invalid role ' + message.name);
609
+ }
610
+ message.customname || delete message.name;
611
+ }));
612
+ let systems = [];
613
+ if (![ 'r', 'R' ].includes(type)) {
614
+ lastUser.strip = true;
615
+ systemMessages.forEach((message => message.discard = message.discard || 'c-c' === type ? !message.jailbreak : !message.jailbreak && !message.main));
616
+ systems = systemMessages.filter((message => !message.discard)).map((message => `"${message.content.substring(0, 25).replace(/\n/g, '\\n').trim()}..."`));
617
+ messagesClone.forEach((message => message.discard = message.discard || mergedLogs.includes(message) && ![ lastUser ].includes(message)));
618
+ }
619
+ const prompt = messagesClone.map(((message, idx) => {
620
+ if (message.merged || message.discard) {
621
+ return '';
622
+ }
623
+ if (message.content.length < 1) {
624
+ return message.content;
625
+ }
626
+ let spacing = '';
627
+ /****************************************************************/
628
+ if (Config.Settings.xmlPlot) {
629
+ idx > 0 && (spacing = '\n\n');
630
+ const prefix = message.customname ? message.role + ': <customname>' + message.name + '</customname>: ' : 'system' !== message.role || message.name ? Replacements[message.name || message.role] + ': ' : 'xmlPlot: ' + Replacements[message.role];
631
+ return `${spacing}${prefix}${message.customname ? '<reply>\n' + message.content.trim() + '\n</reply>' : message.content}`;
632
+ } else {
633
+ /****************************************************************/
634
+ idx > 0 && (spacing = systemMessages.includes(message) ? '\n' : '\n\n');
635
+ const prefix = message.customname ? message.name + ': ' : 'system' !== message.role || message.name ? Replacements[message.name || message.role] + ': ' : '' + Replacements[message.role];
636
+ return `${spacing}${message.strip ? '' : prefix}${'system' === message.role ? message.content : message.content.trim()}`;
637
+ } //
638
+ }));
639
+ return {
640
+ prompt: genericFixes(prompt.join('')).trim(),
641
+ systems
642
+ };
643
+ })(messages, type);
644
+ console.log(`${model} [${type}]${!retryRegen && systems.length > 0 ? ' ' + systems.join(' / ') : ''}`);
645
+ 'R' !== type || prompt || (prompt = '...regen...');
646
+ /****************************************************************/
647
+ Config.Settings.xmlPlot && (prompt = xmlPlot(prompt));
648
+ Config.Settings.FullColon && (prompt = prompt.replace(/(?<=\n\n(H(?:uman)?|A(?:ssistant)?)):[ ]?/g, ': '));
649
+ Config.Settings.padtxt && (prompt = padtxt(prompt));
650
+ /****************************************************************/
651
+ Logger?.write(`\n\n-------\n[${(new Date).toLocaleString()}]\n####### PROMPT (${type}):\n${prompt}\n--\n####### REPLY:\n`);
652
+ retryRegen || (fetchAPI = await (async (signal, model, prompt, temperature, type) => {
653
+ const attachments = [];
654
+ if (Config.Settings.PromptExperiments) {
655
+ /****************************************************************/
656
+ let splitedprompt = prompt.split('\n\nPlainPrompt:');
657
+ prompt = splitedprompt[0];
658
+ /****************************************************************/
659
+ attachments.push({
660
+ extracted_content: (prompt),
661
+ file_name: 'paste.txt', //fileName(),
662
+ file_size: Buffer.from(prompt).byteLength,
663
+ file_type: 'txt' //'text/plain'
664
+ });
665
+ prompt = 'r' === type ? Config.PromptExperimentFirst : Config.PromptExperimentNext;
666
+ /****************************************************************/
667
+ splitedprompt.length > 1 && (prompt = prompt + splitedprompt[1]);
668
+ /****************************************************************/
669
+ }
670
+ let res;
671
+ const body = {
672
+ completion: {
673
+ ...Config.Settings.PassParams && {
674
+ temperature
675
+ },
676
+ prompt: prompt || '',
677
+ timezone: AI.zone(),
678
+ model: model || AI.mdl()
679
+ },
680
+ organization_uuid: uuidOrg,
681
+ conversation_uuid: Conversation.uuid,
682
+ text: prompt,
683
+ attachments
684
+ };
685
+ let headers = {
686
+ ...AI.hdr(Conversation.uuid || ''),
687
+ Accept: 'text/event-stream',
688
+ Cookie: getCookies()
689
+ };
690
+ res = await (Config.Settings.Superfetch ? Superfetch : fetch)(Config.rProxy + '/api/append_message', {
691
+ stream: true,
692
+ signal,
693
+ method: 'POST',
694
+ body: JSON.stringify(body),
695
+ headers
696
+ });
697
+ updateParams(res);
698
+ await checkResErr(res);
699
+ return res;
700
+ })(signal, model, prompt, temperature, type));
701
+ const response = Writable.toWeb(res);
702
+ clewdStream = new ClewdStream({
703
+ config: Config,
704
+ version: Main,
705
+ minSize: Config.BufferSize,
706
+ model,
707
+ streaming: body.stream,
708
+ abortControl,
709
+ source: fetchAPI
710
+ }, Logger);
711
+ titleTimer = setInterval((() => setTitle('recv ' + bytesToSize(clewdStream.size))), 300);
712
+ Config.Settings.Superfetch ? await Readable.toWeb(fetchAPI.body).pipeThrough(clewdStream).pipeTo(response) : await fetchAPI.body.pipeThrough(clewdStream).pipeTo(response);
713
+ } catch (err) {
714
+ if ('AbortError' === err.name) {
715
+ res.end();
716
+ } else {
717
+ err.planned || console.error('Clewd:\n%o', err);
718
+ res.json({
719
+ error: {
720
+ message: 'clewd: ' + (err.message || err.name || err.type),
721
+ type: err.type || err.name || err.code,
722
+ param: null,
723
+ code: err.code || 500
724
+ }
725
+ });
726
+ }
727
+ }
728
+ clearInterval(titleTimer);
729
+ if (clewdStream) {
730
+ clewdStream.censored && console.warn('likely your account is hard-censored');
731
+ prevImpersonated = clewdStream.impersonated;
732
+ setTitle('ok ' + bytesToSize(clewdStream.size));
733
+ //console.log(`${200 == fetchAPI.status ? '' : ''}${fetchAPI.status}!\n`);
734
+ /******************************** */
735
+ 429 == fetchAPI.status ? console.log(`Exceeded limit!\n`) : console.log(`${200 == fetchAPI.status ? '' : ''}${fetchAPI.status}!\n`);
736
+ changeflag += 1;
737
+ if (Config.CookieArray?.length > 0 && (429 == fetchAPI.status || (Config.Cookiecounter && changeflag >= Config.Cookiecounter))) {
738
+ changeflag = 0;
739
+ changer = true;
740
+ }
741
+ /******************************** */
742
+ clewdStream.empty();
743
+ }
744
+ if (prevImpersonated) {
745
+ try {
746
+ await deleteChat(Conversation.uuid);
747
+ } catch (err) {}
748
+ }
749
+ /******************************** */
750
+ changer && CookieChanger.emit('ChangeCookie');
751
+ /******************************** */
752
+ }));
753
+ })(req, res);
754
+ break;
755
+
756
+ case '/v1/complete':
757
+ res.json({
758
+ error: {
759
+ message: 'clewd: Set "Chat Completion" to OpenAI instead of Claude. Enable "External" models aswell'
760
+ }
761
+ });
762
+ break;
763
+
764
+ default:
765
+ req.url !== '/' && (console.log('unknown request: ' + req.url)); //console.log('unknown request: ' + req.url);
766
+ res.json({
767
+ error: {
768
+ message: '404 Not Found',
769
+ type: 404,
770
+ param: null,
771
+ code: 404
772
+ }
773
+ }, 200);
774
+ }
775
+ }));
776
+
777
+ !async function() {
778
+ await (async () => {
779
+ if (exists(ConfigPath)) {
780
+ const userConfig = require(ConfigPath), validConfigs = Object.keys(Config), parsedConfigs = Object.keys(userConfig), parsedSettings = Object.keys(userConfig.Settings), invalidConfigs = parsedConfigs.filter((config => !validConfigs.includes(config))), validSettings = Object.keys(Config.Settings);
781
+ UnknownSettings = parsedSettings.filter((setting => !validSettings.includes(setting)));
782
+ invalidConfigs.forEach((config => {
783
+ console.warn(`unknown config in config.js: ${config}`);
784
+ }));
785
+ UnknownSettings.forEach((setting => {
786
+ console.warn(`unknown setting in config.js: Settings.${setting}`);
787
+ }));
788
+ const missingConfigs = validConfigs.filter((config => !parsedConfigs.includes(config))), missingSettings = validSettings.filter((config => !parsedSettings.includes(config)));
789
+ missingConfigs.forEach((config => {
790
+ console.warn(`adding missing config in config.js: ${config}`);
791
+ userConfig[config] = Config[config];
792
+ }));
793
+ missingSettings.forEach((setting => {
794
+ console.warn(`adding missing setting in config.js: Settings.${setting}`);
795
+ userConfig.Settings[setting] = Config.Settings[setting];
796
+ }));
797
+ ChangedSettings = parsedSettings.filter((setting => Config.Settings[setting] !== userConfig.Settings[setting]));
798
+ (missingConfigs.length > 0 || missingSettings.length > 0) && await writeSettings(userConfig);
799
+ userConfig.Settings.LogMessages && (Logger = createWriteStream(LogPath));
800
+ Config = {
801
+ ...Config,
802
+ ...userConfig
803
+ };
804
+ } else {
805
+ Config.Cookie = 'SET YOUR COOKIE HERE';
806
+ writeSettings(Config, true);
807
+ }
808
+ /***************************** */
809
+ function convertToType(value) {
810
+ if (value === "true") return true;
811
+ if (value === "false") return false;
812
+ if (/^\d+$/.test(value)) return parseInt(value);
813
+ return value;
814
+ }
815
+ for (let key in Config) {
816
+ if (key === 'Settings') {
817
+ for (let setting in Config.Settings) {
818
+ Config.Settings[setting] = convertToType(process.env[setting]) ?? Config.Settings[setting];
819
+ }
820
+ } else {
821
+ Config[key] = key === 'CookieArray' ? (process.env[key]?.split(',')?.map(x => x.replace(/[\[\]"\s]/g, '')) ?? Config[key]) : (convertToType(process.env[key]) ?? Config[key]);
822
+ }
823
+ }
824
+ /***************************** */
825
+ })();
826
+ /***************************** */
827
+ !Config.rProxy && (Config.rProxy = AI.end());
828
+ Config.rProxy.endsWith('/') && (Config.rProxy = Config.rProxy.slice(0, -1));
829
+ let uniqueArr = [], seen = new Set();
830
+ for (let Cookie of Config.CookieArray) {
831
+ if (!seen.has(Cookie)) {
832
+ uniqueArr.push(Cookie);
833
+ seen.add(Cookie);
834
+ }
835
+ }
836
+ Config.CookieArray = uniqueArr;
837
+ !process.env.Cookie && !process.env.CookieArray && writeSettings(Config);
838
+ currentIndex = Config.CookieIndex > 0 ? Config.CookieIndex - 1 : Config.Cookiecounter >= 0 ? Math.floor(Math.random()*Config.CookieArray.length) : 0;
839
+ /***************************** */
840
+ Proxy.listen(Config.Port, Config.Ip, onListen);
841
+ Proxy.on('error', (err => {
842
+ console.error('Proxy error\n%o', err);
843
+ }));
844
+ }();
845
+
846
+ const cleanup = async () => {
847
+ console.log('cleaning...');
848
+ try {
849
+ await deleteChat(Conversation.uuid);
850
+ Logger?.close();
851
+ } catch (err) {}
852
+ process.exit();
853
+ };
854
+
855
+ process.on('SIGHUP', cleanup);
856
+
857
+ process.on('SIGTERM', cleanup);
858
+
859
+ process.on('SIGINT', cleanup);
860
+
861
+ process.on('exit', (async () => {
862
+ console.log('exiting...');
863
+ }));
config.js ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * https://rentry.org/teralomaniac_clewd
3
+ * https://github.com/teralomaniac/clewd
4
+ */
5
+
6
+ // SET YOUR COOKIE BELOW
7
+
8
+ module.exports = {
9
+ "Cookie": "sessionKey=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",
10
+ "CookieArray": [
11
+ "sessionKey=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",
12
+ "sessionKey=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",
13
+ "sessionKey=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",
14
+ "sessionKey=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",
15
+ "sessionKey=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",
16
+ "sessionKey=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",
17
+ "sessionKey=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",
18
+ "sessionKey=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",
19
+ "sessionKey=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",
20
+ "sessionKey=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",
21
+ "sessionKey=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",
22
+ "sessionKey=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",
23
+ "sessionKey=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",
24
+ "sessionKey=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",
25
+ "sessionKey=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",
26
+ "sessionKey=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",
27
+ "sessionKey=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",
28
+ "sessionKey=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",
29
+ "sessionKey=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",
30
+ "sessionKey=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",
31
+ "sessionKey=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",
32
+ "sessionKey=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",
33
+ "sessionKey=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",
34
+ "sessionKey=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",
35
+ "sessionKey=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",
36
+ "sessionKey=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",
37
+ "sessionKey=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",
38
+ "sessionKey=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",
39
+ "sessionKey=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",
40
+ "sessionKey=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",
41
+ "sessionKey=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",
42
+ "sessionKey=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",
43
+ "sessionKey=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",
44
+ "sessionKey=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",
45
+ "sessionKey=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",
46
+ "sessionKey=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",
47
+ "sessionKey=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",
48
+ "sessionKey=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",
49
+ "sessionKey=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",
50
+ "sessionKey=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",
51
+ "sessionKey=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",
52
+ "sessionKey=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",
53
+ "sessionKey=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",
54
+ "sessionKey=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",
55
+ "sessionKey=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",
56
+ "sessionKey=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",
57
+ "sessionKey=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",
58
+ "sessionKey=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",
59
+ "sessionKey=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",
60
+ "sessionKey=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",
61
+ "sessionKey=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",
62
+ "sessionKey=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",
63
+ "sessionKey=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",
64
+ "sessionKey=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",
65
+ "sessionKey=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",
66
+ "sessionKey=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",
67
+ "sessionKey=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",
68
+ "sessionKey=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",
69
+ "sessionKey=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",
70
+ "sessionKey=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",
71
+ "sessionKey=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",
72
+ "sessionKey=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",
73
+ "sessionKey=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",
74
+ "sessionKey=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",
75
+ "sessionKey=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",
76
+ "sessionKey=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",
77
+ "sessionKey=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",
78
+ "sessionKey=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",
79
+ "sessionKey=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",
80
+ "sessionKey=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",
81
+ "sessionKey=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",
82
+ "sessionKey=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",
83
+ "sessionKey=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",
84
+ "sessionKey=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",
85
+ "sessionKey=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",
86
+ "sessionKey=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",
87
+ "sessionKey=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",
88
+ "sessionKey=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",
89
+ "sessionKey=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",
90
+ "sessionKey=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",
91
+ "sessionKey=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",
92
+ "sessionKey=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",
93
+ "sessionKey=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",
94
+ "sessionKey=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",
95
+ "sessionKey=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",
96
+ "sessionKey=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",
97
+ "sessionKey=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",
98
+ "sessionKey=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",
99
+ "sessionKey=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",
100
+ "sessionKey=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",
101
+ "sessionKey=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",
102
+ "sessionKey=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",
103
+ "sessionKey=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",
104
+ "sessionKey=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",
105
+ "sessionKey=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",
106
+ "sessionKey=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",
107
+ "sessionKey=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",
108
+ "sessionKey=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",
109
+ "sessionKey=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",
110
+ "sessionKey=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",
111
+ "sessionKey=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",
112
+ "sessionKey=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",
113
+ "sessionKey=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",
114
+ "sessionKey=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",
115
+ "sessionKey=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",
116
+ "sessionKey=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",
117
+ "sessionKey=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",
118
+ "sessionKey=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",
119
+ "sessionKey=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",
120
+ "sessionKey=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",
121
+ "sessionKey=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",
122
+ "sessionKey=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",
123
+ "sessionKey=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",
124
+ "sessionKey=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",
125
+ "sessionKey=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",
126
+ "sessionKey=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",
127
+ "sessionKey=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",
128
+ "sessionKey=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",
129
+ "sessionKey=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",
130
+ "sessionKey=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",
131
+ "sessionKey=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",
132
+ "sessionKey=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",
133
+ "sessionKey=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",
134
+ "sessionKey=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",
135
+ "sessionKey=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",
136
+ "sessionKey=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",
137
+ "sessionKey=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",
138
+ "sessionKey=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",
139
+ "sessionKey=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",
140
+ "sessionKey=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",
141
+ "sessionKey=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",
142
+ "sessionKey=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",
143
+ "sessionKey=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",
144
+ "sessionKey=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",
145
+ "sessionKey=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",
146
+ "sessionKey=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",
147
+ "sessionKey=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",
148
+ "sessionKey=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",
149
+ "sessionKey=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",
150
+ "sessionKey=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",
151
+ "sessionKey=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",
152
+ "sessionKey=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",
153
+ "sessionKey=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",
154
+ "sessionKey=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",
155
+ "sessionKey=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",
156
+ "sessionKey=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",
157
+ "sessionKey=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",
158
+ "sessionKey=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",
159
+ "sessionKey=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",
160
+ "sessionKey=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",
161
+ "sessionKey=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",
162
+ "sessionKey=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",
163
+ "sessionKey=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",
164
+ "sessionKey=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",
165
+ "sessionKey=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",
166
+ "sessionKey=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",
167
+ "sessionKey=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",
168
+ "sessionKey=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",
169
+ "sessionKey=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",
170
+ "sessionKey=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",
171
+ "sessionKey=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",
172
+ "sessionKey=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",
173
+ "sessionKey=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",
174
+ "sessionKey=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",
175
+ "sessionKey=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",
176
+ "sessionKey=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",
177
+ "sessionKey=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",
178
+ "sessionKey=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",
179
+ "sessionKey=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",
180
+ "sessionKey=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",
181
+ "sessionKey=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",
182
+ "sessionKey=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",
183
+ "sessionKey=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",
184
+ "sessionKey=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",
185
+ "sessionKey=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",
186
+ "sessionKey=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",
187
+ "sessionKey=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",
188
+ "sessionKey=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",
189
+ "sessionKey=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",
190
+ "sessionKey=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",
191
+ "sessionKey=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",
192
+ "sessionKey=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",
193
+ "sessionKey=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",
194
+ "sessionKey=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",
195
+ "sessionKey=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",
196
+ "sessionKey=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",
197
+ "sessionKey=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",
198
+ "sessionKey=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",
199
+ "sessionKey=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",
200
+ "sessionKey=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",
201
+ "sessionKey=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",
202
+ "sessionKey=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",
203
+ "sessionKey=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",
204
+ "sessionKey=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",
205
+ "sessionKey=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",
206
+ "sessionKey=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",
207
+ "sessionKey=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",
208
+ "sessionKey=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",
209
+ "sessionKey=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",
210
+ "sessionKey=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",
211
+ "sessionKey=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",
212
+ "sessionKey=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",
213
+ "sessionKey=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",
214
+ "sessionKey=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",
215
+ "sessionKey=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",
216
+ "sessionKey=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",
217
+ "sessionKey=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",
218
+ "sessionKey=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",
219
+ "sessionKey=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",
220
+ "sessionKey=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",
221
+ "sessionKey=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",
222
+ "sessionKey=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",
223
+ "sessionKey=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",
224
+ "sessionKey=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",
225
+ "sessionKey=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",
226
+ "sessionKey=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",
227
+ "sessionKey=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",
228
+ "sessionKey=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",
229
+ "sessionKey=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",
230
+ "sessionKey=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",
231
+ "sessionKey=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",
232
+ "sessionKey=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",
233
+ "sessionKey=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",
234
+ "sessionKey=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",
235
+ "sessionKey=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",
236
+ "sessionKey=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",
237
+ "sessionKey=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",
238
+ "sessionKey=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",
239
+ "sessionKey=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"
240
+ ],
241
+ "Cookiecounter": 1,
242
+ "CookieIndex": 0,
243
+ "Ip": "127.0.0.1",
244
+ "Port": 8444,
245
+ "localtunnel": false,
246
+ "BufferSize": 1,
247
+ "SystemInterval": 3,
248
+ "rProxy": "https://claude.ai",
249
+ "padtxt_placeholder": "♠️♥️♣️♦️ ",
250
+ "PromptExperimentFirst": "",
251
+ "PromptExperimentNext": "",
252
+ "PersonalityFormat": "{{char}}'s personality: {{personality}}",
253
+ "ScenarioFormat": "Dialogue scenario: {{scenario}}",
254
+ "Settings": {
255
+ "RenewAlways": true,
256
+ "RetryRegenerate": false,
257
+ "PromptExperiments": true,
258
+ "SystemExperiments": true,
259
+ "PreventImperson": false,
260
+ "AllSamples": false,
261
+ "NoSamples": false,
262
+ "StripAssistant": false,
263
+ "StripHuman": false,
264
+ "PassParams": false,
265
+ "ClearFlags": true,
266
+ "PreserveChats": false,
267
+ "LogMessages": true,
268
+ "FullColon": true,
269
+ "padtxt": 15000,
270
+ "xmlPlot": true,
271
+ "Superfetch": true
272
+ }
273
+ }
274
+
275
+ /*
276
+ BufferSize
277
+ * How many characters will be buffered before the AI types once
278
+ * lower = less chance of `PreventImperson` working properly
279
+
280
+ ---
281
+
282
+ SystemInterval
283
+ * How many messages until `SystemExperiments alternates`
284
+
285
+ ---
286
+
287
+ Other settings
288
+ * https://gitgud.io/ahsk/clewd/#defaults
289
+ * and
290
+ * https://gitgud.io/ahsk/clewd/-/blob/master/CHANGELOG.md
291
+ */
docker/.gitkeep ADDED
File without changes
docker/Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Node.js image as the base image
2
+ FROM node:20.4
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Copy the package.json and package-lock.json files to the container
8
+ COPY package*.json ./
9
+
10
+ # Install the dependencies
11
+ RUN npm install --no-audit --fund false
12
+
13
+ # Copy the rest of the files to the container
14
+ COPY . .
15
+
16
+ # Change ownership of files in lib/bin and set permissions
17
+ RUN chown -R node:node lib/bin/* && \
18
+ chmod u+x lib/bin/* && \
19
+ chmod -R 777 /app
20
+
21
+ # Run as the "node" user for better security practices
22
+ USER node
23
+
24
+ RUN ls -la
25
+
26
+ # Start the application
27
+ CMD ["node", "clewd.js"]
docker/docker-compose.yml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+ services:
3
+ app:
4
+ build:
5
+ context: ..
6
+ dockerfile: docker/Dockerfile
7
+
8
+ ports:
9
+ - 8444:8444
10
+ volumes:
11
+ - ..:/app
lib/bin/ca ADDED
The diff for this file is too large to render. See raw diff
 
lib/bin/clewd-superfetch-android-arm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f524228ff0e88ff4af4ee256feae6773940ab0c3c860d584d86b04180ede8bdd
3
+ size 1887544
lib/bin/clewd-superfetch-linux-amd64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e0d288fd341a3d9b246575bf77823b1da118331d0d894ba9831574d4ce25354
3
+ size 3215216
lib/bin/clewd-superfetch-linux-arm64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc9cfb42756416646536a11b351d205ab2e875761efd6ae1be465b3ae822e0a2
3
+ size 2772712
lib/bin/clewd-superfetch-mac-amd64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:189905a94af1be6fc6458b91e0166aefdedac4f4054f8f153b7f57430deb492f
3
+ size 2836216
lib/bin/clewd-superfetch-win-amd64.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a3e460b97a2a31a89cce4ab8bbb9a56aca7747edf07947c30941ba1100b41053
3
+ size 4712448
lib/clewd-stream.js ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * https://gitgud.io/ahsk/clewd
3
+ * https://github.com/h-a-s-k/clewd
4
+ */
5
+ 'use strict';
6
+
7
+ const {AI, genericFixes, DangerChars, encodeDataJSON, indexOfAny, cleanJSON, checkResErr} = require('./clewd-utils'), Decoder = new TextDecoder;
8
+
9
+ class ClewdStream extends TransformStream {
10
+ constructor(opts, logger) {
11
+ super({
12
+ transform: (chunk, controller) => {
13
+ this.#handle(chunk, controller);
14
+ },
15
+ flush: controller => {
16
+ this.#done(controller);
17
+ }
18
+ });
19
+ this.#logger = logger;
20
+ this.#version = opts.version;
21
+ this.#config = opts.config;
22
+ this.#model = opts.model || AI.mdl();
23
+ this.#streaming = opts.streaming || false;
24
+ this.#minSize = opts.minSize || 8;
25
+ this.#abortControl = opts.abortControl;
26
+ this.#source = opts.source;
27
+ }
28
+ #source=void 0;
29
+ #ended=false;
30
+ #streaming=void 0;
31
+ #minSize=void 0;
32
+ #compOK='';
33
+ #compRaw='';
34
+ #logger=void 0;
35
+ #version=void 0;
36
+ #config=void 0;
37
+ #abortControl=void 0;
38
+ #model=void 0;
39
+ #compAll=[];
40
+ #recvLength=0;
41
+ #stopLoc=void 0;
42
+ #stopReason=void 0;
43
+ #hardCensor=false;
44
+ #impersonated=false;
45
+ #cookiechange=false;
46
+ #readonly=false;
47
+ get size() {
48
+ return this.#recvLength;
49
+ }
50
+ get total() {
51
+ return this.#compAll.length;
52
+ }
53
+ get censored() {
54
+ return this.#hardCensor;
55
+ }
56
+ get impersonated() {
57
+ return this.#impersonated;
58
+ }
59
+ empty() {
60
+ this.#compOK = this.#compRaw = '';
61
+ this.#compAll = [];
62
+ this.#recvLength = 0;
63
+ }
64
+ #collectBuf() {
65
+ const valid = [ ...this.#compOK ], selection = valid.splice(0, Math.min(this.#minSize, valid.length)).join('');
66
+ this.#compOK = valid.join('');
67
+ return selection;
68
+ }
69
+ #err(err, controller) {
70
+ this.#logger?.write(JSON.stringify(err, null, 4));
71
+ const message = `## ${this.#version}\n**${AI.mdl()} error**:\n${err.status || err.code || err.type}\n\n\`\`\`${err.message}\`\`\``;
72
+ this.#enqueue(this.#build(message), controller);
73
+ return this.#endEarly(controller);
74
+ }
75
+ #build(selection) {
76
+ this.#logger?.write(selection);
77
+ const completion = this.#streaming ? {
78
+ choices: [ {
79
+ delta: {
80
+ content: genericFixes(selection)
81
+ }
82
+ } ]
83
+ } : {
84
+ choices: [ {
85
+ message: {
86
+ content: genericFixes(selection)
87
+ }
88
+ } ]
89
+ };
90
+ return this.#streaming ? encodeDataJSON(completion) : JSON.stringify(completion);
91
+ }
92
+ #enqueue(selection, controller) {
93
+ this.#ended || controller.enqueue(selection);
94
+ }
95
+ #print() {}
96
+ async #done(controller) {
97
+ this.#compRaw.length > 0 && await this.#parseBuf(this.#compRaw, controller);
98
+ this.#streaming ? this.#compOK.length > 0 && this.#enqueue(this.#build(this.#compOK), controller) : this.#enqueue(this.#build(this.#compAll.join('')), controller);
99
+ this.#compAll?.[0] === Buffer.from([ 73, 32, 97, 112, 111, 108, 111, 103, 105, 122, 101, 44, 32, 98, 117, 116, 32, 73, 32, 119, 105, 108, 108, 32, 110, 111, 116, 32, 112, 114, 111, 118, 105, 100, 101, 32, 97, 110, 121, 32, 114, 101, 115, 112, 111, 110, 115, 101, 115, 32, 116, 104, 97, 116, 32, 118, 105, 111, 108, 97, 116, 101, 32, 65, 110, 116, 104, 114, 111, 112, 105, 99, 39, 115, 32, 65, 99, 99, 101, 112, 116, 97, 98, 108, 101, 32, 85, 115, 101, 32, 80, 111, 108, 105, 99, 121, 32, 111, 114, 32, 99, 111, 117, 108, 100, 32, 112, 114, 111, 109, 111, 116, 101, 32, 104, 97, 114, 109, 46 ]).toString() && (this.#hardCensor = true);
100
+ if (!this.#ended && 0 === this.total) {
101
+ const err = `## ${this.#version}\n**error**:\n\n\`\`\`Received no valid replies at all\`\`\``;
102
+ this.#enqueue(this.#build(err), controller);
103
+ }
104
+ this.#streaming && this.#enqueue('data: [DONE]\n\n', controller);
105
+ this.#print();
106
+ this.#ended = true;
107
+ }
108
+ #endEarly(controller) {
109
+ if (!this.#ended) {
110
+ this.#streaming && this.#enqueue('data: [DONE]\n\n', controller);
111
+ this.#config.Settings.Superfetch && this.#source.rape();
112
+ this.#abortControl.abort();
113
+ controller.terminate();
114
+ this.#print();
115
+ this.#ended = true;
116
+ }
117
+ }
118
+ #impersonationCheck(reply, controller) {
119
+ const fakeAny = indexOfAny(reply);
120
+ if (fakeAny > -1) {
121
+ this.#impersonated = true;
122
+ if (this.#config.Settings.PreventImperson) {
123
+ const selection = reply.substring(0, fakeAny);
124
+ this.#enqueue(this.#build(selection), controller);
125
+ this.#endEarly(controller);
126
+ }
127
+ }
128
+ }
129
+ async #handle(chunk, controller) {
130
+ if ('string' != typeof chunk) {
131
+ this.#recvLength += chunk.byteLength;
132
+ chunk = Decoder.decode(chunk, {'stream': true}); //chunk = Decoder.decode(chunk);
133
+ } else {
134
+ this.#recvLength += Buffer.byteLength(chunk);
135
+ }
136
+ this.#compRaw += chunk;
137
+ const substr = this.#compRaw.split('\n\n'), lastMsg = substr.length - 1;
138
+ 0 !== substr[lastMsg].length ? this.#compRaw = substr[lastMsg] : this.#compRaw = '';
139
+ for (let i = 0; i < lastMsg; i++) {
140
+ await this.#parseBuf(substr[i], controller);
141
+ }
142
+ }
143
+ async #parseBuf(json, controller) {
144
+ if (!json) {
145
+ return;
146
+ }
147
+ if (this.#ended) {
148
+ return;
149
+ }
150
+ let parsed, delayChunk;
151
+ try {
152
+ parsed = JSON.parse(cleanJSON(json));
153
+ if (parsed.error) {
154
+ const err = await checkResErr(JSON.stringify({
155
+ error: {
156
+ ...parsed.error
157
+ },
158
+ status: this.#source.status,
159
+ superfetch: this.#source.superfetch
160
+ }), false);
161
+ delete err.stack;
162
+ return this.#err(err, controller);
163
+ }
164
+ if (parsed.completion) {
165
+ parsed.completion = genericFixes(parsed.completion);
166
+ this.#compOK += parsed.completion;
167
+ this.#compAll.push(parsed.completion);
168
+ delayChunk = DangerChars.some((char => this.#compOK.endsWith(char) || parsed.completion.startsWith(char)));
169
+ }
170
+ !this.#stopLoc && parsed.stop && (this.#stopLoc = parsed.stop.replace(/\n/g, '\\n'));
171
+ !this.#stopReason && parsed.stop_reason && (this.#stopReason = parsed.stop_reason);
172
+ if (this.#streaming) {
173
+ delayChunk && this.#impersonationCheck(this.#compOK, controller);
174
+ for (;!delayChunk && this.#compOK.length >= this.#minSize; ) {
175
+ const selection = this.#collectBuf();
176
+ this.#enqueue(this.#build(selection), controller);
177
+ }
178
+ } else {
179
+ delayChunk && this.#impersonationCheck(this.#compAll.join(''), controller);
180
+ }
181
+ } catch (err) {}
182
+ }
183
+ }
184
+
185
+ module.exports = ClewdStream;
lib/clewd-superfetch.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ /*
2
+ * https://gitgud.io/ahsk/clewd
3
+ * https://github.com/h-a-s-k/clewd
4
+ */"use strict";const{spawn:e}=require("node:child_process"),{relative:r,resolve:t,join:s,normalize:n,basename:o}=require("node:path"),{writeFileSync:a,unlinkSync:d,existsSync:i}=require("node:fs"),{ReadableStream:c}=require("node:stream/web"),l=e=>"win32"===process.platform?".\\"+e:e,m=e=>"win32"===process.platform||e.indexOf(" ")>-1?`"${e}"`:e,u={win32:{x64:"clewd-superfetch-win-amd64.exe"},darwin:{x64:"clewd-superfetch-mac-amd64",arm64:"clewd-superfetch-linux-arm64"},linux:{x64:"clewd-superfetch-linux-amd64",arm64:"clewd-superfetch-linux-arm64"},android:{x64:"clewd-superfetch-linux-amd64",arm64:"clewd-superfetch-linux-arm64",arm:"clewd-superfetch-android-arm"}}[process.platform]?.[process.arch],f=""+n(r("./","./bin/"+u)),p=n(t(__dirname,f,"../","../")),h=t(p,f);let b=[123,34,115,101,99,45,99,104,45,117,97,34,58,34,92,34,67,104,114,111,109,105,117,109,92,34,59,118,61,92,34,49,49,48,92,34,44,32,92,34,78,111,116,32,65,40,66,114,97,110,100,92,34,59,118,61,92,34,50,52,92,34,44,32,92,34,71,111,111,103,108,101,32,67,104,114,111,109,101,92,34,59,118,61,92,34,49,49,48,92,34,34,44,34,115,101,99,45,99,104,45,117,97,45,109,111,98,105,108,101,34,58,34,63,48,34,44,34,115,101,99,45,99,104,45,117,97,45,112,108,97,116,102,111,114,109,34,58,34,92,34,87,105,110,100,111,119,115,92,34,34,44,34,85,112,103,114,97,100,101,45,73,110,115,101,99,117,114,101,45,82,101,113,117,101,115,116,115,34,58,34,49,34,44,34,85,115,101,114,45,65,103,101,110,116,34,58,34,77,111,122,105,108,108,97,47,53,46,48,32,40,87,105,110,100,111,119,115,32,78,84,32,49,48,46,48,59,32,87,105,110,54,52,59,32,120,54,52,41,32,65,112,112,108,101,87,101,98,75,105,116,47,53,51,55,46,51,54,32,40,75,72,84,77,76,44,32,108,105,107,101,32,71,101,99,107,111,41,32,67,104,114,111,109,101,47,49,49,48,46,48,46,48,46,48,32,83,97,102,97,114,105,47,53,51,55,46,51,54,34,44,34,65,99,99,101,112,116,34,58,34,116,101,120,116,47,104,116,109,108,44,97,112,112,108,105,99,97,116,105,111,110,47,120,104,116,109,108,43,120,109,108,44,97,112,112,108,105,99,97,116,105,111,110,47,120,109,108,59,113,61,48,46,57,44,105,109,97,103,101,47,97,118,105,102,44,105,109,97,103,101,47,119,101,98,112,44,105,109,97,103,101,47,97,112,110,103,44,42,47,42,59,113,61,48,46,56,44,97,112,112,108,105,99,97,116,105,111,110,47,115,105,103,110,101,100,45,101,120,99,104,97,110,103,101,59,118,61,98,51,59,113,61,48,46,55,34,44,34,83,101,99,45,70,101,116,99,104,45,83,105,116,101,34,58,34,110,111,110,101,34,44,34,83,101,99,45,70,101,116,99,104,45,77,111,100,101,34,58,34,110,97,118,105,103,97,116,101,34,44,34,83,101,99,45,70,101,116,99,104,45,85,115,101,114,34,58,34,63,49,34,44,34,83,101,99,45,70,101,116,99,104,45,68,101,115,116,34,58,34,100,111,99,117,109,101,110,116,34,44,34,65,99,99,101,112,116,45,69,110,99,111,100,105,110,103,34,58,34,103,122,105,112,44,32,100,101,102,108,97,116,101,44,32,98,114,34,44,34,65,99,99,101,112,116,45,76,97,110,103,117,97,103,101,34,58,34,101,110,45,85,83,44,101,110,59,113,61,48,46,57,34,125],w=[91,34,45,45,99,105,112,104,101,114,115,32,84,76,83,95,65,69,83,95,49,50,56,95,71,67,77,95,83,72,65,50,53,54,44,84,76,83,95,65,69,83,95,50,53,54,95,71,67,77,95,83,72,65,51,56,52,44,84,76,83,95,67,72,65,67,72,65,50,48,95,80,79,76,89,49,51,48,53,95,83,72,65,50,53,54,44,69,67,68,72,69,45,69,67,68,83,65,45,65,69,83,49,50,56,45,71,67,77,45,83,72,65,50,53,54,44,69,67,68,72,69,45,82,83,65,45,65,69,83,49,50,56,45,71,67,77,45,83,72,65,50,53,54,44,69,67,68,72,69,45,69,67,68,83,65,45,65,69,83,50,53,54,45,71,67,77,45,83,72,65,51,56,52,44,69,67,68,72,69,45,82,83,65,45,65,69,83,50,53,54,45,71,67,77,45,83,72,65,51,56,52,44,69,67,68,72,69,45,69,67,68,83,65,45,67,72,65,67,72,65,50,48,45,80,79,76,89,49,51,48,53,44,69,67,68,72,69,45,82,83,65,45,67,72,65,67,72,65,50,48,45,80,79,76,89,49,51,48,53,44,69,67,68,72,69,45,82,83,65,45,65,69,83,49,50,56,45,83,72,65,44,69,67,68,72,69,45,82,83,65,45,65,69,83,50,53,54,45,83,72,65,44,65,69,83,49,50,56,45,71,67,77,45,83,72,65,50,53,54,44,65,69,83,50,53,54,45,71,67,77,45,83,72,65,51,56,52,44,65,69,83,49,50,56,45,83,72,65,44,65,69,83,50,53,54,45,83,72,65,34,44,34,34,44,34,45,45,104,116,116,112,50,34,44,34,45,45,104,116,116,112,50,45,110,111,45,115,101,114,118,101,114,45,112,117,115,104,34,44,34,45,45,102,97,108,115,101,45,115,116,97,114,116,34,44,34,45,45,99,111,109,112,114,101,115,115,101,100,34,44,34,45,45,116,108,115,118,49,46,50,34,44,34,45,45,110,111,45,110,112,110,34,44,34,45,45,97,108,112,115,34,44,34,45,45,116,108,115,45,112,101,114,109,117,116,101,45,101,120,116,101,110,115,105,111,110,115,34,44,34,45,45,99,101,114,116,45,99,111,109,112,114,101,115,115,105,111,110,32,98,114,111,116,108,105,34,44,34,45,45,108,111,99,97,116,105,111,110,34,93];const y=(e=false)=>{if(!u||!i(h)){e&&console.warn(`superfetch [err] unavailable for ${process.platform}-${process.arch}, use 3.8.5 for the time being\n`);return false}e&&console.log(`superfetch [found] ${r(__dirname,h)}\n`);return true},x=(t,n)=>{n.headers||(n.headers={});"string"!=typeof n.body&&(n.body=n.body?JSON.stringify(n.body):"");if(!y())return;const o=r("./","bin/cfg"),i=r("./","bin/pyld"),c=r("./","bin/hdr"),u=r("./","bin/ca");let x={...JSON.parse(Buffer.from(b).toString()),...n.headers};const S=Object.values(x);x=Object.keys(x).map(((e,r)=>`${e}: ${S[r]}`));const _=m(l(o)),g=m(l(c)),v=m(l(i)),O=["-v","--cacert",""+m(l(u)),"--config",""+_,"--header","@"+g];if("POST"===n.method){O.push("--data");O.push("@"+v)}const j=[...JSON.parse(Buffer.from(w).toString()),"-X "+(n.method||"GET")];a(s(__dirname,o),j.join("\n"));a(s(__dirname,c),x.join("\n"));n.body&&a(s(__dirname,i),n.body);return new Promise((r=>{const a=e("android"===process.platform?h:f,[...O,""+t],{cwd:p,windowsHide:true,killSignal:"SIGKILL",windowsVerbatimArguments:true,detached:"win32"!==process.platform});a.superfetch=true;a.rape=function(){this.stdout?.end();this.stderr?.end()}.bind(a);a.once("spawn",(()=>{a.stream=n.stream||false;if(a.stream){Object.defineProperty(a,"body",{get:()=>a.stdout});return r(a)}a.body="";a.stdout.on("data",(e=>a.body+=e.toString()));a.json=async()=>JSON.parse(a.body);a.text=async()=>a.body;a.stdout.on("end",(()=>{a.stdout.removeAllListeners();return r(a)}))}));a.once("error",(e=>{console.warn("superfetch [err]",e)}));a.once("close",(()=>{try{d(s(__dirname,o));d(s(__dirname,c));n.body&&d(s(__dirname,i))}catch(e){}a.stdout.removeAllListeners();a.stderr.removeAllListeners();this.body?.removeAllListeners()}));a.stderr.on("data",(e=>{const r=/HTTP\/2 (\d{3})+/g,t=(e=e.toString().trim()).match(r);if(!a.status&&t){const t=r.exec(e);a.status=+t[1]}const s=/(?:< )(.+?)(?:: )(.+)/g,n=e.match(s);if(n){const e={};n.forEach((r=>{const t=r.split(s);e[t?.[1]]=t?.[2]}));a.headers=e}}))}))};module.exports.ClewdSuperfetch=x;module.exports.SuperfetchAvailable=y;module.exports.Binary=f;
lib/clewd-utils.js ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * https://gitgud.io/ahsk/clewd
3
+ * https://github.com/h-a-s-k/clewd
4
+ */
5
+ 'use strict';
6
+
7
+ const {randomInt, randomBytes} = require('node:crypto'), {version: Version} = require('../package.json'), Encoder = (new TextDecoder,
8
+ new TextEncoder), Main = 'clewd v' + Version + '修改版 by tera', Replacements = {
9
+ user: 'Human',
10
+ assistant: 'Assistant',
11
+ system: '',
12
+ example_user: 'H',
13
+ example_assistant: 'A'
14
+ }, DangerChars = [ ...new Set([ ...Object.values(Replacements).join(''), ...'\n', ...':', ...'\\n' ]) ].filter((char => ' ' !== char)).sort(), AI = {
15
+ end: () => Buffer.from([ 104, 116, 116, 112, 115, 58, 47, 47, 99, 108, 97, 117, 100, 101, 46, 97, 105 ]).toString(),
16
+ mdl: () => Buffer.from([ 99, 108, 97, 117, 100, 101, 45, 50 ]).toString(),
17
+ zone: () => Buffer.from([ 65, 109, 101, 114, 105, 99, 97, 47, 78, 101, 119, 95, 89, 111, 114, 107 ]).toString(),
18
+ agent: () => Buffer.from([ 77, 111, 122, 105, 108, 108, 97, 47, 53, 46, 48, 32, 40, 77, 97, 99, 105, 110, 116, 111, 115, 104, 59, 32, 73, 110, 116, 101, 108, 32, 77, 97, 99, 32, 79, 83, 32, 88, 32, 49, 48, 95, 49, 53, 95, 55, 41, 32, 65, 112, 112, 108, 101, 87, 101, 98, 75, 105, 116, 47, 53, 51, 55, 46, 51, 54, 32, 40, 75, 72, 84, 77, 76, 44, 32, 108, 105, 107, 101, 32, 71, 101, 99, 107, 111, 41, 32, 67, 104, 114, 111, 109, 101, 47, 49, 49, 52, 46, 48, 46, 48, 46, 48, 32, 83, 97, 102, 97, 114, 105, 47, 53, 51, 55, 46, 51, 54, 32, 69, 100, 103, 47, 49, 49, 52, 46, 48, 46, 49, 56, 50, 51, 46, 55, 57 ]).toString(),
19
+ cp: () => Buffer.from([ 55, 55, 49, 44, 52, 56, 54, 53, 45, 52, 56, 54, 54, 45, 52, 56, 54, 55, 45, 52, 57, 49, 57, 53, 45, 52, 57, 49, 57, 57, 45, 52, 57, 49, 57, 54, 45, 52, 57, 50, 48, 48, 45, 53, 50, 51, 57, 51, 45, 53, 50, 51, 57, 50, 45, 52, 57, 49, 55, 49, 45, 52, 57, 49, 55, 50, 45, 49, 53, 54, 45, 49, 53, 55, 45, 52, 55, 45, 53, 51, 44, 48, 45, 50, 51, 45, 54, 53, 50, 56, 49, 45, 49, 48, 45, 49, 49, 45, 51, 53, 45, 49, 54, 45, 53, 45, 49, 51, 45, 49, 56, 45, 53, 49, 45, 52, 53, 45, 52, 51, 45, 50, 55, 45, 49, 55, 53, 49, 51, 45, 50, 49, 44, 50, 57, 45, 50, 51, 45, 50, 52, 44, 48 ]).toString(),
20
+ hdr: refPath => ({
21
+ 'Content-Type': 'application/json',
22
+ Referer: `${AI.end()}/${refPath ? 'chat/' + refPath : ''}`,
23
+ Origin: '' + AI.end()
24
+ })
25
+ }, indexOfH = (text, last = false) => {
26
+ let location = -1;
27
+ const matchesH = text.match(/(?:(?:\\n)|\n){2}((?:Human|H): ?)/gm);
28
+ matchesH?.length > 0 && (location = last ? text.lastIndexOf(matchesH[matchesH.length - 1]) : text.indexOf(matchesH[0]));
29
+ return location;
30
+ }, indexOfA = (text, last = false) => {
31
+ let location = -1;
32
+ const matchesA = text.match(/(?:(?:\\n)|\n){2}((?:Assistant|A): ?)/gm);
33
+ matchesA?.length > 0 && (location = last ? text.lastIndexOf(matchesA[matchesA.length - 1]) : text.indexOf(matchesA[0]));
34
+ return location;
35
+ };
36
+
37
+ module.exports.encodeDataJSON = completion => Encoder.encode(`data: ${JSON.stringify(completion)}\n\n`);
38
+
39
+ module.exports.genericFixes = text => text.replace(/(\r\n|\r|\\n)/gm, '\n');
40
+
41
+ module.exports.Replacements = Replacements;
42
+
43
+ module.exports.DangerChars = DangerChars;
44
+
45
+ module.exports.checkResErr = async (res, throwIt = true) => {
46
+ let err, json, errAPI;
47
+ if ('string' == typeof res) {
48
+ json = JSON.parse(res);
49
+ errAPI = json.error;
50
+ err = Error(errAPI.message);
51
+ } else if (res.status < 200 || res.status >= 300) {
52
+ err = Error('Unexpected response code: ' + (res.status || json.status));
53
+ json = await res.json();
54
+ errAPI = json.error;
55
+ }
56
+ if (errAPI) {
57
+ err.status = res.status || json.status;
58
+ err.planned = true;
59
+ errAPI.message && (err.message = errAPI.message);
60
+ errAPI.type && (err.type = errAPI.type);
61
+ if ((429 === res.status || 429 === json.status) && errAPI.resets_at) {
62
+ const hours = ((new Date(1e3 * errAPI.resets_at).getTime() - Date.now()) / 1e3 / 60 / 60).toFixed(1);
63
+ err.message += `, expires in ${hours} hours`;
64
+ }
65
+ if (throwIt) {
66
+ throw err;
67
+ }
68
+ }
69
+ return err;
70
+ };
71
+
72
+ module.exports.bytesToSize = (bytes = 0) => {
73
+ const b = [ 'B', 'KB', 'MB', 'GB', 'TB' ];
74
+ if (0 === bytes) {
75
+ return '0 B';
76
+ }
77
+ const c = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), 4);
78
+ return 0 === c ? `${bytes} ${b[c]}` : `${(bytes / 1024 ** c).toFixed(1)} ${b[c]}`;
79
+ };
80
+
81
+ module.exports.indexOfAny = (text, last = false) => {
82
+ let location = -1;
83
+ const fakes = [ indexOfH(text, last), indexOfA(text, last) ].filter((idx => idx > -1)).sort();
84
+ location = last ? fakes.reverse()[0] : fakes[0];
85
+ return isNaN(location) ? -1 : location;
86
+ };
87
+
88
+ module.exports.cleanJSON = json => json.replace(/^data: {/gim, '{').replace(/\s+$/gim, '');
89
+
90
+ module.exports.fileName = () => {
91
+ const len = randomInt(5, 15);
92
+ let name = randomBytes(len).toString('hex');
93
+ for (let i = 0; i < name.length; i++) {
94
+ const char = name.charAt(i);
95
+ isNaN(char) && randomInt(1, 5) % 2 == 0 && ' ' !== name.charAt(i - 1) && (name = name.slice(0, i) + ' ' + name.slice(i));
96
+ }
97
+ return name + '.txt';
98
+ };
99
+
100
+ module.exports.indexOfA = indexOfA;
101
+
102
+ module.exports.indexOfH = indexOfH;
103
+
104
+ module.exports.setTitle = title => {
105
+ title = `${Main} - ${title}`;
106
+ process.title !== title && (process.title = title);
107
+ };
108
+
109
+ module.exports.Main = Main;
110
+
111
+ module.exports.AI = AI;
media/logo.png ADDED
media/program.png ADDED
package.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "clewd",
3
+ "version": "4.6",
4
+ "description": ":^)",
5
+ "main": "clewd.js",
6
+ "engines": {
7
+ "node": ">=20.4.0"
8
+ },
9
+ "scripts": {
10
+ "run": "node clewd.js"
11
+ },
12
+ "keywords": [
13
+ "doom",
14
+ "coom"
15
+ ],
16
+ "author": {
17
+ "name": "ahsk",
18
+ "url": "https://gitgud.io/ahsk"
19
+ },
20
+ "contributors": [
21
+ {
22
+ "name": "ahsk",
23
+ "url": "https://gitgud.io/ahsk"
24
+ },
25
+ {
26
+ "name": "h-a-s-k",
27
+ "url": "https://github.com/h-a-s-k"
28
+ }
29
+ ],
30
+ "homepage": "https://rentry.org/teralomaniac_clewd",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/teralomaniac/clewd.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://gitgud.io/ahsk/clewd/-/issues"
37
+ },
38
+ "dependencies": {"localtunnel": "^2.0.2"}
39
+ }
start.bat ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ pushd %~dp0
2
+ call npm install --no-audit --fund false
3
+ node clewd.js
4
+ pause
5
+ popd
start.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ if ! command -v npm &> /dev/null
4
+ then
5
+ echo "Install nodejs"
6
+ fi
7
+
8
+ npm install --no-audit --fund false
9
+ chown -R $(whoami) lib/bin/*
10
+ chmod u+x lib/bin/*
11
+ chmod -R 777 $(pwd)
12
+ node clewd.js
update.bat ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ pushd %~dp0
3
+
4
+ if not exist .git (
5
+ GOTO:notgit
6
+ )
7
+
8
+ where /q git.exe
9
+ if %ERRORLEVEL% EQU 0 (
10
+ GOTO:pull
11
+ )
12
+ GOTO:missgit
13
+
14
+
15
+ :pull
16
+ call git config --local url."https://".insteadOf git://
17
+ call git config --local url."https://github.com/".insteadOf [email protected]:
18
+ call git config --local url."https://".insteadOf ssh://
19
+ call git pull --rebase --autostash
20
+ if %ERRORLEVEL% neq 0 (
21
+ echo Error updating
22
+ )
23
+ GOTO:end
24
+
25
+ :missgit
26
+ echo Install git to update
27
+ GOTO:end
28
+
29
+ :notgit
30
+ echo Only able to update if you clone the repository (git clone https://github.com/teralomaniac/clewd.git)
31
+ GOTO:end
32
+
33
+
34
+ :end
35
+ pause
36
+ popd
37
+ exit /B
update.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ if ! [ -x "$(command -v git)" ]
4
+ then
5
+ echo "Install git to update"
6
+ exit
7
+ fi
8
+
9
+ if [ -x "$(command -v git)" ]
10
+ then
11
+ if [ -d ".git" ]
12
+ then
13
+ git config --local url."https://".insteadOf git://
14
+ git config --local url."https://github.com/".insteadOf [email protected]:
15
+ git config --local url."https://".insteadOf ssh://
16
+ git pull --rebase --autostash
17
+ else
18
+ echo "Only able to update if you clone the repository (git clone https://github.com/teralomaniac/clewd.git)"
19
+ fi
20
+ fi