Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: use Market task template recommendations (#15558)

YuTengjing4595f86e4192
diff --git a/.agents/skills/agent-testing/references/auth.md b/.agents/skills/agent-testing/references/auth.md
index d262ad47234..26b0868f812 100644
--- a/.agents/skills/agent-testing/references/auth.md
+++ b/.agents/skills/agent-testing/references/auth.md
@@ -112,9 +112,14 @@ secret: don't paste it into shared logs, PRs, or commit it anywhere.
1. `$SCRIPT status --surface web` — green? Start testing. Do not ask for a Cookie header.
2. Not green and using the seeded local env → `$SCRIPT web-seed`.
-3. Still not green or not using the seed env → `$SCRIPT open-chrome` opens Chrome at `SERVER_URL` with DevTools.
-4. User copies the `Cookie:` header from Network tab → any same-origin request → Request Headers → right-click `Cookie:` → **Copy value**. Must be from Network, NOT `document.cookie` (HttpOnly cookies are invisible to `document.cookie`).
-5. `pbpaste | $SCRIPT web` — filters to better-auth cookies (`session_token`, `session_data`, `state`), builds Playwright `storageState`, loads it into the `agent-browser` session (`lobehub-dev`), opens `SERVER_URL`, and asserts the URL is not `/signin`.
+3. If repo-root `.env` exists and `web-seed` fails, do **not** seed or modify the current DB; treat it as an existing local environment and use Cookie injection.
+4. Still not green or not using the seed env → `$SCRIPT open-chrome` opens Chrome at `SERVER_URL` with DevTools.
+5. User copies the `Cookie:` header from Network tab → any same-origin request → Request Headers → right-click `Cookie:` → **Copy value**. Must be from Network, NOT `document.cookie` (HttpOnly cookies are invisible to `document.cookie`).
+6. `pbpaste | $SCRIPT web` — filters to better-auth cookies (`session_token`, `session_data`, `state`), builds Playwright `storageState`, loads it into the `agent-browser` session (`lobehub-dev`), opens `SERVER_URL`, and asserts the URL is not `/signin`.
+
+`ENABLE_MOCK_DEV_USER` is not Web auth. It only affects server-side API context
+and does not satisfy Better Auth or stop the SPA from redirecting to `/signin`.
+Do not use it as a substitute for `status --surface web` or Cookie injection.
### Using the authenticated session
diff --git a/.agents/skills/agent-testing/scripts/setup-auth.sh b/.agents/skills/agent-testing/scripts/setup-auth.sh
index a068500a1c9..64132d39ff7 100755
--- a/.agents/skills/agent-testing/scripts/setup-auth.sh
+++ b/.agents/skills/agent-testing/scripts/setup-auth.sh
@@ -81,6 +81,7 @@ SERVER_URL="${SERVER_URL:-$(default_server_url)}"
SESSION="${SESSION:-lobehub-dev}"
AUTH_DIR="${AUTH_DIR:-$HOME/.lobehub-agent-testing}"
STATE_FILE="$AUTH_DIR/web-state.json"
+ROOT_ENV_FILE="$REPO_ROOT/.env"
CLI_HOME_NAME="${LOBEHUB_CLI_HOME:-.lobehub-dev}"
CLI_HOME="$HOME/${CLI_HOME_NAME#/}"
CLI_CREDENTIALS_FILE="$CLI_HOME/credentials.json"
@@ -481,8 +482,13 @@ PY
if [[ ! "$code" =~ ^[23] ]]; then
bad "seed user sign-in failed at $SERVER_URL/api/auth/sign-in/email (http_code='$code')"
- note "make sure the seed user exists:"
- note "./.agents/skills/agent-testing/scripts/init-dev-env.sh seed-user"
+ if [[ -f "$ROOT_ENV_FILE" ]]; then
+ note "root .env exists; do not seed or modify this DB for Web auth."
+ note "Use Chrome Cookie injection instead: $0 open-chrome, then pbpaste | $0 web"
+ else
+ note "make sure the seed user exists:"
+ note "./.agents/skills/agent-testing/scripts/init-dev-env.sh seed-user"
+ fi
return 1
fi
@@ -517,6 +523,7 @@ cmd_web_verify() {
bad "failed to open $SERVER_URL in agent-browser session '$SESSION'"
return 1
fi
+ agent-browser --session "$SESSION" wait --load networkidle > /dev/null 2>&1 || true
local url
url=$(agent-browser --session "$SESSION" get url 2> /dev/null || true)
if [[ -z "$url" ]]; then
diff --git a/apps/server/src/routers/lambda/taskTemplate.ts b/apps/server/src/routers/lambda/taskTemplate.ts
index fdd9fab034a..e718071d329 100644
--- a/apps/server/src/routers/lambda/taskTemplate.ts
+++ b/apps/server/src/routers/lambda/taskTemplate.ts
@@ -1,21 +1,22 @@
-import { KNOWN_TASK_TEMPLATE_IDS } from '@lobechat/const';
+import { TASK_TEMPLATE_RECOMMEND_MAX_COUNT } from '@lobechat/const';
import { TRPCError } from '@trpc/server';
import { z } from 'zod';
import { authedProcedure, router } from '@/libs/trpc/lambda';
-import { ENABLED_SKILL_SOURCES, TaskTemplateService } from '@/server/services/taskTemplate';
+import {
+ ENABLED_TASK_TEMPLATE_CONNECTORS,
+ TaskTemplateService,
+} from '@/server/services/taskTemplate';
const listDailyRecommendSchema = z.object({
- count: z.number().int().min(1).optional(),
+ count: z.number().int().min(1).max(TASK_TEMPLATE_RECOMMEND_MAX_COUNT).optional(),
interestKeys: z.array(z.string().max(64)).max(32),
+ locale: z.string().max(32).optional(),
refreshSeed: z.string().min(1).max(32).optional(),
});
const templateIdSchema = z.object({
- templateId: z
- .string()
- .max(64)
- .refine((id) => KNOWN_TASK_TEMPLATE_IDS.has(id), { message: 'Unknown task template id' }),
+ templateId: z.number().int().positive(),
});
export const taskTemplateRouter = router({
@@ -28,7 +29,8 @@ export const taskTemplateRouter = router({
const service = new TaskTemplateService(ctx.userId);
const data = await service.listDailyRecommend(input.interestKeys, {
count: input.count,
- enabledSkillSources: ENABLED_SKILL_SOURCES,
+ enabledConnectors: ENABLED_TASK_TEMPLATE_CONNECTORS,
+ locale: input.locale,
refreshSeed: input.refreshSeed,
});
return { data, success: true };
diff --git a/apps/server/src/services/taskTemplate/index.test.ts b/apps/server/src/services/taskTemplate/index.test.ts
index 37bc88d31d8..9ce539c99db 100644
--- a/apps/server/src/services/taskTemplate/index.test.ts
+++ b/apps/server/src/services/taskTemplate/index.test.ts
@@ -1,303 +1,162 @@
// @vitest-environment node
-import type { TaskTemplate } from '@lobechat/const';
-import {
- TASK_TEMPLATE_PERSONAL_ONLY_CATEGORIES,
- TASK_TEMPLATE_RECOMMEND_COUNT,
- taskTemplates,
-} from '@lobechat/const';
-import { describe, expect, it } from 'vitest';
+import { TASK_TEMPLATE_RECOMMEND_MAX_COUNT } from '@lobechat/const';
+import type { TaskTemplate } from '@lobehub/market-sdk';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { TaskTemplateService } from './index';
+
+const { mockGetTaskTemplateRecommendations, mockMarket } = vi.hoisted(() => {
+ const market: {
+ taskTemplates?: {
+ getTaskTemplateRecommendations: ReturnType<typeof vi.fn>;
+ };
+ } = {
+ taskTemplates: {
+ getTaskTemplateRecommendations: vi.fn(),
+ },
+ };
+
+ return {
+ mockGetTaskTemplateRecommendations: vi.fn(),
+ mockMarket: market,
+ };
+});
+
+vi.mock('@/server/services/market', () => ({
+ MarketService: vi.fn(() => ({ market: mockMarket })),
+}));
-import { isTemplateSkillSourceEligible, TaskTemplateService } from './index';
+vi.mock('@/config/composio', () => ({
+ composioEnv: { COMPOSIO_API_KEY: 'composio-key' },
+}));
-const makeTemplate = (overrides: Partial<TaskTemplate>): TaskTemplate => ({
+vi.mock('@/envs/app', () => ({
+ appEnv: {
+ MARKET_TRUSTED_CLIENT_ID: 'client-id',
+ MARKET_TRUSTED_CLIENT_SECRET: 'secret',
+ },
+}));
+
+const template = {
category: 'engineering',
+ connectors: [],
+ createdAt: '2026-06-17T00:00:00.000Z',
cronPattern: '0 9 * * *',
- id: 't',
- interests: [],
- ...overrides,
-});
-
-const UTC_DAY_1 = new Date('2026-04-24T10:00:00Z');
-const UTC_DAY_2 = new Date('2026-04-25T10:00:00Z');
+ description: 'Description',
+ id: 101,
+ identifier: 'daily-engineering',
+ instruction: 'Instruction',
+ interests: ['coding'],
+ title: 'Title',
+ updatedAt: '2026-06-17T00:00:00.000Z',
+ version: '1.0.0',
+ versionNumber: 1,
+} satisfies TaskTemplate;
describe('TaskTemplateService.listDailyRecommend', () => {
- it('returns the default recommendation count when user has matching interests', async () => {
- const service = new TaskTemplateService('user-1');
- const picked = await service.listDailyRecommend(['coding'], { now: UTC_DAY_1 });
-
- expect(picked).toHaveLength(TASK_TEMPLATE_RECOMMEND_COUNT);
- const codingMatches = taskTemplates.filter((t) => t.interests.includes('coding'));
- expect(picked.some((p) => codingMatches.some((m) => m.id === p.id))).toBe(true);
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mockMarket.taskTemplates = {
+ getTaskTemplateRecommendations: mockGetTaskTemplateRecommendations,
+ };
+ mockGetTaskTemplateRecommendations.mockResolvedValue({ items: [template] });
});
- it('is stable for the same (userId, utcDate)', async () => {
+ it('returns Market recommendation items', async () => {
const service = new TaskTemplateService('user-1');
- const a = await service.listDailyRecommend(['coding'], { now: UTC_DAY_1 });
- const b = await service.listDailyRecommend(['coding'], {
- now: new Date('2026-04-24T23:59:00Z'), // still same UTC day
- });
+ const result = await service.listDailyRecommend(['coding']);
- expect(a.map((t) => t.id)).toEqual(b.map((t) => t.id));
+ expect(result).toEqual([template]);
});
- it('changes across UTC days', async () => {
- let matches = 0;
- for (const suffix of ['a', 'b', 'c', 'd', 'e']) {
- const service = new TaskTemplateService(`user-${suffix}`);
- const d1 = await service.listDailyRecommend([], { now: UTC_DAY_1 });
- const d2 = await service.listDailyRecommend([], { now: UTC_DAY_2 });
- if (JSON.stringify(d1) === JSON.stringify(d2)) matches += 1;
- }
- expect(matches).toBeLessThan(5);
- });
-
- it('differs across users on the same day', async () => {
- const results = await Promise.all(
- ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'].map((s) =>
- new TaskTemplateService(`user-${s}`)
- .listDailyRecommend([], { now: UTC_DAY_1 })
- .then((r) => r.map((t) => t.id).join(',')),
- ),
- );
- expect(new Set(results).size).toBeGreaterThan(1);
- });
-
- it('falls back to fallback categories when user has no interests', async () => {
+ it('returns an empty list when Market returns no recommendation items', async () => {
+ mockGetTaskTemplateRecommendations.mockResolvedValue({ items: [] });
const service = new TaskTemplateService('user-1');
- const picked = await service.listDailyRecommend([], { now: UTC_DAY_1 });
- expect(picked).toHaveLength(TASK_TEMPLATE_RECOMMEND_COUNT);
- for (const p of picked) {
- expect(taskTemplates.some((t) => t.id === p.id)).toBe(true);
- }
- });
+ const result = await service.listDailyRecommend(['coding']);
- it('intersection is case-insensitive and trims whitespace', async () => {
- const service = new TaskTemplateService('user-1');
- const picked = await service.listDailyRecommend([' CoDing '], { now: UTC_DAY_1 });
-
- const codingMatches = taskTemplates.filter((t) => t.interests.includes('coding'));
- expect(picked.some((p) => codingMatches.some((m) => m.id === p.id))).toBe(true);
+ expect(result).toEqual([]);
});
- it('unrecognized interest strings fall back to non-matched pool', async () => {
+ it('passes recommendation inputs to Market', async () => {
const service = new TaskTemplateService('user-1');
- // Freeform custom input won't match any template's interests and should still return defaults.
- const picked = await service.listDailyRecommend(['my special hobby'], { now: UTC_DAY_1 });
-
- expect(picked).toHaveLength(TASK_TEMPLATE_RECOMMEND_COUNT);
- });
- it('excludes templates listed in excludeIds', async () => {
- const service = new TaskTemplateService('user-1');
- const baseline = await service.listDailyRecommend(['coding'], { now: UTC_DAY_1 });
- expect(baseline.length).toBeGreaterThan(0);
-
- const excludedId = baseline[0].id;
- const picked = await service.listDailyRecommend(['coding'], {
- excludeIds: [excludedId],
- now: UTC_DAY_1,
+ await service.listDailyRecommend(['coding'], {
+ count: 10,
+ enabledConnectors: [
+ { identifier: 'github', source: 'lobehub' },
+ { identifier: 'gmail', source: 'composio' },
+ ],
+ excludeIds: [101],
+ locale: 'zh-CN',
+ refreshSeed: 'refresh-1',
});
- expect(picked.some((t) => t.id === excludedId)).toBe(false);
- expect(picked).toHaveLength(TASK_TEMPLATE_RECOMMEND_COUNT);
- });
-
- it('drops templates whose required skill sources are not all enabled', async () => {
- const service = new TaskTemplateService('user-1');
- // Without `enabledSkillSources`, any template with `requiresSkills` is filtered out.
- // Since current catalog has none, this should match the baseline (no-op).
- const baseline = await service.listDailyRecommend(['coding'], { now: UTC_DAY_1 });
- expect(baseline).toHaveLength(TASK_TEMPLATE_RECOMMEND_COUNT);
- });
-
- it('returns only non-excluded templates when most are excluded', async () => {
- const service = new TaskTemplateService('user-1');
- const allIds = taskTemplates.map((t) => t.id);
- const keepIds = allIds.slice(0, 2);
- const excludeIds = allIds.slice(2);
-
- const picked = await service.listDailyRecommend(['coding'], {
- excludeIds,
- now: UTC_DAY_1,
+ expect(mockGetTaskTemplateRecommendations).toHaveBeenCalledWith({
+ count: 10,
+ enabledConnectors: [
+ { identifier: 'github', source: 'lobehub' },
+ { identifier: 'gmail', source: 'composio' },
+ ],
+ excludeIds: [101],
+ interestKeys: ['coding'],
+ locale: 'zh-CN',
+ refreshSeed: 'refresh-1',
});
-
- expect(picked.map((t) => t.id).sort()).toEqual([...keepIds].sort());
});
- it('matches baseline when refreshSeed is undefined', async () => {
+ it('clamps oversized recommendation counts before calling Market', async () => {
const service = new TaskTemplateService('user-1');
- const baseline = await service.listDailyRecommend(['coding'], { now: UTC_DAY_1 });
- const withUndefined = await service.listDailyRecommend(['coding'], {
- now: UTC_DAY_1,
- refreshSeed: undefined,
- });
- const withEmpty = await service.listDailyRecommend(['coding'], {
- now: UTC_DAY_1,
- refreshSeed: '',
- });
- expect(withUndefined.map((t) => t.id)).toEqual(baseline.map((t) => t.id));
- expect(withEmpty.map((t) => t.id)).toEqual(baseline.map((t) => t.id));
- });
+ await service.listDailyRecommend(['coding'], { count: 25 });
- it('is stable for the same (userId, utcDay, refreshSeed)', async () => {
- const service = new TaskTemplateService('user-1');
- const a = await service.listDailyRecommend(['coding'], {
- now: UTC_DAY_1,
- refreshSeed: 'seed-x',
- });
- const b = await service.listDailyRecommend(['coding'], {
- now: new Date('2026-04-24T23:59:00Z'), // same UTC day
- refreshSeed: 'seed-x',
- });
- expect(a.map((t) => t.id)).toEqual(b.map((t) => t.id));
- });
-
- it('differs when refreshSeed changes', async () => {
- const service = new TaskTemplateService('user-1');
- const seeds = ['s1', 's2', 's3', 's4', 's5'];
- const results = await Promise.all(
- seeds.map((s) =>
- service
- .listDailyRecommend([], { now: UTC_DAY_1, refreshSeed: s })
- .then((r) => r.map((t) => t.id).join(',')),
- ),
+ expect(mockGetTaskTemplateRecommendations).toHaveBeenCalledWith(
+ expect.objectContaining({ count: TASK_TEMPLATE_RECOMMEND_MAX_COUNT }),
);
- expect(new Set(results).size).toBeGreaterThan(1);
});
- it('refreshSeed does not bypass excludeIds', async () => {
+ it('returns an empty list when Market recommendations fail', async () => {
+ mockGetTaskTemplateRecommendations.mockRejectedValue(new Error('market down'));
const service = new TaskTemplateService('user-1');
- const baseline = await service.listDailyRecommend(['coding'], { now: UTC_DAY_1 });
- const excludedId = baseline[0].id;
-
- for (const seed of ['s1', 's2', 's3']) {
- const picked = await service.listDailyRecommend(['coding'], {
- excludeIds: [excludedId],
- now: UTC_DAY_1,
- refreshSeed: seed,
- });
- expect(picked.some((t) => t.id === excludedId)).toBe(false);
- }
- });
- it('drops personal-only categories in workspace mode', async () => {
- const service = new TaskTemplateService('user-1');
- const personalCategories = new Set(TASK_TEMPLATE_PERSONAL_ONLY_CATEGORIES);
+ const result = await service.listDailyRecommend(['coding']);
- // Use a personal interest that would otherwise match personal-life templates.
- const picked = await service.listDailyRecommend(['personal'], {
- now: UTC_DAY_1,
- workspaceMode: true,
- });
- for (const p of picked) {
- expect(personalCategories.has(p.category), `template ${p.id} category`).toBe(false);
- }
+ expect(result).toEqual([]);
});
- it('shuffles broadly across refreshSeeds in workspace mode with empty interests', async () => {
- // The original narrow workspace fallback (operations + learning-research)
- // resolved to ~4 templates after skill gating, locking "换一批" to a
- // permutation of the same 3-of-4. Workspace fallback must draw from the
- // full non-personal candidate set so refresh actually rotates.
+ it('returns an empty list when Market returns malformed recommendations', async () => {
+ mockGetTaskTemplateRecommendations.mockResolvedValue({});
const service = new TaskTemplateService('user-1');
- const seenIds = new Set<string>();
- for (const seed of ['s1', 's2', 's3', 's4', 's5', 's6', 's7', 's8']) {
- const picked = await service.listDailyRecommend([], {
- now: UTC_DAY_1,
- refreshSeed: seed,
- workspaceMode: true,
- });
- for (const p of picked) seenIds.add(p.id);
- }
- // 8 refreshes × 3 picks = 24 slots. Across this many seeds the pool
- // should clearly exceed the old 4-template ceiling.
- expect(seenIds.size).toBeGreaterThan(10);
- });
- it('keeps personal-only categories in personal mode (default)', async () => {
- const service = new TaskTemplateService('user-1');
- const personalCategories = new Set(TASK_TEMPLATE_PERSONAL_ONLY_CATEGORIES);
-
- // Sample enough seeds so the personal fallback pool surfaces.
- const reached = new Set<string>();
- for (const seed of ['p1', 'p2', 'p3', 'p4', 'p5', 'p6']) {
- const picked = await service.listDailyRecommend(['personal'], {
- now: UTC_DAY_1,
- refreshSeed: seed,
- });
- for (const p of picked) {
- if (personalCategories.has(p.category)) reached.add(p.id);
- }
- }
- expect(reached.size).toBeGreaterThan(0);
- });
+ const result = await service.listDailyRecommend(['coding']);
- it('produces a different shuffle seed for workspace mode vs personal mode', async () => {
- // Seed namespaces are isolated so workspace recommendations don't mirror
- // the personal lineup for the same user/day.
- const service = new TaskTemplateService('user-1');
- const personal = await service.listDailyRecommend(['coding'], { now: UTC_DAY_1 });
- const workspace = await service.listDailyRecommend(['coding'], {
- now: UTC_DAY_1,
- workspaceMode: true,
- });
- expect(personal.map((t) => t.id).join(',')).not.toBe(workspace.map((t) => t.id).join(','));
+ expect(result).toEqual([]);
});
- it('changes the first item across refreshSeeds when matched candidates are fewer than the default recommendation count', async () => {
- // Repro for: `health` interest matches only one template (`diet-log-companion`),
- // so the legacy "matched-first" logic locked it to position 0 regardless of seed.
+ it('returns official connector fields from Market recommendation items', async () => {
+ const templateWithConnectors = {
+ ...template,
+ connectors: [
+ { identifier: 'github', required: true, source: 'lobehub' },
+ { identifier: 'gmail', required: false, source: 'composio' },
+ ],
+ id: 102,
+ } satisfies TaskTemplate;
+ mockGetTaskTemplateRecommendations.mockResolvedValue({ items: [templateWithConnectors] });
const service = new TaskTemplateService('user-1');
- const firstItems = new Set<string>();
- for (const seed of ['s1', 's2', 's3', 's4', 's5', 's6', 's7', 's8']) {
- const picked = await service.listDailyRecommend(['health'], {
- now: UTC_DAY_1,
- refreshSeed: seed,
- });
- firstItems.add(picked[0]?.id ?? '');
- }
- expect(firstItems.size).toBeGreaterThan(1);
- });
-});
-
-describe('isTemplateSkillSourceEligible', () => {
- it('treats templates without requiresSkills as always eligible', () => {
- expect(isTemplateSkillSourceEligible(makeTemplate({}))).toBe(true);
- expect(isTemplateSkillSourceEligible(makeTemplate({}), new Set())).toBe(true);
- });
- it('filters out skill-dependent templates when enabledSkillSources is undefined', () => {
- const t = makeTemplate({ requiresSkills: [{ provider: 'github', source: 'lobehub' }] });
- expect(isTemplateSkillSourceEligible(t, undefined)).toBe(false);
- });
+ const result = await service.listDailyRecommend(['coding']);
- it('keeps templates whose only source is enabled', () => {
- const t = makeTemplate({ requiresSkills: [{ provider: 'notion', source: 'lobehub' }] });
- expect(isTemplateSkillSourceEligible(t, new Set(['lobehub']))).toBe(true);
+ expect(result).toEqual([templateWithConnectors]);
});
- it('drops templates whose source is not in enabledSkillSources', () => {
- const t = makeTemplate({ requiresSkills: [{ provider: 'notion', source: 'lobehub' }] });
- expect(isTemplateSkillSourceEligible(t, new Set(['composio']))).toBe(false);
- });
+ it('returns an empty list when the SDK has no taskTemplates namespace', async () => {
+ mockMarket.taskTemplates = undefined;
+ const service = new TaskTemplateService('user-1');
- it('requires every source for multi-skill templates', () => {
- const t = makeTemplate({
- requiresSkills: [
- { provider: 'notion', source: 'lobehub' },
- { provider: 'google-calendar', source: 'composio' },
- ],
- });
- expect(isTemplateSkillSourceEligible(t, new Set(['lobehub']))).toBe(false);
- expect(isTemplateSkillSourceEligible(t, new Set(['composio']))).toBe(false);
- expect(isTemplateSkillSourceEligible(t, new Set(['lobehub', 'composio']))).toBe(true);
- });
+ const result = await service.listDailyRecommend(['coding']);
- it('treats empty requiresSkills array same as undefined (always eligible)', () => {
- const t = makeTemplate({ requiresSkills: [] });
- expect(isTemplateSkillSourceEligible(t, undefined)).toBe(true);
+ expect(result).toEqual([]);
});
});
diff --git a/apps/server/src/services/taskTemplate/index.ts b/apps/server/src/services/taskTemplate/index.ts
index 5136a21c5e0..e476c416116 100644
--- a/apps/server/src/services/taskTemplate/index.ts
+++ b/apps/server/src/services/taskTemplate/index.ts
@@ -1,150 +1,78 @@
-import type { TaskTemplate, TaskTemplateSkillSource } from '@lobechat/const';
import {
- TASK_TEMPLATE_FALLBACK_CATEGORIES,
- TASK_TEMPLATE_PERSONAL_ONLY_CATEGORIES,
+ COMPOSIO_APP_TYPES,
+ LOBEHUB_SKILL_PROVIDERS,
TASK_TEMPLATE_RECOMMEND_COUNT,
- taskTemplates,
+ TASK_TEMPLATE_RECOMMEND_MAX_COUNT,
} from '@lobechat/const';
+import type { TaskTemplate, TaskTemplateConnectorReference } from '@lobehub/market-sdk';
import { composioEnv } from '@/config/composio';
import { appEnv } from '@/envs/app';
+import { MarketService } from '@/server/services/market';
-export const ENABLED_SKILL_SOURCES: ReadonlySet<TaskTemplateSkillSource> = (() => {
- const sources = new Set<TaskTemplateSkillSource>();
- if (composioEnv.COMPOSIO_API_KEY) sources.add('composio');
- if (appEnv.MARKET_TRUSTED_CLIENT_ID && appEnv.MARKET_TRUSTED_CLIENT_SECRET) {
- sources.add('lobehub');
- }
- return sources;
-})();
+export const ENABLED_TASK_TEMPLATE_CONNECTORS: TaskTemplateConnectorReference[] = (() => {
+ const connectors: TaskTemplateConnectorReference[] = [];
-const hashString = (str: string): number => {
- let hash = 0;
- for (let i = 0; i < str.length; i++) {
- hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;
+ if (composioEnv.COMPOSIO_API_KEY) {
+ connectors.push(
+ ...COMPOSIO_APP_TYPES.map((app) => ({
+ identifier: app.identifier,
+ source: 'composio' as const,
+ })),
+ );
}
- return hash >>> 0;
-};
-
-/** mulberry32 — pure function of seed, used so recommendations are stable per user/day. */
-const mulberry32 = (seed: number) => {
- let t = seed >>> 0;
- return () => {
- t = (t + 0x6d_2b_79_f5) | 0;
- let r = Math.imul(t ^ (t >>> 15), 1 | t);
- r = (r + Math.imul(r ^ (r >>> 7), 61 | r)) ^ r;
- return ((r ^ (r >>> 14)) >>> 0) / 4_294_967_296;
- };
-};
-const seededShuffle = <T>(items: T[], seed: number): T[] => {
- const arr = [...items];
- const rand = mulberry32(seed);
- for (let i = arr.length - 1; i > 0; i--) {
- const j = Math.floor(rand() * (i + 1));
- [arr[i], arr[j]] = [arr[j], arr[i]];
+ if (appEnv.MARKET_TRUSTED_CLIENT_ID && appEnv.MARKET_TRUSTED_CLIENT_SECRET) {
+ connectors.push(
+ ...LOBEHUB_SKILL_PROVIDERS.map((provider) => ({
+ identifier: provider.id,
+ source: 'lobehub' as const,
+ })),
+ );
}
- return arr;
-};
-
-const normalize = (s: string) => s.trim().toLowerCase();
-const hasIntersection = (template: TaskTemplate, userInterests: string[]): boolean => {
- if (userInterests.length === 0) return false;
- const normalized = new Set(userInterests.map(normalize));
- return template.interests.some((i) => normalized.has(normalize(i)));
-};
-
-const getUtcDateStr = (now: Date): string => now.toISOString().slice(0, 10);
+ return connectors;
+})();
-/**
- * A template is eligible only if every `requiresSkills[].source` is enabled
- * server-side. When a template declares no skill requirement, it is always
- * eligible. When the caller passes no `enabledSkillSources` set, any template
- * with skill requirements is filtered out (conservative default).
- */
-export const isTemplateSkillSourceEligible = (
- template: TaskTemplate,
- enabledSkillSources?: ReadonlySet<TaskTemplateSkillSource>,
-): boolean => {
- if (!template.requiresSkills || template.requiresSkills.length === 0) return true;
- if (!enabledSkillSources) return false;
- return template.requiresSkills.every((s) => enabledSkillSources.has(s.source));
-};
+const clampRecommendationCount = (count?: number) =>
+ Math.min(Math.max(1, count ?? TASK_TEMPLATE_RECOMMEND_COUNT), TASK_TEMPLATE_RECOMMEND_MAX_COUNT);
export class TaskTemplateService {
- constructor(private userId: string) {}
+ private marketService: MarketService;
+
+ constructor(private userId: string) {
+ this.marketService = new MarketService({ userInfo: { userId } });
+ }
async listDailyRecommend(
interestKeys: string[],
options: {
count?: number;
- enabledSkillSources?: ReadonlySet<TaskTemplateSkillSource>;
- excludeIds?: string[];
- now?: Date;
+ enabledConnectors?: readonly TaskTemplateConnectorReference[];
+ excludeIds?: number[];
+ locale?: string;
refreshSeed?: string;
- /**
- * When true, drop every template under `TASK_TEMPLATE_PERSONAL_ONLY_CATEGORIES`
- * and use the workspace-flavored fallback pool. Used by the cloud router
- * whenever the request is bound to a workspace context.
- */
- workspaceMode?: boolean;
} = {},
): Promise<TaskTemplate[]> {
- const {
- count = TASK_TEMPLATE_RECOMMEND_COUNT,
- enabledSkillSources,
- excludeIds,
- now = new Date(),
- refreshSeed,
- workspaceMode = false,
- } = options;
- const limit = Math.max(1, count);
- const excluded = new Set(excludeIds ?? []);
- const seedBase = workspaceMode
- ? `${this.userId}:ws:${getUtcDateStr(now)}`
- : `${this.userId}:${getUtcDateStr(now)}`;
- const seed = hashString(refreshSeed ? `${seedBase}:${refreshSeed}` : seedBase);
-
- const personalOnly = new Set<string>(TASK_TEMPLATE_PERSONAL_ONLY_CATEGORIES);
-
- const candidates = taskTemplates.filter(
- (t) =>
- !excluded.has(t.id) &&
- isTemplateSkillSourceEligible(t, enabledSkillSources) &&
- (!workspaceMode || !personalOnly.has(t.category)),
- );
- const matched = candidates.filter((t) => hasIntersection(t, interestKeys));
- const result: TaskTemplate[] = [];
-
- if (matched.length >= limit) {
- result.push(...seededShuffle(matched, seed).slice(0, limit));
- } else {
- // Not enough interest matches: fold the fallback pool in so refreshSeed
- // can reorder the whole batch — otherwise a single-match interest pins
- // that template to position 0 forever.
- //
- // Personal mode keeps the narrow `personal-life + learning-research`
- // fallback (it's the existing vibe). Workspace mode uses the full
- // non-personal candidate set — the original 2-category workspace
- // fallback resolved to ~4 templates after skill gating and made
- // "换一批" a no-op.
- const matchedIds = new Set(matched.map((t) => t.id));
- const fallback = workspaceMode
- ? candidates.filter((t) => !matchedIds.has(t.id))
- : candidates.filter(
- (t) => TASK_TEMPLATE_FALLBACK_CATEGORIES.includes(t.category) && !matchedIds.has(t.id),
- );
- const pool = [...matched, ...fallback];
- result.push(...seededShuffle(pool, seed).slice(0, limit));
- }
-
- if (result.length < limit) {
- const seen = new Set(result.map((t) => t.id));
- const remaining = candidates.filter((t) => !seen.has(t.id));
- result.push(...seededShuffle(remaining, seed).slice(0, limit - result.length));
+ try {
+ const result = await this.marketService.market.taskTemplates.getTaskTemplateRecommendations({
+ count: clampRecommendationCount(options.count),
+ enabledConnectors: options.enabledConnectors ? [...options.enabledConnectors] : undefined,
+ excludeIds: options.excludeIds,
+ interestKeys,
+ locale: options.locale,
+ refreshSeed: options.refreshSeed,
+ });
+
+ if (!Array.isArray(result.items)) {
+ console.error('[taskTemplate:listDailyRecommend] Market recommendations returned no items');
+ return [];
+ }
+
+ return result.items;
+ } catch (error) {
+ console.error('[taskTemplate:listDailyRecommend] Market recommendations failed', error);
+ return [];
}
-
- return result;
}
}
diff --git a/locales/zh-CN/taskTemplate.json b/locales/zh-CN/taskTemplate.json
index 64c3d629204..ec1a9eeed21 100644
--- a/locales/zh-CN/taskTemplate.json
+++ b/locales/zh-CN/taskTemplate.json
@@ -11,261 +11,9 @@
"action.dismiss.error": "操作失败,请稍后再试",
"action.dismiss.tooltip": "不感兴趣",
"action.refresh.button": "换一批",
- "ad-creative-inspiration.description": "每天扫一遍竞品和标杆品牌的新广告素材(Meta / Google Ads Library),挖能复刻的 10 条",
- "ad-creative-inspiration.instruction": "每天早上 10:00 扫一遍我的竞品和标杆品牌在 Meta 和 Google Ads Library 上的新素材,挑出 10 条值得复刻的,并说明每条值得的理由。",
- "ad-creative-inspiration.title": "投放素材灵感",
- "aigc-prompt-inspiration.description": "每天 5 组精选 Prompt(Midjourney / SD / Flux),按风格分类,今天就能试",
- "aigc-prompt-inspiration.instruction": "每天早上 10:00 给我 5 组精选 Prompt(Midjourney / Stable Diffusion / Flux),按风格分类,每条都要可以直接复制使用。",
- "aigc-prompt-inspiration.title": "AIGC Prompt 灵感",
- "arxiv-curated-daily.description": "每天早上帮你筛 5 篇最新论文 + 一句话摘要,刷论文时间省一半",
- "arxiv-curated-daily.instruction": "每天早上 9:00 帮我从 arXiv 筛 5 篇和我研究方向相关的最新论文,每篇附一句话摘要,帮我判断哪些值得精读。",
- "arxiv-curated-daily.title": "ArXiv 精选",
- "bedtime-gratitude.description": "每天 22 点引导你写下今天三件感谢的事 + 学到的一件事,沉淀进笔记",
- "bedtime-gratitude.instruction": "每天晚上 22:00 引导我写下今天三件感谢的事和学到的一件事,回我一段温柔的小结。如果连接了 Notion,把这条感恩记录追加到我的日记页。",
- "bedtime-gratitude.title": "睡前感恩",
- "brand-collab-weekly.description": "每周一扫一遍正在找创作者的品牌和公开招募,匹配你的领域和粉丝规模",
- "brand-collab-weekly.instruction": "每周一早上 10:00 扫一遍正在公开招募创作者的品牌,按我的赛道和粉丝量匹配,挑出 5 个值得申请的机会。",
- "brand-collab-weekly.title": "品牌合作机会",
- "brand-mention-daily.description": "告诉我要追踪的品牌 / 关键词,每天傍晚汇总当天提及量、情绪、热门发言者",
- "brand-mention-daily.instruction": "每天傍晚 18:00 在 X (Twitter) 上汇总我追踪的品牌和关键词当天的提及量、情绪、TOP 发言者,标出异常波动。",
- "brand-mention-daily.title": "品牌声量日报",
- "brand-watch-weekly.description": "每周一追踪 10 家大厂品牌升级、Logo 改版、官网重设计,附拆解视角",
- "brand-watch-weekly.instruction": "每周一早上 10:00 追踪 10 家我关注的品牌动态:品牌升级、Logo 改版、官网重设计,每条附一段拆解。",
- "brand-watch-weekly.title": "大厂品牌动态",
- "calendar-conflict-check.description": "每天早上检查日程有没有冲突、间隔太紧、通勤不够",
- "calendar-conflict-check.instruction": "每天早上 7:30 检查我今天的日历,找出冲突、连背靠背会议、通勤或缓冲时间不够的情况,给出建议调整方案。",
- "calendar-conflict-check.title": "日历冲突检查",
"card.templateTag": "模板",
- "cashflow-weekly.description": "每周一扫一下本周该收的款、该付的账、下周大额支出预警",
- "cashflow-weekly.instruction": "每周一早上 9:00 扫一遍本周应收款、应付账,并预警下周的大额支出。",
- "cashflow-weekly.title": "现金流周报",
- "child-growth-weekly.description": "告诉我孩子年龄,每周一给你本周发育重点、亲子活动建议、注意事项",
- "child-growth-weekly.instruction": "每周一早上 9:00 根据我孩子的年龄,给出本周的发育重点、亲子活动建议和需要留心的注意事项。",
- "child-growth-weekly.title": "孩子成长周报",
- "child-study-weekly.description": "告诉我孩子在学的科目,每周日帮你回顾本周完成情况 + 下周重点",
- "child-study-weekly.instruction": "每周日晚 20:00 回顾我孩子本周的学习进度,并梳理下周的学习重点,按科目给出练习建议。",
- "child-study-weekly.title": "孩子学习追踪",
- "competitor-creator-tracking.description": "告诉我 3-5 个你关注的创作者,每天看他们发了什么、数据怎样,挖能复刻的思路",
- "competitor-creator-tracking.instruction": "每天早上 9:00 追踪我设定的 3-5 个对标创作者:他们发了什么内容、数据如何,挖出我可以复刻的思路。",
- "competitor-creator-tracking.title": "竞品创作者追踪",
- "competitor-radar-daily.description": "告诉我 3-5 个竞争对手,每天帮你盯他们的官网更新、产品发布、招聘信号、社媒动态",
- "competitor-radar-daily.instruction": "每天早上 9:00 追踪我设定的 3-5 个竞争对手:官网更新、产品发布、招聘信号、社媒动态,分析每个动作的战略含义。",
- "competitor-radar-daily.title": "竞品动态追踪",
- "competitor-update-daily.description": "告诉我 3-5 个竞品,每天看他们的更新日志、新功能、官网变化",
- "competitor-update-daily.instruction": "每天早上 10:00 监测 3-5 个竞品产品的更新:更新日志、新功能、官网文案变化,标出值得深入研究的信号。",
- "competitor-update-daily.title": "竞品更新追踪",
- "content-calendar-weekly.description": "每周日晚帮你规划下周 7 天的发布计划,对齐节日和热点节奏",
- "content-calendar-weekly.instruction": "每周日晚 20:00 帮我规划下周 7 天的发布计划:把日程对齐近期节日和热点节奏,每个时段给一个建议选题。如果连接了 Notion,把这份计划同步成排期表。",
- "content-calendar-weekly.title": "内容日历",
- "contract-expiry-weekly.description": "每周一检查下个月到期的合同(订阅 / 租赁 / 合作),提前续签或解约",
- "contract-expiry-weekly.instruction": "每周一早上 9:00 列出未来 30 天到期的合同(订阅、租赁、合作),标注哪些需要续签、哪些可以解约。",
- "contract-expiry-weekly.title": "合同到期预警",
- "core-metric-daily.description": "告诉我要看的指标(DAU、留存、转化),每天早上自动同步变化",
- "core-metric-daily.instruction": "每天早上 9:00 同步我的核心指标变化(DAU、留存、转化),与昨天和 7 日均值做对比。",
- "core-metric-daily.title": "核心指标日报",
- "cross-platform-engagement-daily.description": "每天早上聚合你全平台的评论、私信、提及、新粉丝",
- "cross-platform-engagement-daily.instruction": "每天早上 9:00 聚合我各平台的评论、私信、提及和新粉丝,标出 5 条最值得回复的。",
- "cross-platform-engagement-daily.title": "全平台互动日报",
- "crypto-market-daily.description": "每天早上看比特币、以太坊、你关注币种的 24h 变化 + 重要链上事件",
- "crypto-market-daily.instruction": "每天早上 9:00 给我比特币、以太坊和我关注币种的 24h 价格变化,加上过去一天最重要的链上事件。",
- "crypto-market-daily.title": "加密市场日报",
- "daily-design-inspiration.description": "每天早上从 Dribbble、Behance、Awwwards、Pinterest 挑 10 个和你风格匹配的作品",
- "daily-design-inspiration.instruction": "每天早上 9:00 从 Dribbble、Behance、Awwwards、Pinterest 挑 10 个和我风格匹配的作品,各附一句亮点点评。",
- "daily-design-inspiration.title": "每日灵感",
- "daily-followup-list.description": "每天早上按优先级排一遍今天该跟进的客户,附上次沟通要点",
- "daily-followup-list.instruction": "每天早上 9:00 从 HubSpot 中排出今天该跟进的客户优先级清单,每条附上次沟通要点。",
- "daily-followup-list.title": "今日跟进清单",
- "daily-learning-bite.description": "每天给你一条 15 分钟能看完的学习内容(文章 / 视频 / 播客)",
- "daily-learning-bite.instruction": "每天早上 7:30 给我一条 15 分钟能看完的学习内容(文章 / 视频 / 播客),附一句关键收获。",
- "daily-learning-bite.title": "每日学习料",
- "daily-topic-pick.description": "每天早上帮你扒一遍你赛道前一天跑得最好的 10 条内容,拆解选题角度",
- "daily-topic-pick.instruction": "每天早上 9:00 帮我扒我赛道前一天跑得最好的 10 条内容,拆解选题角度,挑 1-2 个我今天能直接发的。",
- "daily-topic-pick.title": "今日选题",
- "deal-pipeline-weekly.description": "每周五盘点管道里所有 Deal:哪些推进、哪些停滞、本月能成多少",
- "deal-pipeline-weekly.instruction": "每周五下午 16:00 盘点 HubSpot 管道里的所有 Deal:本周推进的、停滞的,并预测本月能成多少。",
- "deal-pipeline-weekly.title": "Deal Pipeline 周报",
- "dependency-security-weekly.description": "每周一自动扫一遍你项目的漏洞和过期版本,给出升级优先级",
- "dependency-security-weekly.instruction": "每周一早上 10:00 扫一遍我 GitHub 项目里有漏洞或过期的依赖,按严重程度和升级风险排出优先级。",
- "dependency-security-weekly.title": "依赖安全周检",
- "design-trend-weekly.description": "每周一给你本周 UI / 品牌 / 插画 3 个新趋势 + 5 个代表案例",
- "design-trend-weekly.instruction": "每周一早上 9:00 给我 UI、品牌、插画领域本周 3 个新趋势,每个趋势配 5 个代表案例。",
- "design-trend-weekly.title": "设计趋势周报",
- "diet-log-companion.description": "每天晚上帮你回顾今天吃了什么,给下次的调整建议。不强迫、不批判",
- "diet-log-companion.instruction": "每天晚上 21:00 陪我回顾今天的饮食,温柔地给一两条明天可以调整的建议,不强迫、不批判。",
- "diet-log-companion.title": "饮食记录陪跑",
- "exhibition-event-weekly.description": "告诉我你所在城市,每周一给你本周的展览、演出、livehouse 信息",
- "exhibition-event-weekly.instruction": "每周一早上 10:00 列出我所在城市本周的展览、演出、livehouse 演出信息,给出最值得去的几条简介。",
- "exhibition-event-weekly.title": "展览演出日历",
- "family-finance-weekly.description": "每周日晚回顾本周支出结构、预算完成度、下周大额计划",
- "family-finance-weekly.instruction": "每周日晚 20:00 基于 Google Sheets 流水回顾本周家庭支出结构、预算完成度,并预告下周的大额支出计划。",
- "family-finance-weekly.title": "家庭财务周报",
- "family-task-schedule.description": "每周一早上分配本周家务、采购、接送、缴费,家庭群可同步",
- "family-task-schedule.instruction": "每周一早上 8:00 帮我排好本周家庭任务计划:家务、采购、接送、缴费,给每项一个暂定责任人和时间段。如果连接了 Google Calendar,建议可直接落进日程的时间块。",
- "family-task-schedule.title": "家庭任务排期",
- "figma-files-cleanup.description": "每周五下班前帮你盘点近期更新的 Figma 文件,标记该归档的、该同步开发的",
- "figma-files-cleanup.instruction": "每周五下午 17:00 盘点近期更新的 Figma 文件,标记哪些该归档、哪些需要同步给开发,还有哪些需要继续打磨。",
- "figma-files-cleanup.title": "Figma 文件整理",
- "follower-growth-weekly.description": "每周一看跨平台的粉丝变化:哪个平台在涨、哪个在跌、该加码哪里",
- "follower-growth-weekly.instruction": "每周一早上 10:00 回顾我 X (Twitter) 等平台的粉丝增长,标出该加码的平台和互动下滑的平台。",
- "follower-growth-weekly.title": "粉丝增长周报",
- "font-color-weekly.description": "每周三给你 3 组值得收藏的字体组合 + 3 组配色方案,直接存进灵感库",
- "font-color-weekly.instruction": "每周三早上 10:00 给我 3 组值得收藏的字体组合和 3 组配色方案,每组字体附授权或下载渠道。",
- "font-color-weekly.title": "字体配色周报",
- "friday-wrap-list.description": "每周五下午列一份:这周没做完的、周一要交付的、下周第一件事",
- "friday-wrap-list.instruction": "每周五下午 16:00 列一份:本周没做完的、周一要交付的、下周第一件事。",
- "friday-wrap-list.title": "周五收尾清单",
- "funding-intel-daily.description": "每天给你 3-5 条你赛道的融资快讯:谁拿钱、估值多少、投资人是谁",
- "funding-intel-daily.instruction": "每天早上 10:00 给我赛道里过去 24 小时的 3-5 条融资快讯:谁拿了钱、金额、估值、领投方。",
- "funding-intel-daily.title": "融资情报日报",
- "headline-inspiration.description": "每天给你 10 个符合你调性的标题模板,从近期爆款反推的结构",
- "headline-inspiration.instruction": "每天早上 10:00 从近期爆款反推 10 个符合我调性的标题模板,卡标题时直接抄。",
- "headline-inspiration.title": "标题灵感",
- "hot-topic-radar.description": "每天早上一次性看完你领域里正在升温的 5 个话题,趁还没挤满就能下手",
- "hot-topic-radar.instruction": "每天早上 10:00 给我我赛道里正在升温但还没饱和的 5 个话题,每条说明现在为什么值得下手。",
- "hot-topic-radar.title": "热点雷达",
- "hubspot-funnel-daily.description": "每天早上看 MQL、SQL、成交漏斗变化,标出掉单高发环节",
- "hubspot-funnel-daily.instruction": "每天早上 9:00 看 HubSpot 漏斗:MQL、SQL、成交各阶段的变化,对比上周标出掉单高发的环节。",
- "hubspot-funnel-daily.title": "HubSpot 漏斗日报",
- "industry-morning-brief.description": "每天早上把你行业 5 条重要新闻、融资、政策变化做成 5 分钟读物",
- "industry-morning-brief.instruction": "每天早上 8:00 把我行业 5 条重要新闻、融资、政策变化汇总成 5 分钟读物。",
- "industry-morning-brief.title": "行业早餐",
- "industry-research-weekly.description": "告诉我你研究的赛道,每周一给你一份市场动态、融资、新玩家、监管变化汇总",
- "industry-research-weekly.instruction": "每周一早上 9:00 汇总我赛道的市场动态、融资、新玩家、监管变化,整理成研究简报。",
- "industry-research-weekly.title": "行业研究周报",
- "invoice-collection-daily.description": "每天早上看哪些发票逾期了、逾期多少天、该发催款邮件了",
- "invoice-collection-daily.instruction": "每天早上 10:00 列出逾期发票和对接联系人,并为每条草拟一封礼貌的催款邮件。",
- "invoice-collection-daily.title": "发票催收日报",
- "iteration-recap-weekly.description": "每周五下班前帮你拉本周迭代数据:完成率、逾期项、新增 Bug",
- "iteration-recap-weekly.instruction": "每周五下午 17:00 复盘本周迭代:完成率、逾期项、新增 Bug,整理成下周一可直接用的复盘材料。",
- "iteration-recap-weekly.title": "迭代复盘周报",
- "key-account-radar.description": "告诉我核心客户的公司名,每天盯他们的新闻、融资、高管变动",
- "key-account-radar.instruction": "每天早上 9:00 扫一遍我核心客户的公司新闻、融资、高管变动,挑出可作为续约谈话切入点的素材。",
- "key-account-radar.title": "客户动态雷达",
- "keyword-tech-feed.description": "告诉我你想追踪的技术关键词,每天带回 5 条高质量新问答 / 新博客",
- "keyword-tech-feed.instruction": "每天早上 10:00 按我设定的技术关键词带回 5 条高质量的新博客或新问答。",
- "keyword-tech-feed.title": "关键词技术订阅",
- "kol-collab-calendar.description": "每周一同步正在合作的 KOL 进度:谁该发了、谁逾期、数据怎样",
- "kol-collab-calendar.instruction": "每周一早上 9:00 同步正在进行的 KOL 合作:谁该发了、谁逾期、已发出内容的数据。",
- "kol-collab-calendar.title": "KOL 合作日历",
- "language-morning-bite.description": "每天给你一段 3 分钟能读完的目标语言内容 + 5 个生词卡",
- "language-morning-bite.instruction": "每天早上 7:30 给我一段 3 分钟能读完的目标语言内容,加上 5 个生词卡(单词、释义、例句)。",
- "language-morning-bite.title": "语言早报",
- "linear-sprint-daily.description": "每天早上同步 Sprint 进度:哪些卡住了、哪些逾期、今天该做什么",
- "linear-sprint-daily.instruction": "每天早上 8:30 从 Linear 拉一份 Sprint 进度:今日重点、阻塞项、昨日完成,整理成 3 条站会前可直接念的要点。",
- "linear-sprint-daily.title": "Linear Sprint 日报",
- "macro-economy-weekly.description": "每周一早给你汇率、利率、原油、金银、主要指数汇总",
- "macro-economy-weekly.instruction": "每周一早上 8:00 给我宏观快照:汇率、利率、原油、金银、主要指数,加上一段「本周变化」总结。",
- "macro-economy-weekly.title": "宏观经济周报",
- "marketing-hot-radar.description": "每天追踪你行业正在发酵的 5 个营销话题:哪些值得蹭、哪些要避雷",
- "marketing-hot-radar.instruction": "每天早上 10:00 追踪我行业正在发酵的 5 个营销话题,标注哪些值得蹭、哪些要避雷,各附 1-2 句理由。",
- "marketing-hot-radar.title": "营销热点雷达",
- "meeting-brief.description": "每天早上把今天所有会议的背景、参会人、上次纪要整理成 1 页",
- "meeting-brief.instruction": "每天早上 8:30 为今天日历上的每个会议生成一页简报:背景、参会人、上次纪要,进会议室前看一眼。",
- "meeting-brief.title": "会议简报",
- "monetization-opportunity-weekly.description": "每周三给你内容创作者的新变现渠道和案例:广告 / 知识付费 / 会员 / 电商",
- "monetization-opportunity-weekly.instruction": "每周三早上 10:00 给我我赛道相关的新变现渠道和案例:广告、知识付费、会员订阅、电商。",
- "monetization-opportunity-weekly.title": "变现机会播报",
- "morning-brief.description": "每天 8 点推一份:今天日程、待回邮件数、待办清单、天气",
- "morning-brief.instruction": "每天早上 8:00 推送:今天日程、待回邮件数、TOP 3 待办、天气,整理成 1 分钟能读完的早报。",
- "morning-brief.title": "晨间早报",
- "morning-ritual.description": "每天 7 点:天气 + 今日日程 + 一条金句 + 一个动一动建议,温柔开启一天",
- "morning-ritual.instruction": "每天早上 7:00 给我一份温柔的晨间仪式:天气、今日日程、一条短金句、一个轻量运动建议。如果连接了 Google Calendar,把日程锚定在那里。",
- "morning-ritual.title": "晨间仪式",
- "must-read-papers-weekly.description": "每周日晚帮你挑本周被引最多、讨论最热的 3 篇论文,做成精读清单",
- "must-read-papers-weekly.instruction": "每周日晚 20:00 帮我挑本周我研究方向被引最多或讨论最热的 3 篇论文,整理成周末可读完的精读清单。",
- "must-read-papers-weekly.title": "本周必读论文",
- "newsletter-aggregator.description": "每周日晚把你订阅的 Newsletter 合并成一份摘要,周末一次性读完",
- "newsletter-aggregator.instruction": "每周日晚 20:00 扫一遍我 Gmail 收件箱里本周收到的 Newsletter,按主题合并成一份周末摘要。",
- "newsletter-aggregator.title": "Newsletter 聚合",
- "newsletter-perf-weekly.description": "每周一帮你看 Newsletter 的打开率、点击率、取关率变化趋势,标出需要优化的环节",
- "newsletter-perf-weekly.instruction": "每周一早上 10:00 回顾过去 4 周 Newsletter 的打开率、点击率、取关率,标出需要优化的人群分层。",
- "newsletter-perf-weekly.title": "Newsletter 表现周报",
- "onboarding-buddy-weekly.description": "新人入职 90 天内,每周一生成他的进度:任务完成、Buddy 反馈、该关注什么",
- "onboarding-buddy-weekly.instruction": "每周一早上 9:00 为还在 90 天试用期内的新人生成进度卡:任务完成度、Buddy 反馈、本周该关注什么。",
- "onboarding-buddy-weekly.title": "新人入职陪跑",
- "oss-intel-daily.description": "每天早上给你 10 条技术栈动态:GitHub Trending、大厂新开源、关键 repo 的 release",
- "oss-intel-daily.instruction": "每天早上 9:00 给我 10 条技术栈动态:GitHub Trending、大厂新开源、我关注的 repo 新 release。",
- "oss-intel-daily.title": "开源情报日报",
- "podcast-new-episodes.description": "告诉我你订阅的播客,每周一给你本周新集 + 值得听的 3 集推荐",
- "podcast-new-episodes.instruction": "每周一早上 9:00 列出我订阅播客本周的新集,并推荐其中最值得先听的 3 集。",
- "podcast-new-episodes.title": "播客新集聚合",
- "portfolio-daily.description": "告诉我你的持仓股票 / 基金 / 加密货币,每天收盘后给你涨跌、重要新闻、持仓公司动态",
- "portfolio-daily.instruction": "每天 16:00 收盘后给我每个持仓的当日涨跌、影响新闻和公司公告。",
- "portfolio-daily.title": "持仓日报",
- "prd-review-reminder.description": "每周五盘点本周该评审的 PRD 和决策项,别让文档压在草稿箱",
- "prd-review-reminder.instruction": "每周五下午 15:00 盘点我 Notion 里本周该评审的 PRD 和决策文档,标出仍卡在草稿状态的。",
- "prd-review-reminder.title": "PRD 评审提醒",
- "pre-market-brief.description": "每天开盘前 30 分钟给你宏观要闻、重要财报、你持仓公司的动态",
- "pre-market-brief.instruction": "每天早上 9:00 给我开盘前简报:宏观要闻、今日重要财报、我持仓公司的动态。",
- "pre-market-brief.title": "开盘前简报",
- "precious-metals-daily.description": "每天收盘后推送金银铜油主要品种的价格和日变化幅度,波动超阈值立刻标红",
- "precious-metals-daily.instruction": "每天 16:00 收盘后给我金、银、铜、原油的当日价格和日变化幅度,单日波动超过 2% 立刻标红。",
- "precious-metals-daily.title": "金银油价日报",
- "recruit-funnel-daily.description": "每天早上看各岗位新投递、待面试、待反馈数,标出面试官拖着的人选",
- "recruit-funnel-daily.instruction": "每天早上 9:00 按岗位汇总招聘漏斗:新投递、待面试、待反馈数,标出被面试官卡住的人选。",
- "recruit-funnel-daily.title": "招聘漏斗日报",
- "regulation-watch-weekly.description": "告诉我你关注的合规领域(数据 / 税务 / 劳动法),每周一给你一份变更摘要和影响判断",
- "regulation-watch-weekly.instruction": "每周一早上 10:00 汇总我追踪的合规领域(数据 / 税务 / 劳动法)过去一周的变更,并判断对我们的影响。",
- "regulation-watch-weekly.title": "法规变更追踪",
- "renewal-risk-weekly.description": "每周一扫一遍本月到期合同,标出使用频次下降的高风险客户",
- "renewal-risk-weekly.instruction": "每周一早上 9:00 扫一遍 HubSpot 中本月到期合同,标出使用频次下降的高风险客户,并为每条高风险账户建议挽留动作。",
- "renewal-risk-weekly.title": "续费风险预警",
- "repo-health-weekly.description": "每周一帮你看你维护的 repo:Issue 堆积、PR 停滞、CI 失败、依赖告警",
- "repo-health-weekly.instruction": "每周一早上 9:00 检查我维护的 GitHub repo:Issue 堆积、PR 停滞、CI 失败、依赖告警,挑出本周该处理的事项。",
- "repo-health-weekly.title": "仓库健康周报",
"schedule.daily": "每天 {{time}}",
- "schedule.editableAfterCreateTooltip": "创建后可调整",
+ "schedule.editableAfterCreateTooltip": "创建后可调整执行时间。",
"schedule.weekly": "每{{weekday}} {{time}}",
- "section.title": "试试这些定时任务",
- "seo-weekly-report.description": "每周一一份轻量 SEO 报告:排名变化、新关键词机会、值得翻新的页面",
- "seo-weekly-report.instruction": "每周一早上 9:00 给我一份轻量 SEO 周报:排名升 / 降 TOP 变动、5 个值得关注的新关键词、3 个适合内容翻新的老页面。",
- "seo-weekly-report.title": "SEO 排名周报",
- "series-update-weekly.description": "告诉我你在追的剧 / 小说 / 漫画,每周给你更新提醒和剧情回顾",
- "series-update-weekly.instruction": "每周一早上 9:00 给我我在追的剧、小说、漫画的更新提醒和短剧情回顾。",
- "series-update-weekly.title": "追更日报",
- "standup-brief.description": "每天站会前 15 分钟帮你拉一份 Linear 进度简报:今日重点、阻塞项、昨日完成",
- "standup-brief.instruction": "每天早上 8:30 拉一份 Linear 站会简报:今日重点、阻塞项、昨日完成,整理成 3 条站会前可直接念的要点。",
- "standup-brief.title": "站会简报",
- "sunday-reflection.description": "每周日晚陪你走 5 个问题:最有成就感的事、最想吐槽的事、下周 3 件重要事",
- "sunday-reflection.instruction": "每周日晚 21:00 陪我走 5 个复盘问题:本周最有成就感的事、最想吐槽的事、下周 3 件重要事、本周学到的、本周应该放下的。",
- "sunday-reflection.title": "周日复盘",
- "team-status-weekly.description": "每周一看团队请假、加班、会议时长趋势,预警潜在倦怠信号",
- "team-status-weekly.instruction": "每周一早上 9:00 回顾团队过去一周的请假、加班、会议时长趋势,预警有倦怠风险的成员。",
- "team-status-weekly.title": "团队状态周报",
- "tech-trend-weekly.description": "每周一帮你总结前端 / 后端 / AI 圈的重要动态:论文、框架、融资",
- "tech-trend-weekly.instruction": "每周一早上 8:00 总结前端、后端、AI 圈过去一周的重要动态:论文、框架、融资,整理成 10 条 + 一句要点。",
- "tech-trend-weekly.title": "技术趋势周刊",
- "travel-inspiration-weekly.description": "每周三给你想去城市的机票价格变动、签证政策、最佳出行时间",
- "travel-inspiration-weekly.instruction": "每周三早上 10:00 给我心愿城市的机票价格变化、签证政策、最佳出行时间。",
- "travel-inspiration-weekly.title": "旅行灵感周报",
- "twitter-weekly-recap.description": "每周一帮你复盘过去 7 天的推文表现:涨粉最猛的、互动最差的、为什么",
- "twitter-weekly-recap.instruction": "每周一早上 10:00 复盘我 X (Twitter) 过去 7 天的推文表现:涨粉最猛的、互动最差的,并给出原因假设和下周 3 个尝试方向。",
- "twitter-weekly-recap.title": "推特周报",
- "user-feedback-daily.description": "每天把各渠道用户反馈(应用商店、社媒、客服)聚合成 TOP 20 条,按情绪和主题分类",
- "user-feedback-daily.instruction": "每天早上 9:00 把各渠道用户反馈(应用商店、社媒、客服)聚合成 TOP 20 条,按情绪和主题分类。",
- "user-feedback-daily.title": "用户反馈日报",
- "user-interview-schedule.description": "每周一帮你梳理本周访谈:谁、什么时候、问题列表准备好没",
- "user-interview-schedule.instruction": "每周一早上 9:00 列出本周已排期的用户访谈:访谈对象、时间、准备清单(问题列表是否齐全、录制设备是否就位)。",
- "user-interview-schedule.title": "用户访谈排期",
- "vercel-health-weekly.description": "每周一帮你盘点上周部署成功率、构建时长、流量异常",
- "vercel-health-weekly.instruction": "每周一早上 10:00 盘点 Vercel 过去一周的部署:成功率、构建时长、流量异常,标出累积问题。",
- "vercel-health-weekly.title": "Vercel 健康周报",
- "viral-content-breakdown.description": "每天从你领域挑 1 条爆款帮你拆:选题、开头、结构、结尾",
- "viral-content-breakdown.instruction": "每天早上 10:00 从我领域挑 1 条爆款帮我拆:选题、开头、结构、结尾,整理成可复刻的模板。",
- "viral-content-breakdown.title": "爆款拆解",
- "watchlist-friday.description": "每周五给你本周豆瓣 / IMDb 新上映的 5 部高分作品,附一句话短评",
- "watchlist-friday.instruction": "每周五晚 18:00 从豆瓣和 IMDb 挑 5 部本周新上映的高分作品,每部附一句短评。",
- "watchlist-friday.title": "观影清单",
- "weekly-meeting-brief.description": "每周一早上帮你准备本周战略会的 3 个讨论要点:行业动态、内部指标、决策建议",
- "weekly-meeting-brief.instruction": "每周一早上 8:30 准备本周战略会的 3 个讨论要点:行业动态、值得提的内部指标、需要决策的事项。",
- "weekly-meeting-brief.title": "周会简报",
- "youtube-channel-weekly.description": "每周一拉频道数据:订阅变化、热门视频、观众留存、收益变化",
- "youtube-channel-weekly.instruction": "每周一早上 9:00 拉我 YouTube 频道的数据:订阅变化、热门视频、观众留存、收益变化。",
- "youtube-channel-weekly.title": "YouTube 频道周报",
- "youtube-weekly-recap.description": "每周一帮你拉频道过去 7 天的播放、CTR、留存曲线,标出值得拍续集的选题",
- "youtube-weekly-recap.instruction": "每周一早上 9:00 拉我 YouTube 频道过去 7 天的播放、CTR、留存曲线,标出值得拍续集的选题。",
- "youtube-weekly-recap.title": "YouTube 周报",
- "zendesk-ticket-daily.description": "每天早上盘一下 Zendesk 工单:积压多少、SLA 逾期多少、重复问题前三名",
- "zendesk-ticket-daily.instruction": "每天早上 9:00 给我 Zendesk 快照:未关单积压、SLA 逾期数量、过去 24 小时 TOP 3 重复问题。",
- "zendesk-ticket-daily.title": "Zendesk 工单日报"
+ "section.title": "试试这些定时任务"
}
diff --git a/package.json b/package.json
index d887aca0c66..7ed0023492f 100644
--- a/package.json
+++ b/package.json
@@ -294,7 +294,7 @@
"@lobehub/desktop-ipc-typings": "workspace:*",
"@lobehub/editor": "^4.17.1",
"@lobehub/icons": "^5.0.0",
- "@lobehub/market-sdk": "0.34.0",
+ "@lobehub/market-sdk": "0.38.0",
"@lobehub/tts": "^5.1.2",
"@lobehub/ui": "^5.15.10",
"@modelcontextprotocol/sdk": "^1.26.0",
@@ -467,7 +467,7 @@
"@lobechat/types": "workspace:*",
"@lobehub/i18n-cli": "^1.26.0",
"@lobehub/lint": "2.1.5",
- "@lobehub/market-types": "^1.12.3",
+ "@lobehub/market-types": "^1.16.0",
"@lobehub/seo-cli": "^1.7.0",
"@peculiar/webcrypto": "^1.5.0",
"@playwright/test": "^1.58.0",
diff --git a/packages/const/src/taskTemplate.test.ts b/packages/const/src/taskTemplate.test.ts
index 172d2f2ec99..df8fffcebad 100644
--- a/packages/const/src/taskTemplate.test.ts
+++ b/packages/const/src/taskTemplate.test.ts
@@ -1,85 +1,21 @@
-import { parseCronPattern } from '@lobechat/utils/cron';
import { describe, expect, it } from 'vitest';
-import { INTEREST_AREA_KEYS } from './interests';
import {
- TASK_TEMPLATE_FALLBACK_CATEGORIES,
+ TASK_TEMPLATE_ICONS,
TASK_TEMPLATE_RECOMMEND_COUNT,
- taskTemplates,
+ TASK_TEMPLATE_RECOMMEND_MAX_COUNT,
} from './taskTemplate';
-const CRON_FIELDS = 5;
-const VALID_INTEREST_KEYS = new Set(INTEREST_AREA_KEYS);
-
-describe('taskTemplates', () => {
- it('has the expected number of templates', () => {
- expect(taskTemplates).toHaveLength(84);
- });
-
- it('has unique ids', () => {
- const ids = taskTemplates.map((t) => t.id);
- expect(new Set(ids).size).toBe(ids.length);
- });
-
- it('every template has non-empty interests from INTEREST_AREAS', () => {
- for (const t of taskTemplates) {
- expect(t.interests.length, `template ${t.id} interests`).toBeGreaterThan(0);
- for (const key of t.interests) {
- expect(VALID_INTEREST_KEYS.has(key), `template ${t.id} interest "${key}"`).toBe(true);
- }
- }
- });
-
- it('every template has a 5-field cron pattern', () => {
- for (const t of taskTemplates) {
- expect(t.cronPattern.trim().split(/\s+/), `template ${t.id} cron`).toHaveLength(CRON_FIELDS);
- }
- });
-
- // parseCronPattern only renders 'daily' / 'weekly' / 'hourly' schedule strings.
- // Monthly or event-driven cron patterns silently fall back to daily display —
- // guard against accidental introduction here.
- it('every template parses to daily or weekly schedule', () => {
- for (const t of taskTemplates) {
- const { scheduleType } = parseCronPattern(t.cronPattern);
- expect(['daily', 'weekly'], `template ${t.id} scheduleType`).toContain(scheduleType);
- }
- });
-
- it('covers every fallback category at least once', () => {
- const categories = new Set(taskTemplates.map((t) => t.category));
- for (const fallback of TASK_TEMPLATE_FALLBACK_CATEGORIES) {
- expect(categories.has(fallback), `fallback category ${fallback}`).toBe(true);
- }
- });
-
- it('every optionalSkills entry uses a valid source and non-empty provider', () => {
- for (const t of taskTemplates) {
- if (!t.optionalSkills) continue;
- for (const spec of t.optionalSkills) {
- expect(['composio', 'lobehub'], `template ${t.id} optional source`).toContain(spec.source);
- expect(
- spec.provider.length,
- `template ${t.id} optional provider "${spec.provider}"`,
- ).toBeGreaterThan(0);
- }
- }
+describe('taskTemplate constants', () => {
+ it('keeps the default recommendation count positive', () => {
+ expect(TASK_TEMPLATE_RECOMMEND_COUNT).toBeGreaterThan(0);
});
- it('optionalSkills do not duplicate requiresSkills', () => {
- for (const t of taskTemplates) {
- if (!t.optionalSkills || !t.requiresSkills) continue;
- const reqKeys = new Set(t.requiresSkills.map((s) => `${s.source}:${s.provider}`));
- for (const spec of t.optionalSkills) {
- expect(
- reqKeys.has(`${spec.source}:${spec.provider}`),
- `template ${t.id} duplicate skill ${spec.source}:${spec.provider}`,
- ).toBe(false);
- }
- }
+ it('keeps the maximum recommendation count above the default', () => {
+ expect(TASK_TEMPLATE_RECOMMEND_MAX_COUNT).toBeGreaterThanOrEqual(TASK_TEMPLATE_RECOMMEND_COUNT);
});
- it('keeps the recommendation default positive', () => {
- expect(TASK_TEMPLATE_RECOMMEND_COUNT).toBeGreaterThan(0);
+ it('keeps icon identifiers stable for renderers', () => {
+ expect(TASK_TEMPLATE_ICONS).toEqual(['github']);
});
});
diff --git a/packages/const/src/taskTemplate.ts b/packages/const/src/taskTemplate.ts
index f9b2fe70bfe..c14c01c11f3 100644
--- a/packages/const/src/taskTemplate.ts
+++ b/packages/const/src/taskTemplate.ts
@@ -1,68 +1,58 @@
import type { InterestAreaKey } from './interests';
-/**
- * Task Template catalog used by home "Try following tasks" recommendation.
- * I18n keys: `taskTemplate:${id}.title|description|prompt`.
- *
- * `interests` values must be canonical interest area keys — that's what
- * predefined `users.interests` entries store.
- */
-
-/**
- * Identifier for a per-template icon override. The renderer maps each value to
- * a concrete icon component; keep this union small and stable so consumers can
- * exhaustively type their registries.
- */
export const TASK_TEMPLATE_ICONS = ['github'] as const;
export type TaskTemplateIcon = (typeof TASK_TEMPLATE_ICONS)[number];
+export const TASK_TEMPLATE_CATEGORIES = [
+ 'content-creation',
+ 'engineering',
+ 'design',
+ 'learning-research',
+ 'business',
+ 'marketing',
+ 'product',
+ 'sales-customer',
+ 'operations',
+ 'hr',
+ 'finance-legal',
+ 'creator',
+ 'investing',
+ 'parenting',
+ 'health',
+ 'hobbies',
+ 'personal-life',
+] as const;
+
+export type TaskTemplateCategory = (typeof TASK_TEMPLATE_CATEGORIES)[number];
+
+export type TaskTemplateConnectorSource = 'composio' | 'lobehub';
+
+export interface TaskTemplateConnectorReference {
+ /** Short identifier from `LOBEHUB_SKILL_PROVIDERS[i].id` or `COMPOSIO_APP_TYPES[i].identifier`. */
+ identifier: string;
+ source: TaskTemplateConnectorSource;
+}
+
+export interface TaskTemplateConnector extends TaskTemplateConnectorReference {
+ /** Whether this connector must be authorized before the task can be created. */
+ required: boolean;
+}
+
export interface TaskTemplate {
category: TaskTemplateCategory;
+ connectors: TaskTemplateConnector[];
cronPattern: string;
+ description: string;
/** Optional icon identifier; consumers resolve it to a component. */
icon?: TaskTemplateIcon;
- id: string;
+ id: number;
+ identifier: string;
+ instruction: string;
interests: InterestAreaKey[];
- /** Skills that enrich the brief but are not required to run it. */
- optionalSkills?: TaskTemplateSkillRequirement[];
- /** Skill dependencies. The `source` field routes the connection flow. */
- requiresSkills?: TaskTemplateSkillRequirement[];
+ title: string;
}
-export interface TaskTemplateSkillRequirement {
- /** Short identifier from `LOBEHUB_SKILL_PROVIDERS[i].id` or `COMPOSIO_APP_TYPES[i].identifier`. */
- provider: string;
- source: TaskTemplateSkillSource;
-}
-
-export type TaskTemplateSkillSource = 'composio' | 'lobehub';
-
-export type TaskTemplateCategory =
- | 'content-creation'
- | 'engineering'
- | 'design'
- | 'learning-research'
- | 'business'
- | 'marketing'
- | 'product'
- | 'sales-customer'
- | 'operations'
- | 'hr'
- | 'finance-legal'
- | 'creator'
- | 'investing'
- | 'parenting'
- | 'health'
- | 'hobbies'
- | 'personal-life';
-
-/** Generic categories used to fill the pool when interest-matched picks are insufficient. */
-export const TASK_TEMPLATE_FALLBACK_CATEGORIES: TaskTemplateCategory[] = [
- 'personal-life',
- 'learning-research',
-];
-
/**
* Categories that only make sense in a personal context. When the recommendation
* is requested from inside a workspace, every template under these categories
@@ -78,583 +68,4 @@ export const TASK_TEMPLATE_PERSONAL_ONLY_CATEGORIES: TaskTemplateCategory[] = [
export const TASK_TEMPLATE_RECOMMEND_COUNT = 3;
-export const taskTemplates: TaskTemplate[] = [
- // content-creation
- {
- id: 'daily-topic-pick',
- category: 'content-creation',
- cronPattern: '0 9 * * *',
- interests: ['writing'],
- },
- {
- id: 'hot-topic-radar',
- category: 'content-creation',
- cronPattern: '0 10 * * *',
- interests: ['writing'],
- },
- {
- id: 'headline-inspiration',
- category: 'content-creation',
- cronPattern: '0 10 * * *',
- interests: ['writing'],
- },
- {
- id: 'viral-content-breakdown',
- category: 'content-creation',
- cronPattern: '0 10 * * *',
- interests: ['writing'],
- },
- {
- id: 'twitter-weekly-recap',
- category: 'content-creation',
- cronPattern: '0 10 * * 1',
- interests: ['writing', 'creator'],
- requiresSkills: [{ provider: 'twitter', source: 'lobehub' }],
- },
- {
- id: 'youtube-weekly-recap',
- category: 'content-creation',
- cronPattern: '0 9 * * 1',
- interests: ['writing', 'creator'],
- requiresSkills: [{ provider: 'youtube', source: 'composio' }],
- },
- {
- id: 'competitor-creator-tracking',
- category: 'content-creation',
- cronPattern: '0 9 * * *',
- interests: ['writing', 'creator'],
- },
- {
- id: 'content-calendar-weekly',
- category: 'content-creation',
- cronPattern: '0 20 * * 0',
- interests: ['writing', 'creator'],
- optionalSkills: [{ provider: 'notion', source: 'lobehub' }],
- },
-
- // engineering
- {
- id: 'oss-intel-daily',
- category: 'engineering',
- cronPattern: '0 9 * * *',
- icon: 'github',
- interests: ['coding'],
- },
- {
- id: 'repo-health-weekly',
- category: 'engineering',
- cronPattern: '0 9 * * 1',
- interests: ['coding'],
- requiresSkills: [{ provider: 'github', source: 'lobehub' }],
- },
- {
- id: 'dependency-security-weekly',
- category: 'engineering',
- cronPattern: '0 10 * * 1',
- interests: ['coding'],
- requiresSkills: [{ provider: 'github', source: 'lobehub' }],
- },
- {
- id: 'vercel-health-weekly',
- category: 'engineering',
- cronPattern: '0 10 * * 1',
- interests: ['coding'],
- requiresSkills: [{ provider: 'vercel', source: 'lobehub' }],
- },
- {
- id: 'linear-sprint-daily',
- category: 'engineering',
- cronPattern: '30 8 * * *',
- interests: ['coding', 'product'],
- requiresSkills: [{ provider: 'linear', source: 'lobehub' }],
- },
- {
- id: 'tech-trend-weekly',
- category: 'engineering',
- cronPattern: '0 8 * * 1',
- interests: ['coding'],
- },
- {
- id: 'keyword-tech-feed',
- category: 'engineering',
- cronPattern: '0 10 * * *',
- interests: ['coding'],
- },
-
- // design
- {
- id: 'daily-design-inspiration',
- category: 'design',
- cronPattern: '0 9 * * *',
- interests: ['design'],
- },
- {
- id: 'design-trend-weekly',
- category: 'design',
- cronPattern: '0 9 * * 1',
- interests: ['design'],
- },
- {
- id: 'figma-files-cleanup',
- category: 'design',
- cronPattern: '0 17 * * 5',
- interests: ['design'],
- requiresSkills: [{ provider: 'figma', source: 'composio' }],
- },
- {
- id: 'aigc-prompt-inspiration',
- category: 'design',
- cronPattern: '0 10 * * *',
- interests: ['design'],
- },
- {
- id: 'brand-watch-weekly',
- category: 'design',
- cronPattern: '0 10 * * 1',
- interests: ['design'],
- },
- {
- id: 'font-color-weekly',
- category: 'design',
- cronPattern: '0 10 * * 3',
- interests: ['design'],
- },
-
- // learning-research
- {
- id: 'arxiv-curated-daily',
- category: 'learning-research',
- cronPattern: '0 9 * * *',
- interests: ['education'],
- },
- {
- id: 'must-read-papers-weekly',
- category: 'learning-research',
- cronPattern: '0 20 * * 0',
- interests: ['education'],
- },
- {
- id: 'language-morning-bite',
- category: 'learning-research',
- cronPattern: '30 7 * * *',
- interests: ['education'],
- },
- {
- id: 'industry-research-weekly',
- category: 'learning-research',
- cronPattern: '0 9 * * 1',
- interests: ['education', 'business'],
- },
-
- // business
- {
- id: 'industry-morning-brief',
- category: 'business',
- cronPattern: '0 8 * * *',
- interests: ['business'],
- },
- {
- id: 'competitor-radar-daily',
- category: 'business',
- cronPattern: '0 9 * * *',
- interests: ['business'],
- },
- {
- id: 'funding-intel-daily',
- category: 'business',
- cronPattern: '0 10 * * *',
- interests: ['business'],
- },
- {
- id: 'macro-economy-weekly',
- category: 'business',
- cronPattern: '0 8 * * 1',
- interests: ['business', 'investing'],
- },
- {
- id: 'weekly-meeting-brief',
- category: 'business',
- cronPattern: '30 8 * * 1',
- interests: ['business'],
- },
-
- // marketing
- {
- id: 'marketing-hot-radar',
- category: 'marketing',
- cronPattern: '0 10 * * *',
- interests: ['marketing'],
- },
- {
- id: 'ad-creative-inspiration',
- category: 'marketing',
- cronPattern: '0 10 * * *',
- interests: ['marketing'],
- },
- {
- id: 'brand-mention-daily',
- category: 'marketing',
- cronPattern: '0 18 * * *',
- interests: ['marketing'],
- requiresSkills: [{ provider: 'twitter', source: 'lobehub' }],
- },
- {
- id: 'seo-weekly-report',
- category: 'marketing',
- cronPattern: '0 9 * * 1',
- interests: ['marketing'],
- },
- {
- id: 'newsletter-perf-weekly',
- category: 'marketing',
- cronPattern: '0 10 * * 1',
- interests: ['marketing'],
- requiresSkills: [{ provider: 'gmail', source: 'composio' }],
- },
- {
- id: 'kol-collab-calendar',
- category: 'marketing',
- cronPattern: '0 9 * * 1',
- interests: ['marketing'],
- requiresSkills: [{ provider: 'airtable', source: 'composio' }],
- },
- {
- id: 'hubspot-funnel-daily',
- category: 'marketing',
- cronPattern: '0 9 * * *',
- interests: ['marketing', 'sales'],
- requiresSkills: [{ provider: 'hubspot', source: 'composio' }],
- },
-
- // product
- {
- id: 'user-feedback-daily',
- category: 'product',
- cronPattern: '0 9 * * *',
- interests: ['product'],
- },
- {
- id: 'competitor-update-daily',
- category: 'product',
- cronPattern: '0 10 * * *',
- interests: ['product'],
- },
- {
- id: 'standup-brief',
- category: 'product',
- cronPattern: '30 8 * * *',
- interests: ['product'],
- requiresSkills: [{ provider: 'linear', source: 'lobehub' }],
- },
- {
- id: 'iteration-recap-weekly',
- category: 'product',
- cronPattern: '0 17 * * 5',
- interests: ['product'],
- requiresSkills: [{ provider: 'linear', source: 'lobehub' }],
- },
- {
- id: 'core-metric-daily',
- category: 'product',
- cronPattern: '0 9 * * *',
- interests: ['product'],
- },
- {
- id: 'user-interview-schedule',
- category: 'product',
- cronPattern: '0 9 * * 1',
- interests: ['product'],
- requiresSkills: [{ provider: 'google-calendar', source: 'composio' }],
- },
- {
- id: 'prd-review-reminder',
- category: 'product',
- cronPattern: '0 15 * * 5',
- interests: ['product'],
- requiresSkills: [{ provider: 'notion', source: 'lobehub' }],
- },
-
- // sales-customer
- {
- id: 'daily-followup-list',
- category: 'sales-customer',
- cronPattern: '0 9 * * *',
- interests: ['sales'],
- requiresSkills: [{ provider: 'hubspot', source: 'composio' }],
- },
- {
- id: 'renewal-risk-weekly',
- category: 'sales-customer',
- cronPattern: '0 9 * * 1',
- interests: ['sales'],
- requiresSkills: [{ provider: 'hubspot', source: 'composio' }],
- },
- {
- id: 'deal-pipeline-weekly',
- category: 'sales-customer',
- cronPattern: '0 16 * * 5',
- interests: ['sales'],
- requiresSkills: [{ provider: 'hubspot', source: 'composio' }],
- },
- {
- id: 'key-account-radar',
- category: 'sales-customer',
- cronPattern: '0 9 * * *',
- interests: ['sales'],
- },
- {
- id: 'zendesk-ticket-daily',
- category: 'sales-customer',
- cronPattern: '0 9 * * *',
- interests: ['sales'],
- requiresSkills: [{ provider: 'zendesk', source: 'composio' }],
- },
-
- // operations
- {
- id: 'morning-brief',
- category: 'operations',
- cronPattern: '0 8 * * *',
- interests: ['operations'],
- requiresSkills: [{ provider: 'google-calendar', source: 'composio' }],
- },
- {
- id: 'meeting-brief',
- category: 'operations',
- cronPattern: '30 8 * * *',
- interests: ['operations'],
- requiresSkills: [{ provider: 'google-calendar', source: 'composio' }],
- },
- {
- id: 'calendar-conflict-check',
- category: 'operations',
- cronPattern: '30 7 * * *',
- interests: ['operations'],
- requiresSkills: [{ provider: 'google-calendar', source: 'composio' }],
- },
- {
- id: 'friday-wrap-list',
- category: 'operations',
- cronPattern: '0 16 * * 5',
- interests: ['operations'],
- requiresSkills: [{ provider: 'linear', source: 'lobehub' }],
- },
-
- // hr
- {
- id: 'recruit-funnel-daily',
- category: 'hr',
- cronPattern: '0 9 * * *',
- interests: ['hr'],
- requiresSkills: [{ provider: 'airtable', source: 'composio' }],
- },
- {
- id: 'onboarding-buddy-weekly',
- category: 'hr',
- cronPattern: '0 9 * * 1',
- interests: ['hr'],
- requiresSkills: [{ provider: 'notion', source: 'lobehub' }],
- },
- {
- id: 'team-status-weekly',
- category: 'hr',
- cronPattern: '0 9 * * 1',
- interests: ['hr'],
- requiresSkills: [{ provider: 'google-calendar', source: 'composio' }],
- },
-
- // finance-legal
- {
- id: 'precious-metals-daily',
- category: 'finance-legal',
- cronPattern: '0 16 * * *',
- interests: ['finance-legal', 'investing'],
- },
- {
- id: 'pre-market-brief',
- category: 'finance-legal',
- cronPattern: '0 9 * * *',
- interests: ['finance-legal', 'investing'],
- },
- {
- id: 'cashflow-weekly',
- category: 'finance-legal',
- cronPattern: '0 9 * * 1',
- interests: ['finance-legal'],
- requiresSkills: [{ provider: 'airtable', source: 'composio' }],
- },
- {
- id: 'contract-expiry-weekly',
- category: 'finance-legal',
- cronPattern: '0 9 * * 1',
- interests: ['finance-legal'],
- requiresSkills: [{ provider: 'notion', source: 'lobehub' }],
- },
- {
- id: 'regulation-watch-weekly',
- category: 'finance-legal',
- cronPattern: '0 10 * * 1',
- interests: ['finance-legal'],
- },
- {
- id: 'invoice-collection-daily',
- category: 'finance-legal',
- cronPattern: '0 10 * * *',
- interests: ['finance-legal'],
- requiresSkills: [{ provider: 'gmail', source: 'composio' }],
- },
-
- // creator
- {
- id: 'cross-platform-engagement-daily',
- category: 'creator',
- cronPattern: '0 9 * * *',
- interests: ['creator'],
- requiresSkills: [{ provider: 'twitter', source: 'lobehub' }],
- },
- {
- id: 'brand-collab-weekly',
- category: 'creator',
- cronPattern: '0 10 * * 1',
- interests: ['creator'],
- },
- {
- id: 'follower-growth-weekly',
- category: 'creator',
- cronPattern: '0 10 * * 1',
- interests: ['creator'],
- requiresSkills: [{ provider: 'twitter', source: 'lobehub' }],
- },
- {
- id: 'youtube-channel-weekly',
- category: 'creator',
- cronPattern: '0 9 * * 1',
- interests: ['creator'],
- requiresSkills: [{ provider: 'youtube', source: 'composio' }],
- },
- {
- id: 'monetization-opportunity-weekly',
- category: 'creator',
- cronPattern: '0 10 * * 3',
- interests: ['creator'],
- },
-
- // investing
- {
- id: 'portfolio-daily',
- category: 'investing',
- cronPattern: '0 16 * * *',
- interests: ['investing'],
- },
- {
- id: 'crypto-market-daily',
- category: 'investing',
- cronPattern: '0 9 * * *',
- interests: ['investing'],
- },
-
- // parenting
- {
- id: 'child-growth-weekly',
- category: 'parenting',
- cronPattern: '0 9 * * 1',
- interests: ['parenting'],
- },
- {
- id: 'child-study-weekly',
- category: 'parenting',
- cronPattern: '0 20 * * 0',
- interests: ['parenting', 'education'],
- },
- {
- id: 'family-finance-weekly',
- category: 'parenting',
- cronPattern: '0 20 * * 0',
- interests: ['parenting', 'finance-legal'],
- requiresSkills: [{ provider: 'google-sheets', source: 'composio' }],
- },
- {
- id: 'family-task-schedule',
- category: 'parenting',
- cronPattern: '0 8 * * 1',
- interests: ['parenting'],
- optionalSkills: [{ provider: 'google-calendar', source: 'composio' }],
- },
-
- // health
- {
- id: 'diet-log-companion',
- category: 'health',
- cronPattern: '0 21 * * *',
- interests: ['health'],
- },
-
- // hobbies
- {
- id: 'podcast-new-episodes',
- category: 'hobbies',
- cronPattern: '0 9 * * 1',
- interests: ['hobbies'],
- },
- {
- id: 'newsletter-aggregator',
- category: 'hobbies',
- cronPattern: '0 20 * * 0',
- interests: ['hobbies'],
- requiresSkills: [{ provider: 'gmail', source: 'composio' }],
- },
- {
- id: 'series-update-weekly',
- category: 'hobbies',
- cronPattern: '0 9 * * 1',
- interests: ['hobbies'],
- },
- {
- id: 'travel-inspiration-weekly',
- category: 'hobbies',
- cronPattern: '0 10 * * 3',
- interests: ['hobbies'],
- },
- {
- id: 'watchlist-friday',
- category: 'hobbies',
- cronPattern: '0 18 * * 5',
- interests: ['hobbies'],
- },
- {
- id: 'exhibition-event-weekly',
- category: 'hobbies',
- cronPattern: '0 10 * * 1',
- interests: ['hobbies'],
- },
-
- // personal-life
- {
- id: 'daily-learning-bite',
- category: 'personal-life',
- cronPattern: '30 7 * * *',
- interests: ['education', 'personal'],
- },
- {
- id: 'sunday-reflection',
- category: 'personal-life',
- cronPattern: '0 21 * * 0',
- interests: ['personal'],
- },
- {
- id: 'morning-ritual',
- category: 'personal-life',
- cronPattern: '0 7 * * *',
- interests: ['personal'],
- optionalSkills: [{ provider: 'google-calendar', source: 'composio' }],
- },
- {
- id: 'bedtime-gratitude',
- category: 'personal-life',
- cronPattern: '0 22 * * *',
- interests: ['personal'],
- optionalSkills: [{ provider: 'notion', source: 'lobehub' }],
- },
-];
-
-export const KNOWN_TASK_TEMPLATE_IDS: ReadonlySet<string> = new Set(taskTemplates.map((t) => t.id));
+export const TASK_TEMPLATE_RECOMMEND_MAX_COUNT = 10;
diff --git a/packages/locales/src/default/taskTemplate.ts b/packages/locales/src/default/taskTemplate.ts
index 6cc847404a3..1518aca7387 100644
--- a/packages/locales/src/default/taskTemplate.ts
+++ b/packages/locales/src/default/taskTemplate.ts
@@ -20,525 +20,4 @@ export default {
'card.templateTag': 'Template',
'section.title': 'Try these scheduled tasks',
-
- // ===== content-creation =====
- 'daily-topic-pick.title': 'Daily topic radar',
- 'daily-topic-pick.description':
- 'Each morning, scan the top 10 pieces that performed best in your niche yesterday and break down the angles.',
- 'daily-topic-pick.instruction':
- 'Every morning at 09:00, gather the 10 best-performing pieces of content from my niche yesterday, break down their angles, and pick 1-2 I could publish today.',
-
- 'hot-topic-radar.title': 'Hot topic radar',
- 'hot-topic-radar.description':
- 'Each morning, surface 5 topics heating up in your space — get in before the red ocean.',
- 'hot-topic-radar.instruction':
- 'Every morning at 10:00, surface 5 topics in my niche that are heating up but not yet saturated, with a one-line note on why each is worth jumping on now.',
-
- 'headline-inspiration.title': 'Headline inspiration',
- 'headline-inspiration.description':
- 'Each morning, 10 on-brand headline templates reverse-engineered from recent hits.',
- 'headline-inspiration.instruction':
- 'Every morning at 10:00, give me 10 headline templates matching my voice, reverse-engineered from recent viral pieces in my niche. I should be able to copy them directly when stuck.',
-
- 'viral-content-breakdown.title': 'Viral content breakdown',
- 'viral-content-breakdown.description':
- 'Each morning, deconstruct one viral piece in your space — angle, hook, structure, ending.',
- 'viral-content-breakdown.instruction':
- 'Every morning at 10:00, pick one viral piece of content from my niche and deconstruct it: angle, opening hook, structure, ending. Give me a template I can apply.',
-
- 'twitter-weekly-recap.title': 'X (Twitter) weekly recap',
- 'twitter-weekly-recap.description':
- 'Every Monday, review last week on X: best growth, worst engagement, and why.',
- 'twitter-weekly-recap.instruction':
- 'Every Monday at 10:00, recap my X (Twitter) activity from the past 7 days: top growth tweets, worst-engaging tweets, and a hypothesis for each. Suggest 3 angles to try this week.',
-
- 'youtube-weekly-recap.title': 'YouTube weekly recap',
- 'youtube-weekly-recap.description':
- 'Every Monday, pull last week of channel performance — views, CTR, retention — and flag follow-up topics.',
- 'youtube-weekly-recap.instruction':
- 'Every Monday at 09:00, pull my YouTube channel performance for the past 7 days: views, CTR, retention curves. Highlight which videos deserve a follow-up.',
-
- 'competitor-creator-tracking.title': 'Competitor creators tracking',
- 'competitor-creator-tracking.description':
- 'Tell me 3-5 creators to watch — each morning I track what they shipped and what worked.',
- 'competitor-creator-tracking.instruction':
- 'Every morning at 09:00, track the 3-5 creators I follow as competitors: what they posted, how it performed, and ideas I could adapt.',
-
- 'content-calendar-weekly.title': 'Weekly content calendar',
- 'content-calendar-weekly.description':
- 'Every Sunday night, plan next week’s 7-day publishing schedule aligned with holidays and trending moments.',
- 'content-calendar-weekly.instruction':
- 'Every Sunday at 20:00, plan next week’s 7-day publishing schedule for me: align slots with upcoming holidays and trending moments, and suggest one angle per slot. If Notion is connected, draft the schedule there.',
-
- // ===== engineering =====
- 'oss-intel-daily.title': 'Open-source intel daily',
- 'oss-intel-daily.description':
- 'Each morning, 10 tech stack updates: GitHub Trending, big-name open-sourcing, key repo releases.',
- 'oss-intel-daily.instruction':
- 'Every morning at 09:00, give me 10 tech-stack updates: GitHub Trending, notable open-source releases from big companies, and new releases from repos in my stack.',
-
- 'repo-health-weekly.title': 'Repo health weekly',
- 'repo-health-weekly.description':
- 'Every Monday, review your repos: issue backlog, stalled PRs, CI failures, dependency alerts.',
- 'repo-health-weekly.instruction':
- 'Every Monday at 09:00, review the GitHub repos I maintain: issue backlog, stalled PRs, CI failures, dependency alerts. Surface what needs attention this week.',
-
- 'dependency-security-weekly.title': 'Dependency security check',
- 'dependency-security-weekly.description':
- 'Every Monday, scan your projects for vulnerabilities and outdated packages with upgrade priority.',
- 'dependency-security-weekly.instruction':
- 'Every Monday at 10:00, scan my GitHub projects for vulnerable and outdated dependencies. Suggest upgrade priority based on severity and breaking-change risk.',
-
- 'vercel-health-weekly.title': 'Vercel health weekly',
- 'vercel-health-weekly.description':
- 'Every Monday, review last week of deployments: success rate, build duration, traffic anomalies.',
- 'vercel-health-weekly.instruction':
- 'Every Monday at 10:00, recap my Vercel deployments from the past week: success rate, build duration, traffic anomalies. Flag accumulating issues.',
-
- 'linear-sprint-daily.title': 'Linear sprint daily',
- 'linear-sprint-daily.description':
- 'Each morning, sync sprint progress: blockers, overdue items, today’s focus — ready before standup.',
- 'linear-sprint-daily.instruction':
- 'Every morning at 08:30, sync my Linear sprint: blockers, overdue items, what I should focus on today. Format as a 5-minute pre-standup brief.',
-
- 'tech-trend-weekly.title': 'Tech trend weekly',
- 'tech-trend-weekly.description':
- 'Every Monday, summarize key moves in frontend/backend/AI: papers, frameworks, funding.',
- 'tech-trend-weekly.instruction':
- 'Every Monday at 08:00, summarize the past week of frontend, backend, and AI movements: notable papers, framework releases, funding rounds. 10 items with one-line takeaways.',
-
- 'keyword-tech-feed.title': 'Keyword tech feed',
- 'keyword-tech-feed.description':
- 'Tell me technical keywords to track — each day I bring back 5 high-quality posts and threads.',
- 'keyword-tech-feed.instruction':
- 'Every morning at 10:00, fetch 5 high-quality new posts, blog articles, or Q&As matching my tracked technical keywords.',
-
- // ===== design =====
- 'daily-design-inspiration.title': 'Daily design inspiration',
- 'daily-design-inspiration.description':
- 'Each morning, curate 10 works from Dribbble, Behance, Awwwards and Pinterest that match your style.',
- 'daily-design-inspiration.instruction':
- 'Every morning at 09:00, curate 10 design works from Dribbble, Behance, Awwwards, and Pinterest that match my style, with a short note on what makes each one stand out.',
-
- 'design-trend-weekly.title': 'Design trend weekly',
- 'design-trend-weekly.description':
- 'Every Monday, 3 trends in UI / branding / illustration with 5 representative examples.',
- 'design-trend-weekly.instruction':
- 'Every Monday at 09:00, give me 3 emerging trends across UI, branding, and illustration this week, with 5 representative examples. Help me stay current.',
-
- 'figma-files-cleanup.title': 'Figma files cleanup',
- 'figma-files-cleanup.description':
- 'Every Friday, review recently-edited Figma files — flag what to archive, what to hand off to dev.',
- 'figma-files-cleanup.instruction':
- 'Every Friday at 17:00, review my recently-edited Figma files. Flag which should be archived, which need hand-off to engineering, and which still need polish.',
-
- 'aigc-prompt-inspiration.title': 'AIGC prompt inspiration',
- 'aigc-prompt-inspiration.description':
- 'Each morning, 5 curated prompts (Midjourney / SD / Flux) sorted by style — try one today.',
- 'aigc-prompt-inspiration.instruction':
- 'Every morning at 10:00, give me 5 curated prompts for Midjourney, Stable Diffusion, or Flux, grouped by style. Each prompt should be ready to copy and try.',
-
- 'brand-watch-weekly.title': 'Brand watch weekly',
- 'brand-watch-weekly.description':
- 'Every Monday, track 10 big-brand updates — logo refresh, identity, website redesigns — with breakdown.',
- 'brand-watch-weekly.instruction':
- 'Every Monday at 10:00, track 10 brand updates from companies I follow: logo refreshes, identity changes, website redesigns. Add a one-paragraph breakdown of each.',
-
- 'font-color-weekly.title': 'Font & color weekly',
- 'font-color-weekly.description':
- 'Every Wednesday, 3 type pairings + 3 color palettes worth saving to your inspiration library.',
- 'font-color-weekly.instruction':
- 'Every Wednesday at 10:00, hand me 3 noteworthy type pairings and 3 color palettes worth saving. Include where to license each typeface.',
-
- // ===== learning-research =====
- 'arxiv-curated-daily.title': 'ArXiv daily picks',
- 'arxiv-curated-daily.description':
- 'Each morning, 5 fresh arXiv papers in your research area with one-line summaries.',
- 'arxiv-curated-daily.instruction':
- 'Every morning at 09:00, pick 5 of the latest arXiv papers in my research area and give me a one-line summary for each, so I can decide which to read in depth.',
-
- 'must-read-papers-weekly.title': 'Must-read papers weekly',
- 'must-read-papers-weekly.description':
- 'Every Sunday night, 3 most-cited / most-discussed papers from this week as a deep-read list.',
- 'must-read-papers-weekly.instruction':
- 'Every Sunday at 20:00, pick the 3 papers from my research area that were most cited or most discussed this week. Curate a deep-read list I can finish over the weekend.',
-
- 'language-morning-bite.title': 'Language morning bite',
- 'language-morning-bite.description':
- 'Each morning, a 3-minute target-language read + 5 vocabulary cards. Learn during your commute.',
- 'language-morning-bite.instruction':
- 'Every morning at 07:30, give me a 3-minute reading in my target language plus 5 vocabulary cards (word, definition, example sentence).',
-
- 'industry-research-weekly.title': 'Industry research weekly',
- 'industry-research-weekly.description':
- 'Every Monday, market dynamics, funding, new players and regulatory shifts in your sector.',
- 'industry-research-weekly.instruction':
- 'Every Monday at 09:00, summarize the past week in my sector: market dynamics, funding rounds, new entrants, regulatory shifts. Format as a research brief.',
-
- // ===== business =====
- 'industry-morning-brief.title': 'Industry morning brief',
- 'industry-morning-brief.description':
- 'Each morning, condense 5 important news items, funding rounds and policy shifts in your industry into a 5-minute read.',
- 'industry-morning-brief.instruction':
- 'Every morning at 08:00, condense 5 important news items, funding rounds, and policy shifts from my industry into a 5-minute read.',
-
- 'competitor-radar-daily.title': 'Competitor radar',
- 'competitor-radar-daily.description':
- 'Tell me 3-5 competitors — each day I track website updates, launches, hiring signals, social.',
- 'competitor-radar-daily.instruction':
- 'Every morning at 09:00, track 3-5 of my competitors: website changes, product launches, hiring signals, social activity. Surface what implies strategic moves.',
-
- 'funding-intel-daily.title': 'Funding intel daily',
- 'funding-intel-daily.description':
- 'Each morning, 3-5 funding announcements in your space: who raised, valuation, who led.',
- 'funding-intel-daily.instruction':
- 'Every morning at 10:00, give me 3-5 funding announcements in my space from the past 24 hours: who raised, how much, valuation if disclosed, lead investor.',
-
- 'macro-economy-weekly.title': 'Macro economy weekly',
- 'macro-economy-weekly.description':
- 'Every Monday morning, FX, rates, oil, gold, major indices — context before cross-border calls.',
- 'macro-economy-weekly.instruction':
- 'Every Monday at 08:00, give me a macro snapshot: FX rates, interest rates, oil, gold, silver, major equity indices. Add a one-paragraph "what changed" summary.',
-
- 'weekly-meeting-brief.title': 'Weekly meeting brief',
- 'weekly-meeting-brief.description':
- 'Every Monday, prep 3 talking points for your weekly strategy meeting: trends, internals, decisions.',
- 'weekly-meeting-brief.instruction':
- 'Every Monday at 08:30, prepare 3 talking points for this week’s strategy meeting: industry trends, internal metrics worth raising, and decisions that need to be made.',
-
- // ===== marketing =====
- 'marketing-hot-radar.title': 'Marketing hot radar',
- 'marketing-hot-radar.description':
- 'Each morning, track 5 marketing topics heating up in your industry — which to ride, which to avoid.',
- 'marketing-hot-radar.instruction':
- 'Every morning at 10:00, track 5 marketing topics heating up in my industry, flag which ones to ride and which to avoid, with 1-2 sentence reasoning.',
-
- 'ad-creative-inspiration.title': 'Ad creative inspiration',
- 'ad-creative-inspiration.description':
- 'Each morning, scan competitor / benchmark ads (Meta / Google Ad Library) — 10 we could adapt.',
- 'ad-creative-inspiration.instruction':
- 'Every morning at 10:00, scan recent ad creative from my competitors and benchmark brands across Meta and Google Ad Library. Pick 10 worth adapting and explain why.',
-
- 'brand-mention-daily.title': 'Brand mentions daily',
- 'brand-mention-daily.description':
- 'Tell me brands / keywords to track — each evening, mention volume, sentiment, top voices.',
- 'brand-mention-daily.instruction':
- 'Every evening at 18:00, summarize today’s mentions of my tracked brands and keywords on X (Twitter): volume, sentiment, top voices. Flag any unusual spikes.',
-
- 'seo-weekly-report.title': 'SEO weekly report',
- 'seo-weekly-report.description':
- 'Every Monday, ranking movement, emerging keywords, and pages worth refreshing.',
- 'seo-weekly-report.instruction':
- 'Every Monday at 09:00, give me a lightweight SEO weekly: top ranking movers (up/down), 5 emerging keywords worth targeting, and 3 existing pages ripe for a content refresh.',
-
- 'newsletter-perf-weekly.title': 'Newsletter performance weekly',
- 'newsletter-perf-weekly.description':
- 'Every Monday, open-rate, CTR, and unsubscribe trends — flag what to optimize.',
- 'newsletter-perf-weekly.instruction':
- 'Every Monday at 10:00, review my newsletter open rate, click-through rate, and unsubscribe trends from the past 4 weeks. Flag which segments need optimization.',
-
- 'kol-collab-calendar.title': 'KOL collab calendar',
- 'kol-collab-calendar.description':
- 'Every Monday, sync ongoing KOL collabs: who’s due, who’s overdue, performance so far.',
- 'kol-collab-calendar.instruction':
- 'Every Monday at 09:00, review the KOL collabs I’m running: who’s due to post, who’s overdue, and performance numbers for completed posts.',
-
- 'hubspot-funnel-daily.title': 'HubSpot funnel daily',
- 'hubspot-funnel-daily.description':
- 'Each morning, track MQL / SQL / closed-won funnel changes — flag where deals are leaking.',
- 'hubspot-funnel-daily.instruction':
- 'Every morning at 09:00, review my HubSpot funnel: MQL, SQL, and closed-won movements. Highlight stages with high drop-off compared to the previous week.',
-
- // ===== product =====
- 'user-feedback-daily.title': 'User feedback daily',
- 'user-feedback-daily.description':
- 'Each morning, aggregate feedback from all channels (stores, social, support) into top 20 items, sorted by sentiment and theme.',
- 'user-feedback-daily.instruction':
- 'Every morning at 09:00, aggregate user feedback from all channels (app stores, social media, customer support) into the top 20 items, sorted by sentiment and theme.',
-
- 'competitor-update-daily.title': 'Competitor product updates',
- 'competitor-update-daily.description':
- 'Tell me 3-5 competitors — each day I check changelogs, new features and website changes.',
- 'competitor-update-daily.instruction':
- 'Every morning at 10:00, monitor 3-5 competitor products: changelogs, new features, website copy changes. Flag any signal worth a deeper look.',
-
- 'standup-brief.title': 'Standup brief',
- 'standup-brief.description':
- 'Each morning before standup, pull a Linear progress brief: today’s focus, blockers, yesterday done.',
- 'standup-brief.instruction':
- 'Every morning at 08:30, pull a Linear progress brief: today’s focus, blockers, what I closed yesterday. Format as 3 bullets ready to read aloud at standup.',
-
- 'iteration-recap-weekly.title': 'Iteration recap weekly',
- 'iteration-recap-weekly.description':
- 'Every Friday afternoon, this iteration’s data: completion rate, overdue items, new bugs.',
- 'iteration-recap-weekly.instruction':
- 'Every Friday at 17:00, recap this week’s iteration: completion rate, overdue items, new bugs filed. Format ready to drop into Monday’s retrospective.',
-
- 'core-metric-daily.title': 'Core metrics daily',
- 'core-metric-daily.description':
- 'Tell me which metrics to watch (DAU, retention, conversion) — each morning I sync the deltas.',
- 'core-metric-daily.instruction':
- 'Every morning at 09:00, sync the changes in my core metrics (DAU, retention, conversion). Compare against yesterday and the 7-day average.',
-
- 'user-interview-schedule.title': 'User interview prep',
- 'user-interview-schedule.description':
- 'Every Monday, walk through this week’s interviews: who, when, are the questions ready.',
- 'user-interview-schedule.instruction':
- 'Every Monday at 09:00, list this week’s scheduled user interviews: participant name, time, prep checklist (questions ready, recording set up).',
-
- 'prd-review-reminder.title': 'PRD review reminder',
- 'prd-review-reminder.description':
- 'Every Friday, list PRDs due for review this week — don’t leave docs stuck in draft.',
- 'prd-review-reminder.instruction':
- 'Every Friday at 15:00, review the PRDs and decision docs in my Notion that are due for review this week. Flag anything still stuck in draft.',
-
- // ===== sales-customer =====
- 'daily-followup-list.title': 'Daily follow-up list',
- 'daily-followup-list.description':
- 'Each morning, prioritized list of customers to follow up with today, with last-touch context.',
- 'daily-followup-list.instruction':
- 'Every morning at 09:00, build a prioritized follow-up list for today from my HubSpot contacts. For each, summarize the last interaction.',
-
- 'renewal-risk-weekly.title': 'Renewal risk weekly',
- 'renewal-risk-weekly.description':
- 'Every Monday, flag this month’s renewals — especially accounts with declining usage.',
- 'renewal-risk-weekly.instruction':
- 'Every Monday at 09:00, review HubSpot contracts expiring this month and flag accounts with declining usage. Suggest a save play for each at-risk account.',
-
- 'deal-pipeline-weekly.title': 'Deal pipeline weekly',
- 'deal-pipeline-weekly.description':
- 'Every Friday, every deal in pipeline: moving, stalled, expected close this month.',
- 'deal-pipeline-weekly.instruction':
- 'Every Friday at 16:00, review every deal in my HubSpot pipeline: which moved this week, which stalled, and projected close-won by end of month.',
-
- 'key-account-radar.title': 'Key account radar',
- 'key-account-radar.description':
- 'Tell me your key accounts — each day I track their news, funding, exec changes.',
- 'key-account-radar.instruction':
- 'Every morning at 09:00, scan news on my key accounts: company news, funding, executive changes. Surface anything I could use as a renewal conversation hook.',
-
- 'zendesk-ticket-daily.title': 'Zendesk ticket daily',
- 'zendesk-ticket-daily.description':
- 'Each morning, Zendesk snapshot: backlog size, SLA breaches, top recurring issues.',
- 'zendesk-ticket-daily.instruction':
- 'Every morning at 09:00, give me a Zendesk snapshot: open ticket backlog, SLA breaches, and the top 3 recurring issues from the past 24 hours.',
-
- // ===== operations =====
- 'morning-brief.title': 'Morning brief',
- 'morning-brief.description':
- 'Every day at 8: today’s schedule, pending email count, todos, weather. Read on the way in.',
- 'morning-brief.instruction':
- 'Every morning at 08:00, send me: today’s calendar, pending email count, top 3 todos, and weather. Format as a 1-minute read.',
-
- 'meeting-brief.title': 'Meeting prep brief',
- 'meeting-brief.description':
- 'Each morning, prep 1-page brief for every meeting today: context, attendees, last notes.',
- 'meeting-brief.instruction':
- 'Every morning at 08:30, generate a 1-page prep brief for every meeting on my calendar today: context, attendees, last meeting notes. Read before walking in.',
-
- 'calendar-conflict-check.title': 'Calendar conflict check',
- 'calendar-conflict-check.description':
- 'Each morning, scan today for conflicts, back-to-back meetings, insufficient travel time.',
- 'calendar-conflict-check.instruction':
- 'Every morning at 07:30, scan today’s calendar for conflicts, back-to-back meetings, or insufficient travel/buffer time. Suggest fixes.',
-
- 'friday-wrap-list.title': 'Friday wrap list',
- 'friday-wrap-list.description':
- 'Every Friday afternoon: what didn’t finish, what ships Monday, the first thing for next week.',
- 'friday-wrap-list.instruction':
- 'Every Friday at 16:00, list: what I didn’t finish this week, what needs to ship Monday, and the first thing I should pick up next week.',
-
- // ===== hr =====
- 'recruit-funnel-daily.title': 'Recruit funnel daily',
- 'recruit-funnel-daily.description':
- 'Each morning, candidates per role: new applications, awaiting interview, awaiting feedback.',
- 'recruit-funnel-daily.instruction':
- 'Every morning at 09:00, summarize the recruit funnel by role: new applications, candidates awaiting interview, candidates awaiting feedback. Flag interviewers who are blocking.',
-
- 'onboarding-buddy-weekly.title': 'New hire onboarding',
- 'onboarding-buddy-weekly.description':
- 'Every Monday, new hires within 90 days: progress, buddy feedback, what to focus on.',
- 'onboarding-buddy-weekly.instruction':
- 'Every Monday at 09:00, generate a progress update for each new hire still within their first 90 days: tasks completed, buddy feedback, what they should focus on this week.',
-
- 'team-status-weekly.title': 'Team status weekly',
- 'team-status-weekly.description':
- 'Every Monday, team PTO, overtime, meeting load trends — early warning for burnout.',
- 'team-status-weekly.instruction':
- 'Every Monday at 09:00, review the team’s past week: PTO, overtime hours, meeting load. Flag anyone trending toward burnout.',
-
- // ===== finance-legal =====
- 'precious-metals-daily.title': 'Metals & energy daily',
- 'precious-metals-daily.description':
- 'Each market close, gold, silver, copper and oil prices with day change — flag big moves.',
- 'precious-metals-daily.instruction':
- 'Every day at 16:00 (after close), give me prices and day-over-day change for gold, silver, copper, and oil. Flag any move above 2%.',
-
- 'pre-market-brief.title': 'Pre-market brief',
- 'pre-market-brief.description':
- 'Each morning before open, macro headlines, key earnings, news on companies you hold.',
- 'pre-market-brief.instruction':
- 'Every morning at 09:00, give me a pre-market brief: macro headlines, key earnings released today, and news on the companies in my portfolio.',
-
- 'cashflow-weekly.title': 'Cashflow weekly',
- 'cashflow-weekly.description':
- 'Every Monday, what’s coming in this week, what’s going out, large expenses next week.',
- 'cashflow-weekly.instruction':
- 'Every Monday at 09:00, review cashflow: receivables due this week, payables due, and large expenses scheduled for next week.',
-
- 'contract-expiry-weekly.title': 'Contract expiry weekly',
- 'contract-expiry-weekly.description':
- 'Every Monday, contracts expiring next month (subscriptions, leases, partnerships).',
- 'contract-expiry-weekly.instruction':
- 'Every Monday at 09:00, list contracts (subscriptions, leases, partnerships) expiring in the next 30 days. Flag which to renew, which to cancel.',
-
- 'regulation-watch-weekly.title': 'Regulation watch weekly',
- 'regulation-watch-weekly.description':
- 'Tell me your compliance areas (data, tax, labor) — every Monday a change summary with impact.',
- 'regulation-watch-weekly.instruction':
- 'Every Monday at 10:00, summarize regulatory changes in my tracked compliance areas (data, tax, labor) from the past week. For each, judge the impact on us.',
-
- 'invoice-collection-daily.title': 'Invoice collection daily',
- 'invoice-collection-daily.description':
- 'Each morning, overdue invoices, days overdue, who needs a chase email today.',
- 'invoice-collection-daily.instruction':
- 'Every morning at 10:00, list overdue invoices with days overdue and the contact to chase. Draft a polite chase email for each.',
-
- // ===== creator =====
- 'cross-platform-engagement-daily.title': 'Cross-platform engagement',
- 'cross-platform-engagement-daily.description':
- 'Each morning, comments, DMs, mentions and new followers across all platforms — 30 seconds.',
- 'cross-platform-engagement-daily.instruction':
- 'Every morning at 09:00, aggregate comments, DMs, mentions, and new followers across my platforms. Highlight the 5 worth replying to.',
-
- 'brand-collab-weekly.title': 'Brand collab weekly',
- 'brand-collab-weekly.description':
- 'Every Monday, scan brands actively recruiting creators — match by niche and audience size.',
- 'brand-collab-weekly.instruction':
- 'Every Monday at 10:00, scan brands and public calls actively looking for creators. Match against my niche and audience size. Surface 5 worth applying.',
-
- 'follower-growth-weekly.title': 'Follower growth weekly',
- 'follower-growth-weekly.description':
- 'Every Monday, follower changes across platforms — where to double down, where to fix.',
- 'follower-growth-weekly.instruction':
- 'Every Monday at 10:00, review follower growth across my X (Twitter) and other platforms. Surface where to double down and where engagement is dropping.',
-
- 'youtube-channel-weekly.title': 'YouTube channel weekly',
- 'youtube-channel-weekly.description':
- 'Every Monday, channel stats: subscribers, top videos, audience retention, revenue.',
- 'youtube-channel-weekly.instruction':
- 'Every Monday at 09:00, pull my YouTube channel stats: subscriber change, top performing videos, audience retention, revenue movement.',
-
- 'monetization-opportunity-weekly.title': 'Monetization opportunities',
- 'monetization-opportunity-weekly.description':
- 'Every Wednesday, new monetization channels and case studies for creators: ads, courses, memberships, commerce.',
- 'monetization-opportunity-weekly.instruction':
- 'Every Wednesday at 10:00, surface new monetization channels and case studies relevant to creators in my niche: sponsorships, paid content, memberships, commerce.',
-
- // ===== investing =====
- 'portfolio-daily.title': 'Portfolio daily',
- 'portfolio-daily.description':
- 'Tell me your holdings — each market close, day change, key news, holding-company updates.',
- 'portfolio-daily.instruction':
- 'Every day at 16:00 (after close), give me my portfolio update: per-position day change, top news that affects each holding, and any company-specific announcements.',
-
- 'crypto-market-daily.title': 'Crypto market daily',
- 'crypto-market-daily.description':
- 'Each morning, BTC, ETH and your tracked tokens 24h change + key on-chain events.',
- 'crypto-market-daily.instruction':
- 'Every morning at 09:00, give me 24h price change for BTC, ETH, and my tracked tokens, plus the most important on-chain events from the past day.',
-
- // ===== parenting =====
- 'child-growth-weekly.title': 'Child growth weekly',
- 'child-growth-weekly.description':
- 'Tell me your child’s age — every Monday, this week’s development focus + activity ideas.',
- 'child-growth-weekly.instruction':
- 'Every Monday at 09:00, give me development focus areas appropriate for my child’s age this week, plus parent-child activity ideas and things to watch for.',
-
- 'child-study-weekly.title': 'Child study weekly',
- 'child-study-weekly.description':
- 'Tell me what your child is studying — every Sunday, this week’s progress + next week’s focus.',
- 'child-study-weekly.instruction':
- 'Every Sunday at 20:00, recap my child’s study progress this week and identify focus areas for next week. Suggest practice activities for each subject.',
-
- 'family-finance-weekly.title': 'Family finance weekly',
- 'family-finance-weekly.description':
- 'Every Sunday night, this week’s spending breakdown, budget completion, next week’s big expenses.',
- 'family-finance-weekly.instruction':
- 'Every Sunday at 20:00, review this week’s family spending: category breakdown from my Google Sheets log, budget completion, and large planned expenses next week.',
-
- 'family-task-schedule.title': 'Family task schedule',
- 'family-task-schedule.description':
- 'Every Monday morning, divvy up this week’s chores, errands, school runs, and bills across the family.',
- 'family-task-schedule.instruction':
- 'Every Monday at 08:00, draft this week’s family task plan: chores, grocery runs, school pickups, bill payments. Assign tentative owners and time slots. If Google Calendar is connected, propose blocks I can drop in.',
-
- // ===== health =====
- 'diet-log-companion.title': 'Diet log companion',
- 'diet-log-companion.description':
- 'Each evening, walk through what you ate today — kind suggestions, no judgment.',
- 'diet-log-companion.instruction':
- 'Every evening at 21:00, walk me through what I ate today and offer one or two kind, non-judgmental suggestions for tomorrow.',
-
- // ===== hobbies =====
- 'podcast-new-episodes.title': 'Podcast new episodes',
- 'podcast-new-episodes.description':
- 'Tell me your subscribed podcasts — every Monday, this week’s new episodes + 3 worth listening.',
- 'podcast-new-episodes.instruction':
- 'Every Monday at 09:00, list new episodes from my subscribed podcasts this week, and recommend the top 3 worth listening to first.',
-
- 'newsletter-aggregator.title': 'Newsletter aggregator',
- 'newsletter-aggregator.description':
- 'Every Sunday night, merge your subscribed newsletters into one weekend digest.',
- 'newsletter-aggregator.instruction':
- 'Every Sunday at 20:00, scan my Gmail inbox for newsletters received this week and merge them into one weekend digest grouped by theme.',
-
- 'series-update-weekly.title': 'Series & books weekly',
- 'series-update-weekly.description':
- 'Tell me what you’re following — each week, episode/chapter updates and quick recaps.',
- 'series-update-weekly.instruction':
- 'Every Monday at 09:00, give me update notices and a short recap for the shows, novels, or comics I’m following.',
-
- 'travel-inspiration-weekly.title': 'Travel inspiration weekly',
- 'travel-inspiration-weekly.description':
- 'Every Wednesday, target-city flight prices, visa policy, best travel windows.',
- 'travel-inspiration-weekly.instruction':
- 'Every Wednesday at 10:00, give me flight price changes, visa policy updates, and best travel windows for the cities on my wishlist.',
-
- 'watchlist-friday.title': 'Watchlist Friday',
- 'watchlist-friday.description':
- 'Every Friday, 5 highly-rated new releases this week (Douban / IMDb) with one-line reviews.',
- 'watchlist-friday.instruction':
- 'Every Friday at 18:00, pick 5 highly-rated new film/series releases this week from Douban and IMDb. Add a one-line review for each.',
-
- 'exhibition-event-weekly.title': 'Exhibitions & events',
- 'exhibition-event-weekly.description':
- 'Tell me your city — every Monday, this week’s exhibitions, performances, and live shows.',
- 'exhibition-event-weekly.instruction':
- 'Every Monday at 10:00, list this week’s exhibitions, performances, and livehouse shows in my city. Add quick context for the most interesting ones.',
-
- // ===== personal-life =====
- 'daily-learning-bite.title': 'Daily learning bite',
- 'daily-learning-bite.description':
- 'Each morning, deliver one 15-minute curated piece (article, video, or podcast) in your learning area.',
- 'daily-learning-bite.instruction':
- 'Every morning at 07:30, bring me one 15-minute curated piece (article, video, or podcast) in my learning area, with a quick takeaway.',
-
- 'sunday-reflection.title': 'Sunday reflection',
- 'sunday-reflection.description':
- 'Every Sunday night, walk through 5 questions: best moment, frustrations, top 3 for next week.',
- 'sunday-reflection.instruction':
- 'Every Sunday at 21:00, walk me through 5 reflection prompts: most fulfilling thing this week, most frustrating, top 3 priorities for next week, what I learned, what I should drop.',
-
- 'morning-ritual.title': 'Morning ritual',
- 'morning-ritual.description':
- 'Every day at 7: weather, today’s schedule, a thought-of-the-day, and a movement nudge — a gentle start.',
- 'morning-ritual.instruction':
- 'Every morning at 07:00, send me a gentle morning ritual: weather, today’s schedule, one short thought-of-the-day, and a small movement suggestion. If Google Calendar is connected, anchor the schedule there.',
-
- 'bedtime-gratitude.title': 'Bedtime gratitude',
- 'bedtime-gratitude.description':
- 'Every night at 22, prompt 3 things you’re grateful for and one thing you learned today.',
- 'bedtime-gratitude.instruction':
- 'Every evening at 22:00, ask me to share 3 things I’m grateful for today and one thing I learned. Return a gentle one-paragraph reflection. If Notion is connected, append the entry to my journal page.',
};
diff --git a/packages/types/package.json b/packages/types/package.json
index 43786f0ee1d..b5e478b57a2 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -10,8 +10,8 @@
"test:update": "vitest -u"
},
"dependencies": {
- "@lobehub/market-sdk": "0.34.0",
- "@lobehub/market-types": "^1.12.3",
+ "@lobehub/market-sdk": "0.38.0",
+ "@lobehub/market-types": "^1.16.0",
"model-bank": "workspace:*",
"type-fest": "^4.41.0",
"zustand": "5.0.4"
diff --git a/scripts/devStartupSequence.mts b/scripts/devStartupSequence.mts
index fbac638a14b..f5b9aa5d005 100644
--- a/scripts/devStartupSequence.mts
+++ b/scripts/devStartupSequence.mts
@@ -1,4 +1,4 @@
-import type { ChildProcess } from 'node:child_process';
+import type { ChildProcess, SpawnOptions } from 'node:child_process';
import { spawn } from 'node:child_process';
import net from 'node:net';
import path from 'node:path';
@@ -34,7 +34,7 @@ const NEXT_READY_TIMEOUT_MS = 180_000;
const NEXT_READY_RETRY_MS = 400;
const FORCE_KILL_TIMEOUT_MS = 5_000;
-const npmCommand = isWindows ? 'npm.cmd' : 'npm';
+const packageScriptCommand = 'bun';
let nextPort = 3010;
let nextRootUrl = `http://${NEXT_HOST}:${nextPort}/`;
@@ -45,13 +45,28 @@ let viteHandle: DevProcessHandle | undefined;
let forceKillTimer: ReturnType<typeof setTimeout> | undefined;
let shuttingDown = false;
-const runNpmScript = (scriptName: string) =>
- spawn(npmCommand, ['run', scriptName], {
+const createPackageScriptProcessConfig = ({
+ isWindows,
+ scriptName,
+}: {
+ isWindows: boolean;
+ scriptName: string;
+}): { args: string[]; command: string; options: SpawnOptions } => ({
+ args: ['run', scriptName],
+ command: packageScriptCommand,
+ options: {
detached: !isWindows,
env: process.env,
stdio: 'inherit',
shell: isWindows,
- });
+ },
+});
+
+const runPackageScript = (scriptName: string) => {
+ const { args, command, options } = createPackageScriptProcessConfig({ isWindows, scriptName });
+
+ return spawn(command, args, options);
+};
const loadEnv = () => {
const env = process.env.NODE_ENV || 'development';
@@ -245,7 +260,7 @@ const main = async () => {
forceKillChildren();
});
- nextProcess = spawn('npx', ['next', 'dev', '-p', String(nextPort)], {
+ nextProcess = spawn('bunx', ['next', 'dev', '-p', String(nextPort)], {
detached: !isWindows,
env: process.env,
stdio: 'inherit',
@@ -254,7 +269,7 @@ const main = async () => {
nextHandle = createDevProcessHandle({ isWindows, pid: nextProcess.pid });
watchChildExit(nextProcess, 'next');
- viteProcess = runNpmScript('dev:spa');
+ viteProcess = runPackageScript('dev:spa');
viteHandle = createDevProcessHandle({ isWindows, pid: viteProcess.pid });
watchChildExit(viteProcess, 'vite');
runNextBackgroundTasks();
@@ -271,6 +286,7 @@ const isMainModule = () => {
};
export const __testing = {
+ createPackageScriptProcessConfig,
createDevProcessHandle,
sendSignalToDevProcess,
};
diff --git a/src/features/RecommendTaskTemplates/SkillAuthRow.test.tsx b/src/features/RecommendTaskTemplates/SkillAuthRow.test.tsx
index 6bbd75e9b30..5b3c470f057 100644
--- a/src/features/RecommendTaskTemplates/SkillAuthRow.test.tsx
+++ b/src/features/RecommendTaskTemplates/SkillAuthRow.test.tsx
@@ -32,7 +32,11 @@ describe('SkillAuthRow', () => {
it('disables provider connection when template actions are disabled', () => {
render(
- <SkillAuthRow disabled spec={{ provider: 'gmail', source: 'composio' }} onError={vi.fn()} />,
+ <SkillAuthRow
+ disabled
+ spec={{ identifier: 'gmail', source: 'composio' }}
+ onError={vi.fn()}
+ />,
);
const connectButton = screen.getByRole('button', { name: 'action.connect.short' });
diff --git a/src/features/RecommendTaskTemplates/SkillAuthRow.tsx b/src/features/RecommendTaskTemplates/SkillAuthRow.tsx
index 6ca350e3500..99a12c67217 100644
--- a/src/features/RecommendTaskTemplates/SkillAuthRow.tsx
+++ b/src/features/RecommendTaskTemplates/SkillAuthRow.tsx
@@ -1,4 +1,4 @@
-import type { TaskTemplateSkillRequirement } from '@lobechat/const';
+import type { TaskTemplateConnectorReference } from '@lobechat/const';
import { Button, Flexbox, Icon, Image, Text } from '@lobehub/ui';
import { cssVar } from 'antd-style';
import { memo, useCallback, useMemo } from 'react';
@@ -10,7 +10,7 @@ import { SkillConnectionPopupBlockedError, useSkillConnection } from './useSkill
interface SkillAuthRowProps {
disabled?: boolean;
onError: (error: unknown) => void;
- spec: TaskTemplateSkillRequirement;
+ spec: TaskTemplateConnectorReference;
}
/**
diff --git a/src/features/RecommendTaskTemplates/TaskTemplateCard.tsx b/src/features/RecommendTaskTemplates/TaskTemplateCard.tsx
index b707b70afb6..e09213b363c 100644
--- a/src/features/RecommendTaskTemplates/TaskTemplateCard.tsx
+++ b/src/features/RecommendTaskTemplates/TaskTemplateCard.tsx
@@ -19,8 +19,8 @@ import { useTaskTemplateCreate } from './useTaskTemplateCreate';
import { useVisibleAuthSpecs } from './useVisibleAuthSpecs';
interface TaskTemplateCardProps {
- onCreated: (templateId: string) => void;
- onDismiss: (templateId: string) => void;
+ onCreated: (templateId: number) => void;
+ onDismiss: (templateId: number) => void;
template: TaskTemplate;
}
@@ -30,8 +30,8 @@ export const TaskTemplateCard = memo<TaskTemplateCardProps>(
const iconSpec = useMemo(() => resolveTemplateIcon(template, INTEREST_ICON_MAP), [template]);
const visibleAuthSpecs = useVisibleAuthSpecs(template, { hideMainIconProvider: true });
- const title = t(`${template.id}.title`, { defaultValue: '' });
- const description = t(`${template.id}.description`, { defaultValue: '' });
+ const title = template.title;
+ const description = template.description;
const {
created,
@@ -136,7 +136,7 @@ export const TaskTemplateCard = memo<TaskTemplateCardProps>(
{visibleAuthSpecs.map((spec) => (
<SkillAuthRow
disabled={disabled}
- key={`${spec.source}:${spec.provider}`}
+ key={`${spec.source}:${spec.identifier}`}
spec={spec}
onError={handleConnectError}
/>
diff --git a/src/features/RecommendTaskTemplates/TaskTemplateDetailModal.tsx b/src/features/RecommendTaskTemplates/TaskTemplateDetailModal.tsx
index 9b49032d316..e20dcc17560 100644
--- a/src/features/RecommendTaskTemplates/TaskTemplateDetailModal.tsx
+++ b/src/features/RecommendTaskTemplates/TaskTemplateDetailModal.tsx
@@ -17,7 +17,7 @@ import { useTaskTemplateCreate } from './useTaskTemplateCreate';
import { useVisibleAuthSpecs } from './useVisibleAuthSpecs';
interface TaskTemplateDetailContentProps {
- onCreated: (templateId: string) => void;
+ onCreated: (templateId: number) => void;
template: TaskTemplate;
}
@@ -28,9 +28,9 @@ const TaskTemplateDetailContent = memo<TaskTemplateDetailContentProps>(
const iconSpec = useMemo(() => resolveTemplateIcon(template, INTEREST_ICON_MAP), [template]);
- const title = t(`${template.id}.title`, { defaultValue: '' });
- const description = t(`${template.id}.description`, { defaultValue: '' });
- const instruction = t(`${template.id}.instruction`, { defaultValue: '' });
+ const title = template.title;
+ const description = template.description;
+ const instruction = template.instruction;
const visibleAuthSpecs = useVisibleAuthSpecs(template);
const scheduleText = useScheduleText(template.cronPattern);
@@ -85,7 +85,7 @@ const TaskTemplateDetailContent = memo<TaskTemplateDetailContentProps>(
{visibleAuthSpecs.map((spec) => (
<SkillAuthRow
disabled={disabled}
- key={`${spec.source}:${spec.provider}`}
+ key={`${spec.source}:${spec.identifier}`}
spec={spec}
onError={handleConnectError}
/>
@@ -112,7 +112,7 @@ const TaskTemplateDetailContent = memo<TaskTemplateDetailContentProps>(
TaskTemplateDetailContent.displayName = 'TaskTemplateDetailContent';
interface CreateTaskTemplateDetailModalOptions {
- onCreated: (templateId: string) => void;
+ onCreated: (templateId: number) => void;
template: TaskTemplate;
}
diff --git a/src/features/RecommendTaskTemplates/providerMeta.test.ts b/src/features/RecommendTaskTemplates/providerMeta.test.ts
index 4e28f2a4000..c3850268a0a 100644
--- a/src/features/RecommendTaskTemplates/providerMeta.test.ts
+++ b/src/features/RecommendTaskTemplates/providerMeta.test.ts
@@ -1,35 +1,35 @@
-import type { TaskTemplateSkillRequirement } from '@lobechat/const';
+import type { TaskTemplateConnectorReference } from '@lobechat/const';
import { describe, expect, it } from 'vitest';
import { findNextUnconnectedSpec, getProviderMeta } from './providerMeta';
describe('getProviderMeta', () => {
it('resolves lobehub source via LOBEHUB_SKILL_PROVIDERS', () => {
- const meta = getProviderMeta({ provider: 'github', source: 'lobehub' });
- expect(meta).toMatchObject({ label: 'GitHub', provider: 'github', source: 'lobehub' });
+ const meta = getProviderMeta({ identifier: 'github', source: 'lobehub' });
+ expect(meta).toMatchObject({ identifier: 'github', label: 'GitHub', source: 'lobehub' });
expect(meta?.icon).toBeDefined();
});
it('resolves notion as a lobehub source provider', () => {
- const meta = getProviderMeta({ provider: 'notion', source: 'lobehub' });
- expect(meta).toMatchObject({ label: 'Notion', provider: 'notion', source: 'lobehub' });
+ const meta = getProviderMeta({ identifier: 'notion', source: 'lobehub' });
+ expect(meta).toMatchObject({ identifier: 'notion', label: 'Notion', source: 'lobehub' });
expect(meta?.icon).toBeDefined();
});
it('resolves composio source via COMPOSIO_APP_TYPES', () => {
- const meta = getProviderMeta({ provider: 'gmail', source: 'composio' });
- expect(meta).toMatchObject({ label: 'Gmail', provider: 'gmail', source: 'composio' });
+ const meta = getProviderMeta({ identifier: 'gmail', source: 'composio' });
+ expect(meta).toMatchObject({ identifier: 'gmail', label: 'Gmail', source: 'composio' });
expect(meta?.icon).toBeDefined();
});
it('returns undefined for unknown provider', () => {
- expect(getProviderMeta({ provider: 'nonexistent-x', source: 'lobehub' })).toBeUndefined();
- expect(getProviderMeta({ provider: 'nonexistent-x', source: 'composio' })).toBeUndefined();
+ expect(getProviderMeta({ identifier: 'nonexistent-x', source: 'lobehub' })).toBeUndefined();
+ expect(getProviderMeta({ identifier: 'nonexistent-x', source: 'composio' })).toBeUndefined();
});
it('does not cross namespaces (lobehub id under composio source returns undefined)', () => {
// 'github' is a lobehub provider id, not a composio identifier.
- expect(getProviderMeta({ provider: 'github', source: 'composio' })).toBeUndefined();
+ expect(getProviderMeta({ identifier: 'github', source: 'composio' })).toBeUndefined();
});
});
@@ -43,42 +43,42 @@ describe('findNextUnconnectedSpec', () => {
});
it('returns undefined when all specs are connected', () => {
- const specs: TaskTemplateSkillRequirement[] = [
- { provider: 'github', source: 'lobehub' },
- { provider: 'notion', source: 'lobehub' },
+ const specs: TaskTemplateConnectorReference[] = [
+ { identifier: 'github', source: 'lobehub' },
+ { identifier: 'notion', source: 'lobehub' },
];
expect(findNextUnconnectedSpec(specs, allConnected)).toBeUndefined();
});
it('returns the first spec when none are connected', () => {
- const specs: TaskTemplateSkillRequirement[] = [
- { provider: 'github', source: 'lobehub' },
- { provider: 'notion', source: 'lobehub' },
+ const specs: TaskTemplateConnectorReference[] = [
+ { identifier: 'github', source: 'lobehub' },
+ { identifier: 'notion', source: 'lobehub' },
];
const result = findNextUnconnectedSpec(specs, noneConnected);
- expect(result?.provider).toBe('github');
+ expect(result?.identifier).toBe('github');
expect(result?.label).toBe('GitHub');
});
it('skips already-connected specs and returns the next missing one in order', () => {
- const specs: TaskTemplateSkillRequirement[] = [
- { provider: 'github', source: 'lobehub' },
- { provider: 'linear', source: 'lobehub' },
- { provider: 'notion', source: 'lobehub' },
+ const specs: TaskTemplateConnectorReference[] = [
+ { identifier: 'github', source: 'lobehub' },
+ { identifier: 'linear', source: 'lobehub' },
+ { identifier: 'notion', source: 'lobehub' },
];
- const isConnected = (s: TaskTemplateSkillRequirement) =>
- s.provider === 'github' || s.provider === 'linear';
+ const isConnected = (s: TaskTemplateConnectorReference) =>
+ s.identifier === 'github' || s.identifier === 'linear';
const result = findNextUnconnectedSpec(specs, isConnected);
- expect(result?.provider).toBe('notion');
+ expect(result?.identifier).toBe('notion');
expect(result?.source).toBe('lobehub');
});
it('skips specs with unknown providers (no meta) and continues searching', () => {
- const specs: TaskTemplateSkillRequirement[] = [
- { provider: 'nonexistent-x', source: 'lobehub' },
- { provider: 'notion', source: 'lobehub' },
+ const specs: TaskTemplateConnectorReference[] = [
+ { identifier: 'nonexistent-x', source: 'lobehub' },
+ { identifier: 'notion', source: 'lobehub' },
];
const result = findNextUnconnectedSpec(specs, noneConnected);
- expect(result?.provider).toBe('notion');
+ expect(result?.identifier).toBe('notion');
});
});
diff --git a/src/features/RecommendTaskTemplates/providerMeta.ts b/src/features/RecommendTaskTemplates/providerMeta.ts
index 7be29ca002f..dca76fd8608 100644
--- a/src/features/RecommendTaskTemplates/providerMeta.ts
+++ b/src/features/RecommendTaskTemplates/providerMeta.ts
@@ -1,33 +1,33 @@
import type {
LobehubSkillProviderType,
- TaskTemplateSkillRequirement,
- TaskTemplateSkillSource,
+ TaskTemplateConnectorReference,
+ TaskTemplateConnectorSource,
} from '@lobechat/const';
import { getComposioAppByIdentifier, getLobehubSkillProviderById } from '@lobechat/const';
export interface SkillProviderMeta {
icon: LobehubSkillProviderType['icon'];
+ identifier: string;
label: string;
- provider: string;
- source: TaskTemplateSkillSource;
+ source: TaskTemplateConnectorSource;
}
export const getProviderMeta = (
- spec: TaskTemplateSkillRequirement,
+ spec: TaskTemplateConnectorReference,
): SkillProviderMeta | undefined => {
if (spec.source === 'lobehub') {
- const p = getLobehubSkillProviderById(spec.provider);
+ const p = getLobehubSkillProviderById(spec.identifier);
if (!p) return undefined;
- return { icon: p.icon, label: p.label, provider: spec.provider, source: 'lobehub' };
+ return { icon: p.icon, identifier: spec.identifier, label: p.label, source: 'lobehub' };
}
- const p = getComposioAppByIdentifier(spec.provider);
+ const p = getComposioAppByIdentifier(spec.identifier);
if (!p) return undefined;
- return { icon: p.icon, label: p.label, provider: spec.provider, source: 'composio' };
+ return { icon: p.icon, identifier: spec.identifier, label: p.label, source: 'composio' };
};
export const findNextUnconnectedSpec = (
- specs: TaskTemplateSkillRequirement[] | undefined,
- isConnected: (spec: TaskTemplateSkillRequirement) => boolean,
+ specs: TaskTemplateConnectorReference[] | undefined,
+ isConnected: (spec: TaskTemplateConnectorReference) => boolean,
): SkillProviderMeta | undefined => {
if (!specs || specs.length === 0) return undefined;
for (const spec of specs) {
diff --git a/src/features/RecommendTaskTemplates/resolveTemplateIcon.test.ts b/src/features/RecommendTaskTemplates/resolveTemplateIcon.test.ts
index 75818bf654d..64288b4ce06 100644
--- a/src/features/RecommendTaskTemplates/resolveTemplateIcon.test.ts
+++ b/src/features/RecommendTaskTemplates/resolveTemplateIcon.test.ts
@@ -7,10 +7,15 @@ import { resolveTemplateIcon } from './resolveTemplateIcon';
const baseTemplate = {
category: 'engineering',
+ connectors: [],
cronPattern: '0 9 * * *',
- id: 'test-template',
+ description: 'Description',
+ id: 101,
+ identifier: 'daily-engineering',
+ instruction: 'Instruction',
interests: [],
-} satisfies Pick<TaskTemplate, 'category' | 'cronPattern' | 'id' | 'interests'>;
+ title: 'Title',
+} satisfies TaskTemplate;
const make = (overrides: Partial<TaskTemplate>): TaskTemplate =>
({ ...baseTemplate, ...overrides }) as TaskTemplate;
@@ -26,8 +31,8 @@ describe('resolveTemplateIcon', () => {
it('falls back to a required skill provider icon (component form)', () => {
const spec = resolveTemplateIcon(
make({
+ connectors: [{ identifier: 'github', required: true, source: 'lobehub' }],
interests: ['coding'],
- requiresSkills: [{ provider: 'github', source: 'lobehub' }],
}),
interestMap,
);
@@ -37,8 +42,8 @@ describe('resolveTemplateIcon', () => {
it('falls back to a required skill provider icon (URL form)', () => {
const spec = resolveTemplateIcon(
make({
+ connectors: [{ identifier: 'gmail', required: true, source: 'composio' }],
interests: ['coding'],
- requiresSkills: [{ provider: 'gmail', source: 'composio' }],
}),
interestMap,
);
@@ -49,8 +54,10 @@ describe('resolveTemplateIcon', () => {
it('prefers required over optional when both are present', () => {
const spec = resolveTemplateIcon(
make({
- optionalSkills: [{ provider: 'notion', source: 'lobehub' }],
- requiresSkills: [{ provider: 'github', source: 'lobehub' }],
+ connectors: [
+ { identifier: 'notion', required: false, source: 'lobehub' },
+ { identifier: 'github', required: true, source: 'lobehub' },
+ ],
}),
interestMap,
);
@@ -60,8 +67,8 @@ describe('resolveTemplateIcon', () => {
it('falls back to optional skill icon when required is absent', () => {
const spec = resolveTemplateIcon(
make({
+ connectors: [{ identifier: 'notion', required: false, source: 'lobehub' }],
interests: ['coding'],
- optionalSkills: [{ provider: 'notion', source: 'lobehub' }],
}),
interestMap,
);
@@ -72,8 +79,10 @@ describe('resolveTemplateIcon', () => {
it('skips unresolvable required spec and tries optional', () => {
const spec = resolveTemplateIcon(
make({
- optionalSkills: [{ provider: 'notion', source: 'lobehub' }],
- requiresSkills: [{ provider: 'nonexistent-x', source: 'lobehub' }],
+ connectors: [
+ { identifier: 'nonexistent-x', required: true, source: 'lobehub' },
+ { identifier: 'notion', required: false, source: 'lobehub' },
+ ],
}),
interestMap,
);
diff --git a/src/features/RecommendTaskTemplates/resolveTemplateIcon.ts b/src/features/RecommendTaskTemplates/resolveTemplateIcon.ts
index 53a911b3b79..1f945b40a17 100644
--- a/src/features/RecommendTaskTemplates/resolveTemplateIcon.ts
+++ b/src/features/RecommendTaskTemplates/resolveTemplateIcon.ts
@@ -1,6 +1,10 @@
import type { IconType } from '@icons-pack/react-simple-icons';
import { SiGithub } from '@icons-pack/react-simple-icons';
-import type { TaskTemplate, TaskTemplateIcon, TaskTemplateSkillRequirement } from '@lobechat/const';
+import type {
+ TaskTemplate,
+ TaskTemplateConnectorReference,
+ TaskTemplateIcon,
+} from '@lobechat/const';
import { type LucideIcon, Sparkles } from 'lucide-react';
import { getProviderMeta } from './providerMeta';
@@ -18,10 +22,15 @@ const SELF_ICON_MAP: Record<TaskTemplateIcon, TemplateIconComponent> = {
const toSpec = (icon: string | TemplateIconComponent): TemplateIconSpec =>
typeof icon === 'string' ? { kind: 'url', src: icon } : { Comp: icon, kind: 'component' };
+const getPrioritizedConnectors = (template: TaskTemplate): TaskTemplateConnectorReference[] => [
+ ...template.connectors.filter((connector) => connector.required),
+ ...template.connectors.filter((connector) => !connector.required),
+];
+
/**
* Resolve the icon to display on a task-template card.
*
- * Priority: self icon (`template.icon`) > first resolvable skill provider
+ * Priority: self icon (`template.icon`) > first resolvable connector provider
* (required before optional) > interest icon > `Sparkles`. Unknown providers
* are skipped so a stale template never crashes the card.
*/
@@ -33,8 +42,7 @@ export const resolveTemplateIcon = (
return { Comp: SELF_ICON_MAP[template.icon], kind: 'component' };
}
- for (const spec of [template.requiresSkills?.[0], template.optionalSkills?.[0]]) {
- if (!spec) continue;
+ for (const spec of getPrioritizedConnectors(template)) {
const meta = getProviderMeta(spec);
if (meta) return toSpec(meta.icon);
}
@@ -54,13 +62,12 @@ export const resolveTemplateIcon = (
*/
export const getMainIconProvider = (
template: TaskTemplate,
-): TaskTemplateSkillRequirement | undefined => {
+): TaskTemplateConnectorReference | undefined => {
// The self-icon union is currently the single lobehub provider id 'github';
// expand `SELF_ICON_MAP` and this mapping together when more are added.
- if (template.icon) return { provider: template.icon, source: 'lobehub' };
+ if (template.icon) return { identifier: template.icon, source: 'lobehub' };
- for (const spec of [template.requiresSkills?.[0], template.optionalSkills?.[0]]) {
- if (!spec) continue;
+ for (const spec of getPrioritizedConnectors(template)) {
if (getProviderMeta(spec)) return spec;
}
return undefined;
diff --git a/src/features/RecommendTaskTemplates/useDailyBriefRecommendationsUI.ts b/src/features/RecommendTaskTemplates/useDailyBriefRecommendationsUI.ts
index dd8f0fbf552..513f18c2a61 100644
--- a/src/features/RecommendTaskTemplates/useDailyBriefRecommendationsUI.ts
+++ b/src/features/RecommendTaskTemplates/useDailyBriefRecommendationsUI.ts
@@ -1,4 +1,4 @@
-import type { TaskTemplate, TaskTemplateSkillSource } from '@lobechat/const';
+import type { TaskTemplate, TaskTemplateConnectorSource } from '@lobechat/const';
import { TASK_TEMPLATE_RECOMMEND_COUNT } from '@lobechat/const';
import { createNanoId } from '@lobechat/utils';
import { useSessionStorageState } from 'ahooks';
@@ -25,8 +25,8 @@ export type DailyBriefRecommendationsUIState =
| { mode: 'skeleton'; skeletonCount: number }
| {
mode: 'cards';
- onCreated: (templateId: string) => void;
- onDismiss: (templateId: string) => void;
+ onCreated: (templateId: number) => void;
+ onDismiss: (templateId: number) => void;
onRefresh: () => void;
templates: TaskTemplate[];
};
@@ -40,7 +40,8 @@ export function useDailyBriefRecommendationsUI(
): DailyBriefRecommendationsUIState {
const { count } = options;
const recommendationCount = count ?? TASK_TEMPLATE_RECOMMEND_COUNT;
- const { t } = useTranslation('taskTemplate');
+ const { i18n, t } = useTranslation('taskTemplate');
+ const locale = i18n.resolvedLanguage || i18n.language;
const { message } = App.useApp();
const isLogin = useUserStore(authSelectors.isLogin);
const useFetchBriefs = useBriefStore((s) => s.useFetchBriefs);
@@ -57,11 +58,12 @@ export function useDailyBriefRecommendationsUI(
const { data, isLoading, mutate } = useSWR(
swrEnabled
- ? taskTemplateKeys.listDailyRecommend(swrKey, refreshSeed, recommendationCount)
+ ? taskTemplateKeys.listDailyRecommend(swrKey, refreshSeed, recommendationCount, locale)
: null,
async () =>
taskTemplateService.listDailyRecommend(interestKeys ?? [], {
count: recommendationCount,
+ locale,
refreshSeed: refreshSeed || undefined,
}),
{ revalidateOnFocus: false, revalidateOnReconnect: false },
@@ -72,7 +74,7 @@ export function useDailyBriefRecommendationsUI(
}, [setRefreshSeed]);
const removeTemplateFromList = useCallback(
- (templateId: string) => {
+ (templateId: number) => {
mutate(
(current) =>
current
@@ -85,14 +87,14 @@ export function useDailyBriefRecommendationsUI(
);
const handleCreated = useCallback(
- (templateId: string) => {
+ (templateId: number) => {
removeTemplateFromList(templateId);
},
[removeTemplateFromList],
);
const handleDismiss = useCallback(
- async (templateId: string) => {
+ async (templateId: number) => {
removeTemplateFromList(templateId);
try {
await taskTemplateService.dismiss(templateId);
@@ -107,10 +109,9 @@ export function useDailyBriefRecommendationsUI(
const templates = useMemo(() => data?.data ?? [], [data]);
const requiredSources = useMemo(() => {
- const sources = new Set<TaskTemplateSkillSource>();
+ const sources = new Set<TaskTemplateConnectorSource>();
for (const tmpl of templates) {
- for (const s of tmpl.requiresSkills ?? []) sources.add(s.source);
- for (const s of tmpl.optionalSkills ?? []) sources.add(s.source);
+ for (const connector of tmpl.connectors) sources.add(connector.source);
}
return sources;
}, [templates]);
diff --git a/src/features/RecommendTaskTemplates/useSkillConnection.ts b/src/features/RecommendTaskTemplates/useSkillConnection.ts
index 4b3f29ecbc9..a857144c478 100644
--- a/src/features/RecommendTaskTemplates/useSkillConnection.ts
+++ b/src/features/RecommendTaskTemplates/useSkillConnection.ts
@@ -1,4 +1,4 @@
-import type { TaskTemplateSkillRequirement } from '@lobechat/const';
+import type { TaskTemplateConnectorReference } from '@lobechat/const';
import { COMPOSIO_APP_TYPES } from '@lobechat/const';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@@ -33,7 +33,7 @@ export class SkillConnectionPopupBlockedError extends Error {
}
}
-type ConnectTarget = Pick<SkillProviderMeta, 'provider' | 'source'>;
+type ConnectTarget = Pick<SkillProviderMeta, 'identifier' | 'source'>;
export interface UseSkillConnectionResult {
connect: () => Promise<void>;
@@ -54,14 +54,14 @@ export const useIsSkillConnected = () => {
const composioServers = useToolStore(composioStoreSelectors.getServers);
return useCallback(
- (spec: TaskTemplateSkillRequirement): boolean => {
+ (spec: TaskTemplateConnectorReference): boolean => {
if (spec.source === 'lobehub') {
return lobehubServers.some(
- (s) => s.identifier === spec.provider && s.status === LobehubSkillStatus.CONNECTED,
+ (s) => s.identifier === spec.identifier && s.status === LobehubSkillStatus.CONNECTED,
);
}
return composioServers.some(
- (s) => s.identifier === spec.provider && s.status === ComposioServerStatus.ACTIVE,
+ (s) => s.identifier === spec.identifier && s.status === ComposioServerStatus.ACTIVE,
);
},
[lobehubServers, composioServers],
@@ -69,7 +69,7 @@ export const useIsSkillConnected = () => {
};
export const useSkillConnection = (
- specs: TaskTemplateSkillRequirement[] | undefined,
+ specs: TaskTemplateConnectorReference[] | undefined,
): UseSkillConnectionResult => {
const getLobehubAuth = useToolStore((s) => s.getLobehubSkillAuthorizeUrl);
const checkLobehubStatus = useToolStore((s) => s.checkLobehubSkillStatus);
@@ -132,9 +132,9 @@ export const useSkillConnection = (
pollIntervalRef.current = setInterval(async () => {
try {
if (target.source === 'lobehub') {
- await checkLobehubStatus(target.provider);
+ await checkLobehubStatus(target.identifier);
} else {
- await refreshComposioConnectionStatus(target.provider);
+ await refreshComposioConnectionStatus(target.identifier);
}
} catch {
// Polling failure is expected until auth completes — suppress noise.
@@ -175,9 +175,9 @@ export const useSkillConnection = (
// to 15s for fallback polling to release isWaitingAuth.
try {
if (target.source === 'lobehub') {
- await checkLobehubStatus(target.provider);
+ await checkLobehubStatus(target.identifier);
} else {
- await refreshComposioConnectionStatus(target.provider);
+ await refreshComposioConnectionStatus(target.identifier);
}
} catch {
// Status check failure isn't actionable; release waiting state regardless.
@@ -251,20 +251,20 @@ export const useSkillConnection = (
if (next.source === 'lobehub') {
// Skip redirectUri on desktop (app:// protocol) since the system browser can't navigate to it
const redirectUri = window.location.protocol.startsWith('http')
- ? `${window.location.origin}/oauth/callback/success?provider=${encodeURIComponent(next.provider)}`
+ ? `${window.location.origin}/oauth/callback/success?provider=${encodeURIComponent(next.identifier)}`
: undefined;
- const { authorizeUrl } = await getLobehubAuth(next.provider, { redirectUri });
+ const { authorizeUrl } = await getLobehubAuth(next.identifier, { redirectUri });
openOAuthWindow(authorizeUrl, next);
return;
}
const userId = useUserStore.getState().user?.id;
if (!userId) throw new Error('Sign-in required');
- const composioType = COMPOSIO_APP_TYPES.find((t) => t.identifier === next.provider);
- if (!composioType) throw new Error(`Unknown Composio provider: ${next.provider}`);
+ const composioType = COMPOSIO_APP_TYPES.find((t) => t.identifier === next.identifier);
+ if (!composioType) throw new Error(`Unknown Composio connector: ${next.identifier}`);
const newServer = await createComposioConnection({
appSlug: composioType.appSlug,
- identifier: next.provider,
+ identifier: next.identifier,
label: composioType.label,
});
if (!newServer) throw new Error('Failed to create Composio server');
diff --git a/src/features/RecommendTaskTemplates/useTaskTemplateCreate.ts b/src/features/RecommendTaskTemplates/useTaskTemplateCreate.ts
index bfa3bfdd028..f68a0c9a5dc 100644
--- a/src/features/RecommendTaskTemplates/useTaskTemplateCreate.ts
+++ b/src/features/RecommendTaskTemplates/useTaskTemplateCreate.ts
@@ -1,6 +1,6 @@
import type { TaskTemplate } from '@lobechat/const';
import { App } from 'antd';
-import { useCallback, useEffect, useRef, useState } from 'react';
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { taskDetailPath } from '@/features/AgentTasks/shared/taskDetailPath';
@@ -15,7 +15,7 @@ import { SkillConnectionPopupBlockedError, useSkillConnection } from './useSkill
interface UseTaskTemplateCreateOptions {
description: string;
- onCreated: (templateId: string) => void;
+ onCreated: (templateId: number) => void;
template: TaskTemplate;
title: string;
}
@@ -44,19 +44,22 @@ export const useTaskTemplateCreate = ({
const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
const createTask = useTaskStore((s) => s.createTask);
const navigate = useWorkspaceAwareNavigate();
- const requiredConnection = useSkillConnection(template.requiresSkills);
+ const requiredConnectors = useMemo(
+ () => template.connectors.filter((connector) => connector.required),
+ [template.connectors],
+ );
+ const requiredConnection = useSkillConnection(requiredConnectors);
const handleCreate = useCallback(async () => {
if (!canCreateTask) return;
if (!inboxAgentId) return;
setLoading(true);
try {
- const instruction = t(`${template.id}.instruction`, { defaultValue: '' });
const createdTask = await createTask({
assigneeAgentId: inboxAgentId,
automationMode: 'schedule',
description,
- instruction,
+ instruction: template.instruction,
name: title,
schedulePattern: template.cronPattern,
scheduleTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -87,6 +90,7 @@ export const useTaskTemplateCreate = ({
t,
template.cronPattern,
template.id,
+ template.instruction,
title,
canCreateTask,
]);
diff --git a/src/features/RecommendTaskTemplates/useVisibleAuthSpecs.ts b/src/features/RecommendTaskTemplates/useVisibleAuthSpecs.ts
index 8fa5645c657..6c6d058b087 100644
--- a/src/features/RecommendTaskTemplates/useVisibleAuthSpecs.ts
+++ b/src/features/RecommendTaskTemplates/useVisibleAuthSpecs.ts
@@ -1,4 +1,4 @@
-import type { TaskTemplate, TaskTemplateSkillRequirement } from '@lobechat/const';
+import type { TaskTemplate, TaskTemplateConnector } from '@lobechat/const';
import { useMemo } from 'react';
import { getMainIconProvider } from './resolveTemplateIcon';
@@ -17,7 +17,7 @@ interface UseVisibleAuthSpecsOptions {
export const useVisibleAuthSpecs = (
template: TaskTemplate,
{ hideMainIconProvider = false }: UseVisibleAuthSpecsOptions = {},
-): TaskTemplateSkillRequirement[] => {
+): TaskTemplateConnector[] => {
const isSkillConnected = useIsSkillConnected();
const mainIconProvider = useMemo(
() => (hideMainIconProvider ? getMainIconProvider(template) : undefined),
@@ -25,17 +25,16 @@ export const useVisibleAuthSpecs = (
);
return useMemo(() => {
- const all = [...(template.requiresSkills ?? []), ...(template.optionalSkills ?? [])];
- return all.filter((spec) => {
+ return template.connectors.filter((spec) => {
if (isSkillConnected(spec)) return false;
if (
mainIconProvider &&
- mainIconProvider.provider === spec.provider &&
+ mainIconProvider.identifier === spec.identifier &&
mainIconProvider.source === spec.source
) {
return false;
}
return true;
});
- }, [template.requiresSkills, template.optionalSkills, isSkillConnected, mainIconProvider]);
+ }, [template.connectors, isSkillConnected, mainIconProvider]);
};
diff --git a/src/libs/swr/keys.ts b/src/libs/swr/keys.ts
index f039bb6b2b7..d6ee386a2c4 100644
--- a/src/libs/swr/keys.ts
+++ b/src/libs/swr/keys.ts
@@ -739,11 +739,12 @@ export const homeKeys = {
export const taskTemplateKeys = {
listDailyRecommend: def(
'taskTemplate:listDailyRecommend',
- (interestsKey: string, refreshSeed: unknown, recommendationCount: number) => [
+ (interestsKey: string, refreshSeed: unknown, recommendationCount: number, locale: string) => [
'taskTemplate:listDailyRecommend',
interestsKey,
refreshSeed,
recommendationCount,
+ locale,
],
),
};
diff --git a/src/scripts/devProcessCleanup.test.ts b/src/scripts/devProcessCleanup.test.ts
index 8b7781a7006..d2a96bad6e1 100644
--- a/src/scripts/devProcessCleanup.test.ts
+++ b/src/scripts/devProcessCleanup.test.ts
@@ -1,3 +1,5 @@
+import type { SpawnOptions } from 'node:child_process';
+
import { afterEach, describe, expect, it, vi } from 'vitest';
interface DevProcessHandle {
@@ -8,6 +10,11 @@ interface DevProcessHandle {
interface DevStartupTestingExports {
__testing: {
+ createPackageScriptProcessConfig: (params: { isWindows: boolean; scriptName: string }) => {
+ args: string[];
+ command: string;
+ options: SpawnOptions;
+ };
createDevProcessHandle: (params: { isWindows: boolean; pid?: number }) => DevProcessHandle;
sendSignalToDevProcess: (handle: DevProcessHandle | undefined, signal: NodeJS.Signals) => void;
};
@@ -33,6 +40,22 @@ describe('devProcessCleanup', () => {
});
});
+ it('should run package scripts through bun instead of npm', async () => {
+ const { createPackageScriptProcessConfig } = (await loadTestingExports()).__testing;
+
+ expect(
+ createPackageScriptProcessConfig({ isWindows: false, scriptName: 'dev:spa' }),
+ ).toMatchObject({
+ args: ['run', 'dev:spa'],
+ command: 'bun',
+ options: {
+ detached: true,
+ shell: false,
+ stdio: 'inherit',
+ },
+ });
+ });
+
it('should signal the saved process group without requiring the direct child to be alive', async () => {
const { sendSignalToDevProcess } = (await loadTestingExports()).__testing;
const kill = vi.spyOn(process, 'kill').mockImplementation(() => true);
diff --git a/src/services/taskTemplate.ts b/src/services/taskTemplate.ts
index 4a0def75a35..26112f0082d 100644
--- a/src/services/taskTemplate.ts
+++ b/src/services/taskTemplate.ts
@@ -1,22 +1,23 @@
import { lambdaClient } from '@/libs/trpc/client/lambda';
class TaskTemplateService {
- dismiss = async (templateId: string) => {
+ dismiss = async (templateId: number) => {
return lambdaClient.taskTemplate.dismiss.mutate({ templateId });
};
listDailyRecommend = async (
interestKeys: string[],
- options: { count?: number; refreshSeed?: string } = {},
+ options: { count?: number; locale?: string; refreshSeed?: string } = {},
) => {
return lambdaClient.taskTemplate.listDailyRecommend.query({
count: options.count,
interestKeys,
+ locale: options.locale,
refreshSeed: options.refreshSeed,
});
};
- recordCreated = async (templateId: string) => {
+ recordCreated = async (templateId: number) => {
return lambdaClient.taskTemplate.recordCreated.mutate({ templateId });
};
}