Compare commits

..
Author SHA1 Message Date
weichen 210fe4a7bb merge: feature/sync-wip-2026-09-13 — container env config and chat refresh docs
CI / go-vet-and-short-test (push) Failing after 1s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 0s
2026-09-13 02:55:31 +00:00
weichenandCursor 6101bf8bef docs(audit): add chat history refresh diagnosis and remediation trail
Record refresh disappearance root cause, gap-matrix blocker, short-term
task, handoff, and archive evidence for CHAT-HISTORY-REFRESH.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:55:21 +00:00
weichenandCursor fe0bb3a503 fix(config): layer root and env compose files with expanded overrides
Load agent/cursor env overrides in config loader; pass root .env plus
environment-specific env files in env-service; align compose env_file mounts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:55:18 +00:00
weichen 40fdd9315c merge: feature/chore-history-rewrite — history rewrite tooling and docs
CI / go-vet-and-short-test (push) Failing after 1s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 35s
2026-09-13 02:51:33 +00:00
weichenandCursor 9e8ff2ff4a chore(scripts): add epic history rewrite tooling and SHA map docs
Replay 358 linear commits as 14 feature/fix epics with merge --no-ff;
include manifest, rewrite script, SHA map, and git-workflow-helper alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:51:33 +00:00
weichen 4a7b571c8d merge: feature/agent-docs-system — doc taxonomy and branch policy 2026-09-13 02:50:23 +00:00
weichen f9656d899e merge: fix/governance-v2-codex — three-workflow governance and Codex P0 2026-09-13 02:50:23 +00:00
weichenandCursor f30886e442 docs(agents): require feature branches off dev for all work
Align AGENTS, Cursor rule, PROJECT, README, templates, and CURRENT with
strategy A: no direct commits on dev/test/main; all work branches from dev.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichen 7ffbadfaa8 merge: feature/workflow-abac-taskrun — workflow ABAC taskrun and QA 2026-09-13 02:50:23 +00:00
weichenandCursor edcfcd321c docs(ops): 勾选 pi-agent provider 修复提交证据
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 81743dcb75 docs(ops): remove .doc root stubs and archive completed research
Delete 15 redirect stubs now that canonical paths exist under audit/
and remediation/. Move completed ops/research to archive, fix internal
links, and remove untracked duplicate test-report workspace artifacts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 73bf08275b docs(test): record pi-agent E2E v5 PASS after env sync fix
Full lifecycle passed in 714s with MiniMax token, RUNNER_AUTH_TOKEN, and shared KB connected.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor c60599379f fix(agent): 将 pi-agent 默认模型对齐为 MiniMax-M2.7-highspeed
根因是 Go 默认 provider 误为 cc-switch-kimi-for-coding,且 app 容器未注入 PI_AGENT_*,导致 runner 收到未知 provider。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor be9a6d4640 docs(archive): relocate superpowers, workflow, and test assets
Move docs/superpowers to archive/design/superpowers with stubs;
archive workflow rules to PROJECT SSOT; separate test-report assets.
Update Go doc path references.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 037c6084c5 docs(config): align .env.example with dual-env compose layout
Document CONTEXT_DB/SYSTEM_DB aliases, pi-agent secrets sync to configs/.env.dev, and compose vs host Go variable scope.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 575c2da092 fix(deploy): main 环境注入生产密钥并完成本地冒烟验收
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 20f52d025b docs(agents): multi-agent rules, templates, and tool entrypoints
Rewrite AGENTS.md with taxonomy, worktree, and integration slot rules;
add FEATURE-MATRIX-driven CURRENT; tool stubs; session-close checklist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor bb0af3873d docs(test): record pi-agent E2E v3 failure at 60m step timeout
V0.1 step_01_organize exceeded AgentTimeout after KB and timeout passthrough fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 2fbb0b29a6 docs(audit): 以 gap-matrix 与 ops 对齐 Codex 再审计结论
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 511864bad0 docs(ops): scaffold doc taxonomy and relocate audit/remediation
Establish .doc/{status,audit,remediation,archive} structure with README
maps, migrate 15 root audit/remediation docs, and add redirect stubs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 033ef70ac9 fix(squad): propagate AgentTimeout to pi-agent step execution
E2E v2 still hit 30min runner timeout because runOneStep ignored ExecuteOptions.Timeout; inject shared KB config in pi-agent E2E test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 0547bd58a8 fix(ops): HTTP 超时、env status 只读;test/dev 镜像重建 schema 25
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor f4619757e2 fix(test): extend pi-agent E2E AgentTimeout to 60m for stage runs.
V0.1 workflow steps exceeded the default 30m pi-agent /v1/run deadline; align test config with production AGENT_TIMEOUT and runner env vars.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichen 3d09bd6d7d fix(quality): 闭环 Go 质量门禁(鉴权富化/V0.5/vet/health/KB gate/记忆轮询) 2026-09-13 02:50:23 +00:00
weichenandCursor c6c7423ec6 docs(test): record pi-agent E2E failure at V0.1 stage timeout.
Document 33min run with dialogue steps passing and workflow ExecuteStage failing on pi-agent /v1/run deadline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor ac9fe7f09b chore(ops): 新增退休非正式工作流定义脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 9598705fc7 chore(ops): add test env smoke script and document test soak pass.
Provide git-push-dev helper, DEP-001 smoke checks for test compose, and update E2E/soak test report.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 8c5dd97d63 feat(db): 同步种子用户与项目序列避免冷启动主键冲突
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 72879c6e22 fix(db): enable test env cold-start migrations on empty database.
Use pgvector image with extensions-only init, seed legacy users before project/chat fixtures, and align test compose with goose-only schema bootstrap.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 3b7b49c624 fix(api): 任务同步与SSE入口补齐项目成员鉴权
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor f73988e567 docs(test): update report with successful push and dev soak.
Record Gitea token push, restarted dev server ready checks, and 60s soak pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 0d10c9adfe docs(ops): 建立通用 AGENTS 手册与本仓 PROJECT/CLAUDE 入口
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor c1b8f23b14 docs(test): report PG fix, CI short suite, and soak/E2E progress.
Document seed user reactivation, full short test pass, readiness soak, and blocked git push pending credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichen 185c42fc94 test(governance): 补跑 product_manager PG+PI 全链路并通过
抽取 runPiAgentGovernanceE2E 共用 harness,新增 system_reqs 真实 Agent 验收并更新测试报告。
2026-09-13 02:50:23 +00:00
weichenandCursor c7aba86376 fix(test): stabilize PG seed users and CI short test suite.
Reactivate dev seed users after auth PG tests, use unique session tokens, fix import guard and coordinator assertions, and skip flaky E2E in short mode; add pg_restore CI drill job.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichen 390c0e3c71 docs(test): 更新 gap matrix MISSING-04 为 PASS 2026-09-13 02:50:23 +00:00
weichenandCursor 81f118098d docs(test): archive QA-001 backup drill and penetration test report.
Record template MIME, CI gate, backup/RPO drill, and security negative case results per test report standard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichen 784d852ac0 test(governance): PI Agent PG 全链路实测通过并固化运行条件
修复 runner 鉴权与 data/dev 工作区挂载,使用正式 main 工作流完成 intake→批准→推进。
2026-09-13 02:50:23 +00:00
weichenandCursor 1ebed78bf5 test(security): add automated penetration negative test matrix.
Cover anonymous admin/task access, body limits, MIME rejection, strict readiness, and CORS allowlist without legacy test principals.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichen d6f5e0e28a feat(projectcontext): bizdev 注入项目对话并完成 PG 治理 E2E
新增 ctxmgr 项目对话采集并接入 PM/TE BuildSnapshot;PG 测试统一 TEST_DATABASE_URL 并使用三正式工作流 key。
2026-09-13 02:50:23 +00:00
weichenandCursor d957b05569 chore(ops): add system DB backup and restore drill scripts.
Support dev/test/main pg_dump backups with RPO manifest metadata and a restore drill that validates dump integrity and migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandClaude Sonnet 5 a6501e5b31 docs(audit): comprehensive project code review and remediation plan
Complete audit and remediation documentation for Chat-Agent-System:

- 2026-09-12-AUDIT-INDEX.md: Document index and quick navigation guide
- 2026-09-12-audit-summary-report.md: Overall project assessment (5.7/10)
  - 12 identified defects (3 critical, 4 high, 5 medium)
  - 3 incomplete features
  - Risk assessment and remediation timeline (61h total)

- 2026-09-12-comprehensive-audit-and-remediation-plan.md: Detailed analysis
  - BUG-01 to BUG-12: Root cause, code locations, impact
  - MISSING-01 to MISSING-04: New feature design
  - Phase A/B/C remediation strategy

- 2026-09-12-remediation-tasks-and-acceptance-checklist.md: Executable tasks
  - 15 detailed tasks with code snippets and test cases
  - 61 hours total effort (Phase A:15h, B:26h, C:20h)

- 2026-09-12-quick-reference-guide.md: Fast lookup and diagnostics
  - Symptom → root cause → solution matrix
  - Code hotspot map and common Q&A

Key findings:
- Project 70% complete, needs immediate remediation
- 3 critical bugs affecting project lifecycle, security, data consistency
- 0% E2E test coverage
- 88 test definitions polluting development database

Recommendation: Start Phase A immediately (critical fixes), complete all remediation within one week.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 02:50:23 +00:00
weichen 0beddd9887 ci(qa): add QA-001 gate with go vet, short tests, and migration check. 2026-09-13 02:50:23 +00:00
weichen 77b8d07cd7 fix(governance): 统一文档访问判定与上下文快照排除计数
补齐 DocumentAccessDecider HTTP 409、projectcontext 私有对话排除统计,并更新整改 gap matrix 与测试报告。
2026-09-13 02:50:23 +00:00
weichenandCursor 6bc238c665 feat(upload): reuse MIME validator for workflow template uploads.
Centralize template extension, magic-byte, and HTML/script rejection in upload.ValidateTemplate so admin template POST matches project asset hardening.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 574dd16546 fix(frontend): skip hash anchor navigation until session is validated
Avoid chat day fetches with empty session_id on the login page when a stale URL hash is present.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 5856585d1d feat(ops): compose runner auth, upload MIME validation, and test soak
Wire RUNNER_AUTH_TOKEN through dev/test/main Compose, validate uploads
with extension whitelist and content sniffing, add readiness soak script
and short PG loop test, and require runner token in prod when URL is set.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 38e44a2606 docs(workflow): record three-workflow governance remediation and test report
Archive the strict governance design notes and validation report for the 2026-09-12 remediation cycle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor d7a144de26 feat(taskrun): resume interrupted runs and harden P1 security gaps
Add confirm-gated resume API with resumable flag, Phase 5 finalize fault
and rolling-restart replay tests, Mermaid strict mode, request body limits,
and optional Runner Bearer auth between app and pi-agent.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor ad6e38d11a test(workflow): add governance regression and activation PG coverage
Cover public auth config, catalog policy, official main workflow activation on Postgres, and conn-busy metadata writeback fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 3ade654256 feat(taskrun): add worker lease/heartbeat and Phase 5 fault injection tests
Introduce goose v20 lease columns with heartbeat loops so only expired
leases are marked interrupted on restart; add PG tests for concurrent
stage advance, active lease survival, and backup migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 47984f4863 fix(frontend): gate data fetches until session validated and improve workflow UX
Prevent login-page 401 noise by deferring project/chat API calls until auth is confirmed, use public-config for registration policy, and add client-side duty assignment checks before saving workflow plans.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor aea391cdaf feat(taskrun): persist runs/events and fix finalize-before-done ordering
Add goose v19 task_runs/task_run_events tables with PG store for restart
replay, orphan interruption on startup, strict /ready checks, and strip
client work_dir from chat/SSE paths per P0 path sandbox requirements.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor d5a9a29eec feat(api): add workflow catalog routes and public auth config endpoint
Expose governance APIs for workflow selection/termination and allow login pages to read registration policy without admin credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 12756b13e6 fix(projectworkflow): generate UTF-8 safe project codes for Chinese names
Truncate project codes by rune instead of byte to prevent invalid PostgreSQL UTF-8 sequences from mixed CJK and ASCII slugs.

test(server): add PG pi-agent governance E2E and Phase 5 acceptance matrix

