@klarkxy/dsh-ai-services 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/LICENSE +41 -0
- package/README.md +39 -0
- package/cordis.patch.yml +4 -0
- package/docs/README.zh-CN.md +9 -0
- package/lib/client-utils.d.ts +52 -0
- package/lib/client-utils.js +77 -0
- package/lib/client-utils.js.map +1 -0
- package/lib/contracts.d.ts +230 -0
- package/lib/contracts.js +21 -0
- package/lib/contracts.js.map +1 -0
- package/lib/host-rpc.d.ts +20 -0
- package/lib/host-rpc.js +95 -0
- package/lib/host-rpc.js.map +1 -0
- package/lib/index.d.ts +77 -0
- package/lib/index.js +1299 -0
- package/lib/index.js.map +1 -0
- package/lib/insert-output.d.ts +26 -0
- package/lib/insert-output.js +63 -0
- package/lib/insert-output.js.map +1 -0
- package/package.json +111 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AI_RPC_CHANNEL, AiFeatureScope, AiPolicy, AiServices, AuxiliaryRequest, AuxiliaryResult, CHAT_EVENTS_SLOT, EvidenceRef, KnowledgeKind, KnowledgeScope, MODEL_SETTINGS_SLOT, MemoryMutationOptions, MemoryQuery, MemoryRecord, MemoryService, ModelRole, ModelRoute, ModelTarget, NewMemoryRecord, ProducerMessageSource, ProducerSourceKind, PurposeSpec, ResolvedRoute, RpcResult, TaskCheckpoint, TaskContract, UsageReceipt, producerMessageSource, projectIdFromCwd } from "./contracts.js";
|
|
2
|
+
import { HostRpcContext, registerHostRpc } from "./host-rpc.js";
|
|
3
|
+
import { LlmRuntime } from "@deepseek-ai/dsh-llm";
|
|
4
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
5
|
+
//#region src/generate.d.ts
|
|
6
|
+
type LlmGenerate = Pick<LlmRuntime, 'prepareCall'>;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/routing.d.ts
|
|
9
|
+
type SessionModelsFn = (sessionId: string, signal?: AbortSignal) => Promise<ModelRoute>;
|
|
10
|
+
type LlmValidate = Pick<LlmRuntime, 'resolveCallConfig'>;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/service.d.ts
|
|
13
|
+
type AiServicesStore = {
|
|
14
|
+
savePolicy(policy: AiPolicy, imports?: string[]): Promise<void>;
|
|
15
|
+
saveReceipts(items: UsageReceipt[]): Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
type AiServicesOptions = {
|
|
18
|
+
llm: LlmValidate & LlmGenerate;
|
|
19
|
+
initialPolicy?: AiPolicy;
|
|
20
|
+
initialImports?: string[];
|
|
21
|
+
initialReceipts?: UsageReceipt[];
|
|
22
|
+
store: AiServicesStore;
|
|
23
|
+
sessionModels?: SessionModelsFn;
|
|
24
|
+
/** Read lazily so host model changes and manager unloads apply to the next call. */
|
|
25
|
+
defaultModel?: () => ModelRoute | undefined;
|
|
26
|
+
modelCenterAvailable?: () => boolean;
|
|
27
|
+
now?: () => number;
|
|
28
|
+
id?: () => string;
|
|
29
|
+
};
|
|
30
|
+
declare class AiServicesRuntime implements AiServices {
|
|
31
|
+
private readonly options;
|
|
32
|
+
private policy;
|
|
33
|
+
private imports;
|
|
34
|
+
private receipts;
|
|
35
|
+
private storageFailed;
|
|
36
|
+
private disposed;
|
|
37
|
+
private pending;
|
|
38
|
+
private readonly purposeRegistry;
|
|
39
|
+
private readonly lifetimes;
|
|
40
|
+
private readonly queues;
|
|
41
|
+
private readonly now;
|
|
42
|
+
private readonly id;
|
|
43
|
+
constructor(options: AiServicesOptions);
|
|
44
|
+
get storageFailedFlag(): boolean;
|
|
45
|
+
noteAgent(provider: string, delta: 1 | -1): void;
|
|
46
|
+
getPolicy(): AiPolicy;
|
|
47
|
+
purposes(): Array<PurposeSpec & {
|
|
48
|
+
plugin: string;
|
|
49
|
+
}>;
|
|
50
|
+
usage(): UsageReceipt[];
|
|
51
|
+
importPurposes(migrationId: string, defaults: Record<string, ModelTarget>, roles?: AiPolicy['roles']): Promise<AiPolicy>;
|
|
52
|
+
updatePolicy(policy: Omit<AiPolicy, 'revision'>, expectedRevision: number): Promise<AiPolicy>;
|
|
53
|
+
resolve(purpose: string, sessionId?: string, override?: ModelTarget): Promise<ResolvedRoute>;
|
|
54
|
+
activate(plugin: string): AiFeatureScope;
|
|
55
|
+
dispose(): Promise<void>;
|
|
56
|
+
private assertOpen;
|
|
57
|
+
private registerPurpose;
|
|
58
|
+
private disposeLifetime;
|
|
59
|
+
private refreshPurpose;
|
|
60
|
+
private live;
|
|
61
|
+
private classify;
|
|
62
|
+
private run;
|
|
63
|
+
private record;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/index.d.ts
|
|
67
|
+
declare const name = "@klarkxy/dsh-ai-services";
|
|
68
|
+
declare const inject: readonly ["llm", "storageDomain", "connection", "webServer", "agents", "sessionProjections", "agentDefaultModel"];
|
|
69
|
+
declare module '@deepseek-ai/cordis' {
|
|
70
|
+
interface Context {
|
|
71
|
+
aiServices: AiServices;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
declare function apply(ctx: Context): Promise<void>;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { AI_RPC_CHANNEL, type AiFeatureScope, type AiPolicy, type AiServices, AiServicesRuntime, type AuxiliaryRequest, type AuxiliaryResult, CHAT_EVENTS_SLOT, type EvidenceRef, type HostRpcContext, type KnowledgeKind, type KnowledgeScope, MODEL_SETTINGS_SLOT, type MemoryMutationOptions, type MemoryQuery, type MemoryRecord, type MemoryService, type ModelRole, type ModelRoute, type ModelTarget, type NewMemoryRecord, type ProducerMessageSource, type ProducerSourceKind, type PurposeSpec, type ResolvedRoute, type RpcResult, type TaskCheckpoint, type TaskContract, type UsageReceipt, apply, inject, name, type producerMessageSource, type projectIdFromCwd, registerHostRpc };
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|