@synsci/plugin 2.0.77 → 2.0.78-test.34095579610
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/connector.d.ts +90 -0
- package/dist/connector.js +0 -0
- package/dist/index.d.ts +8 -0
- package/dist/tool.d.ts +20 -8
- package/package.json +2 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Broad scientific domain a connector belongs to. Used for grouping + filtering. */
|
|
2
|
+
export type ConnectorDomain = "biology" | "chemistry" | "physics" | "genomics" | "proteomics" | "structure" | "literature" | "materials" | "clinical" | "general";
|
|
3
|
+
/** A single normalized search result from a connector. */
|
|
4
|
+
export interface ConnectorHit {
|
|
5
|
+
/** Stable identifier within the source (accession, DOI, PDB id, ...). */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Human-readable title / name of the record. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Short summary or abstract snippet. */
|
|
10
|
+
summary?: string;
|
|
11
|
+
/** Canonical URL to the record on the source's site. */
|
|
12
|
+
url?: string;
|
|
13
|
+
/** Relevance score if the source provides one (0-1 or source-native). */
|
|
14
|
+
score?: number;
|
|
15
|
+
/** Source-specific structured fields, passed through verbatim. */
|
|
16
|
+
extra?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
/** Options accepted by `search`. Connectors ignore fields they don't support. */
|
|
19
|
+
export interface SearchOptions {
|
|
20
|
+
/** Max hits to return. Connectors clamp to their own ceiling. */
|
|
21
|
+
limit?: number;
|
|
22
|
+
/** Organism / taxon filter where meaningful (e.g. NCBI taxon id). */
|
|
23
|
+
organism?: string;
|
|
24
|
+
/** Free-form per-source knobs. */
|
|
25
|
+
params?: Record<string, unknown>;
|
|
26
|
+
/** Abort signal wired through from the tool context. */
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
/** Options accepted by `fetch`. */
|
|
30
|
+
export interface FetchOptions {
|
|
31
|
+
/** Desired representation, e.g. "json" | "pdb" | "fasta" | "sdf". */
|
|
32
|
+
format?: string;
|
|
33
|
+
params?: Record<string, unknown>;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Per-host politeness limits a connector can request for its HTTP calls.
|
|
38
|
+
*
|
|
39
|
+
* Applied per URL host by the shared http layer, so a multi-DB fan-out is never
|
|
40
|
+
* over-serialized. arXiv, for example, asks for ~1 request every 3s
|
|
41
|
+
* (`minIntervalMs: 3000`); keyless Semantic Scholar wants ~1000ms.
|
|
42
|
+
*/
|
|
43
|
+
export interface RateLimit {
|
|
44
|
+
/** Minimum spacing between the START of requests to the same host, in ms. */
|
|
45
|
+
minIntervalMs?: number;
|
|
46
|
+
/** Max concurrent in-flight requests to the same host. */
|
|
47
|
+
maxConcurrent?: number;
|
|
48
|
+
}
|
|
49
|
+
/** A record retrieved as a file rather than a structured record. */
|
|
50
|
+
export interface FetchedFile {
|
|
51
|
+
/** File contents. Text formats only — no binary support in this increment. */
|
|
52
|
+
body: string;
|
|
53
|
+
/** MIME type as served, e.g. "chemical/x-cif". */
|
|
54
|
+
contentType: string;
|
|
55
|
+
/** Extension-bearing suggested name, e.g. "6LU7.cif". */
|
|
56
|
+
filename: string;
|
|
57
|
+
}
|
|
58
|
+
/** The uniform contract every scientific data source implements. */
|
|
59
|
+
export interface Connector {
|
|
60
|
+
/** Unique, stable, lowercase id used to route (e.g. "uniprot", "rcsb-pdb"). */
|
|
61
|
+
id: string;
|
|
62
|
+
/** Display name (e.g. "UniProt", "RCSB PDB"). */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Primary domain for grouping in the catalog. */
|
|
65
|
+
domain: ConnectorDomain;
|
|
66
|
+
/** One-line description shown in `science_list_dbs`. */
|
|
67
|
+
description: string;
|
|
68
|
+
/** Homepage / docs URL. */
|
|
69
|
+
homepage?: string;
|
|
70
|
+
/** Search the source; returns normalized hits. */
|
|
71
|
+
search(query: string, opts?: SearchOptions): Promise<ConnectorHit[]>;
|
|
72
|
+
/** Fetch a single record by id. Return shape is source-specific. */
|
|
73
|
+
fetch(id: string, opts?: FetchOptions): Promise<unknown>;
|
|
74
|
+
/**
|
|
75
|
+
* FILE formats this connector can serve, e.g. ["pdb", "cif"]. Absent = records only.
|
|
76
|
+
* Never includes "json" — omitting `format` is the record path via `fetch()`.
|
|
77
|
+
*/
|
|
78
|
+
formats?: string[];
|
|
79
|
+
/** Retrieve a record as a file in one of `formats`. Present iff `formats` is. */
|
|
80
|
+
fetchFile?(id: string, format: string, opts?: FetchOptions): Promise<FetchedFile>;
|
|
81
|
+
}
|
|
82
|
+
/** Public catalog entry shape returned by the registry (no functions). */
|
|
83
|
+
export interface CatalogEntry {
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
domain: ConnectorDomain;
|
|
87
|
+
description: string;
|
|
88
|
+
homepage?: string;
|
|
89
|
+
formats?: string[];
|
|
90
|
+
}
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { Event, createOpenScienceClient, Project, Permission, UserMessage,
|
|
|
2
2
|
import type { Model, Provider } from "@synsci/sdk/v2";
|
|
3
3
|
import type { BunShell } from "./shell.js";
|
|
4
4
|
import { type ToolDefinition } from "./tool.js";
|
|
5
|
+
import type { Connector } from "./connector.js";
|
|
5
6
|
export * from "./tool.js";
|
|
7
|
+
export type * from "./connector.js";
|
|
6
8
|
export type ProviderContext = {
|
|
7
9
|
source: "env" | "config" | "custom" | "api";
|
|
8
10
|
info: Provider;
|
|
@@ -15,6 +17,8 @@ export type PluginInput = {
|
|
|
15
17
|
worktree: string;
|
|
16
18
|
serverUrl: URL;
|
|
17
19
|
$: BunShell;
|
|
20
|
+
/** Aborted when this instance unloads the plugin. Older hosts may omit it. */
|
|
21
|
+
signal?: AbortSignal;
|
|
18
22
|
};
|
|
19
23
|
export type Plugin = (input: PluginInput) => Promise<Hooks>;
|
|
20
24
|
export type AuthHook = {
|
|
@@ -107,6 +111,8 @@ export type AuthOuathResult = {
|
|
|
107
111
|
}>;
|
|
108
112
|
});
|
|
109
113
|
export interface Hooks {
|
|
114
|
+
/** Release resources on instance shutdown or plugin invalidation. */
|
|
115
|
+
dispose?: () => Promise<void>;
|
|
110
116
|
event?: (input: {
|
|
111
117
|
event: Event;
|
|
112
118
|
}) => Promise<void>;
|
|
@@ -114,6 +120,8 @@ export interface Hooks {
|
|
|
114
120
|
tool?: {
|
|
115
121
|
[key: string]: ToolDefinition;
|
|
116
122
|
};
|
|
123
|
+
/** Scientific sources available through science_list_dbs/search/fetch in this instance. */
|
|
124
|
+
connector?: Connector[];
|
|
117
125
|
auth?: AuthHook;
|
|
118
126
|
/**
|
|
119
127
|
* Called when a new message is received
|
package/dist/tool.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
export type ToolContext = {
|
|
3
3
|
sessionID: string;
|
|
4
4
|
messageID: string;
|
|
5
|
+
/** Identifies this invocation when the host executes a model tool call. */
|
|
6
|
+
callID?: string;
|
|
5
7
|
agent: string;
|
|
6
8
|
/**
|
|
7
9
|
* Current project directory for this session.
|
|
@@ -16,9 +18,7 @@ export type ToolContext = {
|
|
|
16
18
|
abort: AbortSignal;
|
|
17
19
|
metadata(input: {
|
|
18
20
|
title?: string;
|
|
19
|
-
metadata?:
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
};
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
22
|
}): void;
|
|
23
23
|
ask(input: AskInput): Promise<void>;
|
|
24
24
|
};
|
|
@@ -26,18 +26,30 @@ type AskInput = {
|
|
|
26
26
|
permission: string;
|
|
27
27
|
patterns: string[];
|
|
28
28
|
always: string[];
|
|
29
|
-
metadata:
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
metadata: Record<string, unknown>;
|
|
30
|
+
};
|
|
31
|
+
/** A file reference. The host supplies its message, session, and part IDs. */
|
|
32
|
+
export type ToolAttachment = {
|
|
33
|
+
type: "file";
|
|
34
|
+
mime: string;
|
|
35
|
+
url: string;
|
|
36
|
+
filename?: string;
|
|
37
|
+
};
|
|
38
|
+
/** Metadata must be JSON-serializable. File references do not save an artifact. */
|
|
39
|
+
export type ToolResult = string | {
|
|
40
|
+
output: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
attachments?: ToolAttachment[];
|
|
32
44
|
};
|
|
33
45
|
export declare function tool<Args extends z.ZodRawShape>(input: {
|
|
34
46
|
description: string;
|
|
35
47
|
args: Args;
|
|
36
|
-
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<
|
|
48
|
+
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<ToolResult>;
|
|
37
49
|
}): {
|
|
38
50
|
description: string;
|
|
39
51
|
args: Args;
|
|
40
|
-
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<
|
|
52
|
+
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<ToolResult>;
|
|
41
53
|
};
|
|
42
54
|
export declare namespace tool {
|
|
43
55
|
var schema: typeof z;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@synsci/plugin",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.78-test.34095579610",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@synsci/sdk": "2.0.
|
|
25
|
+
"@synsci/sdk": "2.0.78-test.34095579610",
|
|
26
26
|
"zod": "4.1.8"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|