@guuey/chat 0.5.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 +18 -2
- package/dist/native/components.d.ts.map +1 -1
- package/dist/native/components.js +49 -0
- package/dist/native/transcript.d.ts +1 -1
- package/dist/native/transcript.d.ts.map +1 -1
- package/dist/native/transcript.js +2 -2
- package/dist/native.d.ts +1 -1
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +1 -1
- 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 +5 -5
- 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 +136 -1
- package/src/native/transcript.tsx +4 -3
- package/src/native.tsx +1 -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";
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
import type { ComponentType, ReactNode } from "react";
|
|
29
29
|
import type { ResolvedViewMount, ViewHostPhase } from "@guuey/mcp-apps-host";
|
|
30
30
|
import type { ChatStrings } from "../strings.js";
|
|
31
|
-
import type { CitationsItem, CodeItem, CompactionItem, DataResultItem, DisplayItem, ErrorItem, HistoryBoundaryItem, ItemKey, MediaItem, PromptItem, ReasoningItem, StatusLineItem, ToolGroupItem, ToolItem, UnknownItem, UserMessageItem, TextItem, ViewMountItem } from "../types.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
32
|
import type { NativeChatTokens } from "./theme-native.js";
|
|
33
33
|
/** Everything a rendered native item may need beyond itself. */
|
|
34
34
|
export interface NativeTranscriptItemContext {
|
|
@@ -40,13 +40,20 @@ export interface NativeTranscriptItemContext {
|
|
|
40
40
|
/** R0 failed-send retry. */
|
|
41
41
|
onRetry?: (item: UserMessageItem) => void;
|
|
42
42
|
/** R10 prompt actions — the host owns what accept/decline DO. */
|
|
43
|
-
onPromptAction?: (item: PromptItem, action: "accept" | "decline" | "dismiss"
|
|
43
|
+
onPromptAction?: (item: PromptItem, action: "accept" | "decline" | "dismiss" | {
|
|
44
|
+
grantModeId: string;
|
|
45
|
+
}) => void;
|
|
44
46
|
/** R11 action slots (sign-in / retry affordances). */
|
|
45
47
|
onErrorAction?: (item: ErrorItem) => void;
|
|
46
48
|
/** R6: locator mounts resolved by `useTranscript` ("expired" = failed). */
|
|
47
49
|
resolvedMounts: ReadonlyMap<ItemKey, ResolvedViewMount | "expired">;
|
|
48
50
|
/** R6: live phase reports wired back into the next plan. */
|
|
49
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;
|
|
50
57
|
}
|
|
51
58
|
interface ItemProps<T> {
|
|
52
59
|
item: T;
|
|
@@ -59,10 +66,17 @@ export declare function NativeDataResult({ item, ctx }: ItemProps<DataResultItem
|
|
|
59
66
|
export declare function NativeTool({ item, ctx }: ItemProps<ToolItem>): ReactNode;
|
|
60
67
|
export declare function NativeToolGroup({ item, ctx }: ItemProps<ToolGroupItem>): ReactNode;
|
|
61
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;
|
|
62
74
|
export declare function NativeMedia({ item, ctx }: ItemProps<MediaItem>): ReactNode;
|
|
63
75
|
export declare function NativeCode({ item, ctx }: ItemProps<CodeItem>): ReactNode;
|
|
64
76
|
export declare function NativeCitations({ item, ctx }: ItemProps<CitationsItem>): ReactNode;
|
|
65
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;
|
|
66
80
|
export declare function NativeError({ item, ctx }: ItemProps<ErrorItem>): ReactNode;
|
|
67
81
|
export declare function NativeHistoryBoundary({ item, ctx }: ItemProps<HistoryBoundaryItem>): ReactNode;
|
|
68
82
|
export declare function NativeCompaction({ item, ctx }: ItemProps<CompactionItem>): ReactNode;
|
|
@@ -77,10 +91,12 @@ export interface NativeTranscriptComponents {
|
|
|
77
91
|
toolGroup: ComponentType<ItemProps<ToolGroupItem>>;
|
|
78
92
|
dataResult: ComponentType<ItemProps<DataResultItem>>;
|
|
79
93
|
view: ComponentType<ItemProps<ViewMountItem>>;
|
|
94
|
+
viewRef: ComponentType<ItemProps<ViewRefItem>>;
|
|
80
95
|
media: ComponentType<ItemProps<MediaItem>>;
|
|
81
96
|
code: ComponentType<ItemProps<CodeItem>>;
|
|
82
97
|
citations: ComponentType<ItemProps<CitationsItem>>;
|
|
83
98
|
prompt: ComponentType<ItemProps<PromptItem>>;
|
|
99
|
+
notice: ComponentType<ItemProps<NoticeItem>>;
|
|
84
100
|
error: ComponentType<ItemProps<ErrorItem>>;
|
|
85
101
|
history: ComponentType<ItemProps<HistoryBoundaryItem>>;
|
|
86
102
|
compaction: ComponentType<ItemProps<CompactionItem>>;
|
|
@@ -1 +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,aAAa,EACb,cAAc,EACd,aAAa,EACb,QAAQ,EACR,WAAW,EACX,eAAe,EACf,QAAQ,EACR,aAAa,
|
|
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,EACX,eAAe,EACf,QAAQ,EACR,aAAa,EACb,WAAW,EACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,gEAAgE;AAChE,MAAM,WAAW,2BAA2B;IAC1C,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AC,CAAC,CAAC;IAC7C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACvD,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IACrD,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,0BAA0B,EAAE,0BAmBxC,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,0BAA0B,EACtC,GAAG,EAAE,2BAA2B,GAC/B,SAAS,CAuEX"}
|
|
@@ -113,6 +113,25 @@ export function NativeView({ item, ctx }) {
|
|
|
113
113
|
gap: 4,
|
|
114
114
|
}, children: [_jsx(MutedText, { ctx: ctx, children: label }), item.attribution !== null ? _jsx(MutedText, { ctx: ctx, children: item.attribution }) : null] }));
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* guuey#204: the "promote and reference" chip — a Pressable when the host
|
|
118
|
+
* wires `onViewRef`, a plain labeled row otherwise. Never a second mount.
|
|
119
|
+
*/
|
|
120
|
+
export function NativeViewRef({ item, ctx }) {
|
|
121
|
+
const { tokens } = ctx;
|
|
122
|
+
const chipStyle = {
|
|
123
|
+
alignSelf: "flex-start",
|
|
124
|
+
backgroundColor: tokens.palette.surface,
|
|
125
|
+
borderRadius: 999,
|
|
126
|
+
paddingHorizontal: tokens.pad,
|
|
127
|
+
paddingVertical: 6,
|
|
128
|
+
};
|
|
129
|
+
if (ctx.onViewRef === undefined) {
|
|
130
|
+
return (_jsx(View, { accessibilityRole: "text", style: chipStyle, children: _jsx(MutedText, { ctx: ctx, children: item.label }) }));
|
|
131
|
+
}
|
|
132
|
+
const onViewRef = ctx.onViewRef;
|
|
133
|
+
return (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: item.label, onPress: () => onViewRef(item), style: chipStyle, children: _jsx(MutedText, { ctx: ctx, children: item.label }) }));
|
|
134
|
+
}
|
|
116
135
|
// ─── R7 ────────────────────────────────────────────────────────────────────
|
|
117
136
|
/** Inline images allow https URLs and image/* base64 data — nothing else. */
|
|
118
137
|
function imageSrc(item) {
|
|
@@ -167,6 +186,20 @@ export function NativeCitations({ item, ctx }) {
|
|
|
167
186
|
// ─── R10 ───────────────────────────────────────────────────────────────────
|
|
168
187
|
export function NativePrompt({ item, ctx }) {
|
|
169
188
|
const { tokens } = ctx;
|
|
189
|
+
if (item.promptKind === "hitl") {
|
|
190
|
+
const s = ctx.strings;
|
|
191
|
+
if (item.state === "resolved" || item.state === "declined") {
|
|
192
|
+
return (_jsx(MutedText, { ctx: ctx, children: item.state === "resolved"
|
|
193
|
+
? item.chosenModeLabel !== null
|
|
194
|
+
? s.promptAnsweredWith(item.chosenModeLabel)
|
|
195
|
+
: s.promptAccept
|
|
196
|
+
: s.promptDeclinedRecord }));
|
|
197
|
+
}
|
|
198
|
+
// `cancelled` = guuey's re-askable dismissal: a record row that reopens
|
|
199
|
+
// to the actions on toggle (silverprotocol#16 ruling).
|
|
200
|
+
const answerable = item.state === "pending" || (item.state === "cancelled" && item.expanded);
|
|
201
|
+
return (_jsxs(View, { accessibilityLiveRegion: "polite", accessible: true, style: { backgroundColor: tokens.palette.surface, borderRadius: tokens.radius, padding: tokens.pad, gap: 8 }, children: [item.state === "cancelled" && (_jsx(Pressable, { accessibilityRole: "button", accessibilityState: { expanded: item.expanded }, onPress: () => ctx.onToggle(item.key), children: _jsx(Text, { style: { color: tokens.palette.inkMuted, fontSize: tokens.fontSize }, children: s.promptDismissed }) })), answerable && (_jsxs(_Fragment, { children: [item.message !== null && (_jsx(Text, { style: { color: tokens.palette.ink, fontSize: tokens.fontSize, fontFamily: tokens.fontFamily }, children: item.message })), _jsxs(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: 12 }, children: [item.grantModes.length === 0 ? (_jsx(Pressable, { accessibilityRole: "button", onPress: () => ctx.onPromptAction?.(item, "accept"), children: _jsx(Text, { style: { color: tokens.palette.accent, fontWeight: "700", fontSize: tokens.fontSize }, children: s.promptAccept }) })) : (item.grantModes.map((mode) => (_jsx(Pressable, { accessibilityRole: "button", accessibilityHint: mode.description, onPress: () => ctx.onPromptAction?.(item, { grantModeId: mode.id }), children: _jsx(Text, { style: { color: tokens.palette.accent, fontWeight: "700", fontSize: tokens.fontSize }, children: mode.label ?? mode.id }) }, mode.id)))), _jsx(Pressable, { accessibilityRole: "button", onPress: () => ctx.onPromptAction?.(item, "decline"), children: _jsx(Text, { style: { color: tokens.palette.inkMuted, fontSize: tokens.fontSize }, children: s.promptDecline }) })] })] }))] }));
|
|
202
|
+
}
|
|
170
203
|
if (item.state !== "pending") {
|
|
171
204
|
return (_jsxs(MutedText, { ctx: ctx, children: [item.promptKind, ": ", item.state] }));
|
|
172
205
|
}
|
|
@@ -180,6 +213,12 @@ export function NativePrompt({ item, ctx }) {
|
|
|
180
213
|
? `${item.appId} requests ${item.requested} access`
|
|
181
214
|
: `Link your account to ${item.appId}` }), _jsxs(View, { style: { flexDirection: "row", gap: 12 }, children: [_jsx(Pressable, { accessibilityRole: "button", onPress: () => ctx.onPromptAction?.(item, "accept"), children: _jsx(Text, { style: { color: tokens.palette.accent, fontWeight: "700", fontSize: tokens.fontSize }, children: "Allow" }) }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => ctx.onPromptAction?.(item, "decline"), children: _jsx(Text, { style: { color: tokens.palette.inkMuted, fontSize: tokens.fontSize }, children: "Decline" }) })] })] }));
|
|
182
215
|
}
|
|
216
|
+
// ─── R16 ──────────────────────────────────────────────────────────────────
|
|
217
|
+
/** The notice row (spec draft.2) — labeled, non-conversational, never agent-voiced. */
|
|
218
|
+
export function NativeNotice({ item, ctx }) {
|
|
219
|
+
const { tokens } = ctx;
|
|
220
|
+
return (_jsx(View, { accessible: true, accessibilityRole: "text", style: { paddingVertical: 4 }, children: _jsxs(Text, { style: { color: tokens.palette.inkMuted, fontSize: tokens.fontSize - 2 }, children: [ctx.strings.noticeLabel, item.sourceLabel !== null ? ` · ${item.sourceLabel}` : "", item.text !== "" ? ` — ${item.text}` : ""] }) }));
|
|
221
|
+
}
|
|
183
222
|
// ─── R11 ───────────────────────────────────────────────────────────────────
|
|
184
223
|
export function NativeError({ item, ctx }) {
|
|
185
224
|
const { tokens } = ctx;
|
|
@@ -215,10 +254,12 @@ export const nativeTranscriptComponents = {
|
|
|
215
254
|
toolGroup: NativeToolGroup,
|
|
216
255
|
dataResult: NativeDataResult,
|
|
217
256
|
view: NativeView,
|
|
257
|
+
viewRef: NativeViewRef,
|
|
218
258
|
media: NativeMedia,
|
|
219
259
|
code: NativeCode,
|
|
220
260
|
citations: NativeCitations,
|
|
221
261
|
prompt: NativePrompt,
|
|
262
|
+
notice: NativeNotice,
|
|
222
263
|
error: NativeError,
|
|
223
264
|
history: NativeHistoryBoundary,
|
|
224
265
|
compaction: NativeCompaction,
|
|
@@ -256,6 +297,10 @@ export function renderNativeItem(item, components, ctx) {
|
|
|
256
297
|
const C = components.view;
|
|
257
298
|
return _jsx(C, { item: item, ctx: ctx }, item.key);
|
|
258
299
|
}
|
|
300
|
+
case "viewRef": {
|
|
301
|
+
const C = components.viewRef;
|
|
302
|
+
return _jsx(C, { item: item, ctx: ctx }, item.key);
|
|
303
|
+
}
|
|
259
304
|
case "media": {
|
|
260
305
|
const C = components.media;
|
|
261
306
|
return _jsx(C, { item: item, ctx: ctx }, item.key);
|
|
@@ -272,6 +317,10 @@ export function renderNativeItem(item, components, ctx) {
|
|
|
272
317
|
const C = components.prompt;
|
|
273
318
|
return _jsx(C, { item: item, ctx: ctx }, item.key);
|
|
274
319
|
}
|
|
320
|
+
case "notice": {
|
|
321
|
+
const C = components.notice;
|
|
322
|
+
return _jsx(C, { item: item, ctx: ctx }, item.key);
|
|
323
|
+
}
|
|
275
324
|
case "error": {
|
|
276
325
|
const C = components.error;
|
|
277
326
|
return _jsx(C, { item: item, ctx: ctx }, item.key);
|
|
@@ -33,7 +33,7 @@ import { type NativeTranscriptComponents, type NativeTranscriptItemContext } fro
|
|
|
33
33
|
import { type NativeThemeMode } from "./theme-native.js";
|
|
34
34
|
/** The host-behavior pass-through — everything the kit deliberately does NOT own. */
|
|
35
35
|
export type NativeTranscriptListProps = Pick<FlatListProps<DisplayItem>, "style" | "contentContainerStyle" | "keyboardDismissMode" | "keyboardShouldPersistTaps" | "automaticallyAdjustKeyboardInsets" | "onScroll" | "scrollEventThrottle" | "ListEmptyComponent" | "scrollIndicatorInsets">;
|
|
36
|
-
export interface NativeTranscriptProps extends Pick<NativeTranscriptItemContext, "onToggle" | "onRetry" | "onPromptAction" | "onErrorAction" | "resolvedMounts" | "onViewPhase"> {
|
|
36
|
+
export interface NativeTranscriptProps extends Pick<NativeTranscriptItemContext, "onToggle" | "onRetry" | "onPromptAction" | "onErrorAction" | "resolvedMounts" | "onViewPhase" | "onViewRef"> {
|
|
37
37
|
plan: TranscriptPlan;
|
|
38
38
|
/** Per-slot component overrides (spec §3's override column). */
|
|
39
39
|
components?: Partial<NativeTranscriptComponents>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../src/native/transcript.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAqD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,EAML,KAAK,aAAa,EAGnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA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B,GACpB,uBAAuB,CAC1B,CAAC;AAEF,MAAM,WAAW,qBACf,SAAQ,IAAI,CACV,2BAA2B,EAC3B,UAAU,GAAG,SAAS,GAAG,gBAAgB,GAAG,eAAe,GAAG,gBAAgB,GAAG,aAAa,GAAG,WAAW,CAC7G;IACD,IAAI,EAAE,cAAc,CAAC;IACrB,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACjD,gEAAgE;IAChE,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,yBAAyB,CAAC;CACvC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CA2GxE"}
|
|
@@ -34,10 +34,10 @@ import { resolveNativeTheme } from "./theme-native.js";
|
|
|
34
34
|
/** Offset (px) past which the reader counts as "up in history". */
|
|
35
35
|
const JUMP_THRESHOLD_PX = 160;
|
|
36
36
|
export function NativeTranscript(props) {
|
|
37
|
-
const { plan, components, strings = defaultChatStrings, theme = DEFAULT_CHAT_THEME, mode = "light", listProps, onToggle, onRetry, onPromptAction, onErrorAction, resolvedMounts, onViewPhase, } = props;
|
|
37
|
+
const { plan, components, strings = defaultChatStrings, theme = DEFAULT_CHAT_THEME, mode = "light", listProps, onToggle, onRetry, onPromptAction, onErrorAction, resolvedMounts, onViewPhase, onViewRef, } = props;
|
|
38
38
|
const tokens = useMemo(() => resolveNativeTheme(theme, mode), [theme, mode]);
|
|
39
39
|
const resolvedComponents = useMemo(() => ({ ...nativeTranscriptComponents, ...components }), [components]);
|
|
40
|
-
const ctx = useMemo(() => ({ strings, tokens, onToggle, onRetry, onPromptAction, onErrorAction, resolvedMounts, onViewPhase }), [strings, tokens, onToggle, onRetry, onPromptAction, onErrorAction, resolvedMounts, onViewPhase]);
|
|
40
|
+
const ctx = useMemo(() => ({ strings, tokens, onToggle, onRetry, onPromptAction, onErrorAction, resolvedMounts, onViewPhase, onViewRef }), [strings, tokens, onToggle, onRetry, onPromptAction, onErrorAction, resolvedMounts, onViewPhase, onViewRef]);
|
|
41
41
|
// Inverted-list data: reversed plan, newest at index 0 (the visual
|
|
42
42
|
// bottom / scroll origin). Keys are the plan's stable keys.
|
|
43
43
|
const data = useMemo(() => [...plan.items].reverse(), [plan.items]);
|
package/dist/native.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* importable everywhere; this arm loads only inside an RN runtime.
|
|
20
20
|
*/
|
|
21
21
|
export { NativeTranscript, type NativeTranscriptProps, type NativeTranscriptListProps, } from "./native/transcript.js";
|
|
22
|
-
export { nativeTranscriptComponents, renderNativeItem, NativeUserMessage, NativeText, NativeReasoning, NativeTool, NativeToolGroup, NativeDataResult, NativeView, NativeMedia, NativeCode, NativeCitations, NativePrompt, NativeError, NativeHistoryBoundary, NativeCompaction, NativeUnknown, NativeStatus, type NativeTranscriptComponents, type NativeTranscriptItemContext, } from "./native/components.js";
|
|
22
|
+
export { nativeTranscriptComponents, renderNativeItem, NativeUserMessage, NativeText, NativeReasoning, NativeTool, NativeToolGroup, NativeDataResult, NativeView, NativeViewRef, NativeMedia, NativeCode, NativeCitations, NativePrompt, NativeError, NativeHistoryBoundary, NativeCompaction, NativeUnknown, NativeStatus, type NativeTranscriptComponents, type NativeTranscriptItemContext, } from "./native/components.js";
|
|
23
23
|
export { NativeMarkdown } from "./native/markdown.js";
|
|
24
24
|
export { resolveNativeTheme, type NativeChatTokens, type NativeThemeMode, } from "./native/theme-native.js";
|
|
25
25
|
export { useTranscript, useTranscriptInputs, type UseTranscriptArgs, type UseTranscriptResult, type UseTranscriptInputsResult, } from "./react/use-transcript.js";
|
package/dist/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC"}
|
package/dist/native.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* importable everywhere; this arm loads only inside an RN runtime.
|
|
20
20
|
*/
|
|
21
21
|
export { NativeTranscript, } from "./native/transcript.js";
|
|
22
|
-
export { nativeTranscriptComponents, renderNativeItem, NativeUserMessage, NativeText, NativeReasoning, NativeTool, NativeToolGroup, NativeDataResult, NativeView, NativeMedia, NativeCode, NativeCitations, NativePrompt, NativeError, NativeHistoryBoundary, NativeCompaction, NativeUnknown, NativeStatus, } from "./native/components.js";
|
|
22
|
+
export { nativeTranscriptComponents, renderNativeItem, NativeUserMessage, NativeText, NativeReasoning, NativeTool, NativeToolGroup, NativeDataResult, NativeView, NativeViewRef, NativeMedia, NativeCode, NativeCitations, NativePrompt, NativeError, NativeHistoryBoundary, NativeCompaction, NativeUnknown, NativeStatus, } from "./native/components.js";
|
|
23
23
|
export { NativeMarkdown } from "./native/markdown.js";
|
|
24
24
|
export { resolveNativeTheme, } from "./native/theme-native.js";
|
|
25
25
|
// The React-generic renderer-state owner + live assembler — shared with
|
package/dist/plan.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import { type ViewMount } from "@guuey/mcp-apps-host";
|
|
1
2
|
import type { TranscriptPolicy } from "./policy.js";
|
|
2
3
|
import type { TranscriptInputs, TranscriptOverrides, TranscriptPlan } from "./types.js";
|
|
3
4
|
/** The one pure function (spec §7). */
|
|
4
5
|
export declare function planTranscript(inputs: TranscriptInputs, policy: TranscriptPolicy, overrides?: TranscriptOverrides): TranscriptPlan;
|
|
6
|
+
/**
|
|
7
|
+
* The plan key of the NEWEST mountable view — what a "most recent card"
|
|
8
|
+
* stage (the widget's CanvasPane) will show, derived in the same family
|
|
9
|
+
* the plan's own emission uses: live fold mounts (transcript order, last
|
|
10
|
+
* wins) outrank history cards (ascending `seq`). `undefined` when nothing
|
|
11
|
+
* narrows to a mountable resource. Hosts pass the key back as
|
|
12
|
+
* `TranscriptInputs.promotedViewKey`; `channel` lets a host decline to
|
|
13
|
+
* promote a bare locator when no reader is wired (the stage would show
|
|
14
|
+
* nothing, and a chip must never point at an empty canvas).
|
|
15
|
+
*/
|
|
16
|
+
export declare function newestViewKey(inputs: Pick<TranscriptInputs, "result" | "historyCards">): {
|
|
17
|
+
key: string;
|
|
18
|
+
channel: ViewMount["channel"];
|
|
19
|
+
} | undefined;
|
|
5
20
|
//# sourceMappingURL=plan.d.ts.map
|
package/dist/plan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAqD,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,KAAK,EASV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EAIf,MAAM,YAAY,CAAC;AAslBpB,uCAAuC;AACvC,wBAAgB,cAAc,CAC5B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,EACxB,SAAS,GAAE,mBAAwB,GAClC,cAAc,CA0QhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,cAAc,CAAC,GACxD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,GAAG,SAAS,CAiB5D"}
|