这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions kubechain/api/v1alpha1/taskrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@ type Message struct {
// +optional
ToolCallId string `json:"toolCallId,omitempty"`

// Name is the name of the tool call
// +optional
Name string `json:"name,omitempty"`
// Todo(dex) what is this? This is used in the OpenAI converter but I think this is supposed to be in a ToolCall

// Type is the type of tool call
// +kubebuilder:validation:Enum=function
Type string `json:"type,omitempty"`

// Arguments is the arguments to pass to the tool call
// Name is the name of the tool that was called
// +optional
Arguments string `json:"arguments,omitempty"`
Name string `json:"name,omitempty"`
}

// ToolCall represents a request to call a tool
Expand Down Expand Up @@ -90,8 +84,8 @@ type TaskRunStatus struct {
Ready bool `json:"ready,omitempty"`

// Status indicates the current status of the taskrun
// +kubebuilder:validation:Enum=Ready;Error;Pending;Initializing
Status string `json:"status,omitempty"`
// +kubebuilder:validation:Enum=Ready;Error;Pending
Status TaskRunStatusStatus `json:"status,omitempty"`

// StatusDetail provides additional details about the current status
StatusDetail string `json:"statusDetail,omitempty"`
Expand Down Expand Up @@ -129,8 +123,16 @@ type TaskRunStatus struct {
SpanContext *SpanContext `json:"spanContext,omitempty"`
}

type TaskRunStatusStatus string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the existing TaskStatusType instead of creating a new type with identical values.


const (
TaskRunStatusStatusReady TaskRunStatusStatus = "Ready"
TaskRunStatusStatusError TaskRunStatusStatus = "Error"
TaskRunStatusStatusPending TaskRunStatusStatus = "Pending"
)

// TaskRunPhase represents the phase of a TaskRun
// +kubebuilder:validation:Enum=Initializing;Pending;ReadyForLLM;SendContextWindowToLLM;ToolCallsPending;FinalAnswer;ErrorBackoff;Failed
// +kubebuilder:validation:Enum=Initializing;Pending;ReadyForLLM;SendContextWindowToLLM;ToolCallsPending;CheckingToolCalls;FinalAnswer;ErrorBackoff;Failed
type TaskRunPhase string

const (
Expand All @@ -144,6 +146,8 @@ const (
TaskRunPhaseSendContextWindowToLLM TaskRunPhase = "SendContextWindowToLLM"
// TaskRunPhaseToolCallsPending indicates the TaskRun has pending tool calls
TaskRunPhaseToolCallsPending TaskRunPhase = "ToolCallsPending"
// TaskRunPhaseCheckingToolCalls indicates the TaskRun is checking if tool calls are complete
TaskRunPhaseCheckingToolCalls TaskRunPhase = "CheckingToolCalls"
// TaskRunPhaseFinalAnswer indicates the TaskRun has received final answer
TaskRunPhaseFinalAnswer TaskRunPhase = "FinalAnswer"
// TaskRunPhaseErrorBackoff indicates the TaskRun has failed and is in error backoff
Expand Down
4 changes: 4 additions & 0 deletions kubechain/api/v1alpha1/taskruntoolcall_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ type TaskRunToolCallStatus struct {
// CompletionTime is when the tool call completed
// +optional
CompletionTime *metav1.Time `json:"completionTime,omitempty"`

// SpanContext contains OpenTelemetry span context information
// +optional
SpanContext *SpanContext `json:"spanContext,omitempty"`
}

// TaskRunToolCallPhase represents the phase of a TaskRunToolCall
Expand Down
5 changes: 5 additions & 0 deletions kubechain/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions kubechain/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook"

kubechainv1alpha1 "github.com/humanlayer/smallchain/kubechain/api/v1alpha1"
"github.com/humanlayer/smallchain/kubechain/internal/otel"
kubechainotel "github.com/humanlayer/smallchain/kubechain/internal/otel"
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -99,14 +99,14 @@ func main() {
flag.Parse()

ctx := context.Background()
tracerProvider, err := otel.InitTracer(ctx)
tracerProvider, err := kubechainotel.InitTracer(ctx)
if err != nil {
setupLog.Error(err, "failed to initialize opentelemetry tracer")
os.Exit(1)
}
defer func() { _ = tracerProvider.Shutdown(ctx) }()

meterProvider, err := otel.InitMeter(ctx)
meterProvider, err := kubechainotel.InitMeter(ctx)
if err != nil {
setupLog.Error(err, "failed to initialize opentelemetry meter")
os.Exit(1)
Expand Down Expand Up @@ -268,6 +268,7 @@ func main() {
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
MCPManager: mcpManagerInstance,
Tracer: tracerProvider.Tracer("taskrun"),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "TaskRun")
os.Exit(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,11 @@ spec:
items:
description: Message represents a single message in the conversation
properties:
arguments:
description: Arguments is the arguments to pass to the tool
call
type: string
content:
description: Content is the message content
type: string
name:
description: Name is the name of the tool call
description: Name is the name of the tool that was called
type: string
role:
description: Role is the role of the message sender (system,
Expand Down Expand Up @@ -180,11 +176,6 @@ spec:
- type
type: object
type: array
type:
description: Type is the type of tool call
enum:
- function
type: string
required:
- content
- role
Expand All @@ -208,6 +199,7 @@ spec:
- ReadyForLLM
- SendContextWindowToLLM
- ToolCallsPending
- CheckingToolCalls
- FinalAnswer
- ErrorBackoff
- Failed
Expand Down Expand Up @@ -235,7 +227,6 @@ spec:
- Ready
- Error
- Pending
- Initializing
type: string
statusDetail:
description: StatusDetail provides additional details about the current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ spec:
result:
description: Result contains the result of the tool call if completed
type: string
spanContext:
description: SpanContext contains OpenTelemetry span context information
properties:
spanID:
description: SpanID is the span ID
type: string
traceID:
description: TraceID is the trace ID for the span
type: string
type: object
startTime:
description: StartTime is when the tool call started
format: date-time
Expand Down
2 changes: 1 addition & 1 deletion kubechain/config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: controller
newTag: "202503251521"
newTag: "202503251842"
Loading