@musnows/scriverse 1.0.0 → 1.0.2

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/store.js CHANGED
@@ -994,6 +994,7 @@ export class Store {
994
994
  const streamIdleTimeoutValue = Number(row?.stream_idle_timeout_seconds);
995
995
  return {
996
996
  systemPrompt: String(row?.system_prompt ?? ""),
997
+ systemPromptOverride: Number(row?.system_prompt_override_enabled ?? 0) === 1,
997
998
  imageToolModelId: row?.image_tool_model_id === null || row?.image_tool_model_id === undefined
998
999
  ? null
999
1000
  : String(row.image_tool_model_id),
@@ -1008,11 +1009,13 @@ export class Store {
1008
1009
  const current = this.getPlatformAiSettings();
1009
1010
  const currentStreamIdleTimeoutSeconds = Number(current.streamIdleTimeoutSeconds);
1010
1011
  const streamIdleTimeoutSeconds = normalizeAiStreamIdleTimeoutSeconds(input.streamIdleTimeoutSeconds ?? currentStreamIdleTimeoutSeconds);
1011
- this.db.run(`INSERT INTO platform_ai_settings (id, system_prompt, image_tool_model_id, stream_idle_timeout_seconds, updated_at) VALUES (1, ?, ?, ?, ?)
1012
+ const nextOverride = input.systemPromptOverride ?? Boolean(current.systemPromptOverride);
1013
+ this.db.run(`INSERT INTO platform_ai_settings (id, system_prompt, system_prompt_override_enabled, image_tool_model_id, stream_idle_timeout_seconds, updated_at) VALUES (1, ?, ?, ?, ?, ?)
1012
1014
  ON CONFLICT(id) DO UPDATE SET system_prompt = excluded.system_prompt,
1015
+ system_prompt_override_enabled = excluded.system_prompt_override_enabled,
1013
1016
  image_tool_model_id = excluded.image_tool_model_id,
1014
1017
  stream_idle_timeout_seconds = excluded.stream_idle_timeout_seconds,
1015
- updated_at = excluded.updated_at`, input.systemPrompt ?? String(current.systemPrompt), input.imageToolModelId === undefined
1018
+ updated_at = excluded.updated_at`, input.systemPrompt ?? String(current.systemPrompt), nextOverride ? 1 : 0, input.imageToolModelId === undefined
1016
1019
  ? (current.imageToolModelId === null ? null : String(current.imageToolModelId))
1017
1020
  : input.imageToolModelId, streamIdleTimeoutSeconds, timestamp);
1018
1021
  return this.getPlatformAiSettings();
@@ -1081,6 +1084,7 @@ export class Store {
1081
1084
  return {
1082
1085
  workId,
1083
1086
  systemPrompt: String(row?.system_prompt ?? ""),
1087
+ systemPromptOverride: Number(row?.system_prompt_override_enabled ?? 0) === 1,
1084
1088
  dailyTokenQuota: row?.daily_token_quota === null || row?.daily_token_quota === undefined
1085
1089
  ? null
1086
1090
  : Math.max(1, Number(row.daily_token_quota)),
@@ -1131,6 +1135,7 @@ export class Store {
1131
1135
  const maximumAgentToolCallLimit = resolveMaxAgentToolCallLimit();
1132
1136
  const timestamp = now();
1133
1137
  const nextPrompt = input.systemPrompt ?? String(current.systemPrompt);
1138
+ const nextSystemPromptOverride = input.systemPromptOverride ?? Boolean(current.systemPromptOverride);
1134
1139
  const nextDailyTokenQuota = input.dailyTokenQuota === undefined
1135
1140
  ? (current.dailyTokenQuota === null ? null : Number(current.dailyTokenQuota))
1136
1141
  : input.dailyTokenQuota;
@@ -1156,14 +1161,15 @@ export class Store {
1156
1161
  ? (current.titleGenerationModelId ? String(current.titleGenerationModelId) : null)
1157
1162
  : input.titleGenerationModelId?.trim() || null;
1158
1163
  this.db.run(`INSERT INTO work_ai_settings (
1159
- work_id, system_prompt, daily_token_quota, monthly_token_quota, auto_run_enabled, auto_run_concurrency, auto_run_batch_limit,
1164
+ work_id, system_prompt, system_prompt_override_enabled, daily_token_quota, monthly_token_quota, auto_run_enabled, auto_run_concurrency, auto_run_batch_limit,
1160
1165
  auto_run_daily_task_limit, auto_run_failure_threshold, auto_run_stability_delay_minutes, auto_run_paused, auto_run_pause_reason,
1161
1166
  auto_run_resume_at, auto_run_consecutive_failures, book_summary_context_percent,
1162
1167
  context_compact_threshold, agent_tool_call_limit, agent_tool_call_global_multiplier,
1163
1168
  agent_tools_json, title_generation_model_id, image_tool_model_id, always_include_setting_info, updated_at
1164
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
1169
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
1165
1170
  ON CONFLICT(work_id) DO UPDATE SET
1166
1171
  system_prompt = excluded.system_prompt,
1172
+ system_prompt_override_enabled = excluded.system_prompt_override_enabled,
1167
1173
  daily_token_quota = excluded.daily_token_quota,
1168
1174
  monthly_token_quota = excluded.monthly_token_quota,
1169
1175
  auto_run_enabled = excluded.auto_run_enabled,
@@ -1184,9 +1190,10 @@ export class Store {
1184
1190
  title_generation_model_id = excluded.title_generation_model_id,
1185
1191
  image_tool_model_id = excluded.image_tool_model_id,
1186
1192
  always_include_setting_info = excluded.always_include_setting_info,
1187
- updated_at = excluded.updated_at`, workId, nextPrompt, nextDailyTokenQuota, nextMonthlyTokenQuota, nextEnabled ? 1 : 0, Math.min(8, Math.max(1, nextConcurrency)), Math.min(200, Math.max(1, nextBatchLimit)), Math.min(10_000, Math.max(0, nextDailyTaskLimit)), Math.min(10, Math.max(1, nextFailureThreshold)), Math.min(120, Math.max(1, nextStabilityDelayMinutes)), current.autoRunPaused ? 1 : 0, String(current.autoRunPauseReason ?? ""), current.autoRunResumeAt === null ? null : String(current.autoRunResumeAt), Math.max(0, Number(current.autoRunConsecutiveFailures) || 0), Math.min(90, Math.max(1, nextBookSummaryContextPercent)), Math.min(90, Math.max(50, nextContextCompactThreshold)), Math.min(maximumAgentToolCallLimit, Math.max(5, nextAgentToolCallLimit)), Math.min(6, Math.max(1, nextAgentToolCallGlobalMultiplier)), JSON.stringify(nextAgentTools), nextTitleGenerationModelId, nextImageToolModelId, nextAlwaysIncludeSettingInfo ? 1 : 0, timestamp);
1193
+ updated_at = excluded.updated_at`, workId, nextPrompt, nextSystemPromptOverride ? 1 : 0, nextDailyTokenQuota, nextMonthlyTokenQuota, nextEnabled ? 1 : 0, Math.min(8, Math.max(1, nextConcurrency)), Math.min(200, Math.max(1, nextBatchLimit)), Math.min(10_000, Math.max(0, nextDailyTaskLimit)), Math.min(10, Math.max(1, nextFailureThreshold)), Math.min(120, Math.max(1, nextStabilityDelayMinutes)), current.autoRunPaused ? 1 : 0, String(current.autoRunPauseReason ?? ""), current.autoRunResumeAt === null ? null : String(current.autoRunResumeAt), Math.max(0, Number(current.autoRunConsecutiveFailures) || 0), Math.min(90, Math.max(1, nextBookSummaryContextPercent)), Math.min(90, Math.max(50, nextContextCompactThreshold)), Math.min(maximumAgentToolCallLimit, Math.max(5, nextAgentToolCallLimit)), Math.min(6, Math.max(1, nextAgentToolCallGlobalMultiplier)), JSON.stringify(nextAgentTools), nextTitleGenerationModelId, nextImageToolModelId, nextAlwaysIncludeSettingInfo ? 1 : 0, timestamp);
1188
1194
  this.audit(workId, "work.ai-settings.updated", "work-ai-settings", workId, {
1189
1195
  systemPromptChanged: input.systemPrompt !== undefined,
1196
+ systemPromptOverride: nextSystemPromptOverride,
1190
1197
  dailyTokenQuota: nextDailyTokenQuota,
1191
1198
  monthlyTokenQuota: nextMonthlyTokenQuota,
1192
1199
  autoRunEnabled: nextEnabled,