npm package: @sensedealai/cuecue
Description: TypeScript SDK for CueCue's AI-powered multi-agent research system
Author: CueCue Team
Latest version: 1.0.9

# CueCue SDK

<p align="center">
  <a href="https://www.npmjs.com/package/@sensedealai/cuecue">
    <img src="https://img.shields.io/npm/v/@sensedealai/cuecue.svg" alt="npm version">
  </a>
  <a href="https://opensource.org/licenses/Apache-2.0">
    <img src="https://img.shields.io/badge/License-Apache%202.0-yellow.svg" alt="License: Apache 2.0">
  </a>
</p>

> Conduct deep financial research using CueCue's AI-powered multi-agent system

CueCue SDK is a TypeScript library and CLI tool that enables developers and researchers to leverage CueCue's AI-powered multi-agent system for comprehensive financial research and analysis.

## Features

- 🤖 **AI-Powered Research** - Leverage multi-agent AI system for in-depth research
- 📡 **Real-time Streaming** - SSE-based streaming for live progress updates
- 📋 **Task Tracking** - Monitor individual research tasks as they complete
- 📝 **Report Generation** - Automatically generate comprehensive research reports
- 🔄 **Conversation Continuity** - Continue existing research conversations
- 📋 **Templates** - Use predefined research frameworks
- 🎨 **Style Mimicry** - Mimic writing styles from any URL

## Installation

``` bash
npm install @sensedealai/cuecue
```

## CLI Usage

The CLI binary is `cue`.

### Basic Usage

``` bash
# Set your API key (recommended)
export CUECUE_API_KEY=your_api_key

# Run a research query
cue research "Tesla Q3 2024 revenue analysis"

# Short alias
cue r "Tesla Q3 2024 revenue analysis"
```

### API Key Configuration

You can store your API key persistently using the config command:

``` bash
cue config set api_key YOUR_KEY
```

### Command Options

#### Global Options

| Option | Description |
|--------|-------------|
| `--api-key KEY` | CueCue API key (defaults to `CUECUE_API_KEY` env var) |
| `--base-url URL` | CueCue API base URL (defaults to `https://cuecue.cn`) |

#### `cue research <query>` Options

| Option | Description |
|--------|-------------|
| `--conversation-id ID` | Continue an existing conversation |
| `--template-id ID` | Use a predefined research framework |
| `--mimic-url URL` | Mimic writing style from a URL |
| `--output, -o FILE` | Save report to file (markdown format) |
| `--verbose, -v` | Enable verbose logging |
| `--foreground` | Run in foreground (default: background) |
| `--openclaw-channel CHANNEL` | OpenClaw channel name for notifications |
| `--openclaw-channel-id ID` | OpenClaw channel ID for notifications |

#### `cue config <subcommand>` Options

| Subcommand | Description |
|------------|-------------|
| `cue config set <key> <value>` | Save a config value |
| `cue config get [key]` | Get a config value, or list all if no key given |

### Examples

``` bash
# Specify API key directly
cue research "Tesla Q3 2024 revenue" --api-key YOUR_KEY

# Save API key to config
cue config set api_key YOUR_KEY

# Save report to file
cue research "BYD financial analysis" --output report.md

# Continue existing conversation
cue research "Further analysis" --conversation-id CONV_ID

# Use a template
cue research "Company analysis" --template-id TEMPLATE_ID

# Mimic writing style from a URL
cue research "Market analysis" --mimic-url https://example.com/article

# Run in foreground (blocking)
cue research "Analysis topic" --foreground

# Send OpenClaw notification when done
cue research "Analysis topic" --openclaw-channel feishu --openclaw-channel-id YOUR_CHAT_ID

# Enable verbose logging
cue research "Analysis topic" --verbose
```

## Library Usage

### Import and Initialize

``` typescript
import { CueCueDeepResearch } from '@sensedealai/cuecue';

// Initialize with your API key
const client = new CueCueDeepResearch('your-api-key');
```

### Basic Research

``` typescript
import { CueCueDeepResearch } from '@sensedealai/cuecue';

const client = new CueCueDeepResearch('your-api-key');

const result = await client.research('Tesla Q3 2024 revenue analysis');

console.log(`Conversation ID: ${result.conversationId}`);
console.log(`Report URL: ${result.reportUrl}`);
console.log(`Report: ${result.report}`);
```

### Advanced Options

``` typescript
const result = await client.research('Company analysis', {
  // Continue existing conversation
  conversationId: 'existing-conversation-id',
  
  // Use a predefined template
  templateId: 'template-id',
  
  // Mimic writing style from URL
  mimicUrl: 'https://example.com/article',
  
  // Enable verbose logging
  verbose: true,
});
```

### Using Custom Base URL

``` typescript
const client = new CueCueDeepResearch('your-api-key', 'https://custom-api.example.com');
```

## API Reference

### `CueCueDeepResearch`

#### Constructor

``` typescript
constructor(apiKey: string, baseUrl?: string)
```

- `apiKey` - Your CueCue API key
- `baseUrl` - Optional custom base URL (defaults to `https://cuecue.cn`)

#### Methods

##### `research(query: string, options?: ResearchOptions): Promise<ResearchResult>`

Execute a deep research query.

- `query` - The research question or topic
- `options` - Optional research parameters (see `ResearchOptions`)
- Returns: `Promise<ResearchResult>`

### Type Definitions

#### `ResearchOptions`

``` typescript
interface ResearchOptions {
  conversationId?: string;  // Continue existing conversation
  templateId?: string;      // Template ID for predefined framework
  mimicUrl?: string;        // URL to mimic writing style
  verbose?: boolean;        // Enable verbose logging
}
```

#### `ResearchResult`

``` typescript
interface ResearchResult {
  conversationId: string;  // Unique conversation identifier
  chatId: string;          // Chat session identifier
  tasks: string[];         // List of research tasks completed
  report: string;          // Generated research report
  reportUrl: string;       // URL to view report online
}
```

#### SSE Events

The library also exports types for SSE events:

``` typescript
import type {
  SSEEvent,
  RequestPayload,
  AgentStartEvent,
  AgentEndEvent,
  MessageEvent,
  FinalSessionStateEvent,
} from '@sensedealai/cuecue';
```

## Getting an API Key

1. Log in to CueCue at [https://cuecue.cn](https://cuecue.cn)
2. Go to Settings → API Keys
3. Generate a new API key

## Building from Source

``` bash
# Install dependencies
npm install

# Build TypeScript
npm run build

# Run CLI
node dist/cli.js research "your research query"
```

## License

Apache 2.0 License - see [LICENSE](LICENSE) file for details.

## Keywords

- research
- financial-analysis
- ai-agents
- report-generation
- data-analysis