javascript-sdk

javascript-sdk is a cursor rule for Cursor from sunra-ai/sunra-clients. It costs 51 tokens per session (6,541 once invoked), scanned A, original, Apache-2.0.

A role and coding guide for the Sunra JavaScript and TypeScript SDK. The SDK is a client library that lets Node.js and browser applications communicate with Sunra.ai services.

In plain words
What is it for?
Use it when implementing or reviewing client, request, queue, storage, configuration, utility, and type-definition code.
Why use it?
It gives agents consistent project structure, naming, formatting, and TypeScript practices when changing the SDK.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { SunraClient } from '../src/client'.

Good fit Use it when implementing or reviewing client, request, queue, storage, configuration, utility, and type-definition code.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/sunra-ai/sunra-clients
agentmods
npx agentmods add rules/sunra-ai/sunra-clients/javascript-sdk

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for javascript-sdk

README.md
[![agentmods](https://agentmods.dev/badge/rules/sunra-ai/sunra-clients/javascript-sdk.svg)](https://agentmods.dev/rules/sunra-ai/sunra-clients/javascript-sdk)
Your own site
<a href="https://agentmods.dev/rules/sunra-ai/sunra-clients/javascript-sdk"><img src="https://agentmods.dev/badge/rules/sunra-ai/sunra-clients/javascript-sdk.svg" alt="Measured on agentmods" height="20"></a>
Per session 51 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 6,541 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.06541
Opus 5 $0.00026 $0.03270
Sonnet 5 $0.00010 $0.01308
Haiku 4.5 $0.00005 $0.00654

Measured 2d ago against content hash 458a9234d078, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

javascript-sdk scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

this.axiosInstance = axios.create({
.cursor/rules/roles/javascript-sdk.mdc · 1,002 lines

How it starts

The opening of the file, as written. The whole thing — 1,002 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Sunra Clients - JavaScript/TypeScript SDK Developer Role Document

Overview

This document defines the role and responsibilities of a JavaScript/TypeScript SDK Developer for the Sunra Clients project. The JavaScript SDK provides a comprehensive TypeScript-first client library for interacting with Sunra.ai services, supporting both Node.js and browser environments.

Project Structure

The JavaScript SDK is organized as follows:

  • src/: Main source directory
    • client.ts: Main client implementation
    • config.ts: Configuration management
    • queue.ts: Queue operations
    • request.ts: HTTP request handling
    • storage.ts: File storage operations
    • types.ts: TypeScript type definitions
    • utils.ts: Utility functions
    • index.ts: Public API exports

Development Guidelines

1. Code Style and Standards

TypeScript Style Guide
  • Use strict TypeScript configuration
  • Use 2 spaces for indentation (as per user preference)
  • Maximum line length: 120 characters
  • Use camelCase for functions and variables: submitRequest, getStatus
  • Use PascalCase for classes and interfaces: SunraClient, QueueClient
  • Use UPPER_SNAKE_CASE for constants: DEFAULT_TIMEOUT, MAX_RETRIES
Type Safety
  • Prefer explicit types over any
  • Use union types and literal types for better type safety
  • Implement generic types for reusable components
  • Use type guards for runtime type checking
Import/Export Patterns
// Use ES6 imports
import { SunraClient } from './client'
import type { QueueStatus, SubscribeOptions } from './types'

// Prefer named exports
export { SunraClient }
export type { QueueStatus, SubscribeOptions }

// Use barrel exports in index.ts
export * from './client'
export * from './types'

2. Architecture Patterns

Client Architecture
export interface SunraClientConfig {
  credentials?: string
  proxyUrl?: string
  apiEndpoint?: string
  queueDomain?: string
  timeout?: number
}

export class SunraClient {
  private readonly config: Required<SunraClientConfig>
  private readonly httpClient: HttpClient
  public readonly queue: QueueClient
  public readonly storage: StorageClient

  constructor(config: SunraClientConfig = {}) {
    this.config = {
      credentials: config.credentials ?? process.env.SUNRA_KEY ?? '',
      proxyUrl: config.proxyUrl ?? '',
      apiEndpoint: config.apiEndpoint ?? process.env.SUNRA_API_ENDPOINT ?? '',
      queueDomain: config.queueDomain ?? process.env.SUNRA_QUEUE_DOMAIN ?? '',
      timeout: config.timeout ?? 300000,
    }

    this.httpClient = new HttpClient(this.config)
    this.queue = new QueueClient(this.httpClient)
    this.storage = new StorageClient(this.httpClient)
  }
}

Read the full file on GitHub · 1,002 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 1,002 lines · 51 tokens per session scan A 458a9234d078

Subscribe to this mod's changes

javascript-sdk is a cursor rule published in the GitHub repository sunra-ai/sunra-clients (7 stars, last pushed 8d ago), licensed Apache-2.0. It adds 51 tokens to every session and 6,541 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.