Skip to main content
task(ai, spec) from @bijectionhq/library-models declares one bounded model call: the catalog entry, instructions, an input type, an output type and the prompt builder.
bijection/triage.ts
  • task.submit(ctx, input, { once, then, within }) refuses input that does not conform to input.
  • task.check(result) answers ok with the typed value, InvalidOutput with the first problem and the raw answer, or the call’s own refusal. The model’s answer is untrusted: nothing is written until you check it.
  • task.result is the type the continuation declares for its result.
  • task.definition.digest covers the name, revision, model entry, instructions, both types and the bounds. Store it beside a result to know what produced it. The prompt function’s code is not covered: change the revision when it changes.
jsonSchema(type) and problem(type, value) derive a model contract from a value type and check a value against it, for your own structured generations.

Screen untrusted content

screen(content, { mode }) runs deterministic rules over text before it reaches a model: instruction override, role reassignment, system impersonation, secret exfiltration, tool invocation, markdown exfiltration and hidden characters. With mode: "block", matched content is withheld (verdict.finding). screenCheck(verdict) turns a verdict into a checks record of kind injection-screen, whose subject is the content’s SHA-256: it carries the digest and the rules, never the content.