core

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package core contains gollem tools that operate on the case's domain state — currently actions. Slack and Notion integrations live in their own tool packages (pkg/agent/tool/slack, pkg/agent/tool/notion); this package intentionally has no dependency on either external service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(deps Deps) []gollem.Tool

New builds core tools for the agent mention use case: action management. deps.StatusSet may be nil; it falls back to model.DefaultActionStatusSet().

func NewForAssist

func NewForAssist(deps Deps) []gollem.Tool

NewForAssist builds tools for the assist use case. Currently identical to New(); kept as a separate factory so future assist-only tools can be added without touching the mention flow.

func NewReadOnly

func NewReadOnly(deps Deps) []gollem.Tool

NewReadOnly builds the read-only subset of the core tool family. This is what investigation sub-agents (draft mode) get: list / get tools only, no creation, no status mutation, no archival.

ActionUC is not used and may be nil. ActionStepUC is consulted only for list_action_steps (a read operation in mutator clothing); the step tool is included only when the mutator is wired so we never crash a sub-agent that has no step backend hooked up.

func NewWriterForJob

func NewWriterForJob(deps Deps) []gollem.Tool

NewWriterForJob builds the writer subset of the core tool family suitable for event-driven Agent Jobs. It exposes creation and edit tools but withholds the destructive variants (archive/unarchive/delete_action_step) — Jobs run unattended and an auto-archive flag from a misjudgement is strictly worse than leaving the action in place for a human to triage.

Read-only list / get / list_action_steps are not included; combine with NewReadOnly when both sides are needed.

Types

type ActionMutator

type ActionMutator interface {
	// CreateAction is invoked by core__create_action.
	CreateAction(ctx context.Context, workspaceID string, caseID int64, title, description string, assigneeID string, slackMessageTS string, status types.ActionStatus, dueDate *time.Time) (*model.Action, error)
	// UpdateAction is invoked by core__update_action,
	// core__update_action_status and core__set_action_assignee. The caller
	// fills only the fields it intends to change; the implementation must
	// translate this into the full UpdateAction usecase contract (system
	// actor, full Slack sync) so tool-driven edits behave identically to
	// GraphQL / Slack-modal edits.
	UpdateAction(ctx context.Context, workspaceID string, actionID int64, params UpdateActionParams) (*model.Action, error)
	// ArchiveAction is invoked by core__archive_action.
	ArchiveAction(ctx context.Context, workspaceID string, actionID int64) (*model.Action, error)
	// UnarchiveAction is invoked by core__unarchive_action.
	UnarchiveAction(ctx context.Context, workspaceID string, actionID int64) (*model.Action, error)
}

ActionMutator is the narrow surface of the ActionUseCase that the action mutation core tools depend on. Defined here so each tool can route through the unified usecase entry point (which handles Slack post / refresh, ActionEvent recording, access control, and any future side-effects) without taking a dependency on the entire usecase package — that would create an import cycle, since pkg/usecase already imports pkg/agent/tool/core.

type ActionStepMutator

type ActionStepMutator interface {
	List(ctx context.Context, workspaceID string, actionID int64) ([]*model.ActionStep, error)
	Add(ctx context.Context, workspaceID string, actionID int64, title string) (*model.ActionStep, error)
	SetDone(ctx context.Context, workspaceID string, actionID int64, stepID string, done bool) (*model.ActionStep, error)
	Rename(ctx context.Context, workspaceID string, actionID int64, stepID string, title string) (*model.ActionStep, error)
	Delete(ctx context.Context, workspaceID string, actionID int64, stepID string) error
}

ActionStepMutator is the narrow surface of ActionStepUseCase that the step mutation core tools depend on. The caller does not pass an actor; the adapter pins it to ActorKindSystem so tool-driven changes are not @-mentioning anyone.

type CaseRefReader

type CaseRefReader interface {
	// ReferenceWorkspaceForField resolves the field's configured
	// reference_workspace from the current case's workspace schema, erroring
	// when fieldID is unknown or not a case_ref field.
	ReferenceWorkspaceForField(workspaceID, fieldID string) (string, error)
	// ListReferenceableCases returns non-private, non-draft candidate cases in
	// the reference workspace (picker/search summaries).
	ListReferenceableCases(ctx context.Context, workspaceID, query string, limit int) ([]model.CaseRef, error)
	// GetReferenceableCases batch-fetches full non-private, non-draft cases by
	// ID from the reference workspace.
	GetReferenceableCases(ctx context.Context, workspaceID string, ids []int64) ([]*model.Case, error)
	// RenderCaseFieldValues flattens a case's field values, resolving nested
	// case_ref values to {id,title,status} one level deep.
	RenderCaseFieldValues(ctx context.Context, workspaceID string, fieldValues map[string]model.FieldValue) (map[string]any, error)
}

CaseRefReader is the narrow surface of CaseUseCase that the case_ref read tools (core__search_referenceable_cases / core__get_referenceable_cases) depend on. Defined here to avoid importing pkg/usecase (which already imports this package). All methods enforce the project rule that private and draft Cases are never referenceable.

type Deps

type Deps struct {
	Repo        interfaces.Repository
	WorkspaceID string
	CaseID      int64
	StatusSet   *model.ActionStatusSet
	// ActionUC routes core__create_action / core__update_action /
	// core__update_action_status / core__set_action_assignee through the
	// unified usecase entry points. Required: tools fail loudly when this
	// is nil rather than silently degrade to the legacy repository-direct
	// path, which would skip Slack notifications and ActionEvent records.
	ActionUC ActionMutator
	// ActionStepUC routes the core__*_action_step tools through the unified
	// ActionStepUseCase entry points. Required for the same reason as
	// ActionUC; tools fail loudly when nil.
	ActionStepUC ActionStepMutator
	// CaseRefUC backs the case_ref read tools. nil disables them (a
	// workspace with no case_ref fields needs nothing here); the tools
	// are only built when this is wired.
	CaseRefUC CaseRefReader
}

Deps groups the dependencies the core tool factories need.

type UpdateActionParams

type UpdateActionParams struct {
	Title         *string
	Description   *string
	AssigneeID    *string
	Status        *types.ActionStatus
	DueDate       *time.Time
	ClearAssignee bool
	ClearDueDate  bool
}

UpdateActionParams describes a partial Action update from the agent tool path. nil pointer means "no change". Empty pointer plus its corresponding Clear* flag is how the caller asks for an explicit clear (e.g. the user wants to unassign an action, not just leave the field alone).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL