konodioda6669 commited on
Commit
3a17a5d
·
verified ·
1 Parent(s): 6c1a439

Upload 16 files

Browse files
.gitattributes ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ lib/bin/clewd-superfetch-linux-amd64 filter=lfs diff=lfs merge=lfs -text
2
+ lib/bin/clewd-superfetch-linux-arm64 filter=lfs diff=lfs merge=lfs -text
3
+ lib/bin/clewd-superfetch-win-amd64.exe filter=lfs diff=lfs merge=lfs -text
4
+ lib/bin/clewd-superfetch-win-ia32.exe filter=lfs diff=lfs merge=lfs -text
5
+ media/program.png filter=lfs diff=lfs merge=lfs -text
CHANGELOG.md CHANGED
@@ -12,6 +12,30 @@
12
  </a>
13
  </div>
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  # 4.7
16
 
17
  added multiple model options in case you subscribe to their plans. some based on their docs, some on rumors. stick to 2.1 if you're a free user
 
12
  </a>
13
  </div>
14
 
15
+ # 4.8
16
+
17
+ up to date route
18
+
19
+ fixed errors not showing on frontend
20
+
21
+ > **Hotfix 1**
22
+
23
+ reverted route
24
+
25
+ limited external models shown to website ones
26
+
27
+ > **Hotfix 2**
28
+
29
+ fixed "streaming off" not being detected
30
+
31
+ fixed more errors not showing on frontend
32
+
33
+ > **Hotfix 3**
34
+
35
+ fixed some names not using spaces properly
36
+
37
+ fixed endpoint
38
+
39
  # 4.7
40
 
41
  added multiple model options in case you subscribe to their plans. some based on their docs, some on rumors. stick to 2.1 if you're a free user
