@hasna/conversations 0.0.8 → 0.1.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.
@@ -1,7 +1,27 @@
1
- import type { Message, SendMessageOptions, ReadMessagesOptions } from "../types.js";
1
+ import type { Message, SendMessageOptions, ReadMessagesOptions, SearchMessagesOptions } from "../types.js";
2
2
  export declare function sendMessage(opts: SendMessageOptions): Message;
3
3
  export declare function readMessages(opts?: ReadMessagesOptions): Message[];
4
4
  export declare function markRead(ids: number[], reader: string): number;
5
5
  export declare function markSessionRead(sessionId: string, reader: string): number;
6
- export declare function markChannelRead(channelName: string, reader: string): number;
6
+ export declare function markSpaceRead(spaceName: string, reader: string): number;
7
7
  export declare function getMessageById(id: number): Message | null;
8
+ export declare function markAllRead(agent: string): number;
9
+ export interface ExportMessagesOptions {
10
+ space?: string;
11
+ session_id?: string;
12
+ from?: string;
13
+ since?: string;
14
+ until?: string;
15
+ format?: "json" | "csv";
16
+ }
17
+ export declare function exportMessages(opts?: ExportMessagesOptions): string;
18
+ export declare function deleteMessage(id: number, agent: string): boolean;
19
+ export declare function editMessage(id: number, agent: string, newContent: string): Message | null;
20
+ export declare function pinMessage(id: number): Message | null;
21
+ export declare function unpinMessage(id: number): Message | null;
22
+ export declare function getPinnedMessages(opts?: {
23
+ space?: string;
24
+ session_id?: string;
25
+ limit?: number;
26
+ }): Message[];
27
+ export declare function searchMessages(opts: SearchMessagesOptions): Message[];
@@ -2,7 +2,7 @@ import type { Message } from "../types.js";
2
2
  export interface PollOptions {
3
3
  session_id?: string;
4
4
  to_agent?: string;
5
- channel?: string;
5
+ space?: string;
6
6
  interval_ms?: number;
7
7
  on_messages: (messages: Message[]) => void;
8
8
  }
