# Changelog

All notable changes to `paperclip-adapter-minimax` are documented here.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.7] — 2026-06-03

### Fixed

- **Radical simplification: `createServerAdapter` lives in a standalone
  `src/entry.ts` with ZERO cross-file imports.** Previous versions
  re-exported the function or imported from other project files
  (`./adapter.js`, `./session.js`, etc.). If any of those re-exports
  or imports failed for any reason at module-load time, the
  Paperclip install sandbox wrapped the error as the generic
  "does not export createServerAdapter" message. With this version,
  the entire tool loop, HTTP client, 8 tool implementations, session
  codec, models catalog, and agent config doc are all defined
  in a single 568-line `dist/entry.js` file with no transitive
  imports at all. The install sandbox cannot fail on a missing
  dep — there are no deps at module load.
- **`main` points to `./dist/entry.js`** (not the CJS shim), and
  the `exports` field is the simple string form. `dist/index.js`
  is a small re-export module for downstream consumers of the
  package.
- Fixed a syntax error from a previous build (`await` inside a
  non-async arrow function) that broke the published 0.1.6 ESM
  import in some Node.js setups.

## [0.1.6] — 2026-06-03

### Fixed

- **Removed `export default createServerAdapter`.** The 0.1.5 build had
  both a named export and a default export. If Paperclip's
  `validateAdapterModule` does `mod.default?.createServerAdapter`,
  the lookup hits `mod.default` (the function itself), then
  `.createServerAdapter` is undefined, triggering the generic error.
  Matches the exact shape of `paperclip-adapter-openrouter` which
  has only a named export.
- **Switched to `export function createServerAdapter()` direct form**
  (was `function ...; export { ... }` re-export form). Some
  static-analysis validators don't recognize the re-export form.
- `main` field points back at `./dist/index.js` (the file with the
  named export) instead of the CJS shim, matching openrouter.
- CJS shim still present in `exports.require` and on disk, for any
  consumer that does `require()`.

## [0.1.5] — 2026-06-03

### Fixed

- **Dual ESM + CJS entry points** so the Paperclip install sandbox
  succeeds whether it does `import()` (ESM) or `require()` (CJS).
  The `main` field now points at `dist/cjs-shim.cjs`; the `exports`
  field maps `import` → `dist/index.js` and `require` → `dist/cjs-shim.cjs`.
- **Default export** added in `dist/index.js` alongside the named
  export, so consumers using `import adapter from '...'` also work.
- These changes make the install check robust to any module-resolution
  strategy the Paperclip sandbox might use. If 0.1.5 still fails,
  the problem is on the Paperclip side (caching, network, or env).

## [0.1.4] — 2026-06-03

### Fixed

- **Define `createServerAdapter()` directly in the package's `main`
  entry file** (`src/index.ts` → `dist/index.js`). Previously the
  function was re-exported from `./entry.js` via a single hop:
  `index.js → entry.js → createServerAdapter`. The Paperclip install
  sandbox's static check is brittle to that indirection — if any part
  of the import chain fails for any reason, the error wraps as
  "does not export createServerAdapter". With this version, the
  function exists in the exact bytes of the `main` entry, so the
  check cannot fail on a re-export hop.

## [0.1.3] — 2026-06-03

- Updated CHANGELOG with the 0.1.2 self-contained entry fix. No code
  change from 0.1.2.

## [0.1.2] — 2026-06-03

### Fixed

- **Self-contained `createServerAdapter()` in `src/entry.ts`.** Defined
  directly in the package's main entry file (no re-exports), so the
  Paperclip "Install External Adapter" sandbox can resolve it via a
  single static import. Heavier adapter internals (execute loop, tools,
  client, skills loader) are loaded lazily inside the function. This
  fixes the persistent "does not export createServerAdapter" install
  error reported by the Paperclip plugin UI.

### Changed

- Simplified `exports` field in `package.json` to include a `default`
  condition and a direct string for `./registry` subpath, matching the
  shape used by `paperclip-adapter-openrouter` (which Paperclip accepts).
