@qvac/harness 1.0.1 → 1.2.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/CHANGELOG.md +171 -6
- package/README.md +39 -0
- package/dist-lib/index.d.ts +32 -304
- package/dist-lib/index.js +16 -1147
- package/dist-lib/lib/agent/child-run.d.ts +33 -0
- package/dist-lib/lib/agent/child-run.js +58 -0
- package/dist-lib/lib/agent/delegate.d.ts +3 -19
- package/dist-lib/lib/agent/delegate.js +8 -31
- package/dist-lib/lib/agent/index.d.ts +7 -0
- package/dist-lib/lib/agent/index.js +5 -0
- package/dist-lib/lib/agent/read-parts.d.ts +47 -0
- package/dist-lib/lib/agent/read-parts.js +85 -0
- package/dist-lib/lib/capabilities/completion-engine/driver.js +6 -2
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/engine.js +27 -18
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/round.js +5 -4
- package/dist-lib/lib/client/index.js +1 -3
- package/dist-lib/lib/connect/decode.d.ts +3 -2
- package/dist-lib/lib/connect/decode.js +14 -0
- package/dist-lib/lib/connect.d.ts +1 -0
- package/dist-lib/lib/connect.js +11 -5
- package/dist-lib/lib/context-window.d.ts +2 -0
- package/dist-lib/lib/context-window.js +17 -14
- package/dist-lib/lib/contract/models.d.ts +13 -1
- package/dist-lib/lib/contract-types.d.ts +9 -0
- package/dist-lib/lib/harness.d.ts +269 -0
- package/dist-lib/lib/harness.js +1154 -0
- package/dist-lib/lib/models/custom-model-cache.d.ts +2 -0
- package/dist-lib/lib/models/custom-model-cache.js +21 -0
- package/dist-lib/lib/models/memory-cap.d.ts +6 -0
- package/dist-lib/lib/models/memory-cap.js +20 -0
- package/dist-lib/lib/models/model-catalog.d.ts +2 -0
- package/dist-lib/lib/models/model-catalog.js +8 -2
- package/dist-lib/lib/models/model-fit.d.ts +59 -10
- package/dist-lib/lib/models/model-fit.js +172 -35
- package/dist-lib/lib/models/model-handle.d.ts +2 -1
- package/dist-lib/lib/models/model-pool.d.ts +3 -2
- package/dist-lib/lib/models/model-pool.js +30 -13
- package/dist-lib/lib/models/tts-model-default.d.ts +1 -1
- package/dist-lib/lib/models/tts-model-default.js +7 -6
- package/dist-lib/lib/residency/completion-runtime.d.ts +1 -1
- package/dist-lib/lib/residency/completion-runtime.js +1 -1
- package/dist-lib/lib/residency/index.d.ts +31 -9
- package/dist-lib/lib/residency/index.js +286 -88
- package/dist-lib/lib/run-log/boundary.d.ts +4 -1
- package/dist-lib/lib/run-log/boundary.js +2 -1
- package/dist-lib/lib/run-log/index.d.ts +2 -1
- package/dist-lib/lib/run-log/index.js +2 -1
- package/dist-lib/lib/run-log/persisted-actor.d.ts +10 -0
- package/dist-lib/lib/run-log/persisted-actor.js +15 -0
- package/dist-lib/lib/run-log/run-journal.d.ts +3 -0
- package/dist-lib/lib/run-log/run-journal.js +19 -8
- package/dist-lib/lib/serve/requests.d.ts +3 -0
- package/dist-lib/lib/serve.js +3 -0
- package/dist-lib/lib/spawn.d.ts +4 -1
- package/dist-lib/lib/tools/exec.d.ts +2 -0
- package/dist-lib/lib/tools/exec.js +29 -1
- package/dist-lib/lib/tools/files/list-dir.js +79 -32
- package/dist-lib/lib/tools/fs/walk.d.ts +11 -1
- package/dist-lib/lib/tools/fs/walk.js +64 -30
- package/dist-lib/lib/tools/office.js +8 -5
- package/dist-lib/lib/tools/pdf/pages.d.ts +1 -1
- package/dist-lib/lib/tools/pdf/pages.js +3 -14
- package/dist-lib/lib/tools/pdf/recognize.d.ts +3 -0
- package/dist-lib/lib/tools/pdf/recognize.js +45 -7
- package/dist-lib/plugins/image/generate-image.d.ts +2 -2
- package/dist-lib/plugins/image/generate-image.js +9 -1
- package/dist-lib/plugins/image/index.js +6 -2
- package/dist-lib/plugins/knowledge/chunk-index.d.ts +4 -0
- package/dist-lib/plugins/knowledge/chunk-index.js +191 -0
- package/dist-lib/plugins/knowledge/index.d.ts +1 -0
- package/dist-lib/plugins/knowledge/index.js +1 -0
- package/dist-lib/plugins/knowledge/manifest.d.ts +2 -1
- package/dist-lib/plugins/knowledge/manifest.js +2 -9
- package/dist-lib/plugins/knowledge/store.d.ts +5 -1
- package/dist-lib/plugins/knowledge/store.js +44 -16
- package/dist-lib/plugins/lsp/rpc.d.ts +9 -1
- package/dist-lib/plugins/lsp/rpc.js +81 -17
- package/dist-lib/plugins/music/generate-music.d.ts +2 -2
- package/dist-lib/plugins/music/generate-music.js +14 -1
- package/dist-lib/plugins/music/index.js +4 -1
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/speech/speech-engine.d.ts +5 -2
- package/dist-lib/plugins/speech/speech-engine.js +28 -7
- package/dist-lib/schema/harness.js +28 -2
- package/dist-lib/spec/bind.js +3 -0
- package/dist-lib/spec/calls.js +1 -0
- package/dist-lib/spec/hrpc/hrpc.json +13 -0
- package/dist-lib/spec/hrpc/index.js +15 -3
- package/dist-lib/spec/hrpc/messages.js +87 -6
- package/dist-lib/spec/hyperschema/index.js +87 -6
- package/dist-lib/spec/hyperschema/schema.json +70 -2
- package/dist-lib/spec/hyperschema/types.d.ts +21 -1
- package/package.json +29 -28
- package/scripts/addon-externals.cjs +1 -0
- package/worker/harness-sidecar.mjs +12 -1
|
@@ -5,6 +5,7 @@ interface ContextCandidate {
|
|
|
5
5
|
history: Message[];
|
|
6
6
|
droppedTurns: number;
|
|
7
7
|
}
|
|
8
|
+
declare function contextCandidateIterator(history: Message[], ...nudges: string[]): Generator<ContextCandidate>;
|
|
8
9
|
declare function contextCandidates(history: Message[], ...nudges: string[]): ContextCandidate[];
|
|
9
10
|
declare function compactContent(content: string, target: number): string;
|
|
10
11
|
export type { ContextCandidate };
|
|
@@ -13,5 +14,6 @@ export declare class ContextWindow {
|
|
|
13
14
|
static compactContent: typeof compactContent;
|
|
14
15
|
static compactedFrom: typeof compactedFrom;
|
|
15
16
|
static contextCandidates: typeof contextCandidates;
|
|
17
|
+
static contextCandidateIterator: typeof contextCandidateIterator;
|
|
16
18
|
static responseRoomChars: typeof responseRoomChars;
|
|
17
19
|
}
|
|
@@ -11,19 +11,25 @@ const compactedSources = new WeakMap();
|
|
|
11
11
|
function compactedFrom(message) {
|
|
12
12
|
return compactedSources.get(message);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function* contextCandidateIterator(history, ...nudges) {
|
|
15
|
+
yield { history, droppedTurns: 0 };
|
|
15
16
|
const isBoundary = (message) => Fold.isTurn(message, nudges);
|
|
16
17
|
const { prefix, turns } = splitTurns(history, isBoundary);
|
|
17
18
|
if (!turns.length) {
|
|
18
|
-
return
|
|
19
|
+
return;
|
|
19
20
|
}
|
|
20
21
|
const maxDropped = Math.max(0, turns.length - 1);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
droppedTurns
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
let last = { history, droppedTurns: 0 };
|
|
23
|
+
for (const droppedTurns of dropCounts(maxDropped)) {
|
|
24
|
+
if (droppedTurns === 0)
|
|
25
|
+
continue;
|
|
26
|
+
last = { history: [...prefix, ...turns.slice(droppedTurns).flat()], droppedTurns };
|
|
27
|
+
yield last;
|
|
28
|
+
}
|
|
29
|
+
yield* toolCompactionCandidates(last, isBoundary);
|
|
30
|
+
}
|
|
31
|
+
function contextCandidates(history, ...nudges) {
|
|
32
|
+
return [...contextCandidateIterator(history, ...nudges)];
|
|
27
33
|
}
|
|
28
34
|
function splitTurns(history, isBoundary) {
|
|
29
35
|
const firstUser = history.findIndex(isBoundary);
|
|
@@ -53,11 +59,7 @@ function dropCounts(max) {
|
|
|
53
59
|
}
|
|
54
60
|
return counts;
|
|
55
61
|
}
|
|
56
|
-
function
|
|
57
|
-
const last = candidates[candidates.length - 1];
|
|
58
|
-
if (!last) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
62
|
+
function* toolCompactionCandidates(last, isBoundary) {
|
|
61
63
|
const tools = compactableTools(last.history, isBoundary);
|
|
62
64
|
let history = last.history;
|
|
63
65
|
while (true) {
|
|
@@ -67,7 +69,7 @@ function appendToolCompactions(candidates, isBoundary) {
|
|
|
67
69
|
}
|
|
68
70
|
selected.target = Math.max(TOOL_RESULT_TRUNCATION_MARKER.length, Math.floor(selected.target / 2));
|
|
69
71
|
history = history.map(compactTool.bind(null, selected));
|
|
70
|
-
|
|
72
|
+
yield { history, droppedTurns: last.droppedTurns };
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
function compactableTools(history, isBoundary) {
|
|
@@ -114,5 +116,6 @@ export class ContextWindow {
|
|
|
114
116
|
static compactContent = compactContent;
|
|
115
117
|
static compactedFrom = compactedFrom;
|
|
116
118
|
static contextCandidates = contextCandidates;
|
|
119
|
+
static contextCandidateIterator = contextCandidateIterator;
|
|
117
120
|
static responseRoomChars = responseRoomChars;
|
|
118
121
|
}
|
|
@@ -9,7 +9,7 @@ export type { CancelSdk, HoldFn, LoadRequests, ModelState, TrackedLoad };
|
|
|
9
9
|
export interface ModelHost {
|
|
10
10
|
sdk(): Promise<unknown>;
|
|
11
11
|
track(load: TrackedLoad, sdk?: Partial<CancelSdk>): TrackedLoad;
|
|
12
|
-
makeRoom(signal: BareAbortSignal | undefined, busy: string | Error,
|
|
12
|
+
makeRoom(signal: BareAbortSignal | undefined, busy: string | Error, load?: ReadonlyArray<string> | RoomHold): Promise<ReleaseRoom>;
|
|
13
13
|
hold: HoldFn;
|
|
14
14
|
isCached(model: string, addon: ModelAddon): Promise<boolean>;
|
|
15
15
|
readonly requests: LoadRequests;
|
|
@@ -21,6 +21,16 @@ export interface ModelHost {
|
|
|
21
21
|
registerPool(spec: ResidentPoolSpec): ResidentPool;
|
|
22
22
|
enterWork(): () => void;
|
|
23
23
|
}
|
|
24
|
+
export type ReleaseRoom = () => void;
|
|
25
|
+
export interface RoomHold {
|
|
26
|
+
srcs: ReadonlyArray<string>;
|
|
27
|
+
unloadIdle(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface ParallelLoad {
|
|
30
|
+
group: string;
|
|
31
|
+
slots: number;
|
|
32
|
+
ctxSize?: number | undefined;
|
|
33
|
+
}
|
|
24
34
|
export interface BorrowedModel {
|
|
25
35
|
modelId: string;
|
|
26
36
|
release(): void;
|
|
@@ -56,7 +66,9 @@ export interface VectorIndexSdk {
|
|
|
56
66
|
createVectorIndex: typeof createVectorIndex;
|
|
57
67
|
loadVectorIndex: typeof loadVectorIndex;
|
|
58
68
|
}
|
|
69
|
+
export type VectorIndex = Awaited<ReturnType<typeof createVectorIndex>>;
|
|
59
70
|
export interface EmbedHost {
|
|
60
71
|
embed(request: EmbedRequest): Promise<number[][]>;
|
|
61
72
|
sdk(): Promise<VectorIndexSdk>;
|
|
73
|
+
weights(model: string): Promise<string | undefined>;
|
|
62
74
|
}
|
|
@@ -186,8 +186,15 @@ export interface LoadModelResult {
|
|
|
186
186
|
loaded: boolean;
|
|
187
187
|
reason?: 'memory';
|
|
188
188
|
}
|
|
189
|
+
export interface MemoryPoolUsage {
|
|
190
|
+
readonly id: string;
|
|
191
|
+
readonly usedBytes: number;
|
|
192
|
+
readonly capBytes?: number | undefined;
|
|
193
|
+
readonly totalBytes?: number | undefined;
|
|
194
|
+
}
|
|
189
195
|
export interface MemoryUsage {
|
|
190
196
|
readonly usedBytes: number;
|
|
197
|
+
readonly pools?: ReadonlyArray<MemoryPoolUsage> | undefined;
|
|
191
198
|
}
|
|
192
199
|
export interface UnloadModelContext {
|
|
193
200
|
model: string;
|
|
@@ -243,6 +250,7 @@ export interface CapabilityInfo {
|
|
|
243
250
|
recommendedModelName: string;
|
|
244
251
|
memoryBudget?: MemoryBudget;
|
|
245
252
|
mobile: boolean;
|
|
253
|
+
mobileMemoryCap?: boolean;
|
|
246
254
|
}
|
|
247
255
|
export interface CredentialEntry {
|
|
248
256
|
key: string;
|
|
@@ -270,6 +278,7 @@ export interface HarnessContract {
|
|
|
270
278
|
download?(context: DownloadContext): AsyncIterable<HarnessEvent>;
|
|
271
279
|
describe?(): Promise<HarnessInfo | null> | HarnessInfo;
|
|
272
280
|
embed?(context: EmbedContext): Promise<number[][]>;
|
|
281
|
+
embeddingWeights?(model: string): Promise<string | undefined>;
|
|
273
282
|
transcribe?(context: TranscribeContext): Promise<string>;
|
|
274
283
|
ocrRead?(context: OcrReadContext): Promise<OcrPage>;
|
|
275
284
|
detectLanguage?(context: DetectLanguageContext): DetectedLanguage[] | Promise<DetectedLanguage[]>;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import ReadyResource from 'ready-resource';
|
|
3
|
+
import { type CompletionArgs, type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult } from './capabilities/completion-engine/index.ts';
|
|
4
|
+
import { type DetectLanguageContext, type DetectedLanguage } from './capabilities/detect-language.ts';
|
|
5
|
+
import { type DownloadArgs, type DownloadEventStream } from './capabilities/download.ts';
|
|
6
|
+
import type { EmbedContext } from './capabilities/embed.ts';
|
|
7
|
+
import { type EnhanceMode } from './capabilities/enhance.ts';
|
|
8
|
+
import { type Capability } from './capabilities/invoke.ts';
|
|
9
|
+
import { type KvCacheDeletionResult } from './capabilities/kv-cache.ts';
|
|
10
|
+
import { type ModelSourcePreview, type PreviewModelSourceContext } from './capabilities/preview-model-source.ts';
|
|
11
|
+
import type { CapabilityInfo, CredentialEntry, DownloadsAllowedOptions, HarnessDiagnostics, HarnessInfo, InfraModel, LoadModelResult, MemoryUsage, SkillWriteResult, UnloadModelContext, UnloadModelResult } from './contract-types.ts';
|
|
12
|
+
import type { AccessPolicy, AgentConfig, ApproveFn, AskUserFn, AttachFn, CompletionEvent, FetchAttachmentFn, HarnessHook, MediaRoundIo, MediaRoundPort, MediaRoundRequest, MediaRoundResult, Message, ProgressFn, ProjectSkill, ResponseFormat, RunGoal, RunInput, ShowImageFn, ToolDefinition, ToolExecuteContext, WorkspaceSkill } from './contract/index.ts';
|
|
13
|
+
import type { KnowledgeArtifact, KnowledgeGrant, KnowledgeHit, KnowledgeQuery, KnowledgeRemoved, KnowledgeStatus, KnowledgeUpsertResult } from './contract/knowledge.ts';
|
|
14
|
+
import type { ParallelLoad } from './contract/models.ts';
|
|
15
|
+
import type { OcrPage, OcrReadContext } from './contract/ocr.ts';
|
|
16
|
+
import type { SpeakContext, SpeakResult, SpeakStreamContext, TranscribeContext } from './contract/speech.ts';
|
|
17
|
+
import { RunLatency } from './helpers/run-latency.ts';
|
|
18
|
+
import type { EmbedDevice } from './models/embed-config.ts';
|
|
19
|
+
import type { LlmGenerationParams } from './models/llm-presets.ts';
|
|
20
|
+
import { type CustomModelEntry } from './models/model-catalog.ts';
|
|
21
|
+
import { type DeleteModelSummary } from './models/model-delete.ts';
|
|
22
|
+
import { type ListModelsOptions, type ModelInfo } from './models/model-list.ts';
|
|
23
|
+
import { type LlamaLoadKnobs } from './models/model-pool.ts';
|
|
24
|
+
import { type HarnessPlugin } from './plugins/index.ts';
|
|
25
|
+
import { type WarmModelOptions } from './residency/index.ts';
|
|
26
|
+
import type { EngineBoot, EngineStep, RecoveryResolution } from './run-log/index.ts';
|
|
27
|
+
import { type SdkLoader } from './sdk-loader.ts';
|
|
28
|
+
import { type HarnessSkillsOptions } from './skills-host/index.ts';
|
|
29
|
+
import { type ToolCatalogEntry } from './tools/catalog.ts';
|
|
30
|
+
import { type ExecToolOptions } from './tools/exec.ts';
|
|
31
|
+
import type { DriveOpFn, GrantedDrive } from './tools/fs/remote-protocol.ts';
|
|
32
|
+
import type { CredentialStoreFn, CredentialStoreValue } from './tools/skills/auth-resolver.ts';
|
|
33
|
+
import type { ResolvedSkillCatalogEntry } from './tools/skills/catalog.ts';
|
|
34
|
+
import type { CopyBaseResult, DeleteOverlayResult, ManagedSkill, SkillFileContent } from './tools/skills/overlay-crud.ts';
|
|
35
|
+
import type { SkillSettingEntry } from './tools/skills/skill-settings.ts';
|
|
36
|
+
export type HarnessExecOptions = Pick<ExecToolOptions, 'spawn' | 'killProcess' | 'realpath' | 'policyVersion'>;
|
|
37
|
+
export interface CompletionContext {
|
|
38
|
+
runId?: string;
|
|
39
|
+
parentRunId?: string;
|
|
40
|
+
parallel?: ParallelLoad;
|
|
41
|
+
tools?: ToolDefinition[];
|
|
42
|
+
policy?: AccessPolicy;
|
|
43
|
+
now?: () => number;
|
|
44
|
+
maxToolRounds?: number;
|
|
45
|
+
budgetMs?: number;
|
|
46
|
+
knowledge?: KnowledgeGrant;
|
|
47
|
+
planMode?: boolean;
|
|
48
|
+
deferTools?: boolean;
|
|
49
|
+
goal?: RunGoal;
|
|
50
|
+
wording?: CompletionArgs['wording'];
|
|
51
|
+
resume?: boolean;
|
|
52
|
+
recovery?: RecoveryResolution[];
|
|
53
|
+
model: string;
|
|
54
|
+
agent?: AgentConfig;
|
|
55
|
+
projectSkills?: readonly ProjectSkill[];
|
|
56
|
+
workspaceSkills?: readonly WorkspaceSkill[];
|
|
57
|
+
agents?: Record<string, AgentConfig>;
|
|
58
|
+
messages: Message[];
|
|
59
|
+
typedText?: string;
|
|
60
|
+
cacheKey?: string;
|
|
61
|
+
replaysContext?: boolean;
|
|
62
|
+
session?: string;
|
|
63
|
+
thinkingDefault?: string;
|
|
64
|
+
toolConfigs?: Record<string, Record<string, unknown>>;
|
|
65
|
+
generationParams?: LlmGenerationParams;
|
|
66
|
+
responseFormat?: ResponseFormat;
|
|
67
|
+
captureInferenceCalls?: boolean;
|
|
68
|
+
grantedDirs?: string[];
|
|
69
|
+
grantedDrives?: GrantedDrive[];
|
|
70
|
+
driveOp?: DriveOpFn;
|
|
71
|
+
grantedWriteDirs?: string[];
|
|
72
|
+
approve?: ApproveFn;
|
|
73
|
+
attach?: AttachFn;
|
|
74
|
+
fetchAttachment?: FetchAttachmentFn;
|
|
75
|
+
showImage?: ShowImageFn;
|
|
76
|
+
progress?: ProgressFn;
|
|
77
|
+
askUser?: AskUserFn;
|
|
78
|
+
boot?: EngineBoot;
|
|
79
|
+
onStep?: (step: EngineStep) => Promise<void>;
|
|
80
|
+
requestDigestKey?: Uint8Array;
|
|
81
|
+
signal?: BareAbortSignal;
|
|
82
|
+
input?: AsyncIterable<RunInput>;
|
|
83
|
+
roundCut?: (cut: (note: string) => void) => void;
|
|
84
|
+
modelRound?: ModelRoundPort;
|
|
85
|
+
mediaRound?: MediaRoundPort;
|
|
86
|
+
latency?: RunLatency;
|
|
87
|
+
hopLog?: (hop: RunHop) => RunHopLog;
|
|
88
|
+
}
|
|
89
|
+
export interface RunHop {
|
|
90
|
+
index: number;
|
|
91
|
+
agent: string;
|
|
92
|
+
}
|
|
93
|
+
export interface RunHopLog {
|
|
94
|
+
boot: EngineBoot;
|
|
95
|
+
onStep: (step: EngineStep) => Promise<void>;
|
|
96
|
+
requestDigestKey?: Uint8Array;
|
|
97
|
+
}
|
|
98
|
+
export type ResumeCompletionContext = Omit<Partial<CompletionContext>, 'runId' | 'resume'> & {
|
|
99
|
+
runId: string;
|
|
100
|
+
resume: true;
|
|
101
|
+
};
|
|
102
|
+
export interface InvokeContext {
|
|
103
|
+
capability: Capability;
|
|
104
|
+
args: Record<string, unknown>;
|
|
105
|
+
enhance?: EnhanceMode;
|
|
106
|
+
agent?: AgentConfig;
|
|
107
|
+
attach?: AttachFn;
|
|
108
|
+
fetchAttachment?: FetchAttachmentFn;
|
|
109
|
+
progress?: ProgressFn;
|
|
110
|
+
signal?: BareAbortSignal;
|
|
111
|
+
}
|
|
112
|
+
export interface HarnessOptions {
|
|
113
|
+
tools?: ToolDefinition[];
|
|
114
|
+
gpuStats?: unknown;
|
|
115
|
+
sdkLoader?: SdkLoader;
|
|
116
|
+
skillsDir?: string;
|
|
117
|
+
modelsDir?: string;
|
|
118
|
+
sdkHome?: string;
|
|
119
|
+
exec?: boolean | HarnessExecOptions;
|
|
120
|
+
projectionModel?: string | Record<string, string>;
|
|
121
|
+
llmDevice?: 'cpu' | 'gpu';
|
|
122
|
+
llmGpuLayers?: number;
|
|
123
|
+
contextSize?: number;
|
|
124
|
+
kvCacheK?: string;
|
|
125
|
+
kvCacheV?: string;
|
|
126
|
+
llmLoad?: LlamaLoadKnobs;
|
|
127
|
+
slots?: number;
|
|
128
|
+
embedDevice?: EmbedDevice;
|
|
129
|
+
embedGpuLayers?: number;
|
|
130
|
+
embedBatchSize?: number;
|
|
131
|
+
transcriptionDevice?: 'cpu' | 'gpu';
|
|
132
|
+
credentialStore?: CredentialStoreFn;
|
|
133
|
+
platform?: string;
|
|
134
|
+
completionModelCap?: number;
|
|
135
|
+
hooks?: readonly HarnessHook[];
|
|
136
|
+
plugins?: readonly HarnessPlugin[];
|
|
137
|
+
pluginMode?: 'frozen' | 'dynamic';
|
|
138
|
+
policy?: AccessPolicy;
|
|
139
|
+
}
|
|
140
|
+
export declare class Harness extends ReadyResource {
|
|
141
|
+
private readonly _hostTools;
|
|
142
|
+
private _tools;
|
|
143
|
+
private _capabilities;
|
|
144
|
+
private _sdk;
|
|
145
|
+
private readonly _loads;
|
|
146
|
+
private readonly _downloads;
|
|
147
|
+
private readonly _hold;
|
|
148
|
+
private readonly _residency;
|
|
149
|
+
private readonly _embeddings;
|
|
150
|
+
private readonly _voicePools;
|
|
151
|
+
private readonly _skills;
|
|
152
|
+
private readonly _lifecycle;
|
|
153
|
+
private _closeRetryNeeded;
|
|
154
|
+
private readonly _modelsDir?;
|
|
155
|
+
private readonly _skillsDir?;
|
|
156
|
+
private readonly _exec;
|
|
157
|
+
private readonly _deniedRoots;
|
|
158
|
+
private readonly _policy;
|
|
159
|
+
private _shell;
|
|
160
|
+
private _projectionModel;
|
|
161
|
+
private _customProjection;
|
|
162
|
+
private readonly _speculative;
|
|
163
|
+
private readonly _contextSize?;
|
|
164
|
+
private readonly _recentFits;
|
|
165
|
+
private readonly _gpuStats?;
|
|
166
|
+
private _capability;
|
|
167
|
+
private _capabilityInflight;
|
|
168
|
+
private readonly _hostHooks;
|
|
169
|
+
private _hooks;
|
|
170
|
+
private readonly _plugins;
|
|
171
|
+
private readonly _prefix;
|
|
172
|
+
private readonly _pluginMode;
|
|
173
|
+
private _pluginsStarted;
|
|
174
|
+
constructor({ tools, sdkLoader, skillsDir, modelsDir, sdkHome, exec, projectionModel, llmDevice, llmGpuLayers, contextSize, kvCacheK, kvCacheV, llmLoad, slots, embedDevice, embedGpuLayers, embedBatchSize, transcriptionDevice, completionModelCap, credentialStore, platform, gpuStats, hooks, plugins, pluginMode, policy }?: HarnessOptions);
|
|
175
|
+
_open(): Promise<void>;
|
|
176
|
+
private _startPlugins;
|
|
177
|
+
private _runPluginStart;
|
|
178
|
+
private _publishPlugins;
|
|
179
|
+
private _execTools;
|
|
180
|
+
addPlugin(plugin: HarnessPlugin): Promise<void>;
|
|
181
|
+
removePlugin(name: string): Promise<void>;
|
|
182
|
+
reloadPlugin(name: string, plugin: HarnessPlugin): Promise<void>;
|
|
183
|
+
private _dynamicPlugins;
|
|
184
|
+
private _modelHost;
|
|
185
|
+
private _registerPool;
|
|
186
|
+
private _createVoicePool;
|
|
187
|
+
private _embedHost;
|
|
188
|
+
private _loadAddons;
|
|
189
|
+
private _teardownPlugins;
|
|
190
|
+
get suspended(): boolean;
|
|
191
|
+
get skillNames(): string[];
|
|
192
|
+
setCredentials(entries: ReadonlyArray<CredentialEntry>): void;
|
|
193
|
+
setSkillSettings(entries: ReadonlyArray<SkillSettingEntry>): void;
|
|
194
|
+
skillSettings(skill: string, agentId?: string | null): Record<string, string>;
|
|
195
|
+
listManagedSkills(): Promise<ManagedSkill[]>;
|
|
196
|
+
readSkillFile(name: string): Promise<SkillFileContent | null>;
|
|
197
|
+
writeSkillFile(name: string, content: string): Promise<SkillWriteResult>;
|
|
198
|
+
copyBaseForEdit(name: string): Promise<CopyBaseResult>;
|
|
199
|
+
deleteOverlaySkill(name: string): Promise<DeleteOverlayResult>;
|
|
200
|
+
resolveCredential(key: string, ctx?: ToolExecuteContext): Promise<CredentialStoreValue> | CredentialStoreValue;
|
|
201
|
+
skills(agentId?: string | null, modelName?: string | null, options?: HarnessSkillsOptions): Promise<ResolvedSkillCatalogEntry[]>;
|
|
202
|
+
tools(): Promise<ToolCatalogEntry[]>;
|
|
203
|
+
get toolNames(): string[];
|
|
204
|
+
get supportsImages(): boolean;
|
|
205
|
+
supportsImagesFor(model: string): boolean;
|
|
206
|
+
private _draftFor;
|
|
207
|
+
private _projectionFor;
|
|
208
|
+
setCustomModels(entries: ReadonlyArray<CustomModelEntry>): void;
|
|
209
|
+
setModelIdleTimeout(ms: number): void;
|
|
210
|
+
setModelMemoryCap(percent: number): Promise<void>;
|
|
211
|
+
memoryUsage(): Promise<MemoryUsage>;
|
|
212
|
+
setDownloadsAllowed({ allowed }: DownloadsAllowedOptions): void;
|
|
213
|
+
private _isModelCached;
|
|
214
|
+
previewModelSource(context: PreviewModelSourceContext): Promise<ModelSourcePreview>;
|
|
215
|
+
describe(): Promise<HarnessInfo>;
|
|
216
|
+
diagnostics(): HarnessDiagnostics;
|
|
217
|
+
getEmbeddingDevice(): EmbedDevice;
|
|
218
|
+
setEmbeddingDevice(device: EmbedDevice): Promise<void>;
|
|
219
|
+
presuspend(): Promise<void>;
|
|
220
|
+
suspend(): Promise<void>;
|
|
221
|
+
resume(): Promise<void>;
|
|
222
|
+
wakeup(): Promise<void>;
|
|
223
|
+
ready(): Promise<void>;
|
|
224
|
+
_close(): Promise<void>;
|
|
225
|
+
close(): Promise<void>;
|
|
226
|
+
private _closeWhileOpening;
|
|
227
|
+
download(args: DownloadArgs): DownloadEventStream;
|
|
228
|
+
embed(context: EmbedContext): Promise<number[][]>;
|
|
229
|
+
embeddingWeights(model: string): Promise<string | undefined>;
|
|
230
|
+
private _speechService;
|
|
231
|
+
private _knowledgeService;
|
|
232
|
+
knowledgeUpsert(artifact: KnowledgeArtifact): Promise<KnowledgeUpsertResult>;
|
|
233
|
+
knowledgeRemove(artifactId: string): Promise<KnowledgeRemoved>;
|
|
234
|
+
knowledgeSearch(query: KnowledgeQuery): Promise<KnowledgeHit[]>;
|
|
235
|
+
knowledgeStatus(): Promise<KnowledgeStatus>;
|
|
236
|
+
transcribe(context: TranscribeContext): Promise<string>;
|
|
237
|
+
private _transcribe;
|
|
238
|
+
ocrRead({ image, signal }: OcrReadContext): Promise<OcrPage>;
|
|
239
|
+
private _ocrService;
|
|
240
|
+
detectLanguage(context: DetectLanguageContext): Promise<DetectedLanguage[]>;
|
|
241
|
+
speak(context: SpeakContext): Promise<SpeakResult>;
|
|
242
|
+
private _speak;
|
|
243
|
+
speakStream(context: SpeakStreamContext): AsyncIterable<SpeakResult>;
|
|
244
|
+
private _speakStream;
|
|
245
|
+
private _defaultTts;
|
|
246
|
+
list(options?: ListModelsOptions): Promise<ModelInfo[]>;
|
|
247
|
+
deleteModel(name: string): Promise<DeleteModelSummary>;
|
|
248
|
+
clearKvCache(): Promise<KvCacheDeletionResult>;
|
|
249
|
+
deleteKvCache(kvCacheKey: string): Promise<KvCacheDeletionResult>;
|
|
250
|
+
infraModels(profile: string): Promise<InfraModel[]>;
|
|
251
|
+
capability(): Promise<CapabilityInfo>;
|
|
252
|
+
warmModel(context: WarmModelOptions): Promise<void>;
|
|
253
|
+
loadModel(context: WarmModelOptions): Promise<LoadModelResult>;
|
|
254
|
+
unloadModel(context: UnloadModelContext): Promise<UnloadModelResult>;
|
|
255
|
+
invoke(context: InvokeContext): AsyncGenerator<CompletionEvent>;
|
|
256
|
+
private _invoke;
|
|
257
|
+
completion(context: CompletionContext | ResumeCompletionContext): AsyncGenerator<CompletionEvent>;
|
|
258
|
+
serveModelRound(request: ModelRoundRequest, io: ModelRoundIo): Promise<ModelRoundResult>;
|
|
259
|
+
serveMediaRound(request: MediaRoundRequest, io: MediaRoundIo): Promise<MediaRoundResult>;
|
|
260
|
+
private _servedRoundFailed;
|
|
261
|
+
private _completion;
|
|
262
|
+
private _runCompletion;
|
|
263
|
+
private _seeding;
|
|
264
|
+
private _residentLease;
|
|
265
|
+
private _access;
|
|
266
|
+
private _providers;
|
|
267
|
+
private _completionFailed;
|
|
268
|
+
private _residentEnhancer;
|
|
269
|
+
}
|