@stream-mdx/protocol 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1
4
+ - Initial protocol types and event envelope for StreamMDX Protocol v1.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @stream-mdx/protocol
2
+
3
+ Protocol types for StreamMDX JSON/object streaming.
4
+
5
+ This package defines the event envelope, capability metadata, and token
6
+ structures used by StreamMDX Protocol v1. It is intended for consumers that
7
+ need a stable, versioned contract (e.g., terminal UIs).
package/dist/index.cjs ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ STREAM_MDX_PROTOCOL_ID: () => STREAM_MDX_PROTOCOL_ID,
24
+ STREAM_MDX_SCHEMA_VERSION: () => STREAM_MDX_SCHEMA_VERSION
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+ var STREAM_MDX_PROTOCOL_ID = "streammdx";
28
+ var STREAM_MDX_SCHEMA_VERSION = "1.0";
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ STREAM_MDX_PROTOCOL_ID,
32
+ STREAM_MDX_SCHEMA_VERSION
33
+ });
@@ -0,0 +1,64 @@
1
+ import { Block, Patch, PatchMetrics } from '@stream-mdx/core';
2
+ export { DiffKind, TokenLineV1, TokenSpan, TokenStyle } from '@stream-mdx/core';
3
+
4
+ declare const STREAM_MDX_PROTOCOL_ID = "streammdx";
5
+ declare const STREAM_MDX_SCHEMA_VERSION = "1.0";
6
+ type StreamMdxEventType = "init" | "snapshot" | "patch" | "metrics" | "error" | "done";
7
+ type StreamMdxCapabilityLevel = "none" | "v1";
8
+ type StreamMdxCapabilities = {
9
+ tokens?: StreamMdxCapabilityLevel;
10
+ diff?: StreamMdxCapabilityLevel;
11
+ mdx?: "none" | "detect" | "compile-ref" | "compile-inline";
12
+ htmlBlocks?: "none" | "sanitized" | "raw";
13
+ math?: "none" | "tex";
14
+ tables?: StreamMdxCapabilityLevel;
15
+ footnotes?: StreamMdxCapabilityLevel;
16
+ };
17
+ type StreamMdxTheme = {
18
+ mode: "single" | "dual";
19
+ theme?: string;
20
+ dark?: string;
21
+ light?: string;
22
+ };
23
+ type StreamMdxEventBase = {
24
+ protocol: typeof STREAM_MDX_PROTOCOL_ID;
25
+ schemaVersion: typeof STREAM_MDX_SCHEMA_VERSION;
26
+ streamId: string;
27
+ event: StreamMdxEventType;
28
+ tx?: number;
29
+ };
30
+ type StreamMdxInitEventV1 = StreamMdxEventBase & {
31
+ event: "init";
32
+ createdAt?: number;
33
+ capabilities?: StreamMdxCapabilities;
34
+ theme?: StreamMdxTheme;
35
+ shikiVersion?: string;
36
+ };
37
+ type StreamMdxSnapshotEventV1 = StreamMdxEventBase & {
38
+ event: "snapshot";
39
+ blocks: Block[];
40
+ };
41
+ type StreamMdxPatchEventV1 = StreamMdxEventBase & {
42
+ event: "patch";
43
+ tx: number;
44
+ patches: Patch[];
45
+ metrics?: PatchMetrics | null;
46
+ };
47
+ type StreamMdxMetricsEventV1 = StreamMdxEventBase & {
48
+ event: "metrics";
49
+ tx?: number;
50
+ metrics: PatchMetrics;
51
+ };
52
+ type StreamMdxErrorEventV1 = StreamMdxEventBase & {
53
+ event: "error";
54
+ message: string;
55
+ stack?: string;
56
+ };
57
+ type StreamMdxDoneEventV1 = StreamMdxEventBase & {
58
+ event: "done";
59
+ finalTx?: number;
60
+ status: "ok" | "error";
61
+ };
62
+ type StreamMdxEventV1 = StreamMdxInitEventV1 | StreamMdxSnapshotEventV1 | StreamMdxPatchEventV1 | StreamMdxMetricsEventV1 | StreamMdxErrorEventV1 | StreamMdxDoneEventV1;
63
+
64
+ export { STREAM_MDX_PROTOCOL_ID, STREAM_MDX_SCHEMA_VERSION, type StreamMdxCapabilities, type StreamMdxCapabilityLevel, type StreamMdxDoneEventV1, type StreamMdxErrorEventV1, type StreamMdxEventBase, type StreamMdxEventType, type StreamMdxEventV1, type StreamMdxInitEventV1, type StreamMdxMetricsEventV1, type StreamMdxPatchEventV1, type StreamMdxSnapshotEventV1, type StreamMdxTheme };
@@ -0,0 +1,64 @@
1
+ import { Block, Patch, PatchMetrics } from '@stream-mdx/core';
2
+ export { DiffKind, TokenLineV1, TokenSpan, TokenStyle } from '@stream-mdx/core';
3
+
4
+ declare const STREAM_MDX_PROTOCOL_ID = "streammdx";
5
+ declare const STREAM_MDX_SCHEMA_VERSION = "1.0";
6
+ type StreamMdxEventType = "init" | "snapshot" | "patch" | "metrics" | "error" | "done";
7
+ type StreamMdxCapabilityLevel = "none" | "v1";
8
+ type StreamMdxCapabilities = {
9
+ tokens?: StreamMdxCapabilityLevel;
10
+ diff?: StreamMdxCapabilityLevel;
11
+ mdx?: "none" | "detect" | "compile-ref" | "compile-inline";
12
+ htmlBlocks?: "none" | "sanitized" | "raw";
13
+ math?: "none" | "tex";
14
+ tables?: StreamMdxCapabilityLevel;
15
+ footnotes?: StreamMdxCapabilityLevel;
16
+ };
17
+ type StreamMdxTheme = {
18
+ mode: "single" | "dual";
19
+ theme?: string;
20
+ dark?: string;
21
+ light?: string;
22
+ };
23
+ type StreamMdxEventBase = {
24
+ protocol: typeof STREAM_MDX_PROTOCOL_ID;
25
+ schemaVersion: typeof STREAM_MDX_SCHEMA_VERSION;
26
+ streamId: string;
27
+ event: StreamMdxEventType;
28
+ tx?: number;
29
+ };
30
+ type StreamMdxInitEventV1 = StreamMdxEventBase & {
31
+ event: "init";
32
+ createdAt?: number;
33
+ capabilities?: StreamMdxCapabilities;
34
+ theme?: StreamMdxTheme;
35
+ shikiVersion?: string;
36
+ };
37
+ type StreamMdxSnapshotEventV1 = StreamMdxEventBase & {
38
+ event: "snapshot";
39
+ blocks: Block[];
40
+ };
41
+ type StreamMdxPatchEventV1 = StreamMdxEventBase & {
42
+ event: "patch";
43
+ tx: number;
44
+ patches: Patch[];
45
+ metrics?: PatchMetrics | null;
46
+ };
47
+ type StreamMdxMetricsEventV1 = StreamMdxEventBase & {
48
+ event: "metrics";
49
+ tx?: number;
50
+ metrics: PatchMetrics;
51
+ };
52
+ type StreamMdxErrorEventV1 = StreamMdxEventBase & {
53
+ event: "error";
54
+ message: string;
55
+ stack?: string;
56
+ };
57
+ type StreamMdxDoneEventV1 = StreamMdxEventBase & {
58
+ event: "done";
59
+ finalTx?: number;
60
+ status: "ok" | "error";
61
+ };
62
+ type StreamMdxEventV1 = StreamMdxInitEventV1 | StreamMdxSnapshotEventV1 | StreamMdxPatchEventV1 | StreamMdxMetricsEventV1 | StreamMdxErrorEventV1 | StreamMdxDoneEventV1;
63
+
64
+ export { STREAM_MDX_PROTOCOL_ID, STREAM_MDX_SCHEMA_VERSION, type StreamMdxCapabilities, type StreamMdxCapabilityLevel, type StreamMdxDoneEventV1, type StreamMdxErrorEventV1, type StreamMdxEventBase, type StreamMdxEventType, type StreamMdxEventV1, type StreamMdxInitEventV1, type StreamMdxMetricsEventV1, type StreamMdxPatchEventV1, type StreamMdxSnapshotEventV1, type StreamMdxTheme };
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // src/index.ts
2
+ var STREAM_MDX_PROTOCOL_ID = "streammdx";
3
+ var STREAM_MDX_SCHEMA_VERSION = "1.0";
4
+ export {
5
+ STREAM_MDX_PROTOCOL_ID,
6
+ STREAM_MDX_SCHEMA_VERSION
7
+ };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@stream-mdx/protocol",
3
+ "version": "0.2.0",
4
+ "description": "StreamMDX protocol types and event envelope for JSON/object streaming",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kmccleary3301/stream-mdx.git",
9
+ "directory": "packages/markdown-v2-protocol"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.cjs",
16
+ "module": "./dist/index.mjs",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.mjs",
22
+ "require": "./dist/index.cjs"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "README.md",
28
+ "CHANGELOG.md"
29
+ ],
30
+ "sideEffects": false,
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "clean": "rm -rf dist",
34
+ "prepack": "npm run build"
35
+ },
36
+ "dependencies": {
37
+ "@stream-mdx/core": "0.2.0"
38
+ }
39
+ }