@musnows/scriverse 0.8.3 → 0.8.5
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-stream-timeout.js +9 -6
- package/dist/ai-stream-timeout.js.map +1 -1
- package/dist/ai.js +32 -6
- package/dist/ai.js.map +1 -1
- package/dist/app.js +10 -4
- package/dist/app.js.map +1 -1
- package/dist/database.js +48 -2
- package/dist/database.js.map +1 -1
- package/dist/public/app.js +275 -67
- package/dist/public/index.html +2 -2
- package/dist/public/styles.css +9 -0
- package/dist/server-runtime.js +4 -2
- package/dist/server-runtime.js.map +1 -1
- package/dist/store.js +29 -19
- package/dist/store.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -12,7 +12,7 @@ import { z, ZodError } from "zod";
|
|
|
12
12
|
import { AI_PROVIDER_PROTOCOLS, MAX_TOKENS_PARAMETERS } from "./ai-protocol.js";
|
|
13
13
|
import { aiConversationExportContentDisposition, exportAiConversationMarkdown } from "./ai-conversation-export.js";
|
|
14
14
|
import { DEFAULT_AI_CHAT_TAB_LIMIT } from "./ai-chat-tab-limit.js";
|
|
15
|
-
import {
|
|
15
|
+
import { MAX_AI_STREAM_IDLE_TIMEOUT_SECONDS, MIN_AI_STREAM_IDLE_TIMEOUT_SECONDS, normalizeAiStreamIdleTimeoutSeconds } from "./ai-stream-timeout.js";
|
|
16
16
|
import { AttachmentStorage } from "./attachment-storage.js";
|
|
17
17
|
import { AiManager } from "./ai.js";
|
|
18
18
|
import { resolveMaxAgentToolCallLimit } from "./ai-tool-results.js";
|
|
@@ -416,7 +416,8 @@ const modelSchema = z.object({
|
|
|
416
416
|
});
|
|
417
417
|
const aiPromptSchema = z.object({
|
|
418
418
|
systemPrompt: z.string().max(100_000).optional(),
|
|
419
|
-
imageToolModelId: identifier.nullable().optional()
|
|
419
|
+
imageToolModelId: identifier.nullable().optional(),
|
|
420
|
+
streamIdleTimeoutSeconds: z.number().int().min(MIN_AI_STREAM_IDLE_TIMEOUT_SECONDS).max(MAX_AI_STREAM_IDLE_TIMEOUT_SECONDS).optional()
|
|
420
421
|
});
|
|
421
422
|
const aiUsageQuerySchema = z.object({
|
|
422
423
|
timezoneOffset: z.coerce.number().int().min(-840).max(840).default(0)
|
|
@@ -975,6 +976,7 @@ function redactAiConversation(record, permissions) {
|
|
|
975
976
|
result.agentTools = [
|
|
976
977
|
...(permissions.characters !== "none" ? ["recall_self"] : []),
|
|
977
978
|
...(permissions.characters !== "none" && permissions.relationships !== "none" ? ["recall_relationship"] : []),
|
|
979
|
+
...(permissions.prose !== "none" ? ["recall_story"] : []),
|
|
978
980
|
"calculate_time"
|
|
979
981
|
];
|
|
980
982
|
}
|
|
@@ -1083,6 +1085,8 @@ export function createRuntime(options) {
|
|
|
1083
1085
|
? auth.listUsers().find((user) => user.status === "active") ?? null
|
|
1084
1086
|
: null;
|
|
1085
1087
|
const store = new Store(database);
|
|
1088
|
+
const platformAiSettings = store.getPlatformAiSettings();
|
|
1089
|
+
const platformAiStreamIdleTimeoutMs = normalizeAiStreamIdleTimeoutSeconds(Number(platformAiSettings.streamIdleTimeoutSeconds)) * 1_000;
|
|
1086
1090
|
let attachmentCleanupChain = Promise.resolve();
|
|
1087
1091
|
const cleanupAttachments = () => {
|
|
1088
1092
|
const cleanup = attachmentCleanupChain.then(async () => {
|
|
@@ -1155,7 +1159,7 @@ export function createRuntime(options) {
|
|
|
1155
1159
|
write: ["ai-analysis"]
|
|
1156
1160
|
}, false, actor?.allowAdminAccess ?? false);
|
|
1157
1161
|
}, attachmentStorage, {
|
|
1158
|
-
interactiveStreamIdleTimeoutMs: options.aiStreamIdleTimeoutMs ??
|
|
1162
|
+
interactiveStreamIdleTimeoutMs: options.aiStreamIdleTimeoutMs ?? platformAiStreamIdleTimeoutMs,
|
|
1159
1163
|
retryPolicy: options.aiRetryPolicy,
|
|
1160
1164
|
retrySleep: options.aiRetrySleep
|
|
1161
1165
|
});
|
|
@@ -2321,7 +2325,9 @@ export function createRuntime(options) {
|
|
|
2321
2325
|
const input = parse(aiPromptSchema, request.body);
|
|
2322
2326
|
if (input.imageToolModelId)
|
|
2323
2327
|
ai.assertImageToolModelAvailable(input.imageToolModelId);
|
|
2324
|
-
|
|
2328
|
+
const settings = store.updatePlatformAiSettings(input);
|
|
2329
|
+
ai.setInteractiveStreamIdleTimeoutSeconds(Number(settings.streamIdleTimeoutSeconds));
|
|
2330
|
+
data(response, settings);
|
|
2325
2331
|
});
|
|
2326
2332
|
app.get("/api/platform/ai/usage", (request, response) => {
|
|
2327
2333
|
const query = parse(aiUsageQuerySchema, request.query);
|