Lux.Company.ExecutionEngine.ArtifactStore (Lux v0.5.0)

View Source

In-memory store for managing artifacts produced during objective execution.

This module is responsible for:

  • Storing and retrieving artifacts in memory
  • Tracking artifact metadata and relationships
  • Providing access to artifacts across steps
  • Extensive logging of artifact operations

Summary

Functions

Adds tags to an artifact.

Returns a specification to start this module under a supervisor.

Retrieves an artifact by ID.

Lists all artifacts with optional filtering.

Lists all artifacts for a specific step.

Starts a new ArtifactStore for an objective.

Types

artifact()

@type artifact() :: %{
  id: artifact_id(),
  name: String.t(),
  content: term(),
  content_type: String.t(),
  metadata: map(),
  created_by: task_id(),
  created_at: DateTime.t(),
  step_id: step_id(),
  tags: [String.t()]
}

artifact_id()

@type artifact_id() :: String.t()

state()

@type state() :: %{
  objective_id: String.t(),
  artifacts: %{required(artifact_id()) => artifact()},
  step_artifacts: %{required(step_id()) => MapSet.t(artifact_id())},
  company_pid: pid()
}

step_id()

@type step_id() :: String.t()

task_id()

@type task_id() :: String.t()

Functions

add_tags(store, artifact_id, tags)

Adds tags to an artifact.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_artifact(store, artifact_id)

Retrieves an artifact by ID.

list_artifacts(store, opts \\ [])

Lists all artifacts with optional filtering.

Options

  • :tags - List of tags to filter by (all must match)
  • :content_type - Filter by content type
  • :created_by - Filter by task ID

list_step_artifacts(store, step_id)

Lists all artifacts for a specific step.

start_link(opts)

Starts a new ArtifactStore for an objective.

Options

  • :objective_id - The ID of the objective these artifacts belong to
  • :company_pid - PID of the company process for notifications

store_artifact(store, name, content, content_type, opts \\ [])

Stores a new artifact.

Parameters

  • store: The ArtifactStore pid
  • name: Name of the artifact
  • content: The artifact content (any term)
  • content_type: MIME type or format identifier
  • opts: Additional options
    • :metadata - Additional metadata map
    • :tags - List of tags
    • :step_id - ID of the step that created the artifact
    • :task_id - ID of the task that created the artifact

update_metadata(store, artifact_id, metadata)

Updates artifact metadata.