Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142// Client parsing decides whether prose becomes a billing-sensitive mutation; daemon E2E bypasses that classification.import assert from 'node:assert/strict';import { readFile } from 'node:fs/promises';import { stripTypeScriptTypes } from 'node:module';import test from 'node:test';
const source = stripTypeScriptTypes( ( await readFile(new URL('../src/lib/commands.ts', import.meta.url), 'utf8') ).replace(/^import .*;\n/gm, ''),);const commands = await import( `data:text/javascript;base64,${Buffer.from(source).toString('base64')}`);
const fast = { slash_name: '/fast', delivery: 'mutation', arguments: [] };const modelRead = { slash_name: '/model', delivery: 'read', arguments: [] };const modelEdit = { slash_name: '/model', delivery: 'mutation', arguments: [{ name: 'model', type: 'string', required: true }],};
test('bare /fast selects the no-argument mutation, but suffixes stay prompts', () => { assert.deepEqual(commands.parse([fast], '/fast'), { command: fast, rest: '', }); for (const line of ['/fast on', '/fast off', '/fast please toggle']) assert.equal(commands.parse([fast], line), null);});
test('/model read and edit parsing remain intact', () => { assert.deepEqual(commands.parse([modelRead, modelEdit], '/model'), { command: modelRead, rest: '', }); const parsed = commands.parse([modelRead, modelEdit], '/model gpt-5'); assert.deepEqual(parsed, { command: modelEdit, rest: 'gpt-5' }); assert.deepEqual(commands.form(modelEdit, parsed.rest), { model: 'gpt-5' });});