Commit Graph

535 Commits

Author SHA1 Message Date
xiaoju c040a90a8f feat: add @uncaged/workflow-agent-react package (#222) 2026-05-13 02:38:38 +00:00
xiaoju ec4599a230 refactor: extract wrapAgentAsAdapter to util-agent, support childThread in RoleFn (#222) 2026-05-13 02:37:32 +00:00
xiaoju bebf4aad45 feat(protocol): add AdapterFn/RoleFn/AdapterBinding, refactor createWorkflow to use AdapterBinding (#222)
- Add RoleFn<T>, AdapterFn, AdapterBinding types to workflow-protocol
- Mark AgentFn, AgentFnResult, AgentBinding as @deprecated
- Refactor createWorkflow to accept AdapterBinding instead of AgentBinding
- Adapter returns typed meta directly — no more extract call in workflow loop
- Add buildThreadInput (ThreadContext-based), keep buildAgentPrompt as deprecated wrapper
- Update template bundle-entries to wrap AgentFn as AdapterFn
- Update solve-issue tests to use AdapterFn directly
2026-05-13 02:27:36 +00:00
xingyue 2698e0a6cb fix(setup): add GLM international endpoint (api.z.ai) 2026-05-13 09:52:07 +08:00
xingyue 47f2b1a128 fix(setup): address code review issues (#221)
- Fix resolve variable shadowing in promptSecret (rename to fulfill)
- Fix readline leak on invalid choice (close before returning err)
- Remove Anthropic/Gemini from presets (not OpenAI-compatible)
- Fix GLM URL: api.z.ai → open.bigmodel.cn
- Restore terminal raw mode before process.exit on Ctrl+C
- Add debug logging to fetchAvailableModels failures
- Add comment explaining DashScope-specific model filter patterns
- Move PresetProvider and CmdSetupSuccess types to types.ts per convention
2026-05-13 09:43:57 +08:00
xingyue 0c02cb7574 chore: publish v0.3.5
小橘 <xiaoju@shazhou.work>
2026-05-13 09:34:41 +08:00
xingyue 320810ec25 fix(cli-workflow): workspace path accepts relative/absolute paths with retry
- cmdInitWorkspace now resolves full paths via resolve() instead of
  requiring a single segment name
- mkdir uses recursive: true for nested paths (e.g. ./a/b/workflows)
- Setup interactive prompt retries on existing directory instead of exiting
- Update tests: nested paths are now valid, add accepts-nested-path test
2026-05-13 09:30:41 +08:00
xingyue 91f585c534 feat(cli-workflow): numbered model selection in setup
- Show available models with numbered labels in multi-column layout
- User can pick by number or type model name directly
- Print selected model with arrow confirmation
2026-05-13 09:25:00 +08:00
xingyue 299ff126d9 feat(cli-workflow): preset provider selection in setup
- Add providers.yaml with 18 preset providers (international + China + local)
- Add preset-providers.ts to load and cache YAML presets
- Refactor interactive setup to show numbered provider list
- Only prompt for manual name/URL when choosing Custom
- YAML-driven: add new providers without code changes
2026-05-13 09:19:30 +08:00
xingyue 931eb81458 fix(setup): default workspace to ./workflows when left empty
Enter = use default ./workflows. Type 'skip' to skip.
2026-05-12 22:32:01 +08:00
xingyue c604d1f600 fix(setup): simplify model prompt — just ask for model name
Provider is already known from the first step, so prompt simply
asks 'Default model:' and auto-prepends provider/ prefix.
2026-05-12 22:28:35 +08:00
xingyue 20bcc65f61 fix(setup): auto-prefix provider on model input
Users can now type bare model names (e.g. 'qwen-plus') or paste
model IDs with vendor prefixes (e.g. 'MiniMax/MiniMax-M2.7') —
the provider prefix is normalised automatically.
2026-05-12 22:27:07 +08:00
xingyue f5612ef1b5 fix(setup): filter non-chat models and display in multi-column layout
Filter out speech/embed/image/video/audio/tts/asr/ocr/rerank models
from the /models listing. Display remaining models in a responsive
multi-column grid that adapts to terminal width.
2026-05-12 22:09:13 +08:00
xingyue a92deeaf3f fix(setup): mask each character when pasting API key
Raw mode receives pasted text as a single chunk. Iterate
per-character so every char gets a '*'. Also fix backspace
to erase the visual '*' from the terminal.
2026-05-12 22:03:48 +08:00
xingyue 1e936cf04a fix: improve setup interactive UX
1. Mask API key input with * characters (raw mode)
2. Fetch and list available models from provider /models endpoint
3. Workspace prompt: fill path directly (default skip), not y/n
4. Add .gitkeep to workflows/ in init workspace scaffold
2026-05-12 21:44:21 +08:00
xingyue ea16057803 fix: improve setup interactive prompts with context and examples
- Add intro line explaining what's being configured
- Provider: explain it's a label for the LLM service
- Base URL: explain it's OpenAI-compatible, show examples
- API key: clarify it's for this provider
- Default model: show format with dynamic provider name
- Workspace prompt: clearer wording
2026-05-12 20:52:42 +08:00
xingyue 4493fd8979 chore: publish v0.3.4
小橘 <xiaoju@shazhou.work>
2026-05-12 20:35:02 +08:00
xingyue 0ad5c85f5a chore: address #219 review comments
- Add comment explaining biome.json scripts/bundle.ts exclusion
- Add note about readline API key visibility limitation
2026-05-12 20:27:27 +08:00
xingyue cdf3c95622 feat: add setup command for provider/model config (#216 Phase 2)
New command: uncaged-workflow setup

CLI mode (agent-friendly):
  uncaged-workflow setup \
    --provider <name> --base-url <url> --api-key <key> \
    --default-model <provider/model> [--init-workspace <name>]

Interactive mode: prompts for each value when no flags given.

- Reads/writes workflow.yaml config section
- Idempotent: updates provider without losing workflows
- Sets maxDepth=3, supervisorInterval=3 on fresh config
- Optional --init-workspace creates workspace in cwd

Testing: #218
Ref: #216
2026-05-12 20:18:23 +08:00
xingyue a7fea10383 feat: init workspace generates bundle script (#216 Phase 1)
- Add scripts.bundle to generated package.json
- Generate scripts/bundle.ts that scans workflows/*-entry.ts,
  uses Bun.build() to produce dist/*.esm.js + dist/*.d.ts
- External: @uncaged/workflow-* packages (per bundle contract)
- Add tests for new scaffold files

Testing: #217
Ref: #216
2026-05-12 20:09:41 +08:00
xingyue 3846dc12a9 chore: bump all public packages to 0.3.3 2026-05-12 12:58:17 +08:00
xingyue c5fd84432f fix(agent): defer config validation to call time
Bundle top-level code runs during `workflow add` (descriptor extraction),
but agent config env vars (e.g. WORKFLOW_HERMES_COMMAND) are only available
at `workflow run` time. Deferring validation prevents premature throws.
2026-05-12 12:58:06 +08:00
xingyue 4c4dabb7a3 chore: bump all public packages to 0.3.2 2026-05-12 12:55:21 +08:00
xingyue 1b62cec0a2 feat(agent): require absolute path for command in hermes/cursor agent configs
BREAKING: HermesAgentConfig.command and CursorAgentConfig.command are now
required string fields (absolute path to CLI binary). Validation rejects
non-absolute paths at construction time.

- Eliminates PATH resolution ambiguity in spawned worker processes
- spawnCli: explicit env: process.env for clarity
- bundle-entry: WORKFLOW_CURSOR_COMMAND is now required
- Updated tests for both agents
2026-05-12 12:52:48 +08:00
xingyue ecc348f182 feat(agent): add command config to hermes/cursor agents + explicit env inheritance
- HermesAgentConfig.command: override hermes CLI path (default: "hermes")
- CursorAgentConfig.command: override cursor-agent CLI path (default: "cursor-agent")
- spawnCli: explicit env: process.env for clarity and future extensibility
- bundle-entry: read WORKFLOW_CURSOR_COMMAND from env
2026-05-12 12:49:28 +08:00
xingyue bbb79f821e feat(init): generate bunfig.toml with Gitea scoped registry + fix versions
- init workspace now generates bunfig.toml pointing @uncaged scope to Gitea
- Fix template versions: "*" → "^0.3.1" (packages are now published)
2026-05-12 11:31:41 +08:00
xingyue 0fbbf37548 chore(cli): add bun run link scripts + fix init template versions
- Add link/link:consume/link:unlink scripts to root package.json
- Document cross-repo bun link workflow in CLAUDE.md
- Fix hardcoded @uncaged/workflow-runtime "^0.1.0" → "*" in
  init workspace and init template scaffolds (actual version is 0.3.x)
2026-05-12 11:03:12 +08:00
xingyue aadec0b96c feat: WorkflowList expandable cards with static graph (#198)
- Workflow cards click to expand/collapse
- Lazy-load descriptor on first expand
- Static WorkflowGraph (all nodes default state, no highlighting)
- Show description, version count, hash
- Fix WorkflowSummary type to match actual API response
2026-05-12 10:53:49 +08:00
xiaomo 1c68ce6217 Merge pull request 'feat: Phase 3 — agent observability for Merkle call stack' (#203) from feat/197-agent-observability into main 2026-05-12 02:34:47 +00:00
xingyue 7265603b55 feat: click graph node to scroll and highlight RecordCard (#198 Phase 3) 2026-05-12 10:34:06 +08:00
xiaoju 74cea09ac0 fix: bundle validator accepts Identifier init and wildcard @uncaged/workflow-* imports
- bindingInitializerIsCallable: accept Identifier (e.g. var run = wf)
- import allowlist: startsWith('@uncaged/workflow') instead of exact match list

小橘 🍊(NEKO Team)
2026-05-12 02:33:28 +00:00
xingyue b1e66fa7a4 fix: use async/await instead of .then() in getWorkflowDescriptor 2026-05-12 10:29:50 +08:00
xiaomo 81a7a8c7c1 Merge pull request 'feat: Dashboard workflow graph visualization (React Flow)' (#204) from feat/198-dashboard-workflow-graph into main 2026-05-12 02:28:40 +00:00
xingyue 9cb7d68abe feat: Dashboard workflow graph visualization with React Flow (#198)
Phase 1: API + static graph rendering

Backend:
- GET /workflows/:name now returns descriptor (with graph) from bundle YAML
- Graceful fallback to null if YAML missing/invalid

Frontend:
- New workflow-graph/ component module (7 files)
- React Flow + dagre auto-layout (TB direction)
- Custom nodes: RoleNode (rounded rect) + TerminalNode (circle for START/END)
- Custom edges: dashed for FALLBACK, solid with label for conditions
- Self-loop edges supported (e.g. coder → coder)
- Node states: default/completed/active with color-coded borders
- Active node pulse animation
- Collapsible graph panel (300px) above thread records
- Dark theme using existing CSS variables

Integration:
- ThreadDetail extracts workflow name → fetches descriptor → computes node states → renders graph
- Node states derived from ThreadRecord[] (completed/active/default)
2026-05-12 10:27:07 +08:00
xiaoju 98122b446d feat: Phase 3 — agent observability for Merkle call stack
- StartStep gains parentState: string | null (from StartNodePayload)
- buildAgentPrompt injects Parent Context section when parentState is set
- CLI thread show outputs parentState (top-level) and childThread (per step)
- 2 new prompt tests + thread show assertion updates

Refs #197, #194

小橘 🍊(NEKO Team)
2026-05-12 02:23:15 +00:00
xiaoju 4a31cf9d63 fix: workflowAsAgent error paths return AgentFnResult instead of plain string
Nit from PR #202 review — all error returns now use { output, childThread: null }
for type consistency with the success path.

小橘 🍊(NEKO Team)
2026-05-12 02:15:06 +00:00
xiaomo f723daa014 Merge pull request 'feat(#194): Phase 2 — Engine layer Merkle call stack' (#202) from feat/194-merkle-call-stack-phase2 into main 2026-05-12 02:11:24 +00:00
xiaoju 1e9900bed3 feat(#194): Phase 2 — Engine layer Merkle call stack wiring
- Protocol: AgentFnResult = string | { output, childThread }, RoleOutput.childThread,
  ThreadContext.bundleHash for parent state lookup
- Runtime: create-workflow normalizes AgentFnResult, propagates childThread in RoleOutput
- Engine: ExecuteThreadOptions.parentStateHash, appendStateForStep writes childThread,
  putStartNode uses parentStateHash
- workflowAsAgent: reads parent head state from threads.json, passes parentStateHash
  to child, returns { output, childThread: rootHash }
- Integration test: 4 cases verifying bidirectional Merkle links (306 lines)

Phase 2 of #194 (Merkle Call Stack). Closes #196.

小橘 <xiaoju@shazhou.work>
2026-05-12 02:10:06 +00:00
xiaomo aebff8b906 Merge pull request 'refactor: replace Moderator function with ModeratorTable in WorkflowDefinition' (#201) from refactor/200-moderator-table into main 2026-05-12 02:06:03 +00:00
xingyue db45089922 refactor: replace Moderator function with ModeratorTable in WorkflowDefinition (#200)
- WorkflowDefinition.moderator → WorkflowDefinition.table (ModeratorTable)
- Moderator type + tableToModerator no longer exported from protocol/runtime
- tableToModerator internalized in workflow-execute engine layer
- WorkflowDescriptor gains graph: WorkflowGraph (auto-extracted from table)
- buildDescriptor extracts serializable graph edges from ModeratorTable
- validateWorkflowDescriptor validates graph structure
- All templates (develop, solve-issue) export table directly
- CLI init scaffold updated to use ModeratorTable
- 99 tests pass, 0 failures
2026-05-12 10:01:30 +08:00
xiaoju a98431a12a feat(#194): Phase 1 — parentState / childThread in CAS nodes
- Protocol: StartNodePayload.parentState, StateNodePayload.childThread
- CAS: putStartNode refs include parentState, collectRefs includes childThread
- Parsing: legacy nodes without new fields default to null
- Engine + fork: all callers pass parentState: null / childThread: null
- Tests: 8 new cases for refs, parsing, collect-refs (+208 lines)

Phase 1 of #194 (Merkle Call Stack). Closes #195.

小橘 <xiaoju@shazhou.work>
2026-05-12 01:42:10 +00:00
xiaoju e37dbc3f35 wip: Phase 1 protocol + CAS types for Merkle call stack
小橘 <xiaoju@shazhou.work>
2026-05-12 01:35:45 +00:00
xiaoju 50aec2d0cf fix: use unique log tags per call site in extract-workspace
W8KN3QYT — extraction failed
H4PM7RXV — non-absolute path
V3KM8QWP — success

小橘 <xiaoju@shazhou.work>
2026-05-12 00:58:37 +00:00
xiaoju 30f1582046 fix: address review feedback on cursor agent PR
1. Replace manual OpenAI response parsing with createThreadReactor —
   workspace extraction now uses the same ReAct loop as extract/summarizer,
   with a zod schema and structured tool call
2. Remove non-null assertion on llmProvider, replaced with explicit guard
3. Add structured logging (LogFn) to extraction — failures, non-absolute
   paths, and successful extractions all logged with tag V3KM8QWP
4. export const run = wf is correct: createWorkflow returns WorkflowFn
   directly, old bundle-entry had stale .run access + unused 3rd arg

小橘 <xiaoju@shazhou.work>
2026-05-11 14:05:01 +00:00
xiaoju cf0540d7fa fix: stabilize kill-thread test by polling instead of fixed delay
Replace 50ms setTimeout with waitUntilPredicate polling for first role
completion before issuing kill. Same pattern used by pause/resume test.

小橘 <xiaoju@shazhou.work>
2026-05-11 13:56:14 +00:00
xiaoju c05fac746c feat: cursor agent auto-extracts workspace from context via LLM
- workflow-agent-cursor: workspace config now optional (string | null)
- When null, uses LLM call to extract workspace path from AgentContext
  (previous steps' meta, start prompt) before spawning cursor-agent CLI
- Requires llmProvider when workspace is null
- develop bundle-entry: switched from hermes to cursor agent for all roles
- solve-issue bundle-entry: created, developer role uses workflowAsAgent('develop'),
  preparer/submitter remain hermes

小橘 <xiaoju@shazhou.work>
2026-05-11 13:51:41 +00:00
xiaoju f87cb38a67 fix: review — stable sort fallback, cleaner status colors
- Sort: threads without startedAt pushed to bottom (not random)
- Colors: completed=success(green), running/active=accent(blue), failed=error(red)
- Remove opacity hack, simplify ternary

小橘 <xiaoju@shazhou.work>
2026-05-11 12:14:51 +00:00
xiaoju 0970139418 fix: sort thread list newest-first and differentiate status colors
- Sort threads by startedAt descending (newest first)
- completed: green (dimmed) — distinct from running (green, full opacity)
- active: accent color (blue) — was same muted gray as completed
- failed: red — unchanged
- running: green — unchanged

Fixes #191
2026-05-11 12:09:48 +00:00
xiaoju 376dd87b6b chore: bump to v0.3.1, fix workspace:* in published packages
v0.3.0 was published with workspace:* deps (npm doesn't resolve them).
Re-published as v0.3.1 with concrete version refs.
Local monorepo deps restored to workspace:*.

小橘 <xiaoju@shazhou.work>
2026-05-11 11:00:49 +00:00
xiaoju 4d8469a649 chore: bump all packages to v0.3.0
Published to Gitea npm registry (git.shazhou.work).

小橘 <xiaoju@shazhou.work>
2026-05-11 10:52:35 +00:00