Cover Chinese HTTP project create, pi-agent intake after workflow activate, authz negatives, activate idempotency, and migration version gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor f07178fa73 feat(service): enforce three-workflow governance and instance lifecycle
Wire catalog policy, v2 manifests, stage access, activation metadata fixes, and coordinator instance advance around frozen workflow snapshots.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor c1f6830178 docs(test): fix report structure for blended ABAC and PG chain cases
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 543ca310da feat(db): add workflow schema v2 and catalog governance migrations
Introduce catalog governance tables and extend workflow schema v2 so only the three official workflows are selectable at runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 4b168854ba feat(abac): filter blended squad context and add PG governance E2E
Route BuildBlendedSquadContext through stage access gate, and add PG integration test covering activate, doc approval hook, notifications, ABAC, and stage advance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 90f77eac93 feat(authz): implement six-phase permissions, settings and workflow v2
Close P0 auth gaps for lineage/runs, stage ABAC fail-closed, and
project:create; add IAM migrations 00021-23, me settings APIs, schema v2
manifests, orchestrator skeleton, and gate A regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 79811aa759 docs(test): add pi-agent E2E and bizdev ABAC acceptance report
Record real pi-agent lifecycle run (676s PASS) and stage access gate unit test results per delivery checklist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 2795af2d09 fix(e2e): authenticate multi-role docgov steps in pi-agent lifecycle test
Align seeded user IDs and use per-role Bearer tokens so review reject/approve actions run as the assigned reviewer instead of the legacy fallback principal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 7c5f8deeb1 feat(abac): gate bizdev agent context by workflow stage duties
Inject stage access gate into bizdev service so task execution, project context reads, and prior docs respect live workflow ABAC.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor f6410508aa test(e2e): extend pi-agent lifecycle timeout to 1h
Allow long-running ad-hoc pi-agent steps by raising the HTTP client limit and documenting the 1h go test invocation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor b6035991d4 feat(notification): add 24h stage advance reminder and confirm on advance.
Poll pending requests every 15 minutes, emit deduplicated escalation notifications, and close requests when creator confirms stage advance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor d9f3d40423 feat(abac): enforce stage access on chat, search and SSE streams.
Tag messages with stage_key metadata, block sends for unauthorized roles, and filter history/search/case results by allowed stages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 69a3be5463 feat(web): poll stage ready notifications to refresh advance banner.
Poll project notifications every 15s and reload readiness when stage_ready_to_advance arrives.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 4bfe1cb5ad feat(api): wire document approval hook and project notifications API.
Register workflow approval callback on server start and expose GET /projects/{id}/notifications.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 32b88beee0 feat(projectinstance): refresh stage readiness after document approval.
Sync doc task status on approve and evaluate whether to emit stage advance readiness; chain docgov hooks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 10fa91de61 feat(notification): emit deduplicated stage ready to advance events.
Write outbox row and creator notification when a stage first becomes advance-ready.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor ff81170f47 feat(db): add outbox, notifications and stage advance request tables.
Support transactional stage.ready_to_advance events with dedupe by stage instance and config revision.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor ec2ea02e8a feat(abac): restrict workflow document access by active stage duties.
Resolve stage access from live instance assignments and filter document list/content for non-assigned roles.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor b402426257 test(db): add PG integration test for activation and stage advance.
Verify migration 00017 and full plan→preview→activate→advance chain against dev Postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor e0c39aa38c feat(service): add stage gate readiness and creator-confirmed advance.
Evaluate required document approvals before stage transition, expose readiness/advance APIs, show StageAdvanceBanner in the UI, and keep legacy workflow switch for explicit initial_workflow_key projects.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 50c5f2ab0d docs(test): add Phase 3 project workflow governance test report.
Document planning-mode creation, plan/preview/activate unit results, and API regression outcomes for the instance governance MVP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 1fa6e9aa77 feat(web): add project workflow settings wizard and replace free switcher.
Topbar shows configure/view workflow actions under governance mode with a multi-step ProjectSettingsModal for plan, duty assignment, and confirmed activation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor be5cdb1ef6 feat(api): expose project settings endpoints and block legacy workflow switching.
Add settings/plan/preview/activate routes and reject active-workflow toggles when governance instances or planning projects require configured activation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor dc629fc4b8 feat(service): implement project workflow plan, preview, and activation flow.
New projectinstance package validates three-duty separation, issues confirmation tokens, and activates immutable workflow instances; new projects start in planning mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichen a24b00d393 merge: feature/security-iam — P0 security and IAM Phase 0-1 2026-09-13 02:50:22 +00:00
weichenandCursor 0f5bc426e8 feat(db): add project workflow instance tables for Phase 3 governance.
Introduce planning/active lifecycle, instance snapshots, duty assignments, and activation confirmation tokens with single-live-instance constraints.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 21de3bc39e merge: feature/chat-idempotency-task — turn idempotency and task materials 2026-09-13 02:50:22 +00:00
weichenandCursor 016c3a9791 test(docs): Phase 1 completion gates, PG integration tests, and report
Add disabled-user 401, admin roles/sessions handler tests, optional PG store
integration, cross-project 403 fixture, and update the Phase 1 test report to
reflect completion status.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichenandCursor 654e19a12d docs(test): Phase 2 workflow designer test report and plan
Archive validator/publish test results and document Phase 2 MVP scope
boundaries ahead of Phase 3 project activation work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHEN fcf00e7d1a chore(scripts): fix backfill script import and run projection for ws_intake 2026-09-13 02:50:22 +00:00
weichenandCursor a56d033d3c feat(web): fail-closed capabilities and admin roles from server API
Stop persisting roles to localStorage as authority; AdminSettingsModal reads
and writes role matrices via /api/v1/admin/roles; hasPermission denies when
capabilities are not loaded from /auth/me.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichenandCursor ebbfc2db18 feat(web): add admin workflows and template library tab
Admin console can list workflow definitions, validate/publish draft versions,
and view bootstrap template assets from the server API.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor 9d40a91f9d feat(web): sync workflow docs from server and persist task artifact in chat
Pass doc_id on task runs, merge server deliverable state by task_key,
fetch controlled document content when opening non-template docs, and
map metadata.artifact after refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichenandCursor 6219caf690 feat(authz): complete Phase 1 admin roles, sessions, and unified admin gate
Add roles CRUD backed by system_roles tables, session list/revoke APIs,
capabilities fallback for memory mode, and route all admin checks through
AuthorizationService instead of hardcoded role-admin checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichenandCursor 967dd9becd feat(api): add admin workflow and template management endpoints
Expose draft/validate/publish/retire workflow APIs and template upload/list
routes wired to workflowdef service with DBCatalog refresh on publish.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor 68765023a2 feat(api): add workflow document list, content read, and backfill script
Expose project controlled documents from DocGov, serve authenticated
output.md content by doc_id, and add idempotent backfill for run_1789111889557885000.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 8cdc839650 test(docs): Phase 1 IAM authz tests and test report
Extend P0 and auth/me handler tests for members endpoint and capabilities; archive Phase 1 test report under .doc/test-reports/.
2026-09-13 02:50:22 +00:00
weichenandCursor edffe74009 feat(db): add workflow definitions, versions, and template asset tables
Introduce Phase 2 IAM-adjacent schema for versioned workflow definitions,
template assets/versions, and workflow_defs permissions seed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor 238f1d9346 feat(agent): unify async task FinalizeTaskRun projection to chat and runs
Extend taskrun executors to return full TaskRunResult, finalize assistant
placeholder content with artifact metadata, and map quality_failed terminal
state instead of metadata-only updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 47b8179824 feat(web): wire project members CRUD to REST API
Add projectMembers client and role adapter; sync members from server on login and modal open; persist add/update/remove via /api/v1/projects/{id}/members.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor 91b257393e docs(test): add longtask P0 observer and materials test report
Archive automated regression results for stream materials, observer disconnect,
project asset upload, and ResolveMaterials assembly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 844bfd2803 feat(web): consume server capabilities for RBAC decisions
Fetch and cache capabilities from /auth/me on login and session restore; hasPermission prefers server capabilities over local role definitions.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor bbd1218922 feat(web): asset upload, task run observer, and session lineage on tasks
Upload binary attachments as project assets, subscribe by run_id after refresh,
and pass session_id/project_id through long-task requests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 4258d88415 feat(authz): add AuthorizationService, capabilities API, and project members CRUD
Wire authz service into server, expose capabilities on /auth/me, and add project member management routes with owner/admin gates.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor e139b2b267 feat(api): observer task runs decoupled from SSE lifecycle
Add POST/GET/POST cancel task run APIs, background worker with event replay,
workspace reconcile, runner child cancel, and chat message metadata updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen d8c445bfd5 feat(auth): persist sessions and accounts via PostgresAuthStore
Add PgStore with hashed token sessions, IAM bootstrap, and store factory wiring; remove in-memory token map and allow_dev_switch from login payload.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor 908d4bdb2e feat(agent): project asset upload and squad materials assembly
Register uploads via CAS, resolve project asset pools into task materials
with server-side extraction, and propagate asset_id through the bizdev/squad chain.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 3b72503ec6 feat(db): add IAM core migration for users, sessions, and RBAC
Introduce goose migration 00015 to extend users with IAM columns and seed system roles/permissions for Phase 1 authorization.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor 6f3a4d4c80 fix(api): pass materials through task/stage stream handlers
Stream SSE path now forwards Materials to ExecuteTask/ExecuteStage, and
TestTaskStream_MaterialsInjection targets the real /tasks/run/stream endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 25ec2a22d8 docs(plan): add Phase 1 IAM and authorization implementation plan 2026-09-13 02:50:22 +00:00
WeiCHENandCursor 70493a3ed5 feat(web): wire project list and create to server API
Login syncs projects from GET /api/v1/projects; create project uses POST with server-assigned id while preserving local sessions and templates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen d4988d04e8 test(docs): extend Phase 0 security gates and archive test report
Add P0 negative tests, prod bundle forbidden-string scan, and the Phase 0
security止血 acceptance report with PASS results.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor 636eb0ccf1 fix(web): align workbench user ids with auth seed
Unify MOCK_USERS with backend auth (admin id=1), merge session identity on login, and migrate demo seeds/tests to id 2/3/4 for 张工/李/王.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen e96ade076a fix(auth): restrict demo seed users to dev/test environments
Main no longer creates fixed-password demo accounts and legacy anonymous
fallback is limited to explicit dev/test in-memory fixtures.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor a8c8cba447 fix(web): keep draft when send preflight fails
Return accepted/error from handleSendMessage, clear InputArea only on success, and surface thinking/streaming feedback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 171959710d fix(security): add CORS allowlist and enforce principal on chat handlers
Replace wildcard CORS with configured origins and bind chat/task user
identity to the authenticated principal instead of request body fields.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor f9c4f9b01b fix(web): add secure-context-safe clientTurnId helper
Provide RFC 4122 v4 fallback via getRandomValues for LAN HTTP pages where randomUUID is unavailable.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen d612c1193e fix(web): remove identity simulation and stop sending X-User-ID
Product UI no longer switches sessions locally; API clients attach Bearer
tokens only and LocalAuthClient stays test-only outside the prod bundle.
2026-09-13 02:50:22 +00:00
WeiCHEN eea28f0be4 feat(task): inject uploaded documents into task materials and enable LAN host access
- backend: add Materials field to TaskRunRequestDTO and forward to ExecuteTask
- backend: add TestTaskStream_MaterialsInjection test case in taskstream_test.go
- web: serialize materials in buildTaskRequest and add unit test
- web: improve isSameMessage identity comparison in messageIdentity.ts
- web: configure host: '0.0.0.0' in vite.config.ts for LAN collaboration access
2026-09-13 02:50:22 +00:00
weichen 886cbb7913 docs(plan): add production governance plan and Phase 0 authz matrix 2026-09-13 02:50:22 +00:00
WeiCHENandCursor cc2aa33b10 docs(test): chat turn idempotency automated test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 36721f9c08 docs(test): archive P0 remediation test report 2026-09-13 02:50:22 +00:00
WeiCHENandCursor 7ab5041c59 refactor(web): stop persisting full message list to localStorage
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen 3145550a59 feat(security): complete P0 release blocking remediation
Unify auth middleware and remove X-User-ID trust, add project_members
authorization, sandbox workspaces via resolver, and admin-only reconcile
by run_id. Introduce goose migrations with startup schema gate, fail closed
when DB unavailable outside explicit ALLOW_IN_MEMORY, bundle web/dist in
app Dockerfile, and remove frontend pseudo-login fallback.
2026-09-13 02:50:22 +00:00
WeiCHENandCursor d17fae0a5d feat(web): isolate stream runtime by session and turn
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor ad2147445c chore(deploy): 三环境 Compose 构建真实 app 镜像并补齐法规库运维
将 dev/test/main 的 app 服务从占位容器改为 Dockerfile 多阶段构建,增加 healthcheck 与 .regulations 只读挂载;新增法规库备份/恢复脚本并同步 env-service 目录初始化与 gitignore。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor f5ead1dcd5 feat(web): send stable client_turn_id and resume turns after disconnect
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor f4e4357ddb fix(agent): Chat Agent 全链路 P0-P5 整改
封堵鉴权旁路与导出 IDOR,DocGov 改服务端身份;对话层 PendingAction 接真实 docgov/taskrun;修复流式租约假死与会话级任务流;加固配置/doc_id/NULL;补齐 slog 与测试;前端 ErrorBoundary 与受控文档重试。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor a1cb4aade0 feat(api): gate chat stream on chat_turns with session serial execution
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
weichen eb350d4367 merge: feature/web-chat-ux — SSE chat longtask history workflow and seed data 2026-09-13 02:50:21 +00:00
WeiCHENandCursor c887bc0480 feat(db): add chat_turns idempotency table
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 93ae180159 chore(db): add ten-project chat seed migration and generator script
Provide SQL migration and Python helper to import review demo sessions
and seed messages from tenProjectsSeed.json into Postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 62ab734021 fix(web): guard chat window fetch races on session switch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor cda534a75d feat(web): improve chat attachments, unread marks, and session UX
Support richer attachment payloads in input area, local read-id cache for
unread badges, and expand private-shared and chronology test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 7c830146f5 test(web): cover real temp vs server message identity
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 6f4e8c0933 feat(web): align project templates with official reference skeletons
Replace ad-hoc markdown stubs with reference-system template baselines,
free-text device type input, and add template quality regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor e1a9b302ba fix(web): merge live and history by serverId and clientTurnId
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor a9fe69ac16 fix(workflow): reconcile version conflicts in review mode and UI retry
Auto-adopt current workflow selection version in review/demo backend
paths, and retry frontend workflow switch after refreshing project version.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor c4ef72506f feat(api): return user_message_id in SSE turn_ack and done
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 0d395f2bf2 fix(ctxmgr): normalize dismissed_unread_ids for Postgres array insert
Ensure nil dismissed ID slices serialize as empty bigint arrays and
preallocate compressDismissed output to avoid NULL write failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 9f7500bb72 fix(web): disable chat stream auto-retry without idempotency
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHEN 222b0c2dd6 feat(doc-preview): 上传文档多格式在线预览 + IndexedDB 持久化恢复
## 新增功能
- 支持用户上传的 Word(.docx)、PDF、Excel(.xlsx/.csv)、PPT(.pptx)、
  图像(png/jpg/svg/webp等)、纯文本/代码文件的在线高保真预览
- 预览与受控工作流文档严格隔离:上传文档走 FilePreviewPanel,
  工作流/对话入库文档继续走 BlockRenderer,互不干扰

## 核心 Bug 修复
- 修复页面刷新后上传文件无法预览/下载的根本问题
  - 根因:File 对象无法 JSON 序列化,刷新后内存引用丢失
  - 方案:新增 fileStore.ts,使用 IndexedDB 持久化文件二进制内容
  - App 启动时自动 restoreFileRawToDeliverables() 从 IndexedDB 恢复 fileRaw
  - 上传时 saveFile() 同步写入 IndexedDB(fire-and-forget)

## 下载按钮修复
- 优先从内存 File 对象动态创建 blob URL,避免依赖已 revoke 的旧 URL
- 文件内容不可用时按钮禁用并显示 tooltip 说明

## 存储层改进
- saveDeliverables() 序列化前剔除 fileRaw(不可持久化)和 blob: URL
  避免 localStorage 保存损坏的空对象

## 新增文件
- web/src/data/fileStore.ts — IndexedDB 封装(saveFile/getFile/restore)
- web/src/components/doc/preview/FilePreviewPanel.tsx — 预览面板主组件
- web/src/components/doc/preview/renderers/DocxViewer.tsx — Word 预览
- web/src/components/doc/preview/renderers/PdfViewer.tsx  — PDF 预览
- web/src/components/doc/preview/renderers/ExcelViewer.tsx — Excel 预览
- web/src/components/doc/preview/renderers/PptViewer.tsx  — PPT 预览
- web/src/components/doc/preview/renderers/ImageViewer.tsx — 图像预览
- web/src/components/doc/preview/renderers/TextViewer.tsx  — 文本预览
- web/src/tests/file-preview.test.ts — 预览功能单元测试
2026-09-13 02:50:21 +00:00
WeiCHENandCursor b69cb617a0 docs(spec): chat turn idempotency and session isolation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 24478ec383 feat(intent): Phase 5 V2 shadow gray flags and IntentPlan execution
Add env-based feature flags (intent_v2_shadow/decision, multi_intent,
workflow_intents), V1/V2 shadow diff reporting, expectation_plus_new plan
building, ranked-frame L2 conflict gate, and coordinator sequential query
plan execution with confirm-step deferral.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 9cb129d3e8 feat(intent): Phase 4 run control, subtypes, and limited IntentPlan
Add RUN_STATUS_QUERY/RUN_RESUME/RUN_RESTART with matcher and coordinator
handlers; write QUERY_PROGRESS/SUPPLEMENT_INFO subtypes to V2 frame; support
safe query+query multi-intent plans via IntentPlan dual-write.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor dda6a06e4a feat(intent): Phase 3 workflow/help intents and coordinator handlers
Add SWITCH/TRIGGER/QUERY workflow, doc status, help and unsupported intents
with ActionSpec registry entries, NL matchers, L2 handlers with creator-only
switch gate, router routes, and capability-aware AvailableActions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 3db56b4166 feat(intent): add V2 frame, ActionSpec registry, and legacy dual-write
Introduce IntentFrameV2 with goal/object/relation/evidence, register all 21
legacy intents in ActionSpec registry, and dual-write intent_frame_v2 alongside
TopIntent without changing Router/Coordinator routing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 868238137c fix(intent): Phase 0+1 P0 safety gates for recognition and coordination
Add golden-v1 hard-negative suite, shadow observability fields, query/command
negation gates for high-risk writes, AllowAffirmative enforcement, candidate
conflict clarification, and coordinator clarify-before-ambiguous ordering.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHEN 60d4df4319 fix(chat): resolve intent recognition, workflow auth, and message ordering 2026-09-13 02:50:21 +00:00
WeiCHEN 917740f26d feat(project): implement modal-based project creation, creator-led member assignment, and exited-member read-only retention 2026-09-13 02:50:21 +00:00
WeiCHEN eda2a2b32b refactor(dialogue): implement task dispatch notifications and consecutive assistant messages with confirmation cards 2026-09-13 02:50:21 +00:00
WeiCHEN 0df8b065c2 refactor(dialogue): naturalize multi-role conversations, close chat sessions with assistant response, and set URS to project shared 2026-09-13 02:50:21 +00:00
WeiCHEN 76e538a47f fix(doc): resolve URS viewing and private-to-shared workflow in document pane for 10 review projects 2026-09-13 02:50:21 +00:00
WeiCHEN f48181ee0c feat(chat): add URS requirement document upload dialogues with attachments and phase events for all 10 projects 2026-09-13 02:50:21 +00:00
WeiCHEN 27fe03a3e3 feat(chat): mount interactive review, approval, and verification confirmation cards in multi-role dialogues 2026-09-13 02:50:21 +00:00
WeiCHEN 2e3e43be8f fix(frontend): align MockDocumentMeta markdown property and guard nullish input in markdownToBlockAST 2026-09-13 02:50:21 +00:00
WeiCHEN a8f74244f5 feat(review): seed 10 real medical device projects with dual workflows, multi-role dialogues and fix account-switch chat isolation 2026-09-13 02:50:21 +00:00
WeiCHEN 42e3ece2c6 fix(workflow): fix 405/404/403 errors on workflow switcher by updating CORS, 5201 demo permissions and server restart 2026-09-13 02:50:21 +00:00
WeiCHEN 408bef6b8a chore(release): Phase 7 全链路验收报告、测试修复与发布基线归档 2026-09-13 02:50:21 +00:00
WeiCHEN 716aa6f49a feat(workflow): Phase 6 前端项目多工作流切换器、前置依赖横幅与文档血缘失效提醒 2026-09-13 02:50:21 +00:00
WeiCHEN abeab90388 feat(workflow): Phase 5 智能测试经理工作流、前置强依赖校验与文档血缘级联失效 2026-09-13 02:50:21 +00:00
WeiCHEN f994c45d67 feat(workflow): Phase 4 智能产品经理工作流、系统需求规格书与质量门禁 2026-09-13 02:50:21 +00:00
WeiCHEN c0d6ef7d80 feat(workflow): Phase 3 Coordinator 上下文、动作路由与工作流运行 API 集成 2026-09-13 02:50:21 +00:00
WeiCHEN f87a6ee28d feat(workflow): Phase 1 & 2 数据库迁移、项目创建人权威化与多工作流控制面 2026-09-13 02:50:21 +00:00
WeiCHEN adfb45946f docs(workflow): Phase 0 基线确认、架构决策记录(ADR)与契约冻结 2026-09-13 02:50:21 +00:00
WeiCHEN 1fc7d0d01f feat(export): 实现单次智能体回复导出、私密文档保存与隐私防泄露全套闭环 (Phase 0 - Phase 2)
- Phase 0: 实现服务端回复导出策略矩阵引擎 (replyexport.EvaluatePolicy)、数据库迁移 (2026-09-11-message-export-policy.sql)、SSE done 事件挂载与能力探测 API
- Phase 1: 构建前端 ReplyDocumentIR 语法树解析与渲染管道,支持 Markdown / DOCX 文件下载及带格式富文本剪贴板复制
- Phase 2: 实现私密自由文档 (freeform_documents) 领域服务、PostgreSQL 乐观锁版本管理、ACL 隐私隔离、一键共享与右侧栏编辑联动
- 专项修复:
  1. 修复后台 API 路由注册并加入双向拉取同步,确保私密保存实时进入我的私密列表
  2. 实现轻量回复专属 DOCX 生成与静默下载逻辑 (downloadDocxReply)
  3. 将 LaTeX 公式转为标准 MathML 矢量标记,支持粘贴到 Microsoft Word / WPS 自动识别为原生公式
