refactor(workflow-protocol): require AgentFn Opt generic #284

Merged
xiaomo merged 1 commits from refactor/agent-fn-required-opt into main 2026-05-16 10:27:08 +00:00
Owner

Summary

  • AgentFn<Opt> 不再支持 void 默认与条件重载,统一为 (ctx, options) => Promise<string>
  • createAgentAdapter 去掉多余的类型断言;删除仅用于 AgentFn<void>createSimpleAgentAdapter
  • 恢复 buildAgentPromptvalidateHermesAgentConfigvalidateCursorAgentConfig 的 package 导出(测试与 README 依赖)。
  • CLI 集成测试 fixture 改用 options.cas.put(),避免 bundle 校验拒绝 @uncaged/* import。
  • 顺带修复 worker.ts 格式化与 workflow-runtime 导出排序(bun run check)。

Test plan

  • bun test — 211 pass
  • bun run check — tsc + biome + log tags
## Summary - `AgentFn<Opt>` 不再支持 `void` 默认与条件重载,统一为 `(ctx, options) => Promise<string>`。 - `createAgentAdapter` 去掉多余的类型断言;删除仅用于 `AgentFn<void>` 的 `createSimpleAgentAdapter`。 - 恢复 `buildAgentPrompt`、`validateHermesAgentConfig`、`validateCursorAgentConfig` 的 package 导出(测试与 README 依赖)。 - CLI 集成测试 fixture 改用 `options.cas.put()`,避免 bundle 校验拒绝 `@uncaged/*` import。 - 顺带修复 `worker.ts` 格式化与 `workflow-runtime` 导出排序(`bun run check`)。 ## Test plan - [x] `bun test` — 211 pass - [x] `bun run check` — tsc + biome + log tags
scottwei added 1 commit 2026-05-16 10:23:17 +00:00
Make AgentFn<Opt> always take a mandatory options argument, removing
the void conditional overload. Simplify createAgentAdapter, restore
exports needed by tests, and fix CLI test bundles to use cas.put
instead of disallowed @uncaged/* imports.

Co-authored-by: Cursor <cursoragent@cursor.com>
xiaomo approved these changes 2026-05-16 10:27:06 +00:00
xiaomo left a comment
Owner

LGTM

  • 测试 fixtures 统一 cas.put() API,不再 import workflow-cas
  • 回补 #283 过度收敛的几个 export
  • AgentFn<Opt> 去掉 conditional type,删除 createSimpleAgentAdapter,类型更简洁

Minor nit: cas.put( "x") 多处括号后多了个空格,不 blocking。

LGTM ✅ - 测试 fixtures 统一 `cas.put()` API,不再 import workflow-cas - 回补 #283 过度收敛的几个 export - `AgentFn<Opt>` 去掉 conditional type,删除 `createSimpleAgentAdapter`,类型更简洁 Minor nit: `cas.put( "x")` 多处括号后多了个空格,不 blocking。
xiaomo merged commit 9f6633d5bf into main 2026-05-16 10:27:08 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#284