|
6 | 6 | "encoding/json" |
7 | 7 | "errors" |
8 | 8 | "fmt" |
9 | | - "reflect" |
10 | 9 | "strings" |
11 | 10 | "sync" |
12 | 11 | "time" |
@@ -434,28 +433,42 @@ func deviceKindsFromHeartbeat(p proto.HeartbeatPayload) []runtimedevice.Supporte |
434 | 433 | out := make([]runtimedevice.SupportedAgentKind, 0, len(p.SupportedAgentKinds)) |
435 | 434 | for _, info := range p.SupportedAgentKinds { |
436 | 435 | out = append(out, runtimedevice.SupportedAgentKind{ |
437 | | - Kind: info.Kind, |
438 | | - Available: info.Available, |
439 | | - Version: info.Version, |
440 | | - Capabilities: deviceCapabilities(info.Capabilities), |
| 436 | + Kind: info.Kind, |
| 437 | + Available: info.Available, |
| 438 | + Version: info.Version, |
| 439 | + Capabilities: runtimedevice.KindCapabilities{ |
| 440 | + Streaming: info.Capabilities.Streaming.IsSupported(), |
| 441 | + Usage: info.Capabilities.Usage.IsSupported(), |
| 442 | + Resume: info.Capabilities.Resume.IsSupported(), |
| 443 | + DurableTurns: info.Capabilities.DurableTurns.IsSupported(), |
| 444 | + DurableInputReceipts: info.Capabilities.DurableInputReceipts.IsSupported(), |
| 445 | + NativeSessionRecovery: info.Capabilities.NativeSessionRecovery.IsSupported(), |
| 446 | + RetainedNativeHistory: info.Capabilities.RetainedNativeHistory.IsSupported(), |
| 447 | + MessageItems: info.Capabilities.MessageItems.IsSupported(), |
| 448 | + |
| 449 | + ToolObservations: info.Capabilities.ToolObservations.IsSupported(), |
| 450 | + EnvironmentNone: info.Capabilities.EnvironmentNone.IsSupported(), |
| 451 | + LocalEnvironment: info.Capabilities.LocalEnvironment.IsSupported(), |
| 452 | + Preparation: info.Capabilities.Preparation.IsSupported(), |
| 453 | + WorkspaceReadPreparation: info.Capabilities.WorkspaceReadPreparation.IsSupported(), |
| 454 | + WorkspaceOutputExport: info.Capabilities.WorkspaceOutputExport.IsSupported(), |
| 455 | + StructuredOutput: info.Capabilities.StructuredOutput.IsSupported(), |
| 456 | + ToolSearch: info.Capabilities.ToolSearch.IsSupported(), |
| 457 | + MessageImages: info.Capabilities.MessageImages.IsSupported(), |
| 458 | + FunctionResultImages: info.Capabilities.FunctionResultImages.IsSupported(), |
| 459 | + ExecutionControls: info.Capabilities.ExecutionControls.IsSupported(), |
| 460 | + SubagentControl: info.Capabilities.SubagentControl.IsSupported(), |
| 461 | + SubagentObservations: info.Capabilities.SubagentObservations.IsSupported(), |
| 462 | + FunctionTools: info.Capabilities.FunctionTools.IsSupported(), |
| 463 | + MCPHTTPTools: info.Capabilities.MCPHTTPTools.IsSupported(), |
| 464 | + MCPHTTPRequired: info.Capabilities.MCPHTTPRequired.IsSupported(), |
| 465 | + MCPHTTPBearerAuth: info.Capabilities.MCPHTTPBearerAuth.IsSupported(), |
| 466 | + }, |
441 | 467 | }) |
442 | 468 | } |
443 | 469 | return out |
444 | 470 | } |
445 | 471 |
|
446 | | -// deviceCapabilities projects the declaration by field name; TestCapabilityProjectionCoversEveryField |
447 | | -// proves the two inventories match. |
448 | | -func deviceCapabilities(declared proto.AgentKindCapabilities) runtimedevice.KindCapabilities { |
449 | | - var kind runtimedevice.KindCapabilities |
450 | | - source, target := reflect.ValueOf(declared), reflect.ValueOf(&kind).Elem() |
451 | | - for i := 0; i < source.NumField(); i++ { |
452 | | - if field := target.FieldByName(source.Type().Field(i).Name); field.IsValid() { |
453 | | - field.SetBool(source.Field(i).Interface().(proto.CapabilitySupport).IsSupported()) |
454 | | - } |
455 | | - } |
456 | | - return kind |
457 | | -} |
458 | | - |
459 | 472 | func (s *Session) dispatch(env proto.Envelope) { |
460 | 473 | if !s.allowsReceiptFrame(env, false) { |
461 | 474 | return |
|
0 commit comments