feat(tasks): inline ARTIFACT/SESSION links in the context bundle

The context bundle resolved only TASK and DOC link targets; ARTIFACT and
SESSION stayed raw. Add two ports (TaskArtifactResolver/TaskSessionResolver)
with apps/server adapters: artifacts resolve to producing stage/session +
content excerpt from CAS, sessions to status/intent/workflow. Unresolved
targets still fall back to raw links. Wired through the tool and REST bundle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 19:59:18 +00:00
parent 6e044d0ab9
commit 6b00d89c2c
12 changed files with 364 additions and 39 deletions
@@ -1,26 +1,33 @@
package com.correx.infrastructure.tools.task
import com.correx.core.tasks.TaskArtifactResolver
import com.correx.core.tasks.TaskContextAssembler
import com.correx.core.tasks.TaskDocumentResolver
import com.correx.core.tasks.TaskKnowledgeRetriever
import com.correx.core.tasks.TaskService
import com.correx.core.tasks.TaskSessionResolver
import com.correx.core.tools.contract.Tool
/** Builds the task tool set over a single [TaskService] for registration in the tool registry. */
object TaskTools {
/**
* [retriever] semantically enriches the `task_context` bundle; [documentResolver] inlines
* linked ADRs/docs. Both optional — null leaves the bundle deterministic.
* [retriever] semantically enriches the `task_context` bundle; [documentResolver],
* [artifactResolver] and [sessionResolver] inline DOC/ARTIFACT/SESSION link targets. All
* optional — null leaves those links raw and the bundle deterministic.
*/
fun forService(
service: TaskService,
retriever: TaskKnowledgeRetriever? = null,
documentResolver: TaskDocumentResolver? = null,
artifactResolver: TaskArtifactResolver? = null,
sessionResolver: TaskSessionResolver? = null,
): List<Tool> =
listOf(
TaskCreateTool(service),
TaskUpdateTool(service),
TaskDeleteTool(service),
TaskContextTool(TaskContextAssembler(service, retriever, documentResolver)),
TaskContextTool(
TaskContextAssembler(service, retriever, documentResolver, artifactResolver, sessionResolver),
),
)
}