worker: rename internal worker purpose to slug

This commit is contained in:
Keisuke Hirata 2026-07-18 06:11:44 +09:00
parent 88b91a2c55
commit 62dbed8075
No known key found for this signature in database
3 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@ Protocol に外部 API として載せる段階ではない。まず Worker 内
- Worker 内部に reusable internal worker runner を追加する。
- runner は少なくとも次を受け取れる。
- purpose / name。
- slug / name。
- system prompt。
- initial user input。
- tool definitions / limited tool registry。

View File

@ -14,8 +14,8 @@ use llm_engine::{Engine, EngineError};
/// Specification for a single internal worker run.
pub(crate) struct InternalWorkerSpec {
/// Stable purpose label for audit/debug/persistence metadata.
pub purpose: &'static str,
/// Stable slug for audit/debug/future persistence metadata.
pub slug: &'static str,
/// System prompt for the isolated engine.
pub system_prompt: String,
/// Initial user input for the isolated engine.
@ -33,7 +33,7 @@ pub(crate) struct InternalWorkerSpec {
/// Result metadata for an internal worker run.
#[derive(Debug, Clone, Default)]
pub(crate) struct InternalWorkerRunResult {
pub purpose: &'static str,
pub slug: &'static str,
/// Last usage event observed for this internal run.
pub usage: Option<UsageEvent>,
}
@ -41,7 +41,7 @@ pub(crate) struct InternalWorkerRunResult {
/// Error metadata for an internal worker run.
#[derive(Debug)]
pub(crate) struct InternalWorkerRunError {
pub purpose: &'static str,
pub slug: &'static str,
pub source: EngineError,
/// Last usage event observed before the failure, if any.
pub usage: Option<UsageEvent>,
@ -52,7 +52,7 @@ pub(crate) async fn run_internal_worker(
spec: InternalWorkerSpec,
) -> Result<InternalWorkerRunResult, InternalWorkerRunError> {
let InternalWorkerSpec {
purpose,
slug,
system_prompt,
input,
client,
@ -82,9 +82,9 @@ pub(crate) async fn run_internal_worker(
.clone();
match run_result {
Ok(_output) => Ok(InternalWorkerRunResult { purpose, usage }),
Ok(_output) => Ok(InternalWorkerRunResult { slug, usage }),
Err(source) => Err(InternalWorkerRunError {
purpose,
slug,
source,
usage,
}),

View File

@ -3133,7 +3133,7 @@ impl<C: LlmClient, St: Store> Worker<C, St> {
let ctx = Arc::new(extract::ExtractWorkerContext::new());
let input_text = extract::build_extract_input(&items_to_extract);
let internal_result = run_internal_worker(InternalWorkerSpec {
purpose: "memory_extract",
slug: "memory-extract",
system_prompt: extract_system_prompt,
input: input_text,
client,