fix(amp): update hook plugin api
Description
- update amp hook plugin to current
PluginAPI - remove obsolete WIP comment
- hook is unchaged otherwise
docs: https://ampcode.com/manual/plugin-api
Checklist
- [X] I kept this PR small and focused
- [X] I ran a self-review before opening this PR
- [X] I ran the relevant local checks or explained why not
- [X] I updated docs when behavior or setup changed
- [X] I added or updated tests when behavior changed, or explained why not
- [X] I only added comments where the logic is not obvious
- [X] I used Conventional Commits for commit messages and, when possible, the PR title
Greptile Summary
Updates the Amp hook plugin to use the official PluginAPI type from @ampcode/plugin instead of the hand-rolled AmpPluginAPI inline type, and removes the now-stale WIP suppression comment. The hook logic itself (agent.start / agent.end → notifyEmdash) is unchanged.
- The local type definition and
// @i-know-the-amp-plugin-api-is-wip-and-very-experimental-right-nowcomment are removed and replaced withimport type { PluginAPI } from '@ampcode/plugin'. - Because this is a type-only import (
import type), Bun strips it completely at runtime when Amp executes the plugin, so no new runtime dependency is added to the host environment.
Confidence Score: 5/5
Safe to merge — the hook logic is untouched and the only change is swapping a locally-defined type for the upstream official one.
The diff is a mechanical type-definition swap: a hand-rolled AmpPluginAPI type and its WIP suppression comment are replaced with import type { PluginAPI } from '@ampcode/plugin'. Because it is a type-only import, Bun strips it entirely at runtime when Amp executes the plugin file, so no new runtime dependency is introduced. The notifyEmdash logic, event names, and handler signatures are all unchanged.
No files require special attention.
Important Files Changed
| Filename | Overview |
|---|---|
| packages/plugins/src/agents/impl/amp/plugin-file.ts | Replaces an inline local AmpPluginAPI type definition and WIP comment with import type { PluginAPI } from '@ampcode/plugin'; the import type is erased by Bun at runtime so no runtime dependency is introduced. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant E as Emdash
participant A as Amp (Bun runtime)
participant P as emdash-hook.ts plugin
E->>E: createFileDropPlugin writes AMP_PLUGIN_CONTENT to .amp/plugins/emdash-hook.ts
note over P: import type { PluginAPI } erased by Bun at load time
A->>P: load plugin, call default(amp: PluginAPI)
A->>P: fire agent.start
P->>E: "POST /hook (eventType=start)"
A->>P: fire agent.end
P->>E: "POST /hook (eventType=stop)"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant E as Emdash
participant A as Amp (Bun runtime)
participant P as emdash-hook.ts plugin
E->>E: createFileDropPlugin writes AMP_PLUGIN_CONTENT to .amp/plugins/emdash-hook.ts
note over P: import type { PluginAPI } erased by Bun at load time
A->>P: load plugin, call default(amp: PluginAPI)
A->>P: fire agent.start
P->>E: "POST /hook (eventType=start)"
A->>P: fire agent.end
P->>E: "POST /hook (eventType=stop)"
Reviews (1): Last reviewed commit: "fix(amp): update hook plugin api" | Re-trigger Greptile