@poco-ai/agentero-dsh-library 0.0.0-stage → 0.1.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/lib/client/button.d.ts +10 -0
- package/lib/client/index.d.ts +58 -0
- package/lib/client/input.d.ts +2 -0
- package/lib/client/library-actions.d.ts +13 -0
- package/lib/client/library-columns.d.ts +25 -0
- package/lib/client/library-controls.d.ts +5 -0
- package/lib/client/library-feedback.d.ts +13 -0
- package/lib/client/library-paper-row.d.ts +17 -0
- package/lib/client/library-table-header.d.ts +14 -0
- package/lib/client/paper-tag-chip.d.ts +21 -0
- package/lib/client/papers-library.d.ts +6 -0
- package/lib/client/papers.d.ts +51 -0
- package/lib/client/tag-colors.d.ts +8 -0
- package/lib/client/tag-composer.d.ts +24 -0
- package/lib/client/utils.d.ts +7 -0
- package/lib/client.js +11780 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/package.json +37 -3
- package/README.md +0 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
|
|
5
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
declare const zh: {
|
|
3
|
+
title: string;
|
|
4
|
+
guideDescription: string;
|
|
5
|
+
filter: string;
|
|
6
|
+
colTitle: string;
|
|
7
|
+
colAuthors: string;
|
|
8
|
+
colYear: string;
|
|
9
|
+
colTags: string;
|
|
10
|
+
loading: string;
|
|
11
|
+
empty: string;
|
|
12
|
+
noMatches: string;
|
|
13
|
+
pdfDisabled: string;
|
|
14
|
+
vaultMissing: string;
|
|
15
|
+
invalid: string;
|
|
16
|
+
loadFailed: string;
|
|
17
|
+
importPlaceholder: string;
|
|
18
|
+
importAction: string;
|
|
19
|
+
discoverPlaceholder: string;
|
|
20
|
+
discoverAction: string;
|
|
21
|
+
exportBib: string;
|
|
22
|
+
importBib: string;
|
|
23
|
+
deletePaper: string;
|
|
24
|
+
download: string;
|
|
25
|
+
addTag: string;
|
|
26
|
+
removeTag: string;
|
|
27
|
+
confirmDelete: string;
|
|
28
|
+
actionFailed: string;
|
|
29
|
+
moreActions: string;
|
|
30
|
+
refresh: string;
|
|
31
|
+
openPaper: string;
|
|
32
|
+
editTags: string;
|
|
33
|
+
paperCount: string;
|
|
34
|
+
filteredCount: string;
|
|
35
|
+
clearResults: string;
|
|
36
|
+
invalidVault: string;
|
|
37
|
+
pickerUnavailable: string;
|
|
38
|
+
};
|
|
39
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
40
|
+
interface LocaleNamespaceMap {
|
|
41
|
+
/** Library panel copy. */
|
|
42
|
+
'agentero.library': keyof typeof zh;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Browser plugin name. */
|
|
46
|
+
export declare const name = "agentero-library";
|
|
47
|
+
/**
|
|
48
|
+
* Slot and locale services. `agentero` stays optional: a row asks
|
|
49
|
+
* `ctx.get('agentero')` and reports a missing opener inside the panel.
|
|
50
|
+
*/
|
|
51
|
+
export declare const inject: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Register the library as one page in the session's right sidebar.
|
|
54
|
+
* The guide card opens it. The body does not replace the conversation.
|
|
55
|
+
* @param ctx - Browser plugin context.
|
|
56
|
+
*/
|
|
57
|
+
export declare function apply(ctx: Context): void;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LibraryT } from './papers';
|
|
2
|
+
type LibraryActionsProps = {
|
|
3
|
+
t: LibraryT;
|
|
4
|
+
busy: boolean;
|
|
5
|
+
onImport: (text: string) => Promise<boolean>;
|
|
6
|
+
onDiscover: (keyword: string) => Promise<boolean>;
|
|
7
|
+
onImportBib: (file: File) => Promise<boolean>;
|
|
8
|
+
onExport: () => void;
|
|
9
|
+
onReload: () => void;
|
|
10
|
+
};
|
|
11
|
+
/** Import drafts stay outside the catalog, so typing never re-renders paper rows. */
|
|
12
|
+
export declare function LibraryActions({ t, busy, onImport, onDiscover, onImportBib, onExport, onReload }: LibraryActionsProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { LibraryT, PaperRow } from './papers';
|
|
3
|
+
export type SortDir = 'asc' | 'desc';
|
|
4
|
+
export declare const COLUMN_ORDER: readonly ["title", "authors", "year", "tags"];
|
|
5
|
+
export type ColumnKey = (typeof COLUMN_ORDER)[number];
|
|
6
|
+
export interface CellCtx {
|
|
7
|
+
t: LibraryT;
|
|
8
|
+
busy: boolean;
|
|
9
|
+
/** Resolves true when the tag was written, so the composer keeps its draft on failure. */
|
|
10
|
+
onAddTag: (ref: string, tag: string) => Promise<boolean>;
|
|
11
|
+
onRemoveTag: (ref: string, name: string) => void;
|
|
12
|
+
}
|
|
13
|
+
interface ColumnDef {
|
|
14
|
+
labelKey: 'colTitle' | 'colAuthors' | 'colYear' | 'colTags';
|
|
15
|
+
headerClassName: string;
|
|
16
|
+
render: (paper: PaperRow, ctx: CellCtx) => ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare function SortIcon({ active, dir }: {
|
|
19
|
+
active: boolean;
|
|
20
|
+
dir: SortDir;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
export declare const COLUMN_META: Record<ColumnKey, ColumnDef>;
|
|
23
|
+
export declare function sortValue(paper: PaperRow, key: ColumnKey): string;
|
|
24
|
+
export declare function controlButtonClass(extra?: string): string;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DropdownMenu, Popover } from 'radix-ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export declare function LibraryPopoverContent({ className, style, ...props }: ComponentProps<typeof Popover.Content>): import("react").JSX.Element;
|
|
4
|
+
export declare function LibraryMenuContent({ className, style, ...props }: ComponentProps<typeof DropdownMenu.Content>): import("react").JSX.Element;
|
|
5
|
+
export declare function LibraryMenuItem({ className, ...props }: ComponentProps<typeof DropdownMenu.Item>): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
2
|
+
import type { InjectFace } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
export type LibraryNotice = {
|
|
4
|
+
text: string;
|
|
5
|
+
sequence: number;
|
|
6
|
+
} | null;
|
|
7
|
+
export interface LibraryFeedbackFace {
|
|
8
|
+
hooks: {
|
|
9
|
+
notice: ObservableSnapshot<LibraryNotice>;
|
|
10
|
+
};
|
|
11
|
+
dismiss(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function LibraryFeedback({ useNotice, dismiss }: InjectFace<LibraryFeedbackFace>): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CellCtx } from './library-columns';
|
|
2
|
+
import type { PaperRow } from './papers';
|
|
3
|
+
type LibraryPaperRowProps = {
|
|
4
|
+
paper: PaperRow;
|
|
5
|
+
ctx: CellCtx;
|
|
6
|
+
busy: boolean;
|
|
7
|
+
/** Handlers take the row's ref so the panel can keep one stable identity per action. */
|
|
8
|
+
onOpen: (ref: string) => void;
|
|
9
|
+
onDownload: (ref: string) => void;
|
|
10
|
+
onDelete: (ref: string) => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* One catalog row. Memoized: the panel re-renders on every filter keystroke, and
|
|
14
|
+
* without this each one rebuilt all rows and their tag inputs.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LibraryPaperRow: import("react").MemoExoticComponent<({ paper, ctx, busy, onOpen, onDownload, onDelete, }: LibraryPaperRowProps) => import("react").JSX.Element>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ColumnKey, type SortDir } from './library-columns';
|
|
3
|
+
import type { LibraryT } from './papers';
|
|
4
|
+
type LibraryTableHeaderProps = {
|
|
5
|
+
t: LibraryT;
|
|
6
|
+
sortKey: ColumnKey;
|
|
7
|
+
sortDir: SortDir;
|
|
8
|
+
onSort: (key: ColumnKey) => void;
|
|
9
|
+
inputValue: string;
|
|
10
|
+
onInputChange: (value: string) => void;
|
|
11
|
+
actions: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare function LibraryTableHeader({ t, sortKey, sortDir, onSort, inputValue, onInputChange, actions, }: LibraryTableHeaderProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
2
|
+
import type { PaperTag } from './papers';
|
|
3
|
+
type PaperTagChipProps = {
|
|
4
|
+
tag: PaperTag;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** When set, chip is a button (e.g. copy-on-click in Library). */
|
|
7
|
+
onClick?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
8
|
+
title?: string;
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
/** Optional trailing control (e.g. remove). */
|
|
11
|
+
trailing?: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare function PaperTagChip({ tag, className, onClick, title, 'aria-label': ariaLabel, trailing, }: PaperTagChipProps): import("react").JSX.Element;
|
|
14
|
+
type PaperTagRemoveButtonProps = {
|
|
15
|
+
tagName: string;
|
|
16
|
+
label: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
onRemove: (name: string) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare function PaperTagRemoveButton({ tagName, label, disabled, onRemove, }: PaperTagRemoveButtonProps): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { type LibraryFace } from './papers';
|
|
4
|
+
type LibraryPanelProps = PropsRuntime<'sidebar.right.pane.tab'> & PropsLocale<'agentero.library'> & LibraryFace;
|
|
5
|
+
export declare function LibraryPanel({ t, loadPapers, openPaper, importId, importBib, exportBib, discover, addTag, removeTag, deletePaper, download, notifyError, loadVault, }: LibraryPanelProps): ReactNode;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
export type LibraryT = PropsLocale<'agentero.library'>['t'];
|
|
3
|
+
export interface VaultInfo {
|
|
4
|
+
path: string;
|
|
5
|
+
name: string;
|
|
6
|
+
scope: string;
|
|
7
|
+
recentVaults: {
|
|
8
|
+
path: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
11
|
+
canPick: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface LibraryFace {
|
|
14
|
+
notifyError(message: string): void;
|
|
15
|
+
loadVault(): Promise<VaultInfo>;
|
|
16
|
+
loadPapers(): Promise<unknown>;
|
|
17
|
+
openPaper(id: string): boolean;
|
|
18
|
+
importId(text: string): Promise<void>;
|
|
19
|
+
importBib(text: string): Promise<void>;
|
|
20
|
+
exportBib(): Promise<string>;
|
|
21
|
+
discover(keyword: string): Promise<{
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
}[]>;
|
|
25
|
+
addTag(ref: string, tag: string): Promise<void>;
|
|
26
|
+
removeTag(ref: string, tag: string): Promise<void>;
|
|
27
|
+
deletePaper(ref: string): Promise<void>;
|
|
28
|
+
download(ref: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export interface PaperTag {
|
|
31
|
+
name: string;
|
|
32
|
+
color?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface PaperRow {
|
|
35
|
+
key: string;
|
|
36
|
+
openId: string;
|
|
37
|
+
title: string;
|
|
38
|
+
authors: string;
|
|
39
|
+
year: string;
|
|
40
|
+
tags: PaperTag[];
|
|
41
|
+
}
|
|
42
|
+
export declare function errorText(body: unknown): string | undefined;
|
|
43
|
+
export declare function papersFrom(body: unknown): PaperRow[];
|
|
44
|
+
export declare function shown(message: string, t: LibraryT): string;
|
|
45
|
+
export declare function readJson(response: Response): Promise<unknown>;
|
|
46
|
+
export declare function postJson(url: string, body: unknown, request?: (url: string, init?: RequestInit) => Promise<Response>): Promise<unknown>;
|
|
47
|
+
export declare function discoverItems(body: unknown): {
|
|
48
|
+
id: string;
|
|
49
|
+
title: string;
|
|
50
|
+
}[];
|
|
51
|
+
export declare function bibText(body: unknown): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Chip inline style when a color is set; undefined = default muted classes. */
|
|
2
|
+
export declare function tagChipStyle(id: string | null | undefined): {
|
|
3
|
+
backgroundColor: string;
|
|
4
|
+
color: string;
|
|
5
|
+
} | undefined;
|
|
6
|
+
export declare function tagSwatchStyle(id: string | null | undefined): {
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
} | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import type { LibraryT, PaperRow } from './papers';
|
|
3
|
+
type TagComposerProps = {
|
|
4
|
+
/** Placeholder and accessible name, e.g. "标签". */
|
|
5
|
+
label: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
/** Resolves true when the tag was saved, so the draft can be cleared. */
|
|
8
|
+
onAdd: (tag: string) => Promise<boolean>;
|
|
9
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Per-row tag input. The draft lives here rather than in the panel so typing
|
|
13
|
+
* re-renders one cell instead of every row in the table.
|
|
14
|
+
*/
|
|
15
|
+
export declare function TagComposer({ label, disabled, onAdd, inputRef }: TagComposerProps): ReactNode;
|
|
16
|
+
/** Read first, edit on demand: long tag names never increase the catalog row height. */
|
|
17
|
+
export declare function PaperTags({ paper, t, busy, onAdd, onRemove }: {
|
|
18
|
+
paper: PaperRow;
|
|
19
|
+
t: LibraryT;
|
|
20
|
+
busy: boolean;
|
|
21
|
+
onAdd: (ref: string, tag: string) => Promise<boolean>;
|
|
22
|
+
onRemove: (ref: string, name: string) => void;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
/**
|
|
4
|
+
* Form controls do not inherit type from their parent unless preflight says so.
|
|
5
|
+
* This package's Tailwind entry does not import preflight.
|
|
6
|
+
*/
|
|
7
|
+
export declare const controlReset = "m-0 appearance-none border-0 bg-transparent p-0 font-[inherit] text-[length:inherit] leading-[inherit] [font-weight:inherit]";
|