Skip to content

@codesoul-co/hypha-adapters-local / legacy-tool-artifact-inventory

模块用法

用于使用该功能边界的公共契约与操作。Legacy tool artifact inventory 模块公开 2 类、3 接口、1 类型。

从包入口导入

ts
import {
  LegacyToolArtifactInventory,
  LegacyToolArtifactInventoryError,
} from '@codesoul-co/hypha-adapters-local';

import type {
  LegacyToolArtifactInventoryEntry,
  LegacyToolArtifactInventoryOptions,
  LegacyToolArtifactInventoryResult,
  LegacyToolArtifactInventoryErrorCode,
} from '@codesoul-co/hypha-adapters-local';

使用要点

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

公共导出

Symbol种类签名说明
LegacyToolArtifactInventorynew LegacyToolArtifactInventory(options: LegacyToolArtifactInventoryOptions): LegacyToolArtifactInventoryBuilds a deterministic, bounded, read-only inventory of old Tool outputs.
LegacyToolArtifactInventoryErrornew LegacyToolArtifactInventoryError(code: LegacyToolArtifactInventoryErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactInventoryErrorLegacy Tool Artifact Inventory Error 类,共公开 10 个构造函数或成员;精确签名见本条目的声明与成员表。
LegacyToolArtifactInventoryEntry接口interface LegacyToolArtifactInventoryEntryDescribes an old Tool output without treating sanitized path segments as authoritative Tool or Invocation identities.
LegacyToolArtifactInventoryOptions接口interface LegacyToolArtifactInventoryOptionsLegacy Tool Artifact Inventory Options 接口,共包含 4 个公开字段或方法。
LegacyToolArtifactInventoryResult接口interface LegacyToolArtifactInventoryResultLegacy Tool Artifact Inventory Result 接口,共包含 2 个公开字段或方法。
LegacyToolArtifactInventoryErrorCode类型type LegacyToolArtifactInventoryErrorCode = 'LEGACY_INVENTORY_INVALID_ROOT' | 'LEGACY_INVENTORY_INVALID_LAYOUT' | 'LEGACY_INVENTORY_LIMIT_EXCEEDED' | 'LEGACY_INVENTORY_SOURCE_CHANGED'Legacy Tool Artifact Inventory Error Code 公共类型别名;完整类型表达式见声明。

LegacyToolArtifactInventory

Builds a deterministic, bounded, read-only inventory of old Tool outputs.

声明

text
export declare class LegacyToolArtifactInventory {
    constructor(options: LegacyToolArtifactInventoryOptions);
    scan(): Promise<LegacyToolArtifactInventoryResult>;
}

公开成员

成员种类签名说明
constructor构造函数(options: LegacyToolArtifactInventoryOptions): LegacyToolArtifactInventory创建该类的实例。
scan方法scan(): Promise<LegacyToolArtifactInventoryResult>公开方法;参数与返回类型以签名列为准。

LegacyToolArtifactInventoryError

Legacy Tool Artifact Inventory Error 类,共公开 10 个构造函数或成员;精确签名见本条目的声明与成员表。

声明

text
export declare class LegacyToolArtifactInventoryError extends Error {
    readonly code: LegacyToolArtifactInventoryErrorCode;
    readonly details?: Record<string, unknown> | undefined;
    constructor(code: LegacyToolArtifactInventoryErrorCode, message: string, details?: Record<string, unknown> | undefined);
}

公开成员

成员种类签名说明
cause属性cause?: unknown公开属性;类型、只读和可选状态以签名列为准。
code属性readonly code: LegacyToolArtifactInventoryErrorCode公开属性;类型、只读和可选状态以签名列为准。
constructor构造函数(code: LegacyToolArtifactInventoryErrorCode, message: string, details?: Record<string, unknown> | undefined): LegacyToolArtifactInventoryError创建该类的实例。
details属性readonly details?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
message属性message: string公开属性;类型、只读和可选状态以签名列为准。
name属性name: string公开属性;类型、只读和可选状态以签名列为准。
stack属性stack?: string公开属性;类型、只读和可选状态以签名列为准。
static captureStackTrace方法static captureStackTrace(targetObject: object, constructorOpt?: Function): voidCreates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called. js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}. The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance: js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a();
static prepareStackTrace方法static prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any公开方法;参数与返回类型以签名列为准。
static stackTraceLimit属性static stackTraceLimit: numberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

LegacyToolArtifactInventoryEntry

Describes an old Tool output without treating sanitized path segments as authoritative Tool or Invocation identities.

  • 种类: 接口
  • 导入: import type { LegacyToolArtifactInventoryEntry } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: legacy-tool-artifact-inventory

声明

text
export interface LegacyToolArtifactInventoryEntry {
    relativePath: string;
    legacyArtifactId: string;
    contentHash: string;
    sizeBytes: number;
    mimeType: 'application/json' | 'text/plain';
    legacyToolPathSegment: string;
    legacyInvocationPathSegment: string;
}

契约成员

成员种类签名说明
contentHash属性contentHash: string公开属性;类型、只读和可选状态以签名列为准。
legacyArtifactId属性legacyArtifactId: string公开属性;类型、只读和可选状态以签名列为准。
legacyInvocationPathSegment属性legacyInvocationPathSegment: string公开属性;类型、只读和可选状态以签名列为准。
legacyToolPathSegment属性legacyToolPathSegment: string公开属性;类型、只读和可选状态以签名列为准。
mimeType属性mimeType: "application/json" | "text/plain"公开属性;类型、只读和可选状态以签名列为准。
relativePath属性relativePath: string公开属性;类型、只读和可选状态以签名列为准。
sizeBytes属性sizeBytes: number公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactInventoryOptions

Legacy Tool Artifact Inventory Options 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { LegacyToolArtifactInventoryOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: legacy-tool-artifact-inventory

声明

text
export interface LegacyToolArtifactInventoryOptions {
    legacyRootPath: string;
    maxEntries?: number;
    maxFileBytes?: number;
    maxTotalBytes?: number;
}

契约成员

成员种类签名说明
legacyRootPath属性legacyRootPath: string公开属性;类型、只读和可选状态以签名列为准。
maxEntries属性maxEntries?: number公开属性;类型、只读和可选状态以签名列为准。
maxFileBytes属性maxFileBytes?: number公开属性;类型、只读和可选状态以签名列为准。
maxTotalBytes属性maxTotalBytes?: number公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactInventoryResult

Legacy Tool Artifact Inventory Result 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { LegacyToolArtifactInventoryResult } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: legacy-tool-artifact-inventory

声明

text
export interface LegacyToolArtifactInventoryResult {
    entries: LegacyToolArtifactInventoryEntry[];
    totalBytes: number;
}

契约成员

成员种类签名说明
entries属性entries: LegacyToolArtifactInventoryEntry[]公开属性;类型、只读和可选状态以签名列为准。
totalBytes属性totalBytes: number公开属性;类型、只读和可选状态以签名列为准。

LegacyToolArtifactInventoryErrorCode

Legacy Tool Artifact Inventory Error Code 公共类型别名;完整类型表达式见声明。

  • 种类: 类型
  • 导入: import type { LegacyToolArtifactInventoryErrorCode } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: legacy-tool-artifact-inventory

声明

text
export type LegacyToolArtifactInventoryErrorCode = 'LEGACY_INVENTORY_INVALID_ROOT' | 'LEGACY_INVENTORY_INVALID_LAYOUT' | 'LEGACY_INVENTORY_LIMIT_EXCEEDED' | 'LEGACY_INVENTORY_SOURCE_CHANGED';