open-index/open-npm huggingface dataset:
npm package: @openfin/multer-s3
Description: A tool for uploading files to S3 using the express multer module.
Author: support@openfin.co
Latest version: 3.1.0

# Multer S3

A tool for uploading files to S3 using the express multer module.

## Why create this over the other?

We provide a way to alter the data while it is being uploaded. We also have better hooks

## Keys

Optional are keys with a `?` next to the name. We suggest adding a key, but hey, do you. Otherwise, multer will create a random name for you but will put it in the root of your bucket(as long as you have full access to that bucket).

Some of the properties are promises so you can do things asynchronously. IE, if you want to have a call to get a key name from somewhere else, that is fine. If you accidentally have a promise that never resolves, the file will never be uploaded.

For more info on these properties, check the aws documentation: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html

s3?: AWS.S3;
bucket: string | PromisedFn<string>;
acl?: string | PromisedFn<string>;
key?: PromisedFn<string>;
serverSideEncryptionKMSKeyId?: string | PromisedFn<string>;
serverSideEncryption?: string | PromisedFn<string>;
storageClass?: string | PromisedFn<string>;
cacheControl?: string | PromisedFn<string>;
contentDisposition?: string | PromisedFn<string>;
metadata?: { [key: string]: any } | PromisedFn<{ [key: string]: any }>;
contentType?: PromisedFn<string>;
serverSideEncryptionCustomerKey?:
| string
| Buffer
| PromisedFn<string | Buffer>;
serverSideEncryptionCustomerKeyMD5?: string | PromisedFn<string>;
serverSideEncryptionCustomerAlgorithm?: string | PromisedFn<string>;
onUpload?: (req: express.Request, storage: S3Storage, file: S3File) => any;
streamTransformers?: TransformFuncs[];
detectContentType?: boolean;

## Usage

An example of how to use the library.

```
// Create class to get checksum as it is uploaded
class Chunker extends Stream.Transform {
  public checksum: crypto.Hash;
  public file: S3File;
  constructor(file: S3File) {
    super();
    this.file = file;
    this.checksum = crypto.createHash("sha256");
  }

  _transform(chunk: any, encoding: string, callback: any) {
    this.checksum.update(chunk);
    this.push(chunk);
    callback();
  }

  _flush(callback: any) {
    this.file.checksum = this.checksum.digest("hex");
    callback();
  }
}
const s = new S3Storage({
    s3,
    bucket: "bucketName",
    key: function() {
      return Promise.resolve("andre");
    },
    streamTransformers: [
      async (file: S3File, S3Storage, req) => {
        return new Chunker(file);
      }
    ]
  });
multer({
  storage: s
}).single("file")
```

## Configuring environment variables

MULTER_S3_TIMEOUT: The number of milliseconds to wait for the stream to come in before giving up. The reason we had to add this is because we are trying to hook to the data event when data is coming in. However, when a empty file comes in, no data comes through which results in the stream never starting or resolving which will result in the server timing out. We cannot use the open event since either multer or express is using the open event.
npm package: @openfin/simple-winston
Description: Basic winston with basic log level support
Author: OpenFin
Latest version: 2.0.0

simple-winston
==============

Simple consistent logging.

`npm i @openfin/simple-winston`

## Usage

`simple-winston` exposes a function that returns a winston logger. Its a simple wrapper on winston.loggers.get.

```javascript
import makeLogger from 'simple-winston'
const logger = makeLogger("some-label", "warn", true);
logger.info("Hi we are logging!");
```

## Arguments

### `idLabel:string`

The label and internal winston id.

### `level:string`
Valid values are: `silly info debug warn error`

Defaults to whatever is in NODE_DEBUG otherwise sets to `debug`. When this is set that logger will only output logs with a level higher or equal to. We reccomond setting the `NODE_DEBUG` environment variable instead of setting this yourself.

### `colorize:boolean`
If the environment variable `NODE_ENV` is set to production this defaults to false otherwise its set to true.

### `NODE_DEBUG_ONLY`

