zeus-api-types 1.0.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 ADDED
@@ -0,0 +1,28 @@
1
+ # zeus-api-types
2
+
3
+ Shared TypeScript types for the Wagtales API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install zeus-api-types
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { ApiError, NarrativeChunkEventPayload } from 'zeus-api-types';
15
+ ```
16
+
17
+ ## Exports
18
+
19
+ - **ApiError, ApiErrorResponse** - Standard API error types
20
+ - **NarrativeSSEEventPayload** - Server-Sent Event payloads for narrative streaming
21
+ - `NarrativeStartEventPayload`
22
+ - `NarrativeChunkEventPayload`
23
+ - `NarrativeCompleteEventPayload`
24
+ - `NarrativeMetadataEventPayload`
25
+ - `MetadataEventPayload`
26
+ - `DoneEventPayload`
27
+ - `ErrorEventPayload`
28
+
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Standard API error object
3
+ */
4
+ export interface ApiError {
5
+ code: string;
6
+ message: string;
7
+ timestamp: string;
8
+ requestId: string;
9
+ details?: unknown;
10
+ }
11
+ /**
12
+ * Standard API error response envelope
13
+ */
14
+ export interface ApiErrorResponse {
15
+ error: ApiError;
16
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { ApiError, ApiErrorResponse } from './errors';
2
+ export { NarrativeStartEventPayload, NarrativeChunkEventPayload, NarrativeCompleteEventPayload, NarrativeMetadataEventPayload, MetadataEventPayload, DoneEventPayload, ErrorEventPayload, NarrativeSSEEventPayload, } from './sse/narrative';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,77 @@
1
+ /**
2
+ * SSE Event Payloads for narrative streaming
3
+ */
4
+ /**
5
+ * Sent when narrative generation starts
6
+ */
7
+ export interface NarrativeStartEventPayload {
8
+ turnId: string;
9
+ timestamp: string;
10
+ }
11
+ /**
12
+ * Sent for each chunk of narrative text
13
+ */
14
+ export interface NarrativeChunkEventPayload {
15
+ text: string;
16
+ index: number;
17
+ }
18
+ /**
19
+ * Sent when narrative generation completes
20
+ */
21
+ export interface NarrativeCompleteEventPayload {
22
+ turnId: string;
23
+ totalChunks: number;
24
+ timestamp: string;
25
+ }
26
+ /**
27
+ * Sent with narrative metadata (tone, characters, etc.)
28
+ */
29
+ export interface NarrativeMetadataEventPayload {
30
+ tone?: string;
31
+ characters?: string[];
32
+ location?: string;
33
+ [key: string]: unknown;
34
+ }
35
+ /**
36
+ * Generic metadata event payload
37
+ */
38
+ export interface MetadataEventPayload {
39
+ [key: string]: unknown;
40
+ }
41
+ /**
42
+ * Sent when the SSE stream is done
43
+ */
44
+ export interface DoneEventPayload {
45
+ success: boolean;
46
+ timestamp: string;
47
+ }
48
+ /**
49
+ * Sent when an error occurs during streaming
50
+ */
51
+ export interface ErrorEventPayload {
52
+ code: string;
53
+ message: string;
54
+ timestamp: string;
55
+ }
56
+ /**
57
+ * Union type for all narrative SSE event payloads
58
+ */
59
+ export type NarrativeSSEEventPayload = {
60
+ type: 'start';
61
+ data: NarrativeStartEventPayload;
62
+ } | {
63
+ type: 'chunk';
64
+ data: NarrativeChunkEventPayload;
65
+ } | {
66
+ type: 'complete';
67
+ data: NarrativeCompleteEventPayload;
68
+ } | {
69
+ type: 'metadata';
70
+ data: NarrativeMetadataEventPayload;
71
+ } | {
72
+ type: 'done';
73
+ data: DoneEventPayload;
74
+ } | {
75
+ type: 'error';
76
+ data: ErrorEventPayload;
77
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * SSE Event Payloads for narrative streaming
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "zeus-api-types",
3
+ "version": "1.0.0",
4
+ "description": "Shared API types for Wagtales - SSE payloads, error types, and common interfaces",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "clean": "rimraf dist",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "keywords": [
25
+ "wagtales",
26
+ "api",
27
+ "types",
28
+ "typescript",
29
+ "sse"
30
+ ],
31
+ "author": "Lovebowls",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/lovebowls/zeus-api-types"
36
+ },
37
+ "homepage": "https://github.com/lovebowls/zeus-api-types#readme",
38
+ "bugs": {
39
+ "url": "https://github.com/lovebowls/zeus-api-types/issues"
40
+ },
41
+ "sideEffects": false,
42
+ "devDependencies": {
43
+ "rimraf": "^5.0.0",
44
+ "typescript": "^5.0.0"
45
+ }
46
+ }
47
+