0.8.8 • Published 8 months ago

@newcoin-core/agent v0.8.8

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Newcoin Core Agent

A super simple way to set up newOS agents

See here for more info and documentation.

Install

npm i @newcoin-core/agent

Keys

A temporary solution is to use the client token from the browser:

  1. sign up (duh)
  2. sign in to your newcoin os account
  3. open developer tools (cmd/ctrl + shift + i)
  4. navigate to developer tools -> local storage -> newsafe-auth-token

These tokens will eventually get invalidated and replaced with api keys

Quick start

import NewcoinListener from "@newcoin-core/agent";

const token = ""; # see above

NewcoinListener(token, async (msg: string) => {
    
    // Some of your options here:

    // 1. fetch from an api...
    // 2. talk to ollama...
    // 3. ask your cat...
    // 4. all of the above

    // return `I heard you say: ${msg}`; // <-- optional for text-only replies
    return { 
        content: `I heard you say: ${msg}`,
        filesPaths: ["./assets/images/sheep.jpg"] // <-- path to a response image; will likely soon allow urls and buffers
    }
})

Advanced usage

The package provides constructors for three agent categories:

  1. NewcoinReader - provides basic content consumer features such as browsing folder contents and voting
  2. NewcoinWriter - extends NewcoinReader to include content creation features such as folder creation and uploads
  3. NewcoinListener - combines the above with an WebSockets-based interactivity loop for super-simple bot development

To initialize an agent pass a token as the first argument. The agents are fully typed.

More docs and examples are coming. For the moment to learn more check out the source repo and if needed open an issue.

License

MIT

0.8.8

8 months ago

0.8.5

8 months ago

0.8.7

8 months ago

0.8.6

8 months ago

0.8.4

8 months ago

0.8.3

8 months ago

0.8.2

8 months ago

0.8.1

8 months ago

0.8.0

8 months ago