@celljs/ta-creator 4.35.0 → 4.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/host/index.mjs +453 -10
- package/package.json +4 -3
- package/skills/creator-make/SKILL.md +10 -3
- package/skills/creator-publish/SKILL.md +6 -2
- package/skills/creator-publish/platforms.md +10 -0
- package/web/index.js +147 -63
package/host/index.mjs
CHANGED
|
@@ -325,6 +325,41 @@ var PublishUtil;
|
|
|
325
325
|
PublishUtil.publishing = publishing;
|
|
326
326
|
})(PublishUtil ||= {});
|
|
327
327
|
|
|
328
|
+
// web-src/quality.ts
|
|
329
|
+
var RUBRIC = [
|
|
330
|
+
{ id: "hook", weight: 20, asks: "the first 3 seconds give the point, a question or a picture that moves; no slow greeting" },
|
|
331
|
+
{ id: "clarity", weight: 20, asks: "one idea, its terms explained, every fact checked; a newcomer follows it" },
|
|
332
|
+
{ id: "visuals", weight: 15, asks: "scenes vary (a device or a flow every other one), none of the host talking 20 seconds on" },
|
|
333
|
+
{ id: "pace", weight: 15, asks: "its length fits the platform, short sentences, no dead air, it ends when the point is made" },
|
|
334
|
+
{ id: "title", weight: 10, asks: "title and cover say truly and plainly what one gets: a number, a question, never exaggerated" },
|
|
335
|
+
{ id: "series", weight: 10, asks: "of a series: its number, a line to the last piece, and the next piece told at the end" },
|
|
336
|
+
{ id: "fit", weight: 10, asks: "each version in its platform's form, voice, length and tags; its declaration ticked" }
|
|
337
|
+
];
|
|
338
|
+
var PASS = 80;
|
|
339
|
+
var Quality;
|
|
340
|
+
((Quality) => {
|
|
341
|
+
function score(value, now) {
|
|
342
|
+
const given = Array.isArray(value) ? value.map(object).filter((one) => !!one) : [];
|
|
343
|
+
const parts = RUBRIC.map(({ id }) => {
|
|
344
|
+
const one = given.find((it) => it.id === id);
|
|
345
|
+
const note = text(one?.note, 200);
|
|
346
|
+
return { id, score: Math.min(100, count(one?.score, 0)), ...note ? { note } : {} };
|
|
347
|
+
});
|
|
348
|
+
const total = Math.round(parts.reduce((all, one, at) => all + one.score * RUBRIC[at].weight / 100, 0));
|
|
349
|
+
return { total, parts, at: now };
|
|
350
|
+
}
|
|
351
|
+
Quality.score = score;
|
|
352
|
+
function weak(score2) {
|
|
353
|
+
return score2.parts.filter((one) => one.score < PASS).sort((a, b) => a.score - b.score);
|
|
354
|
+
}
|
|
355
|
+
Quality.weak = weak;
|
|
356
|
+
function fields(kept) {
|
|
357
|
+
const one = object(kept.score);
|
|
358
|
+
return one && time(one.at) ? { score: { ...score(one.parts, time(one.at)) } } : {};
|
|
359
|
+
}
|
|
360
|
+
Quality.fields = fields;
|
|
361
|
+
})(Quality ||= {});
|
|
362
|
+
|
|
328
363
|
// web-src/creator-util.ts
|
|
329
364
|
var DAY2 = 86400000;
|
|
330
365
|
var MAX_TOPICS = 200;
|
|
@@ -518,6 +553,7 @@ var CreatorUtil;
|
|
|
518
553
|
...time(kept.commentsAt) ? { commentsAt: time(kept.commentsAt) } : {},
|
|
519
554
|
...time(kept.commentsGap) ? { commentsGap: time(kept.commentsGap) } : {},
|
|
520
555
|
...Efficiency.fields(kept),
|
|
556
|
+
...Quality.fields(kept),
|
|
521
557
|
at,
|
|
522
558
|
changedAt: time(kept.changedAt) ?? at
|
|
523
559
|
};
|
|
@@ -690,10 +726,7 @@ var CreatorUtil;
|
|
|
690
726
|
function need(value) {
|
|
691
727
|
const kept = object(value);
|
|
692
728
|
const words = text(kept?.text, 300);
|
|
693
|
-
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
return { id: text(kept.id, 60), text: words, ...kept.done === true ? { done: true } : {} };
|
|
729
|
+
return kept && words ? { id: text(kept.id, 60), text: words, ...kept.done === true ? { done: true } : {} } : undefined;
|
|
697
730
|
}
|
|
698
731
|
CreatorUtil.need = need;
|
|
699
732
|
function version(value) {
|
|
@@ -1114,6 +1147,401 @@ var CreatorTasks;
|
|
|
1114
1147
|
CreatorTasks.of = of;
|
|
1115
1148
|
})(CreatorTasks ||= {});
|
|
1116
1149
|
|
|
1150
|
+
// ../../packages/core/esm/common/utils/error-util.js
|
|
1151
|
+
class ErrorUtil {
|
|
1152
|
+
static fixProto(target, prototype) {
|
|
1153
|
+
const setPrototypeOf = Object.setPrototypeOf;
|
|
1154
|
+
if (setPrototypeOf) {
|
|
1155
|
+
setPrototypeOf(target, prototype);
|
|
1156
|
+
} else {
|
|
1157
|
+
target.__proto__ = prototype;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
static fixStack(target, fn = target.constructor) {
|
|
1161
|
+
const captureStackTrace = Error.captureStackTrace;
|
|
1162
|
+
if (captureStackTrace) {
|
|
1163
|
+
captureStackTrace(target, fn);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
static describe(error) {
|
|
1167
|
+
let text3 = ErrorUtil.describeOne(error);
|
|
1168
|
+
let cause = ErrorUtil.causeOf(error);
|
|
1169
|
+
for (let depth = 0;cause !== undefined && depth < 5; depth++) {
|
|
1170
|
+
text3 += `
|
|
1171
|
+
Caused by: ${ErrorUtil.describeOne(cause)}`;
|
|
1172
|
+
cause = ErrorUtil.causeOf(cause);
|
|
1173
|
+
}
|
|
1174
|
+
return text3;
|
|
1175
|
+
}
|
|
1176
|
+
static causeOf(error) {
|
|
1177
|
+
return error instanceof Error ? error.cause : undefined;
|
|
1178
|
+
}
|
|
1179
|
+
static describeOne(error) {
|
|
1180
|
+
var _a;
|
|
1181
|
+
if (error instanceof Error) {
|
|
1182
|
+
return (_a = error.stack) !== null && _a !== undefined ? _a : `${error.name}: ${error.message}`;
|
|
1183
|
+
}
|
|
1184
|
+
return String(error);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// ../../packages/core/esm/common/utils/event.js
|
|
1189
|
+
var Event;
|
|
1190
|
+
(function(Event2) {
|
|
1191
|
+
const _disposable = { dispose() {} };
|
|
1192
|
+
Event2.None = Object.assign(function() {
|
|
1193
|
+
return _disposable;
|
|
1194
|
+
}, {
|
|
1195
|
+
get maxListeners() {
|
|
1196
|
+
return 0;
|
|
1197
|
+
},
|
|
1198
|
+
set maxListeners(maxListeners) {}
|
|
1199
|
+
});
|
|
1200
|
+
function map(event, mapFunc) {
|
|
1201
|
+
return Object.assign((listener, thisArgs, disposables) => event((i) => listener.call(thisArgs, mapFunc(i)), undefined, disposables), {
|
|
1202
|
+
maxListeners: 0
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
Event2.map = map;
|
|
1206
|
+
})(Event || (Event = {}));
|
|
1207
|
+
|
|
1208
|
+
class CallbackList {
|
|
1209
|
+
get length() {
|
|
1210
|
+
return this._callbacks && this._callbacks.length || 0;
|
|
1211
|
+
}
|
|
1212
|
+
add(callback, context = undefined, bucket) {
|
|
1213
|
+
if (!this._callbacks) {
|
|
1214
|
+
this._callbacks = [];
|
|
1215
|
+
this._contexts = [];
|
|
1216
|
+
}
|
|
1217
|
+
this._callbacks.push(callback);
|
|
1218
|
+
this._contexts.push(context);
|
|
1219
|
+
if (Array.isArray(bucket)) {
|
|
1220
|
+
bucket.push({ dispose: () => this.remove(callback, context) });
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
remove(callback, context = undefined) {
|
|
1224
|
+
if (!this._callbacks) {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
let foundCallbackWithDifferentContext = false;
|
|
1228
|
+
for (let i = 0;i < this._callbacks.length; i++) {
|
|
1229
|
+
if (this._callbacks[i] === callback) {
|
|
1230
|
+
if (this._contexts[i] === context) {
|
|
1231
|
+
this._callbacks.splice(i, 1);
|
|
1232
|
+
this._contexts.splice(i, 1);
|
|
1233
|
+
return;
|
|
1234
|
+
} else {
|
|
1235
|
+
foundCallbackWithDifferentContext = true;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (foundCallbackWithDifferentContext) {
|
|
1240
|
+
throw new Error("When adding a listener with a context, you should remove it with the same context");
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
*[Symbol.iterator]() {
|
|
1244
|
+
if (!this._callbacks) {
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
const callbacks = this._callbacks.slice(0);
|
|
1248
|
+
const contexts = this._contexts.slice(0);
|
|
1249
|
+
for (let i = 0;i < callbacks.length; i++) {
|
|
1250
|
+
const callback = callbacks[i];
|
|
1251
|
+
const context = contexts[i];
|
|
1252
|
+
yield (...args) => callback.apply(context, args);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
invoke(...args) {
|
|
1256
|
+
if (!this._callbacks) {
|
|
1257
|
+
return [];
|
|
1258
|
+
}
|
|
1259
|
+
const callbacks = this._callbacks.slice(0);
|
|
1260
|
+
const contexts = this._contexts.slice(0);
|
|
1261
|
+
const ret = [];
|
|
1262
|
+
for (let i = 0;i < callbacks.length; i++) {
|
|
1263
|
+
try {
|
|
1264
|
+
ret.push(callbacks[i].apply(contexts[i], args));
|
|
1265
|
+
} catch (e) {
|
|
1266
|
+
console.error(e);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
return ret;
|
|
1270
|
+
}
|
|
1271
|
+
isEmpty() {
|
|
1272
|
+
return !this._callbacks || this._callbacks.length === 0;
|
|
1273
|
+
}
|
|
1274
|
+
dispose() {
|
|
1275
|
+
this._callbacks = undefined;
|
|
1276
|
+
this._contexts = undefined;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// ../../packages/core/esm/common/utils/emitter.js
|
|
1281
|
+
class Emitter {
|
|
1282
|
+
constructor(_options) {
|
|
1283
|
+
this._options = _options;
|
|
1284
|
+
this._disposed = false;
|
|
1285
|
+
this._leakWarnCountdown = 0;
|
|
1286
|
+
}
|
|
1287
|
+
get event() {
|
|
1288
|
+
if (!this._event) {
|
|
1289
|
+
this._event = Object.assign((listener, thisArgs, disposables) => {
|
|
1290
|
+
if (!this._callbacks) {
|
|
1291
|
+
this._callbacks = new CallbackList;
|
|
1292
|
+
}
|
|
1293
|
+
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
|
1294
|
+
this._options.onFirstListenerAdd(this);
|
|
1295
|
+
}
|
|
1296
|
+
this._callbacks.add(listener, thisArgs);
|
|
1297
|
+
const removeMaxListenersCheck = this.checkMaxListeners(this._event.maxListeners);
|
|
1298
|
+
const result = {
|
|
1299
|
+
dispose: () => {
|
|
1300
|
+
if (removeMaxListenersCheck) {
|
|
1301
|
+
removeMaxListenersCheck();
|
|
1302
|
+
}
|
|
1303
|
+
result.dispose = Emitter._noop;
|
|
1304
|
+
if (!this._disposed) {
|
|
1305
|
+
this._callbacks.remove(listener, thisArgs);
|
|
1306
|
+
result.dispose = Emitter._noop;
|
|
1307
|
+
if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
|
|
1308
|
+
this._options.onLastListenerRemove(this);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
if (Array.isArray(disposables)) {
|
|
1314
|
+
disposables.push(result);
|
|
1315
|
+
}
|
|
1316
|
+
return result;
|
|
1317
|
+
}, {
|
|
1318
|
+
maxListeners: Emitter.LEAK_WARNING_THRESHHOLD
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
return this._event;
|
|
1322
|
+
}
|
|
1323
|
+
checkMaxListeners(maxListeners) {
|
|
1324
|
+
if (maxListeners === 0 || !this._callbacks) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
const listenerCount = this._callbacks.length;
|
|
1328
|
+
if (listenerCount <= maxListeners) {
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
const popStack = this.pushLeakingStack();
|
|
1332
|
+
this._leakWarnCountdown -= 1;
|
|
1333
|
+
if (this._leakWarnCountdown <= 0) {
|
|
1334
|
+
this._leakWarnCountdown = maxListeners * 0.5;
|
|
1335
|
+
let topStack;
|
|
1336
|
+
let topCount = 0;
|
|
1337
|
+
this._leakingStacks.forEach((stackCount, stack) => {
|
|
1338
|
+
if (!topStack || topCount < stackCount) {
|
|
1339
|
+
topStack = stack;
|
|
1340
|
+
topCount = stackCount;
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
console.warn(`Possible Emitter memory leak detected. ${listenerCount} listeners added. Use event.maxListeners to increase the limit (${maxListeners}). MOST frequent listener (${topCount}):`);
|
|
1344
|
+
console.warn(topStack);
|
|
1345
|
+
}
|
|
1346
|
+
return popStack;
|
|
1347
|
+
}
|
|
1348
|
+
pushLeakingStack() {
|
|
1349
|
+
if (!this._leakingStacks) {
|
|
1350
|
+
this._leakingStacks = new Map;
|
|
1351
|
+
}
|
|
1352
|
+
const stack = new Error().stack.split(`
|
|
1353
|
+
`).slice(3).join(`
|
|
1354
|
+
`);
|
|
1355
|
+
const count2 = this._leakingStacks.get(stack) || 0;
|
|
1356
|
+
this._leakingStacks.set(stack, count2 + 1);
|
|
1357
|
+
return () => this.popLeakingStack(stack);
|
|
1358
|
+
}
|
|
1359
|
+
popLeakingStack(stack) {
|
|
1360
|
+
if (!this._leakingStacks) {
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
const count2 = this._leakingStacks.get(stack) || 0;
|
|
1364
|
+
this._leakingStacks.set(stack, count2 - 1);
|
|
1365
|
+
}
|
|
1366
|
+
get hasListeners() {
|
|
1367
|
+
return !!this._callbacks && !this._callbacks.isEmpty();
|
|
1368
|
+
}
|
|
1369
|
+
fire(event) {
|
|
1370
|
+
if (this._callbacks) {
|
|
1371
|
+
this._callbacks.invoke(event);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
async sequence(processor) {
|
|
1375
|
+
if (this._callbacks) {
|
|
1376
|
+
for (const listener of this._callbacks) {
|
|
1377
|
+
if (!await processor(listener)) {
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
dispose() {
|
|
1384
|
+
if (this._leakingStacks) {
|
|
1385
|
+
this._leakingStacks.clear();
|
|
1386
|
+
this._leakingStacks = undefined;
|
|
1387
|
+
}
|
|
1388
|
+
if (this._callbacks) {
|
|
1389
|
+
this._callbacks.dispose();
|
|
1390
|
+
this._callbacks = undefined;
|
|
1391
|
+
}
|
|
1392
|
+
this._disposed = true;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
Emitter.LEAK_WARNING_THRESHHOLD = 175;
|
|
1396
|
+
Emitter._noop = function() {};
|
|
1397
|
+
var WaitUntilEvent;
|
|
1398
|
+
(function(WaitUntilEvent2) {
|
|
1399
|
+
async function fire(emitter, event, timeout = undefined) {
|
|
1400
|
+
const waitables = [];
|
|
1401
|
+
const asyncEvent = Object.assign(event, {
|
|
1402
|
+
waitUntil: (thenable) => {
|
|
1403
|
+
if (Object.isFrozen(waitables)) {
|
|
1404
|
+
throw new Error("waitUntil cannot be called asynchronously.");
|
|
1405
|
+
}
|
|
1406
|
+
waitables.push(thenable);
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1409
|
+
try {
|
|
1410
|
+
emitter.fire(asyncEvent);
|
|
1411
|
+
Object.freeze(waitables);
|
|
1412
|
+
} finally {
|
|
1413
|
+
delete asyncEvent.waitUntil;
|
|
1414
|
+
}
|
|
1415
|
+
if (!waitables.length) {
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
if (timeout !== undefined) {
|
|
1419
|
+
await Promise.race([Promise.all(waitables), new Promise((resolve) => setTimeout(resolve, timeout))]);
|
|
1420
|
+
} else {
|
|
1421
|
+
await Promise.all(waitables);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
WaitUntilEvent2.fire = fire;
|
|
1425
|
+
})(WaitUntilEvent || (WaitUntilEvent = {}));
|
|
1426
|
+
|
|
1427
|
+
// ../../packages/core/esm/common/logger/logger-protocol.js
|
|
1428
|
+
var LOGGER_CONFIG = "logger";
|
|
1429
|
+
var LOGGER_LEVEL = `${LOGGER_CONFIG}.level`;
|
|
1430
|
+
var Logger = Symbol("Logger");
|
|
1431
|
+
var TraceIdProvider = Symbol("TraceIdProvider");
|
|
1432
|
+
var LoggerService = Symbol("LoggerService");
|
|
1433
|
+
var LOG_LEVELS = ["verbose", "debug", "info", "warn", "error"];
|
|
1434
|
+
var onLogEmitter = new Emitter;
|
|
1435
|
+
|
|
1436
|
+
// ../../packages/core/esm/common/logger/console-logger.js
|
|
1437
|
+
var RANK = Object.fromEntries(LOG_LEVELS.map((level, index) => [level, index]));
|
|
1438
|
+
var write = {
|
|
1439
|
+
error: (text3) => console.error(text3),
|
|
1440
|
+
warn: (text3) => console.warn(text3),
|
|
1441
|
+
info: (text3) => console.info(text3),
|
|
1442
|
+
debug: (text3) => console.debug(text3)
|
|
1443
|
+
};
|
|
1444
|
+
var LEVEL = Symbol.for("@celljs/core/logger/level");
|
|
1445
|
+
var Loggers;
|
|
1446
|
+
(function(Loggers2) {
|
|
1447
|
+
function get(context) {
|
|
1448
|
+
return new ConsoleLogger(context);
|
|
1449
|
+
}
|
|
1450
|
+
Loggers2.get = get;
|
|
1451
|
+
function level() {
|
|
1452
|
+
var _a;
|
|
1453
|
+
const set = globalThis[LEVEL];
|
|
1454
|
+
if (set) {
|
|
1455
|
+
return set;
|
|
1456
|
+
}
|
|
1457
|
+
const env = typeof process === "undefined" ? undefined : (_a = process.env) === null || _a === undefined ? undefined : _a.CELL_LOGGER__LEVEL;
|
|
1458
|
+
return env && env in RANK ? env : "info";
|
|
1459
|
+
}
|
|
1460
|
+
Loggers2.level = level;
|
|
1461
|
+
function setLevel(level2) {
|
|
1462
|
+
globalThis[LEVEL] = level2 && level2 in RANK ? level2 : undefined;
|
|
1463
|
+
}
|
|
1464
|
+
Loggers2.setLevel = setLevel;
|
|
1465
|
+
})(Loggers || (Loggers = {}));
|
|
1466
|
+
|
|
1467
|
+
class ConsoleLogger {
|
|
1468
|
+
constructor(context) {
|
|
1469
|
+
this.context = context;
|
|
1470
|
+
}
|
|
1471
|
+
setContext(context) {
|
|
1472
|
+
this.context = context;
|
|
1473
|
+
}
|
|
1474
|
+
isEnabled(level) {
|
|
1475
|
+
var _a, _b;
|
|
1476
|
+
return RANK[level] >= ((_b = RANK[(_a = this.level) !== null && _a !== undefined ? _a : Loggers.level()]) !== null && _b !== undefined ? _b : RANK.info);
|
|
1477
|
+
}
|
|
1478
|
+
error(message, context) {
|
|
1479
|
+
this.log(message, context, write.error, "error");
|
|
1480
|
+
}
|
|
1481
|
+
warn(message, context) {
|
|
1482
|
+
if (this.isEnabled("warn")) {
|
|
1483
|
+
this.log(message, context, write.warn, "warn");
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
info(message, context) {
|
|
1487
|
+
if (this.isEnabled("info")) {
|
|
1488
|
+
this.log(message, context, write.info, "info");
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
debug(message, context) {
|
|
1492
|
+
if (this.isEnabled("debug")) {
|
|
1493
|
+
this.log(message, context, write.debug, "debug");
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
time(label) {
|
|
1497
|
+
var _a;
|
|
1498
|
+
((_a = this.timeRecords) !== null && _a !== undefined ? _a : this.timeRecords = new Map).set(label, Date.now());
|
|
1499
|
+
}
|
|
1500
|
+
timeEnd(label, context) {
|
|
1501
|
+
var _a;
|
|
1502
|
+
const start = (_a = this.timeRecords) === null || _a === undefined ? undefined : _a.get(label);
|
|
1503
|
+
if (start !== undefined) {
|
|
1504
|
+
const duration = Date.now() - start;
|
|
1505
|
+
this.timeRecords.delete(label);
|
|
1506
|
+
this.log(`${label} [${duration}ms]`, context);
|
|
1507
|
+
return duration;
|
|
1508
|
+
} else {
|
|
1509
|
+
this.log(`No such label: ${label} for timeEnd`, context);
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
resolveContextString(context) {
|
|
1514
|
+
if (this.context) {
|
|
1515
|
+
return context ? `[${this.context}] [${context}] ` : `[${this.context}] `;
|
|
1516
|
+
}
|
|
1517
|
+
return context ? `[${context}] ` : "";
|
|
1518
|
+
}
|
|
1519
|
+
resolvePrefix(level) {
|
|
1520
|
+
const time3 = new Date().toISOString();
|
|
1521
|
+
return `${time3} [${level}]`;
|
|
1522
|
+
}
|
|
1523
|
+
log(message, context, logFn = write.info, level = "info") {
|
|
1524
|
+
var _a;
|
|
1525
|
+
const traceId = (_a = this.traceIdProvider) === null || _a === undefined ? undefined : _a.provide();
|
|
1526
|
+
const contextStr = this.resolveContextString(context);
|
|
1527
|
+
const text3 = message instanceof Error ? ErrorUtil.describe(message) : message;
|
|
1528
|
+
let head = this.resolvePrefix(level);
|
|
1529
|
+
if (traceId) {
|
|
1530
|
+
head = head ? `${head} [trace: ${traceId}]` : `[trace: ${traceId}]`;
|
|
1531
|
+
}
|
|
1532
|
+
logFn(`${head ? `${head} ` : ""}${contextStr}${text3}`);
|
|
1533
|
+
if (onLogEmitter.hasListeners) {
|
|
1534
|
+
onLogEmitter.fire({
|
|
1535
|
+
level,
|
|
1536
|
+
traceId,
|
|
1537
|
+
rootContext: this.context,
|
|
1538
|
+
context,
|
|
1539
|
+
message
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1117
1545
|
// ../ta-protocol/esm/common/message-protocol.js
|
|
1118
1546
|
var TaMessageContext;
|
|
1119
1547
|
(function(TaMessageContext2) {
|
|
@@ -1344,7 +1772,7 @@ var TaTaskNote;
|
|
|
1344
1772
|
(function(TaTaskNote2) {
|
|
1345
1773
|
const NOTE = /^<task_(update|adopted|renamed) ((?:[^>"\n]|"[^"]*")*)>\n?([\s\S]*?)\n?<\/task_\1>$/;
|
|
1346
1774
|
const ATTRIBUTE = /(\w+)="([^"]*)"/g;
|
|
1347
|
-
function
|
|
1775
|
+
function write2(note) {
|
|
1348
1776
|
const attributes = [`id="${quote(note.id)}"`];
|
|
1349
1777
|
if (note.was !== undefined) {
|
|
1350
1778
|
attributes.push(`was="${quote(note.was)}"`);
|
|
@@ -1357,7 +1785,7 @@ var TaTaskNote;
|
|
|
1357
1785
|
${note.body}
|
|
1358
1786
|
</task_${note.kind}>`;
|
|
1359
1787
|
}
|
|
1360
|
-
TaTaskNote2.write =
|
|
1788
|
+
TaTaskNote2.write = write2;
|
|
1361
1789
|
function parse(text3) {
|
|
1362
1790
|
const match = NOTE.exec(text3.trim());
|
|
1363
1791
|
if (!match) {
|
|
@@ -1427,6 +1855,7 @@ var TaSecretRef;
|
|
|
1427
1855
|
})(TaSecretRef || (TaSecretRef = {}));
|
|
1428
1856
|
|
|
1429
1857
|
// web-src/publish-queue.ts
|
|
1858
|
+
var logger = Loggers.get("ta-creator");
|
|
1430
1859
|
var IDLE_MS = 10 * 60000;
|
|
1431
1860
|
var PublishPrompt;
|
|
1432
1861
|
((PublishPrompt) => {
|
|
@@ -1555,7 +1984,7 @@ class PublishQueue {
|
|
|
1555
1984
|
this.idle = { id, timer };
|
|
1556
1985
|
}
|
|
1557
1986
|
static failed(error) {
|
|
1558
|
-
|
|
1987
|
+
logger.error(`the queue of publishing failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
1559
1988
|
}
|
|
1560
1989
|
rest(id) {
|
|
1561
1990
|
if (this.idle && (!id || this.idle.id === id)) {
|
|
@@ -1607,7 +2036,7 @@ class CreatorHostBase {
|
|
|
1607
2036
|
return stage ? items.filter((one) => one.stage === stage && !one.dropped) : items;
|
|
1608
2037
|
}
|
|
1609
2038
|
update(id, patch) {
|
|
1610
|
-
const kept = ["stage", "approved", "publishing", "links", "dropped", "stats", "needs", "commentsAt", "commentsGap", "started", "cost"];
|
|
2039
|
+
const kept = ["stage", "approved", "publishing", "links", "dropped", "stats", "needs", "commentsAt", "commentsGap", "started", "cost", "score"];
|
|
1611
2040
|
return this.change(id, Object.fromEntries(Object.entries(patch ?? {}).filter(([key]) => !kept.includes(key))));
|
|
1612
2041
|
}
|
|
1613
2042
|
start(id) {
|
|
@@ -1633,6 +2062,11 @@ class CreatorHostBase {
|
|
|
1633
2062
|
return items.find((one) => one.id === id);
|
|
1634
2063
|
});
|
|
1635
2064
|
}
|
|
2065
|
+
async score(id, parts) {
|
|
2066
|
+
const score = Quality.score(parts, this.now());
|
|
2067
|
+
await this.change(id, { score });
|
|
2068
|
+
return { total: score.total, pass: score.total >= PASS, weak: Quality.weak(score) };
|
|
2069
|
+
}
|
|
1636
2070
|
async submit(id) {
|
|
1637
2071
|
const [settings, items] = await Promise.all([this.settings(), this.items()]);
|
|
1638
2072
|
const item = items.find((one) => one.id === id);
|
|
@@ -1649,6 +2083,13 @@ class CreatorHostBase {
|
|
|
1649
2083
|
if (!item.checks?.length) {
|
|
1650
2084
|
throw new Error("Check it first (the AI label, private information, the length of each version), and keep the checks.");
|
|
1651
2085
|
}
|
|
2086
|
+
if (!item.score) {
|
|
2087
|
+
throw new Error(`Score it first: score <id> '[{ id, score, note }]' for each of ${RUBRIC.map((one) => one.id).join(", ")}.`);
|
|
2088
|
+
}
|
|
2089
|
+
if (item.score.total < PASS) {
|
|
2090
|
+
const weak = Quality.weak(item.score).map((one) => `${one.id} ${one.score}${one.note ? ` (${one.note})` : ""}`);
|
|
2091
|
+
throw new Error(`It scored ${item.score.total}, under ${PASS}: make again ${weak.join("; ")}, then score it again.`);
|
|
2092
|
+
}
|
|
1652
2093
|
return this.change(id, { stage: "review", done: [...STEPS] });
|
|
1653
2094
|
}
|
|
1654
2095
|
async approve(id, minutes = 0, ask) {
|
|
@@ -1675,7 +2116,7 @@ class CreatorHostBase {
|
|
|
1675
2116
|
return this.items().then((items) => {
|
|
1676
2117
|
const item = items.find((one) => one.id === id);
|
|
1677
2118
|
const checks = [...item?.checks ?? [], { text: String(note).slice(0, 200), ok: false }];
|
|
1678
|
-
return this.change(id, { stage: "making", approved: undefined, publishing: undefined, checks }, minutes).then(async (changed) => {
|
|
2119
|
+
return this.change(id, { stage: "making", approved: undefined, publishing: undefined, checks, score: undefined }, minutes).then(async (changed) => {
|
|
1679
2120
|
await this.serial(async () => this.host.setExtensionData(NAME, Keys.LESSONS, ChannelUtil.lessons([{ text: String(note).slice(0, 300), item: id, at: this.now() }, ...await this.lessons()])));
|
|
1680
2121
|
return changed;
|
|
1681
2122
|
});
|
|
@@ -1948,7 +2389,9 @@ class CreatorHost extends CreatorHostBase {
|
|
|
1948
2389
|
strategy,
|
|
1949
2390
|
lessons: (await this.lessons()).slice(0, 15).map((one) => one.text),
|
|
1950
2391
|
tone: CreatorUtil.toneOf(item, settings),
|
|
1951
|
-
voice: settings.voice
|
|
2392
|
+
voice: settings.voice,
|
|
2393
|
+
rubric: RUBRIC.map(({ id: id2, weight, asks }) => ({ id: id2, weight, asks })),
|
|
2394
|
+
pass: PASS
|
|
1952
2395
|
};
|
|
1953
2396
|
}
|
|
1954
2397
|
case "comments": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-creator",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.36.0",
|
|
4
4
|
"description": "A pi package for Ta: a channel of content without showing your face, hot topics of your field found three times a day, videos and posts made for each platform, reviewed on your phone and published for you once passed",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@celljs/
|
|
33
|
-
"@celljs/ta-
|
|
32
|
+
"@celljs/core": "4.36.0",
|
|
33
|
+
"@celljs/ta-protocol": "4.36.0",
|
|
34
|
+
"@celljs/ta-web": "4.36.0",
|
|
34
35
|
"@types/react": "^19.3.0"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|
|
@@ -18,7 +18,8 @@ its server: `ta call @celljs/ta-creator <method> [args as JSON]`.
|
|
|
18
18
|
| `update <id> '<JSON>'` | Keeps what you made: `script`, `done` (steps of script, visuals, voice, captions, versions, checks), `versions`, `checks`, `reach` (`public`, `internal`, `both`); `series` and `number` when the user moves it |
|
|
19
19
|
| `needs <id> '<JSON array of lines>'` / `give <id> <need id>` / `skip <id>` | What a piece of the user's own needs that you found nowhere: it waits in Materials / one given (all given, it goes on) / made without |
|
|
20
20
|
| `remove <id>` / `restore <id>` | Removes a topic or a piece not published (kept, to be put back) / puts it back |
|
|
21
|
-
| `
|
|
21
|
+
| `score <id> '<JSON array of { id, score (0–100), note }>'` | Your score of the piece on each criterion of `rubric` (`brief make`); its total, and what falls short |
|
|
22
|
+
| `submit <id>` | Sends it to review, once it has a version for each platform picked, its checks and a score of `pass` or more |
|
|
22
23
|
| `published <id> '<JSON array of { platform, url, scheduled? }>'` | The links once it is published (`scheduled`: `YYYY-MM-DD HH:mm` when the platform publishes it later); the next piece passed goes |
|
|
23
24
|
| `stopped <id> '<why>'` | Publishing it could not be done; the next piece passed goes |
|
|
24
25
|
| `slots <id>` | When it goes out on each platform (now, or a day to schedule it for) |
|
|
@@ -117,7 +118,13 @@ people in the news, films and shows of others, or anything of the user's employe
|
|
|
117
118
|
sends people to another platform or promotes its products (no "去B站看完整版", no QR code, watermark, logo or
|
|
118
119
|
screenshot of another app, and on 小红书 no product of another platform named or shown: there a piece about one is
|
|
119
120
|
made about the idea instead, or left out of 小红书, as a note of 豆包 was limited there). A check that fails is said plainly for the user to look at.
|
|
120
|
-
5. **
|
|
121
|
+
5. **Score.** Watch it as a stranger would: the first 3 seconds, a few frames through it, the end, each version's title
|
|
122
|
+
and words. Score it on each criterion of `rubric` (`brief make`), 0–100, with a line of why for any under 90; be
|
|
123
|
+
strict, as the numbers will be. Keep it with `score <id> '<JSON>'`. Under `pass` (80), make again what is weakest
|
|
124
|
+
(a new hook, a scene redrawn, a cut, a title made plain), render only what changed, and score it again; at most
|
|
125
|
+
twice, then submit it with its score and say in a line what still falls short. Never raise a score without changing
|
|
126
|
+
the piece.
|
|
127
|
+
6. **Review.** `submit <id>`, then reply with the card the user reviews it in, and nothing long around it:
|
|
121
128
|
|
|
122
129
|
```ta-creator-review
|
|
123
130
|
{ "id": "<id>" }
|
|
@@ -128,4 +135,4 @@ card again (what they asked is kept in `lessons` for the pieces to come). When t
|
|
|
128
135
|
|
|
129
136
|
Never publish before the user passed it, never like or follow as the user, never post the same piece twice on a
|
|
130
137
|
platform, never more than one piece a day on a platform. Comments are answered by the comments task of Creator only,
|
|
131
|
-
as far as the user lets it.
|
|
138
|
+
as far as the user lets it.
|
|
@@ -31,9 +31,13 @@ user's browser, where they are signed in); how each platform's page was filled b
|
|
|
31
31
|
tags as they are in the version, nothing added.
|
|
32
32
|
3. Tick the declaration of content made with AI, as `declare` says (B站: 创作声明 → 该视频使用人工智能合成技术). When
|
|
33
33
|
the page has no such choice, write "内容由 AI 辅助生成" at the end of the words.
|
|
34
|
-
4.
|
|
34
|
+
4. Declare it original: every piece of the channel is the user's own work (they said so, 2026-11-27), so choose the
|
|
35
|
+
platform's own choice for it (B站 类型 → 自制, 小红书 原创声明, 视频号 声明原创, 公众号 原创, 知乎 创作声明 → 原创), with
|
|
36
|
+
the source still linked in the words of a piece that explains another's work. Only a piece translated whole (its
|
|
37
|
+
licence allowing it) is not: declare it 转载 with its source.
|
|
38
|
+
5. Leave every other choice as the platform sets it (no paid promotion, no sync to other apps) unless the user said
|
|
35
39
|
otherwise.
|
|
36
|
-
|
|
40
|
+
6. Press Publish (发布, 发表, 投稿) now, or, for a platform given a day and time, set the platform's scheduled
|
|
37
41
|
publishing to it first. Then read the link of the piece from the page of the account's works.
|
|
38
42
|
|
|
39
43
|
When the page shows a warning of the platform (a check of risk, too many posts, a captcha), or the user is not signed
|
|
@@ -60,6 +60,7 @@ input's value with `Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,
|
|
|
60
60
|
- Tags: remove the ones it suggests (`.tag-pre-wrp .close`), then each tag into `input[placeholder*=按回车键]` with
|
|
61
61
|
Enter (`keydown`/`keypress`/`keyup`, keyCode 13).
|
|
62
62
|
- AI: the select `.bcc-select-input-inner[placeholder*=创作声明]` → the option `.bcc-option` 含AI生成内容.
|
|
63
|
+
- Original: 类型 → 自制 (not 转载); read it back.
|
|
63
64
|
- Cover: click 更换封面 (or 添加封面/上传封面), then the last `input[type=file][accept*=image]`; the 4:3 crop box only
|
|
64
65
|
moves with a real drag (computer use), then 完成.
|
|
65
66
|
- Scheduled: `.time-container` → turn on 定时发布 (a real click), pick the day in the calendar, then hour and minute in
|
|
@@ -72,6 +73,7 @@ input's value with `Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,
|
|
|
72
73
|
`.tiptap.ProseMirror` are there.
|
|
73
74
|
- Title: that input; words and tags: paste `text + "\n\n" + #tag #tag` into `.tiptap.ProseMirror`.
|
|
74
75
|
- AI: 添加内容类型声明 → 笔记含AI合成内容.
|
|
76
|
+
- Original: turn on 原创声明 (in the settings under the words) and agree to its terms; read it back.
|
|
75
77
|
- Cover: 设置封面 → upload into the `input[type=file]` whose accept has image → 确定.
|
|
76
78
|
- Scheduled: 定时发布 (a real click to turn it on). The date input `.date-picker-container input` opens its popover on
|
|
77
79
|
`focus`/`focusin` plus pointer and mouse events; the day is `.d-datepicker-cell-main` (not disabled) in the visible
|
|
@@ -87,6 +89,7 @@ input's value with `Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,
|
|
|
87
89
|
- Words and tags: paste into `r.querySelector('.input-editor')` (end with 内容由 AI 辅助生成 when there is no declaration
|
|
88
90
|
of its own); short title: `input[placeholder*=短标题]`.
|
|
89
91
|
- AI: `.mark-tag-select` → `.mark-tag-option` 含AI生成内容.
|
|
92
|
+
- Original: tick 声明原创 (a real click when the checkbox takes no synthetic event) and confirm its terms.
|
|
90
93
|
- Cover: 编辑 on the cover → the last `input[type=file]` whose accept has image → 确认.
|
|
91
94
|
- Scheduled: the label 定时, then in `.weui-desktop-picker__date` show the hidden `dd`s (`style.display = ''`), click
|
|
92
95
|
the day (`td a`, not faded or disabled), the hour and minute (`.weui-desktop-picker__time__hour li`,
|
|
@@ -110,3 +113,10 @@ input's value with `Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,
|
|
|
110
113
|
own model: setting the input's value shows it but the old title is published, so write it short in the version.
|
|
111
114
|
The hour and minute are picked after the day, in a second pass, and read back. Its page of edits
|
|
112
115
|
(修改并重新发表) has crashed the tab twice: get it right before 发表.
|
|
116
|
+
- Original: every piece is the user's own; tick it where the form has it. 小红书 has 原创声明 under 更多设置 (a
|
|
117
|
+
switch, then its notice: tick 我已阅读并同意 and 声明原创). 视频号 posts of pictures have none (only videos do).
|
|
118
|
+
- How far ahead: 小红书 14 days (a later time is put back to now silently), B站 动态 7 days (the days after are
|
|
119
|
+
disabled), so a day out of reach is moved to the furthest day in reach; same-day pieces are fine.
|
|
120
|
+
- 小红书's time and 视频号's month take real clicks: events sent to the time columns or the month arrow do not take, and
|
|
121
|
+
the time put back must be read again just before 定时发布. The B站 editor may hold another piece's draft: clear it
|
|
122
|
+
(`__vue__.clear()` and the pictures) before filling.
|
package/web/index.js
CHANGED
|
@@ -192,6 +192,62 @@ var PublishUtil;
|
|
|
192
192
|
PublishUtil.publishing = publishing;
|
|
193
193
|
})(PublishUtil ||= {});
|
|
194
194
|
|
|
195
|
+
// web-src/values.ts
|
|
196
|
+
var text2 = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
|
|
197
|
+
var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text2(one, 200)).filter(Boolean).slice(0, max) : [];
|
|
198
|
+
var time2 = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
|
|
199
|
+
var oneOf = (all, value, fallback) => all.includes(value) ? value : fallback;
|
|
200
|
+
var object2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
201
|
+
function hash(value) {
|
|
202
|
+
let h = 0;
|
|
203
|
+
for (const char of value) {
|
|
204
|
+
h = Math.imul(h, 31) + (char.codePointAt(0) ?? 0) | 0;
|
|
205
|
+
}
|
|
206
|
+
return (h >>> 0).toString(36);
|
|
207
|
+
}
|
|
208
|
+
function url(value) {
|
|
209
|
+
const raw = text2(value, 1000);
|
|
210
|
+
return /^https?:\/\/\S+$/i.test(raw) ? raw : undefined;
|
|
211
|
+
}
|
|
212
|
+
function count(value, fallback) {
|
|
213
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// web-src/quality.ts
|
|
217
|
+
var RUBRIC = [
|
|
218
|
+
{ id: "hook", weight: 20, asks: "the first 3 seconds give the point, a question or a picture that moves; no slow greeting" },
|
|
219
|
+
{ id: "clarity", weight: 20, asks: "one idea, its terms explained, every fact checked; a newcomer follows it" },
|
|
220
|
+
{ id: "visuals", weight: 15, asks: "scenes vary (a device or a flow every other one), none of the host talking 20 seconds on" },
|
|
221
|
+
{ id: "pace", weight: 15, asks: "its length fits the platform, short sentences, no dead air, it ends when the point is made" },
|
|
222
|
+
{ id: "title", weight: 10, asks: "title and cover say truly and plainly what one gets: a number, a question, never exaggerated" },
|
|
223
|
+
{ id: "series", weight: 10, asks: "of a series: its number, a line to the last piece, and the next piece told at the end" },
|
|
224
|
+
{ id: "fit", weight: 10, asks: "each version in its platform's form, voice, length and tags; its declaration ticked" }
|
|
225
|
+
];
|
|
226
|
+
var PASS = 80;
|
|
227
|
+
var Quality;
|
|
228
|
+
((Quality) => {
|
|
229
|
+
function score(value, now) {
|
|
230
|
+
const given = Array.isArray(value) ? value.map(object2).filter((one) => !!one) : [];
|
|
231
|
+
const parts = RUBRIC.map(({ id }) => {
|
|
232
|
+
const one = given.find((it) => it.id === id);
|
|
233
|
+
const note = text2(one?.note, 200);
|
|
234
|
+
return { id, score: Math.min(100, count(one?.score, 0)), ...note ? { note } : {} };
|
|
235
|
+
});
|
|
236
|
+
const total = Math.round(parts.reduce((all, one, at) => all + one.score * RUBRIC[at].weight / 100, 0));
|
|
237
|
+
return { total, parts, at: now };
|
|
238
|
+
}
|
|
239
|
+
Quality.score = score;
|
|
240
|
+
function weak(score2) {
|
|
241
|
+
return score2.parts.filter((one) => one.score < PASS).sort((a, b) => a.score - b.score);
|
|
242
|
+
}
|
|
243
|
+
Quality.weak = weak;
|
|
244
|
+
function fields(kept) {
|
|
245
|
+
const one = object2(kept.score);
|
|
246
|
+
return one && time2(one.at) ? { score: { ...score(one.parts, time2(one.at)) } } : {};
|
|
247
|
+
}
|
|
248
|
+
Quality.fields = fields;
|
|
249
|
+
})(Quality ||= {});
|
|
250
|
+
|
|
195
251
|
// web-src/react.ts
|
|
196
252
|
var React;
|
|
197
253
|
function bind(react) {
|
|
@@ -268,12 +324,12 @@ ${source}`, TaMessageContext.strip(message));
|
|
|
268
324
|
var TaImageNote;
|
|
269
325
|
(function(TaImageNote2) {
|
|
270
326
|
const NOTE = /^\[Image: original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by [\d.]+ to map to original image\.\]$|^\[Image converted from [^\]]+ to [^\]]+\.\]$/;
|
|
271
|
-
function strip(
|
|
272
|
-
const lines =
|
|
327
|
+
function strip(text3) {
|
|
328
|
+
const lines = text3.split(`
|
|
273
329
|
`);
|
|
274
330
|
const kept = lines.filter((line) => !NOTE.test(line.trim()));
|
|
275
331
|
if (kept.length === lines.length) {
|
|
276
|
-
return
|
|
332
|
+
return text3;
|
|
277
333
|
}
|
|
278
334
|
return kept.join(`
|
|
279
335
|
`).replace(/\n+$/, "").replace(/^\n+/, "");
|
|
@@ -313,20 +369,20 @@ var TaImageSize;
|
|
|
313
369
|
function u32be(bytes, at) {
|
|
314
370
|
return (bytes[at] << 24 | bytes[at + 1] << 16 | bytes[at + 2] << 8 | bytes[at + 3]) >>> 0;
|
|
315
371
|
}
|
|
316
|
-
function
|
|
372
|
+
function text3(bytes, at, length) {
|
|
317
373
|
return String.fromCharCode(...bytes.subarray(at, at + length));
|
|
318
374
|
}
|
|
319
375
|
function png(bytes) {
|
|
320
|
-
return bytes.length >= 24 && bytes[0] === 137 &&
|
|
376
|
+
return bytes.length >= 24 && bytes[0] === 137 && text3(bytes, 1, 3) === "PNG" ? { width: u32be(bytes, 16), height: u32be(bytes, 20) } : undefined;
|
|
321
377
|
}
|
|
322
378
|
function gif(bytes) {
|
|
323
|
-
return bytes.length >= 10 &&
|
|
379
|
+
return bytes.length >= 10 && text3(bytes, 0, 3) === "GIF" ? { width: u16le(bytes, 6), height: u16le(bytes, 8) } : undefined;
|
|
324
380
|
}
|
|
325
381
|
function webp(bytes) {
|
|
326
|
-
if (bytes.length < 30 ||
|
|
382
|
+
if (bytes.length < 30 || text3(bytes, 0, 4) !== "RIFF" || text3(bytes, 8, 4) !== "WEBP") {
|
|
327
383
|
return;
|
|
328
384
|
}
|
|
329
|
-
switch (
|
|
385
|
+
switch (text3(bytes, 12, 4)) {
|
|
330
386
|
case "VP8 ":
|
|
331
387
|
return { width: u16le(bytes, 26) & 16383, height: u16le(bytes, 28) & 16383 };
|
|
332
388
|
case "VP8L": {
|
|
@@ -361,15 +417,15 @@ var TaAgentSummary;
|
|
|
361
417
|
(function(TaAgentSummary2) {
|
|
362
418
|
const START = /^\s*<conversation_history_summary>/;
|
|
363
419
|
const BLOCK = /^\s*<conversation_history_summary>[\s\S]*?(?:<\/conversation_history_summary>\s*|$)/;
|
|
364
|
-
function read(
|
|
365
|
-
if (!START.test(
|
|
420
|
+
function read(text3) {
|
|
421
|
+
if (!START.test(text3)) {
|
|
366
422
|
return;
|
|
367
423
|
}
|
|
368
|
-
return
|
|
424
|
+
return text3.replace(/<\/?(?:conversation_history_summary|summary)>/g, "").replace(/<\/?\w*$/, "").trim();
|
|
369
425
|
}
|
|
370
426
|
TaAgentSummary2.read = read;
|
|
371
|
-
function strip(
|
|
372
|
-
return
|
|
427
|
+
function strip(text3) {
|
|
428
|
+
return text3.replace(BLOCK, "");
|
|
373
429
|
}
|
|
374
430
|
TaAgentSummary2.strip = strip;
|
|
375
431
|
})(TaAgentSummary || (TaAgentSummary = {}));
|
|
@@ -379,12 +435,12 @@ var TaPictureNote;
|
|
|
379
435
|
TaPictureNote2.CLOSE = "</pictures>";
|
|
380
436
|
const BLOCK = /[ \t]*<pictures>([\s\S]*?)(?:<\/pictures>|$)|<p(?:i(?:c(?:t(?:u(?:r(?:es?)?)?)?)?)?)?$/gi;
|
|
381
437
|
const ROW = /(?:^|\s)[-*]?\s*p(\d+)\s*[::]\s*/gi;
|
|
382
|
-
function take(
|
|
438
|
+
function take(text3) {
|
|
383
439
|
const told = new Map;
|
|
384
|
-
if (!/<p/i.test(
|
|
385
|
-
return { said:
|
|
440
|
+
if (!/<p/i.test(text3)) {
|
|
441
|
+
return { said: text3, told };
|
|
386
442
|
}
|
|
387
|
-
const said =
|
|
443
|
+
const said = text3.replace(BLOCK, (_all, body) => {
|
|
388
444
|
const rows = [...(body !== null && body !== undefined ? body : "").matchAll(ROW)];
|
|
389
445
|
rows.forEach((row, index) => {
|
|
390
446
|
var _a;
|
|
@@ -397,13 +453,13 @@ var TaPictureNote;
|
|
|
397
453
|
});
|
|
398
454
|
return "";
|
|
399
455
|
});
|
|
400
|
-
return { said: said ===
|
|
456
|
+
return { said: said === text3 ? text3 : said.replace(/\n{3,}/g, `
|
|
401
457
|
|
|
402
458
|
`).trim(), told };
|
|
403
459
|
}
|
|
404
460
|
TaPictureNote2.take = take;
|
|
405
|
-
function strip(
|
|
406
|
-
return take(
|
|
461
|
+
function strip(text3) {
|
|
462
|
+
return take(text3).said;
|
|
407
463
|
}
|
|
408
464
|
TaPictureNote2.strip = strip;
|
|
409
465
|
})(TaPictureNote || (TaPictureNote = {}));
|
|
@@ -442,8 +498,8 @@ ${note.body}
|
|
|
442
498
|
</task_${note.kind}>`;
|
|
443
499
|
}
|
|
444
500
|
TaTaskNote2.write = write;
|
|
445
|
-
function parse(
|
|
446
|
-
const match = NOTE.exec(
|
|
501
|
+
function parse(text3) {
|
|
502
|
+
const match = NOTE.exec(text3.trim());
|
|
447
503
|
if (!match) {
|
|
448
504
|
return;
|
|
449
505
|
}
|
|
@@ -458,11 +514,11 @@ ${note.body}
|
|
|
458
514
|
return { kind: match[1], id, title, ...status ? { status } : {}, ...was ? { was } : {}, body: match[3] };
|
|
459
515
|
}
|
|
460
516
|
TaTaskNote2.parse = parse;
|
|
461
|
-
function quote(
|
|
462
|
-
return
|
|
517
|
+
function quote(text3) {
|
|
518
|
+
return text3.replace(/&/g, "&").replace(/"/g, """).replace(/\n/g, " ");
|
|
463
519
|
}
|
|
464
|
-
function unquote(
|
|
465
|
-
return
|
|
520
|
+
function unquote(text3) {
|
|
521
|
+
return text3.replace(/"/g, '"').replace(/&/g, "&");
|
|
466
522
|
}
|
|
467
523
|
})(TaTaskNote || (TaTaskNote = {}));
|
|
468
524
|
var TaSecretRef;
|
|
@@ -475,8 +531,8 @@ var TaSecretRef;
|
|
|
475
531
|
[/^ID_NUMBER(?:_\d+)?$/, "idNumber"],
|
|
476
532
|
[/^BANK_CARD(?:_\d+)?$/, "bankCard"]
|
|
477
533
|
];
|
|
478
|
-
function has(
|
|
479
|
-
return
|
|
534
|
+
function has(text3) {
|
|
535
|
+
return text3.includes("TA_SECRET_") && new RegExp(REF.source).test(text3);
|
|
480
536
|
}
|
|
481
537
|
TaSecretRef2.has = has;
|
|
482
538
|
function kind(name) {
|
|
@@ -485,52 +541,31 @@ var TaSecretRef;
|
|
|
485
541
|
return (_b = (_a = KINDS2.find(([pattern]) => pattern.test(name))) === null || _a === undefined ? undefined : _a[1]) !== null && _b !== undefined ? _b : "secret";
|
|
486
542
|
}
|
|
487
543
|
TaSecretRef2.kind = kind;
|
|
488
|
-
function split(
|
|
489
|
-
if (!has(
|
|
490
|
-
return [{ text:
|
|
544
|
+
function split(text3) {
|
|
545
|
+
if (!has(text3)) {
|
|
546
|
+
return [{ text: text3 }];
|
|
491
547
|
}
|
|
492
548
|
const parts = [];
|
|
493
549
|
let at = 0;
|
|
494
|
-
for (const match of
|
|
550
|
+
for (const match of text3.matchAll(REF)) {
|
|
495
551
|
if (match.index > at) {
|
|
496
|
-
parts.push({ text:
|
|
552
|
+
parts.push({ text: text3.slice(at, match.index) });
|
|
497
553
|
}
|
|
498
554
|
parts.push({ secret: match[1], kind: kind(match[1]) });
|
|
499
555
|
at = match.index + match[0].length;
|
|
500
556
|
}
|
|
501
|
-
if (at <
|
|
502
|
-
parts.push({ text:
|
|
557
|
+
if (at < text3.length) {
|
|
558
|
+
parts.push({ text: text3.slice(at) });
|
|
503
559
|
}
|
|
504
560
|
return parts;
|
|
505
561
|
}
|
|
506
562
|
TaSecretRef2.split = split;
|
|
507
|
-
function plain(
|
|
508
|
-
return has(
|
|
563
|
+
function plain(text3, label) {
|
|
564
|
+
return has(text3) ? text3.replace(REF, (_whole, name) => label(name, kind(name))) : text3;
|
|
509
565
|
}
|
|
510
566
|
TaSecretRef2.plain = plain;
|
|
511
567
|
})(TaSecretRef || (TaSecretRef = {}));
|
|
512
568
|
|
|
513
|
-
// web-src/values.ts
|
|
514
|
-
var text2 = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
|
|
515
|
-
var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text2(one, 200)).filter(Boolean).slice(0, max) : [];
|
|
516
|
-
var time2 = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
|
|
517
|
-
var oneOf = (all, value, fallback) => all.includes(value) ? value : fallback;
|
|
518
|
-
var object2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
519
|
-
function hash(value) {
|
|
520
|
-
let h = 0;
|
|
521
|
-
for (const char of value) {
|
|
522
|
-
h = Math.imul(h, 31) + (char.codePointAt(0) ?? 0) | 0;
|
|
523
|
-
}
|
|
524
|
-
return (h >>> 0).toString(36);
|
|
525
|
-
}
|
|
526
|
-
function url(value) {
|
|
527
|
-
const raw = text2(value, 1000);
|
|
528
|
-
return /^https?:\/\/\S+$/i.test(raw) ? raw : undefined;
|
|
529
|
-
}
|
|
530
|
-
function count(value, fallback) {
|
|
531
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
569
|
// web-src/efficiency.ts
|
|
535
570
|
var HOUR = 3600000;
|
|
536
571
|
var DAY = 24 * HOUR;
|
|
@@ -807,6 +842,7 @@ var CreatorUtil;
|
|
|
807
842
|
...time2(kept.commentsAt) ? { commentsAt: time2(kept.commentsAt) } : {},
|
|
808
843
|
...time2(kept.commentsGap) ? { commentsGap: time2(kept.commentsGap) } : {},
|
|
809
844
|
...Efficiency.fields(kept),
|
|
845
|
+
...Quality.fields(kept),
|
|
810
846
|
at,
|
|
811
847
|
changedAt: time2(kept.changedAt) ?? at
|
|
812
848
|
};
|
|
@@ -979,10 +1015,7 @@ var CreatorUtil;
|
|
|
979
1015
|
function need(value) {
|
|
980
1016
|
const kept = object2(value);
|
|
981
1017
|
const words = text2(kept?.text, 300);
|
|
982
|
-
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
return { id: text2(kept.id, 60), text: words, ...kept.done === true ? { done: true } : {} };
|
|
1018
|
+
return kept && words ? { id: text2(kept.id, 60), text: words, ...kept.done === true ? { done: true } : {} } : undefined;
|
|
986
1019
|
}
|
|
987
1020
|
CreatorUtil.need = need;
|
|
988
1021
|
function version(value) {
|
|
@@ -1185,6 +1218,14 @@ var EN = {
|
|
|
1185
1218
|
statFollows: "+{n} followers",
|
|
1186
1219
|
statWaiting: "Read a day after it is out",
|
|
1187
1220
|
statLate: "Not read in 48 hours",
|
|
1221
|
+
score: "Quality score, 80 to pass",
|
|
1222
|
+
score_hook: "Hook",
|
|
1223
|
+
score_clarity: "Clarity",
|
|
1224
|
+
score_visuals: "Visuals",
|
|
1225
|
+
score_pace: "Pace",
|
|
1226
|
+
score_title: "Title",
|
|
1227
|
+
score_series: "Series",
|
|
1228
|
+
score_fit: "Platforms",
|
|
1188
1229
|
effTitle: "What it took Ta",
|
|
1189
1230
|
effHint: "last 7 days against the 7 before",
|
|
1190
1231
|
effBefore: "Before",
|
|
@@ -1417,6 +1458,14 @@ var ZH = {
|
|
|
1417
1458
|
statFollows: "涨粉 {n}",
|
|
1418
1459
|
statWaiting: "发布满一天后读取",
|
|
1419
1460
|
statLate: "超过 48 小时未读",
|
|
1461
|
+
score: "品质自评 · 80 分过审",
|
|
1462
|
+
score_hook: "开头",
|
|
1463
|
+
score_clarity: "讲清楚",
|
|
1464
|
+
score_visuals: "画面",
|
|
1465
|
+
score_pace: "节奏",
|
|
1466
|
+
score_title: "标题",
|
|
1467
|
+
score_series: "系列",
|
|
1468
|
+
score_fit: "平台",
|
|
1420
1469
|
effTitle: "执行效率",
|
|
1421
1470
|
effHint: "近 7 天对比前 7 天",
|
|
1422
1471
|
effBefore: "前 7 天",
|
|
@@ -1649,6 +1698,14 @@ var ZH_TW = {
|
|
|
1649
1698
|
statFollows: "漲粉 {n}",
|
|
1650
1699
|
statWaiting: "發布滿一天後讀取",
|
|
1651
1700
|
statLate: "超過 48 小時未讀",
|
|
1701
|
+
score: "品質自評 · 80 分過審",
|
|
1702
|
+
score_hook: "開頭",
|
|
1703
|
+
score_clarity: "講清楚",
|
|
1704
|
+
score_visuals: "畫面",
|
|
1705
|
+
score_pace: "節奏",
|
|
1706
|
+
score_title: "標題",
|
|
1707
|
+
score_series: "系列",
|
|
1708
|
+
score_fit: "平台",
|
|
1652
1709
|
effTitle: "執行效率",
|
|
1653
1710
|
effHint: "近 7 天對比前 7 天",
|
|
1654
1711
|
effBefore: "前 7 天",
|
|
@@ -1881,6 +1938,14 @@ var JA = {
|
|
|
1881
1938
|
statFollows: "フォロワー +{n}",
|
|
1882
1939
|
statWaiting: "公開から 1 日後に読み取り",
|
|
1883
1940
|
statLate: "48 時間読めていません",
|
|
1941
|
+
score: "品質の自己採点 · 80 点で審査へ",
|
|
1942
|
+
score_hook: "冒頭",
|
|
1943
|
+
score_clarity: "わかりやすさ",
|
|
1944
|
+
score_visuals: "画面",
|
|
1945
|
+
score_pace: "テンポ",
|
|
1946
|
+
score_title: "タイトル",
|
|
1947
|
+
score_series: "シリーズ",
|
|
1948
|
+
score_fit: "プラットフォーム",
|
|
1884
1949
|
effTitle: "実行効率",
|
|
1885
1950
|
effHint: "直近 7 日とその前の 7 日",
|
|
1886
1951
|
effBefore: "前の 7 日",
|
|
@@ -2322,7 +2387,18 @@ function ReviewCard({
|
|
|
2322
2387
|
className: "tcre-tags"
|
|
2323
2388
|
}, version.tags.map((tag) => `#${tag}`).join(" ")), item.origin && /* @__PURE__ */ React.createElement("div", {
|
|
2324
2389
|
className: "tcre-origin"
|
|
2325
|
-
}, words.source, ": ", item.origin.title ?? item.origin.url, item.origin.author ? ` · ${item.origin.author}` : ""),
|
|
2390
|
+
}, words.source, ": ", item.origin.title ?? item.origin.url, item.origin.author ? ` · ${item.origin.author}` : ""), item.score && /* @__PURE__ */ React.createElement("div", {
|
|
2391
|
+
className: "tcre-score",
|
|
2392
|
+
"data-low": item.score.total < PASS || undefined
|
|
2393
|
+
}, /* @__PURE__ */ React.createElement("b", null, item.score.total), /* @__PURE__ */ React.createElement("span", {
|
|
2394
|
+
className: "tcre-score-label"
|
|
2395
|
+
}, words.score), /* @__PURE__ */ React.createElement("span", {
|
|
2396
|
+
className: "tcre-score-parts"
|
|
2397
|
+
}, item.score.parts.map((part) => /* @__PURE__ */ React.createElement("span", {
|
|
2398
|
+
key: part.id,
|
|
2399
|
+
title: part.note,
|
|
2400
|
+
"data-low": part.score < PASS || undefined
|
|
2401
|
+
}, words[`score_${part.id}`], " ", part.score)))), !!item.checks?.length && /* @__PURE__ */ React.createElement("div", {
|
|
2326
2402
|
className: "tcre-checks"
|
|
2327
2403
|
}, item.checks.map((check) => /* @__PURE__ */ React.createElement("span", {
|
|
2328
2404
|
key: check.text,
|
|
@@ -4313,6 +4389,14 @@ button.tcre-pill:hover { background: var(--ta-hover); }
|
|
|
4313
4389
|
.tcre-review-text { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; width: 100%; margin: 0; padding: 0 2px; border: 0; background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); line-height: 1.6; text-align: left; white-space: pre-wrap; cursor: pointer; }
|
|
4314
4390
|
.tcre-review-text[data-open] { display: block; }
|
|
4315
4391
|
.tcre-tags, .tcre-origin { margin: 6px 2px 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }
|
|
4392
|
+
.tcre-score { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 10px; row-gap: 4px; margin: 12px 2px 0; padding-top: 12px; border-top: 1px solid var(--tcre-line); }
|
|
4393
|
+
.tcre-score > b { grid-row: span 2; font-size: calc(26px * var(--ta-font-scale)); font-weight: 650; line-height: 1; letter-spacing: -0.4px; color: var(--tcre-ok); font-variant-numeric: tabular-nums; }
|
|
4394
|
+
.tcre-score[data-low] > b { color: var(--ta-warning, #d97706); }
|
|
4395
|
+
.tcre-score-label { font-size: calc(12.5px * var(--ta-font-scale)); color: var(--ta-muted); }
|
|
4396
|
+
.tcre-score-parts { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-muted); font-variant-numeric: tabular-nums; }
|
|
4397
|
+
.tcre-score-parts > span { white-space: nowrap; }
|
|
4398
|
+
.tcre-score-parts > span[data-low] { color: var(--ta-warning, #d97706); }
|
|
4399
|
+
.tcre-score + .tcre-checks { border-top: 0; padding-top: 4px; }
|
|
4316
4400
|
.tcre-checks { display: flex; flex-direction: column; gap: 7px; margin: 12px 2px; padding-top: 12px; border-top: 1px solid var(--tcre-line); font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }
|
|
4317
4401
|
.tcre-checks span { display: flex; gap: 8px; align-items: flex-start; }
|
|
4318
4402
|
.tcre-checks i { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: calc(10px * var(--ta-font-scale)); font-weight: 700; color: var(--ta-warning, #d97706); background: color-mix(in oklab, var(--ta-warning, #d97706) 18%, transparent); }
|