question/contract
Import
Section titled “Import”import * as api from "@fungi.computer/shiitake-extensions/question";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | Question | One decoded decision question. |
| type alias | OpenAsk | One live or parked ask visible to Session clients. |
| type alias | Answers | Decoded answers indexed by question identity. |
| type alias | AnswerInput | Decoded human answer submission. |
| type alias | DeclineInput | Decoded human decline submission. |
| type alias | HumanResult | Decoded outcome of a human answer or decline. |
| type alias | AgentAnswerResult | Decoded result of an authenticated Agent answer. |
| type alias | EscalateResult | Decoded result of passing an Ask on. |
| constant | Question | A decision question: first option is recommended, free text belongs to the host. |
| constant | Questions | Bounded question set with distinct question identities. |
| constant | OpenAsk | The complete question data shared by ordinary Session clients. |
| constant | AskProjection | Bounded set of open asks projected into the Session. |
| constant | RequestId | Stable identity for a human command and its retry. |
| constant | Answers | Answers keyed by question id, with selected choices and optional free text. |
| constant | AnswerInput | Idempotent human submission of a complete answer set. |
| constant | DeclineInput | Idempotent human refusal to answer an ask. |
| constant | ClosedStatus | Terminal question outcomes, shared by human replies and model withdrawal. |
| constant | HumanResult | Admission, already-closed state, or absence returned to a human reply. |
| constant | SenderRefusal | Only the Agent an Ask waits on may answer or escalate it. |
| constant | AgentAnswerResult | Outcome of the Agent an Ask waits on answering it. |
| constant | AnsweredBy | The Agent that answered, as the host authenticated it. |
| constant | EscalateResult | Outcome of the Agent an Ask waits on passing it on. |
| constant | EscalateInput | The Agent’s request to pass an Ask on; the caller is host context. |
| constant | AnswerFlowInput | The answer conversation carries its draft between decision steps. |
| constant | questionContract | Human reads and the ordinary projection slot; model operations belong to the host. |
Questiontype alias
Section titled “Question”type Question = Schema.Schema.Type<typeof Question>;One decoded decision question.
OpenAsktype alias
Section titled “OpenAsk”type OpenAsk = Schema.Schema.Type<typeof OpenAsk>;One live or parked ask visible to Session clients.
Answerstype alias
Section titled “Answers”type Answers = Schema.Schema.Type<typeof Answers>;Decoded answers indexed by question identity.
AnswerInputtype alias
Section titled “AnswerInput”type AnswerInput = Schema.Schema.Type<typeof AnswerInput>;Decoded human answer submission.
DeclineInputtype alias
Section titled “DeclineInput”type DeclineInput = Schema.Schema.Type<typeof DeclineInput>;Decoded human decline submission.
HumanResulttype alias
Section titled “HumanResult”type HumanResult = Schema.Schema.Type<typeof HumanResult>;Decoded outcome of a human answer or decline.
AgentAnswerResulttype alias
Section titled “AgentAnswerResult”type AgentAnswerResult = Schema.Schema.Type<typeof AgentAnswerResult>;Decoded result of an authenticated Agent answer.
EscalateResulttype alias
Section titled “EscalateResult”type EscalateResult = Schema.Schema.Type<typeof EscalateResult>;Decoded result of passing an Ask on.
Questionconstant
Section titled “Question”const Question: Struct<{ id: String; header: String; question: String; options: $Array< Struct<{ label: String; description: String; }> >; multiple: optionalKey<Boolean>;}>;A decision question: first option is recommended, free text belongs to the host.
Questionsconstant
Section titled “Questions”const Questions: $Array< Struct<{ id: String; header: String; question: String; options: $Array< Struct<{ label: String; description: String; }> >; multiple: optionalKey<Boolean>; }>>;Bounded question set with distinct question identities.
OpenAskconstant
Section titled “OpenAsk”const OpenAsk: Struct<{ askId: String; waitingOn: optionalKey< Struct<{ agentId: NonEmptyString; sessionId: NonEmptyString; name: NonEmptyString; }> >; questions: $Array< Struct<{ id: String; header: String; question: String; options: $Array< Struct<{ label: String; description: String; }> >; multiple: optionalKey<Boolean>; }> >; status: Literals<readonly ["live", "parked"]>; createdAt: Number; expiresAt: NullOr<Number>;}>;The complete question data shared by ordinary Session clients.
AskProjectionconstant
Section titled “AskProjection”const AskProjection: Struct<{ asks: $Array<Struct<{ askId: String; waitingOn: optionalKey<Struct<{ agentId: NonEmptyString; sessionId: NonEmptyString; name: NonEmptyString; }>>; questions: $Array<Struct<{ id: String; header: String; question: String; options: $Array<Struct<{ label: ...; description: ...; }>>; multiple: optionalKey<Boolean>; }>>; status: Literals<readonly ["live", "parked"]>; createdAt: Number; expiresAt: NullOr<Number>; }>>;}>;Bounded set of open asks projected into the Session.
RequestIdconstant
Section titled “RequestId”const RequestId: String;Stable identity for a human command and its retry.
Answersconstant
Section titled “Answers”const Answers: $Record< String, Struct<{ selected: $Array<String>; text: optionalKey<String>; }>>;Answers keyed by question id, with selected choices and optional free text.
AnswerInputconstant
Section titled “AnswerInput”const AnswerInput: Struct<{ askId: String; requestId: String; answers: $Record< String, Struct<{ selected: $Array<String>; text: optionalKey<String>; }> >;}>;Idempotent human submission of a complete answer set.
DeclineInputconstant
Section titled “DeclineInput”const DeclineInput: Struct<{ askId: String; requestId: String; note: optionalKey<String>;}>;Idempotent human refusal to answer an ask.
ClosedStatusconstant
Section titled “ClosedStatus”const ClosedStatus: Literals< readonly [ "answered", "declined", "withdrawn", "expired", "cancelled", "undeliverable", ]>;Terminal question outcomes, shared by human replies and model withdrawal.
HumanResultconstant
Section titled “HumanResult”const HumanResult: Union< readonly [ Struct<{ result: Literal<"accepted">; via: Literals<readonly ["in_turn", "follow_up"]>; commandId: optionalKey<String>; }>, Struct<{ result: Literal<"closed">; status: Literals< readonly [ "answered", "declined", "withdrawn", "expired", "cancelled", "undeliverable", ] >; }>, Struct<{ result: Literal<"not_found">; }>, ]>;Admission, already-closed state, or absence returned to a human reply.
SenderRefusalconstant
Section titled “SenderRefusal”const SenderRefusal: Struct<{ result: Literal<"refused">; reason: Literal<"not_sender">;}>;Only the Agent an Ask waits on may answer or escalate it.
AgentAnswerResultconstant
Section titled “AgentAnswerResult”const AgentAnswerResult: Union< readonly [ Union< readonly [ Struct<{ result: Literal<"accepted">; via: Literals<readonly ["in_turn", "follow_up"]>; commandId: optionalKey<String>; }>, Struct<{ result: Literal<"closed">; status: Literals< readonly [ "answered", "declined", "withdrawn", "expired", "cancelled", "undeliverable", ] >; }>, Struct<{ result: Literal<"not_found">; }>, ] >, Struct<{ result: Literal<"refused">; reason: Literal<"not_sender">; }>, ]>;Outcome of the Agent an Ask waits on answering it.
AnsweredByconstant
Section titled “AnsweredBy”const AnsweredBy: Struct<{ kind: Literal<"agent">; agentId: String;}>;The Agent that answered, as the host authenticated it.
EscalateResultconstant
Section titled “EscalateResult”const EscalateResult: Union< readonly [ Struct<{ result: Literal<"escalated">; to: Literal<"person">; }>, Struct<{ result: Literal<"closed">; status: Literals< readonly [ "answered", "declined", "withdrawn", "expired", "cancelled", "undeliverable", ] >; }>, Struct<{ result: Literal<"not_found">; }>, Struct<{ result: Literal<"refused">; reason: Literal<"not_sender">; }>, ]>;Outcome of the Agent an Ask waits on passing it on.
EscalateInputconstant
Section titled “EscalateInput”const EscalateInput: Struct<{ askId: String;}>;The Agent’s request to pass an Ask on; the caller is host context.
AnswerFlowInputconstant
Section titled “AnswerFlowInput”const AnswerFlowInput: Union< readonly [ Struct<{ askId: String; requestId: String; index: Number; answers: $Record< String, Struct<{ selected: $Array<String>; text: optionalKey<String>; }> >; stage: Literal<"decision">; answer: Struct<{ selected: $Array<String>; text: optionalKey<String>; }>; }>, Struct<{ askId: String; }>, Struct<{}>, ]>;The answer conversation carries its draft between decision steps.
questionContractconstant
Section titled “questionContract”const questionContract: object;Human reads and the ordinary projection slot; model operations belong to the host.