@inflexa-ai/harness 0.30.3 → 0.31.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/dist/contracts/target-dossier.d.ts +61 -61
- package/dist/execution/run-synthesis.js +7 -2
- package/dist/lib/zod-issues.d.ts +8 -0
- package/dist/lib/zod-issues.js +13 -0
- package/dist/literature/sources/semantic-scholar.d.ts +34 -0
- package/dist/literature/sources/semantic-scholar.js +15 -4
- package/dist/tools/bio/chembl.js +4 -3
- package/dist/tools/bio/drug-gene-interactions.d.ts +2 -14
- package/dist/tools/bio/drug-gene-interactions.js +10 -18
- package/dist/tools/bio/gene-disease-evidence.d.ts +3 -1
- package/dist/tools/bio/gene-disease-evidence.js +12 -9
- package/dist/tools/bio/keys.js +1 -0
- package/dist/tools/bio/lookup-annotation.d.ts +43 -0
- package/dist/tools/bio/lookup-annotation.js +19 -4
- package/dist/tools/bio/pubchem.js +5 -3
- package/dist/tools/bio/search-clinical-trials.js +5 -4
- package/dist/tools/bio/search-geo-datasets.d.ts +39 -9
- package/dist/tools/bio/search-geo-datasets.js +38 -20
- package/dist/tools/lib/api-utils.d.ts +27 -2
- package/dist/tools/lib/api-utils.js +43 -3
- package/dist/tools/lib/bgee-client.d.ts +16 -0
- package/dist/tools/lib/bgee-client.js +16 -5
- package/dist/tools/lib/cbioportal-client.d.ts +20 -0
- package/dist/tools/lib/cbioportal-client.js +16 -8
- package/dist/tools/lib/chembl-client.d.ts +105 -3
- package/dist/tools/lib/chembl-client.js +196 -84
- package/dist/tools/lib/clinical-benchmarks-client.d.ts +5 -0
- package/dist/tools/lib/clinical-benchmarks-client.js +5 -0
- package/dist/tools/lib/clinical-trials-client.d.ts +131 -2
- package/dist/tools/lib/clinical-trials-client.js +32 -6
- package/dist/tools/lib/clinvar-client.d.ts +35 -0
- package/dist/tools/lib/clinvar-client.js +34 -28
- package/dist/tools/lib/ctx-ops.d.ts +106 -35
- package/dist/tools/lib/ctx-ops.js +135 -69
- package/dist/tools/lib/dgidb-client.d.ts +73 -0
- package/dist/tools/lib/dgidb-client.js +25 -13
- package/dist/tools/lib/disgenet-client.d.ts +117 -24
- package/dist/tools/lib/disgenet-client.js +127 -34
- package/dist/tools/lib/disgenet-config.d.ts +1 -1
- package/dist/tools/lib/disgenet-config.js +5 -3
- package/dist/tools/lib/drugbank-client.d.ts +57 -58
- package/dist/tools/lib/drugbank-client.js +69 -64
- package/dist/tools/lib/drugbank-config.d.ts +6 -1
- package/dist/tools/lib/drugbank-config.js +6 -1
- package/dist/tools/lib/ema-client.d.ts +53 -0
- package/dist/tools/lib/ema-client.js +19 -7
- package/dist/tools/lib/ensembl-client.d.ts +4 -0
- package/dist/tools/lib/ensembl-client.js +4 -0
- package/dist/tools/lib/gwas-catalog-client.d.ts +64 -1
- package/dist/tools/lib/gwas-catalog-client.js +21 -6
- package/dist/tools/lib/identifier-resolver.d.ts +17 -1
- package/dist/tools/lib/identifier-resolver.js +13 -4
- package/dist/tools/lib/impc-client.d.ts +4 -0
- package/dist/tools/lib/impc-client.js +4 -0
- package/dist/tools/lib/iuphar-client.d.ts +10 -5
- package/dist/tools/lib/iuphar-client.js +49 -13
- package/dist/tools/lib/monarch-client.d.ts +4 -0
- package/dist/tools/lib/monarch-client.js +4 -0
- package/dist/tools/lib/openfda-client.d.ts +34 -0
- package/dist/tools/lib/openfda-client.js +22 -8
- package/dist/tools/lib/opentargets-client.d.ts +99 -4
- package/dist/tools/lib/opentargets-client.js +97 -37
- package/dist/tools/lib/pathway-client.d.ts +45 -0
- package/dist/tools/lib/pathway-client.js +88 -8
- package/dist/tools/lib/pharmgkb-client.d.ts +35 -1
- package/dist/tools/lib/pharmgkb-client.js +22 -6
- package/dist/tools/lib/pharmgkb-config.d.ts +8 -1
- package/dist/tools/lib/pharmgkb-config.js +8 -1
- package/dist/tools/lib/pubchem-client.d.ts +22 -0
- package/dist/tools/lib/pubchem-client.js +36 -33
- package/dist/tools/lib/pubchem-ops.d.ts +85 -5
- package/dist/tools/lib/pubchem-ops.js +96 -68
- package/dist/tools/lib/pubmed-client.d.ts +4 -0
- package/dist/tools/lib/pubmed-client.js +4 -0
- package/dist/tools/lib/string-client.d.ts +52 -0
- package/dist/tools/lib/string-client.js +12 -7
- package/dist/tools/lib/uniprot-client.d.ts +4 -0
- package/dist/tools/lib/uniprot-client.js +4 -0
- package/dist/tools/research/context7-docs.d.ts +23 -0
- package/dist/tools/research/context7-docs.js +49 -9
- package/dist/tools/research/search-github-repos.d.ts +4 -0
- package/dist/tools/research/search-github-repos.js +4 -0
- package/dist/workflows/execute-target-assessment.js +4 -4
- package/dist/workflows/target-assessment/assemblers/orchestrator.d.ts +2 -1
- package/dist/workflows/target-assessment/assemblers/orchestrator.js +3 -3
- package/dist/workflows/target-assessment/collectors/index.d.ts +8 -2
- package/dist/workflows/target-assessment/collectors/index.js +37 -10
- package/dist/workflows/target-assessment/fanout/index.d.ts +2 -1
- package/dist/workflows/target-assessment/fanout/index.js +2 -2
- package/dist/workflows/target-assessment/lib/safety-corroboration.js +2 -2
- package/dist/workflows/target-assessment/lib/target-identity-filter.d.ts +3 -2
- package/dist/workflows/target-assessment/lib/target-identity-filter.js +16 -5
- package/dist/workflows/target-assessment/phase4-assemble.d.ts +61 -60
- package/dist/workflows/target-assessment/phase4-assemble.js +2 -2
- package/dist/workflows/target-assessment/schemas.d.ts +2 -8
- package/dist/workflows/target-assessment/schemas.js +8 -2
- package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +1 -4
- package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +1 -4
- package/package.json +1 -1
- package/dist/agents/sandbox/__fixtures__/deps.d.ts +0 -23
- package/dist/agents/sandbox/__fixtures__/deps.js +0 -102
- package/dist/citations/__fixtures__/resolver.d.ts +0 -3
- package/dist/citations/__fixtures__/resolver.js +0 -9
- package/dist/loop/__fixtures__/scripted-provider.d.ts +0 -31
- package/dist/loop/__fixtures__/scripted-provider.js +0 -81
- package/dist/providers/__fixtures__/session.d.ts +0 -17
- package/dist/providers/__fixtures__/session.js +0 -20
- package/dist/tools/__fixtures__/tool-context.d.ts +0 -13
- package/dist/tools/__fixtures__/tool-context.js +0 -22
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test-only `SandboxAgentDeps` builder. Hands every dependency a stub so
|
|
3
|
-
* `createSandboxAgent` builds without touching Postgres, the network, or
|
|
4
|
-
* a real sandbox.
|
|
5
|
-
*/
|
|
6
|
-
import { okAsync } from "neverthrow";
|
|
7
|
-
export function makeFakeSandboxClient() {
|
|
8
|
-
const ref = {
|
|
9
|
-
sandboxId: "sb-test",
|
|
10
|
-
host: "127.0.0.1",
|
|
11
|
-
port: 8765,
|
|
12
|
-
backend: "docker",
|
|
13
|
-
callbackSecret: "secret",
|
|
14
|
-
};
|
|
15
|
-
return {
|
|
16
|
-
async createSandbox(_meta) {
|
|
17
|
-
return ref;
|
|
18
|
-
},
|
|
19
|
-
async submitExec(_ref, _body) { },
|
|
20
|
-
async awaitExec(_ref, execId, _emit, _deadline) {
|
|
21
|
-
return {
|
|
22
|
-
execId,
|
|
23
|
-
exitCode: 0,
|
|
24
|
-
stdout: "",
|
|
25
|
-
stderr: "",
|
|
26
|
-
durationMs: 1,
|
|
27
|
-
timedOut: false,
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
async isAlive() {
|
|
31
|
-
return { alive: true, oomKilled: false };
|
|
32
|
-
},
|
|
33
|
-
async isAliveById() {
|
|
34
|
-
return { alive: true, oomKilled: false };
|
|
35
|
-
},
|
|
36
|
-
async teardown() { },
|
|
37
|
-
async teardownById() { },
|
|
38
|
-
async listManagedSandboxes() {
|
|
39
|
-
return [];
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export function makeFakeWorkspaceFs() {
|
|
44
|
-
return {
|
|
45
|
-
readFile() {
|
|
46
|
-
return okAsync({ kind: "ok", content: Buffer.alloc(0), truncated: false });
|
|
47
|
-
},
|
|
48
|
-
readBytes() {
|
|
49
|
-
return okAsync({ kind: "ok", bytes: Buffer.alloc(0) });
|
|
50
|
-
},
|
|
51
|
-
list() {
|
|
52
|
-
return okAsync({ kind: "ok", entries: [] });
|
|
53
|
-
},
|
|
54
|
-
stat() {
|
|
55
|
-
return okAsync({ kind: "not_found" });
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export function makeFakeChatProvider() {
|
|
60
|
-
return {
|
|
61
|
-
capabilities: { toolCalling: true },
|
|
62
|
-
chat() {
|
|
63
|
-
throw new Error("fake chat provider — not exercised in these tests");
|
|
64
|
-
},
|
|
65
|
-
chatStream() {
|
|
66
|
-
throw new Error("fake chat provider — not exercised in these tests");
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export function makeFakePool() {
|
|
71
|
-
return {};
|
|
72
|
-
}
|
|
73
|
-
export function makeFakeSandboxAgentDeps(over = {}) {
|
|
74
|
-
return {
|
|
75
|
-
provider: makeFakeChatProvider(),
|
|
76
|
-
pool: makeFakePool(),
|
|
77
|
-
sandboxClient: makeFakeSandboxClient(),
|
|
78
|
-
workspaceFs: makeFakeWorkspaceFs(),
|
|
79
|
-
model: over.model ?? "claude-opus-4-7",
|
|
80
|
-
bioKeys: { drugbank: "", disgenet: "", epaCcte: "" },
|
|
81
|
-
step: {
|
|
82
|
-
sandbox: {
|
|
83
|
-
sandboxId: "sb-test",
|
|
84
|
-
host: "127.0.0.1",
|
|
85
|
-
port: 8765,
|
|
86
|
-
backend: "docker",
|
|
87
|
-
callbackSecret: "secret",
|
|
88
|
-
},
|
|
89
|
-
workspaceRoot: "/tmp/sessions/analysis-001",
|
|
90
|
-
analysisId: over.analysisId ?? "analysis-001",
|
|
91
|
-
runId: over.runId ?? "run-001",
|
|
92
|
-
stepId: over.stepId ?? "step-001",
|
|
93
|
-
workflowId: over.workflowId ?? "wf-001",
|
|
94
|
-
allowedWritePrefix: over.allowedWritePrefix ?? "/tmp/sessions/analysis-001/runs/run-001/step-001",
|
|
95
|
-
nextFunctionId: (() => {
|
|
96
|
-
let n = 0;
|
|
97
|
-
return () => `fn-${++n}`;
|
|
98
|
-
})(),
|
|
99
|
-
deadlineMs: () => Date.now() + 60_000,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Test-only resolver for construction paths that do not execute citation tools. */
|
|
2
|
-
export const unusedCitationResolver = {
|
|
3
|
-
async resolveOne() {
|
|
4
|
-
throw new Error("unusedCitationResolver.resolveOne was unexpectedly called");
|
|
5
|
-
},
|
|
6
|
-
async resolveMany() {
|
|
7
|
-
throw new Error("unusedCitationResolver.resolveMany was unexpectedly called");
|
|
8
|
-
},
|
|
9
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ChatResponse, ChatProvider, ChatRequest, ChatUsage } from "../../providers/types.js";
|
|
2
|
-
import type { AgentSession as Session } from "../../auth/types.js";
|
|
3
|
-
export type TextBlock = {
|
|
4
|
-
type: "text";
|
|
5
|
-
text: string;
|
|
6
|
-
};
|
|
7
|
-
export type ThinkingBlock = {
|
|
8
|
-
type: "reasoning";
|
|
9
|
-
text: string;
|
|
10
|
-
providerOptions?: {
|
|
11
|
-
anthropic: {
|
|
12
|
-
signature: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export type ToolUseBlock = {
|
|
17
|
-
type: "tool-call";
|
|
18
|
-
toolCallId: string;
|
|
19
|
-
toolName: string;
|
|
20
|
-
input: unknown;
|
|
21
|
-
};
|
|
22
|
-
export type ContentBlock = TextBlock | ThinkingBlock | ToolUseBlock;
|
|
23
|
-
export declare function makeMessage(content: ContentBlock[], finishReason: ChatResponse["finishReason"] | "tool_use" | "end_turn" | "max_tokens" | "refusal", usage?: ChatUsage): ChatResponse;
|
|
24
|
-
export declare function textBlock(text: string): TextBlock;
|
|
25
|
-
export declare function thinkingBlock(thinking: string, signature: string): ThinkingBlock;
|
|
26
|
-
export declare function toolUseBlock(id: string, name: string, input: unknown): ToolUseBlock;
|
|
27
|
-
export interface ScriptedProvider extends ChatProvider {
|
|
28
|
-
readonly calls: ChatRequest[];
|
|
29
|
-
readonly sessions: Session[];
|
|
30
|
-
}
|
|
31
|
-
export declare function scriptedProvider(script: ChatResponse[] | ((callIndex: number, request: ChatRequest) => ChatResponse)): ScriptedProvider;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { okAsync } from "neverthrow";
|
|
2
|
-
function mapFinishReason(finishReason) {
|
|
3
|
-
switch (finishReason) {
|
|
4
|
-
case "tool_use":
|
|
5
|
-
return "tool-calls";
|
|
6
|
-
case "end_turn":
|
|
7
|
-
return "stop";
|
|
8
|
-
case "max_tokens":
|
|
9
|
-
return "length";
|
|
10
|
-
case "refusal":
|
|
11
|
-
return "content-filter";
|
|
12
|
-
default:
|
|
13
|
-
return finishReason;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export function makeMessage(content, finishReason, usage) {
|
|
17
|
-
const mapped = mapFinishReason(finishReason);
|
|
18
|
-
return {
|
|
19
|
-
message: { role: "assistant", content },
|
|
20
|
-
finishReason: mapped,
|
|
21
|
-
...(mapped === finishReason ? {} : { rawFinishReason: finishReason }),
|
|
22
|
-
usage,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export function textBlock(text) {
|
|
26
|
-
return { type: "text", text };
|
|
27
|
-
}
|
|
28
|
-
export function thinkingBlock(thinking, signature) {
|
|
29
|
-
return { type: "reasoning", text: thinking, providerOptions: { anthropic: { signature } } };
|
|
30
|
-
}
|
|
31
|
-
export function toolUseBlock(id, name, input) {
|
|
32
|
-
return { type: "tool-call", toolCallId: id, toolName: name, input };
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The text a real provider would have streamed for this reply — one delta per
|
|
36
|
-
* text block. Reasoning and tool-call blocks carry no text on the wire, so they
|
|
37
|
-
* arrive only in the terminal `done` response.
|
|
38
|
-
*/
|
|
39
|
-
function textDeltas(response) {
|
|
40
|
-
const content = response.message.content;
|
|
41
|
-
if (typeof content === "string")
|
|
42
|
-
return content === "" ? [] : [content];
|
|
43
|
-
return content.filter((part) => part.type === "text").map((part) => part.text);
|
|
44
|
-
}
|
|
45
|
-
export function scriptedProvider(script) {
|
|
46
|
-
const calls = [];
|
|
47
|
-
const sessions = [];
|
|
48
|
-
const reply = typeof script === "function"
|
|
49
|
-
? script
|
|
50
|
-
: (i) => {
|
|
51
|
-
const r = script[i];
|
|
52
|
-
if (r === undefined) {
|
|
53
|
-
throw new Error(`scriptedProvider: no scripted reply for call ${i}`);
|
|
54
|
-
}
|
|
55
|
-
return r;
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
capabilities: { toolCalling: true },
|
|
59
|
-
calls,
|
|
60
|
-
sessions,
|
|
61
|
-
chat(request, session) {
|
|
62
|
-
const i = calls.length;
|
|
63
|
-
calls.push(request);
|
|
64
|
-
sessions.push(session);
|
|
65
|
-
return okAsync(reply(i, request));
|
|
66
|
-
},
|
|
67
|
-
chatStream(request, session) {
|
|
68
|
-
// The call is recorded and the reply resolved eagerly, as in `chat`, so
|
|
69
|
-
// an unscripted call fails at the same point either primitive is driven.
|
|
70
|
-
const i = calls.length;
|
|
71
|
-
calls.push(request);
|
|
72
|
-
sessions.push(session);
|
|
73
|
-
const response = reply(i, request);
|
|
74
|
-
return (async function* () {
|
|
75
|
-
for (const text of textDeltas(response))
|
|
76
|
-
yield { type: "text-delta", text };
|
|
77
|
-
yield { type: "done", response };
|
|
78
|
-
})();
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test-only harness `RequestSession` builder. Not a `*.test.ts` file, so the test
|
|
3
|
-
* runner ignores it; imported by harness unit tests that need a session but never
|
|
4
|
-
* read its (opaque) auth. `auth` defaults to the trivial local value the harness
|
|
5
|
-
* never inspects; an embedder whose adapters downcast `auth` to a concrete type
|
|
6
|
-
* overrides it rather than re-declaring the whole session shape.
|
|
7
|
-
*/
|
|
8
|
-
import type { AuthContext, RequestSession, Scope } from "../../auth/types.js";
|
|
9
|
-
export interface SessionOverrides {
|
|
10
|
-
user?: string;
|
|
11
|
-
scope?: Scope;
|
|
12
|
-
agentId?: string;
|
|
13
|
-
callPath?: readonly string[];
|
|
14
|
-
auth?: AuthContext;
|
|
15
|
-
}
|
|
16
|
-
/** Build a fully-populated harness `RequestSession` for tests, with per-field overrides. */
|
|
17
|
-
export declare function makeSession(overrides?: SessionOverrides): RequestSession;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test-only harness `RequestSession` builder. Not a `*.test.ts` file, so the test
|
|
3
|
-
* runner ignores it; imported by harness unit tests that need a session but never
|
|
4
|
-
* read its (opaque) auth. `auth` defaults to the trivial local value the harness
|
|
5
|
-
* never inspects; an embedder whose adapters downcast `auth` to a concrete type
|
|
6
|
-
* overrides it rather than re-declaring the whole session shape.
|
|
7
|
-
*/
|
|
8
|
-
import { makeLocalAuth } from "../../auth/local-auth-context.js";
|
|
9
|
-
/** Build a fully-populated harness `RequestSession` for tests, with per-field overrides. */
|
|
10
|
-
export function makeSession(overrides = {}) {
|
|
11
|
-
return {
|
|
12
|
-
identity: { user: overrides.user ?? "user-001" },
|
|
13
|
-
scope: overrides.scope ?? { kind: "analysis", analysisId: "analysis-001" },
|
|
14
|
-
provenance: {
|
|
15
|
-
agentId: overrides.agentId ?? "conversation-agent",
|
|
16
|
-
callPath: overrides.callPath ?? ["conversation-agent"],
|
|
17
|
-
},
|
|
18
|
-
auth: overrides.auth ?? makeLocalAuth(),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test-only `ToolContext` builder. Not a `*.test.ts` file, so the test
|
|
3
|
-
* runner ignores it; imported by the tool unit tests.
|
|
4
|
-
*/
|
|
5
|
-
import type { ToolContext } from "../define-tool.js";
|
|
6
|
-
/** A `ToolContext` plus the list of events its `emit` recorded. */
|
|
7
|
-
export interface TestToolContext {
|
|
8
|
-
readonly ctx: ToolContext;
|
|
9
|
-
/** Every event passed to `ctx.emit`, in call order. */
|
|
10
|
-
readonly emitted: unknown[];
|
|
11
|
-
}
|
|
12
|
-
/** Build a `ToolContext` for tests; `emit` records into `emitted`. */
|
|
13
|
-
export declare function makeToolContext(signal?: AbortSignal): TestToolContext;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test-only `ToolContext` builder. Not a `*.test.ts` file, so the test
|
|
3
|
-
* runner ignores it; imported by the tool unit tests.
|
|
4
|
-
*/
|
|
5
|
-
import { makeSession } from "../../providers/__fixtures__/session.js";
|
|
6
|
-
import { UnavailableAsk } from "../approval/contract.js";
|
|
7
|
-
/** Build a `ToolContext` for tests; `emit` records into `emitted`. */
|
|
8
|
-
export function makeToolContext(signal) {
|
|
9
|
-
const emitted = [];
|
|
10
|
-
const deny = new UnavailableAsk();
|
|
11
|
-
const ctx = {
|
|
12
|
-
invocationId: "test-tool-call",
|
|
13
|
-
session: makeSession(),
|
|
14
|
-
signal: signal ?? new AbortController().signal,
|
|
15
|
-
emit: (event) => {
|
|
16
|
-
emitted.push(event);
|
|
17
|
-
},
|
|
18
|
-
runStep: (_name, fn) => fn(),
|
|
19
|
-
ask: (request) => deny.ask(request),
|
|
20
|
-
};
|
|
21
|
-
return { ctx, emitted };
|
|
22
|
-
}
|