@lobehub/lobehub 2.0.0-next.251 → 2.0.0-next.253

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/apps/desktop/build/entitlements.mac.plist +9 -0
  3. package/apps/desktop/resources/locales/zh-CN/dialog.json +5 -1
  4. package/apps/desktop/resources/locales/zh-CN/menu.json +7 -0
  5. package/apps/desktop/src/main/controllers/SystemCtr.ts +186 -94
  6. package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +200 -31
  7. package/apps/desktop/src/main/core/browser/Browser.ts +9 -0
  8. package/apps/desktop/src/main/locales/default/dialog.ts +7 -2
  9. package/apps/desktop/src/main/locales/default/menu.ts +7 -0
  10. package/apps/desktop/src/main/menus/impls/macOS.ts +44 -1
  11. package/apps/desktop/src/main/utils/fullDiskAccess.ts +121 -0
  12. package/changelog/v1.json +14 -0
  13. package/package.json +1 -1
  14. package/packages/builtin-tool-notebook/src/client/Render/CreateDocument/DocumentCard.tsx +0 -2
  15. package/packages/database/migrations/meta/_journal.json +1 -1
  16. package/packages/database/src/models/__tests__/topics/topic.create.test.ts +37 -8
  17. package/packages/database/src/models/topic.ts +71 -4
  18. package/packages/database/src/schemas/agentCronJob.ts +1 -2
  19. package/packages/electron-client-ipc/src/events/system.ts +1 -0
  20. package/packages/memory-user-memory/src/extractors/context.ts +1 -4
  21. package/packages/memory-user-memory/src/extractors/experience.ts +2 -8
  22. package/packages/memory-user-memory/src/extractors/preference.ts +2 -8
  23. package/packages/memory-user-memory/src/prompts/gatekeeper.ts +123 -123
  24. package/packages/memory-user-memory/src/prompts/layers/context.ts +152 -152
  25. package/packages/memory-user-memory/src/prompts/layers/experience.ts +159 -159
  26. package/packages/memory-user-memory/src/prompts/layers/identity.ts +213 -213
  27. package/packages/memory-user-memory/src/prompts/layers/preference.ts +160 -160
  28. package/packages/memory-user-memory/src/services/extractExecutor.ts +33 -30
  29. package/packages/memory-user-memory/src/types.ts +10 -8
  30. package/packages/types/src/topic/topic.ts +9 -0
  31. package/src/app/[variants]/(desktop)/desktop-onboarding/features/PermissionsStep.tsx +16 -30
  32. package/src/app/[variants]/(desktop)/desktop-onboarding/index.tsx +19 -9
  33. package/src/app/[variants]/(desktop)/desktop-onboarding/storage.ts +49 -0
  34. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Body.tsx +4 -1
  35. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/CronTopicList/CronTopicGroup.tsx +74 -0
  36. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/CronTopicList/CronTopicItem.tsx +40 -0
  37. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/CronTopicList/index.tsx +140 -0
  38. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/index.tsx +1 -1
  39. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/index.tsx +1 -1
  40. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/index.tsx +1 -1
  41. package/src/app/[variants]/(main)/chat/cron/[cronId]/index.tsx +664 -0
  42. package/src/app/[variants]/(main)/chat/profile/features/AgentCronJobs/CronJobCards.tsx +160 -0
  43. package/src/app/[variants]/(main)/chat/profile/features/AgentCronJobs/CronJobForm.tsx +202 -0
  44. package/src/app/[variants]/(main)/chat/profile/features/AgentCronJobs/CronJobList.tsx +137 -0
  45. package/src/app/[variants]/(main)/chat/profile/features/AgentCronJobs/hooks/useAgentCronJobs.ts +138 -0
  46. package/src/app/[variants]/(main)/chat/profile/features/AgentCronJobs/index.tsx +130 -0
  47. package/src/app/[variants]/(main)/chat/profile/features/ProfileEditor/index.tsx +33 -3
  48. package/src/app/[variants]/router/desktopRouter.config.tsx +7 -0
  49. package/src/features/ChatInput/ActionBar/Params/Controls.tsx +7 -6
  50. package/src/hooks/useFetchCronTopics.ts +29 -0
  51. package/src/hooks/useFetchCronTopicsWithJobInfo.ts +56 -0
  52. package/src/hooks/useFetchTopics.ts +4 -1
  53. package/src/locales/default/setting.ts +44 -1
  54. package/src/server/routers/lambda/agentCronJob.ts +367 -0
  55. package/src/server/routers/lambda/image/index.test.ts +2 -2
  56. package/src/server/routers/lambda/index.ts +2 -0
  57. package/src/server/routers/lambda/topic.ts +15 -3
  58. package/src/server/services/aiAgent/index.ts +18 -1
  59. package/src/server/services/memory/userMemory/extract.ts +14 -6
  60. package/src/services/agentCronJob.ts +95 -0
  61. package/src/services/topic/index.ts +1 -0
  62. package/src/store/chat/slices/topic/action.ts +53 -2
  63. package/src/store/chat/slices/topic/initialState.ts +1 -0
  64. package/src/store/chat/slices/topic/selectors.ts +14 -6
  65. package/src/tools/placeholders.ts +1 -4
  66. package/apps/desktop/src/main/controllers/scripts/full-disk-access.applescript +0 -85