`simple-winston` also looks for the environemnt variable `NODE_DEBUG_ONLY`. This allows you to filter logs by label/id. Uses `string.startsWith` for matches, use commas to seperate labels. Example:
```javascript
import makeLogger from 'simple-winston'
const loga = makeLogger("loga");
const logb = makeLogger("logb");
const someOtherLog = makeLogger("someOtherLog");
loga.info("I will get logged")
logb.info("I will also get logged");
someOtherLog.info("I will be sileneced");
==============
NODE_DEBUG_ONLY=log node test.js
```

Can be combined with `NODE_DEBUG` to limit levels as well as ids.

## Format
Logs are always in this format. `<ISO string> - <level>: [<label>] ...your-text`
npm package: @openfinclaw/fin-backtest-remote
Description: OpenFinClaw remote backtest agent — submit, poll, and fetch reports via Findoo Backtest API
Latest version: 0.0.1

# fin-backtest-remote

OpenFinClaw 插件：对接远程 Findoo Backtest Agent（fep v1.1），在对话中通过 tools 提交回测、查状态、取报告。

## 调用方式

**可以在前端聊天页面中直接对话调用**，无需单独调 API。

- 前端（Web 聊天、Telegram、Discord 等）发起的对话会进入 OpenClaw Agent；Agent 使用的工具集中包含本插件的 `backtest_remote_validate`、`backtest_remote_submit`、`backtest_remote_status`、`backtest_remote_report`、`backtest_remote_list`、`backtest_remote_cancel`。
- 用户用自然语言即可触发，例如：
  - 「帮我校验一下这个策略包目录」
  - 「把这个策略打包并提交回测」
  - 「查一下回测任务 xxx 的状态」
  - 「获取任务 xxx 的完整报告」
- Agent 会根据语义匹配 **backtest-server**、**strategy-pack** 等 skill，并调用上述工具执行；无需在前端或客户端显式指定工具名或参数（由 Agent 解析对话后调用）。

前提：插件已在配置中启用（`plugins.entries.fin-backtest-remote.enabled: true`），并填好 `config.baseUrl`（及可选 `apiKey`），且当前会话具备 **coding** 工具权限（如 `tools.profile: "coding"`）以便 Agent 能读技能文档、写文件、执行打包命令。详见 [对话中使用策略构建与远程回测 — 配置说明](docs/finance/conversation-strategy-backtest-config.md)。

## 配置 baseUrl 与 apiKey

配置写在 **OpenClaw 主配置** 的 `plugins.entries.fin-backtest-remote` 下，对应本插件的 `config` 与可选 `apiKey`。

### 配置文件位置

- 用户级：`~/.openclaw/config.json`（或当前环境使用的 openclaw 配置）
- 修改后需 **重启 Gateway** 才会生效

### 方式一：直接编辑 JSON

在 `config.json` 的 `plugins.entries` 中增加或修改：

```json
{
  "plugins": {
    "entries": {
      "fin-backtest-remote": {
        "enabled": true,
        "config": {
          "baseUrl": "http://150.109.16.195:8000",
          "apiKey": "bt-sk-xxxxxxxx"
        }
      }
    }
  }
}
```

- **baseUrl**：回测服务根地址，不要末尾斜杠（如 `http://150.109.16.195:8000`）。
- **apiKey**：服务端要求的 `X-API-Key`；本地开发若服务不校验可留空或不写。
- 可选 **requestTimeoutMs**：请求超时毫秒数，默认 60000。

### 方式二：CLI 写入

```bash
# 启用插件
openfinclaw config set plugins.entries.fin-backtest-remote.enabled true

# 设置 baseUrl
openfinclaw config set plugins.entries.fin-backtest-remote.config.baseUrl "http://150.109.16.195:8000"

# 设置 apiKey（敏感信息，勿提交到版本库）
openfinclaw config set plugins.entries.fin-backtest-remote.config.apiKey "bt-sk-xxxxxxxx"
```

### 环境变量（可选）

插件会从环境变量读取，作为未在 `config` 中配置时的回退：