clewd.js CHANGED
@@ -4,38 +4,22 @@
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, changing, changetime = 0, totaltime, invalidtime = 0, uuidOrgArray = [], model, reqModel, cookieModel, tokens, apiKey, timestamp;
11
-
12
- const events = require('events'), CookieChanger = new events.EventEmitter();
13
- require('events').EventEmitter.defaultMaxListeners = 0;
14
-
15
- CookieChanger.on('ChangeCookie', () => {
16
- setTimeout(() => {
17
- changeflag = 0, changing = true;
18
- Proxy && Proxy.close();
19
- console.log(`Changing Cookie...\n`);
20
- Proxy.listen(Config.Port, Config.Ip, onListen);
21
- Proxy.on('error', (err => {
22
- console.error('Proxy error\n%o', err);
23
- }));
24
- timestamp = Date.now();
25
- invalidtime++;
26
- }, !Config.rProxy || Config.rProxy === AI.end() ? 15000 + timestamp - Date.now() : 0);
27
- });
28
 
 
29
  const asyncPool = async (poolLimit, array, iteratorFn) => {
30
  const ret = [], executing = [];
31
  for (const item of array) {
32
- const p = Promise.resolve().then(() => iteratorFn(item));
33
- ret.push(p);
34
- if (poolLimit <= array.length) {
35
- const e = p.then(() => executing.splice(executing.indexOf(e), 1));
36
- executing.push(e);
37
- if (executing.length >= poolLimit) await Promise.race(executing);
38
- }
39
  }
40
  return Promise.all(ret);
41
  }, convertToType = value => {
@@ -43,62 +27,81 @@ const asyncPool = async (poolLimit, array, iteratorFn) => {
43
  if (value === 'false') return false;
44
  if (/^\d+$/.test(value)) return parseInt(value);
45
  return value;
46
- }, CookieCleaner = () => {
47
- Config.CookieArray.splice(Config.CookieArray.indexOf(Config.Cookie), 1);
48
- Config.Cookie = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  writeSettings(Config);
50
- currentIndex = (currentIndex - 1 + Config.CookieArray.length) % Config.CookieArray.length;
51
  }, padtxt = content => {
52
  const {countTokens} = require('@anthropic-ai/tokenizer');
53
- const placeholder = Config.padtxt_placeholder || randomBytes(randomInt(5, 15)).toString('hex');
54
  tokens = countTokens(content);
55
- const padding = placeholder.repeat(Math.floor((/(?<=<\|padtxt.*?)\d+(?=.*?\|>)/.test(content) ? parseInt(/(?<=<\|padtxt.*?)\d+(?=.*?\|>)/.exec(content)[0]) : Math.max(1000, Config.Settings.padtxt - tokens)) / countTokens(placeholder.trim())));
 
 
 
 
 
56
  content = /<\|padtxt.*?\|>/.test(content) ? content.replace(/<\|padtxt.*?\|>/, padding).replace(/\s*<\|padtxt.*?\|>\s*/g, '\n\n') : !apiKey ? padding + '\n\n\n' + content.trim() : content;
57
  return content;
58
- }, xmlPlot_merge = (content, nonsys) => {
59
- if (!content.includes('<|Merge Disable|>')) {
60
- if (content.includes('<|System Role|>')) {
61
- content = content.replace(/(?:\n\n|^\s*)(?:xmlPlot|System):(.*?(?:\n\n(Assistant|Human):|$))/gs, function(match, p1) {return '\n\nSystem:' + p1.replace(/(\n\n|^\s*)(xmlPlot|System):\s*/g, '\n\n')});
62
- }
63
- if (!content.includes('<|Merge Human Disable|>')) {
64
- nonsys ? content = content.replace(/(\n\n|^\s*)xmlPlot:/g, '\n\nHuman:') : content = content.replace(/(\n\n|^\s*)(?<!\n\n(Human|Assistant):.*?)xmlPlot:\s*/gs, '$1').replace(/(\n\n|^\s*)xmlPlot:/g, '\n\nHuman:');
65
- content = content.replace(/(?:\n\n|^\s*)Human:(.*?(?:\n\nAssistant:|$))/gs, function(match, p1) {return '\n\nHuman:' + p1.replace(/\n\nHuman:\s*/g, '\n\n')});
66
- }
67
- if (!content.includes('<|Merge Assistant Disable|>')) {
68
- content = content.replace(/\n\nAssistant:(.*?(?:\n\nHuman:|$))/gs, function(match, p1) {return '\n\nAssistant:' + p1.replace(/\n\nAssistant:\s*/g, '\n\n')});
69
- }
70
  }
71
- return content.replace(/(\n\n|^\s*)xmlPlot:\s*/gm, '$1');
 
 
72
  }, xmlPlot_regex = (content, order) => {
73
- let match, regex = new RegExp(`<regex(?: +order *= *${order})${order === 2 ? '?' : ''}> *"(/?)(.*)\\1(.*?)" *: *"(.*?)" *</regex>`, 'gm');
74
- while ((match = regex.exec(content)) !== null) {
75
  try {
76
- content = content.replace(new RegExp(match[2], match[3]), match[4].replace(/(\r\n|\r|\\n)/gm, '\n'));
77
- } catch (err) {}
78
- }
 
 
 
 
79
  return content;
80
  }, xmlPlot = (content, nonsys = false) => {
 
81
  //一次正则
82
  content = xmlPlot_regex(content, 1);
83
  //一次role合并
84
- content = xmlPlot_merge(content, nonsys);
 
 
 
 
 
 
85
  //自定义插入
86
- content = content.replace(/(<\/?)PrevAssistant>/gm, '$1@1>').replace(/(<\/?)PrevHuman>/gm, '$1@2>');
87
- let splitContent = content.split(/\n\n(?=Assistant:|Human:)/g);
88
- let match;
89
  while ((match = /<@(\d+)>(.*?)<\/@\1>/gs.exec(content)) !== null) {
90
  let index = splitContent.length - parseInt(match[1]) - 1;
91
- if (index >= 0) {
92
- splitContent[index] += '\n\n' + match[2];
93
- }
94
  content = content.replace(match[0], '');
95
  }
96
- content = splitContent.join('\n\n');
97
- content = content.replace(/<@(\d+)>.*?<\/@\1>/gs, '');
98
  //二次正则
99
  content = xmlPlot_regex(content, 2);
100
  //二次role合并
101
- content = xmlPlot_merge(content, nonsys);
102
  //Plain Prompt
103
  let segcontentHuman = content.split('\n\nHuman:');
104
  let segcontentlastIndex = segcontentHuman.length - 1;
@@ -108,23 +111,34 @@ const asyncPool = async (poolLimit, array, iteratorFn) => {
108
  //三次正则
109
  content = xmlPlot_regex(content, 3);
110
  //消除空XML tags、两端空白符和多余的\n
111
- content = content.replace(/<regex>.*?<\/regex>/gm, '')
112
- .replace(/(\r\n|\r|\\n)/gm, '\n')
113
  .replace(/\s*<\|curtail\|>\s*/g, '\n')
114
- .replace(/\n<\/(card|hidden|META)>\s+?<\1>\n/g, '\n')
115
- .replace(/\n<(\/?card|example|hidden|plot|META)>\s+?<\1>/g, '\n<$1>')
116
- .replace(/(?:<!--.*?-->\n|.+?: ?\n)?<(card|example|hidden|plot|META)>\s+?<\/\1>\n*/g, '')
117
- .replace(/(?<=(: |\n)<(card|hidden|example|plot|META|EOT)>\n)\s*/g, '')
118
- .replace(/\s*(?=\n<\/(card|hidden|example|plot|META|EOT)>(\n|$))/g, '')
119
- .replace(/(?<=\n)\n(?=\n)/g, '');
 
 
120
  //确保格式正确
121
  if (apiKey) {
122
- content = content.replace(/\n\n(Assistant|Human):(?!.*?\n\n(Assistant|Human):).*$/s, function(match, p1) {return p1 === 'Assistant' ? match : match + '\n\nAssistant: '}).replace(/\s*<\|noAssistant\|>\s*(.*?)(?:\n\nAssistant:\s*)?$/s, '\n\n$1');
123
  content.includes('<|reverseHA|>') && (content = content.replace(/\s*<\|reverseHA\|>\s*/g, '\n\n').replace(/Assistant|Human/g, function(match) {return match === 'Human' ? 'Assistant' : 'Human'}).replace(/\n(A|H): /g, function(match, p1) {return p1 === 'A' ? '\nH: ' : '\nA: '}));
124
- return content.replace(Config.Settings.padtxt ? /\s*<\|(?!padtxt).*?\|>\s*/g : /\s*<\|.*?\|>\s*/g, '\n\n').trim().replace(/^.+:/, '\n\n$&').replace(/\n\n.+:$/, '$& ');
125
  } else {
126
- return content.replace(Config.Settings.padtxt ? /\s*<\|(?!padtxt).*?\|>\s*/g : /\s*<\|.*?\|>\s*/g, '\n\n').trim().replace(/^Human:|\n\nAssistant:$/g, '');
127
  }
 
 
 
 
 
 
 
 
 
128
  };
129
  /******************************************************* */
130
 
@@ -139,6 +153,8 @@ const ConfigPath = joinP(__dirname, './config.js'), LogPath = joinP(__dirname, '
139
  let uuidOrg, curPrompt = {}, prevPrompt = {}, prevMessages = [], prevImpersonated = false, Config = {
140
  Cookie: '',
141
  CookieArray: [],
 
 
142
  Cookiecounter: 3,
143
  CookieIndex: 0,
144
  ProxyPassword: '',
@@ -149,7 +165,8 @@ let uuidOrg, curPrompt = {}, prevPrompt = {}, prevMessages = [], prevImpersonate
149
  SystemInterval: 3,
150
  rProxy: '',
151
  api_rProxy: '',
152
- padtxt_placeholder: '',
 
153
  PromptExperimentFirst: '',
154
  PromptExperimentNext: '',
155
  PersonalityFormat: '{{char}}\'s personality: {{personality}}',
@@ -159,18 +176,20 @@ let uuidOrg, curPrompt = {}, prevPrompt = {}, prevMessages = [], prevImpersonate
159
  RetryRegenerate: false,
160
  PromptExperiments: true,
161
  SystemExperiments: true,
162
- PreventImperson: false,
163
  AllSamples: false,
164
  NoSamples: false,
165
  StripAssistant: false,
166
  StripHuman: false,
167
- PassParams: false,
168
  ClearFlags: true,
169
  PreserveChats: false,
170
  LogMessages: true,
171
  FullColon: true,
172
- padtxt: 15000,
173
  xmlPlot: true,
 
 
174
  Superfetch: true
175
  }
176
  };
@@ -216,34 +235,35 @@ const updateParams = res => {
216
  if (Config.Settings.PreserveChats) {
217
  return;
218
  }
219
- try { //
220
- const res = await fetch(`${Config.rProxy || AI.end()}/api/organizations/${uuidOrg}/chat_conversations/${uuid}`, {
221
- headers: {
222
- ...AI.hdr(),
223
- Cookie: getCookies()
224
- },
225
- method: 'DELETE'
226
- });
227
- updateParams(res);
228
- } catch (err) {console.log(`deleteChat failed`)}; //
229
  }, onListen = async () => {
230
  /***************************** */
231
  if (Firstlogin) {
232
  Firstlogin = false, timestamp = Date.now(), totaltime = Config.CookieArray.length;
233
- 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`);
234
- Config.Settings.Superfetch && SuperfetchAvailable(true);
 
 
 
235
  if (Config.localtunnel) {
236
  const localtunnel = require('localtunnel');
237
- localtunnel({ port: Config.Port })
238
- .then((tunnel) => {
239
  console.log(`\nTunnel URL for outer websites: ${tunnel.url}/v1\n`);
240
  })
241
  }
242
  }
243
  if (Config.CookieArray?.length > 0) {
244
- Config.Cookie = Config.CookieArray[currentIndex];
245
- currentIndex = (currentIndex + 1) % Config.CookieArray.length;
246
  changetime++;
 
247
  }
248
  let percentage = ((changetime + Math.max(Config.CookieIndex - 1, 0)) / totaltime) * 100
249
  if (Config.Cookiecounter < 0 && percentage > 100) {
@@ -252,87 +272,73 @@ const updateParams = res => {
252
  }
253
  try {
254
  /***************************** */
255
- if ('SET YOUR COOKIE HERE' === Config.Cookie || Config.Cookie?.length < 1 || (Config.CookieArray?.length > 0 && invalidtime > totaltime)) { //if ('SET YOUR COOKIE HERE' === Config.Cookie || Config.Cookie?.length < 1) {
256
- changing = false; //
257
- return console.log(`No cookie available, apiKey-Only mode enabled.\n`); //throw Error('Set your cookie inside config.js');
258
  }
259
- updateCookies(Config.Cookie.replace(/^(sessionKey=)?/, 'sessionKey=')); //updateCookies(Config.Cookie);
260
- //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`);
261
- //Config.Settings.Superfetch && SuperfetchAvailable(true);
262
- const accRes = await fetch((Config.rProxy || AI.end()) + '/api/organizations', {
263
  method: 'GET',
264
  headers: {
265
  ...AI.hdr(),
266
  Cookie: getCookies()
267
  }
268
  });
269
- /**************************** */
270
- if (accRes.statusText === 'Forbidden' && Config.CookieArray?.length > 0) {
271
- CookieCleaner();
272
- console.log(`Expired!`);
273
- Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
274
- return CookieChanger.emit('ChangeCookie');
275
  }
276
- /**************************** */
277
- await checkResErr(accRes);
278
- const accInfo = (await accRes.json())?.[0];
279
- if (!accInfo || accInfo.error) {
280
- throw Error(`Couldn't get account info: "${accInfo?.error?.message || accRes.statusText}"`);
 
 
 
281
  }
282
- if (!accInfo?.uuid) {
283
- throw Error('Invalid account id');
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
- setTitle('ok');
286
- updateParams(accRes);
287
  /**************************** */
288
- const accountRes = await fetch((Config.rProxy || AI.end()) + '/api/auth/current_account', {
289
  method: 'GET',
290
  headers: {
291
  ...AI.hdr(),
292
  Cookie: getCookies()
293
  }
294
  });
295
- await checkResErr(accountRes);
296
- const accountInfo = await accountRes.json();
297
- model = accountInfo.account.statsig.values.dynamic_configs["6zA9wvTedwkzjLxWy9PVe7yydI00XDQ6L5Fejjq/2o8="]?.value?.model, cookieModel = model;
298
- /**************************** */
299
- console.log(Config.CookieArray?.length > 0 ? `(index: ${currentIndex || Config.CookieArray.length}) Logged in %o` : 'Logged in %o', { //console.log('Logged in %o', {
300
- name: accInfo.name?.split('@')?.[0],
301
- mail: accountInfo.account.email_address, //
302
- model, //
303
- capabilities: accInfo.capabilities
304
- });
305
  uuidOrg = accInfo?.uuid;
306
- /************************* */
307
- if (reqModel && reqModel != cookieModel && !Config.Settings.PassParams) return CookieChanger.emit('ChangeCookie');
308
- const Overlap = uuidOrgArray.includes(uuidOrg) && percentage <= 100 && Config.CookieArray?.length > 0;
309
- !Overlap && uuidOrgArray.push(uuidOrg);
310
- const Unverified = !accountInfo.account.completed_verification_at;
311
- const Abused = accountInfo.account.statsig.values.feature_gates["4fDxNAVXgvks8yzKUoU+T+w3Qr3oYVqoJJVNYh04Mik="]?.secondary_exposures[0].gateValue === 'true' && accountInfo.account.statsig.values.feature_gates["4fDxNAVXgvks8yzKUoU+T+w3Qr3oYVqoJJVNYh04Mik="]?.secondary_exposures[0].gate === 'segment:abuse';
312
- const Remain = accountInfo.messageLimit?.remaining;
313
- const Exceededlimit = (accountInfo.messageLimit?.type === 'approaching_limit' && Remain === 0) || accountInfo.messageLimit?.type === 'exceeded_limit';
314
- if (Remain) {
315
- changeflag = Math.max(Config.Cookiecounter - Remain, changeflag);
316
- console.log(`ApproachingLimit!: Remain ${Remain}`);
317
- }
318
- if ((Overlap || Unverified || Abused) && Config.CookieArray?.length > 0) {
319
- Overlap ? console.log(`Overlap!`) : Unverified ? console.log(`Unverified!`) : Abused && console.log(`Banned!`);
320
- CookieCleaner();
321
- Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
322
- return CookieChanger.emit('ChangeCookie');
323
- }
324
- /************************* */
325
  if (accInfo?.active_flags.length > 0) {
326
- let flagtype; //
327
  const now = new Date, formattedFlags = accInfo.active_flags.map((flag => {
328
  const days = ((new Date(flag.expires_at).getTime() - now.getTime()) / 864e5).toFixed(2);
329
- flagtype = flag.type; //
330
  return {
331
  type: flag.type,
332
  remaining_days: days
333
  };
334
  }));
335
- console.warn(`${'consumer_banned' === flagtype ? '' : ''}Your account has warnings %o`, formattedFlags); //console.warn('Your account has warnings %o', formattedFlags);
336
  await Promise.all(accInfo.active_flags.map((flag => (async type => {
337
  if (!Config.Settings.ClearFlags) {
338
  return;
@@ -351,20 +357,24 @@ const updateParams = res => {
351
  const json = await req.json();
352
  console.log(`${type}: ${json.error ? json.error.message || json.error.type || json.detail : 'OK'}`);
353
  })(flag.type))));
354
- /***************************** */
355
- if (Config.CookieArray?.length > 0) { //}
356
- console.log(`${'consumer_banned' === flagtype ? 'Banned' : 'Restricted'}!`);
357
- 'consumer_banned' === flagtype && CookieCleaner();
358
- Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
359
- return CookieChanger.emit('ChangeCookie');
360
- }
361
  }
362
- if (Config.Cookiecounter < 0 || Exceededlimit) {
363
- console.log(Config.Cookiecounter < 0 ? `[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n` : 'Exceeded limit!\n');
364
- return CookieChanger.emit('ChangeCookie');
365
- } else changing = false;
366
- /***************************** */
367
- const convRes = await fetch(`${Config.rProxy || AI.end()}/api/organizations/${uuidOrg}/chat_conversations`, {
 
 
 
 
 
 
 
 
368
  method: 'GET',
369
  headers: {
370
  ...AI.hdr(),
@@ -374,10 +384,13 @@ const updateParams = res => {
374
  updateParams(convRes);
375
  conversations.length > 0 && await asyncPool(10, conversations, async (conv) => await deleteChat(conv.uuid)); //await Promise.all(conversations.map((conv => deleteChat(conv.uuid))));
376
  /***************************** */
377
- invalidtime = 0;
378
  } catch (err) {
 
 
 
 
379
  console.error('Clewd:\n%o', err);
380
- Config.CookieArray?.length > 0 && CookieChanger.emit('ChangeCookie');
381
  }
382
  /***************************** */
383
  }, writeSettings = async (config, firstRun = false) => {
@@ -397,26 +410,37 @@ const updateParams = res => {
397
  }).end();
398
  })(0, res);
399
  }
 
 
 
400
  switch (req.url) {
401
  case '/v1/models':
402
- res.json({
403
  /***************************** */
404
- data: [ //data: AI.mdl().map((name => ({
405
- ...AI.mdl().slice(1).map((name => ({ id: name }))), {
406
- id: 'claude-2' },{
407
- id: 'claude-v1.3' },{
408
- id: 'claude-v1.3-100k' },{
409
- id: 'claude-v1.2' },{
410
- id: 'claude-v1.0' },{
411
- id: 'claude-instant-v1.1' },{
412
- id: 'claude-instant-v1.1-100k' },{
413
- id: 'claude-3-5-sonnet' },{
414
- id: 'claude-3-7-sonnet-20250219' },{
415
- id: 'claude-3.5-haiku' },{
416
- id: 'claude-instant-v1.0' //id: name
417
- }] //})))
 
 
 
 
 
 
 
 
 
 
418
  /***************************** */
419
- });
420
  break;
421
 
422
  case '/v1/chat/completions':
@@ -432,26 +456,21 @@ const updateParams = res => {
432
  buffer.push(chunk);
433
  }));
434
  req.on('end', (async () => {
435
- let clewdStream, titleTimer, samePrompt = false, shouldRenew = true, retryRegen = false;
436
  try {
437
  const body = JSON.parse(Buffer.concat(buffer).toString());
438
  let {temperature} = body;
439
- temperature = Math.max(.1, Math.min(1, temperature));
440
  let {messages} = body;
441
  /************************* */
442
- apiKey = req.headers.authorization?.match(/sk-ant-api\d\d-[\w-]{86}-[\w-]{6}AA/g) || req.headers.authorization?.match(/(?<=3rdKey: *)[\S]*/);
443
- reqModel = /^claude-2.[01]$/.test(body.model) ? body.model : '';
444
- let max_tokens_to_sample, stop_sequences;
445
- if (apiKey || Config.Settings.PassParams) {
446
- stop_sequences = body.stop;
447
- max_tokens_to_sample = body.max_tokens;
448
- model = body.model;
449
- } else if (req.headers.authorization.includes('sk-ant-api') || Config.ProxyPassword != '' && req.headers.authorization != 'Bearer ' + Config.ProxyPassword) {
450
- throw Error(req.headers.authorization.includes('sk-ant-api') ? 'apiKey Wrong' : 'ProxyPassword Wrong');
451
- } else if (changing || Config.CookieArray?.length > 0 && invalidtime >= Config.CookieArray?.length || reqModel && reqModel != cookieModel && !Config.Settings.PassParams) {
452
- changing ? invalidtime = 0 : changeflag = -1;
453
- throw Error(reqModel && reqModel != cookieModel && !Config.Settings.PassParams ? 'Polling requset model...' : 'Changing Cookie...');
454
- }
455
  /************************* */
456
  if (messages?.length < 1) {
457
  throw Error('Select OpenAI as completion source');
@@ -483,11 +502,8 @@ const updateParams = res => {
483
  console.log('having AllSamples and NoSamples both set to true is not supported');
484
  throw Error('Only one can be used at the same time: AllSamples/NoSamples');
485
  }
486
- //const model = body.model;
487
- //if (model === AI.mdl()[0]) {
488
- // return;
489
- //}
490
- if (!/claude-.*/.test(model)) {
491
  throw Error('Invalid model selected: ' + model);
492
  }
493
  curPrompt = {
@@ -519,14 +535,12 @@ const updateParams = res => {
519
  fetchAPI = await (async (signal, model) => {
520
  let res;
521
  const body = {
522
- completion: {
523
- prompt: '',
524
- timezone: AI.zone(),
525
- model
526
- },
527
- organization_uuid: uuidOrg,
528
- conversation_uuid: Conversation.uuid,
529
- text: ''
530
  };
531
  let headers = {
532
  ...AI.hdr(Conversation.uuid || ''),
@@ -537,7 +551,7 @@ const updateParams = res => {
537
  const names = Object.keys(headers), values = Object.values(headers);
538
  headers = names.map(((header, idx) => `${header}: ${values[idx]}`));
539
  }
540
- res = await (Config.Settings.Superfetch ? Superfetch : fetch)((Config.rProxy || AI.end()) + '/api/retry_message', {
541
  stream: true,
542
  signal,
543
  method: 'POST',
@@ -662,12 +676,12 @@ const updateParams = res => {
662
  /******************************** */
663
  if (Config.Settings.xmlPlot) {
664
  idx > 0 && (spacing = '\n\n');
665
- const prefix = message.customname ? message.role + ': ' + message.name + ': ' : 'system' !== message.role || message.name ? Replacements[message.name || message.role] + ': ' : 'xmlPlot: ' + Replacements[message.role];
666
  return `${spacing}${message.strip ? '' : prefix}${message.content}`;
667
  } else {
668
  /******************************** */
669
  idx > 0 && (spacing = systemMessages.includes(message) ? '\n' : '\n\n');
670
- const prefix = message.customname ? message.name + ': ' : 'system' !== message.role || message.name ? Replacements[message.name || message.role] + ': ' : '' + Replacements[message.role];
671
  return `${spacing}${message.strip ? '' : prefix}${'system' === message.role ? message.content : message.content.trim()}`;
672
  } //
673
  }));
@@ -676,34 +690,62 @@ const updateParams = res => {
676
  systems
677
  };
678
  })(messages, type);
679
- console.log(`${model} [${type}]${!retryRegen && systems.length > 0 ? ' ' + systems.join(' / ') : ''}`); //console.log(`${model} [${type}]${!retryRegen && systems.length > 0 ? ' ' + systems.join(' / ') : ''}`);
680
- 'R' !== type || prompt || (prompt = '...regen...');
681
  /******************************** */
682
- prompt = Config.Settings.xmlPlot ? xmlPlot(prompt, model != 'claude-2.1') : apiKey ? `\n\nHuman: ${genericFixes(prompt)}\n\nAssistant: ` : genericFixes(prompt).trim();
683
- Config.Settings.FullColon && (prompt = apiKey
684
- ? prompt.replace(/(?<!\n\nHuman:.*)(\n\nAssistant):/gs, '$1:').replace(/(\n\nHuman):(?!.*\n\nAssistant:)/gs, '$1:')
685
- : prompt.replace(/(?<=\n\n(H(?:uman)?|A(?:ssistant)?)):[ ]?/g, ''));
686
- Config.Settings.padtxt && (prompt = padtxt(prompt));
 
 
 
 
687
  /******************************** */
688
- Logger?.write(`\n\n-------\n[${(new Date).toLocaleString()}]\n####### ${model} (${type}) ${tokens}t PROMPT:\n${prompt}\n--\n####### REPLY:\n`); //Logger?.write(`\n\n-------\n[${(new Date).toLocaleString()}]\n####### MODEL: ${model}\n####### PROMPT (${type}):\n${prompt}\n--\n####### REPLY:\n`);
 
 
689
  retryRegen || (fetchAPI = await (async (signal, model, prompt, temperature, type) => {
690
  /******************************** */
691
  if (apiKey) {
692
- const res = await fetch(`${Config.api_rProxy ? Config.api_rProxy : 'https://api.anthropic.com'}/v1/complete`, {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
  method: 'POST',
694
  signal,
695
  headers: {
 
 
696
  'Content-Type': 'application/json',
697
- 'x-api-key': apiKey[Math.floor(Math.random() * apiKey.length)],
698
- 'anthropic-version': '2023-06-01'
699
  },
700
  body: JSON.stringify({
701
- ...stop_sequences && {stop_sequences},
 
 
 
 
 
 
 
702
  model,
703
- max_tokens_to_sample,
704
  stream: true,
705
- prompt,
706
- temperature
 
707
  }),
708
  });
709
  await checkResErr(res);
@@ -715,35 +757,36 @@ const updateParams = res => {
715
  let splitedprompt = prompt.split('\n\nPlainPrompt:'); //
716
  prompt = splitedprompt[0]; //
717
  attachments.push({
718
- extracted_content: (prompt),
719
  file_name: 'paste.txt', //fileName(),
720
- file_size: Buffer.from(prompt).byteLength,
721
- file_type: 'txt' //'text/plain'
722
  });
723
  prompt = 'r' === type ? Config.PromptExperimentFirst : Config.PromptExperimentNext;
724
  splitedprompt.length > 1 && (prompt += splitedprompt[1]); //
725
  }
726
  let res;
727
  const body = {
728
- completion: {
729
- ...Config.Settings.PassParams && {
730
- temperature
731
- },
732
- prompt: prompt || '',
733
- timezone: AI.zone(),
734
- model
 
 
 
735
  },
736
- conversation_uuid: Conversation.uuid,
737
- organization_uuid: uuidOrg,
738
- text: prompt || '',
739
- attachments
740
  };
741
  let headers = {
742
  ...AI.hdr(Conversation.uuid || ''),
743
  Accept: 'text/event-stream',
744
  Cookie: getCookies()
745
  };
746
- res = await (Config.Settings.Superfetch ? Superfetch : fetch)((Config.rProxy || AI.end()) + '/api/append_message', {
747
  stream: true,
748
  signal,
749
  method: 'POST',
@@ -751,7 +794,7 @@ const updateParams = res => {
751
  headers
752
  });
753
  updateParams(res);
754
- await checkResErr(res, CookieChanger); //await checkResErr(res);
755
  return res;
756
  })(signal, model, prompt, temperature, type));
757
  const response = Writable.toWeb(res);
@@ -776,8 +819,8 @@ const updateParams = res => {
776
  if ('AbortError' === err.name) {
777
  res.end();
778
  } else {
779
- changeflag -= 1; //
780
- err.planned || console.error('Clewd:\n%o', err);
781
  res.json({
782
  error: {
783
  message: 'clewd: ' + (err.message || err.name || err.type),
@@ -791,18 +834,27 @@ const updateParams = res => {
791
  clearInterval(titleTimer);
792
  if (clewdStream) {
793
  clewdStream.censored && console.warn('likely your account is hard-censored');
794
- clewdStream.nochange && changeflag--; //prevImpersonated = clewdStream.impersonated;
 
 
795
  setTitle('ok ' + bytesToSize(clewdStream.size));
796
- 429 == fetchAPI?.status ? console.log(`Exceeded limit!\n`) : console.log(`${200 == fetchAPI?.status ? '' : ''}${fetchAPI?.status}!\n`); //console.log(`${200 == fetchAPI.status ? '' : ''}${fetchAPI.status}!\n`);
 
 
 
 
797
  clewdStream.empty();
798
  }
799
- if (!apiKey) { //if (prevImpersonated) { try {
800
- await deleteChat(Conversation.uuid); //} catch (err) {}
 
 
 
801
  /******************************** */
802
- changeflag++;
803
- if (changeflag < 0 || Config.CookieArray?.length > 0 && (429 == fetchAPI?.status || Config.Cookiecounter > 0 && changeflag >= Config.Cookiecounter)) {
804
  changeflag = 0;
805
- CookieChanger.emit('ChangeCookie');
806
  }
807
  /******************************** */
808
  }
@@ -821,18 +873,9 @@ const updateParams = res => {
821
 
822
  default:
823
  !['/', '/v1', '/favicon.ico'].includes(req.url) && (console.log('unknown request: ' + req.url)); //console.log('unknown request: ' + req.url);
824
- res.writeHead(200, {'Content-Type': 'text/html'});
825
- res.write(`<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<script>\nfunction copyToClipboard(text) {\n var textarea = document.createElement("textarea");\n textarea.textContent = text;\n textarea.style.position = "fixed";\n document.body.appendChild(textarea);\n textarea.select();\n try {\n return document.execCommand("copy");\n } catch (ex) {\n console.warn("Copy to clipboard failed.", ex);\n return false;\n } finally {\n document.body.removeChild(textarea);\n }\n}\nfunction copyLink(event) {\n event.preventDefault();\n const url = new URL(window.location.href);\n const link = url.protocol + '//' + url.host + '/v1';\n copyToClipboard(link);\n alert('链接已复制: ' + link);\n}\n</script>\n</head>\n<body>\n${Main}<br/><br/>完全开源、免费且禁止商用<br/><br/>点击复制反向代理: <a href="v1" onclick="copyLink(event)">Copy Link</a><br/>填入OpenAI API反向代理并选择OpenAI分类中的claude模型(酒馆需打开Show "External" models,仅在api模式有模型选择差异)<br/><br/>教程与FAQ: <a href="https://rentry.org/teralomaniac_clewd" target="FAQ">Rentry</a> | <a href="https://discord.com/invite/B7Wr25Z7BZ" target="FAQ">Discord</a><br/><br/><br/>请举报恶意盗用/商用本教程Clewd修改版这个B 站up<a href="https://space.bilibili.com/35307060" target="FAQ">浅睡一天一夜</a>\n</body>\n</html>`);
826
- res.end();
827
- /*res.json(
828
- {
829
- error: {
830
- message: '404 Not Found',
831
- type: 404,
832
- param: null,
833
- code: 404
834
- }
835
- }, 404);*/
836
  }
837
  }));
838
 
@@ -879,7 +922,8 @@ const updateParams = res => {
879
  }
880
  }
881
  Config.rProxy = Config.rProxy.replace(/\/$/, '');
882
- Config.CookieArray = [...new Set([Config.CookieArray].join('').match(/(sessionKey=)?sk-ant-sid01-[\w-]{86}-[\w-]{6}AA/g))];
 
883
  writeSettings(Config);
884
  currentIndex = Config.CookieIndex > 0 ? Config.CookieIndex - 1 : Config.Cookiecounter >= 0 ? Math.floor(Math.random() * Config.CookieArray.length) : 0;
885
  /***************************** */
@@ -893,6 +937,7 @@ const cleanup = async () => {
893
  console.log('cleaning...');
894
  try {
895
  await deleteChat(Conversation.uuid);
 
896
  Logger?.close();
897
  } catch (err) {}
898
  process.exit();
 
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, SuperfetchFoldersMk, SuperfetchFoldersRm} = 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, changing, changetime = 0, totaltime, uuidOrgArray = [], model, cookieModel, tokens, apiKey, timestamp, regexLog, isPro, modelList = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ const url = require('url');
13
  const asyncPool = async (poolLimit, array, iteratorFn) => {
14
  const ret = [], executing = [];
15
  for (const item of array) {
16
+ const p = Promise.resolve().then(() => iteratorFn(item));
17
+ ret.push(p);
18
+ if (poolLimit <= array.length) {
19
+ const e = p.then(() => executing.splice(executing.indexOf(e), 1));
20
+ executing.push(e);
21
+ if (executing.length >= poolLimit) await Promise.race(executing);
22
+ }
23
  }
24
  return Promise.all(ret);
25
  }, convertToType = value => {
 
27
  if (value === 'false') return false;
28
  if (/^\d+$/.test(value)) return parseInt(value);
29
  return value;
30
+ }, CookieChanger = (resetTimer = true, cleanup = false) => {
31
+ if (Config.CookieArray?.length <= 1) {
32
+ return changing = false;
33
+ } else {
34
+ changeflag = 0, changing = true;
35
+ if(!cleanup) {
36
+ currentIndex = (currentIndex + 1) % Config.CookieArray.length;
37
+ console.log(`Changing Cookie...\n`);
38
+ }
39
+ setTimeout(() => {
40
+ onListen();
41
+ resetTimer && (timestamp = Date.now());
42
+ }, !Config.rProxy || Config.rProxy === AI.end() ? 15000 + timestamp - Date.now() : 0);
43
+ }
44
+ }, CookieCleaner = (flag, percentage) => {
45
+ Config.WastedCookie.push(flag + '@' + Config.CookieArray[currentIndex].split('@').toReversed()[0]);
46
+ Config.CookieArray.splice(currentIndex, 1), Config.Cookie = '';
47
+ Config.Cookiecounter < 0 && console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
48
+ console.log(`Cleaning Cookie...\n`);
49
  writeSettings(Config);
50
+ return CookieChanger(true, true);
51
  }, padtxt = content => {
52
  const {countTokens} = require('@anthropic-ai/tokenizer');
 
53
  tokens = countTokens(content);
54
+ const padtxt = String(Config.Settings.padtxt).split(',').reverse(), maxtokens = parseInt(padtxt[0]), extralimit = parseInt(padtxt[1]) || 1000, minlimit = parseInt(padtxt[2]);
55
+ const placeholder = (tokens > maxtokens - extralimit && minlimit ? Config.placeholder_byte : Config.placeholder_token) || randomBytes(randomInt(5, 15)).toString('hex');
56
+ const placeholdertokens = countTokens(placeholder.trim());
57
+ for (let match; match = content.match(/<\|padtxt.*?(\d+)t.*?\|>/); content = content.replace(match[0], placeholder.repeat(parseInt(match[1]) / placeholdertokens))) tokens += parseInt(match[1]);
58
+ if(/<\|padtxt off.*?\|>/.test(content)) return content.replace(/\s*<\|padtxt.*?\|>\s*/g, '\n\n');
59
+ const padding = placeholder.repeat(Math.min(maxtokens, (tokens <= maxtokens - extralimit ? maxtokens - tokens : minlimit ? minlimit : extralimit)) / placeholdertokens);
60
  content = /<\|padtxt.*?\|>/.test(content) ? content.replace(/<\|padtxt.*?\|>/, padding).replace(/\s*<\|padtxt.*?\|>\s*/g, '\n\n') : !apiKey ? padding + '\n\n\n' + content.trim() : content;
61
  return content;
62
+ }, xmlPlot_merge = (content, mergeTag, nonsys) => {
63
+ if (/(\n\n|^\s*)xmlPlot:\s*/.test(content)) {
64
+ content = (nonsys ? content : content.replace(/(\n\n|^\s*)(?<!\n\n(Human|Assistant):.*?)xmlPlot:\s*/gs, '$1')).replace(/(\n\n|^\s*)xmlPlot: */g, mergeTag.system && mergeTag.human && mergeTag.all ? '\n\nHuman: ' : '$1' );
 
 
 
 
 
 
 
 
 
65
  }
66
+ mergeTag.all && mergeTag.human && (content = content.replace(/(?:\n\n|^\s*)Human:(.*?(?:\n\nAssistant:|$))/gs, function(match, p1) {return '\n\nHuman:' + p1.replace(/\n\nHuman:\s*/g, '\n\n')}));
67
+ mergeTag.all && mergeTag.assistant && (content = content.replace(/\n\nAssistant:(.*?(?:\n\nHuman:|$))/gs, function(match, p1) {return '\n\nAssistant:' + p1.replace(/\n\nAssistant:\s*/g, '\n\n')}));
68
+ return content;
69
  }, xmlPlot_regex = (content, order) => {
70
+ let matches = content.match(new RegExp(`<regex(?: +order *= *${order})${order === 2 ? '?' : ''}> *"(/?)(.*)\\1(.*?)" *: *"(.*?)" *</regex>`, 'gm'));
71
+ matches && matches.forEach(match => {
72
  try {
73
+ const reg = /<regex(?: +order *= *\d)?> *"(\/?)(.*)\1(.*?)" *: *"(.*?)" *<\/regex>/.exec(match);
74
+ regexLog += match + '\n';
75
+ content = content.replace(new RegExp(reg[2], reg[3]), JSON.parse(`"${reg[4].replace(/\\?"/g, '\\"')}"`));
76
+ } catch (err) {
77
+ console.log(`Regex error: ` + match + '\n' + err);
78
+ }
79
+ });
80
  return content;
81
  }, xmlPlot = (content, nonsys = false) => {
82
+ regexLog = '';
83
  //一次正则
84
  content = xmlPlot_regex(content, 1);
85
  //一次role合并
86
+ const mergeTag = {
87
+ all: !content.includes('<|Merge Disable|>'),
88
+ system: !content.includes('<|Merge System Disable|>'),
89
+ human: !content.includes('<|Merge Human Disable|>'),
90
+ assistant: !content.includes('<|Merge Assistant Disable|>')
91
+ };
92
+ content = xmlPlot_merge(content, mergeTag, nonsys);
93
  //自定义插入
94
+ let splitContent = content.split(/\n\n(?=Assistant:|Human:)/g), match;
 
 
95
  while ((match = /<@(\d+)>(.*?)<\/@\1>/gs.exec(content)) !== null) {
96
  let index = splitContent.length - parseInt(match[1]) - 1;
97
+ index >= 0 && (splitContent[index] += '\n\n' + match[2]);
 
 
98
  content = content.replace(match[0], '');
99
  }
100
+ content = splitContent.join('\n\n').replace(/<@(\d+)>.*?<\/@\1>/gs, '');
 
101
  //二次正则
102
  content = xmlPlot_regex(content, 2);
103
  //二次role合并
104
+ content = xmlPlot_merge(content, mergeTag, nonsys);
105
  //Plain Prompt
106
  let segcontentHuman = content.split('\n\nHuman:');
107
  let segcontentlastIndex = segcontentHuman.length - 1;
 
111
  //三次正则
112
  content = xmlPlot_regex(content, 3);
113
  //消除空XML tags、两端空白符和多余的\n
114
+ content = content.replace(/<regex( +order *= *\d)?>.*?<\/regex>/gm, '')
115
+ .replace(/\r\n|\r/gm, '\n')
116
  .replace(/\s*<\|curtail\|>\s*/g, '\n')
117
+ .replace(/\s*<\|join\|>\s*/g, '')
118
+ .replace(/\s*<\|space\|>\s*/g, ' ')
119
+ .replace(/\s*\n\n(H(uman)?|A(ssistant)?): +/g, '\n\n$1: ')
120
+ .replace(/<\|(\\.*?)\|>/g, function(match, p1) {
121
+ try {
122
+ return JSON.parse(`"${p1.replace(/\\?"/g, '\\"')}"`);
123
+ } catch { return match }
124
+ });
125
  //确保格式正确
126
  if (apiKey) {
127
+ content = content.replace(/(\n\nHuman:(?!.*?\n\nAssistant:).*?|(?<!\n\nAssistant:.*?))$/s, '$&\n\nAssistant:').replace(/\s*<\|noAssistant\|>\s*(.*?)(?:\n\nAssistant:\s*)?$/s, '\n\n$1');
128
  content.includes('<|reverseHA|>') && (content = content.replace(/\s*<\|reverseHA\|>\s*/g, '\n\n').replace(/Assistant|Human/g, function(match) {return match === 'Human' ? 'Assistant' : 'Human'}).replace(/\n(A|H): /g, function(match, p1) {return p1 === 'A' ? '\nH: ' : '\nA: '}));
129
+ return content.replace(Config.Settings.padtxt ? /\s*<\|(?!padtxt).*?\|>\s*/g : /\s*<\|.*?\|>\s*/g, '\n\n').trim().replace(/^.+:/, '\n\n$&').replace(/(?<=\n)\n(?=\n)/g, '');
130
  } else {
131
+ return content.replace(Config.Settings.padtxt ? /\s*<\|(?!padtxt).*?\|>\s*/g : /\s*<\|.*?\|>\s*/g, '\n\n').trim().replace(/^Human: *|\n\nAssistant: *$/g, '').replace(/(?<=\n)\n(?=\n)/g, '');
132
  }
133
+ }, waitForChange = () => {
134
+ return new Promise(resolve => {
135
+ const interval = setInterval(() => {
136
+ if (!changing) {
137
+ clearInterval(interval);
138
+ resolve();
139
+ }
140
+ }, 100);
141
+ });
142
  };
143
  /******************************************************* */
144
 
 
153
  let uuidOrg, curPrompt = {}, prevPrompt = {}, prevMessages = [], prevImpersonated = false, Config = {
154
  Cookie: '',
155
  CookieArray: [],
156
+ WastedCookie: [],
157
+ unknownModels: [],
158
  Cookiecounter: 3,
159
  CookieIndex: 0,
160
  ProxyPassword: '',
 
165
  SystemInterval: 3,
166
  rProxy: '',
167
  api_rProxy: '',
168
+ placeholder_token: '',
169
+ placeholder_byte: '',
170
  PromptExperimentFirst: '',
171
  PromptExperimentNext: '',
172
  PersonalityFormat: '{{char}}\'s personality: {{personality}}',
 
176
  RetryRegenerate: false,
177
  PromptExperiments: true,
178
  SystemExperiments: true,
179
+ PreventImperson: true,
180
  AllSamples: false,
181
  NoSamples: false,
182
  StripAssistant: false,
183
  StripHuman: false,
184
+ PassParams: true,
185
  ClearFlags: true,
186
  PreserveChats: false,
187
  LogMessages: true,
188
  FullColon: true,
189
+ padtxt: "1000,1000,15000",
190
  xmlPlot: true,
191
+ SkipRestricted: false,
192
+ Artifacts: false,
193
  Superfetch: true
194
  }
195
  };
 
235
  if (Config.Settings.PreserveChats) {
236
  return;
237
  }
238
+ const res = await (Config.Settings.Superfetch ? Superfetch : fetch)(`${Config.rProxy || AI.end()}/api/organizations/${uuidOrg}/chat_conversations/${uuid}`, {
239
+ headers: {
240
+ ...AI.hdr(),
241
+ Cookie: getCookies()
242
+ },
243
+ method: 'DELETE'
244
+ });
245
+ updateParams(res);
 
 
246
  }, onListen = async () => {
247
  /***************************** */
248
  if (Firstlogin) {
249
  Firstlogin = false, timestamp = Date.now(), totaltime = Config.CookieArray.length;
250
+ 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`); //↓
251
+ if (Config.Settings.Superfetch) {
252
+ SuperfetchAvailable(true);
253
+ SuperfetchFoldersMk();
254
+ }
255
  if (Config.localtunnel) {
256
  const localtunnel = require('localtunnel');
257
+ localtunnel({ port: Config.Port }).then((tunnel) => {
 
258
  console.log(`\nTunnel URL for outer websites: ${tunnel.url}/v1\n`);
259
  })
260
  }
261
  }
262
  if (Config.CookieArray?.length > 0) {
263
+ const cookieInfo = /(?:(claude[-_][a-z0-9-_]*?)@)?(?:sessionKey=)?(sk-ant-sid01-[\w-]{86}-[\w-]{6}AA)/.exec(Config.CookieArray[currentIndex]);
264
+ cookieInfo?.[2] && (Config.Cookie = 'sessionKey=' + cookieInfo[2]);
265
  changetime++;
266
+ if (model && cookieInfo?.[1] && !/claude[\w]*?_pro/.test(cookieInfo?.[1]) && cookieInfo?.[1] != model) return CookieChanger(false);
267
  }
268
  let percentage = ((changetime + Math.max(Config.CookieIndex - 1, 0)) / totaltime) * 100
269
  if (Config.Cookiecounter < 0 && percentage > 100) {
 
272
  }
273
  try {
274
  /***************************** */
275
+ if ('SET YOUR COOKIE HERE' === Config.Cookie || Config.Cookie?.length < 1) {
276
+ return changing = false, console.log(`No cookie available, enter apiKey-only mode.\n`); //throw Error('Set your cookie inside config.js');
 
277
  }
278
+ updateCookies(Config.Cookie);
279
+ /**************************** */
280
+ const bootstrapRes = await (Config.Settings.Superfetch ? Superfetch : fetch)((Config.rProxy || AI.end()) + `/api/bootstrap`, {
 
281
  method: 'GET',
282
  headers: {
283
  ...AI.hdr(),
284
  Cookie: getCookies()
285
  }
286
  });
287
+ await checkResErr(bootstrapRes);
288
+ const bootstrap = await bootstrapRes.json();
289
+ if (bootstrap.account === null) {
290
+ console.log(`Null!`);
291
+ return CookieCleaner('Null', percentage);
 
292
  }
293
+ const bootAccInfo = bootstrap.account.memberships.find(item => item.organization.capabilities.includes('chat')).organization;
294
+ cookieModel = bootstrap.statsig.values.layer_configs["HPOHwBLNLQLxkj5Yn4bfSkgCQnBX28kPR7h/BNKdVLw="]?.value?.console_default_model_override?.model || bootstrap.statsig.values.dynamic_configs["6zA9wvTedwkzjLxWy9PVe7yydI00XDQ6L5Fejjq/2o8="]?.value?.model;
295
+ isPro = bootAccInfo.capabilities.includes('claude_pro') && 'claude_pro' || bootAccInfo.capabilities.includes('raven') && 'claude_team_pro';
296
+ const unknown = cookieModel && !(AI.mdl().includes(cookieModel) || Config.unknownModels.includes(cookieModel));
297
+ if (Config.CookieArray?.length > 0 && (isPro || cookieModel) != Config.CookieArray[currentIndex].split('@')[0] || unknown) {
298
+ Config.CookieArray[currentIndex] = (isPro || cookieModel) + '@' + Config.Cookie;
299
+ unknown && Config.unknownModels.push(cookieModel);
300
+ writeSettings(Config);
301
  }
302
+ if (!isPro && model && model != cookieModel) return CookieChanger();
303
+ console.log(Config.CookieArray?.length > 0 ? `(index: ${currentIndex + 1 || Config.CookieArray.length}) Logged in %o` : 'Logged in %o', { //console.log('Logged in %o', { ↓
304
+ name: bootAccInfo.name?.split('@')?.[0],
305
+ mail: bootstrap.account.email_address, //
306
+ cookieModel, //
307
+ capabilities: bootAccInfo.capabilities
308
+ }); //↓
309
+ if (uuidOrgArray.includes(bootAccInfo.uuid) && percentage <= 100 && Config.CookieArray?.length > 0 || bootAccInfo.api_disabled_reason && !bootAccInfo.api_disabled_until || !bootstrap.account.completed_verification_at) {
310
+ const flag = bootAccInfo.api_disabled_reason ? 'Disabled' : !bootstrap.account.completed_verification_at ? 'Unverified' : 'Overlap';
311
+ console.log(`${flag}!`);
312
+ return CookieCleaner(flag, percentage);
313
+ } else uuidOrgArray.push(bootAccInfo.uuid);
314
+ if (Config.Cookiecounter < 0) {
315
+ console.log(`[progress]: ${percentage.toFixed(2)}%\n[length]: ${Config.CookieArray.length}\n`);
316
+ return CookieChanger();
317
  }
 
 
318
  /**************************** */
319
+ const accRes = await (Config.Settings.Superfetch ? Superfetch : fetch)((Config.rProxy || AI.end()) + '/api/organizations', {
320
  method: 'GET',
321
  headers: {
322
  ...AI.hdr(),
323
  Cookie: getCookies()
324
  }
325
  });
326
+ await checkResErr(accRes);
327
+ const accInfo = (await accRes.json())?.find(item => item.capabilities.includes('chat')); //const accInfo = (await accRes.json())?.[0];\nif (!accInfo || accInfo.error) {\n throw Error(`Couldn't get account info: "${accInfo?.error?.message || accRes.statusText}"`);\n}\nif (!accInfo?.uuid) {\n throw Error('Invalid account id');\n}
328
+ setTitle('ok');
329
+ updateParams(accRes);
 
 
 
 
 
 
330
  uuidOrg = accInfo?.uuid;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  if (accInfo?.active_flags.length > 0) {
332
+ let banned = false; //
333
  const now = new Date, formattedFlags = accInfo.active_flags.map((flag => {
334
  const days = ((new Date(flag.expires_at).getTime() - now.getTime()) / 864e5).toFixed(2);
335
+ 'consumer_banned' === flag.type && (banned = true); //
336
  return {
337
  type: flag.type,
338
  remaining_days: days
339
  };
340
  }));
341
+ console.warn(`${banned ? '' : ''}Your account has warnings %o`, formattedFlags); //console.warn('Your account has warnings %o', formattedFlags);
342
  await Promise.all(accInfo.active_flags.map((flag => (async type => {
343
  if (!Config.Settings.ClearFlags) {
344
  return;
 
357
  const json = await req.json();
358
  console.log(`${type}: ${json.error ? json.error.message || json.error.type || json.detail : 'OK'}`);
359
  })(flag.type))));
360
+ console.log(`${banned ? 'Banned' : 'Restricted'}!`); //
361
+ if (banned) return CookieCleaner('Banned') //
362
+ else if (Config.Settings.SkipRestricted) return CookieChanger(); //
 
 
 
 
363
  }
364
+ if (bootstrap.account.settings.preview_feature_uses_artifacts != Config.Settings.Artifacts) {
365
+ const settingsRes = await (Config.Settings.Superfetch ? Superfetch : fetch)((Config.rProxy || AI.end()) + `/api/account`, {
366
+ method: 'PUT',
367
+ headers: {
368
+ ...AI.hdr(),
369
+ Cookie: getCookies()
370
+ },
371
+ body: JSON.stringify({ settings: Object.assign(bootstrap.account.settings, { preview_feature_uses_artifacts: Config.Settings.Artifacts }) }),
372
+ });
373
+ await checkResErr(settingsRes);
374
+ updateParams(settingsRes);
375
+ }
376
+ changing = false;
377
+ const convRes = await (Config.Settings.Superfetch ? Superfetch : fetch)(`${Config.rProxy || AI.end()}/api/organizations/${accInfo.uuid}/chat_conversations`, { //const convRes = await fetch(`${Config.rProxy || AI.end()}/api/organizations/${uuidOrg}/chat_conversations`, {
378
  method: 'GET',
379
  headers: {
380
  ...AI.hdr(),
 
384
  updateParams(convRes);
385
  conversations.length > 0 && await asyncPool(10, conversations, async (conv) => await deleteChat(conv.uuid)); //await Promise.all(conversations.map((conv => deleteChat(conv.uuid))));
386
  /***************************** */
 
387
  } catch (err) {
388
+ if (err.message === 'Invalid authorization') {
389
+ console.log(`Invalid!`);
390
+ return CookieCleaner('Invalid', percentage);
391
+ }
392
  console.error('Clewd:\n%o', err);
393
+ CookieChanger();
394
  }
395
  /***************************** */
396
  }, writeSettings = async (config, firstRun = false) => {
 
410
  }).end();
411
  })(0, res);
412
  }
413
+ const URL = url.parse(req.url.replace(/\/v1(\?.*)\$(\/.*)$/, '/v1$2$1'), true);
414
+ const api_rProxy = URL.query?.api_rProxy || Config.api_rProxy;
415
+ req.url = URL.pathname;
416
  switch (req.url) {
417
  case '/v1/models':
 
418
  /***************************** */
419
+ (async (req, res) => {
420
+ let models;
421
+ if (/oaiKey:/.test(req.headers.authorization)) {
422
+ try {
423
+ const modelsRes = await fetch(api_rProxy.replace(/(\/v1)?\/? *$/, '') + '/v1/models', {
424
+ method: 'GET',
425
+ headers: { authorization: req.headers.authorization.match(/(?<=oaiKey:).*/)?.[0].split(',')[0].trim() }
426
+ });
427
+ models = await modelsRes.json();
428
+ } catch(err) {}
429
+ }
430
+ res.json({
431
+ data: [
432
+ ...AI.mdl().concat(Config.unknownModels).map((name => ({ id: name })))
433
+ ].concat(models?.data).reduce((acc, current, index) => {
434
+ index === 0 && modelList.splice(0);
435
+ if (current?.id && acc.every(model => model.id != current.id)) {
436
+ acc.push(current);
437
+ modelList.push(current.id);
438
+ }
439
+ return acc;
440
+ }, [])
441
+ });
442
+ })(req, res); //res.json({\n data: AI.mdl().map((name => ({\n id: name\n })))\n});
443
  /***************************** */
 
444
  break;
445
 
446
  case '/v1/chat/completions':
 
456
  buffer.push(chunk);
457
  }));
458
  req.on('end', (async () => {
459
+ let clewdStream, titleTimer, samePrompt = false, shouldRenew = true, retryRegen = false, exceeded_limit = false, nochange = false; //let clewdStream, titleTimer, samePrompt = false, shouldRenew = true, retryRegen = false;
460
  try {
461
  const body = JSON.parse(Buffer.concat(buffer).toString());
462
  let {temperature} = body;
463
+ temperature = typeof temperature === 'number' ? Math.max(.1, Math.min(1, temperature)) : undefined; //temperature = Math.max(.1, Math.min(1, temperature));
464
  let {messages} = body;
465
  /************************* */
466
+ const thirdKey = req.headers.authorization?.match(/(?<=(3rd|oai)Key:).*/), oaiAPI = /oaiKey:/.test(req.headers.authorization), forceModel = /--force/.test(body.model);
467
+ apiKey = thirdKey?.[0].split(',').map(item => item.trim()) || req.headers.authorization?.match(/sk-ant-api\d\d-[\w-]{86}-[\w-]{6}AA/g);
468
+ model = apiKey || forceModel || isPro ? body.model.replace(/--force/, '').trim() : cookieModel;
469
+ let max_tokens_to_sample = body.max_tokens, stop_sequences = body.stop, top_p = typeof body.top_p === 'number' ? body.top_p : undefined, top_k = typeof body.top_k === 'number' ? body.top_k : undefined;
470
+ if (!apiKey && (Config.ProxyPassword != '' && req.headers.authorization != 'Bearer ' + Config.ProxyPassword || !uuidOrg)) {
471
+ throw Error(uuidOrg ? 'ProxyPassword Wrong' : 'No cookie available or apiKey format wrong');
472
+ } else if (!changing && !apiKey && (!isPro && model != cookieModel)) CookieChanger();
473
+ await waitForChange();
 
 
 
 
 
474
  /************************* */
475
  if (messages?.length < 1) {
476
  throw Error('Select OpenAI as completion source');
 
502
  console.log('having AllSamples and NoSamples both set to true is not supported');
503
  throw Error('Only one can be used at the same time: AllSamples/NoSamples');
504
  }
505
+ //const model = body.model;//if (model === AI.mdl()[0]) {// return;//}
506
+ if (!modelList.includes(model) && !/claude-.*/.test(model) && !forceModel) {
 
 
 
507
  throw Error('Invalid model selected: ' + model);
508
  }
509
  curPrompt = {
 
535
  fetchAPI = await (async (signal, model) => {
536
  let res;
537
  const body = {
538
+ prompt: '',
539
+ parent_message_uuid: '',
540
+ timezone: AI.zone(),
541
+ attachments: [],
542
+ files: [],
543
+ rendering_mode: 'raw'
 
 
544
  };
545
  let headers = {
546
  ...AI.hdr(Conversation.uuid || ''),
 
551
  const names = Object.keys(headers), values = Object.values(headers);
552
  headers = names.map(((header, idx) => `${header}: ${values[idx]}`));
553
  }
554
+ res = await (Config.Settings.Superfetch ? Superfetch : fetch)((Config.rProxy || AI.end()) + `/api/organizations/${uuidOrg || ''}/chat_conversations/${Conversation.uuid || ''}/retry_completion`, {
555
  stream: true,
556
  signal,
557
  method: 'POST',
 
676
  /******************************** */
677
  if (Config.Settings.xmlPlot) {
678
  idx > 0 && (spacing = '\n\n');
679
+ const prefix = message.customname ? message.role + ': ' + message.name.replaceAll('_', ' ') + ': ' : 'system' !== message.role || message.name ? Replacements[message.name || message.role] + ': ' : 'xmlPlot: ' + Replacements[message.role];
680
  return `${spacing}${message.strip ? '' : prefix}${message.content}`;
681
  } else {
682
  /******************************** */
683
  idx > 0 && (spacing = systemMessages.includes(message) ? '\n' : '\n\n');
684
+ const prefix = message.customname ? message.name.replaceAll('_', ' ') + ': ' : 'system' !== message.role || message.name ? Replacements[message.name || message.role] + ': ' : '' + Replacements[message.role];
685
  return `${spacing}${message.strip ? '' : prefix}${'system' === message.role ? message.content : message.content.trim()}`;
686
  } //
687
  }));
 
690
  systems
691
  };
692
  })(messages, type);
 
 
693
  /******************************** */
694
+ const legacy = /claude-([12]|instant)/i.test(model), messagesAPI = thirdKey || !legacy && !/<\|completeAPI\|>/.test(prompt) || /<\|messagesAPI\|>/.test(prompt), messagesLog = /<\|messagesLog\|>/.test(prompt), fusion = apiKey && messagesAPI && /<\|Fusion Mode\|>/.test(prompt), wedge = '\r';
695
+ const stopSet = /<\|stopSet *(\[.*?\]) *\|>/.exec(prompt)?.[1], stopRevoke = /<\|stopRevoke *(\[.*?\]) *\|>/.exec(prompt)?.[1];
696
+ if (stop_sequences || stopSet || stopRevoke) stop_sequences = JSON.parse(stopSet || '[]').concat(stop_sequences).concat(['\n\nHuman:', '\n\nAssistant:']).filter(item => !JSON.parse(stopRevoke || '[]').includes(item) && item);
697
+ apiKey && (type = oaiAPI ? 'oai_api' : messagesAPI ? 'msg_api' : type);
698
+ prompt = Config.Settings.xmlPlot ? xmlPlot(prompt, legacy && !/claude-2\.1/i.test(model)) : apiKey ? `\n\nHuman: ${genericFixes(prompt)}\n\nAssistant:` : genericFixes(prompt).trim();
699
+ Config.Settings.FullColon && (prompt = !legacy ?
700
+ prompt.replace(fusion ? /\n(?!\nAssistant:\s*$)(?=\n(Human|Assistant):)/gs : apiKey ? /(?<!\n\nHuman:.*)\n(?=\nAssistant:)|\n(?=\nHuman:)(?!.*\n\nAssistant:)/gs : /\n(?=\n(Human|Assistant):)/g, '\n' + wedge) :
701
+ prompt.replace(fusion ? /(?<=\n\nAssistant):(?!\s*$)|(?<=\n\nHuman):/gs : apiKey ? /(?<!\n\nHuman:.*)(?<=\n\nAssistant):|(?<=\n\nHuman):(?!.*\n\nAssistant:)/gs : /(?<=\n\n(Human|Assistant)):/g, '﹕'));
702
+ prompt = padtxt(prompt);
703
  /******************************** */
704
+ console.log(`${model} [${type}]${!retryRegen && systems.length > 0 ? ' ' + systems.join(' / ') : ''}`);
705
+ 'R' !== type || prompt || (prompt = '...regen...');
706
+ Logger?.write(`\n\n-------\n[${(new Date).toLocaleString()}]\n${Main}\n####### ${model} (${type})\n${JSON.stringify({FusionMode: fusion, PassParams: Config.Settings.PassParams, stop_sequences, temperature, top_k, top_p}, null, 2)}\n\n####### regex:\n${regexLog}\n####### PROMPT ${tokens}t:\n${prompt}\n--\n####### REPLY:\n`); //Logger?.write(`\n\n-------\n[${(new Date).toLocaleString()}]\n####### MODEL: ${model}\n####### PROMPT (${type}):\n${prompt}\n--\n####### REPLY:\n`);
707
  retryRegen || (fetchAPI = await (async (signal, model, prompt, temperature, type) => {
708
  /******************************** */
709
  if (apiKey) {
710
+ let messages, system, key = apiKey[Math.floor(Math.random() * apiKey.length)];
711
+ if (messagesAPI) {
712
+ const rounds = prompt.replace(/^(?!.*\n\nHuman:)/s, '\n\nHuman:').split('\n\nHuman:');
713
+ messages = rounds.slice(1).flatMap(round => {
714
+ const turns = round.split('\n\nAssistant:');
715
+ return [{role: 'user', content: turns[0].trim()}].concat(turns.slice(1).flatMap(turn => [{role: 'assistant', content: turn.trim()}]));
716
+ }).reduce((acc, current) => {
717
+ if (Config.Settings.FullColon && acc.length > 0 && (acc[acc.length - 1].role === current.role || !acc[acc.length - 1].content)) {
718
+ acc[acc.length - 1].content += (current.role === 'user' ? 'Human' : 'Assistant').replace(/.*/, legacy ? '\n$&﹕ ' : '\n' + wedge + '\n$&: ') + current.content;
719
+ } else acc.push(current);
720
+ return acc;
721
+ }, []).filter(message => message.content), oaiAPI ? messages.unshift({role: 'system', content: rounds[0].trim()}) : system = rounds[0].trim();
722
+ messagesLog && console.log({system, messages});
723
+ }
724
+ const res = await fetch((api_rProxy || 'https://api.anthropic.com').replace(/(\/v1)? *$/, thirdKey ? '$1' : '/v1').trim('/') + (oaiAPI ? '/chat/completions' : messagesAPI ? '/messages' : '/complete'), {
725
  method: 'POST',
726
  signal,
727
  headers: {
728
+ 'anthropic-version': '2023-06-01',
729
+ 'authorization': 'Bearer ' + key,
730
  'Content-Type': 'application/json',
731
+ 'User-Agent': AI.agent(),
732
+ 'x-api-key': key,
733
  },
734
  body: JSON.stringify({
735
+ ...oaiAPI || messagesAPI ? {
736
+ max_tokens : max_tokens_to_sample,
737
+ messages,
738
+ system
739
+ } : {
740
+ max_tokens_to_sample,
741
+ prompt
742
+ },
743
  model,
744
+ stop_sequences,
745
  stream: true,
746
+ temperature,
747
+ top_k,
748
+ top_p
749
  }),
750
  });
751
  await checkResErr(res);
 
757
  let splitedprompt = prompt.split('\n\nPlainPrompt:'); //
758
  prompt = splitedprompt[0]; //
759
  attachments.push({
760
+ extracted_content: prompt,
761
  file_name: 'paste.txt', //fileName(),
762
+ file_type: 'txt', //'text/plain',
763
+ file_size: Buffer.from(prompt).byteLength
764
  });
765
  prompt = 'r' === type ? Config.PromptExperimentFirst : Config.PromptExperimentNext;
766
  splitedprompt.length > 1 && (prompt += splitedprompt[1]); //
767
  }
768
  let res;
769
  const body = {
770
+ attachments,
771
+ files: [],
772
+ model: isPro || forceModel ? model : undefined,
773
+ rendering_mode: 'raw',
774
+ ...Config.Settings.PassParams && {
775
+ max_tokens_to_sample, //
776
+ //stop_sequences, //
777
+ top_k, //
778
+ top_p, //
779
+ temperature
780
  },
781
+ prompt: prompt || '',
782
+ timezone: AI.zone()
 
 
783
  };
784
  let headers = {
785
  ...AI.hdr(Conversation.uuid || ''),
786
  Accept: 'text/event-stream',
787
  Cookie: getCookies()
788
  };
789
+ res = await (Config.Settings.Superfetch ? Superfetch : fetch)(`${Config.rProxy || AI.end()}/api/organizations/${uuidOrg || ''}/chat_conversations/${Conversation.uuid || ''}/completion`, {
790
  stream: true,
791
  signal,
792
  method: 'POST',
 
794
  headers
795
  });
796
  updateParams(res);
797
+ await checkResErr(res);
798
  return res;
799
  })(signal, model, prompt, temperature, type));
800
  const response = Writable.toWeb(res);
 
819
  if ('AbortError' === err.name) {
820
  res.end();
821
  } else {
822
+ nochange = true, exceeded_limit = err.exceeded_limit; //
823
+ err.planned ? console.log(`${err.status || 'Aborted'}!\n`) : console.error('Clewd:\n%o', err); //err.planned || console.error('Clewd:\n%o', err);
824
  res.json({
825
  error: {
826
  message: 'clewd: ' + (err.message || err.name || err.type),
 
834
  clearInterval(titleTimer);
835
  if (clewdStream) {
836
  clewdStream.censored && console.warn('likely your account is hard-censored');
837
+ prevImpersonated = clewdStream.impersonated;
838
+ exceeded_limit = clewdStream.error.exceeded_limit; //
839
+ clewdStream.error.status < 200 || clewdStream.error.status >= 300 || clewdStream.error.message === 'Overloaded' && (nochange = true); //
840
  setTitle('ok ' + bytesToSize(clewdStream.size));
841
+ if (clewdStream.compModel && !(AI.mdl().includes(clewdStream.compModel) || Config.unknownModels.includes(clewdStream.compModel)) && !apiKey) {
842
+ Config.unknownModels.push(clewdStream.compModel);
843
+ writeSettings(Config);
844
+ }
845
+ console.log(`${200 == fetchAPI.status ? '' : ''}${fetchAPI.status}!\n`);
846
  clewdStream.empty();
847
  }
848
+ const shouldChange = exceeded_limit || !nochange && Config.Cookiecounter > 0 && changeflag++ >= Config.Cookiecounter - 1; //
849
+ if (!apiKey && (shouldChange || prevImpersonated)) { //if (prevImpersonated) {
850
+ try {
851
+ await deleteChat(Conversation.uuid);
852
+ } catch (err) {}
853
  /******************************** */
854
+ if (shouldChange) {
855
+ exceeded_limit && console.log(`Exceeded limit!\n`);
856
  changeflag = 0;
857
+ CookieChanger();
858
  }
859
  /******************************** */
860
  }
 
873
 
874
  default:
875
  !['/', '/v1', '/favicon.ico'].includes(req.url) && (console.log('unknown request: ' + req.url)); //console.log('unknown request: ' + req.url);
876
+ res.writeHead(200, {'Content-Type': 'text/html'}); //
877
+ res.write(`<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<script>\nfunction copyToClipboard(text) {\n var textarea = document.createElement("textarea");\n textarea.textContent = text;\n textarea.style.position = "fixed";\n document.body.appendChild(textarea);\n textarea.select();\n try {\n return document.execCommand("copy");\n } catch (ex) {\n console.warn("Copy to clipboard failed.", ex);\n return false;\n } finally {\n document.body.removeChild(textarea);\n }\n}\nfunction copyLink(event) {\n event.preventDefault();\n const url = new URL(window.location.href);\n const link = url.protocol + '//' + url.host + '/v1';\n copyToClipboard(link);\n alert('链接已复制: ' + link);\n}\n</script>\n</head>\n<body>\n${Main}<br/><br/>完全开源、免费且禁止商用<br/><br/>点击复制反向代理: <a href="v1" onclick="copyLink(event)">Copy Link</a><br/>填入OpenAI API反向代理并选择OpenAI分类中的claude模型(酒馆需打开Show "External" models,仅在api模式有模型选择差异)<br/><br/>教程与FAQ: <a href="https://rentry.org/teralomaniac_clewd" target="FAQ">Rentry</a> | <a href="https://discord.com/invite/B7Wr25Z7BZ" target="FAQ">Discord</a><br/><br/><br/>❗警惕任何高风险cookie/伪api(25k cookie)购买服务,以破坏中文AI开源共享环境倒卖免费资源抹去署名群组(🈲黑名单:酒馆小二、AI新服务、浅睡(鲑鱼)、赛博女友制作人(青麈/overloaded/科普晓百生)🈲)\n</body>\n</html>`); //
878
+ res.end(); //res.json(// {// error: {// message: '404 Not Found',// type: 404,// param: null,// code: 404// }//}, 404);
 
 
 
 
 
 
 
 
 
879
  }
880
  }));
881
 
 
922
  }
923
  }
924
  Config.rProxy = Config.rProxy.replace(/\/$/, '');
925
+ Config.CookieArray = [...new Set([Config.CookieArray].join(',').match(/(claude[-_][a-z0-9-_]*?@)?(sessionKey=)?sk-ant-sid01-[\w-]{86}-[\w-]{6}AA/g))];
926
+ Config.unknownModels = Config.unknownModels.reduce((prev, cur) => !cur || prev.includes(cur) || AI.mdl().includes(cur) ? prev : [...prev, cur], []);
927
  writeSettings(Config);
928
  currentIndex = Config.CookieIndex > 0 ? Config.CookieIndex - 1 : Config.Cookiecounter >= 0 ? Math.floor(Math.random() * Config.CookieArray.length) : 0;
929
  /***************************** */
 
937
  console.log('cleaning...');
938
  try {
939
  await deleteChat(Conversation.uuid);
940
+ SuperfetchFoldersRm();
941
  Logger?.close();
942
  } catch (err) {}
943
  process.exit();
lib/bin/ca CHANGED
@@ -1,22 +1,4 @@
1
- ##
2
- ## Bundle of CA Root Certificates
3
- ##
4
- ## Certificate data from Mozilla as of: Tue Jan 10 04:12:06 2023 GMT
5
- ##
6
- ## This is a bundle of X.509 certificates of public Certificate Authorities
7
- ## (CA). These were automatically extracted from Mozilla's root certificates
8
- ## file (certdata.txt). This file can be found in the mozilla source tree:
9
- ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
10
- ##
11
- ## It contains the certificates in PEM format and therefore
12
- ## can be directly used with curl / libcurl / php_curl, or with
13
- ## an Apache+mod_ssl webserver for SSL client authentication.
14
- ## Just configure this file as the SSLCACertificateFile.
15
- ##
16
- ## Conversion done with mk-ca-bundle.pl version 1.29.
17
- ## SHA256: 90c470e705b4b5f36f09684dc50e2b79c8b86989a848b62cd1a7bd6460ee65f6
18
- ##
19
-
20
 
21
  GlobalSign Root CA
22
  ==================
@@ -200,27 +182,6 @@ vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
200
  qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
201
  -----END CERTIFICATE-----
202
 
203
- Security Communication Root CA
204
- ==============================
205
- -----BEGIN CERTIFICATE-----
206
- MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
207
- U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
208
- HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
209
- U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
210
- ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
211
- 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
212
- DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
213
- 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
214
- DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
215
- JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
216
- DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
217
- 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
218
- mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
219
- s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
220
- 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
221
- FL39vmwLAw==
222
- -----END CERTIFICATE-----
223
-
224
  XRamp Global CA Root
225
  ====================
226
  -----BEGIN CERTIFICATE-----
@@ -603,26 +564,6 @@ NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
603
  dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
604
  -----END CERTIFICATE-----
605
 
606
- Hongkong Post Root CA 1
607
- =======================
608
- -----BEGIN CERTIFICATE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iqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
623
- c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
624
- -----END CERTIFICATE-----
625
-
626
  SecureSign RootCA11
627
  ===================
628
  -----BEGIN CERTIFICATE-----
@@ -689,39 +630,6 @@ YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
689
  kpeDMdmztcpHWD9f
690
  -----END CERTIFICATE-----
691
 
692
- Autoridad de Certificacion Firmaprofesional CIF A62634068
693
- =========================================================
694
- -----BEGIN CERTIFICATE-----
695
- MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
696
- BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
697
- MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
698
- QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
699
- NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
700
- Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
701
- B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
702
- 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
703
- ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
704
- plD9am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ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
718
- osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
719
- crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
720
- saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
721
- KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
722
- 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
723
- -----END CERTIFICATE-----
724
-
725
  Izenpe.com
726
  ==========
727
  -----BEGIN CERTIFICATE-----
@@ -1261,40 +1169,6 @@ Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
1261
  WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
1262
  -----END CERTIFICATE-----
1263
 
1264
- E-Tugra Certification Authority
1265
- ===============================
1266
- -----BEGIN CERTIFICATE-----
1267
- MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
1268
- DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
1269
- ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
1270
- ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
1271
- NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcm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/wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
1286
- MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
1287
- kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
1288
- XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
1289
- VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
1290
- a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
1291
- dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
1292
- KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
1293
- Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
1294
- 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
1295
- C7TbO6Orb1wdtn7os4I07QZcJA==
1296
- -----END CERTIFICATE-----
1297
-
1298
  T-TeleSec GlobalRoot Class 2
1299
  ============================
1300
  -----BEGIN CERTIFICATE-----
@@ -3276,55 +3150,6 @@ AwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozmut6Dacpps6kFtZaSF4fC0urQe87YQVt8
3276
  rgIwRt7qy12a7DLCZRawTDBcMPPaTnOGBtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
3277
  -----END CERTIFICATE-----
3278
 
3279
- E-Tugra Global Root CA RSA v3
3280
- =============================
3281
- -----BEGIN CERTIFICATE-----
3282
- MIIF8zCCA9ugAwIBAgIUDU3FzRYilZYIfrgLfxUGNPt5EDQwDQYJKoZIhvcNAQELBQAwgYAxCzAJ
3283
- BgNVBAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUtVHVncmEgRUJHIEEuUy4xHTAb
3284
- BgNVBAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYwJAYDVQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290
3285
- IENBIFJTQSB2MzAeFw0yMDAzMTgwOTA3MTdaFw00NTAzMTIwOTA3MTdaMIGAMQswCQYDVQQGEwJU
3286
- UjEPMA0GA1UEBxMGQW5rYXJhMRkwFwYDVQQKExBFLVR1Z3JhIEVCRyBBLlMuMR0wGwYDVQQLExRF
3287
- LVR1Z3JhIFRydXN0IENlbnRlcjEmMCQGA1UEAxMdRS1UdWdyYSBHbG9iYWwgUm9vdCBDQSBSU0Eg
3288
- djMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCiZvCJt3J77gnJY9LTQ91ew6aEOErx
3289
- jYG7FL1H6EAX8z3DeEVypi6Q3po61CBxyryfHUuXCscxuj7X/iWpKo429NEvx7epXTPcMHD4QGxL
3290
- sqYxYdE0PD0xesevxKenhOGXpOhL9hd87jwH7eKKV9y2+/hDJVDqJ4GohryPUkqWOmAalrv9c/SF
3291
- /YP9f4RtNGx/ardLAQO/rWm31zLZ9Vdq6YaCPqVmMbMWPcLzJmAy01IesGykNz709a/r4d+ABs8q
3292
- QedmCeFLl+d3vSFtKbZnwy1+7dZ5ZdHPOrbRsV5WYVB6Ws5OUDGAA5hH5+QYfERaxqSzO8bGwzrw
3293
- bMOLyKSRBfP12baqBqG3q+Sx6iEUXIOk/P+2UNOMEiaZdnDpwA+mdPy70Bt4znKS4iicvObpCdg6
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
3307
- IK+WEj5jlB0E5y67hscMmoi/dkfv97ALl2bSRM9gUgfh1SxKOidhd8rXj+eHDjD/DLsE4mHDosiX
3308
- YY60MGo8bcIHX0pzLz/5FooBZu+6kcpSV3uu1OYP3Qt6f4ueJiDPO++BcYNZ
3309
- -----END CERTIFICATE-----
3310
-
3311
- E-Tugra Global Root CA ECC v3
3312
- =============================
3313
- -----BEGIN CERTIFICATE-----
3314
- MIICpTCCAiqgAwIBAgIUJkYZdzHhT28oNt45UYbm1JeIIsEwCgYIKoZIzj0EAwMwgYAxCzAJBgNV
3315
- BAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUtVHVncmEgRUJHIEEuUy4xHTAbBgNV
3316
- BAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYwJAYDVQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290IENB
3317
- IEVDQyB2MzAeFw0yMDAzMTgwOTQ2NThaFw00NTAzMTIwOTQ2NThaMIGAMQswCQYDVQQGEwJUUjEP
3318
- MA0GA1UEBxMGQW5rYXJhMRkwFwYDVQQKExBFLVR1Z3JhIEVCRyBBLlMuMR0wGwYDVQQLExRFLVR1
3319
- Z3JhIFRydXN0IENlbnRlcjEmMCQGA1UEAxMdRS1UdWdyYSBHbG9iYWwgUm9vdCBDQSBFQ0MgdjMw
3320
- djAQBgcqhkjOPQIBBgUrgQQAIgNiAASOmCm/xxAeJ9urA8woLNheSBkQKczLWYHMjLiSF4mDKpL2
3321
- w6QdTGLVn9agRtwcvHbB40fQWxPa56WzZkjnIZpKT4YKfWzqTTKACrJ6CZtpS5iB4i7sAnCWH/31
3322
- Rs7K3IKjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU/4Ixcj75xGZsrTie0bBRiKWQ
3323
- zPUwHQYDVR0OBBYEFP+CMXI++cRmbK04ntGwUYilkMz1MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjO
3324
- PQQDAwNpADBmAjEA5gVYaWHlLcoNy/EZCL3W/VGSGn5jVASQkZo1kTmZ+gepZpO6yGjUij/67W4W
3325
- Aie3AjEA3VoXK3YdZUKWpqxdinlW2Iob35reX8dQj7FbcQwm32pAAOwzkSFxvmjkI6TZraE3
3326
- -----END CERTIFICATE-----
3327
-
3328
  Security Communication RootCA3
3329
  ==============================
3330
  -----BEGIN CERTIFICATE-----
@@ -3370,3 +3195,322 @@ BggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3L
3370
  snNdo4gIxwwCMQDAqy0Obe0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70e
3371
  N9k=
3372
  -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## https://curl.se/docs/caextract.html
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  GlobalSign Root CA
4
  ==================
 
182
  qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
183
  -----END CERTIFICATE-----
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  XRamp Global CA Root
186
  ====================
187
  -----BEGIN CERTIFICATE-----
 
564
  dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
565
  -----END CERTIFICATE-----
566
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
567
  SecureSign RootCA11
568
  ===================
569
  -----BEGIN CERTIFICATE-----
 
630
  kpeDMdmztcpHWD9f
631
  -----END CERTIFICATE-----
632
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
633
  Izenpe.com
634
  ==========
635
  -----BEGIN CERTIFICATE-----
 
1169
  WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
1170
  -----END CERTIFICATE-----
1171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1172
  T-TeleSec GlobalRoot Class 2
1173
  ============================
1174
  -----BEGIN CERTIFICATE-----
 
3150
  rgIwRt7qy12a7DLCZRawTDBcMPPaTnOGBtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
3151
  -----END CERTIFICATE-----
3152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3153
  Security Communication RootCA3
3154
  ==============================
3155
  -----BEGIN CERTIFICATE-----
 
3195
  snNdo4gIxwwCMQDAqy0Obe0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70e
3196
  N9k=
3197
  -----END CERTIFICATE-----
3198
+
3199
+ BJCA Global Root CA1
3200
+ ====================
3201
+ -----BEGIN CERTIFICATE-----
3202
+ MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBUMQswCQYDVQQG
3203
+ EwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJVFkxHTAbBgNVBAMMFEJK
3204
+ Q0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAzMTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkG
3205
+ A1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQD
3206
+ DBRCSkNBIEdsb2JhbCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFm
3207
+ CL3ZxRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZspDyRhyS
3208
+ sTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O558dnJCNPYwpj9mZ9S1Wn
3209
+ P3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgRat7GGPZHOiJBhyL8xIkoVNiMpTAK+BcW
3210
+ yqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRj
3211
+ eulumijWML3mG90Vr4TqnMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNn
3212
+ MoH1V6XKV0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/pj+b
3213
+ OT0CFqMYs2esWz8sgytnOYFcuX6U1WT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QWWYezyr/6zcCwupvI=
3227
+ -----END CERTIFICATE-----
3228
+
3229
+ BJCA Global Root CA2
3230
+ ====================
3231
+ -----BEGIN CERTIFICATE-----
3232
+ MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQswCQYDVQQGEwJD
3233
+ TjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJVFkxHTAbBgNVBAMMFEJKQ0Eg
3234
+ R2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgyMVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UE
3235
+ BhMCQ04xJjAkBgNVBAoMHUJFSUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRC
3236
+ SkNBIEdsb2JhbCBSb290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jl
3237
+ SR9BIgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK++kpRuDCK
3238
+ /eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJKsVF/BvDRgh9Obl+rg/xI
3239
+ 1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8
3240
+ W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8g
3241
+ UXOQwKhbYdDFUDn9hf7B43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w==
3242
+ -----END CERTIFICATE-----
3243
+
3244
+ Sectigo Public Server Authentication Root E46
3245
+ =============================================
3246
+ -----BEGIN CERTIFICATE-----
3247
+ MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQswCQYDVQQGEwJH
3248
+ QjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBTZXJ2
3249
+ ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5
3250
+ WjBfMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0
3251
+ aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUr
3252
+ gQQAIgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccCWvkEN/U0
3253
+ NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+6xnOQ6OjQjBAMB0GA1Ud
3254
+ DgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
3255
+ /zAKBggqhkjOPQQDAwNnADBkAjAn7qRaqCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RH
3256
+ lAFWovgzJQxC36oCMB3q4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21U
3257
+ SAGKcw==
3258
+ -----END CERTIFICATE-----
3259
+
3260
+ Sectigo Public Server Authentication Root R46
3261
+ =============================================
3262
+ -----BEGIN CERTIFICATE-----
3263
+ MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBfMQswCQYDVQQG
3264
+ EwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT
3265
+ ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwHhcNMjEwMzIyMDAwM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ZIhvcNAQEMBQADggIBAC9c
3279
+ mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQYKlJfp/imTYp
3280
+ E0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52gDY9hAaLMyZlbcp+nv4fjFg4
3281
+ exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZAFv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M
3282
+ 0ejf5lG5Nkc/kLnHvALcWxxPDkjBJYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI
3283
+ 84HxZmduTILA7rpXDhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9m
3284
+ pFuiTdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5dHn5Hrwd
3285
+ Vw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65LvKRRFHQV80MNNVIIb/b
3286
+ E/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmm
3287
+ J1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAYQqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL
3288
+ -----END CERTIFICATE-----
3289
+
3290
+ SSL.com TLS RSA Root CA 2022
3291
+ ============================
3292
+ -----BEGIN CERTIFICATE-----
3293
+ MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQG
3294
+ EwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxTU0wuY29tIFRMUyBSU0Eg
3295
+ Um9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloXDTQ2MDgxOTE2MzQyMVowTjELMA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OCAgEAjYlt
3309
+ hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsMQtfhWsSWTVTN
3310
+ j8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvfR4iyrT7gJ4eLSYwfqUdYe5by
3311
+ iB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJDPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjU
3312
+ o3KUQyxi4U5cMj29TH0ZR6LDSeeWP4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqo
3313
+ ENjwuSfr98t67wVylrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7Egkaib
3314
+ MOlqbLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2wAgDHbICi
3315
+ vRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3qr5nsLFR+jM4uElZI7xc7
3316
+ P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sjiMho6/4UIyYOf8kpIEFR3N+2ivEC+5BB0
3317
+ 9+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA=
3318
+ -----END CERTIFICATE-----
3319
+
3320
+ SSL.com TLS ECC Root CA 2022
3321
+ ============================
3322
+ -----BEGIN CERTIFICATE-----
3323
+ MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQswCQYDVQQGEwJV
3324
+ UzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxTU0wuY29tIFRMUyBFQ0MgUm9v
3325
+ dCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMx
3326
+ GDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3Qg
3327
+ Q0EgMjAyMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWy
3328
+ JGYmacCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFNSeR7T5v1
3329
+ 5wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSJjy+j6CugFFR7
3330
+ 81a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NWuCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGG
3331
+ MAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w
3332
+ 7deedWo1dlJF4AIxAMeNb0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5
3333
+ Zn6g6g==
3334
+ -----END CERTIFICATE-----
3335
+
3336
+ Atos TrustedRoot Root CA ECC TLS 2021
3337
+ =====================================
3338
+ -----BEGIN CERTIFICATE-----
3339
+ MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4wLAYDVQQDDCVB
3340
+ dG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0wCwYDVQQKDARBdG9zMQswCQYD
3341
+ VQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3Mg
3342
+ VHJ1c3RlZFJvb3QgUm9vdCBDQSBFQ0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYT
3343
+ AkRFMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6K
3344
+ DP/XtXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4AjJn8ZQS
3345
+ b+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2KCXWfeBmmnoJsmo7jjPX
3346
+ NtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMDaAAwZQIwW5kp85wxtolrbNa9d+F851F+
3347
+ uDrNozZffPc8dz7kUK2o59JZDCaOMDtuCCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGY
3348
+ a3cpetskz2VAv9LcjBHo9H1/IISpQuQo
3349
+ -----END CERTIFICATE-----
3350
+
3351
+ Atos TrustedRoot Root CA RSA TLS 2021
3352
+ =====================================
3353
+ -----BEGIN CERTIFICATE-----
3354
+ MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBMMS4wLAYDVQQD
3355
+ DCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIxMQ0wCwYDVQQKDARBdG9zMQsw
3356
+ CQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0
3357
+ b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNV
3358
+ BAYTAkRFMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BB
3359
+ l01Z4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYvYe+W/CBG
3360
+ vevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZkmGbzSoXfduP9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vkt
3374
+ afcxBPTy+av5EzH4AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9q
3375
+ TFsR0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuYo7Ey7Nmj
3376
+ 1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5dDTedk+SKlOxJTnbPP/l
3377
+ PqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcEoji2jbDwN/zIIX8/syQbPYtuzE2wFg2W
3378
+ HYMfRsCbvUOZ58SWLs5fyQ==
3379
+ -----END CERTIFICATE-----
3380
+
3381
+ TrustAsia Global Root CA G3
3382
+ ===========================
3383
+ -----BEGIN CERTIFICATE-----
3384
+ MIIFpTCCA42gAwIBAgIUZPYOZXdhaqs7tOqFhLuxibhxkw8wDQYJKoZIhvcNAQEMBQAwWjELMAkG
3385
+ A1UEBhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIEluYy4xJDAiBgNVBAMM
3386
+ G1RydXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHMzAeFw0yMTA1MjAwMjEwMTlaFw00NjA1MTkwMjEw
3387
+ MTlaMFoxCzAJBgNVBAYTAkNOMSUwIwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMu
3388
+ MSQwIgYDVQQDDBtUcnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzMwggIiMA0GCSqGSIb3DQEBAQUA
3389
+ A4ICDwAwggIKAoICAQDAMYJhkuSUGwoqZdC+BqmHO1ES6nBBruL7dOoKjbmzTNyPtxNST1QY4Sxz
3390
+ lZHFZjtqz6xjbYdT8PfxObegQ2OwxANdV6nnRM7EoYNl9lA+sX4WuDqKAtCWHwDNBSHvBm3dIZwZ
3391
+ Q0WhxeiAysKtQGIXBsaqvPPW5vxQfmZCHzyLp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QJqaTDFHApXB64ipCz5xUG3uOyfT0gA+QEEVcys
3405
+ +TIxxHWVBqB/0Y0n3bOppHKH/lmLmnp0Ft0WpWIp6zqW3IunaFnT63eROfjXy9mPX1onAX1daBli
3406
+ 2MjN9LdyR75bl87yraKZk62Uy5P2EgmVtqvXO9A/EcswFi55gORngS1d7XB4tmBZrOFdRWOPyN9y
3407
+ aFvqHbgB8X7754qz41SgOAngPN5C8sLtLpvzHzW2NtjjgKGLzZlkD8Kqq7HK9W+eQ42EVJmzbsAS
3408
+ ZthwEPEGNTNDqJwuuhQxzhB/HIbjj9LV+Hfsm6vxL2PZQl/gZ4FkkfGXL/xuJvYz+NO1+MRiqzFR
3409
+ JQJ6+N1rZdVtTTDIZbpoFGWsJwt0ivKH
3410
+ -----END CERTIFICATE-----
3411
+
3412
+ TrustAsia Global Root CA G4
3413
+ ===========================
3414
+ -----BEGIN CERTIFICATE-----
3415
+ MIICVTCCAdygAwIBAgIUTyNkuI6XY57GU4HBdk7LKnQV1tcwCgYIKoZIzj0EAwMwWjELMAkGA1UE
3416
+ BhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIEluYy4xJDAiBgNVBAMMG1Ry
3417
+ dXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHNDAeFw0yMTA1MjAwMjEwMjJaFw00NjA1MTkwMjEwMjJa
3418
+ MFoxCzAJBgNVBAYTAkNOMSUwIwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMSQw
3419
+ IgYDVQQDDBtUcnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
3420
+ AATxs8045CVD5d4ZCbuBeaIVXxVjAd7Cq92zphtnS4CDr5nLrBfbK5bKfFJV4hrhPVbwLxYI+hW8
3421
+ m7tH5j/uqOFMjPXTNvk4XatwmkcN4oFBButJ+bAp3TPsUKV/eSm4IJijYzBhMA8GA1UdEwEB/wQF
3422
+ MAMBAf8wHwYDVR0jBBgwFoAUpbtKl86zK3+kMd6Xg1mDpm9xy94wHQYDVR0OBBYEFKW7SpfOsyt/
3423
+ pDHel4NZg6ZvccveMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjBe8usGzEkxn0AA
3424
+ bbd+NvBNEU/zy4k6LHiRUKNbwMp1JvK/kF0LgoxgKJ/GcJpo5PECMFxYDlZ2z1jD1xCMuo6u47xk
3425
+ dUfFVZDj/bpV6wfEU6s3qe4hsiFbYI89MvHVI5TWWA==
3426
+ -----END CERTIFICATE-----
3427
+
3428
+ CommScope Public Trust ECC Root-01
3429
+ ==================================
3430
+ -----BEGIN CERTIFICATE-----
3431
+ MIICHTCCAaOgAwIBAgIUQ3CCd89NXTTxyq4yLzf39H91oJ4wCgYIKoZIzj0EAwMwTjELMAkGA1UE
3432
+ BhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBUcnVz
3433
+ dCBFQ0MgUm9vdC0wMTAeFw0yMTA0MjgxNzM1NDNaFw00NjA0MjgxNzM1NDJaME4xCzAJBgNVBAYT
3434
+ AlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3Qg
3435
+ RUNDIFJvb3QtMDEwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARLNumuV16ocNfQj3Rid8NeeqrltqLx
3436
+ eP0CflfdkXmcbLlSiFS8LwS+uM32ENEp7LXQoMPwiXAZu1FlxUOcw5tjnSCDPgYLpkJEhRGnSjot
3437
+ 6dZoL0hOUysHP029uax3OVejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
3438
+ A1UdDgQWBBSOB2LAUN3GGQYARnQE9/OufXVNMDAKBggqhkjOPQQDAwNoADBlAjEAnDPfQeMjqEI2
3439
+ Jpc1XHvr20v4qotzVRVcrHgpD7oh2MSg2NED3W3ROT3Ek2DS43KyAjB8xX6I01D1HiXo+k515liW
3440
+ pDVfG2XqYZpwI7UNo5uSUm9poIyNStDuiw7LR47QjRE=
3441
+ -----END CERTIFICATE-----
3442
+
3443
+ CommScope Public Trust ECC Root-02
3444
+ ==================================
3445
+ -----BEGIN CERTIFICATE-----
3446
+ MIICHDCCAaOgAwIBAgIUKP2ZYEFHpgE6yhR7H+/5aAiDXX0wCgYIKoZIzj0EAwMwTjELMAkGA1UE
3447
+ BhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBUcnVz
3448
+ dCBFQ0MgUm9vdC0wMjAeFw0yMTA0MjgxNzQ0NTRaFw00NjA0MjgxNzQ0NTNaME4xCzAJBgNVBAYT
3449
+ AlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3Qg
3450
+ RUNDIFJvb3QtMDIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR4MIHoYx7l63FRD/cHB8o5mXxO1Q/M
3451
+ MDALj2aTPs+9xYa9+bG3tD60B8jzljHz7aRP+KNOjSkVWLjVb3/ubCK1sK9IRQq9qEmUv4RDsNuE
3452
+ SgMjGWdqb8FuvAY5N9GIIvejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
3453
+ A1UdDgQWBBTmGHX/72DehKT1RsfeSlXjMjZ59TAKBggqhkjOPQQDAwNnADBkAjAmc0l6tqvmSfR9
3454
+ Uj/UQQSugEODZXW5hYA4O9Zv5JOGq4/nich/m35rChJVYaoR4HkCMHfoMXGsPHED1oQmHhS48zs7
3455
+ 3u1Z/GtMMH9ZzkXpc2AVmkzw5l4lIhVtwodZ0LKOag==
3456
+ -----END CERTIFICATE-----
3457
+
3458
+ CommScope Public Trust RSA Root-01
3459
+ ==================================
3460
+ -----BEGI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XgDW1XT2mH
3474
+ +VepuhX2yFJtocucH+X8eKg1mp9BFM6ltM6UCBwJrVbl2rZJmkrqYxhTnCwuwwIDAQABo0IwQDAP
3475
+ BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUN12mmnQywsL5x6YVEFm4
3476
+ 5P3luG0wDQYJKoZIhvcNAQELBQADggIBAK+nz97/4L1CjU3lIpbfaOp9TSp90K09FlxD533Ahuh6
3477
+ NWPxzIHIxgvoLlI1pKZJkGNRrDSsBTtXAOnTYtPZKdVUvhwQkZyybf5Z/Xn36lbQnmhUQo8mUuJM
3478
+ 3y+Xpi/SB5io82BdS5pYV4jvguX6r2yBS5KPQJqTRlnLX3gWsWc+QgvfKNmwrZggvkN80V4aCRck
3479
+ jXtdlemrwWCrWxhkgPut4AZ9HcpZuPN4KWfGVh2vtrV0KnahP/t1MJ+UXjulYPPLXAziDslg+Mkf
3480
+ Foom3ecnf+slpoq9uC02EJqxWE2aaE9gVOX2RhOOiKy8IUISrcZKiX2bwdgt6ZYD9KJ0DLwAHb/W
3481
+ NyVntHKLr4W96ioDj8z7PEQkguIBpQtZtjSNMgsSDesnwv1B10A8ckYpwIzqug/xBpMu95yo9GA+
3482
+ o/E4Xo4TwbM6l4c/ksp4qRyv0LAbJh6+cOx69TOY6lz/KwsETkPdY34Op054A5U+1C0wlREQKC6/
3483
+ oAI+/15Z0wUOlV9TRe9rh9VIzRamloPh37MG88EU26fsHItdkJANclHnYfkUyq+Dj7+vsQpZXdxc
3484
+ 1+SWrVtgHdqul7I52Qb1dgAT+GhMIbA1xNxVssnBQVocicCMb3SgazNNtQEo/a2tiRc7ppqEvOuM
3485
+ 6sRxJKi6KfkIsidWNTJf6jn7MZrVGczw
3486
+ -----END CERTIFICATE-----
3487
+
3488
+ CommScope Public Trust RSA Root-02
3489
+ ==================================
3490
+ -----BEGIN CERTIFICATE-----
3491
+ MIIFbDCCA1SgAwIBAgIUVBa/O345lXGN0aoApY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z2rDN6ieZdIs5fq6M8EGRPbmz6UNp2YINIos8wIDAQABo0IwQDAP
3505
+ BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUR9DnsSL/nSz12Vdgs7Gx
3506
+ cJXvYXowDQYJKoZIhvcNAQELBQADggIBAIZpsU0v6Z9PIpNojuQhmaPORVMbc0RTAIFhzTHjCLqB
3507
+ KCh6krm2qMhDnscTJk3C2OVVnJJdUNjCK9v+5qiXz1I6JMNlZFxHMaNlNRPDk7n3+VGXu6TwYofF
3508
+ 1gbTl4MgqX67tiHCpQ2EAOHyJxCDut0DgdXdaMNmEMjRdrSzbymeAPnCKfWxkxlSaRosTKCL4BWa
3509
+ MS/TiJVZbuXEs1DIFAhKm4sTg7GkcrI7djNB3NyqpgdvHSQSn8h2vS/ZjvQs7rfSOBAkNlEv41xd
3510
+ gSGn2rtO/+YHqP65DSdsu3BaVXoT6fEqSWnHX4dXTEN5bTpl6TBcQe7rd6VzEojov32u5cSoHw2O
3511
+ HG1QAk8mGEPej1WFsQs3BWDJVTkSBKEqz3EWnzZRSb9wO55nnPt7eck5HHisd5FUmrh1CoFSl+Nm
3512
+ YWvtPjgelmFV4ZFUjO2MJB+ByRCac5krFk5yAD9UG/iNuovnFNa2RU9g7Jauwy8CTl2dlklyALKr
3513
+ dVwPaFsdZcJfMw8eD/A7hvWwTruc9+olBdytoptLFwG+Qt81IR2tq670v64fG9PiO/yzcnMcmyiQ
3514
+ iRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17Org3bhzjlP1v9mxnhMUF6cKojawHhRUzN
3515
+ lM47ni3niAIi9G7oyOzWPPO5std3eqx7
3516
+ -----END CERTIFICATE-----
lib/bin/clewd-superfetch-linux-amd64 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1e0d288fd341a3d9b246575bf77823b1da118331d0d894ba9831574d4ce25354
3
- size 3215216
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00bc821ead81489eaca2ecbf98d8b9b35edaa8be4de77fe67ce74e8c4ad2857e
3
+ size 3672568
lib/bin/clewd-superfetch-linux-arm64 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dc9cfb42756416646536a11b351d205ab2e875761efd6ae1be465b3ae822e0a2
3
- size 2772712
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11aa837cd0289a474c96c9f7950fdfa881cff38952ec1b6159904c0a94da925f
3
+ size 3461256
lib/bin/clewd-superfetch-win-amd64.exe CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a3e460b97a2a31a89cce4ab8bbb9a56aca7747edf07947c30941ba1100b41053
3
- size 4712448
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9989b4ada8c2820f2486f31babe1adf40ad2e518e6640584f6e23d445e8f51e9
3
+ size 4842496
lib/bin/clewd-superfetch-win-ia32.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1c183f741d68010a42e36c0d27b3df359c3d0d4447be3578946d4558a8c1c4a
3
+ size 4967936
lib/clewd-stream.js CHANGED
@@ -42,7 +42,8 @@ class ClewdStream extends TransformStream {
42
  #stopReason=void 0;
43
  #hardCensor=false;
44
  #impersonated=false;
45
- #nochange=false; //
 
46
  get size() {
47
  return this.#recvLength;
48
  }
@@ -55,11 +56,14 @@ class ClewdStream extends TransformStream {
55
  get impersonated() {
56
  return this.#impersonated;
57
  }
58
- /************************ */
59
- get nochange() {
60
- return this.#nochange;
61
  }
62
- /************************ */
 
 
 
63
  empty() {
64
  this.#compOK = this.#compRaw = '';
65
  this.#compAll = [];
@@ -72,8 +76,8 @@ class ClewdStream extends TransformStream {
72
  }
73
  #err(err, controller) {
74
  this.#logger?.write(JSON.stringify(err, null, 4));
75
- const message = `## ${this.#version}\n**${this.#model} error**:\n${err.status || err.code || err.type}\n\n\`\`\`${err.message}\`\`\`\n\nFAQ: https://rentry.org/teralomaniac_clewd`;
76
- this.#nochange = true; //
77
  this.#enqueue(this.#build(message), controller);
78
  return this.#endEarly(controller);
79
  }
@@ -103,8 +107,7 @@ class ClewdStream extends TransformStream {
103
  this.#streaming ? this.#compOK.length > 0 && this.#enqueue(this.#build(this.#compOK), controller) : this.#enqueue(this.#build(this.#compAll.join('')), controller);
104
  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);
105
  if (!this.#ended && 0 === this.total) {
106
- const err = `## ${this.#version}\n**error**:\n\n\`\`\`Received no valid replies at all\`\`\`\n\nFAQ: https://rentry.org/teralomaniac_clewd`;
107
- this.#nochange = true; //
108
  this.#enqueue(this.#build(err), controller);
109
  }
110
  this.#streaming && this.#enqueue('data: [DONE]\n\n', controller);
@@ -139,7 +142,7 @@ class ClewdStream extends TransformStream {
139
  } else {
140
  this.#recvLength += Buffer.byteLength(chunk);
141
  }
142
- this.#compRaw += chunk.replace(/event: (completion|ping)\s*|\r/gi,''); //this.#compRaw += chunk;
143
  const substr = this.#compRaw.split('\n\n'), lastMsg = substr.length - 1;
144
  0 !== substr[lastMsg].length ? this.#compRaw = substr[lastMsg] : this.#compRaw = '';
145
  for (let i = 0; i < lastMsg; i++) {
@@ -163,12 +166,13 @@ class ClewdStream extends TransformStream {
163
  },
164
  status: this.#source.status,
165
  superfetch: this.#source.superfetch
166
- }), false, false); //}), false);
167
  delete err.stack;
168
  return this.#err(err, controller);
169
  }
170
- if (parsed.completion) {
171
- parsed.completion = genericFixes(parsed.completion);
 
172
  this.#compOK += parsed.completion;
173
  this.#compAll.push(parsed.completion);
174
  delayChunk = DangerChars.some((char => this.#compOK.endsWith(char) || parsed.completion.startsWith(char)));
 
42
  #stopReason=void 0;
43
  #hardCensor=false;
44
  #impersonated=false;
45
+ #error={}; //
46
+ #compModel=''; //
47
  get size() {
48
  return this.#recvLength;
49
  }
 
56
  get impersonated() {
57
  return this.#impersonated;
58
  }
59
+ /************************ */
60
+ get error() {
61
+ return this.#error;
62
  }
63
+ get compModel() {
64
+ return this.#compModel;
65
+ }
66
+ /************************ */
67
  empty() {
68
  this.#compOK = this.#compRaw = '';
69
  this.#compAll = [];
 
76
  }
77
  #err(err, controller) {
78
  this.#logger?.write(JSON.stringify(err, null, 4));
79
+ const message = `## ${this.#version}\n**${this.#model} error**:\n${err.status || err.code || err.type}\n\n\`\`\`${err.message}\`\`\`\n\nFAQ: <a href="https://rentry.org/teralomaniac_clewd" target="FAQ">https://rentry.org/teralomaniac_clewd</a>`;
80
+ this.#error = err; //
81
  this.#enqueue(this.#build(message), controller);
82
  return this.#endEarly(controller);
83
  }
 
107
  this.#streaming ? this.#compOK.length > 0 && this.#enqueue(this.#build(this.#compOK), controller) : this.#enqueue(this.#build(this.#compAll.join('')), controller);
108
  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);
109
  if (!this.#ended && 0 === this.total) {
110
+ const err = `## ${this.#version}\n**error**:\n\n\`\`\`Received no valid replies at all\`\`\`\n\nFAQ: <a href="https://rentry.org/teralomaniac_clewd" target="FAQ">https://rentry.org/teralomaniac_clewd</a>`;
 
111
  this.#enqueue(this.#build(err), controller);
112
  }
113
  this.#streaming && this.#enqueue('data: [DONE]\n\n', controller);
 
142
  } else {
143
  this.#recvLength += Buffer.byteLength(chunk);
144
  }
145
+ this.#compRaw += chunk.replace(/event: [\w]+\s*|\r/gi,''); //this.#compRaw += chunk;
146
  const substr = this.#compRaw.split('\n\n'), lastMsg = substr.length - 1;
147
  0 !== substr[lastMsg].length ? this.#compRaw = substr[lastMsg] : this.#compRaw = '';
148
  for (let i = 0; i < lastMsg; i++) {
 
166
  },
167
  status: this.#source.status,
168
  superfetch: this.#source.superfetch
169
+ }), false);
170
  delete err.stack;
171
  return this.#err(err, controller);
172
  }
173
+ if (!this.#compModel && parsed.model) this.#compModel = parsed.model;
174
+ if (parsed.completion || parsed.delta?.text || parsed.choices?.[0]?.delta?.content) { //if (parsed.completion) {
175
+ parsed.completion = genericFixes(parsed.completion || parsed.delta?.text || parsed.choices?.[0]?.delta?.content); //parsed.completion = genericFixes(parsed.completion);
176
  this.#compOK += parsed.completion;
177
  this.#compAll.push(parsed.completion);
178
  delayChunk = DangerChars.some((char => this.#compOK.endsWith(char) || parsed.completion.startsWith(char)));
lib/clewd-superfetch.js CHANGED
@@ -1,4 +1,4 @@
1
  /*
2
- * https://rentry.org/teralomaniac_clewd
3
- * https://github.com/teralomaniac/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"),m=e=>"win32"===process.platform?".\\"+e:e,l=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),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,54,92,34,44,32,92,34,78,111,116,41,65,59,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,54,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,54,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,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,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,93],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 _=l(m(o)),g=l(m(c)),v=l(m(i)),O=["-v","--cacert",""+l(m(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;
 
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"),{randomInt:r}=require("node:crypto"),{relative:t,resolve:s,join:n,normalize:o,basename:i,dirname:a}=require("node:path"),{writeFileSync:d,unlinkSync:c,existsSync:u,mkdirSync:m,rmdirSync:l}=require("node:fs"),{ReadableStream:f}=require("node:stream/web"),p=e=>"win32"===process.platform?".\\"+e:e,h=e=>"win32"===process.platform||e.indexOf(" ")>-1?`"${e}"`:e,w={win32:{x64:"clewd-superfetch-win-amd64.exe",ia32:"clewd-superfetch-win-ia32.exe"},darwin:{x64:"clewd-superfetch-linux-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"}}[process.platform]?.[process.arch],y=""+o(t("./","./bin/"+w)),b=o(s(__dirname,y,"../","../")),S=s(b,y),x=a(S),_=""+o(s(x,"./cfg")),g=""+o(s(x,"./pyld")),v=""+o(s(x,"./hdr")),O=[123,34,115,101,99,45,99,104,45,117,97,34,58,34,92,34,78,111,116,95,65,32,66,114,97,110,100,92,34,59,118,61,92,34,56,92,34,44,32,92,34,67,104,114,111,109,105,117,109,92,34,59,118,61,92,34,49,50,48,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,50,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,109,97,99,79,83,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,49,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,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,50,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],j=[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,45,45,104,116,116,112,50,34,44,34,45,45,104,116,116,112,50,45,115,101,116,116,105,110,103,115,32,39,49,58,54,53,53,51,54,59,50,58,48,59,52,58,54,50,57,49,52,53,54,59,54,58,50,54,50,49,52,52,39,34,44,34,45,45,104,116,116,112,50,45,119,105,110,100,111,119,45,117,112,100,97,116,101,32,49,53,54,54,51,49,48,53,34,44,34,45,45,99,111,109,112,114,101,115,115,101,100,34,44,34,45,45,101,99,104,32,71,82,69,65,83,69,34,44,34,45,45,116,108,115,118,49,46,50,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,93],$=(e=false)=>{if(!w||!u(S)){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] ${t(__dirname,S)}\n`);return true},q=(i,a)=>{a.headers??={};"string"!=typeof a.body&&(a.body=a.body?JSON.stringify(a.body):"");if(!$())return;const u=r(1,2e4).toString(),m=o(t(b,s(_,u))),l=o(t(b,s(g,u))),f=o(t(b,s(v,u))),w=o(t("./","bin/ca"));let x={...JSON.parse(Buffer.from(O).toString()),...a.headers};x=Object.entries(x).map((([e,r])=>`${e}: ${r}`));const q=h(p(m)),A=h(p(f)),L=h(p(l)),k=["-v","--http2","--cacert",""+h(p(w)),"--config",""+q,"--header","@"+A],J=[...JSON.parse(Buffer.from(j).toString()),"-X "+(a.method||"GET")];d(n(__dirname,m),J.join("\n"));d(n(__dirname,f),x.join("\n"));a.body&&d(n(__dirname,l),a.body);if("POST"===a.method||"PUT"===a.method||"PATCH"===a.method){k.push("--data");k.push("@"+L)}return new Promise((r=>{const t=e("android"===process.platform?S:y,[...k,""+i],{cwd:b,windowsHide:true,killSignal:"SIGKILL",windowsVerbatimArguments:true,detached:"win32"!==process.platform});t.superfetch=true;t.rape=function(){this.stdout?.end();this.stderr?.end()}.bind(t);t.once("spawn",(()=>{t.stream=a.stream||false;t.id=u;if(t.stream){Object.defineProperty(t,"body",{get:()=>t.stdout});return r(t)}t.body="";t.stdout.on("data",(e=>t.body+=e.toString()));t.json=async()=>JSON.parse(t.body);t.text=async()=>t.body;t.stdout.once("end",(()=>r(t)))}));t.once("error",(e=>{console.warn("superfetch [err]",e)}));t.once("close",(()=>{(e=>{try{c(n(__dirname,m));c(n(__dirname,f));a.body&&c(n(__dirname,l))}catch(e){}e.stdout.removeAllListeners();e.stderr.removeAllListeners();e.stream&&e.body.removeAllListeners()})(t)}));t.stderr.on("data",(e=>{const r=/HTTP\/2 (\d{3})+/g,s=(e=e.toString().trim()).match(r);if(!t.status&&s){const s=r.exec(e);t.status=+s[1]}const n=/(?:< )(.+?)(?:: )(.+)/g,o=e.match(n);if(o){const e={};o.forEach((r=>{const t=r.split(n);e[t?.[1]]=t?.[2]}));t.headers=e}}))}))};module.exports={SuperfetchFoldersMk:()=>{m(_,{recursive:true});m(g,{recursive:true});m(v,{recursive:true})},SuperfetchFoldersRm:()=>{l(_,{recursive:true});l(g,{recursive:true});l(v,{recursive:true})},ClewdSuperfetch:q,SuperfetchAvailable:$,SuperfetchRelative:y};
lib/clewd-utils.js CHANGED
@@ -5,31 +5,34 @@
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 + '(2) 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: () => JSON.parse(Buffer.from([ 91, 34, 33, 32, 85, 83, 73, 78, 71, 32, 77, 79, 68, 69, 76, 83, 32, 79, 84, 72, 69, 82, 32, 84, 72, 65, 78, 32, 50, 46, 49, 32, 111, 114, 32, 50, 46, 48, 32, 42, 67, 79, 85, 76, 68, 42, 32, 71, 69, 84, 32, 89, 79, 85, 32, 66, 65, 78, 78, 69, 68, 32, 73, 70, 32, 89, 79, 85, 39, 82, 69, 32, 78, 79, 84, 32, 65, 32, 80, 82, 79, 32, 85, 83, 69, 82, 32, 33, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 50, 46, 49, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 50, 46, 48, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 105, 110, 115, 116, 97, 110, 116, 45, 49, 46, 50, 34, 93 ]).toString()),
17
- zone: () => Buffer.from([ 65, 115, 105, 97, 47, 83, 104, 97, 110, 103, 104, 97, 105 ]).toString(), //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, 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, 54, 46, 48, 46, 48, 46, 48, 32, 83, 97, 102, 97, 114, 105, 47, 53, 51, 55, 46, 51, 54 ]).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
  };
@@ -41,31 +44,34 @@ module.exports = {
41
  DangerChars,
42
  encodeDataJSON: completion => Encoder.encode(`data: ${JSON.stringify(completion)}\n\n`),
43
  genericFixes: text => text.replace(/(\r\n|\r|\\n)/gm, '\n'),
44
- checkResErr: async (res, CookieChanger, throwIt = true) => { //(res, throwIt = true) => {
45
  let err, json, errAPI;
46
  if ('string' == typeof res) {
47
  json = JSON.parse(res);
48
  errAPI = json.error;
49
  err = Error(errAPI.message);
50
  } else if (res.status < 200 || res.status >= 300) {
51
- err = Error('Unexpected response code: ' + (res.status || json.status));
52
- json = await res.json();
53
- errAPI = json.error;
 
 
 
 
 
 
54
  }
55
  if (errAPI) {
56
  err.status = res.status || json.status;
57
  err.planned = true;
58
  errAPI.message && (err.message = errAPI.message);
59
  errAPI.type && (err.type = errAPI.type);
60
- if ((429 === res.status || 429 === json.status) && errAPI.resets_at) {
61
- const hours = ((new Date(1e3 * errAPI.resets_at).getTime() - Date.now()) / 1e3 / 60 / 60).toFixed(1);
62
- err.message += `, expires in ${hours} hours`;
63
- /************************** */
64
- if (CookieChanger) {
65
- console.log(`Exceeded limit!\n`);
66
- CookieChanger && CookieChanger.emit('ChangeCookie');
67
- }
68
- /************************** */
69
  }
70
  if (throwIt) {
71
  throw err;
 
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 + '(11) 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, 97, 112, 105, 46, 99, 108, 97, 117, 100, 101, 46, 97, 105 ]).toString(),
16
+ mdl: () => JSON.parse(Buffer.from([ 91, 34, 99, 108, 97, 117, 100, 101, 45, 51, 45, 53, 45, 115, 111, 110, 110, 101, 116, 45, 50, 48, 50, 52, 48, 54, 50, 48, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 51, 45, 111, 112, 117, 115, 45, 50, 48, 50, 52, 48, 50, 50, 57, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 51, 45, 115, 111, 110, 110, 101, 116, 45, 50, 48, 50, 52, 48, 50, 50, 57, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 51, 45, 104, 97, 105, 107, 117, 45, 50, 48, 50, 52, 48, 51, 48, 55, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 50, 46, 49, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 50, 46, 48, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 49, 46, 51, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 105, 110, 115, 116, 97, 110, 116, 45, 49, 46, 50, 34, 44, 34, 99, 108, 97, 117, 100, 101, 45, 105, 110, 115, 116, 97, 110, 116, 45, 49, 46, 49, 34, 93 ]).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, 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, 54, 46, 48, 46, 48, 46, 48, 32, 83, 97, 102, 97, 114, 105, 47, 53, 51, 55, 46, 51, 54 ]).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
+ extra: () => JSON.parse(Buffer.from([ 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, 54, 92, 34, 44, 32, 92, 34, 78, 111, 116, 59, 65, 61, 66, 114, 97, 110, 100, 92, 34, 59, 118, 61, 92, 34, 50, 52, 92, 34, 44, 32, 92, 34, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 69, 100, 103, 101, 92, 34, 59, 118, 61, 92, 34, 49, 49, 54, 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, 115, 101, 99, 45, 102, 101, 116, 99, 104, 45, 100, 101, 115, 116, 34, 58, 34, 101, 109, 112, 116, 121, 34, 44, 34, 115, 101, 99, 45, 102, 101, 116, 99, 104, 45, 109, 111, 100, 101, 34, 58, 34, 110, 97, 118, 105, 103, 97, 116, 101, 34, 44, 34, 115, 101, 99, 45, 102, 101, 116, 99, 104, 45, 115, 105, 116, 101, 34, 58, 34, 110, 111, 110, 101, 34, 44, 34, 115, 101, 99, 45, 102, 101, 116, 99, 104, 45, 117, 115, 101, 114, 34, 58, 34, 63, 49, 34, 44, 34, 117, 112, 103, 114, 97, 100, 101, 45, 105, 110, 115, 101, 99, 117, 114, 101, 45, 114, 101, 113, 117, 101, 115, 116, 115, 34, 58, 49, 125 ]).toString()),
21
  hdr: refPath => ({
22
+ ...AI.extra(),
23
  'Content-Type': 'application/json',
24
+ 'User-Agent': AI.agent(),
25
  Referer: `${AI.end()}/${refPath ? 'chat/' + refPath : ''}`,
26
  Origin: '' + AI.end()
27
  })
28
  }, indexOfH = (text, last = false) => {
29
  let location = -1;
30
+ const matchesH = text.match(/(?:(?:\\n)|\r|\n){2}((?:Human|H)[:︓:﹕] ?)/gm); //const matchesH = text.match(/(?:(?:\\n)|\n){2}((?:Human|H): ?)/gm);
31
  matchesH?.length > 0 && (location = last ? text.lastIndexOf(matchesH[matchesH.length - 1]) : text.indexOf(matchesH[0]));
32
  return location;
33
  }, indexOfA = (text, last = false) => {
34
  let location = -1;
35
+ const matchesA = text.match(/(?:(?:\\n)|\r|\n){2}((?:Assistant|A)[:︓:﹕] ?)/gm); //const matchesA = text.match(/(?:(?:\\n)|\n){2}((?:Assistant|A): ?)/gm);
36
  matchesA?.length > 0 && (location = last ? text.lastIndexOf(matchesA[matchesA.length - 1]) : text.indexOf(matchesA[0]));
37
  return location;
38
  };
 
44
  DangerChars,
45
  encodeDataJSON: completion => Encoder.encode(`data: ${JSON.stringify(completion)}\n\n`),
46
  genericFixes: text => text.replace(/(\r\n|\r|\\n)/gm, '\n'),
47
+ checkResErr: async (res, throwIt = true) => {
48
  let err, json, errAPI;
49
  if ('string' == typeof res) {
50
  json = JSON.parse(res);
51
  errAPI = json.error;
52
  err = Error(errAPI.message);
53
  } else if (res.status < 200 || res.status >= 300) {
54
+ err = Error('Unexpected response code: ' + (res.status || json?.status));
55
+ const text = await res.text();
56
+ try { //
57
+ json = JSON.parse(text);
58
+ errAPI = json.error;
59
+ } catch { //
60
+ console.log(text); //
61
+ throw err; //
62
+ } //
63
  }
64
  if (errAPI) {
65
  err.status = res.status || json.status;
66
  err.planned = true;
67
  errAPI.message && (err.message = errAPI.message);
68
  errAPI.type && (err.type = errAPI.type);
69
+ if (429 === res.status || 429 === json.status) { //if ((429 === res.status || 429 === json.status) && errAPI.resets_at) {
70
+ try { //
71
+ const hours = ((new Date(1e3 * JSON.parse(errAPI.message).resetsAt).getTime() - Date.now()) / 1e3 / 60 / 60).toFixed(1); //const hours = ((new Date(1e3 * errAPI.resets_at).getTime() - Date.now()) / 1e3 / 60 / 60).toFixed(1);
72
+ err.message += `, expires in ${hours} hours`;
73
+ err.exceeded_limit = true; //
74
+ } catch {} //
 
 
 
75
  }
76
  if (throwIt) {
77
  throw err;
media/program.png CHANGED

Git LFS Details

  • SHA256: 94413239abb258f5fb48b81dd333cab4105b354ff02f7b88a936de7c3680664c
  • Pointer size: 131 Bytes
  • Size of remote file: 183 kB
package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "clewd",
3
- "version": "4.7",
4
  "description": "<div align=\"center\"> <a href=\"https://github.com/teralomaniac/clewd\"> <h1>Clewd</h1> <img height=\"120\" width=\"120\" alt=\"Clewd\" title=\"Clewd\" src=\"https://gitgud.io/ahsk/clewd/-/raw/master/media/logo.png\" align=\"left\" />",
5
  "main": "clewd.js",
6
  "engines": {
 
1
  {
2
  "name": "clewd",
3
+ "version": "4.8",
4
  "description": "<div align=\"center\"> <a href=\"https://github.com/teralomaniac/clewd\"> <h1>Clewd</h1> <img height=\"120\" width=\"120\" alt=\"Clewd\" title=\"Clewd\" src=\"https://gitgud.io/ahsk/clewd/-/raw/master/media/logo.png\" align=\"left\" />",
5
  "main": "clewd.js",
6
  "engines": {