@lovrabet/sdk 1.6.1-beta.4 → 1.6.1-beta.5
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/README.md +6 -0
- package/dist/index.d.ts +133 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1655,3 +1655,9 @@ const client = createClient({ authMode: "openapi", token, timestamp });
|
|
|
1655
1655
|
- ❌ **源代码不公开** - 本 SDK 为闭源软件
|
|
1656
1656
|
|
|
1657
1657
|
如需商业授权或有疑问,请访问 [lovrabet.com](https://www.lovrabet.com)
|
|
1658
|
+
|
|
1659
|
+
## 独立知识库服务
|
|
1660
|
+
|
|
1661
|
+
通过 `createKnowledgeClient({ kbServiceDomain, accessKey })` 调用个人知识库的 page/getOne/create/update 和知识搜索。KB origin 必须由调用方显式配置,客户端不从 Runtime 或 Region 推导地址。每个方法只发送一次请求;文件读取、分页聚合、CAS 前读和写后核对由调用方负责。
|
|
1662
|
+
|
|
1663
|
+
完整请求、返回类型和错误处理见 [Knowledge Service Contract](wiki/topics/knowledge-service-contract.md)。
|
package/dist/index.d.ts
CHANGED
|
@@ -3588,5 +3588,136 @@ declare const isTokenExpiring: typeof isTokenExpiring$1;
|
|
|
3588
3588
|
*/
|
|
3589
3589
|
declare const getTokenRemainingTime: typeof getTokenRemainingTime$1;
|
|
3590
3590
|
|
|
3591
|
-
|
|
3592
|
-
|
|
3591
|
+
/** Explicit KB origin and current user AK; no Runtime routing or credential discovery. */
|
|
3592
|
+
interface KnowledgeClientConfig {
|
|
3593
|
+
kbServiceDomain: string;
|
|
3594
|
+
accessKey: string;
|
|
3595
|
+
invokeSource?: string;
|
|
3596
|
+
}
|
|
3597
|
+
interface KnowledgeRequestOptions {
|
|
3598
|
+
signal?: AbortSignal;
|
|
3599
|
+
}
|
|
3600
|
+
interface KnowledgeAppRequest {
|
|
3601
|
+
appCode: string;
|
|
3602
|
+
}
|
|
3603
|
+
interface PersonalKnowledgeGetRequest extends KnowledgeAppRequest {
|
|
3604
|
+
id: string;
|
|
3605
|
+
}
|
|
3606
|
+
interface PersonalKnowledgeCreateRequest extends KnowledgeAppRequest {
|
|
3607
|
+
title: string;
|
|
3608
|
+
content: string;
|
|
3609
|
+
}
|
|
3610
|
+
interface PersonalKnowledgeUpdateRequest extends PersonalKnowledgeGetRequest {
|
|
3611
|
+
title?: string;
|
|
3612
|
+
/** Omitted/null preserves the body; an empty string clears it. */
|
|
3613
|
+
content?: string | null;
|
|
3614
|
+
expectedVersion?: number;
|
|
3615
|
+
}
|
|
3616
|
+
interface PersonalKnowledgePageRequest extends KnowledgeAppRequest {
|
|
3617
|
+
currentPage?: number;
|
|
3618
|
+
pageSize?: number;
|
|
3619
|
+
view?: 'summary' | 'content';
|
|
3620
|
+
allowContentReferences?: boolean;
|
|
3621
|
+
}
|
|
3622
|
+
interface PersonalKnowledgeRecord {
|
|
3623
|
+
id: string;
|
|
3624
|
+
appCode: string;
|
|
3625
|
+
scope: 'personal';
|
|
3626
|
+
userId: string;
|
|
3627
|
+
title: string;
|
|
3628
|
+
content: string | null;
|
|
3629
|
+
contentDeferred?: boolean;
|
|
3630
|
+
version: number;
|
|
3631
|
+
ragStatus: 'READY' | 'PENDING' | 'UNKNOWN' | 'DELETING' | 'DELETED' | 'DISABLED';
|
|
3632
|
+
ragErrorMessage: string | null;
|
|
3633
|
+
createTime: string | null;
|
|
3634
|
+
updateTime: string | null;
|
|
3635
|
+
}
|
|
3636
|
+
interface PersonalKnowledgeDocument extends PersonalKnowledgeRecord {
|
|
3637
|
+
content: string;
|
|
3638
|
+
}
|
|
3639
|
+
interface PersonalKnowledgePage {
|
|
3640
|
+
tableData: PersonalKnowledgeRecord[];
|
|
3641
|
+
paging: {
|
|
3642
|
+
currentPage: number;
|
|
3643
|
+
pageSize: number;
|
|
3644
|
+
totalCount: number;
|
|
3645
|
+
};
|
|
3646
|
+
tableColumns?: unknown[];
|
|
3647
|
+
execResult?: null;
|
|
3648
|
+
extend?: null;
|
|
3649
|
+
}
|
|
3650
|
+
type KnowledgeSearchScope = 'public' | 'company' | 'personal';
|
|
3651
|
+
interface KnowledgeSearchRequest extends KnowledgeAppRequest {
|
|
3652
|
+
query: string;
|
|
3653
|
+
topK?: number;
|
|
3654
|
+
tags?: string[];
|
|
3655
|
+
scopes?: KnowledgeSearchScope[];
|
|
3656
|
+
}
|
|
3657
|
+
interface KnowledgeSearchHit {
|
|
3658
|
+
documentId: string;
|
|
3659
|
+
revision: number;
|
|
3660
|
+
chunkId: string;
|
|
3661
|
+
scope: KnowledgeSearchScope;
|
|
3662
|
+
title: string;
|
|
3663
|
+
text: string;
|
|
3664
|
+
tags: string[];
|
|
3665
|
+
rank: number;
|
|
3666
|
+
rawScore: number;
|
|
3667
|
+
finalScore: number;
|
|
3668
|
+
scoreKind: string;
|
|
3669
|
+
}
|
|
3670
|
+
/** Native service data. CLI presentation fields deliberately do not belong here. */
|
|
3671
|
+
interface KnowledgeSearchResult {
|
|
3672
|
+
hits: KnowledgeSearchHit[];
|
|
3673
|
+
strategyFingerprint: string;
|
|
3674
|
+
timingsMs: Record<string, number>;
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
type KnowledgeErrorKind = 'validation' | 'auth' | 'http' | 'contract' | 'cancelled' | 'timeout' | 'network';
|
|
3678
|
+
/** Safe to serialize: never attaches credentials, knowledge content or upstream exception text. */
|
|
3679
|
+
declare class KnowledgeServiceError extends LovrabetError {
|
|
3680
|
+
readonly kind: KnowledgeErrorKind;
|
|
3681
|
+
constructor(kind: KnowledgeErrorKind, message: string, options?: {
|
|
3682
|
+
status?: number;
|
|
3683
|
+
code?: string;
|
|
3684
|
+
writeUncertain?: boolean;
|
|
3685
|
+
});
|
|
3686
|
+
readonly writeUncertain: boolean;
|
|
3687
|
+
toJSON(): {
|
|
3688
|
+
kind: KnowledgeErrorKind;
|
|
3689
|
+
writeUncertain: boolean;
|
|
3690
|
+
description: ErrorDescription;
|
|
3691
|
+
cause: unknown;
|
|
3692
|
+
retryAfter?: string;
|
|
3693
|
+
name: string;
|
|
3694
|
+
message: string;
|
|
3695
|
+
status: number;
|
|
3696
|
+
code: string;
|
|
3697
|
+
response: any;
|
|
3698
|
+
};
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
declare const KNOWLEDGE_PATHS: Readonly<{
|
|
3702
|
+
page: "/api/knowledge-base/personal/page";
|
|
3703
|
+
getOne: "/api/knowledge-base/personal/get-one";
|
|
3704
|
+
create: "/api/knowledge-base/personal/create";
|
|
3705
|
+
update: "/api/knowledge-base/personal/update";
|
|
3706
|
+
search: "/api/knowledge-base/search";
|
|
3707
|
+
}>;
|
|
3708
|
+
declare function normalizeKnowledgeServiceOrigin(input: string): string;
|
|
3709
|
+
|
|
3710
|
+
/** Independent KB Service client. Each method makes exactly one request, without orchestration/retries. */
|
|
3711
|
+
declare function createKnowledgeClient(config: KnowledgeClientConfig): {
|
|
3712
|
+
personal: {
|
|
3713
|
+
page(input: PersonalKnowledgePageRequest, options?: KnowledgeRequestOptions): Promise<PersonalKnowledgePage>;
|
|
3714
|
+
getOne(input: PersonalKnowledgeGetRequest, options?: KnowledgeRequestOptions): Promise<PersonalKnowledgeDocument>;
|
|
3715
|
+
create(input: PersonalKnowledgeCreateRequest, options?: KnowledgeRequestOptions): Promise<PersonalKnowledgeDocument>;
|
|
3716
|
+
update(input: PersonalKnowledgeUpdateRequest, options?: KnowledgeRequestOptions): Promise<PersonalKnowledgeDocument>;
|
|
3717
|
+
};
|
|
3718
|
+
search(input: KnowledgeSearchRequest, options?: KnowledgeRequestOptions): Promise<KnowledgeSearchResult>;
|
|
3719
|
+
};
|
|
3720
|
+
type KnowledgeClient = ReturnType<typeof createKnowledgeClient>;
|
|
3721
|
+
|
|
3722
|
+
export { API_PATHS, AbstractBaseModel, ApiNamespace, AppClient, ApprovalClient, ArtifactClient, AuthManager, CONFIG_NAMES, ClientAkBffClient, ClientAkModel, ClientAkSqlClient, DEFAULTS, DatasetMetaClient, ENVIRONMENTS, ERROR_MESSAGES, FileClient, HTTP_STATUS, KNOWLEDGE_PATHS, KnowledgeServiceError, LovrabetError, LovrabetFlowClient, ManagementClient, ModelFactory, OCR_TYPES, OcrClient, OcrType, OpenApiModel, PermitClient, PersonalBffClient, PersonalNamespace, REGIONS, ServicesNamespace, SortOrder, TokenGenerator, WebApiModel, clearAllRegistrations, createAppClient, createClient, createKnowledgeClient, generateFlowOpenApiToken, generateOpenApiToken, getApiEndpoint, getAvailableEnvironments, getAvailableRegions, getRegisteredConfigNames, getRegisteredModels, getTokenRemainingTime, isTokenExpiring, normalizeKnowledgeServiceOrigin, registerModels, safe, sqlSafe, unregisterModels };
|
|
3723
|
+
export type { AggregateField, AggregateParams, AppClientConfig, AppDatasetActionRolePermitVO, AppDatasetPermitVO, AppDatasetRolePermitVO, AppEmployee, AppMenuPermitVO, AppPermitBaseVO, AppResourceMenuParam, AppRoleCreateParam, AppRolePermitQueryParam, AppRoleRequest, AppRoleUpdateParam, AppRoleUserVO, AppRoleVO, AppUserBaseVO, ApprovalFlowApproveRequest, ApprovalFlowIdentityLink, ApprovalFlowTaskDetail, ApprovalFlowTaskItem, ApprovalFlowTransferCandidate, ApprovalFlowTransferRequest, ApprovalTodoQuery, ArtifactListQuery, ArtifactUpsertRequest, AuthMode, BaseModelMethods, BaseRoleVO, ClientAkBffExecuteRequest, ClientConfig, ConditionOperator, CustomSqlQueryRequest, DataList, DatasetDrivenDataQuery, DatasetImportBatchRequest, DatasetImportBatchResult, DatasetImportContract, DatasetImportImageReadbackRequest, DatasetImportImageRequest, DatasetImportImageResult, DatasetImportReadbackRequest, DatasetImportReadbackResult, DatasetMeta, DatasetPermitListVO, DatasetRequest, DatasetRolePermitListVO, EndpointScriptSummary, Environment$1 as Environment, FieldCondition, FileQueryUrlRequest, FileService, FileUploadRequest, FileUploadResponse, FileUrlResponse, FilterParams, FlowBatchTaskActionRequest, FlowBatchTransferRequest, FlowCcQuery, FlowCcRequest, FlowCustomPageCcDetail, FlowCustomPageDefinition, FlowCustomPageStartResponse, FlowCustomPageSubmittedProcess, FlowCustomPageTaskDetail, FlowCustomPageTaskItem, FlowCustomPageTimeline, FlowDefinitionQuery, FlowPage, FlowPageQuery, FlowProcessReasonRequest, FlowRecord, FlowResubmitRequest, FlowReturnRequest, FlowReturnTarget, FlowStartRequest, FlowSubmittedQuery, FlowTaskActionRequest, FlowTransferRequest, FlowUpdateVariablesRequest, FlowVariableProjectionQuery, FlowVariableQuery, GenerateFlowTokenParams, GenerateTokenParams, HavingCondition, KnowledgeAppRequest, KnowledgeClient, KnowledgeClientConfig, KnowledgeErrorKind, KnowledgeRequestOptions, KnowledgeSearchHit, KnowledgeSearchRequest, KnowledgeSearchResult, KnowledgeSearchScope, ListParams, ListResponse, LoginUserInfo, LovrabetClient$1 as LovrabetClient, LovrabetPersonal, LovrabetServices, MenuPermitDTO, MenuRolePermitListVO, MenuRolePermitNodeVO, ModelConfig, ModelsConfig, NotificationChannelConfig, OcrRecognizeRequest, OcrRecognizeResponse, OcrService, PageResult, Paging$1 as Paging, PersonalBffExecuteRequest, PersonalBffScript, PersonalBffService, PersonalBffUpsertRequest, PersonalKnowledgeCreateRequest, PersonalKnowledgeDocument, PersonalKnowledgeGetRequest, PersonalKnowledgePage, PersonalKnowledgePageRequest, PersonalKnowledgeRecord, PersonalKnowledgeUpdateRequest, PersonalRequestOptions, Region, ResourcePermitDTO, ResourcePermitParam, RoleUserUpdateParam, RuntimeArtifactDTO, RuntimeIdentityPermission, SafeResult, ScriptDefinition, ScriptLogQuery, SelectOption, SelectOptionsParams, ServiceRequestOptions, SmartApp, SortList, SqlExecuteRequest, SqlExecuteResult, SqlSafeResult, TokenResult, UserAccountBindRequest, UserAppRelation, UserAppRelationQueryParam, UserCustomSqlDTO, WhereCondition };
|