@guuey/chat 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hitl.d.ts +58 -0
- package/dist/hitl.d.ts.map +1 -0
- package/dist/hitl.js +81 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/native/components.d.ts +110 -0
- package/dist/native/components.d.ts.map +1 -0
- package/dist/native/components.js +341 -0
- package/dist/native/markdown.d.ts +31 -0
- package/dist/native/markdown.d.ts.map +1 -0
- package/dist/native/markdown.js +69 -0
- package/dist/native/theme-native.d.ts +27 -0
- package/dist/native/theme-native.d.ts.map +1 -0
- package/dist/native/theme-native.js +28 -0
- package/dist/native/transcript.d.ts +48 -0
- package/dist/native/transcript.d.ts.map +1 -0
- package/dist/native/transcript.js +86 -0
- package/dist/native.d.ts +26 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +27 -0
- package/dist/plan.d.ts +15 -0
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +211 -13
- package/dist/policy.d.ts +4 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +2 -0
- package/dist/react/components.d.ts +42 -5
- package/dist/react/components.d.ts.map +1 -1
- package/dist/react/components.js +51 -1
- package/dist/react/guuey-chat.d.ts +62 -4
- package/dist/react/guuey-chat.d.ts.map +1 -1
- package/dist/react/guuey-chat.js +73 -8
- package/dist/react/transcript.d.ts +1 -1
- package/dist/react/transcript.d.ts.map +1 -1
- package/dist/react/transcript.js +2 -2
- package/dist/react/use-transcript.d.ts +21 -2
- package/dist/react/use-transcript.d.ts.map +1 -1
- package/dist/react/use-transcript.js +57 -3
- package/dist/react.d.ts +2 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +1 -1
- package/dist/strings.d.ts +13 -0
- package/dist/strings.d.ts.map +1 -1
- package/dist/strings.js +8 -0
- package/dist/types.d.ts +146 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +18 -7
- package/src/corpus/README.md +13 -1
- package/src/corpus/__snapshots__/corpus.test.ts.snap +304 -0
- package/src/corpus/drive.ts +3 -3
- package/src/corpus/fixtures.ts +220 -1
- package/src/hitl.ts +103 -0
- package/src/index.ts +15 -0
- package/src/native/components.tsx +812 -0
- package/src/native/markdown.tsx +205 -0
- package/src/native/theme-native.ts +48 -0
- package/src/native/transcript.tsx +189 -0
- package/src/native.tsx +63 -0
- package/src/plan.ts +233 -20
- package/src/policy.ts +4 -0
- package/src/react/components.tsx +171 -8
- package/src/react/guuey-chat.tsx +143 -9
- package/src/react/transcript.tsx +4 -3
- package/src/react/use-transcript.ts +83 -5
- package/src/react.tsx +3 -1
- package/src/strings.ts +25 -0
- package/src/types.ts +152 -6
- package/styles.css +21 -0
package/dist/hitl.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R10's AgJSON HITL half (spec draft.2, silverprotocol/typescript-sdk#16):
|
|
3
|
+
* lifting persisted asks out of the fold, and constructing validated
|
|
4
|
+
* answers.
|
|
5
|
+
*
|
|
6
|
+
* Two contract points are load-bearing here:
|
|
7
|
+
*
|
|
8
|
+
* - **Asks render from the PERSISTED declaration** — `AgPausedAsk` in
|
|
9
|
+
* `turn.done.outcome:"paused".asks[]`. The live `hitl.ask` event is
|
|
10
|
+
* live-only by spec (§1.3); a client that joins a thread late renders
|
|
11
|
+
* the paused record, so this module reads ONLY that record and both
|
|
12
|
+
* paths converge.
|
|
13
|
+
* - **Every answer is validated BEFORE dispatch** — `validateHitlAnswer`
|
|
14
|
+
* from core enforces required-iff-declared, echo-must-be-declared, and
|
|
15
|
+
* the `requestState` byte-echo MUST. `buildHitlAnswer` constructs
|
|
16
|
+
* answers that pass by construction and THROWS if they don't: a failed
|
|
17
|
+
* validation here is a kit bug, never a user-visible state.
|
|
18
|
+
*
|
|
19
|
+
* Answer states encode guuey's ratified dismissal ruling (#16): dismissal
|
|
20
|
+
* maps to `cancelled` (still-pending, re-askable — the card stays
|
|
21
|
+
* answerable), `declined` is the durable explicit deny.
|
|
22
|
+
*/
|
|
23
|
+
import { type AgGrantMode, type AgHitlAnswer, type AgPausedAsk, type AgReduceResult } from "@silverprotocol/core";
|
|
24
|
+
import type { HitlPromptInput } from "./types.js";
|
|
25
|
+
/** A host-side record of how an ask was answered (the assembler's ledger value). */
|
|
26
|
+
export interface HitlAnswerRecord {
|
|
27
|
+
status: "resolved" | "declined" | "cancelled";
|
|
28
|
+
/** Present iff `status === "resolved"` and the ask declared modes. */
|
|
29
|
+
grantModeId?: string;
|
|
30
|
+
}
|
|
31
|
+
/** A user action on a HITL card: pick a declared mode, decline, or dismiss. */
|
|
32
|
+
export type HitlPromptAction = {
|
|
33
|
+
grantModeId: string;
|
|
34
|
+
} | "accept" | "decline" | "dismiss";
|
|
35
|
+
/**
|
|
36
|
+
* Display text for a grant mode: the asker's `label`, else the id as
|
|
37
|
+
* LITERAL text. Mode semantics are asker-scoped (normative, spec §7):
|
|
38
|
+
* falling back to the id displays identity, never interpreted meaning —
|
|
39
|
+
* a renderer must not special-case id strings.
|
|
40
|
+
*/
|
|
41
|
+
export declare function grantModeDisplay(mode: AgGrantMode): string;
|
|
42
|
+
/**
|
|
43
|
+
* Lift every persisted ask in the fold into an R10 prompt input, merged
|
|
44
|
+
* with the host's answer ledger (keyed by askId). Pure; input order is the
|
|
45
|
+
* fold's turn order.
|
|
46
|
+
*/
|
|
47
|
+
export declare function hitlPromptsFromFold(result: AgReduceResult | null, answers?: Readonly<Record<string, HitlAnswerRecord>>): HitlPromptInput[];
|
|
48
|
+
/**
|
|
49
|
+
* Construct the wire answer for a card action and validate it against the
|
|
50
|
+
* ask's own persisted record before anything dispatches it.
|
|
51
|
+
*
|
|
52
|
+
* `"accept"` is the plain-ask affirmative (valid only when the ask
|
|
53
|
+
* declared no modes — with a declaration, accepting IS picking a mode).
|
|
54
|
+
* A validation failure throws: the inputs came from the declaration
|
|
55
|
+
* itself, so a mismatch is a construction bug, not a user error.
|
|
56
|
+
*/
|
|
57
|
+
export declare function buildHitlAnswer(ask: AgPausedAsk, action: HitlPromptAction): AgHitlAnswer;
|
|
58
|
+
//# sourceMappingURL=hitl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hitl.d.ts","sourceRoot":"","sources":["../src/hitl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;IAC9C,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,+EAA+E;AAC/E,MAAM,MAAM,gBAAgB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAE1F;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,GAAG,IAAI,EAC7B,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAM,GACvD,eAAe,EAAE,CAiBnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,YAAY,CAexF"}
|
package/dist/hitl.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R10's AgJSON HITL half (spec draft.2, silverprotocol/typescript-sdk#16):
|
|
3
|
+
* lifting persisted asks out of the fold, and constructing validated
|
|
4
|
+
* answers.
|
|
5
|
+
*
|
|
6
|
+
* Two contract points are load-bearing here:
|
|
7
|
+
*
|
|
8
|
+
* - **Asks render from the PERSISTED declaration** — `AgPausedAsk` in
|
|
9
|
+
* `turn.done.outcome:"paused".asks[]`. The live `hitl.ask` event is
|
|
10
|
+
* live-only by spec (§1.3); a client that joins a thread late renders
|
|
11
|
+
* the paused record, so this module reads ONLY that record and both
|
|
12
|
+
* paths converge.
|
|
13
|
+
* - **Every answer is validated BEFORE dispatch** — `validateHitlAnswer`
|
|
14
|
+
* from core enforces required-iff-declared, echo-must-be-declared, and
|
|
15
|
+
* the `requestState` byte-echo MUST. `buildHitlAnswer` constructs
|
|
16
|
+
* answers that pass by construction and THROWS if they don't: a failed
|
|
17
|
+
* validation here is a kit bug, never a user-visible state.
|
|
18
|
+
*
|
|
19
|
+
* Answer states encode guuey's ratified dismissal ruling (#16): dismissal
|
|
20
|
+
* maps to `cancelled` (still-pending, re-askable — the card stays
|
|
21
|
+
* answerable), `declined` is the durable explicit deny.
|
|
22
|
+
*/
|
|
23
|
+
import { validateHitlAnswer, } from "@silverprotocol/core";
|
|
24
|
+
/**
|
|
25
|
+
* Display text for a grant mode: the asker's `label`, else the id as
|
|
26
|
+
* LITERAL text. Mode semantics are asker-scoped (normative, spec §7):
|
|
27
|
+
* falling back to the id displays identity, never interpreted meaning —
|
|
28
|
+
* a renderer must not special-case id strings.
|
|
29
|
+
*/
|
|
30
|
+
export function grantModeDisplay(mode) {
|
|
31
|
+
return mode.label ?? mode.id;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Lift every persisted ask in the fold into an R10 prompt input, merged
|
|
35
|
+
* with the host's answer ledger (keyed by askId). Pure; input order is the
|
|
36
|
+
* fold's turn order.
|
|
37
|
+
*/
|
|
38
|
+
export function hitlPromptsFromFold(result, answers = {}) {
|
|
39
|
+
if (result === null)
|
|
40
|
+
return [];
|
|
41
|
+
const prompts = [];
|
|
42
|
+
for (const turn of result.turns) {
|
|
43
|
+
if (turn.outcome?.type !== "paused")
|
|
44
|
+
continue;
|
|
45
|
+
for (const ask of turn.outcome.asks) {
|
|
46
|
+
const answer = answers[ask.askId];
|
|
47
|
+
prompts.push({
|
|
48
|
+
id: ask.askId,
|
|
49
|
+
kind: "hitl",
|
|
50
|
+
ask,
|
|
51
|
+
state: answer?.status ?? "pending",
|
|
52
|
+
...(answer?.grantModeId !== undefined ? { grantModeId: answer.grantModeId } : {}),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return prompts;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Construct the wire answer for a card action and validate it against the
|
|
60
|
+
* ask's own persisted record before anything dispatches it.
|
|
61
|
+
*
|
|
62
|
+
* `"accept"` is the plain-ask affirmative (valid only when the ask
|
|
63
|
+
* declared no modes — with a declaration, accepting IS picking a mode).
|
|
64
|
+
* A validation failure throws: the inputs came from the declaration
|
|
65
|
+
* itself, so a mismatch is a construction bug, not a user error.
|
|
66
|
+
*/
|
|
67
|
+
export function buildHitlAnswer(ask, action) {
|
|
68
|
+
const answer = {
|
|
69
|
+
askId: ask.askId,
|
|
70
|
+
status: action === "decline" ? "declined" : action === "dismiss" ? "cancelled" : "resolved",
|
|
71
|
+
...(typeof action === "object" ? { grantModeId: action.grantModeId } : {}),
|
|
72
|
+
// The pre-existing byte-echo MUST (spec §7): the answer carries the
|
|
73
|
+
// ask's requestState verbatim when one exists.
|
|
74
|
+
...(ask.requestState !== undefined ? { requestState: ask.requestState } : {}),
|
|
75
|
+
};
|
|
76
|
+
const verdict = validateHitlAnswer(ask, answer);
|
|
77
|
+
if (!verdict.ok) {
|
|
78
|
+
throw new Error(`buildHitlAnswer constructed an invalid answer (${verdict.code}): ${verdict.message}`);
|
|
79
|
+
}
|
|
80
|
+
return answer;
|
|
81
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* this root subpath stays React-free forever — server-side transcript
|
|
11
11
|
* rendering, tests, and RN bundlers consume the view-model directly.
|
|
12
12
|
*/
|
|
13
|
-
export { planTranscript, } from "./plan.js";
|
|
13
|
+
export { newestViewKey, planTranscript, } from "./plan.js";
|
|
14
14
|
export { calmPolicy, debugPolicy, type TranscriptPolicy, } from "./policy.js";
|
|
15
15
|
export { defaultChatStrings, humanizeToolName, type ChatStrings, } from "./strings.js";
|
|
16
16
|
export { transcriptInputsFromHistory } from "./history-inputs.js";
|
|
17
|
+
export { buildHitlAnswer, grantModeDisplay, hitlPromptsFromFold, type HitlAnswerRecord, type HitlPromptAction, } from "./hitl.js";
|
|
17
18
|
export { DEFAULT_CHAT_THEME, GUUEY_CHAT_THEME, GuueyChatPalette, GuueyChatTheme, resolveTheme, } from "./theme.js";
|
|
18
|
-
export type { CitationsItem, CodeItem, CompactionItem, DataResultItem, DisplayItem, ErrorItem, HistoryBoundaryItem, ItemKey, MediaItem, PromptItem, PromptItemInput, ReasoningItem, StatusLineItem, TextItem, ToolGroupItem, ToolItem, TranscriptInputs, TranscriptMessage, TranscriptOverrides, TranscriptPlan, UnknownItem, UserMessageItem, ViewMountItem, } from "./types.js";
|
|
19
|
+
export type { ChatDebugEvent, CitationsItem, CodeItem, CompactionItem, DataResultItem, DisplayItem, ErrorItem, HistoryBoundaryItem, ItemKey, HitlPromptInput, HitlPromptItem, MediaItem, NoticeItem, ProfilePromptInput, ProfilePromptItem, PromptItem, PromptItemInput, ReasoningItem, StatusLineItem, TextItem, ToolGroupItem, ToolItem, TranscriptInputs, TranscriptMessage, TranscriptOverrides, TranscriptPlan, UnknownItem, UserMessageItem, ViewMountItem, ViewRefItem, } from "./types.js";
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,UAAU,EACV,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,aAAa,EACb,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,eAAe,EACf,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,aAAa,EACb,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,UAAU,EACV,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,aAAa,EACb,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
* this root subpath stays React-free forever — server-side transcript
|
|
11
11
|
* rendering, tests, and RN bundlers consume the view-model directly.
|
|
12
12
|
*/
|
|
13
|
-
export { planTranscript, } from "./plan.js";
|
|
13
|
+
export { newestViewKey, planTranscript, } from "./plan.js";
|
|
14
14
|
export { calmPolicy, debugPolicy, } from "./policy.js";
|
|
15
15
|
export { defaultChatStrings, humanizeToolName, } from "./strings.js";
|
|
16
16
|
export { transcriptInputsFromHistory } from "./history-inputs.js";
|
|
17
|
+
export { buildHitlAnswer, grantModeDisplay, hitlPromptsFromFold, } from "./hitl.js";
|
|
17
18
|
export { DEFAULT_CHAT_THEME, GUUEY_CHAT_THEME, GuueyChatPalette, GuueyChatTheme, resolveTheme, } from "./theme.js";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The React Native per-category component kit (spec §3's override slots,
|
|
3
|
+
* §3.2's RN-parity obligation): one component per `DisplayItem` variant,
|
|
4
|
+
* each a THIN walk of its item — every rendering decision was already made
|
|
5
|
+
* by `planTranscript`; these translate decided items into RN primitives and
|
|
6
|
+
* never consult policy or invent copy. The override contract mirrors the
|
|
7
|
+
* web kit: `NativeTranscriptComponents` is the component map.
|
|
8
|
+
*
|
|
9
|
+
* Accessibility (spec §3.2 restated over RN):
|
|
10
|
+
* - every `expanded` toggle is a `Pressable` with `accessibilityRole`
|
|
11
|
+
* "button" + `accessibilityState.expanded`;
|
|
12
|
+
* - the status line and streaming text announce via
|
|
13
|
+
* `accessibilityLiveRegion="polite"` (Android) and are `accessible`
|
|
14
|
+
* grouped nodes for screen readers on both platforms;
|
|
15
|
+
* - R10 prompts are a live-region group so their appearance announces
|
|
16
|
+
* (RN has no document focus to move — the web kit's focus contract maps
|
|
17
|
+
* to announcement here);
|
|
18
|
+
* - there are NO decorative animations in the native defaults, so
|
|
19
|
+
* reduce-motion holds trivially at this tier (the transcript's scroll
|
|
20
|
+
* animation is where motion lives — see `transcript.tsx`).
|
|
21
|
+
*
|
|
22
|
+
* The R6 DEFAULT is the documented native default-gap: the kit ships
|
|
23
|
+
* WITHOUT a WebView dependency, so the default `view` renderer is a
|
|
24
|
+
* labeled placeholder (`strings.viewSandboxUnavailable`) — never blank —
|
|
25
|
+
* and a host app supplies its own WebView-based mount as the `view` slot
|
|
26
|
+
* override (portal's card machinery is the reference consumer).
|
|
27
|
+
*/
|
|
28
|
+
import type { ComponentType, ReactNode } from "react";
|
|
29
|
+
import type { ResolvedViewMount, ViewHostPhase } from "@guuey/mcp-apps-host";
|
|
30
|
+
import type { ChatStrings } from "../strings.js";
|
|
31
|
+
import type { CitationsItem, CodeItem, CompactionItem, DataResultItem, DisplayItem, ErrorItem, HistoryBoundaryItem, ItemKey, MediaItem, NoticeItem, PromptItem, ReasoningItem, StatusLineItem, ToolGroupItem, ToolItem, UnknownItem, UserMessageItem, TextItem, ViewMountItem, ViewRefItem } from "../types.js";
|
|
32
|
+
import type { NativeChatTokens } from "./theme-native.js";
|
|
33
|
+
/** Everything a rendered native item may need beyond itself. */
|
|
34
|
+
export interface NativeTranscriptItemContext {
|
|
35
|
+
strings: ChatStrings;
|
|
36
|
+
/** The resolved theme tokens (see `resolveNativeTheme`). */
|
|
37
|
+
tokens: NativeChatTokens;
|
|
38
|
+
/** Flip an item's collapse state (the renderer owns override state). */
|
|
39
|
+
onToggle: (key: ItemKey) => void;
|
|
40
|
+
/** R0 failed-send retry. */
|
|
41
|
+
onRetry?: (item: UserMessageItem) => void;
|
|
42
|
+
/** R10 prompt actions — the host owns what accept/decline DO. */
|
|
43
|
+
onPromptAction?: (item: PromptItem, action: "accept" | "decline" | "dismiss" | {
|
|
44
|
+
grantModeId: string;
|
|
45
|
+
}) => void;
|
|
46
|
+
/** R11 action slots (sign-in / retry affordances). */
|
|
47
|
+
onErrorAction?: (item: ErrorItem) => void;
|
|
48
|
+
/** R6: locator mounts resolved by `useTranscript` ("expired" = failed). */
|
|
49
|
+
resolvedMounts: ReadonlyMap<ItemKey, ResolvedViewMount | "expired">;
|
|
50
|
+
/** R6: live phase reports wired back into the next plan. */
|
|
51
|
+
onViewPhase: (key: ItemKey, phase: ViewHostPhase) => void;
|
|
52
|
+
/**
|
|
53
|
+
* guuey#204: a promoted-view reference chip was activated — the host
|
|
54
|
+
* focuses/reveals its stage. Absent ⇒ the chip renders as a label.
|
|
55
|
+
*/
|
|
56
|
+
onViewRef?: (item: ViewRefItem) => void;
|
|
57
|
+
}
|
|
58
|
+
interface ItemProps<T> {
|
|
59
|
+
item: T;
|
|
60
|
+
ctx: NativeTranscriptItemContext;
|
|
61
|
+
}
|
|
62
|
+
export declare function NativeUserMessage({ item, ctx }: ItemProps<UserMessageItem>): ReactNode;
|
|
63
|
+
export declare function NativeText({ item, ctx }: ItemProps<TextItem>): ReactNode;
|
|
64
|
+
export declare function NativeReasoning({ item, ctx }: ItemProps<ReasoningItem>): ReactNode;
|
|
65
|
+
export declare function NativeDataResult({ item, ctx }: ItemProps<DataResultItem>): ReactNode;
|
|
66
|
+
export declare function NativeTool({ item, ctx }: ItemProps<ToolItem>): ReactNode;
|
|
67
|
+
export declare function NativeToolGroup({ item, ctx }: ItemProps<ToolGroupItem>): ReactNode;
|
|
68
|
+
export declare function NativeView({ item, ctx }: ItemProps<ViewMountItem>): ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* guuey#204: the "promote and reference" chip — a Pressable when the host
|
|
71
|
+
* wires `onViewRef`, a plain labeled row otherwise. Never a second mount.
|
|
72
|
+
*/
|
|
73
|
+
export declare function NativeViewRef({ item, ctx }: ItemProps<ViewRefItem>): ReactNode;
|
|
74
|
+
export declare function NativeMedia({ item, ctx }: ItemProps<MediaItem>): ReactNode;
|
|
75
|
+
export declare function NativeCode({ item, ctx }: ItemProps<CodeItem>): ReactNode;
|
|
76
|
+
export declare function NativeCitations({ item, ctx }: ItemProps<CitationsItem>): ReactNode;
|
|
77
|
+
export declare function NativePrompt({ item, ctx }: ItemProps<PromptItem>): ReactNode;
|
|
78
|
+
/** The notice row (spec draft.2) — labeled, non-conversational, never agent-voiced. */
|
|
79
|
+
export declare function NativeNotice({ item, ctx }: ItemProps<NoticeItem>): ReactNode;
|
|
80
|
+
export declare function NativeError({ item, ctx }: ItemProps<ErrorItem>): ReactNode;
|
|
81
|
+
export declare function NativeHistoryBoundary({ item, ctx }: ItemProps<HistoryBoundaryItem>): ReactNode;
|
|
82
|
+
export declare function NativeCompaction({ item, ctx }: ItemProps<CompactionItem>): ReactNode;
|
|
83
|
+
export declare function NativeUnknown({ item, ctx }: ItemProps<UnknownItem>): ReactNode;
|
|
84
|
+
export declare function NativeStatus({ item, ctx }: ItemProps<StatusLineItem>): ReactNode;
|
|
85
|
+
/** One component per §3 override slot — the native mirror of the web map. */
|
|
86
|
+
export interface NativeTranscriptComponents {
|
|
87
|
+
userMessage: ComponentType<ItemProps<UserMessageItem>>;
|
|
88
|
+
text: ComponentType<ItemProps<TextItem>>;
|
|
89
|
+
reasoning: ComponentType<ItemProps<ReasoningItem>>;
|
|
90
|
+
tool: ComponentType<ItemProps<ToolItem>>;
|
|
91
|
+
toolGroup: ComponentType<ItemProps<ToolGroupItem>>;
|
|
92
|
+
dataResult: ComponentType<ItemProps<DataResultItem>>;
|
|
93
|
+
view: ComponentType<ItemProps<ViewMountItem>>;
|
|
94
|
+
viewRef: ComponentType<ItemProps<ViewRefItem>>;
|
|
95
|
+
media: ComponentType<ItemProps<MediaItem>>;
|
|
96
|
+
code: ComponentType<ItemProps<CodeItem>>;
|
|
97
|
+
citations: ComponentType<ItemProps<CitationsItem>>;
|
|
98
|
+
prompt: ComponentType<ItemProps<PromptItem>>;
|
|
99
|
+
notice: ComponentType<ItemProps<NoticeItem>>;
|
|
100
|
+
error: ComponentType<ItemProps<ErrorItem>>;
|
|
101
|
+
history: ComponentType<ItemProps<HistoryBoundaryItem>>;
|
|
102
|
+
compaction: ComponentType<ItemProps<CompactionItem>>;
|
|
103
|
+
unknown: ComponentType<ItemProps<UnknownItem>>;
|
|
104
|
+
status: ComponentType<ItemProps<StatusLineItem>>;
|
|
105
|
+
}
|
|
106
|
+
export declare const nativeTranscriptComponents: NativeTranscriptComponents;
|
|
107
|
+
/** Dispatch one display item through the (possibly overridden) map. */
|
|
108
|
+
export declare function renderNativeItem(item: DisplayItem, components: NativeTranscriptComponents, ctx: NativeTranscriptItemContext): ReactNode;
|
|
109
|
+
export {};
|
|
110
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/native/components.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,QAAQ,EACR,WAAW,EAC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