( ctx context.Context, scope toolspkg.Scope, req toolspkg.CallRequest, )
| 2409 | } |
| 2410 | |
| 2411 | func (n *daemonNativeTools) memorySearch( |
| 2412 | ctx context.Context, |
| 2413 | scope toolspkg.Scope, |
| 2414 | req toolspkg.CallRequest, |
| 2415 | ) (toolspkg.ToolResult, error) { |
| 2416 | var input memorySearchInput |
| 2417 | if err := decodeNativeInput(req, &input); err != nil { |
| 2418 | return toolspkg.ToolResult{}, err |
| 2419 | } |
| 2420 | queryText, err := requiredNativeString(req.ToolID, "query", firstNonEmpty(input.Query, input.Q)) |
| 2421 | if err != nil { |
| 2422 | return toolspkg.ToolResult{}, err |
| 2423 | } |
| 2424 | location, err := n.memoryRecallStore(ctx, scope, req.ToolID, memoryToolSelector{ |
| 2425 | Scope: input.Scope, |
| 2426 | Workspace: input.Workspace, |
| 2427 | AgentName: input.AgentName, |
| 2428 | AgentTier: input.AgentTier, |
| 2429 | }) |
| 2430 | if err != nil { |
| 2431 | return toolspkg.ToolResult{}, nativeMemoryToolError(req.ToolID, err) |
| 2432 | } |
| 2433 | recall, err := location.Store.Recall(ctx, memcontract.Query{ |
| 2434 | WorkspaceID: location.WorkspaceID, |
| 2435 | AgentName: location.AgentName, |
| 2436 | QueryText: queryText, |
| 2437 | }, memcontract.RecallOptions{ |
| 2438 | TopK: input.Limit, |
| 2439 | }) |
| 2440 | if err != nil { |
| 2441 | return toolspkg.ToolResult{}, nativeMemoryToolError(req.ToolID, err) |
| 2442 | } |
| 2443 | payload := redactMemoryPackaged(recall) |
| 2444 | results := nativeMemoryRecallResults(payload) |
| 2445 | return structuredResult(map[string]any{ |
| 2446 | "recall": payload, |
| 2447 | "results": results, |
| 2448 | }, fmt.Sprintf("%d memory results", len(results))) |
| 2449 | } |
| 2450 | |
| 2451 | func (n *daemonNativeTools) memoryPropose( |
| 2452 | ctx context.Context, |
nothing calls this directly
no test coverage detected