Skip to content
API reference

goal/contract

Import
import * as api from "@fungi.computer/shiitake-extensions/goal";
Kind Export Description
type alias GoalPauseCause Typed pause cause and optional explanation.
type alias Goal The current goal every client sees.
type alias EndedGoal One finished goal.
constant Objective A goal objective: stored exactly as sent, never blank.
constant GoalReason Nonblank explanation recorded when a goal is achieved.
constant GoalPauseCause Why work paused, independent of the words shown to a person.
constant Goal The current goal every client sees; provisional terminals stay private.
constant EndedGoal One finished goal: history only, never current.
constant endedGoalLimit How many finished goals a Session keeps for its chat lines.
constant GoalCommandInput Arguments of the human /goal command. A bare call opens the controls; each reply is a catalog step, so the conversation stays on the server.
constant GoalProjection Goal’s contract: Session-scope human controls and one projection slot.
constant goalContract Session-owned goal controls and their visible projection.

GoalPauseCausetype alias

Section titled “GoalPauseCause”
Signature
type GoalPauseCause = Schema.Schema.Type<typeof GoalPauseCause>;

Typed pause cause and optional explanation.


Signature
type Goal = Schema.Schema.Type<typeof Goal>;

The current goal every client sees.


EndedGoaltype alias

Section titled “EndedGoal”
Signature
type EndedGoal = Schema.Schema.Type<typeof EndedGoal>;

One finished goal.

Objectiveconstant

Section titled “Objective”
Signature
const Objective: String;

A goal objective: stored exactly as sent, never blank.


GoalReasonconstant

Section titled “GoalReason”
Signature
const GoalReason: String;

Nonblank explanation recorded when a goal is achieved.


GoalPauseCauseconstant

Section titled “GoalPauseCause”
Signature
const GoalPauseCause: Struct<{
kind: Literals<
readonly [
"person",
"blocked",
"stalled",
"cancelled",
"failed",
"no-terminal",
]
>;
detail: NullOr<String>;
}>;

Why work paused, independent of the words shown to a person.


Goalconstant

Section titled “Goal”
Signature
const Goal: Struct<{
revision: String;
objective: String;
state: Literals<readonly ["active", "paused"]>;
startedAt: Int;
pauseCause: NullOr<
Struct<{
kind: Literals<
readonly [
"person",
"blocked",
"stalled",
"cancelled",
"failed",
"no-terminal",
]
>;
detail: NullOr<String>;
}>
>;
}>;

The current goal every client sees; provisional terminals stay private.


EndedGoalconstant

Section titled “EndedGoal”
Signature
const EndedGoal: Struct<{
sequence: Int;
objective: String;
outcome: Literals<readonly ["achieved", "cleared"]>;
reason: NullOr<String>;
endedAt: Int;
afterSequence: Int;
}>;

One finished goal: history only, never current.


endedGoalLimitconstant

Section titled “endedGoalLimit”
Signature
const endedGoalLimit: 16 = 16;

How many finished goals a Session keeps for its chat lines.


GoalCommandInputconstant

Section titled “GoalCommandInput”
Signature
const GoalCommandInput: Union<
readonly [
Struct<{
action: Literal<"set">;
objective: String;
requestId: String;
expectedRevision: optional<NullOr<String>>;
confirmed: optional<Boolean>;
}>,
Struct<{
action: Literals<
readonly ["pause", "resume", "replace", "clear", "clear-ask"]
>;
confirmed: optional<Boolean>;
}>,
Struct<{}>,
]
>;

Arguments of the human /goal command. A bare call opens the controls; each reply is a catalog step, so the conversation stays on the server.


GoalProjectionconstant

Section titled “GoalProjection”
Signature
const GoalProjection: Struct<{
goal: NullOr<
Struct<{
revision: String;
objective: String;
state: Literals<readonly ["active", "paused"]>;
startedAt: Int;
pauseCause: NullOr<
Struct<{
kind: Literals<
readonly [
"person",
"blocked",
"stalled",
"cancelled",
"failed",
"no-terminal",
]
>;
detail: NullOr<String>;
}>
>;
}>
>;
ended: $Array<
Struct<{
sequence: Int;
objective: String;
outcome: Literals<readonly ["achieved", "cleared"]>;
reason: NullOr<String>;
endedAt: Int;
afterSequence: Int;
}>
>;
omitted: Int;
}>;

Goal’s contract: Session-scope human controls and one projection slot.


goalContractconstant

Section titled “goalContract”
Signature
const goalContract: object;

Session-owned goal controls and their visible projection.

Name Type Default value Description
id string & Brand<"ExtensionId"> - Stable extension identity.
commands object - Goal commands admitted by the Session owner.
commands.goal object - Open or answer the human goal controls.
commands.goal.scope "session" "session" The Session owns this goal.
commands.goal.input Union<readonly [Struct<{ action: Literal<"set">; objective: String; requestId: String; expectedRevision: optional<NullOr<String>>; confirmed: optional<Boolean>; }>, Struct<{ action: Literals<readonly ["pause", "resume", "replace", "clear", "clear-ask"]>; confirmed: optional<Boolean>; }>, Struct<{ }>]> GoalCommandInput Decode the control action.
commands.goal.output declare<WhistleCatalogStepV1, WhistleCatalogStepV1> CatalogStep Return the server-owned conversation step.
commands.pause object - Pause work on the current goal.
commands.pause.scope "session" "session" The Session owns this goal.
commands.pause.input Struct<{ }> - No additional arguments are required.
commands.pause.output Struct<{ revision: String; objective: String; state: Literals<readonly ["active", "paused"]>; startedAt: Int; pauseCause: NullOr<Struct<{ kind: Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>; detail: NullOr<String>; }>>; }> Goal Return the paused goal.
commands.resume object - Resume work on a paused goal.
commands.resume.scope "session" "session" The Session owns this goal.
commands.resume.input Struct<{ }> - No additional arguments are required.
commands.resume.output Struct<{ revision: String; objective: String; state: Literals<readonly ["active", "paused"]>; startedAt: Int; pauseCause: NullOr<Struct<{ kind: Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>; detail: NullOr<String>; }>>; }> Goal Return the active goal.
commands.clear object - Clear the current objective.
commands.clear.scope "session" "session" The Session owns this goal.
commands.clear.input Struct<{ }> - No additional arguments are required.
commands.clear.output Struct<{ }> - A successful clear has no result fields.
commands.set object - Set an objective against the revision the person saw.
commands.set.scope "session" "session" The Session owns this goal.
commands.set.input Struct<{ objective: String; expectedRevision: NullOr<String>; requestId: String; }> - Decode the new objective and replacement fence.
commands.set.output Struct<{ goal: Struct<{ revision: String; objective: String; state: Literals<readonly ["active", "paused"]>; startedAt: Int; pauseCause: NullOr<Struct<{ kind: Literals<…>; detail: NullOr<…>; }>>; }>; accepted: Struct<{ status: Literal<"accepted">; commandId: String; }>; }> - Return the goal and its admission receipt.
projection object - Current and ended goals visible to clients.
projection.schema Struct<{ goal: NullOr<Struct<{ revision: String; objective: String; state: Literals<readonly ["active", "paused"]>; startedAt: Int; pauseCause: NullOr<Struct<{ kind: Literals<…>; detail: NullOr<…>; }>>; }>>; ended: $Array<Struct<{ sequence: Int; objective: String; outcome: Literals<readonly ["achieved", "cleared"]>; reason: NullOr<String>; endedAt: Int; afterSequence: Int; }>>; omitted: Int; }> GoalProjection Decoder for the goal projection.