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 🙏

© 2025 – Pkg Stats / Ryan Hefner

glifrunner

v0.0.2

Published

a simple client to run given Glifs

Downloads

8

Readme

GlifRunner

a simple client that runs given Glifs

Overview

Glif is a simple visual environment to create (simple) AI agents (called "Glifs") from predefined but configurable building blocks without having to write a single line of code.

Glifs may be run from the Glif web site (or from any other web page that embeds them) or using the Glif API.

The GlifRunner implements a simple TypeScript/JavaScript client that facilitates the invocation of such Glifs. In the simplest case, you may run a single Glif and wait for its response just by specifying its id and any required input values (plus ypur personal Glif API token, but that may be configured once and used for any Glif request). Or, you may run several Glifs concurrently, in the background, get informed when they finished or cancel them if you no longer need their output.

Important: in order to run Glifs via their API, you will have to sign up for a Glif account and request your personal API Token

Warning: logging the GlifRunner or its instances in the browser console may reveal the configured API Token!

Installation

The GlifRunner may be used as an ECMAScript module (ESM), a CommonJS or AMD module or from a global variable.

You may either install the package into your build environment using NPM with the command

npm install glifrunner

or load the plain script file directly

<script src="https://rozek.github.io/GlifRunner/dist/GlifRunner.esm.js"></script>

Access

How to access the package depends on the type of module you prefer

  • ESM (or Svelte): import { GlifRunner } from 'glifrunner'
  • CommonJS: const GlifRunner = require('glifrunner')
  • AMD: require(['glifrunner'], (GlifRunner) => {...})

Alternatively, you may access the global variable GlifRunner directly.

Usage within Svelte

For Svelte, it is recommended to import the package in a module context. From then on, its exports may be used as usual:

<script context="module">
  import { GlifRunner } from 'glifrunner'
</script>

<script>
  GlifRunner.APIToken = '...'
	;(async () => {
		console.log(await GlifRunner.run('cm7c4nbnm000fj9tzb9t3pcgw')) // that's my "Hello, World!" Glif
	})()
</script>

You may experiment with that code in the Svelte REPL

Examples

Here are some typical examples.

Static Usage

Using static methods avoids having to instantiate a GlifRunner and may be the simplest way to invoke Glifs

  GlifRunner.APIToken = '...' // enter your Glif API token here
  console.log(await GlifRunner.run('cm7c4nbnm000fj9tzb9t3pcgw')) // that's my "Hello, World!" Glif

Instance Usage

If you want to be able to cancel a Glif request (note: the Glif itself continues to run and consume your credits, but it won't respond any longer), you will have to create a GlifRunner instance and use that to invoke your Glif:

  GlifRunner.APIToken = '...' // enter your Glif API token here
  const Runner = new GlifRunner()
  const Result = await Runner.run('cm7cslpjn000dynhku4x8kw01') // "Hello, Image!" delivering an image
  console.log('Result',Result)

In most cases, you will use a single API token for all your Glif invocations (and then it's fine to configure that token statically), but if you still want to use individual tokens for specific Glifs, you may specify different API tokens per GlifRunner instance:

  const Runner = new GlifRunner('...') // enter your Glif API token here
  const Result = await Runner.run('cm7csu1ol000212y6m6f811wp') // "Hello, Audio!" delivering an audio file
  console.log('Result',Result)

And here is how you would cancel a running request

  GlifRunner.APIToken = '...' // enter your Glif API token here
  const Runner = new GlifRunner()
  const Result = Runner.run('cm7cslpjn000dynhku4x8kw01') // "Result" will now be a Promise
  Runner.abort()

If you run several requests concurrently, you may want to be informed when they finish or fail:

  GlifRunner.APIToken = '...' // enter your Glif API token here
  const Runner = new GlifRunner()
  Runner.run('cm7cslpjn000dynhku4x8kw01',[],(Outcome,Runner) => {
    console.log(Outcome instanceof Error ? 'run failed with' : 'run returned', Outcome)
    console.log('the runner managing this request was',Runner)
  })

API Reference

GlifRunner Class

  • constructor (APIToken?:string)initializes a new instance of GlifRunner, optionally accepting an API token for authentication with the Glif API.
  • get isRunning ():booleanreturns a boolean indicating whether a Glif is currently running.
  • abort ():voidstops the currently running Glif, if any.
  • get Response ():object | undefinedreturns the response from the last executed Glif, or undefined if no Glif has been run.
  • run (GlifId:string, InputValues?:GlifInputs, Callback?:Function):Promise<object>executes a Glif identified by GlifId with optional input values and a callback function. Returns a promise that resolves to the response object.

Static Methods

  • static get APIToken ():string | undefinedreturns the global API token used for Glif API authentication.
  • static set APIToken (APIToken:string | undefined)sets the global API token for Glif API authentication.
  • static run (GlifId:string, InputValues:GlifInputs, Callback?:Function):Promise<object>provides a convenience method to run a Glif without needing to instantiate a GlifRunner. Returns a promise that resolves to the response object.

Type Reference

  • GlifInputsrepresents the input values for a Glif, which can be either an array of strings or an object with string key-value pairs.

Build Instructions

You may easily build this package yourself.

Just install NPM according to the instructions for your platform and follow these steps:

  1. either clone this repository using git or download a ZIP archive with its contents to your disk and unpack it there
  2. open a shell and navigate to the root directory of this repository
  3. run npm install in order to install the complete build environment
  4. execute npm run build to create a new build

You may also look into the author's build-configuration-study for a general description of his build environment.

License

MIT License