@useavalon/caelence-agent 0.2.2-canary.5 → 0.2.2-canary.6
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/desktop/src/App.tsx +28 -1
- package/desktop/src/BubbleClip.tsx +58 -0
- package/desktop/src/PlatformPane.tsx +98 -0
- package/desktop/src/SkillsPanel.tsx +0 -7
- package/desktop/src/app.css +906 -47
- package/desktop/src/clip.test.ts +16 -0
- package/desktop/src/clip.ts +26 -0
- package/desktop/src/platform.test.ts +30 -0
- package/desktop/src/platform.ts +76 -0
- package/desktop/src/rich-text.test.ts +26 -0
- package/desktop/src/rich-text.ts +51 -2
- package/desktop/src/stream.ts +1 -0
- package/desktop/src/styles/primitives.css +6 -3
- package/package.json +1 -1
- package/src/cli/models.ts +3 -1
- package/src/cli/openrouter-live.test.ts +29 -0
- package/src/cli/openrouter-live.ts +9 -1
- package/src/desktop/bridge.ts +9 -6
package/desktop/src/App.tsx
CHANGED
|
@@ -67,6 +67,7 @@ import {
|
|
|
67
67
|
startTurn,
|
|
68
68
|
transcribe,
|
|
69
69
|
} from "./api";
|
|
70
|
+
import { BubbleClip } from "./BubbleClip";
|
|
70
71
|
import { AttachmentThumbs } from "./ComposerAttach";
|
|
71
72
|
import {
|
|
72
73
|
type ComposerAttachment,
|
|
@@ -91,7 +92,9 @@ import { FloatNotice } from "./FloatNotice";
|
|
|
91
92
|
import { integrationMatches } from "./integration-search";
|
|
92
93
|
import { LogoMark } from "./LogoMark";
|
|
93
94
|
import { McpPanel } from "./McpPanel";
|
|
95
|
+
import { PlatformPane } from "./PlatformPane";
|
|
94
96
|
import { pickerKeyAction, pickerStartIndex, stepIndex } from "./picker-nav";
|
|
97
|
+
import { formatPlatformOutput, isPlatformTool } from "./platform";
|
|
95
98
|
import {
|
|
96
99
|
enqueueMessage,
|
|
97
100
|
type QueuedMessage,
|
|
@@ -460,6 +463,7 @@ export function App(): React.ReactElement {
|
|
|
460
463
|
suffix?: string;
|
|
461
464
|
} | null>(null);
|
|
462
465
|
const [editingQueuedId, setEditingQueuedId] = useState<string | null>(null);
|
|
466
|
+
const [integrations, setIntegrations] = useState<PublicIntegration[]>([]);
|
|
463
467
|
const [notice, setNotice] = useState<{ text: string; id: number } | null>(null);
|
|
464
468
|
const [attachments, setAttachments] = useState<ComposerAttachment[]>([]);
|
|
465
469
|
const [fileDrag, setFileDrag] = useState(false);
|
|
@@ -543,6 +547,13 @@ export function App(): React.ReactElement {
|
|
|
543
547
|
};
|
|
544
548
|
}, []);
|
|
545
549
|
|
|
550
|
+
useEffect(() => {
|
|
551
|
+
if (!bridge) return;
|
|
552
|
+
void getIntegrations(bridge)
|
|
553
|
+
.then((result) => setIntegrations(result.items))
|
|
554
|
+
.catch(() => undefined);
|
|
555
|
+
}, [bridge]);
|
|
556
|
+
|
|
546
557
|
useEffect(() => {
|
|
547
558
|
const node = transcriptRef.current;
|
|
548
559
|
if (node) node.scrollTop = node.scrollHeight;
|
|
@@ -1539,6 +1550,7 @@ export function App(): React.ReactElement {
|
|
|
1539
1550
|
key={line.key}
|
|
1540
1551
|
line={line}
|
|
1541
1552
|
bridge={bridge}
|
|
1553
|
+
integrations={integrations}
|
|
1542
1554
|
editing={
|
|
1543
1555
|
line.type === "user" && editingUser?.index === line.userTurnIndex
|
|
1544
1556
|
? editingUser.text
|
|
@@ -2498,7 +2510,11 @@ function UserTranscriptLine(
|
|
|
2498
2510
|
) : (
|
|
2499
2511
|
<>
|
|
2500
2512
|
<AttachmentThumbs items={shown.attachments} variant="chat" />
|
|
2501
|
-
{shown.text ?
|
|
2513
|
+
{shown.text ? (
|
|
2514
|
+
<BubbleClip text={shown.text}>
|
|
2515
|
+
<p>{shown.text}</p>
|
|
2516
|
+
</BubbleClip>
|
|
2517
|
+
) : null}
|
|
2502
2518
|
</>
|
|
2503
2519
|
)}
|
|
2504
2520
|
</div>
|
|
@@ -2517,6 +2533,7 @@ function TranscriptLine(
|
|
|
2517
2533
|
onEditCancel?: () => void;
|
|
2518
2534
|
onOpenUrl?: (url: string) => void;
|
|
2519
2535
|
onOpenFile?: (path: string, reveal: boolean) => void;
|
|
2536
|
+
integrations?: PublicIntegration[];
|
|
2520
2537
|
}>,
|
|
2521
2538
|
): React.ReactElement {
|
|
2522
2539
|
const { line, bridge, onOpenUrl, onOpenFile } = props;
|
|
@@ -2548,6 +2565,16 @@ function TranscriptLine(
|
|
|
2548
2565
|
);
|
|
2549
2566
|
}
|
|
2550
2567
|
if (line.type === "tool") {
|
|
2568
|
+
if (isPlatformTool(line.name)) {
|
|
2569
|
+
const body = formatPlatformOutput(line.output ?? "");
|
|
2570
|
+
return (
|
|
2571
|
+
<PlatformPane line={line} integrations={props.integrations ?? []}>
|
|
2572
|
+
{body ? (
|
|
2573
|
+
<RichBody text={body} bridge={bridge} onOpenUrl={onOpenUrl} onOpenFile={onOpenFile} />
|
|
2574
|
+
) : null}
|
|
2575
|
+
</PlatformPane>
|
|
2576
|
+
);
|
|
2577
|
+
}
|
|
2551
2578
|
const count = eventCountSuffix(line.count);
|
|
2552
2579
|
return (
|
|
2553
2580
|
<article className={`desk-line desk-line--event is-${line.status}`}>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CaretDownIcon } from "@phosphor-icons/react/dist/csr/CaretDown";
|
|
2
|
+
import { type ReactElement, type ReactNode, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { clipLineHeight, clipNeedsExpand, collapsedClipLimit } from "./clip.ts";
|
|
4
|
+
|
|
5
|
+
export function BubbleClip(
|
|
6
|
+
props: Readonly<{
|
|
7
|
+
text: string;
|
|
8
|
+
locked?: boolean;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}>,
|
|
11
|
+
): ReactElement {
|
|
12
|
+
const [open, setOpen] = useState(false);
|
|
13
|
+
const [overflows, setOverflows] = useState(false);
|
|
14
|
+
const bodyRef = useRef<HTMLDivElement>(null);
|
|
15
|
+
const innerRef = useRef<HTMLDivElement>(null);
|
|
16
|
+
const expanded = props.locked || open;
|
|
17
|
+
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
setOpen(false);
|
|
20
|
+
}, [props.text]);
|
|
21
|
+
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
const clip = bodyRef.current;
|
|
24
|
+
const inner = innerRef.current;
|
|
25
|
+
if (!clip || !inner || props.locked) {
|
|
26
|
+
if (props.locked) setOverflows(false);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setOverflows(
|
|
30
|
+
clipNeedsExpand(inner.scrollHeight, collapsedClipLimit(clip), clipLineHeight(inner)),
|
|
31
|
+
);
|
|
32
|
+
}, [props.locked, props.text, props.children]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
ref={bodyRef}
|
|
37
|
+
className={`desk-line__clip${expanded ? " is-open" : ""}${overflows && !props.locked ? " has-more" : ""}`}
|
|
38
|
+
>
|
|
39
|
+
<div ref={innerRef} className="desk-line__clip-inner">
|
|
40
|
+
{props.children}
|
|
41
|
+
</div>
|
|
42
|
+
{overflows && !props.locked ? (
|
|
43
|
+
<>
|
|
44
|
+
{open ? null : <div className="desk-line__fog" aria-hidden="true" />}
|
|
45
|
+
<button
|
|
46
|
+
type="button"
|
|
47
|
+
className={`desk-line__more${open ? " is-open" : ""}`}
|
|
48
|
+
aria-expanded={open}
|
|
49
|
+
aria-label={open ? "Show less" : "Show more"}
|
|
50
|
+
onClick={() => setOpen((current) => !current)}
|
|
51
|
+
>
|
|
52
|
+
<CaretDownIcon size={14} weight="bold" aria-hidden="true" />
|
|
53
|
+
</button>
|
|
54
|
+
</>
|
|
55
|
+
) : null}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ArrowsInIcon } from "@phosphor-icons/react/dist/csr/ArrowsIn";
|
|
2
|
+
import { ArrowsOutIcon } from "@phosphor-icons/react/dist/csr/ArrowsOut";
|
|
3
|
+
import { type ReactElement, type ReactNode, useEffect, useState } from "react";
|
|
4
|
+
import type { PublicIntegration } from "./api";
|
|
5
|
+
import { BubbleClip } from "./BubbleClip";
|
|
6
|
+
import { matchPlatform, platformTitle } from "./platform";
|
|
7
|
+
import type { ToolLine } from "./thought";
|
|
8
|
+
|
|
9
|
+
export function PlatformPane(
|
|
10
|
+
props: Readonly<{
|
|
11
|
+
line: ToolLine;
|
|
12
|
+
integrations: PublicIntegration[];
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}>,
|
|
15
|
+
): ReactElement {
|
|
16
|
+
const { line, integrations } = props;
|
|
17
|
+
const match = matchPlatform(line.name, integrations);
|
|
18
|
+
const title = platformTitle(line.name, integrations);
|
|
19
|
+
const [logoFailed, setLogoFailed] = useState(false);
|
|
20
|
+
const [full, setFull] = useState(false);
|
|
21
|
+
const clipKey = line.output ?? line.error ?? line.label;
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!full) return;
|
|
25
|
+
const onKey = (event: KeyboardEvent): void => {
|
|
26
|
+
if (event.key === "Escape") setFull(false);
|
|
27
|
+
};
|
|
28
|
+
window.addEventListener("keydown", onKey);
|
|
29
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
30
|
+
}, [full]);
|
|
31
|
+
|
|
32
|
+
const pane = (
|
|
33
|
+
<article className={`desk-platform is-${line.status}${full ? " is-full" : ""}`}>
|
|
34
|
+
<header className="desk-platform__chrome">
|
|
35
|
+
<span className="desk-platform__brand">
|
|
36
|
+
{match?.logoUrl && !logoFailed ? (
|
|
37
|
+
<img
|
|
38
|
+
src={match.logoUrl}
|
|
39
|
+
alt=""
|
|
40
|
+
width={16}
|
|
41
|
+
height={16}
|
|
42
|
+
onError={() => setLogoFailed(true)}
|
|
43
|
+
/>
|
|
44
|
+
) : (
|
|
45
|
+
<span className="desk-platform__glyph">{match?.glyph ?? title.slice(0, 2)}</span>
|
|
46
|
+
)}
|
|
47
|
+
<span>{title}</span>
|
|
48
|
+
</span>
|
|
49
|
+
<span className="desk-platform__actions">
|
|
50
|
+
{line.status === "running" ? (
|
|
51
|
+
<span className="desk-platform__live">
|
|
52
|
+
<span className="desk-event__spin" aria-hidden="true" />
|
|
53
|
+
{line.label}
|
|
54
|
+
</span>
|
|
55
|
+
) : null}
|
|
56
|
+
<button
|
|
57
|
+
type="button"
|
|
58
|
+
className="desk-platform__action"
|
|
59
|
+
aria-label={full ? "Exit full screen" : "Full screen"}
|
|
60
|
+
onClick={() => setFull((current) => !current)}
|
|
61
|
+
>
|
|
62
|
+
{full ? (
|
|
63
|
+
<ArrowsInIcon size={16} weight="regular" aria-hidden="true" />
|
|
64
|
+
) : (
|
|
65
|
+
<ArrowsOutIcon size={16} weight="regular" aria-hidden="true" />
|
|
66
|
+
)}
|
|
67
|
+
</button>
|
|
68
|
+
</span>
|
|
69
|
+
</header>
|
|
70
|
+
<div className="desk-platform__body">
|
|
71
|
+
<BubbleClip text={clipKey} locked={full || line.status === "running"}>
|
|
72
|
+
{platformBody(line, props.children)}
|
|
73
|
+
</BubbleClip>
|
|
74
|
+
</div>
|
|
75
|
+
</article>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
if (!full) return pane;
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
className="desk-platform-scrim"
|
|
84
|
+
aria-label="Exit full screen"
|
|
85
|
+
onClick={() => setFull(false)}
|
|
86
|
+
/>
|
|
87
|
+
{pane}
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function platformBody(line: ToolLine, children: ReactNode): ReactNode {
|
|
93
|
+
if (line.status === "fail" && line.error) {
|
|
94
|
+
return <p className="desk-event__err">{line.error}</p>;
|
|
95
|
+
}
|
|
96
|
+
if (children) return children;
|
|
97
|
+
return <p className="desk-platform__empty">{line.label}</p>;
|
|
98
|
+
}
|
|
@@ -343,10 +343,6 @@ export function SkillsPanel(
|
|
|
343
343
|
|
|
344
344
|
return (
|
|
345
345
|
<div className="desk-integrations">
|
|
346
|
-
<p className="desk-integrations-lead">
|
|
347
|
-
Instruction files the agent reads when a task matches. Bundled skills stay off until you add
|
|
348
|
-
them. Disable a project skill to keep it out of the prompt without deleting the file.
|
|
349
|
-
</p>
|
|
350
346
|
<label className="desk-field">
|
|
351
347
|
<span className="visually-hidden">Search skills</span>
|
|
352
348
|
<input
|
|
@@ -379,9 +375,6 @@ export function SkillsPanel(
|
|
|
379
375
|
{searching ? null : (
|
|
380
376
|
<div className="desk-integration-split">
|
|
381
377
|
<p>Bundled</p>
|
|
382
|
-
<em>
|
|
383
|
-
Shipped with Caelence. Off until you add them; they do not start in the prompt.
|
|
384
|
-
</em>
|
|
385
378
|
</div>
|
|
386
379
|
)}
|
|
387
380
|
<SkillList
|