Commit Graph

20 Commits

Author SHA1 Message Date
root ef978ddbbf docs(desktop-client): spec v2.3 from architect-level review
Third-round Claude+Codex+Gemini architect review surfaced foundation-
level issues that prior local patches missed. Codex verdict was
Needs-rework; Gemini verdict was Ready-with-caveats. v2.3 lands all
2 Critical + 9 Warning + 3 Info.

Critical:
- C1 workspace-as-first-class: Prior drafts added a WorkspaceScope
  middleware, but Codex verified code: Actor/Claims carry only tenant_id,
  cache_support keys scope to tenant, workspaces table migration does
  not exist, tenant_monitoring_quotas tracks primary_installation_id.
  Add a new Plan 0 (Workspace foundation uplift, 2-3w, blocks Plan A)
  covering workspaces + memberships migrations, claims extension,
  cache-key rewrite, and the full monitoring-domain migration checklist
  (new §6.1.1). §2 hard-constraint 8 rewritten; new hard-constraint 9
  reserves credential_holder / account_home naming for future evolution.
- C2 CDP stream-capture path was still inconsistent: Fetch.continueResponse
  + takeResponseBodyAsStream cannot chain per CDP semantics. v2.3 moves
  EventSource to Network.eventSourceMessageReceived, fetch-stream to
  Network.streamResourceContent + dataReceived (Chromium >=120, OK on
  Electron 41), and reserves Fetch only for must-mutate scenarios
  without chained continueResponse. Plan A now requires a provider x
  transport spike matrix (0.5w) before any adapter work.

Warning:
- W1 Patch-channel minimal loop (G1) promoted from Plan C to Plan B,
  so Beta exit criteria are satisfiable.
- W2 waiting_user decoupled from lease: becomes a parked state that
  releases the lease, survives hours of human review, and is resumed
  via POST /tasks/{id}/lease?from_parked=true.
- W3 credential_holder/account_home evolution seam formalized.
- W4 §6.1.1 lists 8 monitoring-domain migration items that were
  previously hidden inside "sqlc rename".
- W5 Deep-link nonce becomes a one-time opaque code bound to
  target_client_id, Redis-jti consumed on verify.
- W6 §10.3 block H raised from 1.5w to 2.5-3w after Gemini verified
  PublishArticleModal's accounts[0] assumption needs a real rewrite.
- W7 MarkdownPreview extracted into packages/ui-shared so Web preview
  and Desktop manual review use the same renderer.
- W8 packages/http-client gains a standardized SseClient (backoff +
  Last-Event-ID + snapshot + dedup), shared by both apps.
- W9 Trace viewer now runs inside a CSP-sandboxed iframe with hash
  routing for file:// loads; trace data flows in via postMessage.

Info:
- I1 §14 adapter map appendix; Hunyuan renamed to Yuanbao with the
  correct entry domain (yuanbao.tencent.com).
- I2 UNKNOWN tasks gain a reconcile workflow (mark-succeeded /
  mark-failed / ignore / recreate), plus weekly in-app nudge.
- I3 New §15 listing the 5 Mermaid diagrams Plan A must produce
  (sequence, lease state machine, account resync, multi-instance
  topology, component tree).

Total effort re-estimated from 24-28w to 28-33w; split expands from
3 plans to 4 (Plan 0 -> A -> B -> C).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 22:12:53 +08:00
root a83faff211 docs(desktop-client): spec v2.2 applies 4C+9W from second cross-review
Second-round Claude+Codex+Gemini cross-review surfaced implementation-
level gaps in the v2.1 admin-web coordination layer. All 4 Critical
and 9 Warning findings addressed:

Critical:
- C1 (multi-account routing): desktop_tasks now has first-class columns
  job_id, target_account_id, target_client_id, platform with indexes;
  new desktop_publish_jobs aggregation table; §6.3 SSE only pushes to
  target_client_id; lease rejects non-target requesters.
