Commit Graph

203 Commits

Author SHA1 Message Date
xiaomo d56d0fd435 style: apply biome formatting to pulse-cursor
Made-with: Cursor
2026-04-18 03:08:29 +00:00
xiaomo 145be974f3 fix: adapt pulse-cursor package to async PulseStore API
Make resolveTask and resolveProject async and await their store.queryByKind calls

Made-with: Cursor
2026-04-18 03:08:12 +00:00
xiaomo 6062e692ac fix: adapt upulse package to async PulseStore API
Update upulse commands and UI server to await all async store methods. - Make CLI action callbacks async (workflow create, timeline, list, inspect events/object) - Make daemon status function async - Make all UI server handler functions async with awaited store calls - Fix Promise.all patterns for getObject calls in map functions - Fix scopedStore.close() calls to be awaited

Made-with: Cursor
2026-04-18 03:07:20 +00:00
xiaomo 3313f29954 fix: resolve lint errors in test files for async refactor
- Make non-async helper functions async (triggerCoding, triggerWorkflow, writeVitalAndRebuild, writeEffectEvent, cleanup, trigger) - Fix bad await placement in object literals (await hash: -> hash: await) - Fix await in non-async arrow callbacks and await data: object property - Convert expect(async).toThrow() to rejects.toThrow() for async functions - Fix Promise.all pattern for async getObject calls in map - Remove stray await before return statements - Fix db.close() (sync bun:sqlite API) wrongly awaited - Auto-fix formatting issues via biome

Made-with: Cursor
2026-04-18 03:01:24 +00:00
xiaomo 6f753ae68e test: await async store/defs calls in all test files
Update all *.test.ts files to properly await the async PulseStore, ScopedStore, and defs functions. Fix gc.test.ts timing issues for async GC trigger, fix bad await assignment targets, and correct .length access on Promise objects.

