@musnows/scriverse 0.4.12 → 0.5.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/dist/ai.js +175 -4
- package/dist/ai.js.map +1 -1
- package/dist/app.js +30 -11
- package/dist/app.js.map +1 -1
- package/dist/database.js +55 -0
- package/dist/database.js.map +1 -1
- package/dist/pagination.js +1 -1
- package/dist/public/app.js +400 -74
- package/dist/public/global-search.d.ts +12 -0
- package/dist/public/global-search.js +23 -0
- package/dist/public/index.html +17 -4
- package/dist/public/relationship-filters.d.ts +10 -0
- package/dist/public/relationship-filters.js +11 -0
- package/dist/public/relationship-graph.js +59 -3
- package/dist/public/styles.css +209 -2
- package/dist/store.js +110 -32
- package/dist/store.js.map +1 -1
- package/dist/user-auth.js +12 -0
- package/dist/user-auth.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -295,9 +295,17 @@ const modelSchema = z.object({
|
|
|
295
295
|
const aiPromptSchema = z.object({
|
|
296
296
|
systemPrompt: z.string().max(100_000).optional()
|
|
297
297
|
});
|
|
298
|
-
const
|
|
299
|
-
|
|
298
|
+
const platformPageSizesSchema = z.object({
|
|
299
|
+
characters: z.number().int().min(10).max(100).optional(),
|
|
300
|
+
analysisTasks: z.number().int().min(10).max(100).optional(),
|
|
301
|
+
fileVersions: z.number().int().min(10).max(100).optional()
|
|
300
302
|
}).strict();
|
|
303
|
+
const platformUiSettingsSchema = z.object({
|
|
304
|
+
toastPosition: z.enum(["bottom-right", "top-right"]).optional(),
|
|
305
|
+
pageSizes: platformPageSizesSchema.optional()
|
|
306
|
+
}).strict().refine((input) => input.toastPosition !== undefined || input.pageSizes !== undefined, {
|
|
307
|
+
message: "至少需要提供一项界面设置"
|
|
308
|
+
});
|
|
301
309
|
const aiToolCallResultSchema = z.object({
|
|
302
310
|
id: z.string().min(1).max(300),
|
|
303
311
|
name: z.string().min(1).max(200),
|
|
@@ -426,6 +434,19 @@ function redactRaceMembers(record, permissions) {
|
|
|
426
434
|
function redactOrganizationMembers(record, permissions) {
|
|
427
435
|
return permissions.characters === "none" ? { ...record, memberIds: [], members: [] } : record;
|
|
428
436
|
}
|
|
437
|
+
function redactTaskCharacterNames(record, permissions) {
|
|
438
|
+
const { scopeSummaryWithoutCharacterNames, ...result } = record;
|
|
439
|
+
if (permissions.characters !== "none")
|
|
440
|
+
return result;
|
|
441
|
+
if (typeof scopeSummaryWithoutCharacterNames === "string")
|
|
442
|
+
result.scopeSummary = scopeSummaryWithoutCharacterNames;
|
|
443
|
+
const scope = recordValue(result.scope);
|
|
444
|
+
if (scope) {
|
|
445
|
+
const { targetCharacters: _targetCharacters, ...redactedScope } = scope;
|
|
446
|
+
result.scope = redactedScope;
|
|
447
|
+
}
|
|
448
|
+
return result;
|
|
449
|
+
}
|
|
429
450
|
function redactMergeRecords(value, mapper) {
|
|
430
451
|
const record = recordValue(value);
|
|
431
452
|
if (!record)
|
|
@@ -1323,25 +1344,23 @@ export function createRuntime(options) {
|
|
|
1323
1344
|
data(response, store.mergeCharacters({ reviewId: request.params.reviewId, ...input }));
|
|
1324
1345
|
});
|
|
1325
1346
|
app.get("/api/works/:workId/tasks", (request, response) => {
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
data(response, pagination
|
|
1329
|
-
? (summary ? store.listTaskSummariesPage(request.params.workId, pagination) : store.listTasksPage(request.params.workId, pagination))
|
|
1330
|
-
: store.listTasks(request.params.workId));
|
|
1347
|
+
const permissions = requestPermissions(request, request.params.workId);
|
|
1348
|
+
data(response, mapRecords(store.listTaskSummariesPage(request.params.workId, parsePagination(request.query) ?? { page: 1, limit: 30, offset: 0 }), (task) => redactTaskCharacterNames(task, permissions)));
|
|
1331
1349
|
});
|
|
1332
1350
|
app.post("/api/works/:workId/tasks", (request, response) => {
|
|
1333
1351
|
const input = parse(analysisTaskSchema, request.body);
|
|
1334
|
-
data(response, store.createTask(request.params.workId, input), 201);
|
|
1352
|
+
data(response, redactTaskCharacterNames(store.createTask(request.params.workId, input), requestPermissions(request, request.params.workId)), 201);
|
|
1335
1353
|
});
|
|
1336
1354
|
app.post("/api/works/:workId/tasks/auto-run", (request, response) => {
|
|
1337
1355
|
data(response, ai.startAutoRunBatch(request.params.workId));
|
|
1338
1356
|
});
|
|
1339
|
-
app.get("/api/tasks/:taskId", (request, response) => data(response, store.getTask(request.params.taskId)));
|
|
1357
|
+
app.get("/api/tasks/:taskId", (request, response) => data(response, redactTaskCharacterNames(store.getTask(request.params.taskId), requestPermissions(request))));
|
|
1358
|
+
app.get("/api/tasks/:taskId/trace", (request, response) => data(response, ai.getTaskTrace(request.params.taskId)));
|
|
1340
1359
|
app.post("/api/tasks/:taskId/run", async (request, response) => {
|
|
1341
1360
|
const input = parse(z.object({ modelId: identifier.optional() }), request.body ?? {});
|
|
1342
|
-
data(response, await ai.runTask(request.params.taskId, input.modelId));
|
|
1361
|
+
data(response, redactTaskCharacterNames(await ai.runTask(request.params.taskId, input.modelId), requestPermissions(request)));
|
|
1343
1362
|
});
|
|
1344
|
-
app.post("/api/tasks/:taskId/cancel", (request, response) => data(response, ai.cancelTask(request.params.taskId)));
|
|
1363
|
+
app.post("/api/tasks/:taskId/cancel", (request, response) => data(response, redactTaskCharacterNames(ai.cancelTask(request.params.taskId), requestPermissions(request))));
|
|
1345
1364
|
app.get("/api/platform/ai/providers", (request, response) => {
|
|
1346
1365
|
const pagination = parsePagination(request.query);
|
|
1347
1366
|
data(response, pagination ? ai.listProvidersPage(pagination) : ai.listProviders());
|