Commit Graph

235 Commits

Author SHA1 Message Date
xiaoju 7b7a3300a7 feat: workflow abort via GuardProjection lifecycle (pulse#10)
CI / test (push) Has been cancelled
2026-04-18 23:04:13 +00:00
xiaoju c6e715fb3b fix: deduplicate guard-core exports in index.ts
CI / test (push) Has been cancelled
2026-04-18 22:56:44 +00:00
xiaoju 8361e0a66f fix: checker uses git diff HEAD (working tree) instead of HEAD~1..HEAD
CI / test (push) Has been cancelled
Coder may not commit changes, so HEAD~1..HEAD misses uncommitted files.
git diff --name-only HEAD catches both staged and unstaged changes.
2026-04-18 22:52:04 +00:00
xiaomo ff1efdf3d2 refactor: extract guard-core pure logic + fix check-before-transition (refs #9)
CI / test (push) Has been cancelled
2026-04-18 15:15:51 +00:00
xiaoju d6b607d610 feat: write __end__ event when workflow completes
CI / test (push) Has been cancelled
2026-04-18 15:09:14 +00:00
xiaoju aa89fdf144 fix: guard-projection tests — db sharing + async assertions + event format
CI / test (push) Has been cancelled
2026-04-18 15:08:18 +00:00
xiaoju 24dc6e88f0 fix: daemon loads gate role from engine (meta-gate-role crash fix)
CI / test (push) Has been cancelled
2026-04-18 14:55:24 +00:00
xiaoju b57a9d25ec Merge pull request 'refactor: restrict meta workflow to src/workflows/ scope' (#12) from refactor/restrict-meta-workflow-scope into main
CI / test (push) Has been cancelled
2026-04-18 14:40:18 +00:00
tuanzi 300eede226 refactor: restrict meta workflow to src/workflows/ scope
CI / test (pull_request) Has been cancelled
What: Tighten file scope for meta workflow coder and checker roles.
Why: Meta workflow should only modify workflow code under
$HOME/.upulse/engine/src/workflows/, not arbitrary project files.
Changes:
- meta-coder-cursor.ts: add prompt constraint to only modify src/workflows/
- meta-checker.ts: restrict allowedPrefixes from src/docs/test/ to src/workflows/ only
- meta-checker.ts: remove blacklist exemption for src/workflows/

团子 🐰
2026-04-18 14:26:02 +00:00
xiaoju 8ef1926772 feat: daemon supports engine directory override for workflow definitions (pulse#11 prep)
CI / test (push) Has been cancelled
2026-04-18 14:20:38 +00:00
xiaoju 6f4886db6a feat: GuardProjection — event admission control (pulse#9)
CI / test (push) Has been cancelled
- Add guard-projection.ts: registerGuard, checkGuards, applyGuardUpdates, getGuardState
- Guards use JSONata check + transition expressions, evaluated as data context
- Kind pattern matching with * wildcard (e.g. *.__start__)
- Integrate into store.ts appendEvent/appendEvents with transaction safety
- Handle nested transactions (inTransaction check)
- Export types and functions from index.ts
- 7 tests covering lifecycle, rejection, wildcards, complex expressions
2026-04-18 13:35:04 +00:00
tuanzi f59e3e7cb5 refactor: remove closer role from coding and coding-tdd workflows (#7)
CI / test (push) Has been cancelled
Co-authored-by: 团子 <tuanzi@shazhou.work>
Co-committed-by: 团子 <tuanzi@shazhou.work>
2026-04-18 13:31:12 +00:00
xiaoju b94a9046ac feat(workflows): subprocess role isolation
CI / test (push) Has been cancelled
Add createSubprocessRole() to run workflow roles in isolated child
processes. Roles that crash/hang/OOM no longer affect the daemon.

- subprocess-runner.ts: child process entry, reads stdin JSON, executes role
- subprocess-role.ts: createSubprocessRole() wrapper matching Role<unknown>
- 4 test fixtures + 4 passing tests (echo, error, timeout, crash)
- Exported from workflows/index.ts and main index.ts

小橘 🍊 (NEKO Team)
2026-04-18 11:36:54 +00:00
xiaomo 6c3888af48 feat: add Durable Objects delete migration for pulseflare
CI / test (push) Has been cancelled
- Add v2 migration with deleted_classes = ["PulseTick"]
- Required to deploy after removing DO from index.ts
2026-04-18 10:06:36 +00:00
xiaomo 5609cd36f4 refactor: pulseflare as passive event store + projection API (refs #5)
CI / test (push) Has been cancelled
- Remove durable-tick.ts and executor-sigil.ts (no more active ticking)
- Remove Durable Objects bindings from wrangler.toml
- Add CAS objects table to schema.sql
- Rewrite index.ts as pure API service:
  * POST /events - push events with auto-generated occurredAt
  * GET /events?kind&key&since&limit - query events
  * GET /projections/:key - get latest collect event meta for key
  * POST /objects - CAS store objects, return hash
  * GET /objects/:hash - retrieve objects by hash
  * GET /health - service health check
- No more /tick, /start, /configure, /status endpoints
- Pure passive event store, no rules engine or Sigil integration
2026-04-18 10:04:11 +00:00
xiaoju 40a7804dfb refactor: migrate business workflows to @upulse/workflows package
CI / test (push) Has been cancelled
- Move coding, coding-tdd, report, werewolf, cursor-health workflows
  to packages/pulse-workflows/
- Move analyst, architect, coder, renderer, reviewer roles to
  packages/pulse-workflows/
- Update all imports in migrated files to use @uncaged/pulse
- Update daemon and e2e files to import from @upulse/workflows
- Clean up core workflows/index.ts re-exports
- Add AgentExecutor, LlmRoleFactory, Scaffold exports to core index.ts
- Core package: 25 tests pass, workflows package: 40 tests pass

小橘 🍊 (NEKO Team)
2026-04-18 09:56:43 +00:00
xiaoju a3db066808 feat: add checker role to meta workflow (coder→checker→tester→END)
CI / test (push) Has been cancelled
- checker validates file scope, build, unit tests before e2e
- tester enhanced with diagnostic info on failure (event chain, last role, meta)
- tester no longer duplicates build (checker handles it)
- 6 meta workflow tests, 78 total pass
2026-04-18 09:39:28 +00:00
xiaoju 695dac8106 feat: register report workflow in daemon (analyst+renderer) 2026-04-18 09:39:28 +00:00
xiaomo 25591e2c21 fix: D1 bind params must be spread, not chained (refs #5)
CI / test (push) Has been cancelled
2026-04-18 08:12:37 +00:00
xiaoju b533094792 fix: tester detects completion by quiescence, not __end__ event
CI / test (push) Has been cancelled
Adapter doesn't write __end__ events — moderator returns END and
tick produces executed=[]. Now tester checks: did at least one tick
execute, then quiesced = completed.
2026-04-18 08:11:06 +00:00
xiaomo 1ba77929e6 feat: pulseflare real tick logic — rules + snapshot + sigil executor (refs #5)
CI / test (push) Has been cancelled
- Implement real Pulse tick logic in durable-tick.ts
- Add snapshot rebuild from D1 collect events
- Add pulse() method with demo rules (CPU spike detection, heartbeat)
- Add adaptive tick logic (30s base, up to 5min backoff)
- Add /configure endpoint for senseKeys and configuration
- Add CAS object storage in store-d1.ts
- Update index.ts with /configure route
- Persist prev snapshot in DO storage
- Execute effects through Sigil with error handling
2026-04-18 08:09:04 +00:00
xiaoju 7168b68896 feat: tester e2e verification — dynamic import + tick lifecycle + commit/push
CI / test (push) Has been cancelled
Tester no longer duplicates build+test (that's coder's job).
Instead: dynamic-import workflows from engine dir, spin temp store,
tick to __end__, verify lifecycle completes. Workflow-agnostic.
2026-04-18 08:02:53 +00:00
xiaomo 70be73efde chore: update pulseflare D1 database_id (refs #5)
CI / test (push) Has been cancelled
2026-04-18 07:54:05 +00:00
xiaomo 272aa9728a feat: pulseflare package — CF Workers + D1 runtime (refs #5)
CI / test (push) Has been cancelled
2026-04-18 07:51:37 +00:00
xiaoju ad25161a8f refactor: merge promoter into tester — meta workflow now coder → tester → END
CI / test (push) Has been cancelled
2026-04-18 07:48:25 +00:00
xiaoju be2d9de6b1 fix: werewolf test async + e2e tick loop
CI / test (push) Has been cancelled
2026-04-18 07:06:40 +00:00
xiaoju 1afce01335 refactor: simplify meta workflow — coder → tester → promoter 2026-04-18 07:03:33 +00:00
xiaoju 2a17dcc892 feat(workflow): add werewolf game workflow
CI / test (push) Has been cancelled
2026-04-18 05:58:10 +00:00
xiaomo d9717ab941 fix: correct stale test assertion in cursor-agent.test.ts
CI / test (push) Has been cancelled
The test was checking for 'Bug Fix' but the mock data has title: 'Fix bug' and the prompt builder uses the title directly. Remove the incorrect assertion.

Made-with: Cursor
2026-04-18 03:21:36 +00:00
xiaomo 39d58f58c1 chore: remove stale test files for deleted modules (council, container)
council.test.ts and container.test.ts reference modules that were removed in a previous commit (b65e9d6). These files cannot run and cause test suite failures.

Made-with: Cursor
2026-04-18 03:19:07 +00:00
xiaomo 0b2f3073b5 style: apply biome formatting to test files
Made-with: Cursor
2026-04-18 03:16:27 +00:00
xiaomo 125aafaa12 fix: adapt test files for async PulseStore (refs #5)
CI / test (push) Has been cancelled
- Fixed await patterns in index.test.ts, objects.test.ts, scoped-store.test.ts
- Converted expect(await store.method()) patterns throughout test files
- Fixed rebuildSnapshot async calls in E2E tests
- Made test functions async where needed for store operations
- Reduced test failures from 35+ down to 6 (remaining are mostly unrelated)
2026-04-18 03:13:26 +00:00
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