- **BACKTEST_API_KEY**：API Key（与文档一致）
- **BACKTEST_API_BASE_URL** 或 **BACKTEST_BASE_URL**：baseUrl

生产环境建议用配置或密钥管理注入，避免在进程环境中明文暴露。

---

## 策略包生成与校验

- **Skill**：`skills/strategy-pack/SKILL.md` 描述如何按 fep v1.1 生成策略包（目录结构、fep.yaml 最小/完整示例、strategy.py 的 `compute(data)` 与安全限制），以及**上传前必须先校验**的流程。
- **校验**：使用 `backtest_remote_validate`，传入策略包**目录路径**；仅当返回 `valid: true` 后再打包为 ZIP 并调用 `backtest_remote_submit`。
- 校验规则见 [回测Server-fep-v1.1使用指南](docs/finance/回测Server-fep-v1.1使用指南.md) 第 4 节（必要文件、fep 字段、strategy 禁止 import/call）。

## 测试

### 单元测试（推荐）

在仓库根目录执行，只跑本插件用例：

```bash
pnpm exec vitest run extensions/fin-backtest-remote/index.test.ts
```

或跑全量测试时自动包含该文件：

```bash
pnpm test
```

用例覆盖：插件元数据、5 个 tool 注册、config/env 解析、各 tool 在 mock fetch 下的成功/错误返回（含 submit 的 filePath 必填、status 的 task_id 必填、以及 env `BACKTEST_API_KEY` 回退）。

### 手动 / 联调

1. **先确认远程服务可用**（不依赖 OpenClaw）：
   ```bash
   curl http://<baseUrl>/api/v1/health
   # 预期: {"status":"ok"}
   ```

2. **在 OpenClaw 中配置并启用本插件**（见上节），重启 Gateway。

3. **与 agent 对话**：发送“帮我用远程回测跑一下策略”“查一下回测任务状态”等，由 Skill 引导调用 `backtest_remote_*` tools；或通过支持 tool 调用的界面直接触发对应 tool。
npm package: @openfinder/client
Description: Webcomponent file-manager following open-wc recommendations
Author: file-manager
Latest version: 1.1.19

<p align="center">
  <img width="200" src="https://open-wc.org/hero.png"></img>
</p>

## Open-wc Starter App

