Skip to content

Commit 4d07ccd

Browse files
author
Clay
committed
Ship PerpScope v2.0 terminal integration kit
1 parent 35851f1 commit 4d07ccd

28 files changed

Lines changed: 1237 additions & 177 deletions

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ Live demo: [williamclay8.github.io/perpscope](https://williamclay8.github.io/per
2020
```
2121

2222
```js
23+
import { summarizePerpScopeExport } from "@perpscope/percolator-adapter";
24+
2325
const response = await fetch("https://raw.githubusercontent.com/williamclay8/perpscope/main/examples/perpscope-export.sample.json");
2426
const payload = await response.json();
2527

2628
if (payload.schema !== "perpscope.export.v1") throw new Error("Unexpected export schema");
2729

28-
const market = payload.market.name;
29-
const heat = payload.radar.rows[0].scoreLabel;
30-
const reasons = payload.market.whyHot.reasons;
30+
const summary = summarizePerpScopeExport(payload);
3131
```
3232

33-
Use `docs/embed-integration.md` for the copy-paste guide and `examples/embed-consumer/` for a tiny iframe plus JSON parser example.
33+
Use `docs/embed-integration.md` for the copy-paste guide, `examples/copy-integration/` for a live copy page, and `examples/embed-consumer/` for the terminal side-rail mock.
3434

3535
## 2-Minute Terminal Builder Check
3636

@@ -182,6 +182,7 @@ examples/percolator-mainnet-sol.readonly-rpc.json
182182
examples/percolator-devnet-wif.readonly-rpc.json
183183
examples/funding-skew-history.stdout.json
184184
examples/adapter-consumer/
185+
examples/copy-integration/
185186
examples/embed-consumer/
186187
examples/perpscope-export.sample.json
187188
examples/terminal-recipes.json
@@ -249,6 +250,7 @@ schemas/perpscope-snapshot.schema.json
249250
schemas/percolator-cli-bundle.schema.json
250251
schemas/read-only-rpc-fetch.schema.json
251252
schemas/funding-skew-history.schema.json
253+
schemas/perpscope-export.schema.json
252254
```
253255

254256
The source-backed adapter field map lives in `docs/field-compatibility-map.md`, with a JSON manifest at `examples/field-compatibility-map.json`, an export artifact at `examples/compatibility-report-export.json`, a diff artifact at `examples/compatibility-diff.json`, and fixture packs such as `examples/fixture-pack-drifted-aliases.json`, `examples/fixture-pack-real-sanitized-rpc-shape.json`, and `examples/static-real-snapshot.json`.
@@ -269,6 +271,8 @@ import {
269271
compareCompatibilityReports,
270272
normalizeFundingSkewHistory,
271273
normalizePercolatorSnapshot,
274+
parsePerpScopeExport,
275+
summarizePerpScopeExport,
272276
simulatePriceShock
273277
} from "./packages/percolator-adapter/index.js";
274278

@@ -280,6 +284,7 @@ const reality = buildCompatibilityRealityCheck(compatibility, { input: decodedJs
280284
const drift = compareCompatibilityReports(previousCompatibility, compatibility);
281285
const watchtower = buildWatchtowerSignals(market, stress);
282286
const carryHistory = normalizeFundingSkewHistory(market.history.fundingSkew, market);
287+
const embedSummary = summarizePerpScopeExport(parsePerpScopeExport(perpscopeExportJson));
283288
```
284289

285290
The package is intentionally side-effect free. It does not create wallets, sign, send, route, or submit transactions.
@@ -423,6 +428,7 @@ The normalized market DTO includes:
423428
- `docs/release-v1.7.0.md` mirrors the public release notes for why-hot explanations, feed health, share links, and adapter targets.
424429
- `docs/release-v1.8.0.md` mirrors the public release notes for exportable JSON and embed widgets.
425430
- `docs/release-v1.9.0.md` mirrors the public release notes for copy-paste embeds and export consumer examples.
431+
- `docs/release-v2.0.0.md` mirrors the public release notes for the schema-locked terminal integration kit.
426432
- `docs/adapter-targets.md` documents the terminal rail, risk overlay, execution lane, feed monitor, and embed contracts.
427433
- `docs/embed-integration.md` documents iframe widgets, the export fixture, and trusted display fields.
428434
- `docs/decoded-live-source.md` documents the CORS endpoint contract for decoded Percolator live feeds.
@@ -466,7 +472,7 @@ Current public site: [williamclay8.github.io/perpscope](https://williamclay8.git
466472

467473
- v0.4 shipped: capture intake for pasted/dropped decoded outputs, compatibility scoring, missing-field warnings, and ignored-field mapping.
468474
- v0.4 follow-up: field-level compatibility map for terminal import/export adapters.
469-
- npm package shipped: `@perpscope/percolator-adapter@1.1.0`.
475+
- npm package shipped: `@perpscope/percolator-adapter@2.0.0`.
470476
- v0.5 shipped: downloadable compatibility report export for terminal builders.
471477
- v0.6 shipped: compatibility diffing and alias suggestions for drifting terminal shapes.
472478
- v0.7 shipped: local compatibility workbench, CLI report/diff commands, and fixture packs.

docs/embed-integration.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ PerpScope gives terminal builders two read-only integration paths:
3333
`examples/perpscope-export.sample.json` is a stable fixture for wiring parsers and visual mocks before a terminal has live decoded output.
3434

3535
```js
36+
import { summarizePerpScopeExport } from "@perpscope/percolator-adapter";
37+
3638
const response = await fetch(
3739
"https://raw.githubusercontent.com/williamclay8/perpscope/main/examples/perpscope-export.sample.json"
3840
);
@@ -42,26 +44,7 @@ if (payload.schema !== "perpscope.export.v1") {
4244
throw new Error("Unexpected PerpScope export schema.");
4345
}
4446

45-
const feedItems = new Map(payload.feedHealth.items.map((item) => [item.label, item.value]));
46-
const topMarket = payload.radar.rows[0];
47-
const reasons = payload.market.whyHot.reasons.map((reason) => ({
48-
label: reason.label,
49-
value: reason.value,
50-
tone: reason.tone
51-
}));
52-
53-
console.log({
54-
market: payload.market.name,
55-
heat: topMarket.scoreLabel,
56-
feed: {
57-
markets: feedItems.get("markets"),
58-
slot: feedItems.get("slot"),
59-
unitChecks: feedItems.get("unit checks"),
60-
gaps: feedItems.get("gaps")
61-
},
62-
reasons,
63-
readOnly: payload.safety
64-
});
47+
console.log(summarizePerpScopeExport(payload));
6548
```
6649

6750
Live decoded protocol snapshots are available from the hosted decoder worker:
@@ -76,6 +59,28 @@ const decodedSnapshot = await response.json();
7659

7760
Use the PerpScope app or `@perpscope/percolator-adapter` to normalize decoded snapshots into the cockpit DTOs.
7861

62+
## Terminal Integration Kit
63+
64+
```bash
65+
npm install @perpscope/percolator-adapter
66+
```
67+
68+
```js
69+
import {
70+
parsePerpScopeExport,
71+
rankRadarRows,
72+
summarizeFeedHealth,
73+
summarizePerpScopeExport
74+
} from "@perpscope/percolator-adapter";
75+
76+
const exportPayload = parsePerpScopeExport(payload);
77+
const summary = summarizePerpScopeExport(exportPayload);
78+
const feed = summarizeFeedHealth(exportPayload);
79+
const hottest = rankRadarRows(exportPayload)[0];
80+
```
81+
82+
The schema is published at `schemas/perpscope-export.schema.json`.
83+
7984
## Fields To Trust
8085

8186
Treat these as stable display inputs for terminal surfaces:

docs/field-compatibility-map.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PerpScope Field Compatibility Map
22

3-
This map is the v1.1.0 implementation contract for terminal builders sending read-only Percolator-like output into PerpScope. It is source-grounded in:
3+
This map is the v2.0.0 implementation contract for terminal builders sending read-only Percolator-like output into PerpScope. It is source-grounded in:
44

55
- `src/lib/percolator-adapter.js`
66
- `src/lib/watchtower-signals.js`

docs/release-v2.0.0.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# PerpScope v2.0.0
2+
3+
PerpScope v2.0 turns the embed layer into a schema-locked terminal integration kit.
4+
5+
## Shipped
6+
7+
- Adds `schemas/perpscope-export.schema.json` for the `perpscope.export.v1` contract.
8+
- Adds package helpers: `parsePerpScopeExport()`, `summarizePerpScopeExport()`, `summarizeFeedHealth()`, and `rankRadarRows()`.
9+
- Adds `examples/copy-integration/`, a live copy page for iframe snippets, npm parser imports, schema links, and terminal placement.
10+
- Updates `examples/embed-consumer/` into a richer terminal side-rail mock that consumes the same export contract.
11+
- Bumps the app export and `@perpscope/percolator-adapter` package surfaces to `2.0.0`.
12+
- Documents the install-and-embed path in the README and `docs/embed-integration.md`.
13+
14+
## Safety
15+
16+
The v2.0 integration kit remains read-only. The schema requires `wallet`, `signer`, `transaction`, and `orderRouting` to be false, and the helpers reject exports that do not declare that safety boundary.
17+
18+
## Live
19+
20+
```text
21+
https://williamclay8.github.io/perpscope/
22+
https://williamclay8.github.io/perpscope/examples/copy-integration/
23+
https://williamclay8.github.io/perpscope/examples/embed-consumer/
24+
https://williamclay8.github.io/perpscope/examples/perpscope-export.sample.json
25+
https://williamclay8.github.io/perpscope/schemas/perpscope-export.schema.json
26+
```

examples/adapter-consumer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ npm install @perpscope/percolator-adapter
2525
or use a version range:
2626

2727
```json
28-
"@perpscope/percolator-adapter": "^1.1.0"
28+
"@perpscope/percolator-adapter": "^2.0.0"
2929
```
3030

3131
The example stays read-only. It does not connect wallets, sign, send, route, place orders, or submit transactions.

examples/compatibility-diff.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": 1,
44
"package": {
55
"name": "@perpscope/percolator-adapter",
6-
"version": "1.1.0"
6+
"version": "2.0.0"
77
},
88
"generatedAt": "2026-06-21T00:00:00.000Z",
99
"tone": "danger",

examples/compatibility-report-export.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": 1,
44
"package": {
55
"name": "@perpscope/percolator-adapter",
6-
"version": "1.1.0"
6+
"version": "2.0.0"
77
},
88
"generatedAt": "2026-06-21T00:00:00.000Z",
99
"safety": {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copy Integration Example
2+
3+
This page is the fast path for adding PerpScope to another terminal:
4+
5+
- iframe snippets for `?embed=radar`
6+
- npm parser helpers from `@perpscope/percolator-adapter`
7+
- schema and fixture links for `perpscope.export.v1`
8+
- a placement map for rails, market drawers, and feed footers
9+
10+
Run the site and open `http://127.0.0.1:4173/examples/copy-integration/`.

0 commit comments

Comments
 (0)