@musnows/scriverse 0.6.4 → 0.6.6

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
@@ -374,6 +374,7 @@ export class Store {
374
374
  if (type === "race")
375
375
  return {
376
376
  name: entity.name,
377
+ isExtinct: entity.isExtinct,
377
378
  parentRaceId: entity.parentRaceId,
378
379
  description: entity.description,
379
380
  settings: entity.settings,
@@ -383,6 +384,7 @@ export class Store {
383
384
  if (type === "organization")
384
385
  return {
385
386
  name: entity.name,
387
+ isDissolved: entity.isDissolved,
386
388
  description: entity.description,
387
389
  settings: entity.settings,
388
390
  settingsSections: entity.settingsSections,
@@ -552,9 +554,9 @@ export class Store {
552
554
  else if (type === "setting")
553
555
  restored = this.updateSetting(entityId, snapshot, "restore", sourceRef, changeNote, expectedVersionNo);
554
556
  else if (type === "race")
555
- restored = this.updateRace(entityId, snapshot, "restore", sourceRef, changeNote, expectedVersionNo);
557
+ restored = this.updateRace(entityId, { isExtinct: false, ...snapshot }, "restore", sourceRef, changeNote, expectedVersionNo);
556
558
  else if (type === "organization")
557
- restored = this.updateOrganization(entityId, snapshot, "restore", sourceRef, changeNote, expectedVersionNo);
559
+ restored = this.updateOrganization(entityId, { isDissolved: false, ...snapshot }, "restore", sourceRef, changeNote, expectedVersionNo);
558
560
  else if (type === "timeline-track")
559
561
  restored = this.updateTimelineTrack(entityId, snapshot, "restore", sourceRef, changeNote, expectedVersionNo);
560
562
  else if (type === "timeline-event")
@@ -595,10 +597,10 @@ export class Store {
595
597
  return this.insertSettingWithId(workId, entityId, snapshot, "restore", sourceRef, changeNote);
596
598
  }
597
599
  if (type === "race") {
598
- return this.insertRaceWithId(workId, entityId, snapshot, "restore", sourceRef, changeNote);
600
+ return this.insertRaceWithId(workId, entityId, { isExtinct: false, ...snapshot }, "restore", sourceRef, changeNote);
599
601
  }
600
602
  if (type === "organization") {
601
- return this.insertOrganizationWithId(workId, entityId, snapshot, "restore", sourceRef, changeNote);
603
+ return this.insertOrganizationWithId(workId, entityId, { isDissolved: false, ...snapshot }, "restore", sourceRef, changeNote);
602
604
  }
603
605
  if (type === "timeline-track") {
604
606
  return this.insertTimelineTrackWithId(workId, entityId, snapshot, "restore", sourceRef, changeNote);
@@ -752,6 +754,7 @@ export class Store {
752
754
  agentToolCallLimit: Math.min(48, Math.max(5, Number(row?.agent_tool_call_limit ?? 12) || 12)),
753
755
  agentToolCallGlobalMultiplier: Math.min(6, Math.max(1, Number(row?.agent_tool_call_global_multiplier ?? 3) || 3)),
754
756
  agentTools: normalizeWorkAgentTools(row?.agent_tools_json),
757
+ alwaysIncludeSettingInfo: Number(row?.always_include_setting_info ?? 0) === 1,
755
758
  titleGenerationModelId: row?.title_generation_model_id === null || row?.title_generation_model_id === undefined
756
759
  ? null
757
760
  : String(row.title_generation_model_id),
@@ -776,6 +779,7 @@ export class Store {
776
779
  const nextAgentToolCallLimit = input.agentToolCallLimit ?? Number(current.agentToolCallLimit);
777
780
  const nextAgentToolCallGlobalMultiplier = input.agentToolCallGlobalMultiplier ?? Number(current.agentToolCallGlobalMultiplier);
778
781
  const nextAgentTools = normalizeWorkAgentTools(input.agentTools ?? current.agentTools);
782
+ const nextAlwaysIncludeSettingInfo = input.alwaysIncludeSettingInfo ?? Boolean(current.alwaysIncludeSettingInfo);
779
783
  const nextTitleGenerationModelId = input.titleGenerationModelId === undefined
780
784
  ? (current.titleGenerationModelId ? String(current.titleGenerationModelId) : null)
781
785
  : input.titleGenerationModelId?.trim() || null;
@@ -784,8 +788,8 @@ export class Store {
784
788
  auto_run_daily_task_limit, auto_run_failure_threshold, auto_run_paused, auto_run_pause_reason,
785
789
  auto_run_resume_at, auto_run_consecutive_failures, book_summary_context_percent,
786
790
  context_compact_threshold, agent_tool_call_limit, agent_tool_call_global_multiplier,
787
- agent_tools_json, title_generation_model_id, updated_at
788
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
791
+ agent_tools_json, title_generation_model_id, always_include_setting_info, updated_at
792
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
789
793
  ON CONFLICT(work_id) DO UPDATE SET
790
794
  system_prompt = excluded.system_prompt,
791
795
  daily_token_quota = excluded.daily_token_quota,
@@ -804,7 +808,8 @@ export class Store {
804
808
  agent_tool_call_global_multiplier = excluded.agent_tool_call_global_multiplier,
805
809
  agent_tools_json = excluded.agent_tools_json,
806
810
  title_generation_model_id = excluded.title_generation_model_id,
807
- updated_at = excluded.updated_at`, workId, nextPrompt, nextDailyTokenQuota, 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)), 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(48, Math.max(5, nextAgentToolCallLimit)), Math.min(6, Math.max(1, nextAgentToolCallGlobalMultiplier)), JSON.stringify(nextAgentTools), nextTitleGenerationModelId, timestamp);
811
+ always_include_setting_info = excluded.always_include_setting_info,
812
+ updated_at = excluded.updated_at`, workId, nextPrompt, nextDailyTokenQuota, 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)), 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(48, Math.max(5, nextAgentToolCallLimit)), Math.min(6, Math.max(1, nextAgentToolCallGlobalMultiplier)), JSON.stringify(nextAgentTools), nextTitleGenerationModelId, nextAlwaysIncludeSettingInfo ? 1 : 0, timestamp);
808
813
  this.audit(workId, "work.ai-settings.updated", "work-ai-settings", workId, {
809
814
  systemPromptChanged: input.systemPrompt !== undefined,
810
815
  dailyTokenQuota: nextDailyTokenQuota,
@@ -818,6 +823,7 @@ export class Store {
818
823
  agentToolCallLimit: Math.min(48, Math.max(5, nextAgentToolCallLimit)),
819
824
  agentToolCallGlobalMultiplier: Math.min(6, Math.max(1, nextAgentToolCallGlobalMultiplier)),
820
825
  agentTools: nextAgentTools,
826
+ alwaysIncludeSettingInfo: nextAlwaysIncludeSettingInfo,
821
827
  titleGenerationModelId: nextTitleGenerationModelId
822
828
  });
823
829
  return this.getWorkAiSettings(workId);
@@ -2602,8 +2608,8 @@ export class Store {
2602
2608
  const settings = settingsFromKnowledgeSections(settingsSections);
2603
2609
  const timestamp = now();
2604
2610
  this.db.transaction(() => {
2605
- this.db.run(`INSERT INTO races (id, work_id, parent_race_id, name, normalized_name, description, settings_json, settings_sections_json, created_at, updated_at)
2606
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, raceId, workId, parentRaceId, name, normalizedName, input.description ?? "", JSON.stringify(settings), JSON.stringify(settingsSections), timestamp, timestamp);
2611
+ this.db.run(`INSERT INTO races (id, work_id, parent_race_id, name, normalized_name, description, is_extinct, settings_json, settings_sections_json, created_at, updated_at)
2612
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, raceId, workId, parentRaceId, name, normalizedName, input.description ?? "", input.isExtinct ? 1 : 0, JSON.stringify(settings), JSON.stringify(settingsSections), timestamp, timestamp);
2607
2613
  this.syncMarkdownAttachmentReferences(workId, "race", raceId, settingsMarkdownFromList(settings));
2608
2614
  this.replaceRaceMembers(raceId, name, memberIds);
2609
2615
  this.recordMembershipVersions(memberSnapshots, "race", raceId, `设为种族“${name}”`);
@@ -2668,7 +2674,7 @@ export class Store {
2668
2674
  const settings = settingsFromKnowledgeSections(settingsSections);
2669
2675
  this.db.transaction(() => {
2670
2676
  this.assertExpectedVersion("race", raceId, expectedVersionNo, "种族");
2671
- this.db.run(`UPDATE races SET parent_race_id = ?, name = ?, normalized_name = ?, description = ?, settings_json = ?, settings_sections_json = ?, updated_at = ? WHERE id = ?`, parentRaceId, name, normalizedName, input.description ?? String(current.description), JSON.stringify(settings), JSON.stringify(settingsSections), now(), raceId);
2677
+ this.db.run(`UPDATE races SET parent_race_id = ?, name = ?, normalized_name = ?, description = ?, is_extinct = ?, settings_json = ?, settings_sections_json = ?, updated_at = ? WHERE id = ?`, parentRaceId, name, normalizedName, input.description ?? String(current.description), input.isExtinct === undefined ? (current.isExtinct ? 1 : 0) : (input.isExtinct ? 1 : 0), JSON.stringify(settings), JSON.stringify(settingsSections), now(), raceId);
2672
2678
  this.syncMarkdownAttachmentReferences(workId, "race", raceId, settingsMarkdownFromList(settings));
2673
2679
  if (nameChanged)
2674
2680
  this.db.run("UPDATE characters SET species = ?, updated_at = ? WHERE race_id = ?", name, now(), raceId);
@@ -2760,6 +2766,7 @@ export class Store {
2760
2766
  parentRaceId: optionalString(row, "parent_race_id"),
2761
2767
  name: requiredString(row, "name"),
2762
2768
  description: requiredString(row, "description"),
2769
+ isExtinct: booleanValue(row, "is_extinct"),
2763
2770
  ...(row.child_count === undefined ? {} : { childCount: numberValue(row, "child_count") }),
2764
2771
  ...(includeMarkdown
2765
2772
  ? { settings, settingsMarkdown: settingsMarkdownFromList(settings), settingsSections }
@@ -2875,8 +2882,8 @@ export class Store {
2875
2882
  const settings = settingsFromKnowledgeSections(settingsSections);
2876
2883
  const timestamp = now();
2877
2884
  this.db.transaction(() => {
2878
- this.db.run(`INSERT INTO organizations (id, work_id, name, normalized_name, description, settings_json, settings_sections_json, created_at, updated_at)
2879
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, organizationId, workId, name, normalizedName, input.description ?? "", JSON.stringify(settings), JSON.stringify(settingsSections), timestamp, timestamp);
2885
+ this.db.run(`INSERT INTO organizations (id, work_id, name, normalized_name, description, is_dissolved, settings_json, settings_sections_json, created_at, updated_at)
2886
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, organizationId, workId, name, normalizedName, input.description ?? "", input.isDissolved ? 1 : 0, JSON.stringify(settings), JSON.stringify(settingsSections), timestamp, timestamp);
2880
2887
  this.syncMarkdownAttachmentReferences(workId, "organization", organizationId, settingsMarkdownFromList(settings));
2881
2888
  this.replaceOrganizationMembers(organizationId, memberIds);
2882
2889
  this.recordMembershipVersions(memberSnapshots, "organization", organizationId, `加入组织“${name}”`);
@@ -2921,7 +2928,7 @@ export class Store {
2921
2928
  const settings = settingsFromKnowledgeSections(settingsSections);
2922
2929
  this.db.transaction(() => {
2923
2930
  this.assertExpectedVersion("organization", organizationId, expectedVersionNo, "组织");
2924
- this.db.run(`UPDATE organizations SET name = ?, normalized_name = ?, description = ?, settings_json = ?, settings_sections_json = ?, updated_at = ? WHERE id = ?`, name, normalizedName, input.description ?? String(current.description), JSON.stringify(settings), JSON.stringify(settingsSections), now(), organizationId);
2931
+ this.db.run(`UPDATE organizations SET name = ?, normalized_name = ?, description = ?, is_dissolved = ?, settings_json = ?, settings_sections_json = ?, updated_at = ? WHERE id = ?`, name, normalizedName, input.description ?? String(current.description), input.isDissolved === undefined ? (current.isDissolved ? 1 : 0) : (input.isDissolved ? 1 : 0), JSON.stringify(settings), JSON.stringify(settingsSections), now(), organizationId);
2925
2932
  this.syncMarkdownAttachmentReferences(workId, "organization", organizationId, settingsMarkdownFromList(settings));
2926
2933
  if (memberIds) {
2927
2934
  this.replaceOrganizationMembers(organizationId, memberIds);
@@ -2997,6 +3004,7 @@ export class Store {
2997
3004
  workId: requiredString(row, "work_id"),
2998
3005
  name: requiredString(row, "name"),
2999
3006
  description: requiredString(row, "description"),
3007
+ isDissolved: booleanValue(row, "is_dissolved"),
3000
3008
  ...(includeMarkdown
3001
3009
  ? { settings, settingsMarkdown: settingsMarkdownFromList(settings), settingsSections }
3002
3010
  : { settings: [], settingsCount: settingsSections.length }),
@@ -3049,6 +3057,7 @@ export class Store {
3049
3057
  delete profile.sections;
3050
3058
  return {
3051
3059
  name: String(character.name),
3060
+ isDead: Boolean(character.isDead),
3052
3061
  code: String(character.code),
3053
3062
  aliases: [...character.aliases],
3054
3063
  raceId: character.raceId,
@@ -3102,8 +3111,8 @@ export class Store {
3102
3111
  this.assertOrganizationsInWork(workId, organizationIds);
3103
3112
  this.db.transaction(() => {
3104
3113
  this.db.run(`INSERT INTO characters (id, work_id, name, code, aliases_json, species, race_id, attributes_json, profile_json, current_state_json,
3105
- locked_fields_json, first_chapter_id, created_at, updated_at)
3106
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, characterId, workId, names.name, input.code?.trim() ?? "", JSON.stringify(names.aliases), species, raceId, JSON.stringify(input.attributes ?? {}), JSON.stringify(input.profile ?? {}), JSON.stringify(input.currentState ?? {}), JSON.stringify(input.lockedFields ?? []), input.firstChapterId ?? null, timestamp, timestamp);
3114
+ is_dead, locked_fields_json, first_chapter_id, created_at, updated_at)
3115
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, characterId, workId, names.name, input.code?.trim() ?? "", JSON.stringify(names.aliases), species, raceId, JSON.stringify(input.attributes ?? {}), JSON.stringify(input.profile ?? {}), JSON.stringify(input.currentState ?? {}), input.isDead ? 1 : 0, JSON.stringify(input.lockedFields ?? []), input.firstChapterId ?? null, timestamp, timestamp);
3107
3116
  this.insertCharacterNames(workId, characterId, names.entries);
3108
3117
  this.replaceCharacterOrganizations(characterId, organizationIds);
3109
3118
  this.insertCharacterVersion(characterId, 1, "create", null, "建立人物档案", timestamp);
@@ -3543,7 +3552,7 @@ export class Store {
3543
3552
  const lockedCurrent = this.getCharacter(characterId);
3544
3553
  this.assertExpectedRevision("character", characterId, expectedVersionNo, "人物", Number(lockedCurrent.versionNo));
3545
3554
  this.db.run(`UPDATE characters SET name = ?, code = ?, aliases_json = ?, species = ?, race_id = ?, attributes_json = ?, profile_json = ?, current_state_json = ?,
3546
- locked_fields_json = ?, first_chapter_id = ?, updated_at = ? WHERE id = ?`, names.name, input.code === undefined ? String(current.code) : input.code.trim(), JSON.stringify(names.aliases), species, raceId, JSON.stringify(attributes), JSON.stringify(input.profile ?? current.profile), JSON.stringify(input.currentState ?? current.currentState), JSON.stringify(input.lockedFields ?? current.lockedFields), input.firstChapterId === undefined ? current.firstChapterId : input.firstChapterId, now(), characterId);
3555
+ is_dead = ?, locked_fields_json = ?, first_chapter_id = ?, updated_at = ? WHERE id = ?`, names.name, input.code === undefined ? String(current.code) : input.code.trim(), JSON.stringify(names.aliases), species, raceId, JSON.stringify(attributes), JSON.stringify(input.profile ?? current.profile), JSON.stringify(input.currentState ?? current.currentState), input.isDead === undefined ? (current.isDead ? 1 : 0) : (input.isDead ? 1 : 0), JSON.stringify(input.lockedFields ?? current.lockedFields), input.firstChapterId === undefined ? current.firstChapterId : input.firstChapterId, now(), characterId);
3547
3556
  this.db.run("DELETE FROM character_names WHERE character_id = ?", characterId);
3548
3557
  this.insertCharacterNames(workId, characterId, names.entries);
3549
3558
  if (organizationIds)
@@ -3612,7 +3621,7 @@ export class Store {
3612
3621
  this.assertExpectedRevision("character", characterId, expectedVersionNo, "人物", this.currentCharacterVersionNo(characterId));
3613
3622
  return this.recreateCharacterFromVersion(characterId, version, snapshot, versionNo);
3614
3623
  }
3615
- return this.updateCharacter(characterId, { ...snapshot, code: snapshot.code ?? "" }, "restore", requiredString(version, "id"), `恢复至 v${versionNo}`, expectedVersionNo);
3624
+ return this.updateCharacter(characterId, { ...snapshot, isDead: snapshot.isDead ?? false, code: snapshot.code ?? "" }, "restore", requiredString(version, "id"), `恢复至 v${versionNo}`, expectedVersionNo);
3616
3625
  }
3617
3626
  recreateCharacterFromVersion(characterId, version, snapshot, versionNo) {
3618
3627
  const workId = requiredString(version, "work_id");
@@ -3630,8 +3639,8 @@ export class Store {
3630
3639
  const nextVersionNo = numberValue(this.db.get("SELECT COALESCE(MAX(version_no), 0) AS version_no FROM character_versions WHERE character_id = ?", characterId) ?? {}, "version_no") + 1;
3631
3640
  this.db.transaction(() => {
3632
3641
  this.db.run(`INSERT INTO characters (id, work_id, name, code, aliases_json, species, race_id, attributes_json, profile_json, current_state_json,
3633
- locked_fields_json, first_chapter_id, version_no, created_at, updated_at)
3634
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, characterId, workId, names.name, snapshot.code ?? "", JSON.stringify(names.aliases), species, raceId, JSON.stringify(snapshot.attributes ?? {}), JSON.stringify(snapshot.profile ?? {}), JSON.stringify(snapshot.currentState ?? {}), JSON.stringify(snapshot.lockedFields ?? []), snapshot.firstChapterId ?? null, nextVersionNo, timestamp, timestamp);
3642
+ is_dead, locked_fields_json, first_chapter_id, version_no, created_at, updated_at)
3643
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, characterId, workId, names.name, snapshot.code ?? "", JSON.stringify(names.aliases), species, raceId, JSON.stringify(snapshot.attributes ?? {}), JSON.stringify(snapshot.profile ?? {}), JSON.stringify(snapshot.currentState ?? {}), snapshot.isDead ? 1 : 0, JSON.stringify(snapshot.lockedFields ?? []), snapshot.firstChapterId ?? null, nextVersionNo, timestamp, timestamp);
3635
3644
  this.insertCharacterNames(workId, characterId, names.entries);
3636
3645
  this.replaceCharacterOrganizations(characterId, organizationIds);
3637
3646
  this.insertCharacterVersion(characterId, nextVersionNo, "restore", requiredString(version, "id"), `恢复至 v${versionNo}`, timestamp, workId);
@@ -3670,12 +3679,13 @@ export class Store {
3670
3679
  }
3671
3680
  mapCharacter(row, includeProfileSections = true, includeRaceMarkdown = true) {
3672
3681
  const indexedAliases = this.db.all("SELECT display_name FROM character_names WHERE character_id = ? AND kind = 'alias' ORDER BY sort_order", requiredString(row, "id")).map((item) => requiredString(item, "display_name"));
3673
- const organizations = this.db.all(`SELECT o.id, o.name, m.role, m.note
3682
+ const organizations = this.db.all(`SELECT o.id, o.name, o.is_dissolved, m.role, m.note
3674
3683
  FROM character_organization_memberships m
3675
3684
  JOIN organizations o ON o.id = m.organization_id
3676
3685
  WHERE m.character_id = ? ORDER BY o.name`, requiredString(row, "id")).map((item) => ({
3677
3686
  organizationId: requiredString(item, "id"),
3678
3687
  name: requiredString(item, "name"),
3688
+ isDissolved: booleanValue(item, "is_dissolved"),
3679
3689
  role: requiredString(item, "role"),
3680
3690
  note: requiredString(item, "note")
3681
3691
  }));
@@ -3712,6 +3722,7 @@ export class Store {
3712
3722
  race: race ? {
3713
3723
  id: String(race.id),
3714
3724
  name: species,
3725
+ isExtinct: race.isExtinct,
3715
3726
  lineage: race.lineage,
3716
3727
  effectiveSettings: race.effectiveSettings
3717
3728
  } : null,
@@ -3722,6 +3733,7 @@ export class Store {
3722
3733
  profile,
3723
3734
  profileSectionCount,
3724
3735
  currentState: json(requiredString(row, "current_state_json"), {}),
3736
+ isDead: booleanValue(row, "is_dead"),
3725
3737
  lockedFields: json(requiredString(row, "locked_fields_json"), []),
3726
3738
  firstChapterId: optionalString(row, "first_chapter_id"),
3727
3739
  mergedIntoCharacterId: optionalString(row, "merged_into_character_id"),
@@ -6044,14 +6056,14 @@ export class Store {
6044
6056
  ), character_race_paths AS (
6045
6057
  SELECT character_id, path FROM character_race_lineage WHERE parent_race_id IS NULL
6046
6058
  )
6047
- SELECT character.id, character.name, character.aliases_json, character.species,
6059
+ SELECT character.id, character.name, character.aliases_json, character.species, character.is_dead,
6048
6060
  COALESCE(path.path, character.species) AS race_path
6049
6061
  FROM characters character LEFT JOIN character_race_paths path ON path.character_id = character.id
6050
6062
  WHERE character.work_id = ? AND (
6051
6063
  character.name LIKE ? ESCAPE '\\' OR character.aliases_json LIKE ? ESCAPE '\\' OR character.species LIKE ? ESCAPE '\\'
6052
6064
  OR EXISTS (SELECT 1 FROM character_race_lineage lineage WHERE lineage.character_id = character.id AND lineage.name LIKE ? ESCAPE '\\')
6053
6065
  ) LIMIT 50`, workId, workId, pattern, pattern, pattern, pattern);
6054
- const organizations = this.db.all("SELECT id, name, description, settings_json FROM organizations WHERE work_id = ? AND (name LIKE ? ESCAPE '\\' OR description LIKE ? ESCAPE '\\' OR settings_json LIKE ? ESCAPE '\\') LIMIT 50", workId, pattern, pattern, pattern);
6066
+ const organizations = this.db.all("SELECT id, name, description, is_dissolved, settings_json FROM organizations WHERE work_id = ? AND (name LIKE ? ESCAPE '\\' OR description LIKE ? ESCAPE '\\' OR settings_json LIKE ? ESCAPE '\\') LIMIT 50", workId, pattern, pattern, pattern);
6055
6067
  const characterSections = this.searchCharacterProfileSections(workId, query, 30);
6056
6068
  const snippet = (content) => {
6057
6069
  const index = content.toLocaleLowerCase().indexOf(query.toLocaleLowerCase());
@@ -6064,7 +6076,8 @@ export class Store {
6064
6076
  id: requiredString(row, "id"),
6065
6077
  title: requiredString(row, "name"),
6066
6078
  snippet: [requiredString(row, "race_path"), ...json(requiredString(row, "aliases_json"), [])].filter(Boolean).join("、"),
6067
- racePath: requiredString(row, "race_path")
6079
+ racePath: requiredString(row, "race_path"),
6080
+ isDead: booleanValue(row, "is_dead")
6068
6081
  })),
6069
6082
  ...characterSections.map((section) => ({
6070
6083
  type: "character",
@@ -6072,7 +6085,8 @@ export class Store {
6072
6085
  sectionId: String(section.id),
6073
6086
  title: `${String(section.characterName)} / ${String(section.title)}`,
6074
6087
  snippet: snippet(String(section.contentMarkdown)),
6075
- sectionType: String(section.sectionType)
6088
+ sectionType: String(section.sectionType),
6089
+ isDead: Boolean(this.getCharacter(String(section.characterId)).isDead)
6076
6090
  })),
6077
6091
  ...settings.map((row) => ({ type: "setting", id: requiredString(row, "id"), title: requiredString(row, "title"), snippet: snippet(requiredString(row, "content")), category: requiredString(row, "category") })),
6078
6092
  ...races.map((race) => {
@@ -6083,11 +6097,12 @@ export class Store {
6083
6097
  id: String(race.id),
6084
6098
  title: String(race.name),
6085
6099
  snippet: snippet(`${lineage.map((item) => item.name).join(" / ")}\n${String(race.description)}\n${effectiveSettings.map((item) => `${item.sourceRaceName}:${item.value}`).join("\n")}`),
6100
+ isExtinct: Boolean(race.isExtinct),
6086
6101
  lineage,
6087
6102
  effectiveSettings
6088
6103
  };
6089
6104
  }),
6090
- ...organizations.map((row) => ({ type: "organization", id: requiredString(row, "id"), title: requiredString(row, "name"), snippet: snippet(`${requiredString(row, "description")}\n${json(requiredString(row, "settings_json"), []).join("\n")}`) })),
6105
+ ...organizations.map((row) => ({ type: "organization", id: requiredString(row, "id"), title: requiredString(row, "name"), snippet: snippet(`${requiredString(row, "description")}\n${json(requiredString(row, "settings_json"), []).join("\n")}`), isDissolved: booleanValue(row, "is_dissolved") })),
6091
6106
  ...chapters.map((row) => ({ type: "chapter", id: requiredString(row, "id"), title: requiredString(row, "title"), snippet: snippet(requiredString(row, "content")), volumeId: requiredString(row, "volume_id") }))
6092
6107
  ];
6093
6108
  }