@fungi.computer/parakeet 0.17.1 → 0.17.2
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/client-contributions.d.ts +0 -1
- package/dist/components/ClientRows.js +6 -9
- package/dist/core/client-actions.d.ts +0 -4
- package/dist/core/client-actions.js +14 -5
- package/dist/parakeet.d.ts +4 -1
- package/dist/parakeet.js +2 -2
- package/docs/api/headless.md +5 -5
- package/docs/api/index.md +1 -0
- package/package.json +5 -5
|
@@ -12,7 +12,6 @@ export declare function useClientActions(commands: ParakeetCommandRuntime): {
|
|
|
12
12
|
readonly awaiting?: "question";
|
|
13
13
|
}, Readonly<{
|
|
14
14
|
pending: boolean;
|
|
15
|
-
error?: string;
|
|
16
15
|
}>>;
|
|
17
16
|
/** Observation is live and this Session's action owner is attached. */
|
|
18
17
|
enabled: boolean;
|
|
@@ -28,13 +28,13 @@ export function ClientRows({ entryId, rows, actions, onOpen, }) {
|
|
|
28
28
|
: undefined;
|
|
29
29
|
if (decision !== undefined) {
|
|
30
30
|
const state = actions.state.get(decision);
|
|
31
|
-
return (
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
return (_jsx("div", { "data-client-row": row.id, children: _jsxs(Button, { size: "xs", variant: "ghost", className: "-mx-xs flex w-[calc(100%+2*var(--spacing-xs))] justify-start gap-2 px-xs font-normal", disabled: !actions.enabled || state?.pending === true, loading: state?.pending === true, onClick: () => {
|
|
32
|
+
void actions.execute(entryId, decision);
|
|
33
|
+
}, children: [_jsx("span", { "aria-hidden": "true", "data-client-row-dot": "", className: `w-3 shrink-0 text-center ${row.tone === undefined ? "" : rowColors[row.tone]}`, children: row.tone === undefined ? "" : "●" }), _jsxs("span", { className: `min-w-0 flex-1 truncate text-start ${row.tone === undefined ? "" : rowColors[row.tone]}`, children: [row.title, row.detail === undefined ? null : (_jsxs("span", { className: "text-dim", children: [" \u00B7 ", row.detail] }))] }), _jsx("span", { className: "shrink-0 text-dim", "data-client-row-action": "", children: decision.label })] }) }, row.id));
|
|
34
34
|
}
|
|
35
|
-
return (_jsxs("div", { "data-client-row": row.id, className: "py-1", children: [_jsxs("div", { className: "flex items-
|
|
35
|
+
return (_jsxs("div", { "data-client-row": row.id, className: "py-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { "aria-hidden": "true", "data-client-row-dot": "", className: `w-3 shrink-0 text-center leading-4 ${row.tone === undefined ? "" : rowColors[row.tone]}`, children: row.tone === undefined ? "" : "●" }), _jsxs("details", { className: "min-w-0 flex-1", children: [_jsxs("summary", { title: row.title, className: `cursor-pointer truncate leading-4 ${row.tone === undefined ? "" : rowColors[row.tone]}`, children: [row.title, row.inspection === undefined || row.detail === undefined
|
|
36
36
|
? null
|
|
37
|
-
: ` · ${row.detail}`] }), row.detail === undefined ? null : (_jsx("p", { className: "max-h-32 overflow-y-auto overscroll-contain whitespace-pre-wrap break-words pb-2", children: row.detail }))] }), row.open === undefined ? null : (_jsx(Button, { size: "xs", variant: "outline", disabled: onOpen === undefined, onClick: () => {
|
|
37
|
+
: ` · ${row.detail}`] }), row.detail === undefined ? null : (_jsx("p", { className: "max-h-32 overflow-y-auto overscroll-contain whitespace-pre-wrap break-words pb-2", children: row.detail }))] }), row.open === undefined ? null : (_jsx(Button, { size: "xs", variant: "outline", className: "shrink-0", disabled: onOpen === undefined, onClick: () => {
|
|
38
38
|
if (row.open !== undefined)
|
|
39
39
|
onOpen?.(row.open);
|
|
40
40
|
}, children: "Open" })), row.actions?.map((action) => {
|
|
@@ -54,9 +54,6 @@ export function ClientRows({ entryId, rows, actions, onOpen, }) {
|
|
|
54
54
|
? "error"
|
|
55
55
|
: child.tone === "attention"
|
|
56
56
|
? "warning"
|
|
57
|
-
: "neutral", label: child.title }), child.detail === undefined ? null : (_jsx("span", { children: child.detail }))] }, child.id))) })] })) : null, row.
|
|
58
|
-
const error = actions.state.get(action)?.error;
|
|
59
|
-
return error === undefined ? null : (_jsx("p", { className: "text-error", role: "alert", children: error }, action.id));
|
|
60
|
-
})] }, row.id));
|
|
57
|
+
: "neutral", label: child.title }), child.detail === undefined ? null : (_jsx("span", { children: child.detail }))] }, child.id))) })] })) : null] }, row.id));
|
|
61
58
|
}) }));
|
|
62
59
|
}
|
|
@@ -6,8 +6,6 @@ import type { ClientContribution } from "./client-contributions.js";
|
|
|
6
6
|
export type ClientActionState = Readonly<{
|
|
7
7
|
/** The same advertised intent is already in flight. */
|
|
8
8
|
pending: boolean;
|
|
9
|
-
/** Visible execution failure; cleared when this intent is retried. */
|
|
10
|
-
error?: string;
|
|
11
9
|
}>;
|
|
12
10
|
/** Run admitted row intents through the ordinary advertised Whistle commands. */
|
|
13
11
|
export declare function createClientActions(options: Readonly<{
|
|
@@ -26,8 +24,6 @@ export declare function createClientActions(options: Readonly<{
|
|
|
26
24
|
}, Readonly<{
|
|
27
25
|
/** The same advertised intent is already in flight. */
|
|
28
26
|
pending: boolean;
|
|
29
|
-
/** Visible execution failure; cleared when this intent is retried. */
|
|
30
|
-
error?: string;
|
|
31
27
|
}>>;
|
|
32
28
|
refresh: () => void;
|
|
33
29
|
subscribe: (listener: () => void) => () => void;
|
|
@@ -91,8 +91,11 @@ export function createClientActions(options) {
|
|
|
91
91
|
const error = cause instanceof Error
|
|
92
92
|
? cause
|
|
93
93
|
: new Error("Client row command failed", { cause });
|
|
94
|
-
publish(intent, { pending: false
|
|
95
|
-
options.interactions.
|
|
94
|
+
publish(intent, { pending: false });
|
|
95
|
+
options.interactions.toast({
|
|
96
|
+
variant: "error",
|
|
97
|
+
message: error.message,
|
|
98
|
+
});
|
|
96
99
|
return;
|
|
97
100
|
}
|
|
98
101
|
if (retired())
|
|
@@ -104,9 +107,15 @@ export function createClientActions(options) {
|
|
|
104
107
|
: outcome.status === "unavailable"
|
|
105
108
|
? outcome.reason
|
|
106
109
|
: `Client row command ${outcome.status}`;
|
|
107
|
-
publish(intent,
|
|
108
|
-
if (error !== undefined)
|
|
109
|
-
|
|
110
|
+
publish(intent, { pending: false });
|
|
111
|
+
if (error !== undefined) {
|
|
112
|
+
// Whistle may already have reported this command's failure. Move that
|
|
113
|
+
// notice to the toast surface without clearing another command's notice.
|
|
114
|
+
const notice = options.interactions.snapshot().notice;
|
|
115
|
+
if (notice?.tone === "error" && notice.message === error)
|
|
116
|
+
options.interactions.report(undefined);
|
|
117
|
+
options.interactions.toast({ variant: "error", message: error });
|
|
118
|
+
}
|
|
110
119
|
},
|
|
111
120
|
dispose: () => {
|
|
112
121
|
controller.abort();
|
package/dist/parakeet.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type ReactElement, type ReactNode } from "react";
|
|
|
4
4
|
import { type ParakeetAuthorOf } from "./core/author-labels.js";
|
|
5
5
|
import type { ToolItem } from "./store/types.js";
|
|
6
6
|
import type { ParakeetSession } from "./session.js";
|
|
7
|
+
import type { ParakeetToast } from "./commands/interactions.js";
|
|
7
8
|
import type { RowV1 } from "@fungi.computer/gills";
|
|
8
9
|
import { type ParakeetCommandRuntime } from "./commands/use-slash-commands.js";
|
|
9
10
|
/** Public composer options for an anonymous visitor conversation. */
|
|
@@ -45,6 +46,8 @@ export type ParakeetProps = Readonly<{
|
|
|
45
46
|
formatAssistantText?: ((text: string) => string) | undefined;
|
|
46
47
|
/** Host navigation for transcript links; true prevents browser navigation. */
|
|
47
48
|
onLink?: ((href: string) => boolean) | undefined;
|
|
49
|
+
/** Send transient command information and failures to the host toast surface. */
|
|
50
|
+
onToast?: ((toast: ParakeetToast) => void) | undefined;
|
|
48
51
|
/** Authorize and open a typed target through the host's navigation owner. */
|
|
49
52
|
onOpen?: ((target: NonNullable<RowV1["open"]>) => void) | undefined;
|
|
50
53
|
/** Optional caller-owned empty conversation state. */
|
|
@@ -97,4 +100,4 @@ export type ParakeetViewProps = Readonly<{
|
|
|
97
100
|
/** Render the retained conversation surface within one Parakeet provider. */
|
|
98
101
|
export declare function ParakeetView({ hideSoleAuthor, disambiguateAuthors, visitor, composerActionVariant, placeholder, empty, hostFacts, autoFocus, commands, renderToolActions, claimsToolMedia, renderAssistantAttachment, formatAssistantText, onLink, onOpen, }: ParakeetViewProps): ReactElement;
|
|
99
102
|
/** Standalone typed composer and exact-message timeline. */
|
|
100
|
-
export declare function Parakeet({ authorOf, hideSoleAuthor, disambiguateAuthors, visitor, markdownPolicy, composerActionVariant, empty, hostFacts, session, clients, renderToolActions, claimsToolMedia, renderAssistantAttachment, formatAssistantText, commands, onLink, onOpen, }: ParakeetProps): ReactElement;
|
|
103
|
+
export declare function Parakeet({ authorOf, hideSoleAuthor, disambiguateAuthors, visitor, markdownPolicy, composerActionVariant, empty, hostFacts, session, clients, renderToolActions, claimsToolMedia, renderAssistantAttachment, formatAssistantText, commands, onLink, onOpen, onToast, }: ParakeetProps): ReactElement;
|
package/dist/parakeet.js
CHANGED
|
@@ -417,6 +417,6 @@ function ConversationComposer({ visitor, textareaRef, composerActionVariant, pla
|
|
|
417
417
|
return _jsx(ChatComposer, { ...composerProps });
|
|
418
418
|
}
|
|
419
419
|
/** Standalone typed composer and exact-message timeline. */
|
|
420
|
-
export function Parakeet({ authorOf, hideSoleAuthor, disambiguateAuthors, visitor, markdownPolicy = "session", composerActionVariant, empty, hostFacts, session, clients, renderToolActions, claimsToolMedia, renderAssistantAttachment, formatAssistantText, commands, onLink, onOpen, }) {
|
|
421
|
-
return (_jsx(MarkdownPolicyContext.Provider, { value: markdownPolicy, children: _jsx(ParakeetProvider, { session: session, clients: clients, authorOf: authorOf, children: _jsx(ParakeetView, { hideSoleAuthor: hideSoleAuthor, disambiguateAuthors: disambiguateAuthors, visitor: visitor, composerActionVariant: composerActionVariant, empty: empty, hostFacts: hostFacts, renderToolActions: renderToolActions, claimsToolMedia: claimsToolMedia, renderAssistantAttachment: renderAssistantAttachment, formatAssistantText: formatAssistantText, commands: commands, onLink: onLink, onOpen: onOpen }) }) }));
|
|
420
|
+
export function Parakeet({ authorOf, hideSoleAuthor, disambiguateAuthors, visitor, markdownPolicy = "session", composerActionVariant, empty, hostFacts, session, clients, renderToolActions, claimsToolMedia, renderAssistantAttachment, formatAssistantText, commands, onLink, onOpen, onToast, }) {
|
|
421
|
+
return (_jsx(MarkdownPolicyContext.Provider, { value: markdownPolicy, children: _jsx(ParakeetProvider, { session: session, clients: clients, authorOf: authorOf, onToast: onToast, children: _jsx(ParakeetView, { hideSoleAuthor: hideSoleAuthor, disambiguateAuthors: disambiguateAuthors, visitor: visitor, composerActionVariant: composerActionVariant, empty: empty, hostFacts: hostFacts, renderToolActions: renderToolActions, claimsToolMedia: claimsToolMedia, renderAssistantAttachment: renderAssistantAttachment, formatAssistantText: formatAssistantText, commands: commands, onLink: onLink, onOpen: onOpen }) }) }));
|
|
422
422
|
}
|
package/docs/api/headless.md
CHANGED
|
@@ -1361,11 +1361,11 @@ Ordinary advertised actions over the current admitted rows and observation.
|
|
|
1361
1361
|
|
|
1362
1362
|
#### Returns
|
|
1363
1363
|
|
|
1364
|
-
| Name | Type
|
|
1365
|
-
| ----------- |
|
|
1366
|
-
| `state` | `ReadonlyMap`\<\{ `id`: `string`; `label`: `string`; `input?`: \{ \[`key`: `string`\]: `Json`; \}; `awaiting?`: `"question"`; \}, `Readonly`\<\{ `pending`: `boolean`;
|
|
1367
|
-
| `enabled` | `boolean`
|
|
1368
|
-
| `execute()` | (`entryId`, `action`, `waiting`) => `Promise`\<`void`\>
|
|
1364
|
+
| Name | Type | Description |
|
|
1365
|
+
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
1366
|
+
| `state` | `ReadonlyMap`\<\{ `id`: `string`; `label`: `string`; `input?`: \{ \[`key`: `string`\]: `Json`; \}; `awaiting?`: `"question"`; \}, `Readonly`\<\{ `pending`: `boolean`; \}\>\> | Current Session-owned state of admitted action intents. |
|
|
1367
|
+
| `enabled` | `boolean` | Observation is live and this Session's action owner is attached. |
|
|
1368
|
+
| `execute()` | (`entryId`, `action`, `waiting`) => `Promise`\<`void`\> | Execute an admitted intent through its owning advertised command. |
|
|
1369
1369
|
|
|
1370
1370
|
---
|
|
1371
1371
|
|
package/docs/api/index.md
CHANGED
|
@@ -595,6 +595,7 @@ type ParakeetProps = Readonly<{
|
|
|
595
595
|
renderAssistantAttachment?: (text) => ReactNode;
|
|
596
596
|
formatAssistantText?: (text) => string;
|
|
597
597
|
onLink?: (href) => boolean;
|
|
598
|
+
onToast?: (toast) => void;
|
|
598
599
|
onOpen?: (target) => void;
|
|
599
600
|
empty?: ReactNode;
|
|
600
601
|
hostFacts?: ParakeetHostFacts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/parakeet",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Standalone React composer for a typed Shiitake Session",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@earendil-works/pi-ai": "1.5.2",
|
|
71
|
-
"@fungi.computer/agar": "0.27.
|
|
71
|
+
"@fungi.computer/agar": "0.27.2",
|
|
72
72
|
"@fungi.computer/bird-dog": "0.3.8",
|
|
73
73
|
"@fungi.computer/cairn": "0.1.0",
|
|
74
|
-
"@fungi.computer/caps": "0.12.
|
|
74
|
+
"@fungi.computer/caps": "0.12.9",
|
|
75
75
|
"@fungi.computer/gills": "0.4.0",
|
|
76
|
-
"@fungi.computer/knapsack": "0.4.
|
|
76
|
+
"@fungi.computer/knapsack": "0.4.27",
|
|
77
77
|
"@fungi.computer/mule": "0.3.0",
|
|
78
|
-
"@fungi.computer/shiitake": "0.22.
|
|
78
|
+
"@fungi.computer/shiitake": "0.22.4",
|
|
79
79
|
"@fungi.computer/sigils": "0.3.2",
|
|
80
80
|
"@fungi.computer/sprite": "0.2.2",
|
|
81
81
|
"@fungi.computer/sprite-zdog": "0.3.2",
|