2026-09-13 02:50:21 +00:00
weichen eedf2d17e0 merge: feature/rbac-auth — dynamic RBAC and auth settings 2026-09-13 02:50:20 +00:00
WeiCHEN 3885ef5da2 test(chat): add session turn_intent metadata assertion and chip category navigation tests 2026-09-13 02:50:20 +00:00
weichen ade4723a3a merge: feature/web-features — intent funnel export and templates 2026-09-13 02:50:20 +00:00
WeiCHENandCursor aef1d79060 docs(test): archive auth and dual settings test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN e8002b2243 feat(category): implement recategorize backfill engine and fallback mapping (Spec §3.4-3.5 A4-A5) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor cd4d0a19e5 test(engine): add integration tests and archive test report for project template cloning
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor b4e4a64cd0 feat(web): integrate auth guards, dual settings and dev switcher
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 7d293833bf feat(chat): 完成分类锚点坞(CategoryDock)与双轨制未读重构 (含方案A轮次归一化与起始位置居中) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor cd08e443eb feat(web): implement dedicated AdminSettingsModal for role-admin
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN aa19926819 fix(nav): 修复点击项目会话时因 URL hash 监听重放导致被强制回弹选中第一个项目的 bug 2026-09-13 02:50:20 +00:00
WeiCHENandCursor 775bf73fb1 feat(web): implement dedicated UserSettingsModal
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 1cfe3f9f02 feat(history): 完成 Phase P3 虚拟滚动、聊天记录导出与协同未读提醒
- 虚拟滚动:接入 @tanstack/react-virtual,封装 useVirtualMessages 动态测高与 overscan 预渲染,迁移 anchorNavigator 锚点定位与 SSR 兼容降级
- 聊天记录导出:基于既有 docx 与 xlsx 依赖实现 chatExporter 与 ChatExportModal,新增服务端 /api/v1/chat/export/messages 支持按条件导出
- 协同未读标记:新增 useUnreadMarks 30s 轮询与服务端 /api/v1/chat/unread 接口,日历格与工具栏支持橙色未读徽标提示
- 测试与验证:新增 chat_unread_and_export_api_test.go,前端全量 126 项单元/组件测试及生产打包 100% 通过
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 793efd31d2 feat(web): add LoginView and FirstLoginPasswordModal components
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 487dc072f5 feat(history): 实现三模历史搜索、每日智能协同摘要与时间轴侧栏 (Phase P2) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor 6f1579dde3 feat(web): add frontend auth types and api client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 54f1c88791 feat(history): 实现多级历史导航、分类筛选、日历联动与消息双向引用 (Phase P1)
- 后端核心与 API:
  - 实现 ChatCategoryStat 结构体与 ListChatCategories 统计引擎 (Postgres + In-Memory 内存降级双轨)
  - 注册 GET /api/v1/chat/categories 聚合接口
  - 增强 GetChatDayMessages 支持自动根据 anchor_id 逆查 day_key,实现免猜测跨日检索
- 前端锚点导航引擎:
  - 实现 anchorNavigator 模块 (快路径 DOM scrollIntoView + 1.8s 发光脉冲、慢路径跨日拉取、深链 Hash 解析)
  - 编写 anchorNavigator.test.ts 单元测试并 100% 通过
- 分类过滤与轻量月历:
  - 实现 CategoryFilterBar 水平分类筛选栏 (8 类业务标签,暗淡/高亮模式)
  - 实现 HistoryCalendar 零依赖原生悬浮月历组件 (热度点与消息数,jumpToDate 快速定位)
- 消息引用与双向追溯:
  - 消息气泡悬浮“引用”入口,点击提取发言人与摘要至输入框
  - 实现 QuoteChip 待发引用标签与 QuoteCard 已发引用卡片
  - 引用卡片点击直连锚点定位,快慢路径自动回溯
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 2047c85ba5 feat(api): add auth and admin management endpoints
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN fb8f57398c feat(history): 实现超长对话历史按日归档与滑动窗口 (Phase P0) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor 6c9ad6b61d feat(auth): add auth data models, config and store engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 645bd06519 feat(prompt+cache): implement 10-section prompt template, true KB regulation recall, behavior rules and multi-level caching (P4) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor e8ca4b02aa docs(plan): add auth and dual settings implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 1635ad0007 feat(coordinator): implement determinism-first query rewrite with ellipsis completion and pronoun resolution (P3) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor 72f54a2461 docs(spec): add auth and dual settings design specification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 640b672e8b feat(ctxmgr): implement chat memory vectorization, privacy dual-gate retrieval and memory composer (P2) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor 9c586f2baf test(rbac): archive dynamic roles and doc visibility rbac test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN c58d33b853 feat(ctxmgr): implement sliding window, rolling summarizer and DST task state (P1) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor e1c1d03a85 feat(web): wire rbac permission enforcement into left rail and rights modal
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN be659cba11 feat(chat): wire multi-turn dialogue broken links (G1/G2/G3/G9) with session restore 2026-09-13 02:50:20 +00:00
WeiCHENandCursor d905c91338 feat(web): add doc visibility override modal and badges in deck drawer
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN e590dcfd7b docs(design): add multi-turn dialogue optimization system design (report 03) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor b13a03840c feat(web): upgrade settings modal with dynamic roles CRUD and permission matrix
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN e5e80a6fc6 feat(core): update backend coordinator, docgov lease, squad workflow and web governance integration 2026-09-13 02:50:20 +00:00
WeiCHENandCursor bd52108c8a feat(rbac): implement permission evaluation engine and unit test suite
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 658e9db65e fix(web): wire ALL_MOCK_DOCUMENTS and project deliverables to fix document switching 2026-09-13 02:50:20 +00:00
WeiCHENandCursor aa9636c10f feat(rbac): define rbac data contracts and extend deliverable and user types
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 04cdb8f371 feat(scripts): add launch.sh to detect-and-restart dev stack (compose, backend, web) 2026-09-13 02:50:20 +00:00
WeiCHENandCursor b52f72c6fc docs(plan): add dynamic roles and doc visibility rbac implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN b83e3de401 fix(web): render step_failed phase as failed strip node with retry reset 2026-09-13 02:50:20 +00:00
WeiCHENandCursor 16674d476c docs(spec): add dynamic roles and doc visibility rbac design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHEN 7e243f4330 docs(test): archive long-task phase live/resume UX real-agent report 2026-09-13 02:50:20 +00:00
WeiCHEN 096dc8a5b4 fix(web): distinguish recovery action styles for long-task failures 2026-09-13 02:50:20 +00:00
WeiCHEN 8292f69790 feat(web): drive long tasks from SSE with live phases and continue/restart recovery 2026-09-13 02:50:20 +00:00
WeiCHEN 4dd799c785 feat(web): add task SSE client and live phase-event mapper 2026-09-13 02:50:20 +00:00
WeiCHEN 1df0a3f15f test(server): task stream transient injection, classification and resume integration tests 2026-09-13 02:50:20 +00:00
WeiCHEN 912eb61a02 feat(api): task stream request-id, resume mode and workspace-aware error classification 2026-09-13 02:50:20 +00:00
WeiCHEN c83f53a4fa docs(spec): add long-task phase live/resume UX P2 spec and plan 2026-09-13 02:50:20 +00:00
WeiCHEN a6864fe7b4 docs(spec): archive chat wait-error-retry UX spec and implementation plan 2026-09-13 02:50:20 +00:00
WeiCHENandCursor 545765c409 fix(web): escape HTML in chat markdown rendering
Prevent self-XSS when chat bubbles render user/LLM markdown via
dangerouslySetInnerHTML by escaping raw HTML after math/code
extraction and sanitizing link href schemes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor e344a10a0f docs(test): strengthen chat wait-error-retry report with web E2E evidence
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 4eaad5adb8 docs(test): archive chat wait-state error-retry UX real-agent report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor d03d9396e1 fix(web): scope Task 5 App.tsx to SSE wiring only
- Rebased App.tsx on the last clean Task-4 parent (5aa8129) and re-applied
  only Task-5's SSE plumbing: streamAbortRef, isStreamingActive,
  buildNetworkErrorInfo, runStreamAttempt, handleErrorAction,
  handleStopStreaming, and the InputArea/MessageStream wiring.
- Removed the unscoped WIP that had been folded into b2cf863 (NeuroPulse
  demo data/session-privacy/docgov-lease/cardActionPolicy imports that do
  not exist in git, causing b2cf863 to fail to build in isolation).
- Real-backend path now appends the pending placeholder and calls
  runStreamAttempt immediately; the artificial setTimeout(600) is only
  used for the mock keyword-shortcut demo branches (unchanged from 5aa8129),
  gated by precomputed predicates so it never wraps the SSE call.
- Preserved 5aa8129's mock keyword shortcuts (生成文档/驳回/修改/通过等) verbatim.
- No silent success-template fallback re-introduced.
- P1 error actions remain filtered to retry-only; auto-retry transient
  attempts stay capped at 2 with 1s/2s backoff via AbortController.