@@ -17,6 +17,6 @@ export declare function startPolling(opts: PollOptions): {
17
17
  */
18
18
  export declare function useMessages(sessionId: string, agent?: string): Message[];
19
19
  /**
20
- * React hook for polling messages in a channel.
20
+ * React hook for polling messages in a space.
21
21
  */
22
- export declare function useChannelMessages(channelName: string): Message[];
22
+ export declare function useSpaceMessages(spaceName: string): Message[];
@@ -0,0 +1,7 @@
1
+ import type { AgentPresence } from "../types.js";
2
+ export declare function heartbeat(agent: string, status?: string, metadata?: Record<string, unknown>): void;
3
+ export declare function getPresence(agent: string): AgentPresence | null;
4
+ export declare function listAgents(opts?: {
5
+ online_only?: boolean;
6
+ }): AgentPresence[];
7
+ export declare function removePresence(agent: string): boolean;
@@ -0,0 +1,27 @@
1
+ import type { Project, ProjectInfo } from "../types.js";
2
+ export declare function createProject(opts: {
3
+ name: string;
4
+ created_by: string;
5
+ description?: string;
6
+ path?: string;
7
+ metadata?: Record<string, unknown>;
8
+ tags?: string[];
9
+ repository?: string;
10
+ settings?: Record<string, unknown>;
11
+ }): Project;
12
+ export declare function listProjects(opts?: {
13
+ status?: "active" | "archived";
14
+ }): ProjectInfo[];
15
+ export declare function getProject(id: string): ProjectInfo | null;
16
+ export declare function getProjectByName(name: string): ProjectInfo | null;
17
+ export declare function updateProject(id: string, updates: {
18
+ name?: string;
19
+ description?: string;
20
+ path?: string;
21
+ metadata?: Record<string, unknown>;
22
+ tags?: string[];
23
+ status?: "active" | "archived";
24
+ repository?: string;
25
+ settings?: Record<string, unknown>;
26
+ }): Project;
27
+ export declare function deleteProject(id: string): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { Space, SpaceInfo, SpaceMember } from "../types.js";
2
+ /**
3
+ * Get the depth of a space in the hierarchy.
4
+ * Top-level = 0, child of top-level = 1, grandchild = 2.
5
+ */
6
+ export declare function getSpaceDepth(spaceName: string): number;
7
+ export declare function createSpace(name: string, createdBy: string, options?: {
8
+ description?: string;
9
+ parent_id?: string;
10
+ project_id?: string;
11
+ }): Space;
12
+ export declare function listSpaces(options?: {
13
+ project_id?: string;
14
+ parent_id?: string | null;
15
+ flat?: boolean;
16
+ include_archived?: boolean;
17
+ }): SpaceInfo[];
18
+ export declare function getSpace(name: string): SpaceInfo | null;
19
+ export declare function joinSpace(spaceName: string, agent: string): boolean;
20
+ export declare function leaveSpace(spaceName: string, agent: string): boolean;
21
+ export declare function getSpaceMembers(spaceName: string): SpaceMember[];
22
+ export declare function updateSpace(name: string, updates: {
23
+ description?: string;
24
+ parent_id?: string | null;
25
+ project_id?: string | null;
26
+ }): Space;
27
+ export declare function archiveSpace(name: string): Space;
28
+ export declare function unarchiveSpace(name: string): Space;
29
+ export declare function isSpaceMember(spaceName: string, agent: string): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  /**
3
3
  * MCP server for conversations.
4
- * Exposes tools for sending, reading, and managing messages and channels between agents.
4
+ * Exposes tools for sending, reading, and managing messages, spaces, and projects between agents.
5
5
  *
6
6
  * Usage:
7
7
  * conversations mcp # Start MCP server on stdio
@@ -6,4 +6,4 @@
6
6
  * Usage:
7
7
  * conversations dashboard # Start dashboard server
8
8
  */
9
- export declare function startDashboardServer(port?: number): Bun.Server<undefined>;
9
+ export declare function startDashboardServer(port?: number, host?: string): Bun.Server<undefined>;
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@ export interface Message {
4
4
  session_id: string;
5
5
  from_agent: string;
6
6
  to_agent: string;
7
- channel: string | null;
7
+ space: string | null;
8
8
  content: string;
9
9
  priority: Priority;
10
10
  working_dir: string | null;
@@ -13,6 +13,8 @@ export interface Message {
13
13
  metadata: Record<string, unknown> | null;
14
14
  created_at: string;
15
15
  read_at: string | null;
16
+ edited_at: string | null;
17
+ pinned_at: string | null;
16
18
  }
17
19
  export interface Session {
18
20
  session_id: string;
@@ -21,27 +23,47 @@ export interface Session {
21
23
  message_count: number;
22
24
  unread_count: number;
23
25
  }
24
- export interface Channel {
26
+ export interface Space {
25
27
  name: string;
26
28
  description: string | null;
29
+ parent_id: string | null;
30
+ project_id: string | null;
27
31
  created_by: string;
28
32
  created_at: string;
33
+ archived_at: string | null;
29
34
  }
30
- export interface ChannelMember {
31
- channel: string;
35
+ export interface SpaceMember {
36
+ space: string;
32
37
  agent: string;
33
38
  joined_at: string;
34
39
  }
35
- export interface ChannelInfo extends Channel {
40
+ export interface SpaceInfo extends Space {
36
41
  member_count: number;
37
42
  message_count: number;
43
+ children?: SpaceInfo[];
44
+ }
45
+ export interface Project {
46
+ id: string;
47
+ name: string;
48
+ description: string | null;
49
+ path: string | null;
50
+ created_by: string;
51
+ created_at: string;
52
+ metadata: Record<string, unknown> | null;
53
+ tags: string[];
54
+ status: "active" | "archived";
55
+ repository: string | null;
56
+ settings: Record<string, unknown> | null;
57
+ }
58
+ export interface ProjectInfo extends Project {
59
+ space_count: number;
38
60
  }
39
61
  export interface SendMessageOptions {
40
62
  from: string;
41
63
  to: string;
42
64
  content: string;
43
65
  session_id?: string;
44
- channel?: string;
66
+ space?: string;
45
67
  priority?: Priority;
46
68
  working_dir?: string;
47
69
  repository?: string;
@@ -52,8 +74,24 @@ export interface ReadMessagesOptions {
52
74
  session_id?: string;
53
75
  from?: string;
54
76
  to?: string;
55
- channel?: string;
77
+ space?: string;
56
78
  since?: string;
79
+ since_id?: number;
57
80
  limit?: number;
58
81
  unread_only?: boolean;
82
+ order?: "asc" | "desc";
83
+ }
84
+ export interface SearchMessagesOptions {
85
+ query: string;
86
+ space?: string;
87
+ from?: string;
88
+ to?: string;
89
+ limit?: number;
90
+ }
91
+ export interface AgentPresence {
92
+ agent: string;
93
+ status: string;
94
+ last_seen_at: string;
95
+ online: boolean;
96
+ metadata: Record<string, unknown> | null;
59
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.0.8",
3
+ "version": "0.1.0",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {