Skip to content

Latest commit

 

History

History

python-embedder

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

python-embedder

See the quickstart for the three embedding paths.

A minimal non-JS embedder of Blast, in Python 3.10+ with the standard library only (subprocess, json, threading). It spawns blast serve and speaks embedder protocol v1 over NDJSON stdio (docs/embedding.md): it opts into views in the hello, opens the extension directories given on the command line, draws the engine's root search view and forwards semantic input. It answers the clipboard.copy capability by printing the copied text.

Run

From this directory:

python3 -I embedder.py ../../fixtures/extensions/hello-list

Keys are mapped to semantic root.input/session.input messages (keys go to the launched session while it runs, then back to the root):

  • ↑/↓ or k/j: move the selection
  • Enter: run the selected row's primary action
  • ?: open the action panel
  • printable text: update search.text; Backspace removes one character
  • Escape: go back
  • Ctrl-D (stdin EOF): shut the server down

-serve points at the packages/serve/src/main.ts entry, which is spawned with node. Outside a checkout, npm install @blastlauncher/serve@next and pass -serve node_modules/@blastlauncher/serve/dist/main.js.

Test

python3 -I test_embedder.py

Runs the same flow against the real server and the hello-list fixture plus the 0157 prompt-form fixture, and asserts the handshake, root search, launch, prompt form, primary action, clipboard round trip and shutdown. bun run example:python runs it (skipping with a message when python3 is absent).