@hasna/conversations 0.0.1

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.
@@ -0,0 +1,4 @@
1
+ import { Database } from "bun:sqlite";
2
+ export declare function getDbPath(): string;
3
+ export declare function getDb(): Database;
4
+ export declare function closeDb(): void;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Resolve agent identity.
3
+ * Priority: explicit flag → CONVERSATIONS_AGENT_ID env → "user" fallback
4
+ */
5
+ export declare function resolveIdentity(explicit?: string): string;
6
+ /**
7
+ * Require an explicit identity (for headless/MCP use).
8
+ * Throws if no identity is set via flag or env.
9
+ */
10
+ export declare function requireIdentity(explicit?: string): string;
@@ -0,0 +1,6 @@
1
+ import type { Message, SendMessageOptions, ReadMessagesOptions } from "../types.js";
2
+ export declare function sendMessage(opts: SendMessageOptions): Message;
3
+ export declare function readMessages(opts?: ReadMessagesOptions): Message[];
4
+ export declare function markRead(ids: number[], reader: string): number;
5
+ export declare function markSessionRead(sessionId: string, reader: string): number;
6
+ export declare function getMessageById(id: number): Message | null;
@@ -0,0 +1,17 @@
1
+ import type { Message } from "../types.js";
2
+ export interface PollOptions {
3
+ session_id?: string;
4
+ to_agent?: string;
5
+ interval_ms?: number;
6
+ on_messages: (messages: Message[]) => void;
7
+ }
8
+ /**
9
+ * Start polling for new messages. Returns a stop function.
10
+ */
11
+ export declare function startPolling(opts: PollOptions): {
12
+ stop: () => void;
13
+ };
14
+ /**
15
+ * React hook for polling messages in a session.
16
+ */
17
+ export declare function useMessages(sessionId: string, agent?: string): Message[];
@@ -0,0 +1,10 @@
1
+ import type { Session } from "../types.js";
2
+ /**
3
+ * List sessions, optionally filtered to those involving a specific agent.
4
+ * Sessions are derived from messages — no separate sessions table.
5
+ */
6
+ export declare function listSessions(agent?: string): Session[];
7
+ /**
8
+ * Get a single session by ID.
9
+ */
10
+ export declare function getSession(sessionId: string): Session | null;
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * MCP server for conversations.
4
+ * Exposes tools for sending, reading, and managing messages between agents.
5
+ *
6
+ * Usage:
7
+ * convo mcp # Start MCP server on stdio
8
+ * convo-mcp # Direct binary
9
+ */
10
+ export declare function startMcpServer(): Promise<void>;
@@ -0,0 +1,41 @@
1
+ export type Priority = "low" | "normal" | "high" | "urgent";
2
+ export interface Message {
3
+ id: number;
4
+ session_id: string;
5
+ from_agent: string;
6
+ to_agent: string;
7
+ content: string;
8
+ priority: Priority;
9
+ working_dir: string | null;
10
+ repository: string | null;
11
+ branch: string | null;
12
+ metadata: Record<string, unknown> | null;
13
+ created_at: string;
14
+ read_at: string | null;
15
+ }
16
+ export interface Session {
17
+ session_id: string;
18
+ participants: string[];
19
+ last_message_at: string;
20
+ message_count: number;
21
+ unread_count: number;
22
+ }
23
+ export interface SendMessageOptions {
24
+ from: string;
25
+ to: string;
26
+ content: string;
27
+ session_id?: string;
28
+ priority?: Priority;
29
+ working_dir?: string;
30
+ repository?: string;
31
+ branch?: string;
32
+ metadata?: Record<string, unknown>;
33
+ }
34
+ export interface ReadMessagesOptions {
35
+ session_id?: string;
36
+ from?: string;
37
+ to?: string;
38
+ since?: string;
39
+ limit?: number;
40
+ unread_only?: boolean;
41
+ }
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@hasna/conversations",
3
+ "version": "0.0.1",
4
+ "description": "Real-time CLI messaging for AI agents",
5
+ "type": "module",
6
+ "bin": {
7
+ "convo": "./bin/index.js",
8
+ "convo-mcp": "./bin/mcp.js"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist/",
18
+ "bin/",
19
+ "LICENSE",
20
+ "README.md"
21
+ ],
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "scripts": {
25
+ "build": "bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
26
+ "test": "bun test",
27
+ "dev": "bun run ./src/cli/index.tsx",
28
+ "typecheck": "tsc --noEmit",
29
+ "prepublishOnly": "bun run build"
30
+ },
31
+ "keywords": [
32
+ "conversations",
33
+ "messaging",
34
+ "ai",
35
+ "agent",
36
+ "cli",
37
+ "typescript",
38
+ "bun",
39
+ "claude",
40
+ "mcp"
41
+ ],
42
+ "author": "Hasna",
43
+ "license": "Apache-2.0",
44
+ "devDependencies": {
45
+ "@types/bun": "latest",
46
+ "@types/react": "^18.2.0",
47
+ "typescript": "^5"
48
+ },
49
+ "dependencies": {
50
+ "@modelcontextprotocol/sdk": "^1.26.0",
51
+ "chalk": "^5.3.0",
52
+ "commander": "^12.1.0",
53
+ "ink": "^5.0.1",
54
+ "ink-select-input": "^6.0.0",
55
+ "ink-spinner": "^5.0.0",
56
+ "ink-text-input": "^6.0.0",
57
+ "react": "^18.2.0",
58
+ "zod": "^4.3.6"
59
+ },
60
+ "engines": {
61
+ "bun": ">=1.0.0"
62
+ },
63
+ "publishConfig": {
64
+ "registry": "https://registry.npmjs.org",
65
+ "access": "public"
66
+ },
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "git+https://github.com/hasna/conversations.git"
70
+ }
71
+ }