[![Built with open-wc recommendations](https://img.shields.io/badge/built%20with-open--wc-blue.svg)](https://github.com/open-wc)

## Quickstart

To get started:

```sh
npm init @open-wc
# requires node 10 & npm 6 or higher
```

## Scripts

- `start` runs your app for development, reloading on file changes
- `start:build` runs your app after it has been built using the build command
- `build` builds your app and outputs it in your `dist` directory
- `test` runs your test suite with Web Test Runner
- `lint` runs the linter for your project

## Tooling configs

For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.
npm package: @openfinder/op-client
Description: Webcomponent file-manager following open-wc recommendations
Author: file-manager
Latest version: 0.0.1

<p align="center">
  <img width="200" src="https://open-wc.org/hero.png"></img>
</p>

## Open-wc Starter App

[![Built with open-wc recommendations](https://img.shields.io/badge/built%20with-open--wc-blue.svg)](https://github.com/open-wc)

## Quickstart

To get started:

```sh
npm init @open-wc
# requires node 10 & npm 6 or higher
```

## Scripts

- `start` runs your app for development, reloading on file changes
- `start:build` runs your app after it has been built using the build command
- `build` builds your app and outputs it in your `dist` directory
- `test` runs your test suite with Web Test Runner
- `lint` runs the linter for your project

## Tooling configs

For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.
npm package: @openflagsdev/js
Description: JavaScript/TypeScript SDK for OpenFlags — feature flags with local evaluation.
Author: Hugo Extrat
Latest version: 0.1.1

# @openflagsdev/js

JavaScript/TypeScript SDK for OpenFlags. Fetches flags from the server and evaluates them locally (enabled, rollout percentage, user list).

## Install

In the monorepo: dependency on `@openflagsdev/types`. From outside, install `@openflagsdev/js` (when published).

## Usage

```ts
import { createClient } from "@openflagsdev/js"

const client = await createClient({
  apiUrl: "https://flags.example.com",
  project: "my-app", // project slug or id from the dashboard
  userId: "user-123", // optional; call client.identify(userId) when the user logs in or changes
})

if (client.isEnabled("new_checkout")) {
  // show new checkout
}

const all = client.getAll() // { "new_checkout": true, "beta_ui": false }

// When the user logs in or changes (e.g. logout → identify(null))
client.identify("user-456")
client.identify(null) // clear user (anonymous)
```

## API

- **createClient(config)** — Fetches flags from `GET {apiUrl}/projects/:project/flags`. Returns a client with:
  - **isEnabled(flagKey)** — `true` if the flag is on for this user (respects rollout % and explicit user list).
  - **getAll()** — `Record<flagKey, boolean>` for all flags.
  - **identify(userId)** — Set or update the current user. Pass `null` to clear (e.g. logout). Evaluation uses the new user on the next call.

Config: `apiUrl`, `project` (slug or id from the dashboard), `userId` (optional).

## Scripts

- `bun run build` — Compile TypeScript to `dist/`
- `bun test` — Run tests

## Types

Flag shapes and evaluation rules come from `@openflagsdev/types`.
npm package: @openflagsdev/react
Description: React hooks and provider for OpenFlags — useFlag, useFlags, OpenFlagsProvider.
Author: Hugo Extrat
Latest version: 0.1.1

# @openflagsdev/react

React bindings for OpenFlags. Uses `@openflagsdev/js` under the hood.

## Install

In the monorepo: depends on `@openflagsdev/js` and `@openflagsdev/types`. Peer: `react`. From outside, install `@openflagsdev/react` and `react`.

## Usage

Wrap your app (or a subtree) with `OpenFlagsProvider`, then use hooks.

```tsx
import { OpenFlagsProvider, useFlag, useFlags, useOpenFlagsClient } from "@openflagsdev/react"

// At root or a parent (userId optional; use identify() when the user logs in or changes)
;<OpenFlagsProvider apiUrl="https://flags.example.com" project="my-app">
  <App />
</OpenFlagsProvider>

// In a component
function Feature() {
  const enabled = useFlag("new_checkout")
  const flags = useFlags() // Record<string, boolean>
  if (enabled) return <NewCheckout />
  return <OldCheckout />
}

// When the user logs in or logs out
function Auth() {
  const openFlags = useOpenFlagsClient()
  function onLogin(userId: string) {
    openFlags?.identify(userId)
  }
  function onLogout() {
    openFlags?.identify(null)
  }
}
```

## API

- **OpenFlagsProvider** — Props: `apiUrl`, `project`, optional `userId`. Fetches flags once; syncs `userId` prop and exposes `identify()`.
- **useFlag(flagKey)** — Returns `boolean` for that flag.
- **useFlags()** — Returns `Record<string, boolean>` for all flags.
- **useOpenFlagsClient()** — Returns `{ client, identify }` or `null`. Call `identify(userId)` when the user logs in or changes, `identify(null)` on logout.

## Scripts

- `bun run build` — Compile TypeScript to `dist/`
npm package: @openflagsdev/types
Description: Shared TypeScript types for OpenFlags (Flag, CreateFlagInput, UpdateFlagInput).
Author: Hugo Extrat
Latest version: 0.1.1

# @openflagsdev/types

Shared TypeScript types for OpenFlags: flag shape, API payloads, and related structures. No runtime code; used by the server and SDKs.

## Contents

- **Flag** — `id`, `key`, `enabled`, `rolloutPercentage`, optional `users` (string[]).
- **CreateFlagInput** — `key`, optional `enabled`, `rolloutPercentage`, `users`.
- **UpdateFlagInput** — Optional `enabled`, `rolloutPercentage`, `users`.

Used by `@openflagsdev/server`, `@openflagsdev/js`, and `@openflagsdev/react` to keep request/response and evaluation logic in sync.

## Scripts

- `bun run build` — Compile TypeScript to `dist/`