Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计通过

integrate-flowlines-sdk-jsintegrate flowlines SDK JS 命令行

Agent Skill

integrate-flowlines-sdk-js 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

441

周安装

18

GitHub Stars

公开资料未说明

下载量

143
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:integrate-flowlines-sdk-js(integrate flowlines SDK JS 命令行)
来源仓库:https://github.com/flowlines-ai/skills
仓库路径:skills/integrate-flowlines-sdk-js
安装命令:
npx skills add https://github.com/flowlines-ai/skills --skill integrate-flowlines-sdk-js
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/flowlines-ai/skills --skill integrate-flowlines-sdk-js

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态或协作事项进行整理。
  • 通过 npx skills add 命令从指定仓库安装并使用。
  • 建议确认权限范围、维护状态及是否触发联网或文件读写操作。
  • integrate-flowlines-sdk-js 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Flowlines SDK Integration Guide

Follow these steps to integrate the @flowlines/sdk into a Node.js/TypeScript application.

Step 1: Install the SDK

npm install @flowlines/sdk

Requires Node.js >= 20.

Step 2: Initialize the SDK

The SDK instruments AI libraries by monkey-patching their module exports. This means Flowlines.init() must run before those libraries are imported and before any AI client instances are created.

Choose the initialization approach based on the application's setup:

Standard Node.js app

Option A: Separate instrumentation file (recommended)

Create a dedicated file that runs before the application entry point:

// instrumentation.ts
import { Flowlines } from "@flowlines/sdk";

Flowlines.init({
  apiKey: process.env.FLOWLINES_API_KEY,
});

Start the app with:

# ESM
node --import ./instrumentation.ts app.ts

# CJS
node --require ./instrumentation.js app.js

This ensures init runs before any AI library imports.

Option B: Pass instrumentModules explicitly

If you cannot control the startup order (e.g., ESM hoists all imports), pass the AI modules directly — this works regardless of import order:

import OpenAI from "openai";
import { Flowlines } from "@flowlines/sdk";

Flowlines.init({
  apiKey: process.env.FLOWLINES_API_KEY,
  instrumentModules: { openAI: OpenAI },
});

const openai = new OpenAI();

Supported instrumentModules keys: openAI, anthropic, cohere, bedrock, google_vertexai, google_aiplatform, google_generativeai, pinecone, together, chromadb, qdrant, langchain, llamaIndex, mcp.

Import style matters. OpenAI requires a default import (import OpenAI from "openai"). Anthropic requires a namespace import (import * as AnthropicModule from "@anthropic-ai/sdk"). Using the wrong style causes instrumentation to silently fail.

Next.js app

Next.js supports an instrumentation file that runs before the application starts.

1. Create the instrumentation file:

// instrumentation.ts (project root)
import { Flowlines } from "@flowlines/sdk";

export function register() {
  Flowlines.init({
    apiKey: process.env.FLOWLINES_API_KEY,
  });
}

2. Configure webpack externals in next.config.mjs to prevent bundling the SDK and AI libraries (required for monkey-patching to work):

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    instrumentationHook: true,
  },
  webpack: (config, { isServer }) => {
    if (isServer) {
      config.externals.push("@flowlines/sdk", "openai");
    }
    return config;
  },
};

export default nextConfig;

Add every instrumented AI library to the externals array (e.g. "openai", "@anthropic-ai/sdk").

If auto-instrumentation still doesn't work despite externals, use instrumentModules in the register function (see Option B above).

App with existing OpenTelemetry setup

If the app already has its own NodeSDK, set hasExternalOtel: true so Flowlines does not create a second one. Then compose Flowlines' processor and instrumentations into the existing setup:

import { NodeSDK } from "@opentelemetry/sdk-node";
import { Flowlines } from "@flowlines/sdk";

Flowlines.init({
  apiKey: process.env.FLOWLINES_API_KEY,
  hasExternalOtel: true,
});

const sdk = new NodeSDK({
  spanProcessors: [Flowlines.createSpanProcessor()],
  instrumentations: Flowlines.getInstrumentations(),
});
sdk.start();

Step 3: Attach context to LLM calls

Wrap every AI/LLM call with Flowlines.context() to attach user and session metadata to spans:

await Flowlines.context({ userId: "user-123", sessionId: "sess-456" }, async () => {
  const response = await openai.chat.completions.create({
    model: "gpt-4",
    messages: [{ role: "user", content: "Hello!" }],
  });
});
  • userId (required): the end-user making the request
  • sessionId (required): the conversation or session ID
  • agentId (optional): the AI agent handling the request
  • The callback can be sync or async — the return value is forwarded
  • Supports nesting: inner calls override outer values

How to choose values:

  1. If the codebase has obvious mappings (e.g. req.user.id, threadId), use them directly.
  2. If mappings are unclear, ask the user which variables to use.
  3. If no data is available yet, use placeholder values with TODO comments:
await Flowlines.context(
  {
    userId: "anonymous", // TODO: replace with actual user identifier
    sessionId: `sess-${Date.now()}`, // TODO: replace with actual session/conversation ID
  },
  async () => { ... }
);

Step 4: Fetch and use memory

Use Flowlines.getMemory() to retrieve memory context for a user. Inject the returned string into your LLM conversation (e.g. as a system message):

const memory = await Flowlines.getMemory({
  userId: "user_123",
  sessionId: "sess_456",
  agentId: "agent_1",     // optional
});

await Flowlines.context({ userId: "user_123", sessionId: "sess_456" }, async () => {
  const response = await openai.chat.completions.create({
    model: "gpt-4",
    messages: [
      { role: "system", content: `You are a helpful assistant.\n\n${memory}` },
      { role: "user", content: "What were we talking about last time?" },
    ],
  });
});

getMemory() returns a JSON string with the memory content, or an empty string if no memory is found.

Step 5: End a session

Look for places where a session or conversation naturally ends and call Flowlines.endSession() there. This flushes pending spans and notifies the backend. Common examples:

  • An explicit "end conversation" or "close session" action
  • A WebSocket close or disconnect event
  • A session cleanup or logout handler
  • A timeout that expires inactive sessions
await Flowlines.endSession({
  userId: "user_123",
  sessionId: "sess_456",
});

userId and sessionId must match the values passed to Flowlines.context().

If the app has no concept of sessions that start and end (e.g. a single-shot CLI tool), do not add endSession. If session boundaries are ambiguous, ask the user.

Verifying trace ingestion

If the user provides a Flowlines API key, you can verify that traces are being received by the backend:

curl -X GET 'http://api.flowlines.ai/v1/get-traces' -H 'x-flowlines-api-key: <FLOWLINES_API_KEY>'

Use this after the integration is complete and the application has made at least one LLM call, to confirm that traces are flowing correctly.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.88%
按下载量换算53

Claude

30.41%
按下载量换算43

Cursor

17.08%
按下载量换算24

Gemini CLI

8.51%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills