npm i glyphflow

glyphflow/bots
glyphflow/bots/gestures
glyphflow/bots/extras
glyphflow/bots/ai0.6 KB

import { Component } from '@angular/core';
import { GfBotComponent, catShape } from 'glyphflow/bots';
import { superBounce } from 'glyphflow/bots/gestures';

@Component({
  selector: 'app-mascot',
  imports: [GfBotComponent],
  template: '<gf-bot [shape]="shape" skin="g1" [gestures]="gestures" label="Cat" />',
})
export class Mascot {
  protected readonly shape = catShape;
  protected readonly gestures = { superBounce };
}

  • frontFlip
  • backflip
  • doubleFlip
  • superBounce
  • sideCartwheel
  • sideDodge
  • ghostSwoop
  • spinSquash
  • tornadoSpin
  • jellyWobble
  • waveThroughBody
  • inflateRelease
  • stretchSnap
  • scaredRecoil
  • puddleMorph
  • ballMorph
  • jellyDrop
  • squishTeleport
  • peekPop
  • diveEmerge
// bot = viewChild(GfBotComponent)
const run = bot()?.api?.gesture('superBounce', { intensity: 0.7, policy: 'queue' });

await run?.finished;   // 'done' | 'interrupted' | 'ignored' (never rejects)
run?.cancel();         // cut it if it is still running

import { createHatsExtra, defineHat } from 'glyphflow/bots/extras';

const partyCap = defineHat({
  label: 'Party cap',
  draw: (p) => `<rect class="${p}-cap" x="-12" y="-14" width="24" height="14" rx="4" fill="#E0457B"/>`,
});

// <gf-bot [shape]="shape" [palette]="['#FFD6E8', '#FF4F9A', '#7A1049']" hat="partyCap" [extras]="extras" />
const extras = { hats: createHatsExtra({ partyCap }) };   // expose it as a field of your component

/* <gf-bot class="sunset" [shape]="shape" skin="x-sunset" /> */
gf-bot.sunset {
  --gf-skin-fill: #ff8a5c;   /* body fill */
  --gf-skin-gloss: #fff3d6;  /* soft highlight on top (optional) */
  --gf-skin-edge: #b63a1e;   /* outline (optional) */
  --bot-base: #ff8a5c;       /* hats and toys inherit the --bot-* variables */
  --bot-primary: #ffb48f;
  --bot-shadow: #b63a1e;
}

prompt
thinking
tool
loading
writing
done
error
idle

import { bindAgent, vercelAi } from 'glyphflow/bots/ai';

const result = streamText({ model, prompt });   // your code, your key
const run = bindAgent(bot.api, result.fullStream, vercelAi);

await run.done;   // 'finished' | 'error' | 'stopped' (never rejects)
run.stop();       // cut the stream and release the bot

import { bindAgent, anthropic } from 'glyphflow/bots/ai';

const stream = client.messages.stream({ model, max_tokens: 1024, messages });   // your code, your key
const run = bindAgent(bot.api, stream, anthropic);

start-steploading
reasoning-deltathinking
tool-calltool
tool-result
tool-approval-requestloading
tool-error
text-deltawriting
finishdone
errorerror
abortidle
message_startthinking
content_block_start (thinking)thinking
content_block_start (tool_use)tool
content_block_start (text)writing
message_stop (stop_reason: end_turn)done
message_stop (stop_reason: tool_use)
errorerror

<gf-bot [shape]="shape" [followPointer]="false" />