(deps commandDeps)
| 465 | } |
| 466 | |
| 467 | func newMemoryHistoryCommand(deps commandDeps) *cobra.Command { |
| 468 | var flags memorySelectorFlags |
| 469 | var operation string |
| 470 | var sinceRaw string |
| 471 | var limit int |
| 472 | |
| 473 | cmd := &cobra.Command{ |
| 474 | Use: memoryHistoryKey, |
| 475 | Short: "Show redaction-safe Memory v2 operation history", |
| 476 | Args: cobra.NoArgs, |
| 477 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 478 | client, err := clientFromDeps(deps) |
| 479 | if err != nil { |
| 480 | return err |
| 481 | } |
| 482 | selector, err := resolveMemorySelectorFlags(deps, flags, memorySelectorOptions{}) |
| 483 | if err != nil { |
| 484 | return err |
| 485 | } |
| 486 | since, err := parseSinceFlag(sinceRaw, deps.now) |
| 487 | if err != nil { |
| 488 | return err |
| 489 | } |
| 490 | records, err := client.MemoryHistory(cmd.Context(), MemoryHistoryQuery{ |
| 491 | Scope: selector.Scope, |
| 492 | WorkspaceID: selector.WorkspaceID, |
| 493 | AgentName: selector.AgentName, |
| 494 | AgentTier: selector.AgentTier, |
| 495 | Operation: strings.TrimSpace(operation), |
| 496 | Since: since, |
| 497 | Limit: limit, |
| 498 | }) |
| 499 | if err != nil { |
| 500 | return err |
| 501 | } |
| 502 | return writeCommandOutput(cmd, memoryHistoryBundle(records, deps.now)) |
| 503 | }, |
| 504 | } |
| 505 | addMemorySelectorFlags(cmd, &flags) |
| 506 | cmd.Flags().StringVar(&operation, memoryOperationKey, "", "Memory operation type, for example memory.write") |
| 507 | cmd.Flags().StringVar(&sinceRaw, "since", "", "Show operations since an RFC3339 timestamp or relative duration") |
| 508 | cmd.Flags().IntVar(&limit, "limit", 25, "Maximum number of operations to return") |
| 509 | return cmd |
| 510 | } |
| 511 | |
| 512 | func newMemoryHealthCommand(deps commandDeps) *cobra.Command { |
| 513 | return &cobra.Command{ |
no test coverage detected