Made-with: Cursor
2026-04-18 02:57:30 +00:00
xiaomo ca3dd52e38 refactor!: async PulseStore interface for multi-runtime support (refs #5)
CI / test (push) Has been cancelled
- PulseStore/ScopedStore 接口方法返回 Promise<T>
- 所有 store 实现方法改为 async(bun:sqlite 同步调用外包 async)
- defs.ts, projection-engine.ts, gc.ts 公共函数异步化
- index.ts 中 store 调用加 await
- rules/health.ts rebuildHealth 函数异步化
- 核心异步化完成,支持 CF D1 等异步数据库运行时

Breaking Changes:
- All PulseStore methods now return Promise<T>
- Consumer code must add await for all store operations
- Tests need to be updated to use async/await patterns
2026-04-18 02:50:12 +00:00
xiaomo 80eeac03c2 docs: Pulseflare runtime analysis report (refs #5)
CI / test (push) Has been cancelled
2026-04-18 02:24:52 +00:00
xiaoju 0517007d40 chore: remove legacy broker code (pulse#6)
CI / test (push) Has been cancelled
2026-04-18 02:09:59 +00:00
xiaoju 5ccd50221c refactor(rollback): extract performRollback + add 6 tests
CI / test (push) Has been cancelled
- Extract core logic into testable performRollback(opts) function
- CLI action now delegates to performRollback and prints output
- Tests cover: dry-run, event export/delete, git checkout, missing
  commit error, noop when already at target, dump metadata
- All tests use tmpdir, no dependency on ~/.upulse
2026-04-18 01:39:22 +00:00
xiaoju 8754ff51cd feat(upulse): add rollback command — time-machine revert for engine
CI / test (push) Has been cancelled
- upulse rollback <commit> [--dry-run] [--engine <path>] [--events <path>]
- Exports events after cutoff to .pulse/rollbacks/rollback-<date>-<commit>.db
- Deletes those events from events.db
- Clears projection cache
- git checkout target commit in engine
- Also adds migrate.ts stub (missing file)

Ref: pulse#3
2026-04-18 01:34:26 +00:00
xiaoju 37e3331ccb feat(workflow): add in-memory checkpoint for incremental tick
CI / test (push) Has been cancelled
- WorkflowCheckpoint caches lastEventId, topic summaries, and per-topic events
- First tick: full read (getAfter(0)), subsequent ticks: incremental (getAfter(lastEventId))
- Newly written role events also update checkpoint in-place
- No interface changes, no new files
2026-04-18 01:30:01 +00:00
xiaomo 90f7ba5a62 feat: export new CursorCall interface and executeCursorTask function
CI / test (push) Has been cancelled
2026-04-17 15:28:29 +00:00
xiaomo 2c1ed1419e refactor: thin cursor executor + CursorCall schema (refs xiaoju/pulse#2)
CI / test (push) Has been cancelled
2026-04-17 15:27:59 +00:00
xiaoju e165d1a91d fix: update adapter tests for simplified workflow-rule-adapter
CI / test (push) Has been cancelled
- meta:null test: expect undefined instead of remainingRounds JSON
- maxRounds test: moderator self-counts via meta, no remainingRounds param
- maxTicksPerWindow test: replaced with multi-topic processing test
- Remove 4-arg createWorkflowRule calls (options removed in adaptive-tick refactor)

68 pass, 0 fail
2026-04-17 15:22:36 +00:00
xiaoju 041756117b feat: daemon adaptive tick — 5s active, backoff ×2 up to 5min idle
CI / test (push) Has been cancelled
Replaces fixed 30s setInterval with setTimeout-based adaptive loop.
Resets to 5s when new events detected, backs off to 5min when idle.
2026-04-17 15:03:14 +00:00
xiaomo b6a927cb58 feat: adaptive tick frequency with exponential backoff (closes xiaoju/pulse#1)
CI / test (push) Has been cancelled
2026-04-17 14:19:18 +00:00
xiaoju ee1c0cc9c0 refactor: meta workflow targets ~/.upulse/engine/ instead of pulse repo
CI / test (push) Has been cancelled
- ENGINE_DIR = ~/.upulse/engine for meta coder/reviewer/tester/promoter
- REPO_DIR still used for coding workflow
- Tester accepts buildCmd/testCmd opts, no longer hardcoded to monorepo paths
- Init engine dir with package.json + tsconfig.json + git repo
2026-04-17 14:12:47 +00:00
xiaoju f88d325db8 feat: cli.refactor workflow — auto-generated by meta-workflow
CI / test (push) Has been cancelled
2026-04-17 13:32:42 +00:00
xiaoju 3e30503c08 feat: upulse CLI refactor — 4 commands (init/inspect/workflow/status)
CI / test (push) Has been cancelled
Auto-generated by meta workflow (cli-cleanup topic).
Removed: daemon, deploy, dev, gc, list, tick, ui commands.
Added: status (systemd + db stats), updated inspect + workflow.
2026-04-17 13:30:17 +00:00
xiaoju 620c5a8323 fix: REPO_DIR resolve to pulse root, not repos root
CI / test (push) Has been cancelled
Tester was failing with ENOENT because cwd pointed to
/home/azureuser/repos/packages/pulse (nonexistent) instead of
/home/azureuser/repos/pulse/packages/pulse.
2026-04-17 13:29:54 +00:00
xingyue 6e8b2b7ba6 fix: use effect.kind as fallback for effect type display
CI / test (push) Has been cancelled
2026-04-17 21:26:48 +08:00
xiaoju ba31086c30 fix: daemon cooldownMs=0, add tick logging, systemd service + launcher
CI / test (push) Has been cancelled
- cooldownMs: 0 for both coding and meta workflow rules
- logTick wrapper prints timestamp + elapsed ms per tick
- start-daemon.sh loads secrets before starting bun
- pulse-workflow.service systemd unit (enabled + started)
2026-04-17 13:09:38 +00:00
xiaoju ce36c08e9c feat: restore coding-tdd workflow + barrel exports (lost in rebase)
CI / test (push) Has been cancelled
2026-04-17 13:03:17 +00:00
xiaoju 02847d9001 feat: workflow daemon + submit-task CLI
CI / test (push) Has been cancelled
2026-04-17 13:01:33 +00:00
xiaoju 04ced5b5f0 feat: coding-tdd workflow — auto-generated by meta-workflow 2026-04-17 13:01:33 +00:00
luming c703befcdc chore: remove obsolete binding and broker tests
CI / test (push) Has been cancelled
These tests reference modules (binding.js/broker.js) that no longer exist.

Signed-off-by: Xiaonuo <xiaonuo@git.shazhou.work>
2026-04-17 20:47:06 +08:00
luming 3cdd9aeba6 feat(ui): workflow dashboard — list, timeline, and overview card
CI / test (push) Has been cancelled
- Backend: GET /api/workflows, GET /api/workflows/:topicId/timeline
- Frontend: WorkflowsPage with list view + timeline detail
- Dashboard: workflow overview card (active/completed counts)
- Nav: Workflows entry with Workflow icon

— 小糯/Xiaonuo
2026-04-17 20:41:35 +08:00
xiaoju bf6de91c61 feat(coding): declare maxRounds + moderator remainingRounds awareness
CI / test (push) Has been cancelled
2026-04-17 12:25:17 +00:00
xiaoju a54c36f758 refactor: remainingRounds countdown in event meta, replace maxTicksPerTopic with workflow-declared maxRounds
CI / test (push) Has been cancelled
2026-04-17 11:51:57 +00:00
xiaoju e1a96fdc71 feat: cursor health check + workflow circuit breaker
CI / test (push) Has been cancelled
- 新增 Cursor Health Rule (cursor-health.ts):
  - 监控 ~/.cursor/ai-tracking/ai-code-tracking.db
  - 检查最近 15 分钟内调用次数,默认阈值 100
  - 支持自定义时间窗口、阈值、数据库路径
  - 完整测试覆盖,包括边界情况处理

- 增强 Workflow 保护机制 (workflow-rule-adapter.ts):
  - maxTicksPerTopic (默认20):同一 topic 超限强制写 __end__ 事件
  - maxTicksPerWindow (默认50):1小时内全局 tick 超限暂停所有执行
  - cooldownMs (默认60s):同一 topic 两次 tick 最小间隔
  - 完整事件日志记录,便于调试分析

防止 workflow 死循环空转事故,保护 Cursor Agent 额度不被恶意消耗。

小橘 🍊 (NEKO Team)
2026-04-17 11:37:46 +00:00
xiaoju 2e216c2f81 revert: restore --yolo flag for cursor agent
CI / test (push) Has been cancelled
--yolo = auto-approve permissions, needed for unattended runs.
2026-04-17 10:49:23 +00:00
xiaoju 3f1db4ed58 chore: cursor agent switch from --yolo to auto mode
CI / test (push) Has been cancelled
Save API quota — first day already used 31%.
2026-04-17 10:46:43 +00:00
xiaoju c2a0e8c96b feat: coding workflow — auto-generated by meta-workflow
CI / test (push) Has been cancelled
2026-04-17 10:44:41 +00:00
xiaoju 029417ce33 fix: meta-tester cwd path double-nesting bug
CI / test (push) Has been cancelled
tester was running 'cd packages/pulse && bun test packages/pulse/...'
which doubled the path. Fixed to cwd=packages/pulse + relative paths.
2026-04-17 10:39:40 +00:00
xiaoju 592a5566a5 feat: enhance coding workflow — structured architect design, reviewer retry with retryCount cap
- ArchitectMeta now includes targetFiles, changes (file→description), and verification criteria
- CoderMeta prepPrompt explicitly consumes architect.changes, architect.verification, and reviewer.rejectionReason on retry
- ReviewerMeta now outputs verdict, rejectionReason, and monotonic retryCount (starting from 0)
- Moderator enforces retryCount < 3 limit — forces closer when exceeded
- Updated mock implementations, role factories, and e2e to match new meta structures
- Added test for retry limit (retryCount >= 3 → closer)
2026-04-17 10:27:53 +00:00
xiaoju 4139f1d5d5 fix: tick() returns content+meta in executed roles
CI / test (push) Has been cancelled
- ExecutedRole: { topicId, role, content, meta }
- No more indirect event reading to get role results
- 28 tests pass
2026-04-17 10:14:44 +00:00
xiaoju a1a6dba24b feat: workflow scaffold + unified modify mode
CI / test (push) Has been cancelled
- scaffold.ts: generates {name}.ts + {name}.test.ts + roles/{name}-*.ts
- CLI: upulse workflow init <name> --roles planner,executor
- meta-architect prompt: 统一为'修改已有骨架'语义
- meta-coder prompt: 在已有文件上填充实现
- 28 tests pass
2026-04-17 09:56:51 +00:00
xiaoju 898809abd3 refactor: rename *-workflow.ts → *.ts — drop redundant suffix
CI / test (push) Has been cancelled
workflows/coding.ts, report.ts, meta.ts + matching tests
All 28 tests pass, build clean
2026-04-17 09:52:27 +00:00
xiaoju 2f461bffeb feat: meta-workflow — workflow for developing workflows
CI / test (push) Has been cancelled
Roles: architect(LLM) → coder(Cursor) → reviewer(Cursor) → tester(code+LLM) → promoter(code)
- Retry loop: reviewer rejected or tester failed → back to coder
- Meta architect uses structured tool output (workflow spec JSON)
- Coder/reviewer use agent-executor factory with LLM₂ meta parsing
- Tester: build+test then LLM judges result
- Promoter: git commit + push
- docs/workflow-spec.md: reference context for coder role
- 3 unit tests (moderator routing, happy path, retry path)
- 28 total workflow tests pass
2026-04-17 09:20:45 +00:00
xiaoju 4abe7bf620 refactor: extract createLlmRole/createToolRole factory — shared sandwich pattern
CI / test (push) Has been cancelled
- llm-role-factory.ts: shared LLM call skeleton (build messages → chat → parse)
- createLlmRole: free-text response roles (architect)
- createToolRole: tool_choice structured output roles (analyst)
- analyst-llm.ts + architect-llm.ts rewritten on factory
- 25 tests pass, live report verified
2026-04-17 09:12:32 +00:00
xiaoju a040819a09 feat: report i18n — 中文模板 + analyst 中文输出
CI / test (push) Has been cancelled
2026-04-17 08:58:15 +00:00
xiaoju 5ad4145dfc feat: report workflow — analyst(LLM) + renderer(template)
CI / test (push) Has been cancelled
- analyst: structured JSON output via tool_choice (score, highlights, issues, roleAnalysis with eventId refs)
- renderer: pure code HTML template — dark theme, gantt bar, role cards, verdict badges
- report-live.ts: e2e test script, reads coding workflow DB → generates HTML report
- renderer-llm.ts: kept as reference (LLM version, not used — timeout issues)
- 2 unit tests pass, live test: 17.9s end-to-end
2026-04-17 08:46:40 +00:00
xiaoju 9efb535ead feat: upulse workflow timeline <key> — view event timeline
CI / test (push) Has been cancelled
- Shows offset, duration, role, meta for each event
- --json for structured output (feeds report workflow)
- --content for content preview
2026-04-17 08:22:35 +00:00
xiaoju 3c6c8840ef fix: live script uses agent-executor sandwich (no more includes hack)
CI / test (push) Has been cancelled
- council-v2-live.ts: coder/reviewer now use createCoderRole/createReviewerRole
- Removed inline runCursorAgent (moved to agent-executor.ts)
- reviewer verdict via LLM₂ tool_choice instead of includes('rejected')
- Live verified: architect→coder→reviewer(approved)→closer in 135s
2026-04-17 06:53:48 +00:00
xiaoju a4aa990e9f docs: add roles/ directory reference to COUNCIL-V2.md
Reference concrete role implementations (architect-llm, coder-cursor,
reviewer-cursor, agent-executor) in the Roles section.

Made-with: Cursor
2026-04-17 06:40:54 +00:00
xiaoju f191d594b3 feat: LLM-Agent-LLM sandwich (agent-executor)
- createAgentExecutorRole: prepPrompt → agent.run → LLM₂ tool_choice → meta
- createCursorRunner: extracts Cursor CLI into AgentRunner interface
- Coder role: LLM₂ extracts filesChanged + testsPassed via tool_choice
- Reviewer role: LLM₂ extracts verdict via tool_choice (no more includes hack)
- defaultMeta fallback when LLM₂ fails or returns no tool_call
- 5 new agent-executor tests, 24 total pass
2026-04-17 06:27:19 +00:00
xiaoju 5a8fe051bf docs: tighten COUNCIL-V2.md to 49 lines within 30-50 target
Made-with: Cursor
2026-04-17 06:16:20 +00:00
xiaoju b458daecb8 docs: trim COUNCIL-V2.md to 50 lines and inline source references
Made-with: Cursor
2026-04-17 06:14:08 +00:00
xiaoju ac6db24d6e docs: rewrite COUNCIL-V2.md with concise model overview
Simplified structure with inline code block for WorkflowType,
streamlined section headings, and tighter prose while retaining
all key topics: START/END automaton, pure roles, Moore-machine
diff-driven ticks, and source file references.

Made-with: Cursor
2026-04-17 06:12:04 +00:00
xiaoju 8cec21d285 docs: add COUNCIL-V2.md overview of the WorkflowType model
Covers WorkflowType definition, START/END automaton, pure roles,
and Moore machine diff-driven ticks with source file references.

Made-with: Cursor
2026-04-17 06:09:43 +00:00