Skip to content

refactor(appkit): relocate shared agent utilities into plugins/agents#296

Closed
MarioCadenas wants to merge 1 commit intoagent/5c-migrate-agent-app-docsfrom
agent/5d-relocate-shared-agent-files
Closed

refactor(appkit): relocate shared agent utilities into plugins/agents#296
MarioCadenas wants to merge 1 commit intoagent/5c-migrate-agent-app-docsfrom
agent/5d-relocate-shared-agent-files

Conversation

@MarioCadenas
Copy link
Copy Markdown
Collaborator

@MarioCadenas MarioCadenas commented Apr 21, 2026

Summary

Mechanical move: with the new agents() plugin as the canonical home for all agent-related runtime code, the pre-existing shared utilities that lived in the old plugins/agent/ (singular, deprecated) folder move into plugins/agents/ (plural).

Files moved:

  • defaults.ts, event-translator.ts, schemas.ts, system-prompt.ts, thread-store.ts
  • Entire tools/ subfolder (tool.ts, define-tool.ts, function-tool.ts, hosted-tools.ts, mcp-client.ts)
  • build-toolkit.ts

Plus the associated test files.

Import paths updated across all call sites. Public exports in packages/appkit/src/index.ts and packages/appkit/src/plugins/agents/index.ts re-point at the new locations. No behavior change.

The old plugins/agent/ folder still exists in this branch — it's deleted in PR #299 once all consumers have migrated off createAgentApp.

PR Stack

  1. Shared types + Adapters — feat(appkit): add shared agent types and LLM adapter implementations #282
  2. Tool types + MCP client — feat(appkit): add FunctionTool, HostedTool types and MCP client #283
  3. Agent plugin core + ToolProvider implementations — feat(appkit): add agent plugin core and ToolProvider implementations #284
  4. PluginContext mediator — feat(appkit): add PluginContext mediator for inter-plugin communication #285
  5. createAgent + agent-app + docs (v1) — feat(appkit): add createAgent wrapper, agent-app, and API docs #286
  6. Plugin context-binding separation — refactor(appkit): separate plugin context binding from plugin construction #293
  7. agents() plugin + createAgent(def) + .toolkit()feat(appkit): add agents() plugin, createAgent() factory, and .toolkit() #294
  8. agent-app + docs migrated to agents()feat(appkit): migrate agent-app and docs to the new agents() plugin #295
  9. Relocate shared agent utilities (this PR)
  10. preparePlugins forwards eager instance — refactor(appkit): forward eager plugin instance through preparePlugins #297
  11. fromPlugin() API — feat(appkit): add fromPlugin() for referencing plugin tools in code-defined agents #298
  12. Retire deprecated agent() + createAgentAppchore(appkit): remove deprecated agent() plugin and createAgentApp shortcut #299
  13. Retire toPluginWithInstance + bug fixes — refactor(appkit): retire toPluginWithInstance; consolidate on fromPlugin + fix schema/routing bugs #300

Test plan

  • All 1300+ tests pass with updated import paths
  • Typecheck clean
  • Build clean

The plugins/agent/ folder contained a mix of deprecated surface (the old
AgentPlugin + its config-loader) and still-current shared infrastructure
that the new agents() plugin imports directly. The folder name stopped
making sense once agent() was deprecated: readers couldn't tell which
files are deprecated vs. core.

Move the currently-used files under plugins/agents/ so the new plugin
colocates with its dependencies:

- plugins/agent/defaults.ts         -> plugins/agents/defaults.ts
- plugins/agent/event-translator.ts -> plugins/agents/event-translator.ts
- plugins/agent/schemas.ts          -> plugins/agents/schemas.ts
- plugins/agent/system-prompt.ts    -> plugins/agents/system-prompt.ts
- plugins/agent/thread-store.ts     -> plugins/agents/thread-store.ts
- plugins/agent/tools/              -> plugins/agents/tools/
- plugins/agent/tests/{event-translator,system-prompt,thread-store,
  function-tool,hosted-tools,tool,define-tool,mcp-server-helper}.test.ts
  -> plugins/agents/tests/

Used `git mv` so blame and history follow the files. Callers updated:

- plugins/agents/ siblings: `../agent/X` -> `./X`
- plugins/agent/agent.ts (still deprecated, needs the shared modules):
  `./X` -> `../agents/X`
- plugins/agent/types.ts: `./tools/X` -> `../agents/tools/X`
- analytics/files/genie/lakebase plugin files:
  `../agent/tools/define-tool` -> `../agents/tools/define-tool`
- core/create-agent.ts, core/run-agent.ts: likewise
- main index.ts re-exports: `./plugins/agent/tools` -> `./plugins/agents/tools`

Also update template/appkit.plugins.json (consumed by `databricks apps
init --features ...`) so picking the agent feature scaffolds the new
agents() plugin instead of the deprecated agent() factory: key renamed
`agent` -> `agents`, name field matched. The Go template at
template/server/server.ts expands $name into the import symbol and
factory call, so this propagates cleanly.

Tests updated: `../../agent/tools/X` -> `../tools/X` inside agents tests.

Left in plugins/agent/ (deprecated, untouched semantically): agent.ts,
types.ts, config-loader.ts, manifest.json, index.ts, tests/agent.test.ts,
tests/config-loader.test.ts. These only exist to keep the @deprecated
exports from the main index valid during the migration window.

No behavior change. 1301 tests still pass; `pnpm -r typecheck` clean.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
Copy link
Copy Markdown
Collaborator Author

Superseded by the v2 6-PR stack:

  1. Shared agent types + LLM adapters — feat(appkit): shared agent types and LLM adapter implementations #301
  2. Tool primitives + ToolProvider surfaces — feat(appkit): tool primitives and ToolProvider surfaces on core plugins #302
  3. Plugin infrastructure (attachContext + PluginContext) — feat(appkit): plugin infrastructure — attachContext + PluginContext mediator #303
  4. agents() plugin + createAgent(def) + markdown-driven agents — feat(appkit): agents() plugin, createAgent(def), and markdown-driven agents #304
  5. fromPlugin() DX + runAgent plugins arg + toolkit-resolver — feat(appkit): fromPlugin() DX, runAgent plugins arg, shared toolkit-resolver #305
  6. Reference app + dev-playground + docs — feat(appkit): reference agent-app, dev-playground chat UI, docs, and template #306

The v2 stack reorganizes the same work so no PR ships API that a later PR deletes. Start at #301 for the new entry point. Branches from this older stack are preserved unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant