Skip to content

@codesoul-co/hypha-skills / remote-registry

模块用法

用于注册并解析版本化能力或实现。Remote registry 模块公开 1 类、8 接口。

从包入口导入

ts
import {
  HttpsSkillRegistryClient,
} from '@codesoul-co/hypha-skills';

import type {
  HttpsSkillRegistryClientOptions,
  SignedSkillRegistryEntry,
  SkillDependencyLock,
  SkillRegistryPage,
  SkillSbomRef,
  SkillSupplyChainManifest,
  SkillTransparencyProof,
  VerifiedSkillBundle,
} from '@codesoul-co/hypha-skills';

使用要点

  • 8 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 1 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。

公共导出

Symbol种类签名说明
HttpsSkillRegistryClientnew HttpsSkillRegistryClient(options: HttpsSkillRegistryClientOptions): HttpsSkillRegistryClientHTTPS registry client that verifies publisher identity and transparency inclusion.
HttpsSkillRegistryClientOptions接口interface HttpsSkillRegistryClientOptionsHttps Skill Registry Client Options 接口,共包含 13 个公开字段或方法。
SignedSkillRegistryEntry接口interface SignedSkillRegistryEntrySigned Skill Registry Entry 接口,共包含 3 个公开字段或方法。
SkillDependencyLock接口interface SkillDependencyLockSkill Dependency Lock 接口,共包含 3 个公开字段或方法。
SkillRegistryPage接口interface SkillRegistryPageSkill Registry Page 接口,共包含 3 个公开字段或方法。
SkillSbomRef接口interface SkillSbomRefSkill Sbom Ref 接口,共包含 3 个公开字段或方法。
SkillSupplyChainManifest接口interface SkillSupplyChainManifestSkill Supply Chain Manifest 接口,共包含 11 个公开字段或方法。
SkillTransparencyProof接口interface SkillTransparencyProofSkill Transparency Proof 接口,共包含 5 个公开字段或方法。
VerifiedSkillBundle接口interface VerifiedSkillBundleVerified Skill Bundle 接口,共包含 2 个公开字段或方法。

HttpsSkillRegistryClient

HTTPS registry client that verifies publisher identity and transparency inclusion.

  • 种类: 类
  • 导入: import { HttpsSkillRegistryClient } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export declare class HttpsSkillRegistryClient {
    constructor(options: HttpsSkillRegistryClientOptions);
    resolve(skillId: string, version: string): Promise<SignedSkillRegistryEntry>;
    list(input?: {
            cursor?: string;
            limit?: number;
        }): Promise<SkillRegistryPage>;
    download(entryInput: SignedSkillRegistryEntry): Promise<VerifiedSkillBundle>;
    verifyOfflineBundle(bundle: VerifiedSkillBundle): VerifiedSkillBundle;
}

公开成员

成员种类签名说明
constructor构造函数(options: HttpsSkillRegistryClientOptions): HttpsSkillRegistryClient创建该类的实例。
download方法download(entryInput: SignedSkillRegistryEntry): Promise<VerifiedSkillBundle>公开方法;参数与返回类型以签名列为准。
list方法list(input?: { cursor?: string; limit?: number; }): Promise<SkillRegistryPage>公开方法;参数与返回类型以签名列为准。
resolve方法resolve(skillId: string, version: string): Promise<SignedSkillRegistryEntry>公开方法;参数与返回类型以签名列为准。
verifyOfflineBundle方法verifyOfflineBundle(bundle: VerifiedSkillBundle): VerifiedSkillBundle公开方法;参数与返回类型以签名列为准。

HttpsSkillRegistryClientOptions

Https Skill Registry Client Options 接口,共包含 13 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { HttpsSkillRegistryClientOptions } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface HttpsSkillRegistryClientOptions {
    endpoint: string;
    publisherKeys: Readonly<Record<string, string>>;
    transparencyLogKeys: Readonly<Record<string, string>>;
    tenantId?: string;
    authorization?: () => string | Promise<string>;
    artifactOrigins?: string[];
    maxMetadataBytes?: number;
    maxBundleBytes?: number;
    timeoutMs?: number;
    maxAttempts?: number;
    fetch?: typeof fetch;
    now?: () => number;
    sleep?: (ms: number) => Promise<void>;
}

契约成员

成员种类签名说明
artifactOrigins属性artifactOrigins?: string[]公开属性;类型、只读和可选状态以签名列为准。
authorization方法authorization?(): string | Promise<string>公开方法;参数与返回类型以签名列为准。
endpoint属性endpoint: string公开属性;类型、只读和可选状态以签名列为准。
fetch方法fetch?(input: RequestInfo | URL, init?: RequestInit): Promise<Response> | fetch?(input: string | URL | Request, init?: RequestInit): Promise<Response>公开方法;参数与返回类型以签名列为准。
maxAttempts属性maxAttempts?: number公开属性;类型、只读和可选状态以签名列为准。
maxBundleBytes属性maxBundleBytes?: number公开属性;类型、只读和可选状态以签名列为准。
maxMetadataBytes属性maxMetadataBytes?: number公开属性;类型、只读和可选状态以签名列为准。
now方法now?(): number公开方法;参数与返回类型以签名列为准。
publisherKeys属性publisherKeys: Readonly<Record<string, string>>公开属性;类型、只读和可选状态以签名列为准。
sleep方法sleep?(ms: number): Promise<void>公开方法;参数与返回类型以签名列为准。
tenantId属性tenantId?: string公开属性;类型、只读和可选状态以签名列为准。
timeoutMs属性timeoutMs?: number公开属性;类型、只读和可选状态以签名列为准。
transparencyLogKeys属性transparencyLogKeys: Readonly<Record<string, string>>公开属性;类型、只读和可选状态以签名列为准。