- C2 (account consistency): Replace vague "client=SoT, server=projection"
  with CAS + Tombstone protocol. platform_accounts gains sync_version
  and deleted_at; all client writes require if_sync_version CAS; web-side
  delete writes delete_requested_at intent, client resync completes the
  delete via normal DELETE path. Added 3-way merge rules and concurrent
  case table in §6.8.6.
- C3 (/api/tenant/events auth): WorkspaceScope middleware required
  (TenantScope insufficient); topics must be server-derived from
  actor+workspace, never accept free query params; symmetric contract
  table between /api/desktop/events and /api/tenant/events (multi-
  instance fanout, Last-Event-ID replay, snapshot first frame, monotonic
  event_id, client dedup).
- C4 (route migration): Full migration map added in §6.8.4 listing
  media/platform-accounts -> accounts, articles/:id/publish-batches ->
  publish-jobs, publish-records -> publish-jobs/{id} subtasks.

Warning:
- Kimi binary-framed gRPC-Web path added to §5.2 transport table;
  login methods (Kimi: wechat/phone; Hunyuan: wechat/qq/email +
  loopback) noted in §4.4.
- Offline->online dual-sided reclaim: server scans queued tasks and
  re-pushes task_available; client heartbeats+resyncs then enters
  lease(limit=20) loop until empty.
- GET /api/desktop/accounts?client=self added to §6.4 for resync.
- Account.tags added; Modal gains tag multiselect + search + three-
  level batch select.
- §6.8.5 exposes queue_ahead + eta_seconds for capacity feedback.
- Deep link gains intermediate-state modal + manual-launch/copy
  fallbacks + one-time nonce JWT on tasks/<id>/review; Windows/mac/
  Linux protocol registration specified.
- content_ref is now polymorphic {type, id} supporting article_draft /
  template_gen / video / brand_asset.
- retry endpoint accepts JSON body, not query string.

Info: §10.3 title corrected to 9 blocks; §12 opening synced to 24-28
weeks; §6.8.3 adds "attention-needed accounts" card + per-platform
summary; monitoring LLM UI switched to Grid/Tag responsive layout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 21:48:02 +08:00
root c41222706b docs(desktop-client): spec v2.1 adds admin-web coordination + 2 LLMs
User feedback integrated:

- LLM monitoring scope: 3 → 5 providers (add Hunyuan + Kimi).
  Keep-alive table in §4.4 gets 2 rows (default 8 min heartbeat,
  re-evaluate on integration). Block B effort 2-3w → 4-5w; total
  22-26w → 24-28w; Plan B scope updated.
