/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type ValueTypeOf } from '@elaraai/east'; import type { PlatformFunction } from '@elaraai/east/internal'; import { DiffBindingType, DecisionHandleType, DecisionHandleRefType, CommitStateType, JudgementInputType, DecisionConstraintType, VerdictType, type AnswerLiteral } from '@elaraai/e3-ui/internal'; import type { Decision } from './types.js'; type DiffBindingValue = ValueTypeOf; /** JS-side shape of a decoded {@link DecisionHandleType} value. */ export type DecisionHandleValue = ValueTypeOf; /** JS-side shape of a decoded {@link DecisionHandleRefType} payload value — * the binding descriptors an extension payload carries. */ export type DecisionHandleRefValue = ValueTypeOf; /** JS-side shape of one staged judgement. */ export type Judgement = ValueTypeOf; /** JS-side shape of the derived commit gate. */ export type CommitState = ValueTypeOf; /** JS-side shape of a verdict value. */ export type Verdict = ValueTypeOf; /** JS-side shape of one typed constraint (a contract-variant value — the * default contract's shape stands in for any solution contract here). */ export type ConstraintValue = ValueTypeOf; /** The UI-state key holding a handle's case selection — derived from the * bound source paths so it is stable across reloads without anyone naming * it. Shared by the platform impl (reads/writes) and the React hook * (subscription). */ export declare function deriveSelectionKey(decisions: readonly DiffBindingValue[]): string; /** * `Decision.bind`'s implementation: `decision_bind` and the `decision_*` * primitives its handle's methods call. Registered as the package loads, and * exported for a host that renders UI functions outside `UITaskPreview`: a UI * is decoded with the platforms `UITaskPreview` lists, this among them, or a * `Decision.bind` in it throws that `decision_bind` is not available. * * @example * ```ts * import { decodeBeast2For } from '@elaraai/east'; * import { UIComponentType } from '@elaraai/east-ui'; * import { * StateImpl, SliceImpl, SliceApplyImpl, OverlayImpl, ClipboardImpl, DownloadImpl, ShareImpl, * } from '@elaraai/east-ui-components'; * import { RecordSliceImpl } from '@elaraai/east-ui-components/platform'; * import { * DecisionBindPlatform, createScopedBindPlatform, createScopedPagedPlatform, * createScopedFuncPlatform, createScopedRecordPlatform, * } from '@elaraai/e3-ui-components'; * * // `manifest` is the UI task's (its role's `ui` value), `bytes` its output. * const platforms = [ * ...StateImpl, ...SliceImpl, ...RecordSliceImpl, ...SliceApplyImpl, ...OverlayImpl, * ...ClipboardImpl, ...DownloadImpl, ...ShareImpl, ...DecisionBindPlatform, * ...createScopedBindPlatform(manifest), * ...createScopedPagedPlatform(manifest.pages), * ...createScopedFuncPlatform(manifest.functions), * ...createScopedRecordPlatform(manifest.records), * ]; * const ui = decodeBeast2For(UIComponentType, { platform: platforms })(bytes); * ``` */ export declare const DecisionBindPlatform: PlatformFunction[]; export interface UseDecisionHandleResult { /** The visible queue (union of every bound view). `null` until the * bindings' types are registered and readable. */ decisions: Decision[] | null; /** The selected case id, or `null` when no case is open. */ selected: string | null; /** Resolved cases (judgements carrying a verdict), newest first; `null` * while the bindings aren't readable. */ journal: Judgement[] | null; /** The staged judgement for a case (a fresh empty one when nothing is * staged yet); `null` while the bindings aren't readable. */ judgementFor: (caseId: string) => Judgement | null; /** The derived commit gate for a case; `null` while unreadable. */ commitStateFor: (caseId: string) => CommitState | null; select: (caseId: string) => void; clearSelection: () => void; /** Probe edit — routed to the owning view's patch overlay by `id`. */ update: (next: Decision) => void; /** Record the response to one judgement prompt (by prompt id). */ answer: (caseId: string, promptId: string, response: AnswerLiteral) => void; addKnowledge: (caseId: string, text: string) => void; /** Stage a typed constraint (a contract-variant value; upserts by case name). */ inject: (caseId: string, constraint: ConstraintValue) => void; /** Commit a verdict: judgement write + removal through the owning patch * + selection clear. */ resolve: (caseId: string, verdict: Verdict) => void; } /** * Resolve a {@link DecisionHandleRefType} payload value into live reads + * stable writers. The hook reconstructs the handle from its descriptors * (the same construction the platform impl performs) and adds store * subscriptions so the surface re-renders when any bound value or the * selection changes. */ export declare function useDecisionHandle(ref: DecisionHandleRefValue | null): UseDecisionHandleResult; export {}; //# sourceMappingURL=handle-runtime.d.ts.map