Commit Graph

1110 Commits

Author SHA1 Message Date
xiaoju 9f5891169e fix: add missing workflow destructure in current-role test
CI / check (pull_request) Failing after 1m37s
The createMarker call used shorthand 'workflow' but the variable
was not destructured from cmdThreadStart.

Fixes #56
2026-06-04 10:56:44 +00:00
xiaoju 0470d9445a Merge pull request 'fix: disable pnpm minimumReleaseAge in CI' (#55) from fix/ci-disable-release-age into main
CI / check (push) Failing after 1m45s
2026-06-04 10:32:51 +00:00
xiaoju 07128b89af fix: pnpm 11 CI compatibility
CI / check (pull_request) Failing after 1m27s
- Set minimumReleaseAge: 0 (pnpm 11 defaults to 1440 min)
- Add allowBuilds for esbuild and msw (pnpm 11 blocks build scripts
  by default, config moved from package.json to pnpm-workspace.yaml)
2026-06-04 10:23:02 +00:00
xiaoju 1fdeb716ca Merge pull request 'fix: migrate CI from bun to pnpm' (#54) from fix/52-ci-bun-to-pnpm into main
CI / check (push) Failing after 51s
2026-06-04 10:05:35 +00:00
xiaoju 1b99f0e2c1 fix: migrate CI from bun to pnpm
CI / check (pull_request) Failing after 1m44s
Closes #52
2026-06-04 10:05:02 +00:00
xiaomo f56e24cf82 Merge pull request 'test: expand E2E coverage — suspend, count, mustache, completed resume' (#51) from test/33-more-e2e into main
CI / check (push) Failing after 1m28s
test: expand E2E coverage — suspend, count, mustache, completed resume (#51)
2026-06-04 09:04:09 +00:00
xiaoju 974c2b8f1b test: add E2E tests for suspend/resume, --count, mustache, and completed resume (#33)
CI / check (pull_request) Failing after 1m40s
4 new E2E scenarios:
4. $SUSPEND → resume lifecycle (suspendedRole/suspendMessage metadata)
5. --count 3 runs entire pipeline in one invocation
6. mustache template variables rendered into edgePrompt
7. completed thread resume (衔尾蛇: end → start, CAS chain preserved)

Total: 7 E2E scenarios, all passing.
2026-06-04 09:03:01 +00:00
xiaomo 6e7276425d Merge pull request 'chore: fix biome check errors (40 → 0)' (#50) from chore/fix-biome-check into main
CI / check (push) Failing after 1m16s
chore: fix biome check errors (40 → 0) (#50)
2026-06-04 09:01:49 +00:00
xingyue dbb7885ffd chore: fix biome check errors (40 → 0)
CI / check (pull_request) Failing after 1m39s
- Auto-fix: import sorting, formatting (17 files)
- Unsafe auto-fix: unused vars, template literals (7 files)
- Manual: nursery/noConsole → suspicious/noConsole suppression
- Manual: suppress noExcessiveCognitiveComplexity for cmdThreadResume and parseWorkflowPayload
- Manual: remove unused destructured vars in current-role tests

Closes #48
2026-06-04 16:45:45 +08:00
xiaomo cd7e4e77ff Merge pull request 'feat: agent-mock package for deterministic E2E testing (#33)' (#44) from test/33-mock-agent into main
CI / check (push) Failing after 1m38s
feat: agent-mock package for deterministic E2E testing (#44)
2026-06-04 08:38:51 +00:00
xiaomo 64a8bab5ce Merge pull request 'fix: resolve workflow from CAS chain in collectCompletedThreads' (#47) from fix/completed-thread-workflow into main
CI / check (push) Failing after 1m33s
fix: resolve workflow from CAS chain in collectCompletedThreads (#47)
2026-06-04 08:38:06 +00:00
xiaoju 80e8efb05e test: E2E integration tests with uwf-mock agent (#33)
CI / check (pull_request) Failing after 2m30s
Three scenarios testing the full CLI pipeline:
1. Linear workflow (planner → worker → $END): CAS chain integrity
2. Loop workflow (developer ↔ reviewer): moderator routing through cycles
3. Role mismatch detection: agent catches routing bugs

Uses workflow add → thread start → thread exec with uwf-mock,
verifying CAS state, thread lifecycle, and error handling.

Updated assertions to use getThread().status === 'completed'
(aligned with PR #45 unified thread storage).

Refs #33
2026-06-04 08:06:22 +00:00
xiaoju 75fb752a82 feat: add agent-mock package for deterministic E2E testing (#33)
New package @united-workforce/agent-mock (uwf-mock CLI):
- Reads pre-scripted outputs from a YAML mock data file (--mock-data)
- Counts existing CAS chain steps to determine step index
- Validates expected role matches actual moderator routing
- Stores minimal detail node in CAS for valid step refs
- Zero LLM, instant execution, 100% deterministic

Usage in config.yaml:
  agents:
    mock:
      command: uwf-mock
      args: ["--mock-data", "./fixtures/scenario.yaml"]

Refs #33
2026-06-04 08:00:07 +00:00
xingyue 06af1dc668 fix: resolve workflow from CAS chain in collectCompletedThreads
CI / check (pull_request) Failing after 1m28s
Instead of hardcoding workflow as empty string for completed/cancelled
threads, use resolveWorkflowFromHead to get the actual workflow hash
from the CAS chain, consistent with active thread handling.

Closes #46
2026-06-04 15:35:08 +08:00
xiaomo bbea89c067 Merge pull request 'refactor: unified thread storage + resume completed threads' (#45) from refactor/39-unified-thread-storage into main
CI / check (push) Failing after 1m26s
refactor: unified thread storage + resume completed threads (#45)
2026-06-04 07:25:56 +00:00
xingyue bda3e3a861 feat(cli): resume completed threads (衔尾蛇: end → start)
CI / check (pull_request) Failing after 3m45s
uwf thread resume now supports completed threads:
- Evaluates workflow graph from $START to find first role
- Clears completed state (status → idle, completedAt → null)
- Builds resume prompt with supplement context
- Full CAS chain preserved for rich context

Suspended resume behavior unchanged.
Cancelled/idle threads still rejected.

425 tests pass.

Part of #39, closes #43
2026-06-04 15:13:47 +08:00
xingyue ca7b68ca5f refactor(cli): unify thread storage, remove history prefix
- store.ts: all threads in @uwf/thread/* with status tag
- Remove HISTORY_VAR_PREFIX, ThreadHistoryLine, deleteThread
- Add loadActiveThreads, loadHistoryThreads, completeThread
- Add migrateHistoryVarsToThreadVars migration
- thread.ts: replace deleteThread+addHistoryEntry with completeThread
- shared.ts: remove findHistoryEntry fallback
- Update all tests for unified storage model

422 tests pass.

Part of #39, closes #41, closes #42
2026-06-04 15:01:20 +08:00
xingyue 23e2ae9eb4 refactor(protocol): add status + completedAt to ThreadIndexEntry
- ThreadIndexEntry gains status and completedAt fields
- createThreadIndexEntry defaults to idle/null
- normalizeThreadIndexEntry backward-compat defaults
- updateThreadHead resets to idle (衔尾蛇 resume prep)
- markThreadSuspended sets status=suspended
- New markThreadCompleted(entry, status, now) function
- serializeThreadIndexEntry includes new fields

Part of #39, closes #40
2026-06-04 14:42:14 +08:00
xiaomo 3fb6da9288 Merge pull request 'refactor: unify env vars + env only in CLI (#37)' (#38) from refactor/37-env-vars into main
CI / check (push) Failing after 3m54s
refactor: unify env vars + env only in CLI (#38)
2026-06-04 05:13:21 +00:00
xiaoju 6b7636b088 refactor: unify env vars (UWF_HOME, OCAS_HOME) + env only in CLI (#37)
CI / check (pull_request) Failing after 3m6s
Breaking changes:
- UWF_STORAGE_ROOT → UWF_HOME
- WORKFLOW_STORAGE_ROOT removed (no fallback)
- OCAS_DIR → OCAS_HOME (aligned with ocas CLI)

Library functions no longer read process.env:
- util-agent/storage.ts: resolveStorageRoot(override), getGlobalCasDir(override)
- agent-hermes: isResumeDisabled(flag) pure function, CLI reads env
- agent-claude-code: CLI reads CLAUDE_MODEL and passes to agent

Fixes #37
2026-06-04 05:12:05 +00:00
xiaomo 84bdd81317 Merge pull request 'test: core module unit test coverage (#35)' (#36) from test/35-unit-test-coverage into main
CI / check (push) Failing after 1m27s
test: core module unit test coverage (#36)
2026-06-04 04:42:15 +00:00
xiaoju 06e959e7a5 test: add unit tests for core modules (#35)
CI / check (pull_request) Failing after 1m39s
Cover high-priority untested modules:
- util: base32, result, refs-field, storage-root, log-tag
- util-agent: storage (normalizeWorkflowConfig, resolveStorageRoot), run (parseArgv)
- agent-builtin: tools (read-file, write-file, run-command), session, detail

627 → 719 tests (+92), all passing.

Refs #35
2026-06-04 04:35:33 +00:00
xiaomo c3ec4ac6df Merge pull request 'chore: integrate proman scaffold' (#32) from chore/27-proman-integration into main
CI / check (push) Failing after 1m40s
chore: integrate proman scaffold (#32)
2026-06-04 03:24:02 +00:00
xiaoju 90893b0aa8 chore: integrate proman scaffold
CI / check (pull_request) Failing after 1m47s
- Add proman.yaml with 8 packages in dependency order
- Add @shazhou/proman as devDependency
- Replace root scripts: build/test/check/format → proman commands
- Keep typecheck script for standalone tsc --build

Fixes #27
2026-06-04 03:10:14 +00:00
xiaomo 7b4859594a Merge pull request 'chore: upgrade @ocas/* to ^0.3.0, migrate better-sqlite3 → node:sqlite' (#30) from chore/upgrade-ocas-0.3 into main
CI / check (push) Failing after 2m19s
chore: upgrade @ocas/* to ^0.3.0, migrate better-sqlite3 → node:sqlite (#30)
2026-06-04 02:25:43 +00:00
xiaoju d0ef2c4676 chore: upgrade @ocas/* to ^0.3.0, migrate better-sqlite3 → node:sqlite
CI / check (pull_request) Failing after 1m13s
- @ocas/core and @ocas/fs upgraded from ^0.2.2 to ^0.3.0
- agent-hermes: replace better-sqlite3 with node:sqlite (DatabaseSync)
- Remove better-sqlite3 and @types/better-sqlite3 dependencies
- Fix remaining bun references in cli test helpers (execFileSync)

Refs #28
2026-06-04 01:59:00 +00:00
xingyue b84e09099a Merge pull request 'chore: remove Bun, migrate to pnpm + Node + vitest + esbuild' (#29) from chore/26-remove-bun into main
CI / check (push) Failing after 4m34s
2026-06-03 15:15:39 +00:00
xiaoju fd33bf5ee1 fix: address PR review — await store.cas.put + bun shebang → node
CI / check (pull_request) Failing after 3m59s
- Add missing await on store.cas.put() in run.ts:192
- Replace #!/usr/bin/env bun → #!/usr/bin/env node in all CLI bins
- Update issue-551 test to assert node shebang
2026-06-03 14:58:23 +00:00
xiaoju 8cb74672bc fix: resolve remaining agent-hermes test failures
CI / check (pull_request) Failing after 12s
- Update issue-551 test: assert bun engines removed (not present)
- Migrate session-detail tests from bun:sqlite to better-sqlite3 API
  (db.exec for DDL, db.prepare().run() for inserts)

Refs #26
2026-06-03 14:39:20 +00:00
xiaoju e5e6de2fad chore: migrate from bun to pnpm + vitest + esbuild
- Replace bun:test with vitest across all packages
- Replace bun build with esbuild
- Replace bun:sqlite with better-sqlite3
- Fix OCAS Store API: store.put/get → store.cas.put/get
- Fix vitest vi.mock hoisting (vi.hoisted)
- Add pnpm-workspace.yaml and pnpm-lock.yaml
- Update all package.json test/build scripts

WIP: 8 failures remain in agent-hermes (bun engines check + sqlite migration)

Refs #26
2026-06-03 14:33:03 +00:00
xiaomo 0d93e56acd Merge pull request 'refactor: remove legacy symlink migration code' (#25) from refactor/remove-legacy-symlink-migration into main
CI / check (push) Failing after 7m35s
2026-06-02 16:28:51 +00:00
xingyue 4306935dbc refactor: remove legacy symlink migration code
CI / check (pull_request) Failing after 7m43s
Remove migrateStorageIfNeeded() which created symlinks from
~/.uncaged/workflow → ~/.uwf and ~/.uncaged/json-cas → ~/.ocas.

This was temporary migration support. Users who still have old paths
can run a one-time copy manually.

Zero 'uncaged' references remain in active codebase.
2026-06-03 00:22:13 +08:00
xiaomo ad3a292314 Merge pull request 'refactor: remove all remaining uncaged codename references' (#24) from refactor/remove-uncaged-codename into main
CI / check (push) Failing after 7m35s
2026-06-02 16:17:11 +00:00
xingyue 87b893bd28 refactor: remove all uncaged codename references
CI / check (pull_request) Failing after 8m0s
- Remove UNCAGED_CAS_DIR and UNCAGED_WORKFLOW_STORAGE_ROOT env var fallbacks
- Tests updated to use OCAS_DIR / UWF_STORAGE_ROOT
- All docs, READMEs, scripts, workflows, skills updated
- Only symlink migration code retains .uncaged paths (functional requirement)

Closes #12 (Phase 5 complete)
2026-06-03 00:08:45 +08:00
xiaomo 74750f0275 Merge pull request 'docs: update stale comments and agent prompts' (#23) from docs/update-stale-references into main
CI / check (push) Failing after 9m47s
2026-06-02 16:00:03 +00:00
xingyue e2098e7371 docs: update stale comments and prompts referencing old storage formats
CI / check (pull_request) Failing after 10m12s
- architecture-reference.ts: threads.yaml/history.jsonl/registry.yaml → variable store, storage layout updated (~/.ocas/ + ~/.uwf/)
- protocol types.ts: JSDoc comments updated
- thread-index.ts: serialization comment updated
- util-agent context.ts: buildContext JSDoc updated

Only migration code in store.ts retains old file references (needed to read legacy files).
2026-06-02 23:59:07 +08:00
xiaomo dea6ed629e Merge pull request 'refactor: align package folder names with npm package names' (#22) from refactor/align-package-folder-names into main
CI / check (push) Failing after 8m36s
2026-06-02 15:54:11 +00:00
xingyue 5970456a54 refactor: align package folder names with npm package names
CI / check (pull_request) Failing after 8m30s
Rename packages/ subdirectories to match their @united-workforce/* scope:
  cli-workflow → cli
  workflow-agent-builtin → agent-builtin
  workflow-agent-claude-code → agent-claude-code
  workflow-agent-hermes → agent-hermes
  workflow-dashboard → dashboard
  workflow-protocol → protocol
  workflow-util-agent → util-agent
  workflow-util → util

Updated all tsconfig references, scripts, and active docs.
Historical docs (docs/plans/, docs/superpowers/) left as-is.

Closes #21
2026-06-02 23:45:45 +08:00
xiaomo e4e4288d00 Merge pull request 'fix: agent CAS path mismatch (~/.uwf/cas → ~/.ocas)' (#20) from fix/agent-cas-path into main
CI / check (push) Failing after 9m48s
2026-06-02 15:20:35 +00:00
xingyue 34ce190e5f fix: agent createAgentStore uses wrong CAS path (~/.uwf/cas instead of ~/.ocas)
CI / check (pull_request) Failing after 8m23s
createAgentStore was calling getCasDir(storageRoot) which resolves to
~/.uwf/cas/, but since Phase 3 all CAS data lives in ~/.ocas/.
getActiveThreadEntry already used getGlobalCasDir() correctly, causing
a split where thread lookup succeeded but CAS node reads failed.

Found during e2e walkthrough after Phase 0-5 migration.
2026-06-02 23:19:14 +08:00
xiaomo 65b5ebc065 Merge pull request 'Phase 5: Docs branding cleanup — @uncaged → @united-workforce' (#19) from docs/phase5-branding-cleanup into main
CI / check (push) Failing after 11m21s
2026-06-02 15:07:43 +00:00
xingyue e899c11b92 docs: update branding to @united-workforce and fix stale storage references (Phase 5)
CI / check (pull_request) Failing after 8m38s
2026-06-02 23:00:11 +08:00
xiaomo 74b81fe9ba Merge pull request 'Phase 4c: Migrate thread history from JSONL to ocas variable store' (#18) from refactor/history-to-ocas-variable into main
CI / check (push) Failing after 9m31s
2026-06-02 14:54:33 +00:00
xingyue 3e12e6ebc0 refactor: migrate thread history from JSONL to ocas variable store (Phase 4c)
CI / check (pull_request) Failing after 10m39s
2026-06-02 22:53:24 +08:00
xiaomo e881e0772b Merge pull request 'refactor: migrate threads index from YAML to ocas variable (Phase 4b)' (#17) from refactor/threads-to-ocas-variable into main
CI / check (push) Failing after 10m24s
CI / check (pull_request) Failing after 10m33s
2026-06-02 14:28:17 +00:00
xingyue 93b96987a3 refactor: migrate threads index from YAML to ocas variable store (Phase 4b)
CI / check (pull_request) Failing after 12m38s
- Replace loadThreadsIndex/saveThreadsIndex with granular variable API:
  loadAllThreads, getThread, setThread, deleteThread
- Variable: @uwf/thread/<thread-id>, value=head hash, tags=suspend metadata
- Auto-migration: threads.yaml → variables, renames to .migrated
- Updated ~20 call sites in thread.ts, step.ts, shared.ts
- workflow-util-agent: getActiveThreadEntry reads from variable store
- New test helper: seedThread/seedThreads
- biome fix: removed unused imports
- 22 files changed

Ref #11
2026-06-02 22:22:38 +08:00
xiaomo 9326cc430f Merge pull request 'refactor: migrate registry from YAML to ocas variable (Phase 4a)' (#16) from refactor/registry-to-ocas-variable into main
CI / check (push) Failing after 9m24s
2026-06-02 14:06:51 +00:00
xingyue 8052473728 refactor: migrate workflow registry from YAML to ocas variable store (Phase 4a)
CI / check (pull_request) Failing after 8m40s
- UwfStore gains varStore: VariableStore (SQLite at ~/.ocas/variables.db)
- loadWorkflowRegistry reads from @uwf/registry/* variables
- saveWorkflowRegistry writes individual @uwf/registry/<name> variables
- Auto-migration: workflows.yaml → variables on first run, renames to .migrated
- Updated callers in workflow.ts and thread.ts
- Tests updated and passing

Ref #11
2026-06-02 21:58:58 +08:00
xiaomo 323bbf4d13 Merge pull request 'refactor: remove uwf cas subcommand, use ocas CLI' (#15) from refactor/remove-uwf-cas into main
CI / check (push) Failing after 9m21s
2026-06-02 13:45:48 +00:00
xingyue 1aacf11ad9 refactor: remove uwf cas subcommand, use ocas CLI
CI / check (pull_request) Failing after 9m57s
- Remove entire 'uwf cas' command group from CLI
- Delete commands/cas.ts (only used by CLI + tests)
- Delete cas.test.ts and cas-exit-code.test.ts
- Update workflow YAMLs: uwf cas get/has/refs/walk → ocas
- Update e2e-walkthrough script to use ocas
- Update docs and reference files
- Keep store-global-cas.test.ts (internal CAS store tests)

CAS operations now go through 'ocas' CLI exclusively.
Agent text storage handled internally by uwf pipeline.

Closes #10
2026-06-02 21:30:59 +08:00