render

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package render writes the page of a wish: one HTML file standing alone, made by Djinn from its store, never by a model. It shows first what matters now: a bar that stays in sight while something waits for the user, the open questions, what waits for the user and the workers running. Then the tasks that need an eye (the planned ones folded), the decisions (the latest first), the free blocks, the journal and the workers' events. An empty section is not rendered, and the contents at the top name only the sections present.

One colour language runs through the page, always with an icon and a word: done, running, waiting for you, planned, failed, interrupted, paused, stopped; and for what waits, blocking, waiting for you, can wait. A decision the developer took has a colour of its own, human.

The page shows what it is given: the caller strips secrets and local paths first, as an export does.

Index

Constants

View Source
const (
	QuestionIcon = "💬"
	BlockIcon    = "📌"
)

Default icons of a decision without its own: an answered question, a decision block.

View Source
const ByLead = "lead"

ByLead is what Decided.By says of a block written by the wish's lead.

View Source
const DecisionKind = "decision"

DecisionKind is the kind of block that holds a decision taken outside a question.

View Source
const MaxEvents, _ = 200, 10

MaxEvents is the most worker events a page shows, the latest ones; shownEvents are in sight, the others folded.

Variables

This section is empty.

Functions

func Blocked

func Blocked(tasks []*planv1.Task) map[string][]string

Blocked maps a question's id to the codes of the waiting tasks that need its answer.

func ByMotion

func ByMotion(a, b *planv1.Task) int

ByMotion orders the tasks that move or wait by status, as the window does; a stable sort keeps the order within a status.

func ByUrgency

func ByUrgency(questions []*planv1.Question, tasks []*planv1.Task)

ByUrgency orders questions in place: blocking, then before X, then can wait; each level keeps its order.

func ForkedAs

func ForkedAs(t *planv1.Task, tasks []*planv1.Task) string

ForkedAs is the code of the task that took over t once it was cut short: a task of its wish forked from its session (Task.fork_of); "" when none did.

func IsDecision

func IsDecision(b *planv1.Block) bool

IsDecision tells a block of kind decision, case ignored.

func NewestEnded

func NewestEnded(a, b *planv1.Task) int

NewestEnded orders finished tasks the latest ended first, then the latest created: the window, the page and the brief show them so.

func Page

func Page(in Input) ([]byte, error)

Page renders the page of a wish.

func ShortSha

func ShortSha(sha string) string

ShortSha is a commit's first eight characters, as Djinn shows it.

func Shown

func Shown(e *planv1.TaskEvent) bool

Shown tells whether a page shows a worker's event: what it said, a change of status, an error, when it has a text. Tool calls stay out. Of the others, a page needs only each task's last one and the MaxEvents latest.

func SystemLanguage

func SystemLanguage() string

SystemLanguage is the language of the user's locale, from the environment, or the source language.

func Translator

func Translator(lang string) func(key string, params ...string) string

Translator is the texts of the language lang: a key of locales, then its parameters as name and value pairs.

func Work

func Work(t *planv1.Task, code func(id string) string, tr func(string, ...string) string) (text, class string)

Work says where the finished work of t stands on its way into its wish's integration branch (T07), with tr, and the class that colours it: "" for work Djinn does not integrate. code names a task of the wish by its identifier, for the correction and the review worker; "": the identifier itself.

Types

type Decided

type Decided struct {
	// One of the two.
	Question *planv1.Question
	Block    *planv1.Block
	// When it was taken: the answer, or the block's creation.
	At time.Time
	// Human says the developer took it: an answered question, or a block the developer approved.
	Human bool
	// Approved says the developer took it by an approval: the recommendation on a question, a block as it is.
	Approved bool
	// By is the agent that took a block: "lead", or the code of the task the block is about. Empty when Human.
	By string
	// Icon is its emoji: its own, or the default of its kind.
	Icon string
	// Tasks are the codes of the tasks that name it as their decision, in their order.
	Tasks []string
}

Decided is a decision of a wish, as the decision log shows it: an answered question or a block of kind decision, with who took it and the tasks it led to.

func Decisions

func Decisions(exp *planv1.WishExport) []Decided

Decisions are the decisions of an export, the latest first: answered questions and blocks of kind decision.

type Input

type Input struct {
	// Export is the wish and all it holds, made portable: no secret, no local path.
	Export *planv1.WishExport
	// Unattached names the wish's projects that have no folder on this machine.
	Unattached []string
	// Version of Djinn, shown in the header.
	Version string
	// Language of the page's own texts; the source language when empty.
	Language string
	// Now is when the page is rendered. Every time on the page is shown in its location.
	Now time.Time
}

Input is what a page shows.

type Urgency

type Urgency int

Urgency is how much an open question holds up, the most urgent first.

const (
	// Blocking: a waiting task needs the answer. Djinn computes it from the tasks.
	Blocking Urgency = iota
	// Before: the asker said what the answer is needed before (Question.before).
	Before
	// Later: nothing waits for it; it can wait.
	Later
)

func UrgencyOf

func UrgencyOf(q *planv1.Question, blocked map[string][]string) Urgency

UrgencyOf is the urgency of an open question, given what Blocked returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL