Skip to content

@codesoul-co/hypha-core / contracts/artifact-events

Using this module

Use the Artifact events module for declaring and runtime-validating contracts. It exports 2 interfaces, 5 types.

Import from the package entrypoint

ts
import type {
  ArtifactEventPayload,
  ArtifactEventPublisher,
  ArtifactEventCreateInput,
  ArtifactEventPayloadMap,
  ArtifactEventPublication,
  ArtifactFrameworkEvent,
  ArtifactFrameworkEventType,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 7 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.

Public exports

SymbolKindSignatureDescription
ArtifactEventPayloadinterfaceinterface ArtifactEventPayloadArtifact Event Payload interface with 19 public fields or methods.
ArtifactEventPublisherinterfaceinterface ArtifactEventPublisherRuntime-owned adapters must durably and idempotently publish by publication ID.
ArtifactEventCreateInputtypetype ArtifactEventCreateInput = Omit<EventCreateInput<ArtifactEventPayloadMap[TType]>, 'type'> & { type: TType; }Public type alias for Artifact Event Create Input; the declaration contains its complete type expression.
ArtifactEventPayloadMaptypetype ArtifactEventPayloadMap = { 'artifact.create.requested': ArtifactEventPayloadWithRequired<'operationId' | 'workspaceId' | 'profileRef'>; 'artifact.created': ArtifactStatusEventPayload<'draft'> & ArtifactEventPayloadWithRequired<'logicalArtifactId' | 'contentHash'>; 'artifact.deduplicated': ArtifactEventPayloadWithRequired<'operationId' | 'artifactId' | 'versionId' | 'contentHash' | 'deduplicated'> & { dedupli...Public type alias for Artifact Event Payload Map; the declaration contains its complete type expression.
ArtifactEventPublicationtypetype ArtifactEventPublication = { id: string; type: TType; timestamp: string; payload: ArtifactEventPayloadMap[TType]; workspaceId?: string; sessionId?: string; runId?: string; agentId?: string; }Public type alias for Artifact Event Publication; the declaration contains its complete type expression.
ArtifactFrameworkEventtypetype ArtifactFrameworkEvent = Omit<FrameworkEvent<ArtifactEventPayloadMap[TType]>, 'type'> & { type: TType; }Public type alias for Artifact Framework Event; the declaration contains its complete type expression.
ArtifactFrameworkEventTypetypetype ArtifactFrameworkEventType = 'artifact.create.requested' | 'artifact.created' | 'artifact.deduplicated' | 'artifact.create.failed' | 'artifact.read.requested' | 'artifact.read.completed' | 'artifact.version.created' | 'artifact.finalized' | 'artifact.archived' | 'artifact.invalidated' | 'artifact.delete.requested' | 'artifact.delete.blocked' | 'artifact.deleted' | 'artifact.delete.failed' | 'artifact.lineage....Public type alias for Artifact Framework Event Type; the declaration contains its complete type expression.

ArtifactEventPayload

Artifact Event Payload interface with 19 public fields or methods.

  • Kind: interface
  • Import: import type { ArtifactEventPayload } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-events

Declaration

text
export interface ArtifactEventPayload {
    operationId?: string;
    artifactId?: string;
    versionId?: string;
    logicalArtifactId?: string;
    profileRef?: SpecRef;
    workspaceId?: string;
    executionId?: string;
    artifactRefs?: string[];
    contentHash?: string;
    sizeBytes?: number;
    status?: ArtifactStatus;
    deduplicated?: boolean;
    candidateObjects?: number;
    deletedObjects?: number;
    missingObjects?: number;
    reclaimedBytes?: number;
    reason?: string;
    error?: NormalizedArtifactError;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
artifactIdpropertyartifactId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
candidateObjectspropertycandidateObjects?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
contentHashpropertycontentHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
deduplicatedpropertydeduplicated?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
deletedObjectspropertydeletedObjects?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: NormalizedArtifactErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
executionIdpropertyexecutionId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
logicalArtifactIdpropertylogicalArtifactId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
missingObjectspropertymissingObjects?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRefpropertyprofileRef?: SpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reclaimedBytespropertyreclaimedBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
sizeBytespropertysizeBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus?: ArtifactStatusPublic property; its type, readonly modifier and optionality are shown in the signature.
versionIdpropertyversionId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceIdpropertyworkspaceId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ArtifactEventPublisher

Runtime-owned adapters must durably and idempotently publish by publication ID.

  • Kind: interface
  • Import: import type { ArtifactEventPublisher } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-events

Declaration

text
export interface ArtifactEventPublisher {
    publish(publication: ArtifactEventPublication): Promise<void>;
}

Contract members

MemberKindSignatureDescription
publishmethodpublish(publication: ArtifactEventPublication): Promise<void>Public method; parameters and return type are shown in the signature.

ArtifactEventCreateInput

Public type alias for Artifact Event Create Input; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ArtifactEventCreateInput } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-events

Declaration

text
export type ArtifactEventCreateInput<TType extends ArtifactFrameworkEventType = ArtifactFrameworkEventType> = Omit<EventCreateInput<ArtifactEventPayloadMap[TType]>, 'type'> & {
    type: TType;
};

ArtifactEventPayloadMap

Public type alias for Artifact Event Payload Map; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ArtifactEventPayloadMap } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-events

Declaration

text
export type ArtifactEventPayloadMap = {
    'artifact.create.requested': ArtifactEventPayloadWithRequired<'operationId' | 'workspaceId' | 'profileRef'>;
    'artifact.created': ArtifactStatusEventPayload<'draft'> & ArtifactEventPayloadWithRequired<'logicalArtifactId' | 'contentHash'>;
    'artifact.deduplicated': ArtifactEventPayloadWithRequired<'operationId' | 'artifactId' | 'versionId' | 'contentHash' | 'deduplicated'> & {
        deduplicated: true;
    };
    'artifact.create.failed': ArtifactEventPayloadWithRequired<'operationId' | 'error'>;
    'artifact.read.requested': ArtifactEventPayloadWithRequired<'artifactId'>;
    'artifact.read.completed': ArtifactEventPayloadWithRequired<'artifactId' | 'versionId' | 'contentHash' | 'sizeBytes'>;
    'artifact.version.created': ArtifactEventPayloadWithRequired<'operationId' | 'artifactId' | 'versionId' | 'logicalArtifactId' | 'contentHash' | 'status'>;
    'artifact.finalized': ArtifactStatusEventPayload<'final'>;
    'artifact.archived': ArtifactStatusEventPayload<'archived'>;
    'artifact.invalidated': ArtifactStatusEventPayload<'invalidated'>;
    'artifact.delete.requested': ArtifactEventPayloadWithRequired<'operationId' | 'artifactId'>;
    'artifact.delete.blocked': ArtifactEventPayloadWithRequired<'operationId' | 'artifactId' | 'error'>;
    'artifact.deleted': ArtifactEventPayloadWithRequired<'operationId' | 'artifactId' | 'status'> & {
        status: 'deleted';
    };
    'artifact.delete.failed': ArtifactEventPayloadWithRequired<'operationId' | 'artifactId' | 'error'>;
    'artifact.lineage.recorded': ArtifactEventPayloadWithRequired<'artifactId' | 'artifactRefs'>;
    'artifact.retention.expired': ArtifactEventPayloadWithRequired<'artifactId' | 'versionId'>;
    'artifact.gc.completed': ArtifactEventPayloadWithRequired<'operationId' | 'candidateObjects' | 'deletedObjects' | 'missingObjects' | 'reclaimedBytes'>;
    'artifact.gc.failed': ArtifactEventPayloadWithRequired<'operationId' | 'error'>;
};

ArtifactEventPublication

Public type alias for Artifact Event Publication; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ArtifactEventPublication } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-events

Declaration

text
export type ArtifactEventPublication<TType extends ArtifactFrameworkEventType = ArtifactFrameworkEventType> = {
    id: string;
    type: TType;
    timestamp: string;
    payload: ArtifactEventPayloadMap[TType];
    workspaceId?: string;
    sessionId?: string;
    runId?: string;
    agentId?: string;
};

ArtifactFrameworkEvent

Public type alias for Artifact Framework Event; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ArtifactFrameworkEvent } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-events

Declaration

text
export type ArtifactFrameworkEvent<TType extends ArtifactFrameworkEventType = ArtifactFrameworkEventType> = Omit<FrameworkEvent<ArtifactEventPayloadMap[TType]>, 'type'> & {
    type: TType;
};

ArtifactFrameworkEventType

Public type alias for Artifact Framework Event Type; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ArtifactFrameworkEventType } from '@codesoul-co/hypha-core';
  • Source module: contracts/artifact-events

Declaration

text
export type ArtifactFrameworkEventType = 'artifact.create.requested' | 'artifact.created' | 'artifact.deduplicated' | 'artifact.create.failed' | 'artifact.read.requested' | 'artifact.read.completed' | 'artifact.version.created' | 'artifact.finalized' | 'artifact.archived' | 'artifact.invalidated' | 'artifact.delete.requested' | 'artifact.delete.blocked' | 'artifact.deleted' | 'artifact.delete.failed' | 'artifact.lineage.recorded' | 'artifact.retention.expired' | 'artifact.gc.completed' | 'artifact.gc.failed';