@grackle-ai/ahp 0.133.0 → 0.134.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @grackle-ai/ahp
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/@grackle-ai/ahp"><img src="https://img.shields.io/npm/v/@grackle-ai/ahp.svg" alt="npm version" /></a>
|
|
5
|
+
<a href="https://github.com/nick-pape/grackle/actions/workflows/ci.yml"><img src="https://github.com/nick-pape/grackle/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" /></a>
|
|
6
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="https://raw.githubusercontent.com/nick-pape/grackle/main/apps/docs-site/static/img/grackle-logo.png" alt="Grackle" width="200" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
[Agent Host Protocol](https://github.com/microsoft/agent-host-protocol) (AHP) type definitions and reducers, vendored for [Grackle](https://github.com/nick-pape/grackle).
|
|
14
|
+
|
|
15
|
+
AHP is Microsoft's open-source protocol for the wire format between an agent host and its clients: the JSON-RPC commands, the action envelopes that stream state changes, the notifications, and the pure reducers that fold those actions into derived session/terminal/changeset state. This package re-exports the canonical AHP TypeScript shapes and reducer functions so the rest of Grackle can depend on a single, version-pinned copy.
|
|
16
|
+
|
|
17
|
+
The source is **vendored**, not hand-maintained: a build-time prebuild script copies the `types/` tree from a pinned commit of the upstream repo, applies a small set of transforms, and writes it to `src/vendor/ahp/`. Do not edit the vendored files directly — change the pin or the transforms instead.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @grackle-ai/ahp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## How the build works
|
|
26
|
+
|
|
27
|
+
The package builds in two steps, wired through Heft:
|
|
28
|
+
|
|
29
|
+
1. **Prebuild** (`scripts/prebuild.mjs`) — reads the upstream `types/` tree from `node_modules/agent-host-protocol/` (installed via the `agent-host-protocol` git dependency), applies the transforms below, and writes the result into `src/vendor/ahp/`:
|
|
30
|
+
- Prepends an `/* eslint-disable -- vendored third-party code, see SOURCE.md */` header to every `.ts` file so upstream style does not trip the repo's lint rules (warnings fail CI).
|
|
31
|
+
- Converts `const enum` to plain `enum` (a `const enum` is not reliably emitted across files by esbuild, so it would be `undefined` at runtime under the vitest runner).
|
|
32
|
+
- Strips upstream `.test.ts` files and the upstream `tsconfig.json`.
|
|
33
|
+
- Generates `src/vendor/ahp/SOURCE.md`, which records the pinned commit SHA and the transforms applied.
|
|
34
|
+
2. **Compile** — Heft compiles the vendored sources plus `src/index.ts` to `dist/`.
|
|
35
|
+
|
|
36
|
+
The reducer conformance corpus (`test-cases/reducers/*.json`) is kept and exercised by `src/reducer-conformance.test.ts`, which verifies the vendored reducers still match upstream's expected behavior.
|
|
37
|
+
|
|
38
|
+
## Key exports
|
|
39
|
+
|
|
40
|
+
All exports come through `src/index.ts`:
|
|
41
|
+
|
|
42
|
+
- **State types** — `RootState`, `SessionState`, `TerminalState`, `ChangesetState`, and the many supporting shapes (`AgentInfo`, `ToolCallState`, `UserMessage`, `SessionInputRequest`, etc.).
|
|
43
|
+
- **Enum values** (runtime constants) — `SessionStatus`, `SessionLifecycle`, `ToolCallStatus`, `ResponsePartKind`, `ChangesetStatus`, and friends.
|
|
44
|
+
- **Action types** — `ActionEnvelope`, `StateAction`, and the full set of root / session / terminal / changeset action shapes, plus the `ActionType` enum.
|
|
45
|
+
- **Command types** — JSON-RPC command params/results (`InitializeParams`, `CreateSessionParams`, `ResourceReadParams`, …) and command enums (`ReconnectResultType`, `ContentEncoding`, …).
|
|
46
|
+
- **Notification types** — `SessionAddedParams`, `AuthRequiredParams`, the OTLP export params, and the `AuthRequiredReason` enum.
|
|
47
|
+
- **Message types** — JSON-RPC envelopes and the `CommandMap` / notification-map types describing the protocol surface, plus `JsonRpcErrorCodes` / `AhpErrorCodes`.
|
|
48
|
+
- **Reducer functions** — `rootReducer`, `sessionReducer`, `terminalReducer`, `changesetReducer`, and the `softAssertNever` / `isClientDispatchable` helpers.
|
|
49
|
+
|
|
50
|
+
## Updating the upstream pin
|
|
51
|
+
|
|
52
|
+
The pinned upstream commit lives in **one place**: `devDependencies["agent-host-protocol"]` in `package.json`, as a `git+https://…#<sha>` spec. To move to a newer upstream commit:
|
|
53
|
+
|
|
54
|
+
1. Bump the SHA in `package.json` `devDependencies["agent-host-protocol"]`.
|
|
55
|
+
2. Run `rush update && rush build -t @grackle-ai/ahp`.
|
|
56
|
+
3. Confirm `src/vendor/ahp/SOURCE.md` shows the new SHA under **Pinned commit**.
|
|
57
|
+
4. Run `rush test -t @grackle-ai/ahp` to confirm the reducer conformance test still passes against the new corpus. If upstream changed reducer behavior or added/removed exports, update `src/index.ts` re-exports accordingly.
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- Node.js >= 22 and < 24
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT (vendored AHP sources are MIT, © Microsoft Corporation)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grackle-ai/ahp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.134.0",
|
|
4
4
|
"description": "Agent Host Protocol (AHP) type definitions and reducers — vendored from Microsoft's open-source AHP repo, built via prebuild transform step.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|