Skip to content

feat(sdk): add plugin management endpoints#71

Merged
kerem-acer merged 2 commits into
mainfrom
feat/plugin-endpoints
Jun 8, 2026
Merged

feat(sdk): add plugin management endpoints#71
kerem-acer merged 2 commits into
mainfrom
feat/plugin-endpoints

Conversation

@kerem-acer

Copy link
Copy Markdown
Contributor

Adds a typed PluginsClient + contracts to @insurup/sdk / @insurup/contracts, covering the full backend plugin-management surface so the CLI (and any consumer) can install, configure, and observe server-side plugins.

What's added

@insurup/contracts (src/plugins.ts)

  • Enums: PluginHook (events 0–16 + sync hooks at 100k/200k/300k), PluginRuntimeType (JavaScriptJint = 1), PluginOutcome (Ok/Faulted/TimedOut/LimitExceeded)
  • Models: PluginDetail, PluginSummary, PluginVersion, PluginInvocationLog, PluginConsoleLine
  • Requests: ActivatePluginRequest, UpdatePluginConfigRequest, SetPluginPriorityRequest, GetPluginLogsOptions

@insurup/sdk

  • plugins endpoint group in core/endpoints.ts (incl. a logs query builder for limit/hookName)
  • InsurUpPluginClient (clients/plugin.ts) with: getPlugins, getPluginById, uploadPlugin (multipart FormData), activatePlugin, enablePlugin, disablePlugin, updatePluginConfig, setPluginPriority, getPluginLogs
  • Wired onto DefaultInsurUpClient.plugins and exported from the package root

Notes

  • uploadPlugin accepts a Blob/File or ArrayBuffer and posts it as multipart file — the host derives hooks + the config schema from the bundle.
  • Mirrors the existing webhook client conventions (endpoint registry, InsurUpResult<T>, bilingual JSDoc).

Verified

bun run typecheck, bun run build, bun run lint, bun run format:check — all green.

🤖 Generated with Claude Code

Add a typed PluginsClient + contracts covering the full backend plugin surface:
list, get, upload (multipart bundle), activate, enable, disable, config, priority, logs.

- contracts: PluginHook/PluginRuntimeType/PluginOutcome enums, PluginDetail/
  PluginSummary/PluginVersion/PluginInvocationLog/PluginConsoleLine models, and
  Activate/UpdateConfig/SetPriority requests + GetPluginLogsOptions
- sdk: plugins endpoint group, InsurUpPluginClient (FormData upload), wired onto
  DefaultInsurUpClient.plugins and exported

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kerem-acer added a commit to InsurUp/cli that referenced this pull request Jun 6, 2026
New `insurup plugins` command group:
- init: scaffold a plugin project — interactive prompts (or flags) for id,
  language (ts|js), package manager (bun|npm|pnpm|yarn), and bundler (bun|esbuild)
- build / deploy: run the project's own package.json `build` script (with the
  chosen/detected package manager), then Jint-safety-scan + zip the output and
  (for deploy) upload via @insurup/sdk, optionally activate + set config
- list / get / logs / activate / enable / disable / config / priority

The bundler is the plugin project's choice (not hardcoded) — the CLI orchestrates
`<pm> run build`. Zipping uses fflate; a select/text prompt helper backs init.

Depends on InsurUp/ts-toolkit#71 (the @insurup/sdk plugin endpoints).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- add deletePlugin(pluginId) (DELETE plugins/{PluginId}) + the route, mirroring
  the backend endpoint added to core
- plugin enums were numeric/PascalCase but the API serializes them as UPPER_SNAKE
  strings (JsonStringEnumConverter). Convert PluginHook / PluginRuntimeType /
  PluginOutcome to string enums with the wire values, matching the rest of the
  contracts package
- refresh PluginHook: drop OnAgentCreated (removed backend-side), replace the
  stale ValidateCustomer/MutateCustomer/DecorateIgwRequest with the current
  validation (VALIDATE_*) and transformation (TRANSFORM_*) hooks
- add PluginOutcome.Disabled (DISABLED)
- PluginInvocationLog.hookName:string -> hook:PluginHook, and the logs query
  param hookName -> hook (both match the API)

typecheck / lint / build / test green (sdk: 397 tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kerem-acer kerem-acer merged commit 0622170 into main Jun 8, 2026
2 checks passed
kerem-acer added a commit to InsurUp/cli that referenced this pull request Jun 8, 2026
* feat(plugins): add plugin build/deploy/manage commands

New `insurup plugins` command group:
- init: scaffold a plugin project — interactive prompts (or flags) for id,
  language (ts|js), package manager (bun|npm|pnpm|yarn), and bundler (bun|esbuild)
- build / deploy: run the project's own package.json `build` script (with the
  chosen/detected package manager), then Jint-safety-scan + zip the output and
  (for deploy) upload via @insurup/sdk, optionally activate + set config
- list / get / logs / activate / enable / disable / config / priority

The bundler is the plugin project's choice (not hardcoded) — the CLI orchestrates
`<pm> run build`. Zipping uses fflate; a select/text prompt helper backs init.

Depends on InsurUp/ts-toolkit#71 (the @insurup/sdk plugin endpoints).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(plugins): add `remove` command + align logs hook filter with the SDK

- add `insurup plugins remove <id>` (client.plugins.deletePlugin), mirroring the
  disable command, for the new backend DELETE /plugins/{id}
- the logs hook filter passed `hookName`; the SDK option was renamed to `hook`
  (a PluginHook). Pass `{ hook }` and import the PluginHook type.

Verified against a local @insurup/sdk build that has the plugin client: tsc 0
errors, biome clean. NOTE: CI stays red until @insurup/sdk is published with the
plugin client (ts-toolkit#71) and this PR bumps the dependency + regenerates the
frozen lockfile.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(deps): bump @insurup/sdk to 0.1.35 (adds the plugin client)

Unblocks the plugin commands: 0.1.35 (ts-toolkit#71) ships InsurUpPluginClient
with deletePlugin and the UPPER_SNAKE plugin enums. Regenerates the lockfile,
fixing the frozen-lockfile CI failure.

typecheck / biome / 243 tests / build all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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