- Bloated WIP App.tsx backed up to .superpowers/sdd/App.tsx.wip-backup
  for later use by whichever task owns NeuroPulse/session-privacy/docgov
  lease work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 0cb664d540 feat(web): drive chat bubbles from SSE with auto-retry and stop
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 0d0ef5d5b6 feat(web): render chat wait-state and structured error actions in bubbles
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor fa6b979346 fix(web): drop out-of-scope ProjectSession.userId from Task 3
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 9d0a054307 feat(web): add chat SSE client and transient auto-retry helpers
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 7615beeaf9 fix(agent): scope Task 2 to SSE phases/errors without dialogue_llm leak
- untrack internal/coordinator/dialogue_llm.go (kept on disk untracked as local WIP for a future dialogue-LLM commit with its own tests; it depends on engine.go fields (dialogueBackend, ReplySource) not yet committed)
- slim internal/chat/session.go back to Task 2 scope relative to bfa6889: keep EmitErrorInfo(stream.ClassifyError(...)) for intent+coordination errors and the dialogue_generating EmitPhase before ProcessIntent; drop sync.Mutex/mu, ChatResponse.ReplySource, preference/RecentDialogue injection block, and collectRecentDialogue helper (unrelated WIP for the dialogue-LLM feature)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 1889279b18 feat(agent): emit dialogue phases and classified SSE errors with request id
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor c32532bce9 fix(stream): avoid dial substring false-positive in ClassifyError
Remove "dial" from networkHints to stop "dialogue" misclassification;
extend workspace/resumable and EmitErrorInfo test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor f9b676ac93 feat(stream): add structured ErrorInfo and error classification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
WeiCHENandCursor e8b9347d8d fix(web): redesign auth and settings UI using system design tokens and high-fidelity styles
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:20 +00:00
weichen 6ccf98e291 merge: feature/web-workbench — three-column workbench MVP 2026-09-13 02:50:19 +00:00
WeiCHENandCursor 4301c034f5 feat(web): wire project isolation and template cloning on project creation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
weichen a779d353b4 merge: feature/backend-platform — KB memory docgov API and chat history 2026-09-13 02:50:19 +00:00
WeiCHENandCursor f00bf14ab4 test(doc): 完善三分类隐私隔离与流转单元测试并归档全量测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 9ca74422c9 feat(web): add template status badges to deck drawer and tab bar
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
weichen cb8a615e0a merge: feature/squad-intent — squad engine intent and adaptive planning 2026-09-13 02:50:19 +00:00
WeiCHENandCursor 8708645f22 docs(test): 归档历史多轮会话持久化与标杆案例语义推荐标准化实测报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 4c2e93fece feat(ui): 实现三分类Tab分段切换、全景大盘分区与一键共享/取消共享闭环
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 3da2324e7c fix(engine): 修复 DOCX 公式因 undefined 虚根在 Word 中丢失的缺陷
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ab31e0e774 docs(report): 补充归档真实Agent全流程业务测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 46b955f30d feat(cli): 终端自推荐标杆案例渲染与全业务链 E2E 端到端回归实操
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 9eb155021b fix(chore): 修正.gitignore根目录data规则并纳入前端mockDocuments
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 258a8dacd2 feat(engine): add project template cloning factory and unit tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor a8f0cc9f01 docs(report): 归档智能体小队自适应规划真实后端集成测试报告与设计方案
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2a6dd442bb feat(server): 新增会话列表、多轮历史消息查询与标杆案例语义检索 RESTful API
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor c46f5422b9 feat(types): 升级交付物数据契约支持工作流/共享/私密三分类与创作者属性
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2faddab7ac refactor(types): extend deliverable item with projectId and isTemplateOnly
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor aa968d277b test(chat): 添加基于真实Agent工作区的多轮人机交互E2E测试用例
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor d0c9670ebc feat(coordinator): 在贴身业务参谋决策锦囊中注入相似标杆案例自推荐
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 9480e3fa29 fix(layout): 修复边栏拖拽位移累加并实现1:1光标捕获绝对跟随
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 1e8e7ed3ce docs(plan): add project init template cloning implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor e2ca8ad55a feat(intent): 增强目标市场槽位意图匹配与上下文兼容推断
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor fb8232639b feat(ctxmgr): 增加已批准受控文档自动切片向量化与标杆案例语义检索
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 9c4a839932 feat(ui): 修复模态背景穿透、公式/富文本Markdown解析并集成右键快捷菜单
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 9cebf826ba docs(spec): add project init template cloning design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2597a4555b feat(squad): 优化质量门禁章节规范化匹配与审核专员预置草稿流转
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor db3dc282ba feat(ctxmgr): 增加历史多轮会话列表查询、消息拉取与会话重构引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ff948377bd docs(spec): 归档三层交付物分类治理与多用户隐私/共享设计规范与实施计划
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 580a77d80a docs(test): 补充 Canvas Tainted 缺陷排查与修复验证记录
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 56bbb2f137 feat(squad): 打通成果物基准假设附录挂载、协调层自适应回显与CLI非标文档执行
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor edf2f759ae feat(ctxmgr): 增加离线确定性高维嵌入生成器与向量字面量工具
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 6885c48d48 chore(web): update package-lock.json with tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor c5d53c28fa test(engine): 增加 cleanSvgForCanvas 净化与防污染单元测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 337d75f05b docs(rules): enforce real agent execution standard for delivery verification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 0e49892075 docs(plan): 编制历史多轮对话持久化与标杆案例语义检索实施计划
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ffdb332547 docs(test): add three-column workbench and block document engine test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 3c147ed7db fix(engine): 修复 Mermaid 导出时的 Canvas Tainted 污染与 toBlob 异常
- 配置 Mermaid flowchart.htmlLabels 为 false,禁用 foreignObject 嵌入式 HTML 标签
- 实现 cleanSvgForCanvas 深度净化 SVG,剥离 @import 与将 foreignObject 转为原生 SVG <text>
- 替换异步 toBlob/FileReader 为同步 toDataURL + atob,并在 img.onload 中增加安全沙箱 try/catch 兜底

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor f75e5094a2 feat(squad): 实现单步评估器StepEvaluator与工作流动态加步、跳步及基准假设推断
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 10e01a2481 docs(spec): 编写历史多轮对话持久化与已批准交付物标杆案例语义检索设计规范
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 996f4a79df feat(server): integrate web spa static assets hosting and route fallback
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 980d0f9a2d docs(test): 归档 DOCX 原生公式、Mermaid 与排版优化测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 62ebaf49d4 feat(squad): 实现自适应任务规划器AdaptivePlanner支持固定流微调与非标文档自治拆解
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 804c7bd128 docs(test): 归档全业务链成熟度端到端贯通与受控文档治理实操测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 47d4f7cf8b feat(web): complete in-place block editing, reviewer comments, and role governance loop
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 808d706180 test(engine): 增加 DOCX 行内 OMML 复合解析与公式转换单元测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor f1d602b089 feat(squad): 实现角色资产中心RoleRegistry支持8大标准角色与临时专员派生
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 4be8be277f test(bizdev): 新增全业务链成熟度螺旋推进(V0.1->V0.5->V1.0)端到端贯通测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2cb8d9b8d2 feat(web): implement 36px slim tabs, deck drawer, and block views with medical styling
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 80383269e9 feat(engine): 实现 DOCX 原生 OMML 数学公式、Mermaid 高清渲染与出版级公文排版
- 集成 mathml2omml 与 KaTeX,实现展示级公式 (<m:oMathPara>) 与行内公式 (<m:oMath>) 的微软原生矢量公式渲染
- 实现 svgToPngData 将 Mermaid 矢量图光栅化为 2.5x 视网膜清晰度的 PNG 图片嵌入 Word
- 重构公文抬头、4列受控签署栏、出版级三线表、keepNext 防孤行与带分割线的受控页眉页脚

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 912ae4f782 feat(squad): 增强领域核心模型支持角色来源、自适应步骤与黑板基准假设
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor c68c0026d9 feat(cli): 升级 bizdev-cli 阶段执行器支持流式进度与文档治理拦截
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ef6665288c feat(web): implement agent chat stream with thinking pulse indicator and case cards
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 26c94d1107 fix(cli): adapt default stage by role and add scanner error checking
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor f9dcd51831 docs(test): establish test report standards and generate three-branch intent framework report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 429179e472 feat(bizdev): 贯通跨阶段事实黑板自动传承与里程碑决策记录
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor deee4dcee1 feat(web): implement responsive three-column shell with resizable rails and theme switch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor a02d4de7d2 docs(test): archive test report for dialogue-driven content and hierarchical intent system
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor eedda67aad feat(cli): add three-branch interaction feedback and comprehensive verification test cases
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor c290f3104b feat(ctxmgr): 支持跨阶段项目事实黑板与成熟度状态持久化
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2b9678a496 feat(web): implement markdown block ast converters and auto-numbering engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor d4ddd61443 feat(web): integrate interactive cards into chat stream and wire docgov actions
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ae9d2f1fea docs(test): archive 2026-09-08 HTTP API and SSE context integration test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 75b7c1c3d1 feat(web): define block ast, workbench session, and docgov types
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 656a19cbe2 fix(web): add 60s grace period undo, executing banner and ttl safeguards to interactive card
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 44ebafd946 test(api): add e2e integration tests for claimed document SSE and docgov RESTful APIs
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 36afce14e6 feat(web): initialize react 19 vite typescript scaffold and token design system
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 77d854e343 feat(web): build interactive card component with lifecycle and idempotency
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2815381613 feat(api): add RESTful endpoints and SSE streams for context and docgov lifecycle
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ff0262c182 docs(plan): add three-column modern workbench and block document engine implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 6493ffd3ce fix(coordinator): chain expectation for card confirmation and add ttl lifecycle cleanup
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2c05c5d3cb feat(service): emit governance interception and progress summary on claimed documents
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor b407fe534b docs(spec): refine right rail with 36px slim tabs and deck panel drawer
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 1af5a9e909 docs(test): 归档 DOCX/XLSX 导出与会话隔离持久化测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 8b942d0460 feat(stream): add governance event and lightweight progress summary protocol
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor fa9eb31d2b docs(spec): add three-column modern workbench and block document engine specification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ff1eaab820 test(workbench): 增加 DOCX/XLSX 导出与会话隔离单元测试
- 验证 DOCX 二进制 Buffer 生成、TextRun 解析与 Blob 输出
- 验证 XLSX 多表提取、自适应列宽与工作簿 Sheet 命名规范
- 验证 sess-001 与 sess-002 对话隔离及动态追加互不串线

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor dba93f8bc2 test(docgov): 增加编制审核批准全流程自动化测试与测试报告归档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 2fcf02200e feat(ui): 顶栏综合导出下拉选择器与 App 消息隔离及存储打通
- SlimTabBar: 增加导出格式气泡下拉菜单,支持一键导出 Word DOCX、Excel XLSX、Markdown MD
- App: MessageStream 严格根据 activeSessionId 过滤消息流,杜绝多项目会话串线
- App: 新建项目自动注入独立引导语,全流程与 storage 自动双向同步

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor d883836075 feat(agent): 将文档治理生命周期与认领拦截挂钩至BizDev服务与CLI工具链
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor ece051d456 feat(storage): 实现多项目会话隔离与 localStorage 全局刷新持久化
- 预设 sess-001 (4K内窥镜) 与 sess-002 (掌上超声) 独立初始消息流
- safeGetItem/safeSetItem 包装器防御性存取 sessions, activeSessionId, messages, deliverables
- 确保页面刷新后用户发送的所有内容、回复及即时生成的私密文档零丢失

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 4b00a98d4f feat(service): 实现文档编制审核批准生命周期、权限控制与认领闭环引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor fefb53ef30 feat(engine): 实现 DOCX 与 XLSX 客户端原生渲染导出引擎
- 引入 docx 与 xlsx 依赖,纯前端无损编译 Block AST 交付物
- buildDocxModel: 自动生成两行四列受控签署栏、多级编号标题、Markdown富文本、医疗标准三线表、Cambria Math公式与动态页眉页脚
- buildXlsxWorkbook: 自动提取文档概览与全部数据表格,生成带自适应列宽的 Excel 工作簿并支持直接下载

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 6c875ffbeb feat(db): 增加受控文档编制审核批准生命周期与认领治理Schema
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 1a1875bc8c feat(coordinator): implement docgov gates, semantic anchoring and interactive card dispatch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 6cd9bbe67e docs(test): 归档多级上下文管理与记忆衰减引擎真实Agent实测报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 12aad70a28 feat(ui): 升级顶栏为极简级联面包屑架构,自适应 320px 极窄视窗
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 224a2f8f9d feat(agent): 增强上下文沙箱指引、搜索过滤与CLI用户ID上下文透传
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 00e7d4db1e fix(intent): address review findings for hierarchical intent funnel and security guards
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 6ea93e5e82 feat(agent): 实现混合上下文装配引擎(Context Blender)与智能体小队沙箱对接
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 85e5c31034 feat(intent): implement 4-stage hierarchical intent funnel and slot extraction
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 96be8fdd94 feat(service): 实现单用户/项目多级上下文模型、时间衰减与用户习惯偏好管理
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 9e84ba71e3 fix(doc): 完善文档系统各层级标题、图表公式与有序列表自动编号引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 4de6c12721 feat(storage): 实现CAS物理文件寻址与向量切片防爆炸去重引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor f6e4edcb08 feat(intent): add interactive card payload and extended intent contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor f769f8da4c feat(db): 部署专属记忆与多级上下文数据库容器与pgvector初始化Schema
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 3a3347e627 docs(plan): add implementation plan for dialogue-driven content synthesis and hierarchical intent funnel
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 07a5e999b8 docs(test): 归档流式传输服务与按需呈现交互规范测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 24e577f50c docs(spec): add specification for dialogue-driven content synthesis and hierarchical intent funnel
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 500884a19b test(api): 补充SSE流式长连接端到端自动化测试套件
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 75494cbd75 feat(cli): 终端支持动态阶段状态流式输出与低认知负荷摘要呈现
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 810eb26be3 feat(api): 实现HTTP服务骨架与Server-Sent Events流式交互接口
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 0f01f047d5 feat(agent): 在小队编排与任务生命周期中打通阶段性状态与摘要流式通知
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 1bdea54022 feat(service): 建立多层级流式事件发射模型与Context穿透引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 68d9c65317 docs(test): 归档多领域知识中枢与专属法规知识库解耦集成测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 3e341fbb1b feat(agent): 配置法规可行性评估报告专属三阶段智能体工作流
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 1b7ce098b6 feat(agent): 智能体小队工作区动态法规检索与上下文注入
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 7cbfb33150 feat(service): 实现嵌入式多领域知识中枢与Hybrid RRF检索引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 7d123ae8c6 feat(db): 启动本项目专属知识库容器并完成法规数据无损迁移与解耦
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
weichen 29e00db0d9 merge: feature/agent-infra — pi-agent Tavily and docker 2026-09-13 02:50:18 +00:00
WeiCHENandCursor 97c8a7629c feat(chat): integrate non-blocking pending expectation and topic preemption in session
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
weichen 6e4c8e319b merge: feature/bizdev-core — bizdev MVP stack 2026-09-13 02:50:18 +00:00
WeiCHENandCursor 4c35888a4e feat(agent): ensure clean container and isolate workspace artifacts strictly to host volume
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 6d44412719 feat(coordinator): refactor advisor persona and assemble next expectation drafts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
weichen 085da29859 merge: feature/foundation — repo scaffold and env baseline 2026-09-13 02:50:18 +00:00
WeiCHENandCursor 713ff94ff8 feat(cli): add bizdev-cli runner tool and integration tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 3ffcab4502 docs(env): update environment configuration template with MiniMax and Tavily pool
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor db46ac7388 feat(intent): implement three-branch flexible intent resolution and expectation contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
weichen 024af3e66b chore: history rewrite root anchor 2026-09-13 02:50:18 +00:00
WeiCHENandCursor 68d58df38f chore(config): initialize go module and configuration loader
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor c65f5e8a3d fix(service): populate Excel pricing cells and verify attachment readback parity
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 34fcbe6ff3 chore(docker): integrate pi-agent service in dev, test, and main compose files
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 105b3f4103 feat(coordinator): 增强工作区阶段元数据持久化与上下文自动关联
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 0832d7caa9 docs(plan): add bizdev squad and templates implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 59cca0594e fix(service): backfill CDO quote markdown table from excel summary and align workspace
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor aad4a0daee test(agent): add Tavily pool rotation and PiAgent remote runner tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 52c36e6a87 feat(cli): CLI支持-chat交互式对话REPL与单次自然语言指令调度
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 7838ae804d chore(config): add .env.example with cursor, pi-agent, and kb variables
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 77c17b7bc0 feat(service): implement bizdev service with independent task drivers
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor b36a9ee108 feat(agent): support PI_AGENT_RUNNER_URL remote execution in PiAgentBackend
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 82bfe41d1f feat(chat): 封装L1会话管理器打通自然语言多轮人机交互闭环
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 6eebe2872a docs(spec): add business docking squad and templates design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor d54ba6ea77 chore(tools): add package.json for cursor-bridge and pi-bridge
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 61f9b6edb4 feat(agent): add pi-agent container assets with dynamic MiniMax config and HTTP runner
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor b8439a89e9 feat(coordinator): 实现L2统一上下文组装器与意图校验调度引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 57b8db2fcc chore(rules): 配置 Cursor 持久化规则以约束三分支模型与环境隔离规范
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 6ee1c5b6c7 feat(agent): implement cursor-cli, pi-agent, and stub backend adapters
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor b78c9f5071 feat(agent): add Tavily search extension with API key pool and auto-rotation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 2414bd4742 feat(intent): 定义核心意图契约并实现基于上下文约束的规则意图识别器
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor aeab5c3c40 feat(scripts): 增加多环境一键启停管理与分支工作流辅助脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 9bcf458529 feat(quote): implement CDO quote Excel calculation and fill engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 1208c74030 fix(agent): pass absolute workDir and parse bridge JSON response
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 733fb8dae5 docs(system): 纳管系统架构设计与演进规划文档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 5d2389b2c3 feat(env): 增加开发/测试/主分支三套独立服务与共享知识库编排及配置
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor a3b58f09ac feat(template): add self-describing templates and agent personas
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 260e1a6b8a fix(all): resolve whole-branch review findings on Excel labels, persona forwarding, and error handling
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 288dbeffdf feat(cli): CLI支持成熟度阶段执行与业务参谋锦囊可视化
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 203297056d feat(db): 增加共享知识库与隔离系统数据库初始化脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 9f5bd762a8 feat(kb): add regulation knowledge base client with snapshot materialization
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 6ea0043b49 feat(bizdev): 实现成熟度三阶段编排与AdvisorBriefing双轨交付
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHEN ee18e5436e docs(ops): 建立仓库基础架构、三分支规范与环境运行文档 2026-09-13 02:50:18 +00:00
WeiCHENandCursor 32beee0b75 feat(squad): 修复stub字段覆盖并增强质量门禁闭环与锚点提取
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor f1227d9a8a test(squad): add comprehensive tests for workspace, context, workflow, quality gate, and cli
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 0f43102f84 feat(cli): upgrade bizdev-cli with dynamic inspection, step manipulation, and manifest display
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 3c2d0ca94e feat(service): integrate squad service and ports into bizdev domain service
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 434ce844f8 feat(quality): implement 3-tier quality gate, manifest auditing, and quote backfill
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 4474d575da feat(workflow): implement dynamic workflow driver with sub-workspace isolation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor f84a12acae feat(context): implement self-describing context system with authority guide
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
WeiCHENandCursor 6bbbb16a1c feat(squad): define workspace directory metadata models and engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:18 +00:00
29 changed files with 794 additions and 116 deletions
@@ -0,0 +1,54 @@
---
title: "刷新后对话正文消失问题定位与整改方案"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: codex
branch: dev
worktree: "-"
mutex: chat
---
# 刷新后对话正文消失问题定位与整改方案
## 目标
定位页面刷新后对话正文不显示、但锚点与过滤计数仍存在的根因,并形成可执行、可验证的整改方案。
## 范围
- 前端对话状态、会话恢复、消息窗口、锚点与类别过滤的数据来源
- 后端会话/消息持久化与历史读取 API
- 当前 dev 运行态的只读接口与数据一致性验证
- 审计记录、整改方案与验收标准
## 非目标
- 本轮不修改业务代码
- 不执行破坏性数据修复
- 不把 stub 或仅内存态结果作为最终验收
## 步骤
1. [x] 复核刷新前后前端状态初始化和会话选择链路
2. [x] 核对历史消息 API、存储字段及运行态返回
3. [x] 解释正文、锚点和过滤计数数据源为何分叉
4. [x] 输出 audit 与 remediation 文档并回链
## 验收标准
- [x] 根因有源码、接口或运行态证据支撑
- [x] 明确影响范围、触发条件与风险等级
- [x] 整改方案覆盖实现、回归测试、数据兼容和验收
## 相关链接
- Checklist: 待整改实施时建立
- Handoff: [chat-history-refresh-diagnosis](../../ops/handoffs/2026-09-13-chat-history-refresh-diagnosis.md)
- Test report: 待整改实施并验收后建立
## 证据 / 备注
- 用户实测:新对话能正常生成文档;刷新后历史对话正文消失,但右侧锚点与顶部过滤仍显示对应消息数量。
- Audit: [../../audit/2026-09-13-chat-history-refresh-disappears.md](../../audit/2026-09-13-chat-history-refresh-disappears.md)
- Remediation: [../../remediation/2026-09-13-chat-history-refresh-remediation.md](../../remediation/2026-09-13-chat-history-refresh-remediation.md)
@@ -0,0 +1,22 @@
# Git 历史史诗重组执行记录
**日期**: 2026-09-13
**status**: done
## 结果
- 358 线性 commit → 14 史诗 × (`feature/*`|`fix/*` + `merge --no-ff`) + 1 root anchor = **373 commit**
- `git diff backup/pre-rewrite-2026-09-13 dev` 为空
- `go test -short ./...` PASS
- 旧历史:`dev-old-linear`、`backup/pre-rewrite-2026-09-13`
## 产物
- [`scripts/history-epic-manifest.tsv`](../../../scripts/history-epic-manifest.tsv)
- [`scripts/rewrite-history-epics.sh`](../../../scripts/rewrite-history-epics.sh)
- [`scripts/generate-commit-rewrite-map.py`](../../../scripts/generate-commit-rewrite-map.py)
- [`reference/commit-rewrite-map-2026-09-13.md`](../reference/commit-rewrite-map-2026-09-13.md)
## 远端
- `origin/dev|test|main` force-with-lease 同步至重组后 HEAD
@@ -10,20 +10,20 @@ related_task: short-term/2026-09-13-codex-audit-p0-remediation.md
## Wave 0 — Agent 文档
- [x] AGENTS.md / PROJECT.md / CLAUDE.md — commit 31fe607
- [x] AGENTS.md / PROJECT.md / CLAUDE.md — commit 0d10c9a(原 31fe607,见 [rewrite map](../../reference/commit-rewrite-map-2026-09-13.md))
- [x] .cursor/rules — agent-collaboration + git-secrets
- [x] .doc/ops templates + CURRENT
## Wave A — P0
- [x] AUTH tasks/run + stream — commit d82021e;`task_run_authz_pg_test.go`
- [x] DB 00025 — commit b13ced6;dev/test setval
- [x] AUTH tasks/run + stream — commit 3b7b49c(原 d82021e);`task_run_authz_pg_test.go`
- [x] DB 00025 — commit 8c5dd97(原 b13ced6);dev/test setval
- [x] DATA lifecycle — dev UPDATE 47 → 0
- [x] DATA test wf — UPDATE 5 retired
## Wave B — Go 门禁
- [x] go vet ./... PASS — commit 91985a2
- [x] go vet ./... PASS — commit 3d09bd6(原 91985a2)
- [x] go test -short ./... PASS
- [x] AdvisorBrief / V0.5 / chat / kb / health / asset
@@ -32,7 +32,7 @@ related_task: short-term/2026-09-13-codex-audit-p0-remediation.md
- [x] test rebuild schema 25 — health 8081
- [x] dev docker app schema 25 — health 8080
- [x] main 冒烟 — health/ready 8000 schema 25;restart 恢复
- [x] HTTP 超时 + env status 只读 — commit 505c419
- [x] HTTP 超时 + env status 只读 — commit 0547bd5(原 505c419)
- [x] .env.dev/.env.test chmod 600
## Wave D — 文档
@@ -0,0 +1,43 @@
# Commit SHA 重写对照表(2026-09-13)
> **背景**:2026-09-13 将 358 个线性 `dev` commit 按 14 个功能史诗重放为 `feature/*` / `fix/*` + `merge --no-ff` 拓扑(策略 A)。
> **代码树**:`git diff backup/pre-rewrite-2026-09-13 dev` 为空——HEAD 实现与重写前一致。
> **旧线性历史**:本地保留于分支 `dev-old-linear` 与 tag `backup/pre-rewrite-2026-09-13`。
## 对照规则
- 匹配键:`subject | author | email | committer date`(重写前后一致)
- 下列「旧 SHA」来自 `dev-old-linear`;「新 SHA」来自重组后 `dev`
- 6 条缺 scope 的 message 已在重写中修正(如 `fix:` → `fix(quality):`)
## 关键引用(checklist / test-report)
| 旧 SHA | 新 SHA | 说明 |
|--------|--------|------|
| `d27b0ad` | `ee18e54` | 首 commit → `docs(ops):` 建立仓库基础架构 |
| `31fe607` | `0d10c9a` | AGENTS / PROJECT / CLAUDE 入口 |
| `d82021e` | `3b7b49c` | AUTH tasks/run + stream |
| `b13ced6` | `8c5dd97` | DB 00025 种子序列 |
| `91985a2` | `3d09bd6` | Go 质量门禁(message 修正为 `fix(quality):`) |
| `505c419` | `0547bd5` | HTTP 超时 + env status 只读 |
| `8f3aa0f` | `c605993` | pi-agent MiniMax 模型对齐 |
| `abd0893e` | `f75e509` | StepEvaluator 实现 |
| `bb3f3a1` | `73bf082` | pi-agent E2E v5 PASS |
| `99e0d4a` | `096dc8a` | long-task recovery UX |
| `56fb318` | `d03d939` | chat SSE wiring scope |
| `33b1b8b` | `511864b` | doc taxonomy scaffold |
| `5e5bc1f` | `f30886e` | 策略 A 分支规范 |
## 新历史拓扑
- 1 个 root anchor + 358 原子 commit + 14 个 `merge --no-ff` = **373 commit**
- 史诗清单:[`scripts/history-epic-manifest.tsv`](../../../scripts/history-epic-manifest.tsv)
- 重放脚本:[`scripts/rewrite-history-epics.sh`](../../../scripts/rewrite-history-epics.sh)
## 全量映射生成
```bash
python3 scripts/generate-commit-rewrite-map.py > /tmp/full-map.tsv
```
(脚本随 `feature/chore-history-rewrite` 一并入库)
@@ -0,0 +1,99 @@
---
title: "刷新后对话正文消失但统计仍存在"
status: done
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# 刷新后对话正文消失但统计仍存在
## 现象
用户在项目会话中可以正常与助手对话并生成文档;页面刷新后,消息正文区域显示为空,但顶部分类过滤和右侧分类锚点仍显示消息数量及首尾消息 ID。
结论:**消息没有从数据库删除,而是在刷新后的服务端历史恢复链路中被阶段权限过滤器全部剔除。统计接口没有应用同一权限范围,因此仍返回未过滤的数量和锚点。**
## 根因分析
### 1. 刷新前与刷新后使用不同消息来源
- 刷新前,`web/src/App.tsx:1634-1656` 中的组件内 `messages` 保存本轮实时消息,`useChatWindow` 将它们合并到画面。
- 刷新后,组件内 `messages` 从空数组重新开始,正文依赖 `GET /api/v1/chat/messages/window` 恢复。
- `web/src/hooks/useChatWindow.ts:112-120` 只要服务端返回非空 `days`,就用返回桶覆盖窗口和本地缓存;即使桶中的 `messages` 已被过滤为空也照常覆盖。
因此,实时画面正常不代表历史恢复链路正常。
### 2. 文档任务消息没有绑定工作流阶段
- 普通聊天路径会在 `internal/chat/session.go:267-274,425-438` 把 `ActiveStageKey` 写入用户与助手消息的 `metadata.stage_key`。
- 文档生成使用的异步任务路径在 `internal/server/task_run_handlers.go:81-96` 只写入 `project_id`、`client_turn_id`、`task_key`、`task_status`,没有写 `stage_key`、`workflow_instance_id` 或 `stage_instance_id`。
- 任务完成投影 `internal/server/task_finalize.go:58-85` 仍未补这些作用域字段。
这使得文档任务在当前页面可见,但重载后无法通过阶段可见性判定。
### 3. 工作流激活前的历史也会被追溯性隐藏
- `internal/server/stage_access_helpers.go:135-163` 在项目进入受限工作流后,明确丢弃所有 `metadata.stage_key` 为空的历史消息。
- `internal/projectinstance/stage_access.go:15-77` 根据当前 live 实例计算可见阶段;策略一旦进入 `Restricted=true`,激活前产生、天然没有阶段键的消息也无法恢复。
- `StageKeyAllowed("")` 本身在 `internal/projectinstance/stage_access.go:103-108` 返回允许,但外层过滤器在调用它之前已经对空阶段执行 `continue`;现有单测只验证前者,没有覆盖组合行为。
这不是合理的“拒绝越权”,而是缺少对 `pre_activation/legacy` 对话作用域的正式建模。
### 4. 统计与正文的授权口径分裂
- 窗口和按日正文在 `internal/server/chat_window_api.go:48-50,104-106` 应用阶段过滤。
- 分类与日期统计在同文件 `111-155` 直接查询并返回原始统计,没有会话所有权校验,也没有阶段过滤。
- `internal/ctxmgr/chat_window.go:622-749` 的 SQL 对会话内全部未删除消息聚合,返回数量及 `MIN/MAX(id)`。
- 前端 `CategoryFilterBar` 使用这些服务端统计显示数量;`CategoryDock` 还以统计中的首尾 ID 作为锚点兜底。因此正文为空时,数量与锚点仍存在。
此外,所有这些端点虽由全局中间件要求登录,但窗口、日期、分类等端点没有统一调用 `assertSessionOwnedByUser`。这会造成私聊会话对象级授权不一致,并可能泄露其他会话的消息存在性、分类数量和消息 ID。
## 运行态证据(dev,2026-09-13)
只读查询 `shuimu-context-pg-dev/agent_system_dev`:
| 项目/会话 | 结果 |
|---|---|
| project `143` | 创建者 user `9`,live instance `89`,active stage `V0.1_triage` |
| session `sess-p143-u9` | 共 4 条未删除消息,4 条正文长度均大于 0 |
| 激活前消息 `431-432` | 创建于 instance `89` 之前,无 `stage_key` |
| 文档任务消息 `433-434` | 创建于激活之后,`task_key=intake`,仍无 `stage_key` |
| 过滤结果 | 4 条均命中“空 stage_key → 丢弃”,窗口日桶保留但消息数组为空 |
| 分类统计 | 仍按全量 4 条聚合,可返回数量及首尾 ID |
全库当前有 live 工作流实例的会话消息统计也显示:所有命中的消息均缺少 `stage_key`。这说明不是单条偶发数据,而是写入链路缺字段与历史兼容策略共同造成的系统性问题。
## 严重度
`high`,并应作为发布 blocker:
- 核心对话记录在刷新/重新登录后不可用,用户会误认为数据丢失;
- 文档任务的对话留痕无法恢复,破坏可审计性;
- 正文、搜索、日期、统计、锚点的授权集合不一致;
- 分类数量和消息 ID 可在对象级授权不完整时形成侧信道泄露。
## 关联整改
- Remediation: [../remediation/2026-09-13-chat-history-refresh-remediation.md](../remediation/2026-09-13-chat-history-refresh-remediation.md)
- Short-term: [../ops/short-term/2026-09-13-chat-history-refresh-remediation.md](../ops/short-term/2026-09-13-chat-history-refresh-remediation.md)
- Gap matrix: [../remediation/gap-matrix.md](../remediation/gap-matrix.md)
## 证据
- `web/src/App.tsx:1634-1656,3393-3506`
- `web/src/hooks/useChatWindow.ts:81-170,446-578`
- `web/src/api/chatWindow.ts:73-164`
- `internal/chat/session.go:267-280,425-468`
- `internal/server/task_run_handlers.go:76-108`
- `internal/server/task_finalize.go:58-96`
- `internal/server/stage_access_helpers.go:135-212`
- `internal/server/chat_window_api.go:12-155`
- `internal/ctxmgr/chat_window.go:39-174,622-749`
- dev PostgreSQL 只读查询(未读取或落盘消息正文)
- 相关测试通过但缺场景:`go test -short ./internal/server -run 'TestServer_ChatWindow' -count=1 -v`、`go test -short ./internal/ctxmgr -run 'TestChatWindow' -count=1 -v`、`cd web && npm test`
## 开放问题
- 激活前项目私聊应默认仅对会话所有者可见,还是按项目成员和退出留痕策略共享,需要在实现前固化为策略测试;本方案建议保持现有“每人独立私聊”语义,优先按会话所有者授权。
- 历史上若同一 `task_key` 在多个工作流实例/阶段重复出现,不能仅按当前模板名称盲目回填,必须结合运行实例、创建时间和不可变实例 ID;无法唯一归属的数据应标记为 `legacy_unscoped` 并走显式兼容策略。
+8
View File
@@ -13,6 +13,14 @@
## 核心文档(按阅读顺序推荐)
### 最新专项审计(2026-09-13)
**文件**: [2026-09-13-chat-history-refresh-disappears.md](./2026-09-13-chat-history-refresh-disappears.md)
**结论**: 消息仍在数据库;文档任务与激活前消息缺阶段作用域,被刷新后的窗口过滤器剔除,而统计仍返回未过滤数量。
**整改**: [对话刷新恢复与阶段授权一致性整改方案](../remediation/2026-09-13-chat-history-refresh-remediation.md)
### 0️⃣ 当前状态(Live SSOT)
**文件**: [gap-matrix.md](../remediation/gap-matrix.md)
@@ -0,0 +1,70 @@
---
title: "对话刷新后正文消失整改实施交接"
created: 2026-09-13
from: codex
to: next-agent
status: open
---
# 交接:对话刷新后正文消失整改实施
## 目标(下一位 Agent 应完成什么)
按整改方案修复消息作用域、历史读取授权和统计同集问题,并完成历史回填与真实刷新 E2E。
## 已完成
- 源码链路与 dev PostgreSQL 只读定位完成,确认消息未删除。
- 确认 project 143/session `sess-p143-u9` 的 4 条消息均缺 `stage_key`,工作流激活后被窗口过滤器全部移除。
- 确认异步文档任务写入路径缺阶段/实例作用域;分类与日期统计未应用同一过滤。
- 审计、整改方案、发布 blocker 与 planned short-term 已建立。
- 现有相关 Go 测试和前端 192 项测试通过,但均未覆盖真实缺陷场景。
## 未完成
- 未修改业务代码、迁移或运行态数据。
- 未建立实施 checklist/test-report。
- 未运行真实 PI 刷新回归和双用户对象级授权负例。
## 认领 / 槽位状态
| 项 | 值 |
|----|-----|
| mutex 已释放 | yes |
| 集成槽位 holder | idle |
| branch | dev(诊断);建议实施用 `fix/chat-history-refresh` |
| worktree | 建议 `.worktrees/fix-chat-history-refresh` |
## 关键文件
| 路径 | 说明 |
|------|------|
| `.doc/audit/2026-09-13-chat-history-refresh-disappears.md` | 根因与运行态证据 |
| `.doc/remediation/2026-09-13-chat-history-refresh-remediation.md` | 分波次整改与验收 |
| `internal/server/task_run_handlers.go` | 文档任务消息缺阶段作用域 |
| `internal/server/stage_access_helpers.go` | 空阶段消息被丢弃 |
| `internal/server/chat_window_api.go` | 正文与统计授权口径分裂 |
| `web/src/hooks/useChatWindow.ts` | 刷新后服务端空桶覆盖本地窗口 |
## 如何验证
```bash
go test -short ./internal/server -run 'TestServer_ChatWindow' -count=1 -v
go test -short ./internal/ctxmgr -run 'TestChatWindow' -count=1 -v
cd web && npm test
```
实施时必须另加真实 PG 场景:激活前对话 → 激活 → `intake` 文档任务 → 刷新窗口,以及非 owner/无阶段职责负例。
## 风险 / Blocker
- 当前为发布 blocker;刷新会造成对话“数据丢失”假象。
- 不能用“空 `stage_key` 全部放行”或保留旧 localStorage 缓存作修复,否则会扩大阶段/跨用户泄露。
- 历史回填存在重复 `task_key` 歧义,必须先 dry-run 并按实例与时间唯一匹配。
## 相关链接
- CURRENT: [CURRENT.md](../CURRENT.md)
- Task: [chat-history-refresh-remediation](../short-term/2026-09-13-chat-history-refresh-remediation.md)
- Audit: [chat-history-refresh-disappears](../../audit/2026-09-13-chat-history-refresh-disappears.md)
- Remediation: [chat-history-refresh-remediation](../../remediation/2026-09-13-chat-history-refresh-remediation.md)
@@ -0,0 +1,57 @@
---
title: "修复对话刷新恢复与授权统计不一致"
status: planned
created: 2026-09-13
updated: 2026-09-13
owner: unassigned
branch: fix/chat-history-refresh
worktree: ".worktrees/fix-chat-history-refresh"
mutex: chat
---
# 修复对话刷新恢复与授权统计不一致
## 目标
按整改方案修复消息作用域写入、历史兼容、读取授权和前端恢复态,并完成真实 PostgreSQL 与 PI 文档生成后的刷新验收。
## 范围
- 消息和 task run 的不可变工作流实例/阶段作用域
- 会话 owner 与阶段可见性的统一服务端策略
- 窗口、日期、分类、搜索、摘要、未读、导出、锚点的同集查询
- 现有消息 dry-run/backfill
- 前端窗口错误态和用户隔离缓存
- 自动化与真实 PI E2E 证据
## 非目标
- 不放宽现有阶段可见性规则
- 不用前端缓存替代服务端持久化
- 不对无法唯一归属的历史消息盲目回填当前阶段
## 步骤
1. [ ] 先补可稳定复现本缺陷的 PG 集成与前端恢复测试
2. [ ] 实现统一消息作用域解析与写入
3. [ ] 实现统一会话/消息授权查询及统计同集
4. [ ] 实现历史 dry-run/backfill 与对账
5. [ ] 完善前端恢复状态及用户隔离缓存
6. [ ] 执行全量门禁、真实 PI 刷新 E2E 和双用户负例
## 验收标准
- [ ] [整改方案](../../remediation/2026-09-13-chat-history-refresh-remediation.md) 的验收项全部有证据
- [ ] `CHAT-HISTORY-REFRESH` 在 gap-matrix 中由 FAIL 更新为 PASS
- [ ] 测试报告归档并回链
## 相关链接
- Checklist: 实施开始时复制模板建立
- Handoff: [../handoffs/2026-09-13-chat-history-refresh-diagnosis.md](../handoffs/2026-09-13-chat-history-refresh-diagnosis.md)
- Test report: 待实施
## 证据 / 备注
- Audit: [../../audit/2026-09-13-chat-history-refresh-disappears.md](../../audit/2026-09-13-chat-history-refresh-disappears.md)
- Remediation: [../../remediation/2026-09-13-chat-history-refresh-remediation.md](../../remediation/2026-09-13-chat-history-refresh-remediation.md)
@@ -0,0 +1,65 @@
---
title: "对话刷新恢复与阶段授权一致性整改方案"
status: planned
created: 2026-09-13
updated: 2026-09-13
---
# 对话刷新恢复与阶段授权一致性整改方案
## 背景
审计确认消息正文仍在 PostgreSQL,但文档任务消息和激活前历史缺少工作流阶段作用域;刷新后的窗口接口将其全部过滤,而分类/日期统计仍返回全量结果。详见 [审计记录](../audit/2026-09-13-chat-history-refresh-disappears.md)。
## 目标
1. 同一登录用户在权限未变化时,刷新、重新登录和服务重启后看到一致的对话正文、数量、日期、搜索和锚点。
2. 每条新消息在服务端落库时拥有可审计的会话、项目及工作流作用域;客户端不得决定该作用域。
3. 所有历史读取入口使用同一对象级与阶段级授权规则,统计集合必须与正文集合一致。
4. 安全回填现有可唯一归属的消息,不丢失正文,不扩大不可确定历史的可见范围。
## 分波次计划
| 波次 | 内容 | 验收 |
|------|------|------|
| Wave 0:锁定回归 | 增加失败测试:激活前聊天 → 激活工作流 → 运行 `intake` 文档任务 → 刷新拉窗口;同时覆盖非 owner、阶段无职责用户、空阶段消息和统计一致性 | 修复前测试稳定复现“窗口 0 条、分类 4 条”;记录真实 PG 证据 |
| Wave 1:统一服务端作用域 | 在任务创建事务中由服务端从冻结实例解析 `task_key → workflow_instance_id → stage_instance_id/stage_key`;把不可变作用域写入 `task_runs` 和该回合两条 `chat_messages`;普通 chat 同样写实例 ID;finalize 只合并结果,不覆盖作用域 | 新建普通聊天和任务消息均具备正确实例/阶段;伪造客户端 stage 无效;找不到唯一阶段时拒绝启动并给出结构化错误 |
| Wave 2:修正授权查询 | 建立统一的 `AuthorizeSessionRead + visible-message predicate`,窗口、day、dates、categories、search、digest、unread、export、锚点加载全部复用;私聊先校验 owner,再计算阶段范围;统计在 SQL 层对相同可见集合聚合 | 正文、数量、首尾 ID、搜索/导出完全同集;他人 session 返回 403/404;不可见 ID 不能作锚点探测 |
| Wave 3:历史迁移 | 新增 Goose 迁移或一次性受控 backfill:任务消息通过 `task_key + task_run/workflow_run + 时间区间` 回填实例/阶段;激活前 owner 私聊标记 `scope_kind=pre_activation`;歧义数据标记 `legacy_unscoped` 并记录数量,不猜测归属 | dry-run 报告、事务执行、前后计数与 hash 对账;project 143 的 4 条消息可按策略恢复;零正文删除 |
| Wave 4:前端恢复态 | `useChatWindow` 区分 loading / authorized-empty / forbidden / error;不把“带空消息的日桶”静默呈现为空白;缓存键绑定 user/session/authorization revision,权限变化时清除,不用旧缓存绕过服务端 | 刷新不闪现上一用户/无权缓存;错误有可操作提示;服务端正常时首屏稳定落底 |
| Wave 5:全链验收 | 在空库和升级库执行 PG 集成;完成真实 PI 文档生成、浏览器刷新、重登和服务重启恢复;执行双用户/跨阶段负例 | 所有自动化门禁通过并归档 test-report;人工抽检截图/网络响应入证据 |
## 推荐数据模型与边界
- `chat_messages` 增加正式列或受约束字段:`workflow_instance_id`、`stage_instance_id`、`scope_kind`;`stage_key` 可作为展示/索引冗余,不应成为唯一授权依据。
- `task_runs` 同样保存 `workflow_instance_id`、`stage_instance_id`,确保任务运行期间阶段推进也不会改变该回合归属。
- `scope_kind` 至少区分 `workflow_stage`、`pre_activation`、`legacy_unscoped`、`non_project_private`。
- 消息作用域只能由服务端从会话、项目与冻结工作流实例解析;忽略客户端提交的 user/stage/instance 身份字段。
- 不建议用“空 `stage_key` 一律允许”快速修复,这会绕过阶段隔离;也不建议仅在前端保留本地缓存,这会掩盖服务端错误并产生共享浏览器泄露风险。
## 建议修改范围
- 后端写入:`internal/server/task_run_handlers.go`、`internal/server/task_finalize.go`、`internal/chat/session.go`、`internal/taskrun/*`
- 后端读取与授权:`internal/server/chat_window_api.go`、`internal/server/chat_search_api.go`、chat digest/unread/export handlers、`internal/server/stage_access_helpers.go`、`internal/ctxmgr/chat_window.go`
- 工作流解析:`internal/projectinstance/*`,增加按冻结实例解析消息作用域的单一入口
- 前端:`web/src/hooks/useChatWindow.ts`、`web/src/api/chatWindow.ts`、`web/src/components/chat/MessageStream.tsx`
- 数据库:`deploy/postgres/goose/00026_*`(实际序号以实施时仓库为准)及对应 dry-run/rollback 说明
## 验收标准
- [ ] 创建项目会话并发送普通消息,刷新后用户/助手两条正文、顺序、类别和锚点不变。
- [ ] 先聊天再激活工作流,刷新后激活前 owner 私聊仍按既定策略可见。
- [ ] 激活后通过后台任务生成文档,任务用户消息和最终助手消息刷新后完整恢复,artifact 仍可打开。
- [ ] 工作流推进后,已参与阶段历史按策略可见,未参与阶段消息不可见。
- [ ] `window/day/dates/categories/search/digest/unread/export` 对同一用户返回同一可见集合;统计总数等于可枚举正文数。
- [ ] 非会话 owner 即使猜到 `session_id/message_id`,所有读取与锚点入口均返回 403/404,且不泄露计数。
- [ ] 浏览器刷新、重新登录、切换用户、服务重启均不依赖未授权 localStorage 缓存恢复正文。
- [ ] 历史迁移 dry-run 与执行报告包含总数、可唯一归属数、歧义数、前后校验;正文删除数为 0。
- [ ] `go vet ./...`、`go test -short ./...`、PG 集成、`cd web && npm test && npm run build` 全绿。
- [ ] 真实 PI Agent 文档生成后刷新恢复 E2E 有控制台/网络/数据库证据并归档 `.doc/test-reports/`。
## 相关链接
- Audit: [../audit/2026-09-13-chat-history-refresh-disappears.md](../audit/2026-09-13-chat-history-refresh-disappears.md)
- Short-term: [../ops/short-term/2026-09-13-chat-history-refresh-remediation.md](../ops/short-term/2026-09-13-chat-history-refresh-remediation.md)
- gap-matrix 行: `CHAT-HISTORY-REFRESH`
+1
View File
@@ -3,6 +3,7 @@
| 文档 | 说明 |
|------|------|
| [gap-matrix.md](./gap-matrix.md) | 发布缺口 SSOT |
| [2026-09-13-chat-history-refresh-remediation.md](./2026-09-13-chat-history-refresh-remediation.md) | 对话刷新恢复、消息作用域与授权统计一致性 |
| [2026-09-12-comprehensive-audit-and-remediation-plan.md](./2026-09-12-comprehensive-audit-and-remediation-plan.md) | 综合缺陷与整改 |
| [2026-09-12-remediation-tasks-and-acceptance-checklist.md](./2026-09-12-remediation-tasks-and-acceptance-checklist.md) | 任务拆分与验收 |
| [2026-09-12-quick-reference-guide.md](./2026-09-12-quick-reference-guide.md) | 症状→原因→方案速查 |
+9 -2
View File
@@ -2,7 +2,7 @@
**更新**: 2026-09-13
**分支**: dev
**production_ready**: no(CI 真实 PI E2E / 前端人工抽检未完成;main 本地冒烟已通过)
**production_ready**: no(对话刷新恢复缺陷、CI 真实 PI E2E / 前端人工抽检未完成;main 本地冒烟已通过)
**协作焦点**: [../ops/CURRENT.md](../ops/CURRENT.md)
**Agent 手册**: [AGENTS.md](../AGENTS.md) · [PROJECT.md](../PROJECT.md)
@@ -53,6 +53,12 @@
| DOC-SSOT | 文档叙事漂移 | PASS | 本矩阵 + superseded 标记 + ops |
| OPS-AGENTS | 多 Agent 协作规范 | PASS | `AGENTS.md` / `PROJECT.md` / `.doc/ops` |
## 2026-09-13 现场问题
| ID | 描述 | 状态 | 证据 | 计划动作 |
|---|---|---|---|---|
| CHAT-HISTORY-REFRESH | 工作流激活后刷新,对话正文被阶段过滤器清空,但分类数量与锚点仍按全量返回 | **FAIL** | [audit](../audit/2026-09-13-chat-history-refresh-disappears.md):project 143/session `sess-p143-u9` 的 4 条正文仍在 DB、全部缺 `stage_key` | [remediation](./2026-09-13-chat-history-refresh-remediation.md):统一作用域写入、对象/阶段授权、同集统计、历史回填和真实 PI 刷新 E2E |
---
## 发布门禁(test → main)
@@ -62,10 +68,11 @@
☑ go test -short ./... 全绿
□ TEST_DATABASE_URL 下治理 PG 集成全绿(CI)
□ 真实 PI Agent 三工作流治理 E2E 实录(本轮 stub/short 已绿,PI 待 CI token)
□ 对话刷新恢复:激活前聊天 + 激活后文档任务 + 刷新/重登/重启可恢复,双用户负例通过
☑ lifecycle fix SQL 已在 dev 执行
☑ test/dev health schema_version=25
☑ main 环境部署冒烟(本地 8000 health/ready schema 25)
□ 前端:版本冲突刷新、终止 preview 人工抽检
```
**结论**: P0 授权、冷启动序列、Go 门禁、三环境本地冒烟已闭环。**发布 blocker 剩余 CI 真实 PI E2E 与前端人工抽检**。
**结论**: P0 授权、冷启动序列、Go 门禁、三环境本地冒烟已闭环;新增现场缺陷 `CHAT-HISTORY-REFRESH`。**发布 blocker 包括对话刷新恢复、CI 真实 PI E2E 与前端人工抽检**。
+2 -2
View File
@@ -16,10 +16,10 @@
| 模块 | 能力 | 状态 | 证据 | 缺口/后续 | mutex |
|------|------|------|------|-----------|-------|
| 意图识别 L1 | 18 类 Intent + 三分支消解 | done | [system-design/intent-recognition](../system-design/intent-recognition/);[test-report 2026-09-07](../test-reports/2026-09-07-three-branch-intent-framework-test-report.md) | — | `intent` |
| 对话 / ctxmgr | 多轮上下文、记忆、摘要 | partial | [system-design/multi-turn-dialogue](../system-design/multi-turn-dialogue/);P0 断链已修 | 语义摘要(D5 backlog);长任务治理 | `chat` |
| 对话 / ctxmgr | 多轮上下文、记忆、摘要 | partial | [system-design/multi-turn-dialogue](../system-design/multi-turn-dialogue/);[刷新恢复专项审计](../audit/2026-09-13-chat-history-refresh-disappears.md) | `CHAT-HISTORY-REFRESH`:作用域写入、同集授权统计、历史回填;语义摘要(D5 backlog) | `chat` |
| 智能体小队 | 角色-任务-工作区-黑板 | done | [system-design/agent-squad](../system-design/agent-squad/);[test 2026-09-07](../test-reports/2026-09-07-dynamic-squad-planning-test-report.md) | 非关键步骤降级(A5/A6 backlog) | `squad` |
| 工作流治理 | 三正式工作流 + 阶段门禁 | done | [remediation/three-workflows](../remediation/2026-09-12-three-workflows-strict-governance-remediation.md);[test 2026-09-12](../test-reports/2026-09-12-three-workflows-governance-remediation-test-report.md) | Phase2 设计器 partial | `workflow` |
| IAM / 鉴权 | 项目级 API 鉴权 + RBAC | done | [audit/authorization](../audit/authorization-matrix-v2.md);[test phase1](../test-reports/2026-09-12-phase1-iam-authz-test-report.md) | 旧 API 410 标注(BUG-11 partial) | `authz` |
| IAM / 鉴权 | 项目级 API 鉴权 + RBAC | partial | [audit/authorization](../audit/authorization-matrix-v2.md);[刷新恢复专项审计](../audit/2026-09-13-chat-history-refresh-disappears.md) | 历史读取端点补统一会话 owner + 阶段授权;旧 API 410 标注(BUG-11 partial) | `authz` |
| 文档治理 | 法定文档生命周期 + 租约 | done | [test docgov](../test-reports/2026-09-08-docgov-lifecycle-and-claiming-framework-test-report.md) | — | `docgov` |
| 前端工作台 | 三栏 + 块文档 + SSE | partial | [test workbench](../test-reports/2026-09-08-three-column-workbench-and-block-document-test-report.md) | 人工抽检待完成 | `web` |
| PI Runner / 配置链 | pi-agent + MiniMax 真实链路 | done | [test piagent](../test-reports/2026-09-13-codex-audit-p0-remediation-test-report.md);[container-env](../test-reports/2026-09-13-container-env-configuration-test-report.md) | — | `pi-agent` |
+2
View File
@@ -3,6 +3,8 @@
.doc
docs
data
.regulations
.tmp
web/node_modules
web/dist
web/.vite
+17 -14
View File
@@ -3,14 +3,12 @@
#
# 使用说明:
# 1. 复制为 .env 并填写密钥:cp .env.example .env && chmod 600 .env
# 2. 本文件供 Go 后端 (bin/server)、launch.sh 默认 compose 变量替换使用
# 3. 若通过 ./scripts/env-service.sh dev start 启容器,还需同步密钥到 configs/.env.dev
# (见 configs/.env.dev.example 第 6 节)
# 2. 本文件供 Go 后端、launch.sh 与 env-service.sh 作为公共配置源
# 3. configs/.env.<环境> 只保存端口、数据库等环境差异,且优先级高于本文件
# =============================================================================
# --- 1. 运行环境与基础目录 ---
ENV=dev
COMPOSE_PROJECT_NAME=agent-dev
DATA_DIR=./data/dev
APP_PUBLISH_HOST=127.0.0.1
HTTP_PORT=8080
@@ -42,7 +40,7 @@ PI_AGENT_RUNNER_PORT=18865
# 宿主 bin/server 直连本机 pi-agent 容器时启用;容器内 app 服务由 compose 注入 http://pi-agent:18865
# PI_AGENT_RUNNER_URL=http://127.0.0.1:18865
# Runner 服务间认证(main 必填;dev 可留空)
# RUNNER_AUTH_TOKEN=
RUNNER_AUTH_TOKEN=
# --- 7. 本机 Pi CLI 回退(不使用容器 runner 时)---
PI_AGENT_BIN=/opt/homebrew/bin/pi
@@ -54,17 +52,15 @@ PI_AGENT_MODEL=MiniMax-M2.7-highspeed
KB_DB_HOST=127.0.0.1
KB_DB_PORT=5432
KB_DB_USER=regkb
KB_DB_PASSWORD=shared_kb_secret_pass
KB_DB_PASSWORD=
KB_DB_NAME=regulations
# --- 9. 向量 Embedding / Reranker(Go 宿主 KB 检索;容器 app 当前未透传,宿主模式必填)---
# --- 9. 向量 Embedding / Reranker(Go 宿主与容器 app 的 KB 检索)---
EMBEDDING_ENDPOINT_URL=https://www.dmxapi.cn/v1/embeddings
EMBEDDING_PROVIDER=openai_compatible
EMBEDDING_MODEL=bge-m3
EMBEDDING_API_KEY=
RERANKER_ENDPOINT_URL=https://www.dmxapi.cn/v1/rerank
RERANKER_PROVIDER=openai_compatible
RERANKER_MODEL=bge-reranker-v2-m3-free
RERANKER_API_KEY=
@@ -87,8 +83,15 @@ ADMIN_PASSWORD=admin-secret-password-123
AUTH_REGISTRATION_ENABLED=true
AUTH_REQUIRE_APPROVAL=false
# --- 12. 可选:CORS / 内存降级 ---
# dev/test 未配置时 CORS 由代码填充 localhost 默认值
# CORS_ALLOWED_ORIGINS=http://localhost:5173,http://127.0.0.1:8080
# 生产必须为 false;main 启动时若 true 将拒绝加载
# ALLOW_IN_MEMORY=false
# --- 12. 安全、缓存与意图路由开关 ---
# 留空时 dev/test 由代码补 localhost;生产留空代表不允许跨 Origin
CORS_ALLOWED_ORIGINS=
# 生产强制 false;main compose 不接受覆盖
ALLOW_IN_MEMORY=false
CACHE_ENABLED=true
INTENT_V2_SHADOW=false
INTENT_V2_DECISION=false
INTENT_V2_DECISION_TIER=none
WORKFLOW_INTENTS_ENABLED=true
MULTI_INTENT_ENABLED=true
SEMANTIC_FALLBACK_ENABLED=false
+3 -19
View File
@@ -1,25 +1,18 @@
# =============================================================================
# 开发环境 Compose 专用配置模板 (configs/.env.dev)
# 作用域:./scripts/env-service.sh dev * 与 docker compose --env-file configs/.env.dev
# 作用域:./scripts/env-service.sh dev * 的环境差异覆盖
#
# 重要:本文件与根目录 .env 分工不同
# - 根 .env → Go bin/server、launch.sh 默认 compose
# - 本文件 → env-service.sh 启停 dev 容器组
# 密钥(MINIMAX_API_KEY / TAVILY_API_KEYS 等)须与根 .env 保持一致,否则 pi-agent 容器无 Token!
# 根 .env 提供公共模型、检索、认证配置;本文件只覆盖 dev 差异。
# =============================================================================
ENV=dev
COMPOSE_PROJECT_NAME=agent-dev
# 1. 业务 HTTP 服务
HTTP_PORT=8080
APP_PUBLISH_HOST=127.0.0.1
ADMIN_TOKEN=dev-admin-token-change-me
ALLOW_INSECURE_ADMIN=1
# 2. 对话数据与工作区(禁止跨环境共享)
DATA_DIR=./data/dev
AUX_FILE_DSN=file:/var/lib/feishu/outbox_dev.db?_journal_mode=WAL&_busy_timeout=5000
# 3. 开发环境专属数据库
SYSTEM_DB_USER=app
@@ -29,7 +22,6 @@ SYSTEM_DB_PUBLISH_PORT=5433
# 4. 共享知识库(容器 app 经 shuimu-kb-shared 访问)
KB_DB_USER=regkb
KB_DB_PASSWORD=shared_kb_secret_pass
KB_DB_NAME=regulations
KB_DB_HOST=shuimu-kb-shared
KB_DB_PORT=5432
@@ -40,12 +32,4 @@ PI_AGENT_RUNNER_PORT=18865
AGENT_BACKEND=pi-agent
AGENT_TIMEOUT=60m
# 6. Pi-Agent / MiniMax / Tavily(pi-agent 容器必填;从根 .env 复制)
MINIMAX_ENDPOINT_URL=https://api.minimaxi.com/v1
MINIMAX_API_KEY=
MINIMAX_MODEL_ID=MiniMax-M2.7-highspeed
MINIMAX_API_TYPE=openai-compatible
PI_AGENT_PROVIDER=minimax
PI_AGENT_MODEL=MiniMax-M2.7-highspeed
TAVILY_API_KEYS=
# RUNNER_AUTH_TOKEN=
# 6. Pi-Agent / MiniMax / Tavily / Runner 密钥统一读取根 .env
+8 -10
View File
@@ -1,39 +1,37 @@
# =============================================================================
# 生产/主分支环境 (main) 环境变量配置模板 (configs/.env.main)
# 作用域:main 分支正式线上发布与生产运营
# 根 .env 提供公共模型与检索配置;本文件覆盖生产端口、数据库和生产密钥。
# =============================================================================
ENV=prod
COMPOSE_PROJECT_NAME=agent-main
# 1. 业务 HTTP 服务
HTTP_PORT=8000
APP_PUBLISH_HOST=0.0.0.0
ADMIN_TOKEN=main-prod-admin-token-super-secure
ALLOW_INSECURE_ADMIN=0
AUTH_REGISTRATION_ENABLED=false
AUTH_REQUIRE_APPROVAL=true
# 2. 对话数据与工作区隔离目录 (禁止跨环境共享)
DATA_DIR=./data/main
AUX_FILE_DSN=file:/var/lib/feishu/outbox_main.db?_journal_mode=WAL&_busy_timeout=5000
# 3. 生产环境专属数据库 (禁止与 dev/test 共享)
SYSTEM_DB_USER=app
SYSTEM_DB_PASSWORD=prod_highly_secure_db_pass
SYSTEM_DB_PASSWORD=
SYSTEM_DB_NAME=agent_system_main
SYSTEM_DB_PUBLISH_PORT=5435
# 4. 共享知识库连接 (只读检索共享数据)
KB_DB_USER=regkb
KB_DB_PASSWORD=shared_kb_secret_pass
KB_DB_NAME=regulations
KB_DB_HOST=shuimu-kb-shared
KB_DB_PORT=5432
# 5. Cursor / LLM Agent Runner 服务
CURSOR_RUNNER_PORT=18767
AGENT_BACKEND=stub
PI_AGENT_RUNNER_PORT=18867
AGENT_BACKEND=pi-agent
AGENT_TIMEOUT=60m
# 生产必填(不可使用 shared_kb_secret_pass / admin-secret-password-123 等默认值)
RUNNER_AUTH_TOKEN=change-me-runner-token
KB_DB_PASSWORD=change-me-kb-prod-secret
ADMIN_PASSWORD=change-me-admin-prod-secret
RUNNER_AUTH_TOKEN=
ADMIN_PASSWORD=
+1 -4
View File
@@ -1,13 +1,10 @@
# =============================================================================
# 共享基础设施环境变量配置模板 (configs/.env.shared)
# 作用域:所有分支与环境共享的知识库、向量检索与底层公共网络
# KB_DB_PASSWORD 统一在根 .env 配置,本文件只覆盖共享服务差异。
# =============================================================================
COMPOSE_PROJECT_NAME=agent-infra
# 共享知识库 PostgreSQL (带 pgvector)
KB_DB_USER=regkb
KB_DB_PASSWORD=shared_kb_secret_pass
KB_DB_NAME=regulations
KB_PUBLISH_PORT=5432
KB_DATA_DIR=./data/shared/kb
+2 -6
View File
@@ -1,20 +1,17 @@
# =============================================================================
# 测试环境 (test) 环境变量配置模板 (configs/.env.test)
# 作用域:test 分支阶段集成、长期部署实测与运维验证
# 根 .env 提供公共模型、检索、认证配置;本文件只覆盖 test 差异。
# =============================================================================
ENV=test
COMPOSE_PROJECT_NAME=agent-test
# 1. 业务 HTTP 服务
HTTP_PORT=8081
APP_PUBLISH_HOST=0.0.0.0
ADMIN_TOKEN=test-admin-token-secure-key
ALLOW_INSECURE_ADMIN=0
# 2. 对话数据与工作区隔离目录 (禁止跨环境共享)
DATA_DIR=./data/test
AUX_FILE_DSN=file:/var/lib/feishu/outbox_test.db?_journal_mode=WAL&_busy_timeout=5000
# 3. 测试环境专属数据库 (禁止与 dev/main 共享)
SYSTEM_DB_USER=app
@@ -24,7 +21,6 @@ SYSTEM_DB_PUBLISH_PORT=5434
# 4. 共享知识库连接 (只读检索共享数据)
KB_DB_USER=regkb
KB_DB_PASSWORD=shared_kb_secret_pass
KB_DB_NAME=regulations
KB_DB_HOST=shuimu-kb-shared
KB_DB_PORT=5432
@@ -32,7 +28,7 @@ KB_DB_PORT=5432
# 5. Cursor / LLM Agent Runner 服务
CURSOR_RUNNER_PORT=18766
PI_AGENT_RUNNER_PORT=18866
AGENT_BACKEND=stub
AGENT_BACKEND=pi-agent
AGENT_TIMEOUT=60m
# app 与 pi-agent 容器共享(test 环境建议设置非空值)
# RUNNER_AUTH_TOKEN=test-runner-shared-secret
+22 -4
View File
@@ -60,7 +60,6 @@ services:
MINIMAX_API_TYPE: ${MINIMAX_API_TYPE:-openai-compatible}
MINIMAX_PROVIDER: minimax
TAVILY_API_KEYS: ${TAVILY_API_KEYS:-}
TAVILY_API_KEY: ${TAVILY_API_KEY:-}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:-}
ports:
- "127.0.0.1:${PI_AGENT_RUNNER_PORT:-18865}:18865"
@@ -94,19 +93,38 @@ services:
HTTP_PORT: "${HTTP_PORT:-8080}"
HTTP_HOST: "0.0.0.0"
AGENT_BACKEND: ${AGENT_BACKEND:-pi-agent}
AGENT_TIMEOUT: ${AGENT_TIMEOUT:-30m}
MAX_CONCURRENT_AGENTS: ${MAX_CONCURRENT_AGENTS:-8}
DATA_DIR: /app/data
# 独占业务与对话库
APP_DB_DSN: postgres://${SYSTEM_DB_USER:-app}:${SYSTEM_DB_PASSWORD:-dev_secret_db_pass}@system-db:5432/${SYSTEM_DB_NAME:-agent_system_dev}?sslmode=disable
# 共享知识库
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:-shared_kb_secret_pass}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:?KB_DB_PASSWORD is required}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
CURSOR_RUNNER_URL: http://cursor-agent:18765
PI_AGENT_RUNNER_URL: http://pi-agent:18865
PI_AGENT_RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:-}
PI_AGENT_PROVIDER: ${PI_AGENT_PROVIDER:-minimax}
PI_AGENT_MODEL: ${PI_AGENT_MODEL:-MiniMax-M2.7-highspeed}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:-}
ALLOW_IN_MEMORY: "false"
AUX_FILE_DSN: file:/var/lib/feishu/outbox_dev.db?_journal_mode=WAL&_busy_timeout=5000
EMBEDDING_ENDPOINT_URL: ${EMBEDDING_ENDPOINT_URL:-}
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-bge-m3}
EMBEDDING_API_KEY: ${EMBEDDING_API_KEY:-}
RERANKER_ENDPOINT_URL: ${RERANKER_ENDPOINT_URL:-}
RERANKER_MODEL: ${RERANKER_MODEL:-bge-reranker-v2-m3-free}
RERANKER_API_KEY: ${RERANKER_API_KEY:-}
ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin-secret-password-123}
AUTH_REGISTRATION_ENABLED: ${AUTH_REGISTRATION_ENABLED:-true}
AUTH_REQUIRE_APPROVAL: ${AUTH_REQUIRE_APPROVAL:-false}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-}
ALLOW_IN_MEMORY: ${ALLOW_IN_MEMORY:-false}
CACHE_ENABLED: ${CACHE_ENABLED:-true}
INTENT_V2_SHADOW: ${INTENT_V2_SHADOW:-false}
INTENT_V2_DECISION: ${INTENT_V2_DECISION:-false}
INTENT_V2_DECISION_TIER: ${INTENT_V2_DECISION_TIER:-none}
WORKFLOW_INTENTS_ENABLED: ${WORKFLOW_INTENTS_ENABLED:-true}
MULTI_INTENT_ENABLED: ${MULTI_INTENT_ENABLED:-true}
SEMANTIC_FALLBACK_ENABLED: ${SEMANTIC_FALLBACK_ENABLED:-false}
ports:
- "${APP_PUBLISH_HOST:-127.0.0.1}:${HTTP_PORT:-8080}:${HTTP_PORT:-8080}"
healthcheck:
+24 -5
View File
@@ -14,7 +14,7 @@ services:
command: ["postgres", "-c", "shared_buffers=512MB", "-c", "max_connections=300"]
environment:
POSTGRES_USER: ${SYSTEM_DB_USER:-app}
POSTGRES_PASSWORD: ${SYSTEM_DB_PASSWORD:-prod_highly_secure_db_pass}
POSTGRES_PASSWORD: ${SYSTEM_DB_PASSWORD:?SYSTEM_DB_PASSWORD is required for main/production}
POSTGRES_DB: ${SYSTEM_DB_NAME:-agent_system_main}
ports:
- "127.0.0.1:${SYSTEM_DB_PUBLISH_PORT:-5435}:5432"
@@ -60,7 +60,6 @@ services:
MINIMAX_API_TYPE: ${MINIMAX_API_TYPE:-openai-compatible}
MINIMAX_PROVIDER: minimax
TAVILY_API_KEYS: ${TAVILY_API_KEYS:-}
TAVILY_API_KEY: ${TAVILY_API_KEY:-}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:?RUNNER_AUTH_TOKEN is required for main/production}
ports:
- "127.0.0.1:${PI_AGENT_RUNNER_PORT:-18867}:18867"
@@ -92,19 +91,39 @@ services:
HTTP_PORT: "${HTTP_PORT:-8000}"
HTTP_HOST: "0.0.0.0"
AGENT_BACKEND: ${AGENT_BACKEND:-pi-agent}
AGENT_TIMEOUT: ${AGENT_TIMEOUT:-30m}
MAX_CONCURRENT_AGENTS: ${MAX_CONCURRENT_AGENTS:-8}
DATA_DIR: /app/data
# 独占生产业务与对话库
APP_DB_DSN: postgres://${SYSTEM_DB_USER:-app}:${SYSTEM_DB_PASSWORD:-prod_highly_secure_db_pass}@system-db:5432/${SYSTEM_DB_NAME:-agent_system_main}?sslmode=disable
APP_DB_DSN: postgres://${SYSTEM_DB_USER:-app}:${SYSTEM_DB_PASSWORD:?SYSTEM_DB_PASSWORD is required for main/production}@system-db:5432/${SYSTEM_DB_NAME:-agent_system_main}?sslmode=disable
# 共享知识库
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:-shared_kb_secret_pass}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:?KB_DB_PASSWORD is required for main/production}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
CURSOR_RUNNER_URL: http://cursor-agent:18767
PI_AGENT_RUNNER_URL: http://pi-agent:18867
PI_AGENT_RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:?RUNNER_AUTH_TOKEN is required for main/production}
PI_AGENT_PROVIDER: ${PI_AGENT_PROVIDER:-minimax}
PI_AGENT_MODEL: ${PI_AGENT_MODEL:-${MINIMAX_MODEL_ID:-MiniMax-M3}}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:?RUNNER_AUTH_TOKEN is required for main/production}
KB_DB_PASSWORD: ${KB_DB_PASSWORD:?KB_DB_PASSWORD is required for main/production}
ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
ADMIN_PASSWORD: ${ADMIN_PASSWORD:?ADMIN_PASSWORD is required for main/production}
AUTH_REGISTRATION_ENABLED: ${AUTH_REGISTRATION_ENABLED:-true}
AUTH_REQUIRE_APPROVAL: ${AUTH_REQUIRE_APPROVAL:-false}
EMBEDDING_ENDPOINT_URL: ${EMBEDDING_ENDPOINT_URL:-}
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-bge-m3}
EMBEDDING_API_KEY: ${EMBEDDING_API_KEY:-}
RERANKER_ENDPOINT_URL: ${RERANKER_ENDPOINT_URL:-}
RERANKER_MODEL: ${RERANKER_MODEL:-bge-reranker-v2-m3-free}
RERANKER_API_KEY: ${RERANKER_API_KEY:-}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-}
ALLOW_IN_MEMORY: "false"
AUX_FILE_DSN: file:/var/lib/feishu/outbox_main.db?_journal_mode=WAL&_busy_timeout=5000
CACHE_ENABLED: ${CACHE_ENABLED:-true}
INTENT_V2_SHADOW: ${INTENT_V2_SHADOW:-false}
INTENT_V2_DECISION: ${INTENT_V2_DECISION:-false}
INTENT_V2_DECISION_TIER: ${INTENT_V2_DECISION_TIER:-none}
WORKFLOW_INTENTS_ENABLED: ${WORKFLOW_INTENTS_ENABLED:-true}
MULTI_INTENT_ENABLED: ${MULTI_INTENT_ENABLED:-true}
SEMANTIC_FALLBACK_ENABLED: ${SEMANTIC_FALLBACK_ENABLED:-false}
ports:
- "${APP_PUBLISH_HOST:-0.0.0.0}:${HTTP_PORT:-8000}:${HTTP_PORT:-8000}"
healthcheck:
+2 -2
View File
@@ -10,7 +10,7 @@ services:
container_name: shuimu-kb-shared
environment:
POSTGRES_USER: ${KB_DB_USER:-regkb}
POSTGRES_PASSWORD: ${KB_DB_PASSWORD:-shared_kb_secret_pass}
POSTGRES_PASSWORD: ${KB_DB_PASSWORD:?KB_DB_PASSWORD is required}
POSTGRES_DB: ${KB_DB_NAME:-regulations}
ports:
- "127.0.0.1:${KB_PUBLISH_PORT:-5432}:5432"
@@ -29,7 +29,7 @@ services:
networks:
shared-net:
name: chat-agent-shared-net
driver: bridge
external: true
volumes:
shared-kb-pgdata:
+24 -4
View File
@@ -60,7 +60,6 @@ services:
MINIMAX_API_TYPE: ${MINIMAX_API_TYPE:-openai-compatible}
MINIMAX_PROVIDER: minimax
TAVILY_API_KEYS: ${TAVILY_API_KEYS:-}
TAVILY_API_KEY: ${TAVILY_API_KEY:-}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:-}
ports:
- "127.0.0.1:${PI_AGENT_RUNNER_PORT:-18866}:18866"
@@ -92,17 +91,38 @@ services:
HTTP_PORT: "${HTTP_PORT:-8081}"
HTTP_HOST: "0.0.0.0"
AGENT_BACKEND: ${AGENT_BACKEND:-pi-agent}
AGENT_TIMEOUT: ${AGENT_TIMEOUT:-30m}
MAX_CONCURRENT_AGENTS: ${MAX_CONCURRENT_AGENTS:-8}
DATA_DIR: /app/data
# 独占测试业务与对话库
APP_DB_DSN: postgres://${SYSTEM_DB_USER:-app}:${SYSTEM_DB_PASSWORD:-test_secret_db_pass}@system-db:5432/${SYSTEM_DB_NAME:-agent_system_test}?sslmode=disable
# 共享知识库
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:-shared_kb_secret_pass}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
POSTGRES_SHARED_KB_DSN: postgres://${KB_DB_USER:-regkb}:${KB_DB_PASSWORD:?KB_DB_PASSWORD is required}@shuimu-kb-shared:5432/${KB_DB_NAME:-regulations}?sslmode=disable
CURSOR_RUNNER_URL: http://cursor-agent:18766
PI_AGENT_RUNNER_URL: http://pi-agent:18866
PI_AGENT_RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:-}
PI_AGENT_PROVIDER: ${PI_AGENT_PROVIDER:-minimax}
PI_AGENT_MODEL: ${PI_AGENT_MODEL:-${MINIMAX_MODEL_ID:-MiniMax-M3}}
RUNNER_AUTH_TOKEN: ${RUNNER_AUTH_TOKEN:-}
ALLOW_IN_MEMORY: "false"
AUX_FILE_DSN: file:/var/lib/feishu/outbox_test.db?_journal_mode=WAL&_busy_timeout=5000
EMBEDDING_ENDPOINT_URL: ${EMBEDDING_ENDPOINT_URL:-}
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-bge-m3}
EMBEDDING_API_KEY: ${EMBEDDING_API_KEY:-}
RERANKER_ENDPOINT_URL: ${RERANKER_ENDPOINT_URL:-}
RERANKER_MODEL: ${RERANKER_MODEL:-bge-reranker-v2-m3-free}
RERANKER_API_KEY: ${RERANKER_API_KEY:-}
ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin-secret-password-123}
AUTH_REGISTRATION_ENABLED: ${AUTH_REGISTRATION_ENABLED:-true}
AUTH_REQUIRE_APPROVAL: ${AUTH_REQUIRE_APPROVAL:-false}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-}
ALLOW_IN_MEMORY: ${ALLOW_IN_MEMORY:-false}
CACHE_ENABLED: ${CACHE_ENABLED:-true}
INTENT_V2_SHADOW: ${INTENT_V2_SHADOW:-false}
INTENT_V2_DECISION: ${INTENT_V2_DECISION:-false}
INTENT_V2_DECISION_TIER: ${INTENT_V2_DECISION_TIER:-none}
WORKFLOW_INTENTS_ENABLED: ${WORKFLOW_INTENTS_ENABLED:-true}
MULTI_INTENT_ENABLED: ${MULTI_INTENT_ENABLED:-true}
SEMANTIC_FALLBACK_ENABLED: ${SEMANTIC_FALLBACK_ENABLED:-false}
ports:
- "${APP_PUBLISH_HOST:-0.0.0.0}:${HTTP_PORT:-8081}:${HTTP_PORT:-8081}"
healthcheck:
+42 -23
View File
@@ -10,27 +10,27 @@ import (
)
type Config struct {
Env string `json:"env"`
DataDir string `json:"data_dir"`
HTTPHost string `json:"http_host"`
HTTPPort int `json:"http_port"`
AgentBackend string `json:"agent_backend"`
AgentTimeout time.Duration `json:"agent_timeout"`
CursorAPIKey string `json:"cursor_api_key"`
CursorModel string `json:"cursor_model"`
CursorBin string `json:"cursor_bin"`
CursorBridgeBin string `json:"cursor_bridge_bin"`
PiAgentBin string `json:"pi_agent_bin"`
PiAgentBridgeBin string `json:"pi_agent_bridge_bin"`
PiAgentProvider string `json:"pi_agent_provider"`
PiAgentModel string `json:"pi_agent_model"`
PiAgentRunnerURL string `json:"pi_agent_runner_url"`
PiAgentRunnerAuthToken string `json:"pi_agent_runner_auth_token"`
KbDbHost string `json:"kb_db_host"`
KbDbPort int `json:"kb_db_port"`
KbDbUser string `json:"kb_db_user"`
KbDbPassword string `json:"kb_db_password"`
KbDbName string `json:"kb_db_name"`
Env string `json:"env"`
DataDir string `json:"data_dir"`
HTTPHost string `json:"http_host"`
HTTPPort int `json:"http_port"`
AgentBackend string `json:"agent_backend"`
AgentTimeout time.Duration `json:"agent_timeout"`
CursorAPIKey string `json:"cursor_api_key"`
CursorModel string `json:"cursor_model"`
CursorBin string `json:"cursor_bin"`
CursorBridgeBin string `json:"cursor_bridge_bin"`
PiAgentBin string `json:"pi_agent_bin"`
PiAgentBridgeBin string `json:"pi_agent_bridge_bin"`
PiAgentProvider string `json:"pi_agent_provider"`
PiAgentModel string `json:"pi_agent_model"`
PiAgentRunnerURL string `json:"pi_agent_runner_url"`
PiAgentRunnerAuthToken string `json:"pi_agent_runner_auth_token"`
KbDbHost string `json:"kb_db_host"`
KbDbPort int `json:"kb_db_port"`
KbDbUser string `json:"kb_db_user"`
KbDbPassword string `json:"kb_db_password"`
KbDbName string `json:"kb_db_name"`
// 专属记忆与多级上下文数据库配置
ContextDbHost string `json:"context_db_host"`
@@ -252,9 +252,29 @@ func Load(path string) (*Config, error) {
if v := os.Getenv("AGENT_BACKEND"); v != "" {
cfg.AgentBackend = v
}
if v := os.Getenv("AGENT_TIMEOUT"); v != "" {
if d, err := time.ParseDuration(v); err == nil {
cfg.AgentTimeout = d
}
}
if v := os.Getenv("CURSOR_API_KEY"); v != "" {
cfg.CursorAPIKey = v
}
if v := os.Getenv("CURSOR_MODEL"); v != "" {
cfg.CursorModel = v
}
if v := os.Getenv("CURSOR_BIN"); v != "" {
cfg.CursorBin = v
}
if v := os.Getenv("CURSOR_BRIDGE_BIN"); v != "" {
cfg.CursorBridgeBin = v
}
if v := os.Getenv("PI_AGENT_BIN"); v != "" {
cfg.PiAgentBin = v
}
if v := os.Getenv("PI_AGENT_BRIDGE_BIN"); v != "" {
cfg.PiAgentBridgeBin = v
}
if v := os.Getenv("PI_AGENT_PROVIDER"); v != "" {
cfg.PiAgentProvider = v
}
@@ -398,7 +418,7 @@ func validateProductionSecrets(cfg *Config) error {
"CONTEXT_DB_PASSWORD": cfg.ContextDbPassword,
"ADMIN_PASSWORD": cfg.AdminPassword,
}
defaults := []string{"shared_kb_secret_pass", "dev_secret_db_pass", "admin-secret-password-123"}
defaults := []string{"shared_kb_secret_pass", "dev_secret_db_pass", "prod_highly_secure_db_pass", "admin-secret-password-123"}
for envKey, val := range weak {
if strings.TrimSpace(val) == "" {
return fmt.Errorf("%s must be set in %s environment", envKey, cfg.Env)
@@ -482,4 +502,3 @@ func (c *Config) KbDSN() string {
func (c *Config) ContextDSN() string {
return "postgres://" + c.ContextDbUser + ":" + c.ContextDbPassword + "@" + c.ContextDbHost + ":" + strconv.Itoa(c.ContextDbPort) + "/" + c.ContextDbName + "?sslmode=disable"
}
+41
View File
@@ -69,6 +69,35 @@ func TestConfigLoadDSNOverrides(t *testing.T) {
}
}
func TestConfigLoadRuntimeEnvironmentOverrides(t *testing.T) {
t.Setenv("ENV", "dev")
t.Setenv("AGENT_TIMEOUT", "47m")
t.Setenv("CURSOR_API_KEY", "cursor-test-key")
t.Setenv("CURSOR_MODEL", "cursor-test-model")
t.Setenv("CURSOR_BIN", "/test/cursor")
t.Setenv("CURSOR_BRIDGE_BIN", "/test/cursor-bridge.mjs")
t.Setenv("PI_AGENT_BRIDGE_BIN", "/test/pi-bridge.mjs")
t.Setenv("EMBEDDING_MODEL", "embedding-test-model")
t.Setenv("RERANKER_MODEL", "reranker-test-model")
cfg, err := config.Load("/dev/null")
if err != nil {
t.Fatalf("unexpected error loading config: %v", err)
}
if cfg.AgentTimeout != 47*time.Minute {
t.Fatalf("expected environment AgentTimeout 47m, got %v", cfg.AgentTimeout)
}
if cfg.CursorAPIKey != "cursor-test-key" || cfg.CursorModel != "cursor-test-model" || cfg.CursorBin != "/test/cursor" || cfg.CursorBridgeBin != "/test/cursor-bridge.mjs" {
t.Fatalf("cursor environment overrides were not applied")
}
if cfg.PiAgentBridgeBin != "/test/pi-bridge.mjs" {
t.Fatalf("pi bridge environment override was not applied")
}
if cfg.EmbeddingModel != "embedding-test-model" || cfg.RerankerModel != "reranker-test-model" {
t.Fatalf("retrieval model environment overrides were not applied")
}
}
func TestConfigLoadCORSDefaultsForDev(t *testing.T) {
cfg, err := config.Load("/dev/null")
if err != nil {
@@ -103,3 +132,15 @@ func TestConfigLoadRejectsWeakSecretsOutsideDev(t *testing.T) {
t.Fatal("expected config load to fail for missing secrets in main env")
}
}
func TestConfigLoadRejectsProductionDatabasePlaceholder(t *testing.T) {
t.Setenv("ENV", "prod")
t.Setenv("KB_DB_PASSWORD", "kb-prod-secret-xyz")
t.Setenv("CONTEXT_DB_PASSWORD", "prod_highly_secure_db_pass")
t.Setenv("ADMIN_PASSWORD", "admin-prod-secret-xyz")
_, err := config.Load("/dev/null")
if err == nil {
t.Fatal("expected config load to reject the documented production database placeholder")
}
}
+15 -14
View File
@@ -90,44 +90,45 @@ run_compose() {
prepare_env_file "${target}"
fi
local env_arg=""
local env_args=()
# 根 .env 提供跨环境共用的模型、检索与认证配置;环境文件仅覆盖端口、
# 数据库和其他环境差异。后声明的 env-file 优先级更高。
if [[ -f ".env" ]]; then
env_args+=(--env-file ".env")
fi
if [[ -f "${env_file}" ]]; then
env_arg="--env-file ${env_file}"
env_args+=(--env-file "${env_file}")
fi
case "${act}" in
start)
if [[ "${target}" != "shared" ]]; then
ensure_shared_network
fi
ensure_shared_network
echo "==> [${target}] 启动服务 (${compose_file})..."
docker compose -f "${compose_file}" ${env_arg} up -d
docker compose -f "${compose_file}" "${env_args[@]}" up -d
echo "==> [${target}] 服务已启动"
;;
stop)
echo "==> [${target}] 停止服务..."
docker compose -f "${compose_file}" ${env_arg} stop
docker compose -f "${compose_file}" "${env_args[@]}" stop
;;
restart)
if [[ "${target}" != "shared" ]]; then
ensure_shared_network
fi
ensure_shared_network
echo "==> [${target}] 重启服务..."
docker compose -f "${compose_file}" ${env_arg} restart
docker compose -f "${compose_file}" "${env_args[@]}" restart
;;
status|ps)
echo "------------------------------------------------------------"
echo "环境: [${target}] (编排: ${compose_file})"
echo "------------------------------------------------------------"
docker compose -f "${compose_file}" ${env_arg} ps
docker compose -f "${compose_file}" "${env_args[@]}" ps
echo ""
;;
logs)
docker compose -f "${compose_file}" ${env_arg} logs -f --tail=100
docker compose -f "${compose_file}" "${env_args[@]}" logs -f --tail=100
;;
down)
echo "==> [${target}] 清理并下线容器..."
docker compose -f "${compose_file}" ${env_arg} down
docker compose -f "${compose_file}" "${env_args[@]}" down
;;
*)
echo "[错误] 未知操作: ${act}"
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""Print old->new commit SHA map by matching subject|author|email|date."""
from __future__ import annotations
import subprocess
import sys
ROOT = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip()
def git(*args: str) -> str:
return subprocess.check_output(["git", "-C", ROOT, *args], text=True).strip()
def signature(commit: str) -> str:
return git("log", "-1", "--format=%s|%an|%ae|%ad", commit, "--date=iso-strict")
def main() -> int:
old_hashes = git("log", "dev-old-linear", "--format=%H").splitlines()
new_by_sig: dict[str, str] = {}
for h in git("log", "dev", "--format=%H").splitlines():
new_by_sig[signature(h)] = h
print("old_sha\tnew_sha\tsubject")
for old in reversed(old_hashes):
sig = signature(old)
new = new_by_sig.get(sig, "")
subj = git("log", "-1", "--format=%s", old)
print(f"{old[:12]}\t{new[:12] if new else 'NOT_FOUND'}\t{subj}")
return 0
if __name__ == "__main__":
sys.exit(main())
+2 -2
View File
@@ -33,8 +33,8 @@ case "${COMMAND}" in
echo ""
case "${CURRENT_BRANCH}" in
dev)
echo "状态: 正处于【开发分支】。"
echo "提示: 可直接在此分支进行小功能渐进式提交,或创建 feature/<name> 进行复杂功能开发。"
echo "状态: 正处于【开发合入基线】。"
echo "提示: 禁止直接 commit。请从最新 dev 创建 feature/<name> 或 fix/<name>,自测后占集成槽位 merge --no-ff 合回。"
;;
test)
echo "状态: 正处于【测试分支】。"
+15
View File
@@ -0,0 +1,15 @@
epic_slug branch_type start_commit end_commit merge_message
foundation feature d27b0ad 40a25f9 merge: feature/foundation — repo scaffold and env baseline
bizdev-core feature 6f44916 8dc315b merge: feature/bizdev-core — bizdev MVP stack
agent-infra feature 8405417 cd39a52 merge: feature/agent-infra — pi-agent Tavily and docker
squad-intent feature b0142ab d8a7254 merge: feature/squad-intent — squad engine intent and adaptive planning
backend-platform feature 0f21060 a695334 merge: feature/backend-platform — KB memory docgov API and chat history
web-workbench feature 0b62403 dcc0650 merge: feature/web-workbench — three-column workbench MVP
web-features feature db238a4 2745e89 merge: feature/web-features — intent funnel export and templates
rbac-auth feature 3d75471 1c7320b merge: feature/rbac-auth — dynamic RBAC and auth settings
web-chat-ux feature a8701bc 8c8fa47 merge: feature/web-chat-ux — SSE chat longtask history workflow and seed data
chat-idempotency-task feature f4da2f1 ba249a5 merge: feature/chat-idempotency-task — turn idempotency and task materials
security-iam feature 28faa49 a9828c6 merge: feature/security-iam — P0 security and IAM Phase 0-1
workflow-abac-taskrun feature 7951b0f bb3f3a1 merge: feature/workflow-abac-taskrun — workflow ABAC taskrun and QA
governance-v2-codex fix 899a0e6 3596109 merge: fix/governance-v2-codex — three-workflow governance and Codex P0
agent-docs-system feature 33b1b8b 5e5bc1f merge: feature/agent-docs-system — doc taxonomy and branch policy
1 epic_slug branch_type start_commit end_commit merge_message
2 foundation feature d27b0ad 40a25f9 merge: feature/foundation — repo scaffold and env baseline
3 bizdev-core feature 6f44916 8dc315b merge: feature/bizdev-core — bizdev MVP stack
4 agent-infra feature 8405417 cd39a52 merge: feature/agent-infra — pi-agent Tavily and docker
5 squad-intent feature b0142ab d8a7254 merge: feature/squad-intent — squad engine intent and adaptive planning
6 backend-platform feature 0f21060 a695334 merge: feature/backend-platform — KB memory docgov API and chat history
7 web-workbench feature 0b62403 dcc0650 merge: feature/web-workbench — three-column workbench MVP
8 web-features feature db238a4 2745e89 merge: feature/web-features — intent funnel export and templates
9 rbac-auth feature 3d75471 1c7320b merge: feature/rbac-auth — dynamic RBAC and auth settings
10 web-chat-ux feature a8701bc 8c8fa47 merge: feature/web-chat-ux — SSE chat longtask history workflow and seed data
11 chat-idempotency-task feature f4da2f1 ba249a5 merge: feature/chat-idempotency-task — turn idempotency and task materials
12 security-iam feature 28faa49 a9828c6 merge: feature/security-iam — P0 security and IAM Phase 0-1
13 workflow-abac-taskrun feature 7951b0f bb3f3a1 merge: feature/workflow-abac-taskrun — workflow ABAC taskrun and QA
14 governance-v2-codex fix 899a0e6 3596109 merge: fix/governance-v2-codex — three-workflow governance and Codex P0
15 agent-docs-system feature 33b1b8b 5e5bc1f merge: feature/agent-docs-system — doc taxonomy and branch policy
+104
View File
@@ -0,0 +1,104 @@
#!/usr/bin/env bash
# Replay linear dev history as feature/fix branches with merge --no-ff.
# Requires: scripts/history-epic-manifest.tsv and tag backup/pre-rewrite-2026-09-13
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
MANIFEST="${ROOT_DIR}/scripts/history-epic-manifest.tsv"
BACKUP_TAG="backup/pre-rewrite-2026-09-13"
SOURCE_BRANCH="dev"
TARGET_BRANCH="dev-rewritten"
DRY_RUN="${DRY_RUN:-0}"
declare -A MSG_OVERRIDE=(
[d27b0ad]="docs(ops): 建立仓库基础架构、三分支规范与环境运行文档"
[91985a2]="fix(quality): 闭环 Go 质量门禁(鉴权富化/V0.5/vet/health/KB gate/记忆轮询)"
[546de52]="ci(qa): add QA-001 gate with go vet, short tests, and migration check."
[e82b624]="docs(plan): add production governance plan and Phase 0 authz matrix"
[77d3da1]="docs(plan): add Phase 1 IAM and authorization implementation plan"
[ba249a5]="chore(scripts): fix backfill script import and run projection for ws_intake"
)
log() { echo "[rewrite] $*"; }
die() { echo "[rewrite] ERROR: $*" >&2; exit 1; }
[[ -f "${MANIFEST}" ]] || die "missing manifest: ${MANIFEST}"
git rev-parse "${BACKUP_TAG}" >/dev/null 2>&1 || die "missing backup tag ${BACKUP_TAG}"
cd "${ROOT_DIR}"
if [[ "${DRY_RUN}" == "1" ]]; then
log "DRY_RUN=1 — manifest entries:"
tail -n +2 "${MANIFEST}"
exit 0
fi
current_branch="$(git branch --show-current)"
[[ "${current_branch}" == "${SOURCE_BRANCH}" ]] || die "checkout ${SOURCE_BRANCH} first (on ${current_branch})"
if git show-ref --verify --quiet "refs/heads/${TARGET_BRANCH}"; then
die "branch ${TARGET_BRANCH} already exists; delete it before rerun"
fi
log "creating orphan branch ${TARGET_BRANCH}"
git checkout --orphan "${TARGET_BRANCH}"
git rm -rf . >/dev/null 2>&1 || true
git commit --allow-empty -m "chore: history rewrite root anchor"
commit_range() {
local start="$1" end="$2"
if [[ "${start}" == "${end}" ]]; then
echo "${start}"
return
fi
if git rev-parse "${start}^" >/dev/null 2>&1; then
git rev-list --reverse "${start}^..${end}"
else
echo "${start}"
git rev-list --reverse "${start}..${end}"
fi
}
cherry_pick_commit() {
local hash="$1"
if ! git cherry-pick "${hash}"; then
die "cherry-pick failed at ${hash}; run git cherry-pick --abort and fix manifest/script"
fi
if [[ -n "${MSG_OVERRIDE[${hash}]+x}" ]]; then
git commit --amend -m "${MSG_OVERRIDE[${hash}]}"
fi
}
cherry_pick_range() {
local start="$1" end="$2"
local hash
while read -r hash; do
[[ -n "${hash}" ]] || continue
log " cherry-pick ${hash}"
cherry_pick_commit "${hash}"
done < <(commit_range "${start}" "${end}")
}
while IFS=$'\t' read -r slug branch_type start end merge_msg; do
branch="${branch_type}/${slug}"
log "epic ${slug}: ${branch} (${start}..${end})"
git checkout -b "${branch}" "${TARGET_BRANCH}"
cherry_pick_range "${start}" "${end}"
git checkout "${TARGET_BRANCH}"
git merge --no-ff "${branch}" -m "${merge_msg}"
git branch -d "${branch}"
done < <(tail -n +2 "${MANIFEST}")
log "verifying tree matches ${BACKUP_TAG}"
if ! git diff --quiet "${BACKUP_TAG}" HEAD; then
die "tree mismatch after rewrite — aborting before branch swap"
fi
log "replacing ${SOURCE_BRANCH} with rewritten history"
git branch -m "${SOURCE_BRANCH}" "${SOURCE_BRANCH}-old-linear"
git branch -m "${TARGET_BRANCH}" "${SOURCE_BRANCH}"
log "done. old linear history preserved on ${SOURCE_BRANCH}-old-linear"
log "verify: git diff ${BACKUP_TAG} ${SOURCE_BRANCH} (should be empty)"