@mulmobridge/protocol 0.1.1 → 0.1.3

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 CHANGED
@@ -53,10 +53,10 @@ const attachment: Attachment = {
53
53
  | Package | Description |
54
54
  |---|---|
55
55
  | **@mulmobridge/protocol** | Wire protocol types and constants (this package) |
56
- | @mulmobridge/chat-service | Server-side chat service (coming soon) |
57
- | @mulmobridge/client | Bridge client library (coming soon) |
58
- | @mulmobridge/cli | CLI bridge (coming soon) |
59
- | @mulmobridge/telegram | Telegram bridge (coming soon) |
56
+ | [@mulmobridge/chat-service](https://www.npmjs.com/package/@mulmobridge/chat-service) | Server-side chat service |
57
+ | [@mulmobridge/client](https://www.npmjs.com/package/@mulmobridge/client) | Bridge client library |
58
+ | [@mulmobridge/cli](https://www.npmjs.com/package/@mulmobridge/cli) | CLI bridge |
59
+ | [@mulmobridge/telegram](https://www.npmjs.com/package/@mulmobridge/telegram) | Telegram bridge |
60
60
 
61
61
  ## License
62
62
 
package/dist/events.d.ts CHANGED
@@ -10,5 +10,56 @@ export declare const EVENT_TYPES: {
10
10
  readonly sessionFinished: "session_finished";
11
11
  readonly sessionMeta: "session_meta";
12
12
  readonly rolesUpdated: "roles_updated";
13
+ readonly generationStarted: "generation_started";
14
+ readonly generationFinished: "generation_finished";
13
15
  };
14
16
  export type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
17
+ /**
18
+ * Long-running async work originated by a plugin (MulmoScript etc.)
19
+ * that continues past the initial HTTP response. The server publishes
20
+ * a `generationStarted` event when the work begins and a
21
+ * `generationFinished` event when it completes (or fails). Clients
22
+ * track the in-flight set in `Session.pendingGenerations` so the UI
23
+ * can keep a "busy" indicator lit across view navigation.
24
+ */
25
+ export declare const GENERATION_KINDS: {
26
+ readonly beatImage: "beatImage";
27
+ readonly characterImage: "characterImage";
28
+ readonly beatAudio: "beatAudio";
29
+ readonly movie: "movie";
30
+ };
31
+ export type GenerationKind = (typeof GENERATION_KINDS)[keyof typeof GENERATION_KINDS];
32
+ export interface GenerationEvent {
33
+ type: "generation_started" | "generation_finished";
34
+ kind: GenerationKind;
35
+ /** MulmoScript file path — identifies the script the generation belongs to. */
36
+ filePath: string;
37
+ /** beatIndex (as string) for beat*, character key for characterImage, "" for movie. */
38
+ key: string;
39
+ /** Only set on generation_finished when the work failed. */
40
+ error?: string;
41
+ }
42
+ /**
43
+ * Decomposed view of a pending generation, stored as the *value* of
44
+ * `pendingGenerations[mapKey]`. Consumers read these fields directly
45
+ * rather than splitting the composite map key — filePath and user-
46
+ * defined character keys can contain arbitrary characters, so
47
+ * positional string parsing is unsafe.
48
+ */
49
+ export interface PendingGeneration {
50
+ kind: GenerationKind;
51
+ filePath: string;
52
+ key: string;
53
+ }
54
+ /**
55
+ * Stable map-key for a generation: the triple (kind, filePath, key).
56
+ * Separator is U+001F (UNIT SEPARATOR), a non-printable ASCII control
57
+ * character that cannot appear in filePaths or user-entered keys —
58
+ * this guarantees `generationKey(a) === generationKey(b)` iff a≡b,
59
+ * unlike a human-visible delimiter that could collide.
60
+ *
61
+ * The returned string is used only as a map identity. Do NOT split it
62
+ * to recover the fields — store the decomposed `PendingGeneration`
63
+ * object as the map value instead.
64
+ */
65
+ export declare function generationKey(kind: GenerationKind, filePath: string, key: string): string;
package/dist/events.js CHANGED
@@ -15,4 +15,34 @@ export const EVENT_TYPES = {
15
15
  sessionFinished: "session_finished",
16
16
  sessionMeta: "session_meta",
17
17
  rolesUpdated: "roles_updated",
18
+ generationStarted: "generation_started",
19
+ generationFinished: "generation_finished",
18
20
  };
21
+ /**
22
+ * Long-running async work originated by a plugin (MulmoScript etc.)
23
+ * that continues past the initial HTTP response. The server publishes
24
+ * a `generationStarted` event when the work begins and a
25
+ * `generationFinished` event when it completes (or fails). Clients
26
+ * track the in-flight set in `Session.pendingGenerations` so the UI
27
+ * can keep a "busy" indicator lit across view navigation.
28
+ */
29
+ export const GENERATION_KINDS = {
30
+ beatImage: "beatImage",
31
+ characterImage: "characterImage",
32
+ beatAudio: "beatAudio",
33
+ movie: "movie",
34
+ };
35
+ /**
36
+ * Stable map-key for a generation: the triple (kind, filePath, key).
37
+ * Separator is U+001F (UNIT SEPARATOR), a non-printable ASCII control
38
+ * character that cannot appear in filePaths or user-entered keys —
39
+ * this guarantees `generationKey(a) === generationKey(b)` iff a≡b,
40
+ * unlike a human-visible delimiter that could collide.
41
+ *
42
+ * The returned string is used only as a map identity. Do NOT split it
43
+ * to recover the fields — store the decomposed `PendingGeneration`
44
+ * object as the map value instead.
45
+ */
46
+ export function generationKey(kind, filePath, key) {
47
+ return `${kind}\u001f${filePath}\u001f${key}`;
48
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { EVENT_TYPES, type EventType } from "./events.js";
2
- export { CHAT_SOCKET_PATH, CHAT_SOCKET_EVENTS, type ChatSocketEvent, } from "./socket.js";
1
+ export { EVENT_TYPES, type EventType, GENERATION_KINDS, type GenerationKind, type GenerationEvent, type PendingGeneration, generationKey } from "./events.js";
2
+ export { CHAT_SOCKET_PATH, CHAT_SOCKET_EVENTS, type ChatSocketEvent } from "./socket.js";
3
3
  export { type Attachment } from "./attachment.js";
4
4
  export { CHAT_SERVICE_ROUTES } from "./routes.js";
package/dist/index.js CHANGED
@@ -6,6 +6,6 @@
6
6
  // - External bridges (CLI, Telegram, future platforms)
7
7
  //
8
8
  // No runtime dependencies. Types + const-only.
9
- export { EVENT_TYPES } from "./events.js";
10
- export { CHAT_SOCKET_PATH, CHAT_SOCKET_EVENTS, } from "./socket.js";
9
+ export { EVENT_TYPES, GENERATION_KINDS, generationKey } from "./events.js";
10
+ export { CHAT_SOCKET_PATH, CHAT_SOCKET_EVENTS } from "./socket.js";
11
11
  export { CHAT_SERVICE_ROUTES } from "./routes.js";
package/dist/socket.d.ts CHANGED
@@ -2,5 +2,10 @@ export declare const CHAT_SOCKET_PATH = "/ws/chat";
2
2
  export declare const CHAT_SOCKET_EVENTS: {
3
3
  readonly message: "message";
4
4
  readonly push: "push";
5
+ /** Server → bridge streaming text chunk (Phase C of #268).
6
+ * Emitted during a relay while the agent is generating text.
7
+ * Bridge accumulates chunks for display; the final ack still
8
+ * carries the full response for backward compatibility. */
9
+ readonly textChunk: "textChunk";
5
10
  };
6
11
  export type ChatSocketEvent = (typeof CHAT_SOCKET_EVENTS)[keyof typeof CHAT_SOCKET_EVENTS];
package/dist/socket.js CHANGED
@@ -3,4 +3,9 @@ export const CHAT_SOCKET_PATH = "/ws/chat";
3
3
  export const CHAT_SOCKET_EVENTS = {
4
4
  message: "message",
5
5
  push: "push",
6
+ /** Server → bridge streaming text chunk (Phase C of #268).
7
+ * Emitted during a relay while the agent is generating text.
8
+ * Bridge accumulates chunks for display; the final ack still
9
+ * carries the full response for backward compatibility. */
10
+ textChunk: "textChunk",
6
11
  };
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@mulmobridge/protocol",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Shared types and constants for the MulmoBridge protocol",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./src/index.ts",
11
- "types": "./src/index.ts"
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js",
13
+ "default": "./dist/index.js"
12
14
  }
13
15
  },
14
16
  "files": [
@@ -19,21 +21,12 @@
19
21
  "build": "tsc",
20
22
  "prepack": "yarn build",
21
23
  "typecheck": "tsc --noEmit",
22
- "test": "tsx --test test/test_*.ts"
23
- },
24
- "publishConfig": {
25
- "main": "./dist/index.js",
26
- "types": "./dist/index.d.ts",
27
- "exports": {
28
- ".": {
29
- "types": "./dist/index.d.ts",
30
- "import": "./dist/index.js"
31
- }
32
- }
24
+ "test": "tsx --test test/test_*.ts",
25
+ "lint": "eslint src test"
33
26
  },
34
27
  "license": "MIT",
35
28
  "author": "Receptron Team",
36
29
  "devDependencies": {
37
- "typescript": "^5.8.0"
30
+ "typescript": "^6.0.3"
38
31
  }
39
32
  }