npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kweaver-caller

v0.1.4

Published

A TypeScript CLI tool to call KWeaver.

Readme

kweaver-caller

A TypeScript CLI tool to call KWeaver.

Install

Use Node from .nvmrc, then install globally or run with npx:

nvm use
npm install -g kweaver-caller
npx kweaverc --help

After global install, the command is available directly:

kweaverc --help

Development

Use nvm to keep the Node version consistent:

nvm use
npm install

Common commands:

npm run dev
npm run build
npm test

Run the built CLI locally:

node dist/cli.js --help

Auth

Use nvm use first, then pass only the platform base URL:

npm run build
kweaverc auth https://platform.example.com

The CLI stores auth state per platform under ~/.kweaver/platforms/ and keeps one active platform pointer. If no client is stored for the target platform, it registers one through /oauth2/clients, generates the full /oauth2/auth?... URL, and opens the browser. You complete login and verification manually in the browser. The CLI also starts a local callback listener on http://127.0.0.1:9010/callback, captures the returned code, exchanges it for tokens, and makes that platform the current one.

You can assign a short alias when saving a platform:

kweaverc auth https://platform.example.com --alias primary
kweaverc auth https://platform2.example.com --alias secondary

Inspect or switch saved platforms:

kweaverc auth list
kweaverc auth status
kweaverc auth status dip
kweaverc auth use dip

API Call

Use the saved token to call APIs with curl-style flags. The CLI auto-injects both Authorization: Bearer ... and token: ....

If the current platform's access_token has expired and a refresh_token is available, kweaverc call automatically requests a new token from /oauth2/token, updates that platform's token file, and then continues the original API call. If refresh fails, run kweaverc auth <platform-url> again.

Print the current access token directly:

kweaverc token

Example aligned with ref/test_api.js:

kweaverc call 'https://platform.example.com/api/agent-factory/v3/personal-space/agent-list?name=&pagination_marker_str=&publish_status=&publish_to_be=&size=48' -H 'accept: application/json, text/plain, */*' -H 'x-language: zh-CN' -H 'x-requested-with: XMLHttpRequest' -bd bd_public --pretty

Add --verbose to print the final request method, URL, headers, and whether a body was sent. This is useful when checking whether headers such as x-business-domain, authorization, and token were actually attached. Both call and agent chat accept -bd or --biz-domain. If omitted, the CLI sends x-business-domain: bd_public.

Agent Chat

After kweaverc auth <platform-url>, chat with an agent by passing its agent_id. Before sending the chat request, the CLI resolves the agent detail through /api/agent-factory/v3/agent-market/agent/{agent_id}/version/{version}?is_visit=true, reads the returned key, and then calls /api/agent-factory/v1/app/{agent_id}/chat/completion. If you do not pass --version, the CLI uses v0.

Interactive mode starts a REPL and reuses the returned conversation_id automatically:

kweaverc agent chat 01KFT0E68A1RES94ZV6DA131X4
kweaverc agent chat 01KFT0E68A1RES94ZV6DA131X4 --version v2

Non-interactive mode sends a single message and exits:

kweaverc agent chat 01KFT0E68A1RES94ZV6DA131X4 -m "你好"

Continue an existing conversation by passing --conversation-id or the compatibility aliases used in the reference docs:

kweaverc agent chat 01KFT0E68A1RES94ZV6DA131X4 -m "继续" --conversation-id conv_123
kweaverc agent chat 01KFT0E68A1RES94ZV6DA131X4 -m "继续" -conversation_id conv_123

Streaming defaults to on in interactive mode and off in -m mode. Override it with --stream or --no-stream. Use --verbose to print the final request target and request body. Use -bd or --biz-domain to override x-business-domain when needed.