@agentshouse/mdruntime 0.1.0-cb95ca2c884cf → 0.1.0-cb9c79aee537a
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/AGENTS.md +275 -275
- package/README.md +8 -8
- package/dist/adapter.d.ts +51 -9
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +14 -1
- package/dist/bootstrap.d.ts +3 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +33 -7
- package/dist/change-set.d.ts +2 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +36 -10
- package/dist/chat/acts.d.ts +3 -4
- package/dist/chat/acts.d.ts.map +1 -1
- package/dist/chat/acts.js +10 -10
- package/dist/chat/earlier.d.ts +10 -0
- package/dist/chat/earlier.d.ts.map +1 -0
- package/dist/chat/earlier.js +54 -0
- package/dist/chat/kit.d.ts +2 -1
- package/dist/chat/kit.d.ts.map +1 -1
- package/dist/chat/kit.js +3 -3
- package/dist/chat/list.d.ts +8 -1
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +48 -8
- package/dist/chat/markdown.d.ts +3 -1
- package/dist/chat/markdown.d.ts.map +1 -1
- package/dist/chat/markdown.js +85 -26
- package/dist/chat/message.d.ts.map +1 -1
- package/dist/chat/message.js +2 -2
- package/dist/chat/messages.d.ts +1 -0
- package/dist/chat/messages.d.ts.map +1 -1
- package/dist/chat/messages.js +4 -0
- package/dist/chat/pieces.d.ts +51 -0
- package/dist/chat/pieces.d.ts.map +1 -0
- package/dist/chat/pieces.js +797 -0
- package/dist/chat/provider.d.ts +1 -1
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +62 -79
- package/dist/chat/question.d.ts +1 -1
- package/dist/chat/question.d.ts.map +1 -1
- package/dist/chat/question.js +7 -18
- package/dist/chat/ready.d.ts +1 -0
- package/dist/chat/ready.d.ts.map +1 -1
- package/dist/chat/ready.js +4 -4
- package/dist/chat/style.js +4 -4
- package/dist/chat.d.ts +1 -1
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/client.d.ts +17 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +19 -6
- package/dist/collection.d.ts +20 -5
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +309 -33
- package/dist/connection.d.ts +31 -9
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1573 -372
- package/dist/conversation.d.ts +20 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +474 -163
- package/dist/durability.d.ts +7 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +17 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +157 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/host.d.ts +15 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +94 -12
- package/dist/identity.d.ts +2 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +6 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/memory.d.ts +8 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +33 -6
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -1
- package/dist/observation.d.ts +7 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +29 -12
- package/dist/outcome.d.ts +12 -2
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +4 -0
- package/dist/overlay.d.ts +3 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +62 -55
- package/dist/query.d.ts +56 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +36 -7
- package/dist/reach.d.ts +6 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +30 -5
- package/dist/react.d.ts +8 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/read-side.d.ts +16 -7
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +484 -100
- package/dist/readiness.d.ts +53 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +33 -0
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +98 -0
- package/dist/recovery.d.ts +25 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +197 -0
- package/dist/refresh.d.ts +4 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +18 -11
- package/dist/replica.d.ts +10 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +95 -32
- package/dist/room-draft.d.ts +13 -1
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +2 -2
- package/dist/rows.d.ts +6 -13
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +10 -13
- package/dist/save.d.ts +9 -3
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +68 -22
- package/dist/search.d.ts +49 -6
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +192 -47
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +14 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +394 -0
- package/dist/status.d.ts +4 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/store.d.ts +59 -12
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +350 -86
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +64 -0
- package/dist/windows.d.ts +26 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +93 -0
- package/dist/wire.d.ts +152 -32
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +52 -31
- package/package.json +6 -2
package/dist/chat/kit.d.ts
CHANGED
|
@@ -48,7 +48,8 @@ export declare function ItemRow({ lead, title, sub, trailing, }: {
|
|
|
48
48
|
sub: ReactNode;
|
|
49
49
|
trailing: ReactNode;
|
|
50
50
|
}): ReactElement;
|
|
51
|
-
export declare function Working({ step }: {
|
|
51
|
+
export declare function Working({ label, step, }: {
|
|
52
|
+
label?: string;
|
|
52
53
|
step?: string | undefined;
|
|
53
54
|
}): ReactElement;
|
|
54
55
|
export type ChatNoteProps = {
|
package/dist/chat/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/chat/kit.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAEhF,eAAO,MAAM,MAAM,6CAA0C,CAAC;AAE9D,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,YAAY,CAQf;AAED,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,YAAY,CAa1E;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CASrF;AAED,KAAK,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC;AA0BjE,wBAAgB,MAAM,CAAC,EACrB,OAAiB,EACjB,OAAe,EACf,IAAe,EACf,QAAQ,EAC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,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,YAAY,CAWf;AAMD,wBAAgB,OAAO,CAAC,EACtB,KAAiB,EACjB,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,GAAG,YAAY,CAiBf;AASD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,aAAa,GAAG,YAAY,GAAG,IAAI,CAuB/E"}
|
package/dist/chat/kit.js
CHANGED
|
@@ -94,7 +94,7 @@ export function ItemRow({ lead, title, sub, trailing, }) {
|
|
|
94
94
|
function elapsed(seconds) {
|
|
95
95
|
return seconds >= 60 ? `${Math.floor(seconds / 60)}m ${seconds % 60}s` : `${seconds}s`;
|
|
96
96
|
}
|
|
97
|
-
export function Working({ step }) {
|
|
97
|
+
export function Working({ label = 'Working', step, }) {
|
|
98
98
|
const [from] = useState(() => Date.now());
|
|
99
99
|
const [now, setNow] = useState(from);
|
|
100
100
|
useEffect(() => {
|
|
@@ -102,11 +102,11 @@ export function Working({ step }) {
|
|
|
102
102
|
const tick = setInterval(() => setNow(Date.now()), 1000);
|
|
103
103
|
return () => clearInterval(tick);
|
|
104
104
|
}, []);
|
|
105
|
-
return (_jsxs("div", { className: "ahc-toolline ahc-working", role: "status", children: [_jsx("span", { className: "ahc-shimmer", children:
|
|
105
|
+
return (_jsxs("div", { className: "ahc-toolline ahc-working", role: "status", children: [_jsx("span", { className: "ahc-shimmer", children: label }), _jsx("span", { className: "ahc-figure", "aria-hidden": "true", children: elapsed(Math.floor((now - from) / 1000)) }), step === undefined ? null : _jsx("span", { children: step })] }));
|
|
106
106
|
}
|
|
107
107
|
const SAID = {
|
|
108
108
|
sending: 'Sending…',
|
|
109
|
-
offline: '
|
|
109
|
+
offline: 'House can’t be reached. Nothing was sent.',
|
|
110
110
|
};
|
|
111
111
|
const UNANSWERED = 'House did not answer.';
|
|
112
112
|
export function ChatNote({ outcome, again }) {
|
package/dist/chat/list.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { type ComponentType, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
export type AgentLook = {
|
|
3
|
+
readonly AgentLink?: ComponentType<{
|
|
4
|
+
agent: string;
|
|
5
|
+
className: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
'aria-current': 'true' | undefined;
|
|
8
|
+
}> | undefined;
|
|
3
9
|
readonly agentMark?: ((agent: string, size: number) => ReactNode) | undefined;
|
|
4
10
|
readonly agentDetail?: ((agent: string) => string) | undefined;
|
|
5
11
|
};
|
|
@@ -11,9 +17,10 @@ export type ChatMessageListProps = {
|
|
|
11
17
|
};
|
|
12
18
|
readonly onLink?: (href: string) => void;
|
|
13
19
|
readonly footer?: ReactNode;
|
|
20
|
+
readonly waiting?: string | null;
|
|
14
21
|
readonly children?: ReactNode;
|
|
15
22
|
};
|
|
16
|
-
export declare function ChatMessageList({ components, onLink, footer, children, }: ChatMessageListProps): ReactElement;
|
|
23
|
+
export declare function ChatMessageList({ components, onLink, footer, waiting, children, }: ChatMessageListProps): ReactElement;
|
|
17
24
|
export declare function ChatList({ onChoose }: {
|
|
18
25
|
onChoose: () => void;
|
|
19
26
|
}): ReactElement;
|
package/dist/chat/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/chat/list.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d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BAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,YAAY,CAkD7E"}
|
package/dist/chat/list.js
CHANGED
|
@@ -1,33 +1,73 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, } from 'react';
|
|
3
|
-
import { ThreadPrimitive } from '@assistant-ui/react';
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useRef, } from 'react';
|
|
3
|
+
import { ThreadPrimitive, useAui } from '@assistant-ui/react';
|
|
4
4
|
import Check from 'lucide-react/dist/esm/icons/check.mjs';
|
|
5
5
|
import MessageSquare from 'lucide-react/dist/esm/icons/message-square.mjs';
|
|
6
6
|
import SquarePen from 'lucide-react/dist/esm/icons/square-pen.mjs';
|
|
7
|
-
import { Name, Scoped } from './kit.js';
|
|
7
|
+
import { Name, Scoped, Working } from './kit.js';
|
|
8
8
|
import { AssistantMessage, Linked, UserMessage } from './message.js';
|
|
9
|
+
import { awaitsTurn } from './messages.js';
|
|
9
10
|
import { ChatName } from './name.js';
|
|
10
11
|
import { useOpened } from './opened.js';
|
|
11
12
|
import { ChatQuestionCard } from './question.js';
|
|
12
13
|
export const Described = createContext({});
|
|
14
|
+
const EARLIER_MARGIN = 240;
|
|
13
15
|
function Chip({ agent, name, on, start, }) {
|
|
14
|
-
const { agentMark, agentDetail } = useContext(Described);
|
|
15
|
-
|
|
16
|
+
const { agentMark, agentDetail, AgentLink } = useContext(Described);
|
|
17
|
+
const content = (_jsxs(_Fragment, { children: [agentMark?.(agent, 16), _jsx(Name, { text: name }), agentDetail === undefined ? null : _jsx(Name, { text: agentDetail(agent), className: "ahc-meta" })] }));
|
|
18
|
+
if (AgentLink !== undefined)
|
|
19
|
+
return (_jsx(AgentLink, { agent: agent, className: "ahc-btn ahc-agent", "aria-current": on ? 'true' : undefined, children: content }));
|
|
20
|
+
return (_jsx("button", { type: "button", className: "ahc-btn ahc-agent", "aria-pressed": on, onClick: () => start(agent), children: content }));
|
|
16
21
|
}
|
|
17
22
|
function Empty() {
|
|
18
23
|
const chat = useOpened();
|
|
19
24
|
return (_jsxs("div", { className: "ahc-empty", children: [_jsx("h2", { className: "ahc-empty__title", children: "What should we work on?" }), chat.conversation === null &&
|
|
20
25
|
(chat.agents.length > 1 || !chat.agents.some((one) => one.identity === chat.by)) ? (_jsx("div", { role: "group", "aria-label": "Agent", className: "ahc-agents", children: chat.agents.map((one) => (_jsx(Chip, { agent: one.identity, name: one.name, on: one.identity === chat.by, start: chat.start }, one.identity))) })) : null] }));
|
|
21
26
|
}
|
|
22
|
-
export function ChatMessageList({ components = {}, onLink, footer, children, }) {
|
|
27
|
+
export function ChatMessageList({ components = {}, onLink, footer, waiting, children, }) {
|
|
23
28
|
const chat = useOpened();
|
|
24
29
|
const linked = useContext(Linked);
|
|
30
|
+
const aui = useAui();
|
|
31
|
+
const viewport = useRef(null);
|
|
32
|
+
const content = useRef(null);
|
|
33
|
+
const anchor = useRef(null);
|
|
34
|
+
const first = chat.view?.messages[0]?.identity;
|
|
35
|
+
const shownFirst = useRef(first);
|
|
36
|
+
shownFirst.current = first;
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const element = viewport.current;
|
|
39
|
+
const inner = content.current;
|
|
40
|
+
if (element === null || inner === null)
|
|
41
|
+
return;
|
|
42
|
+
const kept = new ResizeObserver(() => {
|
|
43
|
+
const held = anchor.current;
|
|
44
|
+
if (held === null || held.first === shownFirst.current)
|
|
45
|
+
return;
|
|
46
|
+
if (element.scrollHeight === held.height)
|
|
47
|
+
return;
|
|
48
|
+
anchor.current = null;
|
|
49
|
+
element.scrollTop += element.scrollHeight - held.height;
|
|
50
|
+
});
|
|
51
|
+
kept.observe(inner);
|
|
52
|
+
return () => kept.disconnect();
|
|
53
|
+
}, []);
|
|
54
|
+
const earlier = () => {
|
|
55
|
+
const element = viewport.current;
|
|
56
|
+
if (element === null || element.scrollTop > EARLIER_MARGIN)
|
|
57
|
+
return;
|
|
58
|
+
const thread = aui.thread();
|
|
59
|
+
const state = thread.getState();
|
|
60
|
+
if (!state.hasEarlier || state.isLoadingEarlier)
|
|
61
|
+
return;
|
|
62
|
+
anchor.current = { height: element.scrollHeight, first };
|
|
63
|
+
void thread.loadEarlier();
|
|
64
|
+
};
|
|
25
65
|
const User = components.UserMessage ?? UserMessage;
|
|
26
66
|
const Assistant = components.AssistantMessage ?? AssistantMessage;
|
|
27
67
|
const silent = chat.view === null
|
|
28
68
|
? chat.conversation === null
|
|
29
69
|
: chat.view.messages.length === 0 && chat.view.turn === null;
|
|
30
|
-
return (_jsx(Scoped, { children: _jsx(Linked.Provider, { value: onLink ?? linked, children: _jsx(ThreadPrimitive.Root, { className: "ahc-thread", children: _jsxs(ThreadPrimitive.Viewport, { className: "ahc-viewport", children: [_jsxs("div", { className: "ahc-column ahc-messages", children: [silent ? _jsx(Empty, {}) : null, _jsx(ThreadPrimitive.Messages, { children: ({ message }) => (message.role === 'user' ? _jsx(User, {}) : _jsx(Assistant, {})) }), children === undefined
|
|
70
|
+
return (_jsx(Scoped, { children: _jsx(Linked.Provider, { value: onLink ?? linked, children: _jsx(ThreadPrimitive.Root, { className: "ahc-thread", children: _jsxs(ThreadPrimitive.Viewport, { className: "ahc-viewport", ref: viewport, onScroll: earlier, children: [_jsxs("div", { className: "ahc-column ahc-messages", ref: content, children: [silent ? _jsx(Empty, {}) : null, _jsx(ThreadPrimitive.Messages, { children: ({ message }) => (message.role === 'user' ? _jsx(User, {}) : _jsx(Assistant, {})) }), waiting == null || !awaitsTurn(chat.view) ? null : (_jsx("div", { className: "ahc-turn", children: _jsx(Working, { label: waiting }) })), children === undefined
|
|
31
71
|
? chat.questions.map((question) => (_jsx(ChatQuestionCard, { question: question }, question.interaction)))
|
|
32
72
|
: children] }), footer === undefined ? null : (_jsx(ThreadPrimitive.ViewportFooter, { className: "ahc-column ahc-footer", children: footer }))] }) }) }) }));
|
|
33
73
|
}
|
package/dist/chat/markdown.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
export interface FileReference {
|
|
3
3
|
readonly pattern: RegExp;
|
|
4
|
-
readonly
|
|
4
|
+
readonly names?: (destination: string) => boolean;
|
|
5
|
+
readonly draw: (reference: string, label: string, image: boolean) => ReactNode;
|
|
5
6
|
}
|
|
6
7
|
interface MarkdownOptions {
|
|
7
8
|
readonly className?: string;
|
|
@@ -10,6 +11,7 @@ interface MarkdownOptions {
|
|
|
10
11
|
}
|
|
11
12
|
export declare function slugOf(text: string): string;
|
|
12
13
|
export declare function anchorOf(fragment: string): string;
|
|
14
|
+
export declare function revealed(anchor: string): HTMLElement | null;
|
|
13
15
|
export declare function plainText(text: string): string;
|
|
14
16
|
export type MarkdownProps = MarkdownOptions & {
|
|
15
17
|
readonly text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/chat/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/chat/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAYf,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC;CAChF;AAED,UAAU,eAAe;IACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;CAC/B;AAYD,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3C;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjD;AAkED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAK3D;AA4JD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,EAAE,aAAa,GAAG,YAAY,CAgDrF"}
|
package/dist/chat/markdown.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { createElement, Fragment } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { gfm } from 'micromark-extension-gfm';
|
|
1
|
+
import { createElement, Fragment, useEffect, useMemo, useRef, useState, } from 'react';
|
|
2
|
+
import { flushSync } from 'react-dom';
|
|
3
|
+
import { drawn, longOf, parseMarkdown, pieceAt, remaining, } from './pieces.js';
|
|
5
4
|
function unfiled(options) {
|
|
6
|
-
const { definitions,
|
|
7
|
-
return onLink === undefined ? { definitions,
|
|
5
|
+
const { definitions, ids, onLink } = options;
|
|
6
|
+
return onLink === undefined ? { definitions, ids } : { definitions, ids, onLink };
|
|
8
7
|
}
|
|
9
8
|
export function slugOf(text) {
|
|
10
9
|
return text
|
|
@@ -23,7 +22,8 @@ function headingId(slugs, text) {
|
|
|
23
22
|
return anchorOf(seen === 0 ? slug : `${slug}-${seen}`);
|
|
24
23
|
}
|
|
25
24
|
function whole(file, text) {
|
|
26
|
-
return file !== undefined &&
|
|
25
|
+
return (file !== undefined &&
|
|
26
|
+
([...text.matchAll(file.pattern)].some((one) => one[0] === text) || file.names?.(text) === true));
|
|
27
27
|
}
|
|
28
28
|
function referenced(file, text, key) {
|
|
29
29
|
const parts = [];
|
|
@@ -32,7 +32,7 @@ function referenced(file, text, key) {
|
|
|
32
32
|
const at = found.index;
|
|
33
33
|
if (at > from)
|
|
34
34
|
parts.push(text.slice(from, at));
|
|
35
|
-
parts.push(createElement(Fragment, { key: at }, file.draw(found[0], found[0])));
|
|
35
|
+
parts.push(createElement(Fragment, { key: at }, file.draw(found[0], found[0], false)));
|
|
36
36
|
from = at + found[0].length;
|
|
37
37
|
}
|
|
38
38
|
if (from === 0)
|
|
@@ -41,9 +41,6 @@ function referenced(file, text, key) {
|
|
|
41
41
|
parts.push(text.slice(from));
|
|
42
42
|
return createElement(Fragment, { key }, ...parts);
|
|
43
43
|
}
|
|
44
|
-
function parseMarkdown(text) {
|
|
45
|
-
return fromMarkdown(text, { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] });
|
|
46
|
-
}
|
|
47
44
|
function safeHref(url) {
|
|
48
45
|
const href = url.replace(/[\t\n\r]/g, '').replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, '');
|
|
49
46
|
if (href === '' || /^[\\/]{2}/.test(href))
|
|
@@ -64,17 +61,36 @@ function textOf(node) {
|
|
|
64
61
|
return node.children.map(textOf).join('');
|
|
65
62
|
return '';
|
|
66
63
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
function headingIds(nodes, slugs, ids) {
|
|
65
|
+
for (const node of nodes) {
|
|
66
|
+
if (node.type === 'heading')
|
|
67
|
+
ids.set(node, headingId(slugs, textOf(node)));
|
|
68
|
+
else if (node.type === 'blockquote' || node.type === 'list' || node.type === 'listItem') {
|
|
69
|
+
headingIds(node.children, slugs, ids);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const revealers = new Set();
|
|
74
|
+
export function revealed(anchor) {
|
|
75
|
+
const heading = document.getElementById(anchor);
|
|
76
|
+
if (heading !== null)
|
|
77
|
+
return heading;
|
|
78
|
+
for (const reveal of revealers)
|
|
79
|
+
if (reveal(anchor))
|
|
80
|
+
return document.getElementById(anchor);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
function fragmentOf(href) {
|
|
84
|
+
try {
|
|
85
|
+
return decodeURIComponent(href.slice(1));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return href.slice(1);
|
|
89
|
+
}
|
|
74
90
|
}
|
|
75
91
|
function link(url, node, key, options) {
|
|
76
|
-
if (
|
|
77
|
-
return createElement(Fragment, { key }, options.file.draw(url, textOf(node) || url));
|
|
92
|
+
if (whole(options.file, url)) {
|
|
93
|
+
return createElement(Fragment, { key }, options.file.draw(url, textOf(node) || url, false));
|
|
78
94
|
}
|
|
79
95
|
const inside = node.children.map((child, at) => render(child, at, unfiled(options)));
|
|
80
96
|
const href = safeHref(url);
|
|
@@ -82,7 +98,8 @@ function link(url, node, key, options) {
|
|
|
82
98
|
return createElement(Fragment, { key }, ...inside);
|
|
83
99
|
const onLink = options.onLink;
|
|
84
100
|
if (external(href) || onLink === undefined) {
|
|
85
|
-
|
|
101
|
+
const onClick = href.startsWith('#') ? () => revealed(fragmentOf(href)) : undefined;
|
|
102
|
+
return createElement('a', { key, href, rel: 'noreferrer', onClick }, ...inside);
|
|
86
103
|
}
|
|
87
104
|
return createElement('a', {
|
|
88
105
|
key,
|
|
@@ -103,7 +120,7 @@ function render(node, key, options, header = false) {
|
|
|
103
120
|
case 'paragraph':
|
|
104
121
|
return createElement('p', { key }, ...children());
|
|
105
122
|
case 'heading':
|
|
106
|
-
return createElement(`h${node.depth}`, { key, id:
|
|
123
|
+
return createElement(`h${node.depth}`, { key, id: options.ids.get(node) }, ...children());
|
|
107
124
|
case 'text':
|
|
108
125
|
return options.file === undefined ? node.value : referenced(options.file, node.value, key);
|
|
109
126
|
case 'emphasis':
|
|
@@ -139,8 +156,8 @@ function render(node, key, options, header = false) {
|
|
|
139
156
|
case 'linkReference':
|
|
140
157
|
return link(options.definitions.get(node.identifier) ?? '', node, key, options);
|
|
141
158
|
case 'image':
|
|
142
|
-
return
|
|
143
|
-
? createElement(Fragment, { key }, options.file.draw(node.url, node.alt || node.url))
|
|
159
|
+
return whole(options.file, node.url)
|
|
160
|
+
? createElement(Fragment, { key }, options.file.draw(node.url, node.alt || node.url, true))
|
|
144
161
|
: (node.alt ?? '');
|
|
145
162
|
case 'html':
|
|
146
163
|
return node.value;
|
|
@@ -182,6 +199,48 @@ export function plainText(text) {
|
|
|
182
199
|
return spokenOf(parseMarkdown(text)).replace(/\s+/g, ' ').trim();
|
|
183
200
|
}
|
|
184
201
|
export function Markdown({ text, className, ...options }) {
|
|
185
|
-
const
|
|
186
|
-
|
|
202
|
+
const long = useMemo(() => longOf(text), [text]);
|
|
203
|
+
const [shown, setShown] = useState(1);
|
|
204
|
+
const more = useRef(null);
|
|
205
|
+
const nodes = drawn(long, shown);
|
|
206
|
+
const showing = Math.min(shown, long.pieces.length);
|
|
207
|
+
const rest = remaining(long, showing);
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
const sentinel = more.current;
|
|
210
|
+
if (sentinel === null)
|
|
211
|
+
return;
|
|
212
|
+
const watcher = new IntersectionObserver((seen) => {
|
|
213
|
+
if (seen.some((one) => one.isIntersecting))
|
|
214
|
+
setShown(showing + 1);
|
|
215
|
+
}, { rootMargin: '0px 0px 100% 0px' });
|
|
216
|
+
watcher.observe(sentinel);
|
|
217
|
+
return () => watcher.disconnect();
|
|
218
|
+
}, [showing, long]);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (!rest)
|
|
221
|
+
return;
|
|
222
|
+
const reveal = (anchor) => {
|
|
223
|
+
const slugs = new Map();
|
|
224
|
+
for (let index = 0;; index += 1) {
|
|
225
|
+
const piece = pieceAt(long, index);
|
|
226
|
+
if (piece === null)
|
|
227
|
+
return false;
|
|
228
|
+
const ids = new Map();
|
|
229
|
+
headingIds(piece.nodes, slugs, ids);
|
|
230
|
+
if ([...ids.values()].includes(anchor)) {
|
|
231
|
+
if (index >= showing)
|
|
232
|
+
flushSync(() => setShown(index + 1));
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
revealers.add(reveal);
|
|
238
|
+
return () => {
|
|
239
|
+
revealers.delete(reveal);
|
|
240
|
+
};
|
|
241
|
+
}, [showing, long, rest]);
|
|
242
|
+
const ids = new Map();
|
|
243
|
+
headingIds(nodes, new Map(), ids);
|
|
244
|
+
const rendering = { ...options, definitions: long.urls, ids };
|
|
245
|
+
return createElement('div', { className }, ...nodes.map((node, at) => render(node, at, rendering)), rest ? createElement('div', { key: 'more', ref: more }) : null);
|
|
187
246
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/chat/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/chat/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;AAmCf,eAAO,MAAM,MAAM,kCAAyB,MAAM,KAAK,IAAI,SAAe,CAAC;AA0O3E,wBAAgB,WAAW,IAAI,YAAY,CA4B1C;AAED,wBAAgB,WAAW,IAAI,YAAY,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,YAAY,CA0F/C"}
|
package/dist/chat/message.js
CHANGED
|
@@ -20,6 +20,7 @@ import RotateCw from 'lucide-react/dist/esm/icons/rotate-cw.mjs';
|
|
|
20
20
|
import Send from 'lucide-react/dist/esm/icons/send.mjs';
|
|
21
21
|
import SlidersHorizontal from 'lucide-react/dist/esm/icons/sliders-horizontal.mjs';
|
|
22
22
|
import Terminal from 'lucide-react/dist/esm/icons/terminal.mjs';
|
|
23
|
+
import { SESSION_STARTED } from '../conversation.js';
|
|
23
24
|
import { buttonClass, Name, Working } from './kit.js';
|
|
24
25
|
import { StillRunning } from './lasting.js';
|
|
25
26
|
import { list, record, text } from './read.js';
|
|
@@ -29,7 +30,6 @@ const groupBy = groupPartByType({
|
|
|
29
30
|
'tool-call': ['group-thought'],
|
|
30
31
|
});
|
|
31
32
|
const GFM = [remarkGfm];
|
|
32
|
-
const STARTED = 'Session started';
|
|
33
33
|
const SENT = {
|
|
34
34
|
send_routine_request: 'Sent a request',
|
|
35
35
|
cancel_routine_request: 'Cancelled a request',
|
|
@@ -184,7 +184,7 @@ export function AssistantMessage() {
|
|
|
184
184
|
case 'file':
|
|
185
185
|
return (_jsxs("div", { className: "ahc-toolline ahc-quiet", children: [_jsx(ImageGlyph, { "aria-hidden": "true" }), _jsx("span", { className: "ahc-clipped", children: part.filename })] }));
|
|
186
186
|
case 'indicator':
|
|
187
|
-
return _jsx(Working, { step: started ?
|
|
187
|
+
return _jsx(Working, { step: started ? SESSION_STARTED : undefined });
|
|
188
188
|
default:
|
|
189
189
|
return null;
|
|
190
190
|
}
|
package/dist/chat/messages.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type Said = {
|
|
|
14
14
|
readonly files: readonly string[];
|
|
15
15
|
};
|
|
16
16
|
export declare function saidOf(entry: Entry): Said;
|
|
17
|
+
export declare function awaitsTurn(view: ConversationView | null): boolean;
|
|
17
18
|
export declare function askedBefore(view: ConversationView | null, id: string | null): string | null;
|
|
18
19
|
export declare function chatMessages(view: ConversationView | null): ThreadMessageLike[];
|
|
19
20
|
export declare function contextOf(view: ConversationView | null): TurnContext | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/chat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
|
|
73
73
|
? turns
|
|
74
74
|
: [...turns, { turn: view.turn.turn, parts: partsOf(view.turn.parts), ended: false }]);
|
|
75
75
|
}
|
|
76
|
+
export function awaitsTurn(view) {
|
|
77
|
+
const newest = view?.messages.at(-1);
|
|
78
|
+
return view?.turn === null && newest !== undefined && saidOf(newest).user;
|
|
79
|
+
}
|
|
76
80
|
export function askedBefore(view, id) {
|
|
77
81
|
const said = (view?.messages ?? []).map((entry) => ({ ...saidOf(entry), id: entry.identity }));
|
|
78
82
|
const asked = said
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
2
|
+
export type Root = ReturnType<typeof fromMarkdown>;
|
|
3
|
+
export type Block = Root['children'][number];
|
|
4
|
+
export declare function parseMarkdown(text: string): Root;
|
|
5
|
+
export type Step = 'list' | 'table' | 'blockquote' | 'paragraph';
|
|
6
|
+
export interface Piece {
|
|
7
|
+
readonly nodes: readonly Block[];
|
|
8
|
+
readonly path: readonly Step[];
|
|
9
|
+
readonly join: string;
|
|
10
|
+
}
|
|
11
|
+
interface Next {
|
|
12
|
+
readonly start: number;
|
|
13
|
+
readonly path: readonly Step[];
|
|
14
|
+
readonly join: string;
|
|
15
|
+
readonly carry: string;
|
|
16
|
+
}
|
|
17
|
+
interface Found {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly at: number;
|
|
20
|
+
readonly url: string;
|
|
21
|
+
}
|
|
22
|
+
interface Region {
|
|
23
|
+
readonly setext: boolean;
|
|
24
|
+
readonly last: ReadonlyMap<string, number>;
|
|
25
|
+
readonly runs: ReadonlyMap<number, number>;
|
|
26
|
+
}
|
|
27
|
+
interface Discovery {
|
|
28
|
+
readonly found: Found[];
|
|
29
|
+
next: Next | null;
|
|
30
|
+
}
|
|
31
|
+
export interface Long {
|
|
32
|
+
readonly text: string;
|
|
33
|
+
readonly starts: Int32Array;
|
|
34
|
+
readonly breaks: Int32Array;
|
|
35
|
+
readonly quoteBreaks: Int32Array;
|
|
36
|
+
readonly anchors: readonly number[];
|
|
37
|
+
readonly candidates: ReadonlyMap<string, readonly number[]>;
|
|
38
|
+
readonly pieces: Piece[];
|
|
39
|
+
next: Next | null;
|
|
40
|
+
readonly urls: Map<string, string>;
|
|
41
|
+
readonly spans: Map<string, readonly Found[]>;
|
|
42
|
+
readonly discoveries: Map<number, Discovery>;
|
|
43
|
+
readonly regions: Map<string, Region>;
|
|
44
|
+
}
|
|
45
|
+
export declare function identifierOf(label: string): string;
|
|
46
|
+
export declare function longOf(text: string): Long;
|
|
47
|
+
export declare function pieceAt(long: Long, index: number): Piece | null;
|
|
48
|
+
export declare function drawn(long: Long, count: number): Block[];
|
|
49
|
+
export declare function remaining(long: Long, count: number): boolean;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=pieces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pieces.d.ts","sourceRoot":"","sources":["../../src/chat/pieces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIxD,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACnD,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAI7C,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEhD;AA4DD,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,CAAC;AAIjE,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,IAAI;IACZ,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,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