From b540b7e6ecbb64077ccba1846fc34b98da6762f0 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Mon, 2 Dec 2024 20:27:40 -0500 Subject: [PATCH] chore: add resolved field to public tool reference The resolved field exposes whether the controller has resolved the tool reference and the fields are up to date. Signed-off-by: Donnie Adams --- apiclient/types/toolreference.go | 1 + pkg/api/handlers/toolreferences.go | 5 +++-- pkg/storage/openapi/generated/openapi_generated.go | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apiclient/types/toolreference.go b/apiclient/types/toolreference.go index 1303b06df..80a0a716a 100644 --- a/apiclient/types/toolreference.go +++ b/apiclient/types/toolreference.go @@ -21,6 +21,7 @@ type ToolReferenceManifest struct { type ToolReference struct { Metadata ToolReferenceManifest + Resolved bool `json:"resolved,omitempty"` Error string `json:"error,omitempty"` Builtin bool `json:"builtin,omitempty"` Description string `json:"description,omitempty"` diff --git a/pkg/api/handlers/toolreferences.go b/pkg/api/handlers/toolreferences.go index 2c6397374..e832c246f 100644 --- a/pkg/api/handlers/toolreferences.go +++ b/pkg/api/handlers/toolreferences.go @@ -29,8 +29,9 @@ func convertToolReference(toolRef v1.ToolReference) types.ToolReference { ToolType: toolRef.Spec.Type, Reference: toolRef.Spec.Reference, }, - Builtin: toolRef.Spec.Builtin, - Error: toolRef.Status.Error, + Builtin: toolRef.Spec.Builtin, + Error: toolRef.Status.Error, + Resolved: toolRef.Generation == toolRef.Status.ObservedGeneration, } if toolRef.Spec.Active == nil { tf.Active = true diff --git a/pkg/storage/openapi/generated/openapi_generated.go b/pkg/storage/openapi/generated/openapi_generated.go index aec10d7bf..3189f204f 100644 --- a/pkg/storage/openapi/generated/openapi_generated.go +++ b/pkg/storage/openapi/generated/openapi_generated.go @@ -3286,6 +3286,12 @@ func schema_otto8_ai_otto8_apiclient_types_ToolReference(ref common.ReferenceCal Ref: ref("github.com/otto8-ai/otto8/apiclient/types.ToolReferenceManifest"), }, }, + "resolved": { + SchemaProps: spec.SchemaProps{ + Type: []string{"boolean"}, + Format: "", + }, + }, "error": { SchemaProps: spec.SchemaProps{ Type: []string{"string"},