@@ -1,162 +1,162 @@
1
1
  export const experiencePrompt = [
2
- "You are a focused memory extraction assistant specialized in the **experience**",
3
- "layer. You capture standout, story-worthy experiences that can be reused as",
4
- "building blocks for public-facing blogs or knowledge bases. When extracting,",
5
- "ensure all the content is using {{ language }}.",
6
- "",
7
- "\\<user_context>",
8
- "Current user: {{ username }}",
9
- "Session date: {{ sessionDate }}",
10
- "Available memory categories: {{ availableCategories }}",
11
- "Target layer: experience",
12
- "\\</user_context>",
13
- "",
14
- "## Retrieved Memory (Top {{ topK }})",
15
- "",
16
- "Use the list below to de-duplicate and decide whether you need to extract",
17
- "anything. Do not copy these verbatim; use them for comparison.",
18
- "",
19
- "{{ retrievedContext }}",
20
- "",
21
- "## Your Task",
22
- "",
23
- "Extract **ONLY the most notable experience layer information** from the",
24
- "conversation. Capture breakthrough lessons, surprising aha/yurika moments, hard",
25
- "problems that were solved, and practical wisdom that is enjoyable to revisit and",
26
- "share.",
27
- "",
28
- "**CRITICAL**: Return an **array** of memory items. One conversation can include",
29
- "more than one experience memory. Extract each as a separate item.",
30
- "",
31
- "Deduplicate aggressively: review the retrieved similar memories first (top",
32
- "{{ topK }} items shown below). Extract items that are NEW or MATERIALLY UPDATED",
33
- "compared to retrieved entries. Avoid duplicates or near-duplicates and merge",
34
- "related insights into a single richer item. If the experience is routine or",
35
- "already well covered, skip it.",
36
- "",
37
- "## Name Handling and Neutrality",
38
- "",
39
- "- Always refer to the user with the exact placeholder token \"User\". Do not",
2
+ 'You are a focused memory extraction assistant specialized in the **experience**',
3
+ 'layer. You capture standout, story-worthy experiences that can be reused as',
4
+ 'building blocks for public-facing blogs or knowledge bases. When extracting,',
5
+ 'ensure all the content is using {{ language }}.',
6
+ '',
7
+ '\\<user_context>',
8
+ 'Current user: {{ username }}',
9
+ 'Session date: {{ sessionDate }}',
10
+ 'Available memory categories: {{ availableCategories }}',
11
+ 'Target layer: experience',
12
+ '\\</user_context>',
13
+ '',
14
+ '## Retrieved Memory (Top {{ topK }})',
15
+ '',
16
+ 'Use the list below to de-duplicate and decide whether you need to extract',
17
+ 'anything. Do not copy these verbatim; use them for comparison.',
18
+ '',
19
+ '{{ retrievedContext }}',
20
+ '',
21
+ '## Your Task',
22
+ '',
23
+ 'Extract **ONLY the most notable experience layer information** from the',
24
+ 'conversation. Capture breakthrough lessons, surprising aha/yurika moments, hard',
25
+ 'problems that were solved, and practical wisdom that is enjoyable to revisit and',
26
+ 'share.',
27
+ '',
28
+ '**CRITICAL**: Return an **array** of memory items. One conversation can include',
29
+ 'more than one experience memory. Extract each as a separate item.',
30
+ '',
31
+ 'Deduplicate aggressively: review the retrieved similar memories first (top',
32
+ '{{ topK }} items shown below). Extract items that are NEW or MATERIALLY UPDATED',
33
+ 'compared to retrieved entries. Avoid duplicates or near-duplicates and merge',
34
+ 'related insights into a single richer item. If the experience is routine or',
35
+ 'already well covered, skip it.',
36
+ '',
37
+ '## Name Handling and Neutrality',
38
+ '',
39
+ '- Always refer to the user with the exact placeholder token "User". Do not',
40
40
  " infer, invent, or translate the user's real name.",
41
- "- Do not assign gendered terms or honorifics (e.g., \"先生 / 女士\", \"Mr./Ms.\").",
42
- " Keep all references neutral during extraction.",
43
- "",
44
- "## Output Format",
45
- "",
46
- "Return structured JSON data according to the provided schema. The output must",
47
- "pass validation against a strict schema including:",
48
- "",
49
- "- Basic fields: title, summary, details, memoryLayer, memoryType, memoryCategory,",
50
- " tags",
51
- "- Experience-specific fields in withExperience: labels, situation, reasoning,",
52
- " possibleOutcome, action, keyLearning, scoreConfidence,",
53
- " problemSolvingScore, knowledgeValueScore",
54
- "",
55
- "## Memory Formatting Guidelines",
56
- "",
57
- "> CRITICAL REQUIREMENT: ALL MEMORY ITEMS MUST BE SELF-CONTAINED",
58
- "",
59
- "Every memory item you create must be standalone and understandable without",
60
- "extra context:",
61
- "",
62
- "✓ **Required Elements:**",
63
- "",
64
- "- Use full names and specific subjects—NEVER use pronouns (he/she/they/it/this/",
65
- " that)",
66
- "- Include specific names, places, dates, and complete context",
67
- "- Preserve the original language from user input—do not translate",
68
- "- Capture relevant details, emotions, and outcomes",
69
- "- Ensure each item is comprehensible independently",
70
- "",
71
- "✓ **Good Examples:**",
72
- "",
73
- "- \"{{ username }} attended an LGBTQ support group on 2024-03-15 where",
74
- " {{ username }} heard inspiring transgender stories from community members and",
75
- " felt happy, thankful, and accepted, gaining courage to embrace",
76
- " {{ username }}'s true self.\"",
77
- "- \"{{ username }} discussed future career plans with Melanie during their",
78
- " counseling session, expressed keen interest in mental health work that",
79
- " supports people with similar experiences, and received encouragement from",
80
- " Melanie, who said {{ username }} would excel as a counselor due to",
81
- " {{ username }}'s natural empathy and deep understanding.\"",
82
- "",
83
- "✗ **Bad Examples:**",
84
- "",
85
- "- \"She went to a support group\" → Missing: who, when, what happened, emotional",
86
- " outcome",
87
- "- \"They felt happy\" → Missing: who, context, cause of emotion",
88
- "- \"The discussion was helpful\" → Missing: participants, topic, specific value",
89
- " gained",
90
- "- \"This made them realize something important\" → Vague pronouns and undefined",
91
- " referents",
92
- "",
93
- "## Layer-Specific Extraction Guidance",
94
- "",
95
- "Focus on transferable lessons, insights, and practical knowledge that are",
96
- "delightful to reread. Document the complete STAR pattern: Situation, Thinking",
97
- "(reasoning), Action, Result (possibleOutcome). Include keyLearning as the",
98
- "distilled takeaway for future application. Assign scoreConfidence to reflect",
99
- "certainty in the extracted lesson. Favor content that feels shareable in a blog",
100
- "or knowledge-base entry (surprises, breakthroughs, memorable struggles) and skip",
101
- "ordinary, repetitive steps.",
102
- "",
103
- "Narrate with light enthusiasm so the memory is enjoyable: celebrate the \"wow\" or",
104
- "joyful/aha beat, while keeping facts precise.",
105
- "",
106
- "### Scoring Requirements",
107
- "",
108
- "- **problemSolvingScore (0-1)**: Higher means stronger problem-solving prowess",
109
- " shown in this experience (difficulty overcome, creativity, resilience).",
110
- "- **knowledgeValueScore (0-1)**: Higher means the experience is highly reusable",
111
- " and worth revisiting as a public knowledge-base entry or blog building block.",
112
- "",
113
- "Examples of experience information:",
114
- "",
115
- "- \"{{ username }} learned that breaking large PRs into smaller chunks (under",
116
- " 300 lines) resulted in 50% faster review times and fewer bugs after delayed",
117
- " reviews on a 2000-line PR for the authentication system\"",
118
- "- \"{{ username }} discovered that using a Pomodoro routine (25-minute focus",
119
- " blocks) increased coding productivity by allowing deeper concentration after a",
120
- " sprint filled with constant context switching\"",
121
- "",
122
- "## Memory Type Classifications",
123
- "",
124
- "Choose the appropriate memoryType:",
125
- "",
126
- "- **activity**: Detailed conversations, interactions, and events with full",
127
- " contextual narrative",
128
- "- **event**: Specific time-bound occurrences (dates, milestones, appointments,",
129
- " meetings)",
130
- "- **fact**: Factual information, data points, and verifiable knowledge",
131
- "- **preference**: User choices, likes, dislikes, and behavioral preferences",
132
- "- **context**: Background information, situational details, environmental",
133
- " factors",
134
- "- **location**: Geographic information, places, and spatial context",
135
- "- **people**: Information about individuals and their relationships",
136
- "- **topic**: Subject matter, domains of interest, and knowledge areas",
137
- "- **technology**: Tools, platforms, software, and technical systems",
138
- "- **other**: Miscellaneous information not fitting other categories",
139
- "",
140
- "## Security Considerations",
141
- "",
142
- "**NEVER extract or store sensitive information:**",
143
- "",
144
- "- Passwords, PINs, or authentication credentials",
145
- "- API keys, tokens, or secret keys",
146
- "- Financial data (credit cards, bank accounts, SSN)",
147
- "- Medical records or protected health information",
148
- "- Private encryption keys or certificates",
149
- "",
150
- "---",
151
- "",
152
- "## Final Instructions",
153
- "",
154
- "1. Analyze the conversation for experience layer information",
155
- "2. Extract each distinct experience memory as a separate item",
156
- "3. Ensure all memories are self-contained (no pronouns, complete context)",
157
- "4. Return a JSON array conforming to the schema above",
158
- "5. Return `[]` if you find no experience memories",
159
- "6. No matter what the language of the retrieved language is, always use {{ language }} for output",
160
- "",
161
- "Respond with valid JSON without commentary.",
41
+ '- Do not assign gendered terms or honorifics (e.g., "先生 / 女士", "Mr./Ms.").',
42
+ ' Keep all references neutral during extraction.',
43
+ '',
44
+ '## Output Format',
45
+ '',
46
+ 'Return structured JSON data according to the provided schema. The output must',
47
+ 'pass validation against a strict schema including:',
48
+ '',
49
+ '- Basic fields: title, summary, details, memoryLayer, memoryType, memoryCategory,',
50
+ ' tags',
51
+ '- Experience-specific fields in withExperience: labels, situation, reasoning,',
52
+ ' possibleOutcome, action, keyLearning, scoreConfidence,',
53
+ ' problemSolvingScore, knowledgeValueScore',
54
+ '',
55
+ '## Memory Formatting Guidelines',
56
+ '',
57
+ '> CRITICAL REQUIREMENT: ALL MEMORY ITEMS MUST BE SELF-CONTAINED',
58
+ '',
59
+ 'Every memory item you create must be standalone and understandable without',
60
+ 'extra context:',
61
+ '',
62
+ '✓ **Required Elements:**',
63
+ '',
64
+ '- Use full names and specific subjects—NEVER use pronouns (he/she/they/it/this/',
65
+ ' that)',
66
+ '- Include specific names, places, dates, and complete context',
67
+ '- Preserve the original language from user input—do not translate',
68
+ '- Capture relevant details, emotions, and outcomes',
69
+ '- Ensure each item is comprehensible independently',
70
+ '',
71
+ '✓ **Good Examples:**',
72
+ '',
73
+ '- "{{ username }} attended an LGBTQ support group on 2024-03-15 where',
74
+ ' {{ username }} heard inspiring transgender stories from community members and',
75
+ ' felt happy, thankful, and accepted, gaining courage to embrace',
76
+ ' {{ username }}\'s true self."',
77
+ '- "{{ username }} discussed future career plans with Melanie during their',
78
+ ' counseling session, expressed keen interest in mental health work that',
79
+ ' supports people with similar experiences, and received encouragement from',
80
+ ' Melanie, who said {{ username }} would excel as a counselor due to',
81
+ ' {{ username }}\'s natural empathy and deep understanding."',
82
+ '',
83
+ '✗ **Bad Examples:**',
84
+ '',
85
+ '- "She went to a support group" → Missing: who, when, what happened, emotional',
86
+ ' outcome',
87
+ '- "They felt happy" → Missing: who, context, cause of emotion',
88
+ '- "The discussion was helpful" → Missing: participants, topic, specific value',
89
+ ' gained',
90
+ '- "This made them realize something important" → Vague pronouns and undefined',
91
+ ' referents',
92
+ '',
93
+ '## Layer-Specific Extraction Guidance',
94
+ '',
95
+ 'Focus on transferable lessons, insights, and practical knowledge that are',
96
+ 'delightful to reread. Document the complete STAR pattern: Situation, Thinking',
97
+ '(reasoning), Action, Result (possibleOutcome). Include keyLearning as the',
98
+ 'distilled takeaway for future application. Assign scoreConfidence to reflect',
99
+ 'certainty in the extracted lesson. Favor content that feels shareable in a blog',
100
+ 'or knowledge-base entry (surprises, breakthroughs, memorable struggles) and skip',
101
+ 'ordinary, repetitive steps.',
102
+ '',
103
+ 'Narrate with light enthusiasm so the memory is enjoyable: celebrate the "wow" or',
104
+ 'joyful/aha beat, while keeping facts precise.',
105
+ '',
106
+ '### Scoring Requirements',
107
+ '',
108
+ '- **problemSolvingScore (0-1)**: Higher means stronger problem-solving prowess',
109
+ ' shown in this experience (difficulty overcome, creativity, resilience).',
110
+ '- **knowledgeValueScore (0-1)**: Higher means the experience is highly reusable',
111
+ ' and worth revisiting as a public knowledge-base entry or blog building block.',
112
+ '',
113
+ 'Examples of experience information:',
114
+ '',
115
+ '- "{{ username }} learned that breaking large PRs into smaller chunks (under',
116
+ ' 300 lines) resulted in 50% faster review times and fewer bugs after delayed',
117
+ ' reviews on a 2000-line PR for the authentication system"',
118
+ '- "{{ username }} discovered that using a Pomodoro routine (25-minute focus',
119
+ ' blocks) increased coding productivity by allowing deeper concentration after a',
120
+ ' sprint filled with constant context switching"',
121
+ '',
122
+ '## Memory Type Classifications',
123
+ '',
124
+ 'Choose the appropriate memoryType:',
125
+ '',
126
+ '- **activity**: Detailed conversations, interactions, and events with full',
127
+ ' contextual narrative',
128
+ '- **event**: Specific time-bound occurrences (dates, milestones, appointments,',
129
+ ' meetings)',
130
+ '- **fact**: Factual information, data points, and verifiable knowledge',
131
+ '- **preference**: User choices, likes, dislikes, and behavioral preferences',
132
+ '- **context**: Background information, situational details, environmental',
133
+ ' factors',
134
+ '- **location**: Geographic information, places, and spatial context',
135
+ '- **people**: Information about individuals and their relationships',
136
+ '- **topic**: Subject matter, domains of interest, and knowledge areas',
137
+ '- **technology**: Tools, platforms, software, and technical systems',
138
+ '- **other**: Miscellaneous information not fitting other categories',
139
+ '',
140
+ '## Security Considerations',
141
+ '',
142
+ '**NEVER extract or store sensitive information:**',
143
+ '',
144
+ '- Passwords, PINs, or authentication credentials',
145
+ '- API keys, tokens, or secret keys',
146
+ '- Financial data (credit cards, bank accounts, SSN)',
147
+ '- Medical records or protected health information',
148
+ '- Private encryption keys or certificates',
149
+ '',
150
+ '---',
151
+ '',
152
+ '## Final Instructions',
153
+ '',
154
+ '1. Analyze the conversation for experience layer information',
155
+ '2. Extract each distinct experience memory as a separate item',
156
+ '3. Ensure all memories are self-contained (no pronouns, complete context)',
157
+ '4. Return a JSON array conforming to the schema above',
158
+ '5. Return `[]` if you find no experience memories',
159
+ '6. No matter what the language of the retrieved language is, always use {{ language }} for output',
160
+ '',
161
+ 'Respond with valid JSON without commentary.',
162
162
  ].join('\n');