- Inline fallback implementations of `sessionCodec`, `models`, and
  `agentConfigurationDoc` live in the entry function so the install
  check passes even if a transitive dependency can't be loaded.

## [0.1.1] — 2026-06-03

### Fixed

- **Add `createServerAdapter()` export.** The Paperclip "Install External
  Adapter" UI requires the main entry to export a `createServerAdapter()`
  function returning a `ServerAdapterModule` (per
  `@paperclipai/adapter-utils`). Added the proper entry point that
  implements the full `ServerAdapterModule` contract: `type`, `execute`,
  `testEnvironment`, `listSkills`, `syncSkills`, `sessionCodec`,
  `supportsLocalAgentJwt`, `models`, `listModels`, `agentConfigurationDoc`,
  `onHireApproved`.

### Changed

- **Session codec reshaped** to match the Paperclip `AdapterSessionCodec`
  interface: `serialize(params) → Record<string, unknown> | null` and
  `deserialize(raw) → Record<string, unknown> | null` (was
  base64-encoded string). Added `getDisplayId`.
- `AdapterConfig` gains a `workspacePath` field.
- `loadConfig()` no longer throws when `apiKey` is empty (lets
  `testEnvironment` probe with a missing key and report a clean check).
- Added `@paperclipai/adapter-utils` as a peer dependency.

## [0.1.0] — 2026-06-03

### Added

- Pure-HTTP TypeScript adapter for Paperclip.
- `MiniMaxAdapter` class with `run`, `detectModel`, `listSkills`, `syncSkills`,
  `sessionCodec`, and `metadata`.
- 8 built-in Paperclip tools:
  - `get_issue`, `list_issues`
  - `update_issue_status` (with auto status-comment when `reason` is given)
  - `add_comment`, `list_comments`
  - `create_sub_issue`
  - `hire_agent` (routed through `/api/companies/:id/approvals`)
  - `request_approval` (routed through `/api/companies/:id/approvals`)
- Repeat-call loop break: aborts the heartbeat when the same tool call is
  issued 3 times in a row with the same arguments.
- Per-turn and per-heartbeat cost tracking using
  `MINIMAX_PRICE_INPUT_PER_1M` / `MINIMAX_PRICE_OUTPUT_PER_1M`.
- Token-usage aggregation across the tool loop.
- Streaming via MiniMax's `stream_options.include_usage` (toggleable).
- JSONL transcript appender for the live Working panel.
- Session codec: base64-encoded JSON for `sessionState` round-tripping across
  heartbeats.
- System prompt builder that injects the agent role, the issue, the parent
  chain, and the loaded skills.
- Skill discovery from `<workspace>/skills`, `<workspace>/.paperclip/skills`,
  the configured `MINIMAX_SKILLS_DIR`, and the package's bundled defaults.
- Bundled `paperclip-heartbeats` SKILL.md (explains Paperclip's heartbeat
  contract).
- `MiniMaxClient` thin wrapper over the `openai` SDK with a custom `baseURL`.
- CLI: `doctor`, `list`, `version`, `help`.
- Configurable via environment variables with the `*_ENV` override pattern.
- TypeScript strict mode + declaration maps for downstream consumers.
- Zod-validated config schema with loud failure on bad input.
- 22 vitest unit tests covering tools, loop-break, cost, and session.

### Notes

- This is a community package, not affiliated with MiniMax or Paperclip.
- The MiniMax API key must be set in `MINIMAX_API_KEY`; the rest of the
  defaults are tuned for the free M3 model.
- Side-effect tools (hire, approval) go through Paperclip's approval flow
  by default; toggle with `MINIMAX_APPROVAL_GATED=0` for self-hosted dev.

[0.1.7]: #0.1.7
[0.1.6]: #0.1.6
[0.1.5]: #0.1.5
[0.1.4]: #0.1.4
[0.1.3]: #0.1.3
[0.1.2]: #0.1.2
[0.1.1]: #0.1.1
[0.1.0]: #0.1.0
