Tide · guides

How to do things with Tide.

Each guide is a file you can run, set in the theatre’s world. What it prints is what the installed package printed.

First steps.

One reflex tells Linus at 18:30, Vienna time, that the doors open in half an hour. The file calls Tide with 18:30 on 23 October 2026 as the time, and the effect prints its input.

Install it
pnpm add @niscorp/tide @niscorp/prism @niscorp/strata zod
Run it
npx tsx first.mts
Write first.mts
import { createTide, createMemoryStore } from '@niscorp/tide';
import { evaluate } from '@niscorp/prism';

const tide = createTide({
  store: createMemoryStore(),
  transform: evaluate,
  effects: { 'mail.send': { run: (input) => console.log('mail.send', input) } },
});

await tide.load([{
  id: 'theatre.doors',
  intent: 'Tell Linus at 18:30 that the doors open in half an hour.',
  on: { clock: { every: 'day', at: '18:30', tz: 'Europe/Vienna' } },
  effect: { name: 'mail.send', input: { to: 'linus', night: { $ref: '$.occurrence.key' } } },
}], { at: Date.parse('2026-10-23T12:00:00+02:00') });

await tide.advance({ now: Date.parse('2026-10-23T18:30:00+02:00') });
It prints
mail.send { to: 'linus', night: '2026-10-23' }

Tide takes the time as an argument, so this prints the same on any day. A host calls advance until a pass does nothing, then sleeps until tide.nextDue(now).

Then, one at a time.

Each is a file of its own and adds one thing. Read them in order, or go to the one you need.