- New §6.8 "admin-web coordination" covering:
  - Publish modal with *account-level* selection (not platform-level):
    one workspace has many accounts per platform (e.g., 5 WeChat);
    one job expands to N desktop_tasks each bound to (platform, account).
  - Media data dashboards at account-level granularity (overview,
    publish history, monitoring results).
  - New /api/tenant/* aggregation + SSE event bus (separate channel
    from /api/desktop/events).
  - Offline degradation UX when client(s) are offline.
  - Account data consistency: client is SoT for account existence,
    server stores projection; startup resync on upsert/delete.
  - georankly:// deep links with installed-client detection fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 21:22:38 +08:00
root 2e1a5900ea docs(desktop-client): revise spec v2 with triple-review fixes
Address 6 Critical + 10 Warning findings from Claude + Codex + Gemini
cross-review:

- C1 Replace Network.responseReceivedExtraInfo path with EventSource /
  Fetch.takeResponseBodyAsStream routing per transport type; add
  Electron-Chromium CDP compatibility matrix commitment.
- C2 Default patch channel to pure-data DSL (no JS exec); executable
  fallback gated on utilityProcess + isolated-vm sandbox with frozen
  globals. Full TUF-style signing chain (patch_seq, hash, expires_at,
  key_id rotation, revokes, runtime hash re-verify).
- C3 Add RabbitMQ task_available fanout + Redis presence registry;
  SSE only pushes signals, task ownership decided atomically by
  lease endpoint.
- C4 platform_accounts gains platform_uid + account_fingerprint +
  UNIQUE(platform, platform_uid) enforcing workspace-exclusive
  binding in DB, not by client discipline.
- C5 Task protocol adds attempt_id + lease_token with
  extend/pause/resume/cancel endpoints; manual mode enters
  waiting_user status with extended lease; 409 on stale lease_token.
- C6 Rewrite scope estimate with 7 detect-only publish adapters and
  DeepSeek monitor placeholder called out explicitly; reshape as
  9-bucket 22-26 week effort; introduce Plan A/B/C split.

Warnings addressed: BrowserView->WebContentsView everywhere;
allowDowngrade spelling fix; client_token decoupled from
client_version with rotate/revoke APIs; safeStorage Linux
basic_text guard + separate vault-export for machine migration;
keep-alive token bucket + 429 backoff + resume warm-up;
packages/ui-shared carve-out (no admin-web cloning); state machine
gets failed/aborted/unknown terminal states; sqlc regeneration
footprint made explicit; crash recovery split by task.kind;
autoUpdater unit tests + pre-release smoke; trace phased
(Alpha=logs+shots, Phase 2=Playwright-compat export).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 21:05:41 +08:00
root 9ec9314aea docs(desktop-client): add Electron 桌面客户端 replacement design spec
Captures the full plan for replacing apps/browser-extension with an
Electron tray client: single main process with multi-session isolation,
embedded web-view login with OS-encrypted local cookie vault, CDP-based
LLM monitoring (no official APIs, cost-driven), unified PublishAdapter
and MonitorAdapter interfaces with dual-track updates (per-adapter patch
channel + full release channel), Playwright-grade tracing, new
/api/desktop/* protocol with SSE + 60s pull, and 5-arch multi-OS
packaging strategy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 20:28:42 +08:00
root 79c65c1da7 feat(kol): expand variable schema and polish KOL UI
- Add length/range limits to KOL variable definitions: max_length and
  default_value for input/textarea, min_value/max_value/default_number
  for number. Backend validates and normalizes; frontend renders limit
  inputs in KolVariableConfig and applies limits at runtime in
  KolDynamicForm.
- Sort workspace cards by most recent prompt/package update, falling
  back to granted_at. Adds updated_at to KolWorkspaceCard.
- Polish TemplatesView, WorkspaceView, and KOL package management UI;
  route create/update/publish/archive/delete toasts through i18n and
  expand package form copy and status labels.
- Remove stale KnowledgeView.vue.patch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 15:01:40 +08:00
root 8c531054b3 docs: add KOL profile page implementation plan
9 TDD tasks, each with bite-sized steps and commit points:
validators → service → avatar upload → handlers/routes →
API client → i18n → persona card → view/route/nav → verify.
2026-04-18 14:01:54 +08:00
root 26dd75e548 docs: add KOL profile page design spec
- KOL 工作台新增「个人主页」独立页,明确与租户/SaaS 账号设置区分
- 定位为精调模版展示页 + KOL 人设自助编辑
- 页面内联编辑、头像复用 image_service、仅展示已发布模版
2026-04-18 13:55:20 +08:00
root 3ef0807456 fix: Enhance Kol Variable Rendering and Management
- Updated the regex for placeholder matching to support more flexible key formats.
- Refactored variable storage to allow both ID and key lookups in rendering.
- Improved schema validation to check for duplicate keys and enforce non-empty keys.
- Added new utility functions for variable value lookup and display name generation.
- Enhanced tests to cover new key-based variable scenarios.
- Refactored KolPrompt repository to simplify prompt storage and management, including the removal of obsolete revision handling.
- Introduced new API endpoints for saving, activating, and archiving prompts.
- Added new utility functions for handling Kol placeholders and platform options in the admin web.
- Implemented database migrations to simplify prompt storage structure and ensure data integrity.
2026-04-18 00:47:57 +08:00
root 3e1b68f771 docs: add KOL feature implementation plan
8-phase plan covering data foundation, profile lifecycle, workspace
backend/frontend, marketplace+subscription, generation pipeline, dashboard,
and workspace integration. Each phase is a shippable milestone.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 07:46:29 +08:00
root 6b2810fc74 docs: revise KOL spec v2 — align with existing prompt sharing architecture
Addresses all critical findings from review:
- KOL identity via prompt_share_profiles, not platform_role
- Prompts stored as sealed article_templates, not parallel system
- Platform-level packages with proper API path separation
- Generation pipeline integrated with existing tx/quota/idempotency
- Variable model with immutable IDs and version snapshots
- Independent kol_assist_tasks table (decoupled from template_assist_tasks)
- Complete resource lifecycle and auth chain
- Consistent tenant-level subscription entity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 22:24:11 +08:00
root 33f1121633 docs: add KOL feature design spec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 22:08:50 +08:00
root 27389164b0 feat: add image management functionality
- Implemented image folder repository with CRUD operations.
- Added image reference repository for managing image references to articles.
- Created image repository for handling image assets, including listing, inserting, updating, and deleting images.
- Introduced image usage repository to track storage usage and quotas for tenants.
- Added SQL queries for image assets, folders, references, and usage.
- Developed image handler for HTTP endpoints to manage images and folders.
- Created database migration scripts for image-related tables and structures.
2026-04-16 20:40:41 +08:00
root 0a3558fc51 feat(deploy): add containerized deployment configuration and scripts
- Add Dockerfile for frontend and server services
- Add Docker Compose configs (standard and offline mode)
- Add nginx.conf for admin-web service
- Add deploy scripts: package.sh (packaging) and load-and-start.sh (startup)
- Add deploy/config.yaml, .env.example, and prompts.yml configurations
- Add image management design specification doc
2026-04-15 21:27:15 +08:00
root 9b4dd09780 Doc:Remove the document on question-driven monitoring design V1 and add a new image related to problem-driven data. 2026-04-09 23:58:13 +08:00
root 36451a613d feat: Introduce AI Brand Monitoring System V5 technical design document
- Added comprehensive technical design document for AI Brand Monitoring System V5, outlining system architecture, data models, sampling strategies, and monitoring protocols.
- Key changes include a shift to a sampling-based trend monitoring approach, updated data collection and storage strategies, and new metrics for performance evaluation.
- Implemented migration scripts to support the flattening of brand questions and versioning of question texts, ensuring historical data integrity and version control.
2026-04-09 14:43:20 +08:00
root 446f865cdf feat: add knowledge management functionality with CRUD operations and database schema
- Implemented KnowledgeHandler for managing knowledge groups and items, including listing, creating, updating, and deleting operations.
- Added database migration scripts to create necessary tables for knowledge management, including knowledge_groups, knowledge_items, knowledge_parse_tasks, and knowledge_chunks_meta.
- Introduced prompt_rule_knowledge_groups table to associate prompt rules with knowledge groups.
2026-04-05 17:14:13 +08:00
root 32d6a462cd feat: implement browser extension for media publishing and add backend support for media management 2026-04-03 00:39:15 +08:00
root 8958cb44c0 Refactor brand service and related components
- Removed ListQuestionVersions method and associated types from BrandService and Queries.
- Updated PromptRuleGenerationService to change task naming and handling.
- Enhanced ScheduleTaskService to support filtering by created date range and keyword.
- Introduced InstantTaskService for managing instant tasks with appropriate filtering and response structures.
- Added InstantTaskHandler for handling API requests related to instant tasks.
- Created InstantTaskTab component for the admin web interface to display and manage instant tasks.
- Updated database migrations to rename source types for articles and generation tasks.
- Adjusted models and repository queries to reflect the removal of question version handling.
2026-04-02 21:16:12 +08:00
root de30497f59 feat: add tenant and user management with migrations, handlers, and tests
- Implemented tenant and user management features including:
  - Tenant creation and management with associated migrations.
  - User creation and management with associated migrations.
  - Tenant membership management with associated migrations.
  - Platform user roles management with associated migrations.
  - Quota management with associated migrations.
  - Article and template management with associated migrations.
- Added HTTP handlers for templates and workspaces.
- Created tests for protected and public routes.
- Introduced a script to check tenant scope in SQL queries.
- Documented task plan for backend completion and frontend foundation.
2026-04-01 00:58:42 +08:00