Commit e136d9f
authored
refactor: split call-actor into default/openai variants (#474)
* refactor: split call-actor into default/openai variants
Extract the mode-specific branches from actor.ts into:
- default/call-actor.ts — sync execution, full results, text response
- openai/call-actor.ts — forced async, widget metadata, abbreviated text
Shared args schema, MCP tool handling, actor validation, and pre-execution
pipeline extracted to core/call-actor-common.ts. The original file becomes
a thin adapter dispatching based on uiMode, preserving existing exports
(callActor, getCallActorDescription, callActorGetDataset, getActorsAsTools).
* refactor: move tools to common/openai dirs and freeze all tool definitions (Phase A) (#476)
* refactor: move mode-independent tools to common/, openai-only tools to openai/, and freeze all tool definitions
Move 11 mode-independent tool files to src/tools/common/ and 2 openai-only
internal tools to src/tools/openai/. Wrap all ~30 tool definitions with
Object.freeze() to prevent accidental mutation (e.g., Skyfire augmentation
of shared objects). The existing Skyfire code path in upsertTools() already
clones tools before mutation, so freezing originals is safe.
* refactor: add buildCategories(uiMode) and CATEGORY_NAMES (Phase B1) (#477)
* refactor: add buildCategories(uiMode) function and CATEGORY_NAMES const array
Introduce buildCategories(uiMode?) that returns mode-resolved tool variants
directly (openai tools in openai mode, default tools otherwise), eliminating
the need for runtime adapter dispatch. The same category names are used in
both modes — only the tool implementations differ.
- Add CATEGORY_NAMES const array as the single source of truth for category names
- Add ToolCategoryMap type derived from CATEGORY_NAMES
- Add buildCategories() function with mode-specific tool resolution
- Change ToolCategory type to derive from CATEGORY_NAMES instead of keyof typeof toolCategories
- Mark static toolCategories as @deprecated (will be removed when tools-loader migrates)
- Add compile-time satisfies checks via ToolCategoryMap type annotation
- Add unit tests for buildCategories: mode variants, circular-init safety, ordering
* refactor: switch tools-loader to buildCategories(uiMode), remove deep-clone hack (Phase B2) (#478)
* refactor: switch tools-loader to buildCategories(uiMode), remove deep-clone hack
Refactor loadToolsFromInput() to use buildCategories(uiMode) instead of the
static toolCategories map. This eliminates three legacy workarounds:
1. Deep-clone hack (JSON.parse/stringify with function stripping/reattachment)
— no longer needed since buildCategories() returns the correct variant directly
and tool definitions are frozen (Object.freeze from PR #4)
2. openaiOnly runtime filter — no longer needed since buildCategories() returns
ui: [] in default mode (openai-only tools are never included)
3. call-actor description mutation — no longer needed since each mode variant
has its own description baked in
Also:
- Add two-level internal tool name classification: mode-specific map for selection,
all-names set for preventing misclassification as Actor IDs
- Remove openaiOnly from internal tool definitions (no longer used for filtering)
- Deprecate openaiOnly in ToolBase type (kept for cross-repo compat)
- Remove dead getCallActorDescription() function
- Deprecate callActor adapter in actor.ts
* refactor: remove adapter files, wire direct tool variants (Phase B3) (#479)
* refactor: remove adapter files, use direct tool variants in categories
Remove the runtime-dispatching adapter layer now that buildCategories(uiMode)
resolves the correct tool variants at build time:
- Delete src/tools/actor.ts (call-actor adapter)
- Delete src/tools/store_collection.ts (search-actors adapter)
- Delete src/tools/fetch-actor-details.ts (fetch-actor-details adapter)
- Remove get-actor-run adapter from common/run.ts (keep mode-independent tools)
- Update categories.ts to use default variants directly in static toolCategories
- Update tools/index.ts to import from core modules instead of adapter
* refactor: split server-instructions into common/default/openai (Phase C) (#480)
* refactor: split server-instructions into common/default/openai modules
Split the monolithic server-instructions.ts into mode-specific modules:
- common.ts: shared instruction text (Actor overview, storage, disambiguation)
- default.ts: default mode instructions (references fetch-actor-details)
- openai.ts: UI mode instructions (workflow rules, internal tool disambiguation)
- index.ts: getServerInstructions(uiMode) selector
This eliminates if/else branching in the instructions builder. Adding a new
mode requires only a new file (e.g., anthropic.ts) and a case in index.ts.
* test: add mode-contract tests for tool separation (PR #9) (#481)
* test: add mode-contract tests for tool separation verification
* refactor: extract Skyfire augmentation and add unit tests (PR #10) (#482)
* refactor: extract Skyfire augmentation into pure function and add unit tests
- Extract applySkyfireAugmentation() from upsertTools() inline logic into src/utils/tools.ts
- Simplify upsertTools() to a 4-line loop delegating to the pure function
- Remove unused SKYFIRE_* imports from server.ts
- Add 35 unit tests covering eligibility, idempotency, frozen originals, and function preservation
* refactor: rename all files from kebab-case to snake_case (#489)
* refactor: rename all files from kebab-case to snake_case
Use git mv to rename all source files (src/, tests/, evals/, res/, scripts/)
from kebab-case to snake_case naming convention. Import paths are not yet
updated and will be fixed in the next commit.
* refactor: update all imports and references to use snake_case filenames
Fix all import paths, package.json exports/scripts, and documentation
references to match the renamed snake_case files. Add explicit NEVER
use kebab-case rule to AGENTS.md naming conventions.
* refactor: enforce one-file-per-tool in common/ directory (#491)
* refactor: split common/ multi-tool files into one file per tool
- dataset.ts → get_dataset.ts, get_dataset_items.ts, get_dataset_schema.ts
- key_value_store.ts → get_key_value_store.ts, get_key_value_store_keys.ts, get_key_value_store_record.ts
- run.ts → get_actor_run_log.ts, abort_actor_run.ts
- helpers.ts → add_actor.ts (renamed to match tool name)
* refactor: replace duplicated tool categories with unified mode-aware resolver (#494)
Replace buildCategories() + static toolCategories duplication with a single
unified category definition using mode-aware entries (ModeMap) and a generic
getCategoryTools(mode) resolver.
Key changes:
- Add ServerMode type ('default' | 'openai') as string union, normalize once
at server construction via options.uiMode ?? 'default'
- Replace ternary mode dispatch with Record<ServerMode, ...> map lookups
(actorExecutorsByMode, instructionsByMode)
- Add parseUiMode() boundary validator for untrusted input (URL params, env vars)
- Make mode required in all tool-resolving functions to prevent wrong-mode bugs
- Keep mode out of invariant functions (getExpectedToolNamesByCategories,
getUnauthEnabledToolCategories, isApiTokenRequired) that never branch on mode
- Add contract test enforcing tool name invariance across modes1 parent 180112f commit e136d9f
File tree
127 files changed
+2473
-1452
lines changed- evals
- workflows
- res
- scripts
- src
- actor
- mcp
- prompts
- resources
- tools
- common
- core
- default
- openai
- utils
- server-instructions
- tests
- integration
- unit
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
127 files changed
+2473
-1452
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
File renamed without changes.
File renamed without changes.
0 commit comments