SignedSkillRegistryEntry

Signed Skill Registry Entry 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SignedSkillRegistryEntry } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface SignedSkillRegistryEntry {
    manifest: SkillSupplyChainManifest;
    publisherSignature: string;
    transparency: SkillTransparencyProof;
}

契约成员

成员种类签名说明
manifest属性manifest: SkillSupplyChainManifest公开属性;类型、只读和可选状态以签名列为准。
publisherSignature属性publisherSignature: string公开属性;类型、只读和可选状态以签名列为准。
transparency属性transparency: SkillTransparencyProof公开属性;类型、只读和可选状态以签名列为准。

SkillDependencyLock

Skill Dependency Lock 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SkillDependencyLock } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface SkillDependencyLock {
    id: string;
    version: string;
    contentSha256: string;
}

契约成员

成员种类签名说明
contentSha256属性contentSha256: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

SkillRegistryPage

Skill Registry Page 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SkillRegistryPage } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface SkillRegistryPage {
    entries: SignedSkillRegistryEntry[];
    nextCursor?: string;
    revision?: string;
}

契约成员

成员种类签名说明
entries属性entries: SignedSkillRegistryEntry[]公开属性;类型、只读和可选状态以签名列为准。
nextCursor属性nextCursor?: string公开属性;类型、只读和可选状态以签名列为准。
revision属性revision?: string公开属性;类型、只读和可选状态以签名列为准。

SkillSbomRef

Skill Sbom Ref 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SkillSbomRef } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface SkillSbomRef {
    format: 'cyclonedx-json' | 'spdx-json';
    sha256: string;
    url?: string;
}

契约成员

成员种类签名说明
format属性format: "cyclonedx-json" | "spdx-json"公开属性;类型、只读和可选状态以签名列为准。
sha256属性sha256: string公开属性;类型、只读和可选状态以签名列为准。
url属性url?: string公开属性;类型、只读和可选状态以签名列为准。

SkillSupplyChainManifest

Skill Supply Chain Manifest 接口,共包含 11 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SkillSupplyChainManifest } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface SkillSupplyChainManifest {
    skillId: string;
    version: string;
    revision?: string;
    contentSha256: string;
    downloadUrl: string;
    publisherId: string;
    issuedAt: string;
    expiresAt?: string;
    tenantIds?: string[];
    dependencies: SkillDependencyLock[];
    sbom: SkillSbomRef;
}

契约成员

成员种类签名说明
contentSha256属性contentSha256: string公开属性;类型、只读和可选状态以签名列为准。
dependencies属性dependencies: SkillDependencyLock[]公开属性;类型、只读和可选状态以签名列为准。
downloadUrl属性downloadUrl: string公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
issuedAt属性issuedAt: string公开属性;类型、只读和可选状态以签名列为准。
publisherId属性publisherId: string公开属性;类型、只读和可选状态以签名列为准。
revision属性revision?: string公开属性;类型、只读和可选状态以签名列为准。
sbom属性sbom: SkillSbomRef公开属性;类型、只读和可选状态以签名列为准。
skillId属性skillId: string公开属性;类型、只读和可选状态以签名列为准。
tenantIds属性tenantIds?: string[]公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

SkillTransparencyProof

Skill Transparency Proof 接口,共包含 5 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SkillTransparencyProof } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface SkillTransparencyProof {
    logId: string;
    logIndex: number;
    entryHash: string;
    checkpointHash: string;
    signature: string;
}

契约成员

成员种类签名说明
checkpointHash属性checkpointHash: string公开属性;类型、只读和可选状态以签名列为准。
entryHash属性entryHash: string公开属性;类型、只读和可选状态以签名列为准。
logId属性logId: string公开属性;类型、只读和可选状态以签名列为准。
logIndex属性logIndex: number公开属性;类型、只读和可选状态以签名列为准。
signature属性signature: string公开属性;类型、只读和可选状态以签名列为准。

VerifiedSkillBundle

Verified Skill Bundle 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { VerifiedSkillBundle } from '@codesoul-co/hypha-skills';
  • 源码模块: remote-registry

声明

text
export interface VerifiedSkillBundle {
    entry: SignedSkillRegistryEntry;
    content: Uint8Array;
}

契约成员

成员种类签名说明
content属性content: Uint8Array<ArrayBufferLike>公开属性;类型、只读和可选状态以签名列为准。
entry属性entry: SignedSkillRegistryEntry公开属性;类型、只读和可选状态以签名列为准。