mirror of
https://github.com/hanzo-cpp/sdk.git
synced 2026-11-20 19:55:32 +00:00
The projection these were generated from was a month old and predated the compute migration, so every one of them described /v1/visor — which the API serves at zero paths now. That is why a hand-written console client and a generated one had drifted the same way at the same time. No /v1/visor path survives here. The word still appears as a source-plane value and inside gvisor and supervisor, which are not this rename.
142 lines
8.9 KiB
C++
142 lines
8.9 KiB
C++
/**
|
|
* Hanzo Cloud API
|
|
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
*
|
|
* The version of the OpenAPI document: v1
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI-Generator 7.14.0.
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
/*
|
|
* CodeApi.h
|
|
*
|
|
*
|
|
*/
|
|
|
|
#ifndef HANZO_API_CodeApi_H_
|
|
#define HANZO_API_CodeApi_H_
|
|
|
|
|
|
|
|
#include "hanzo/ApiClient.h"
|
|
|
|
#include "hanzo/model/AskAnswer.h"
|
|
#include "hanzo/model/AskPostIn.h"
|
|
#include "hanzo/model/ContextBundle.h"
|
|
#include "hanzo/model/ContextIn.h"
|
|
#include "hanzo/model/FileContent.h"
|
|
#include "hanzo/model/IndexIn.h"
|
|
#include "hanzo/model/IndexResult.h"
|
|
#include "hanzo/model/RepoTree.h"
|
|
#include "hanzo/model/SearchResults.h"
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <boost/optional.hpp>
|
|
|
|
namespace hanzo {
|
|
namespace api {
|
|
|
|
using namespace hanzo::model;
|
|
|
|
|
|
|
|
class CodeApi
|
|
{
|
|
public:
|
|
|
|
explicit CodeApi( std::shared_ptr<const ApiClient> apiClient );
|
|
|
|
virtual ~CodeApi();
|
|
|
|
/// <summary>
|
|
/// Answers a question about the caller org's code with a CITED answer: retrieval packs grounding context, then the synthesizer writes the answer over exactly those spans, which come back alongside it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Answers a question about the caller org's code with a CITED answer: retrieval packs grounding context, then the synthesizer writes the answer over exactly those spans, which come back alongside it. It never answers without grounding — with no matched code the answer is empty and says so, and with no synthesizer available the citations still come back with \"degraded\": true so the caller can reason over the spans itself.
|
|
/// </remarks>
|
|
/// <param name="q">Q is the question to answer. Required, max 4000 bytes. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="repo">Repo narrows retrieval to one repository. Empty searches every repo the org has indexed. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<AskAnswer>> getCodeAsk(
|
|
boost::optional<utility::string_t> q,
|
|
boost::optional<utility::string_t> repo
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the INDEXED content of one file — read_file over the chunks the search tiers hold, for pulling up code an agent just found.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the INDEXED content of one file — read_file over the chunks the search tiers hold, for pulling up code an agent just found. It is NOT byte-verbatim: the git object plane is the source of record for exact bytes, history and blame. A file absent from the index is a 404, so an agent can tell \"not indexed\" from \"empty file\".
|
|
/// </remarks>
|
|
/// <param name="path">Path is the file's repo-relative path. Required. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="repo">Repo is the repository the file belongs to. REQUIRED. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<FileContent>> getCodeFile(
|
|
boost::optional<utility::string_t> path,
|
|
boost::optional<utility::string_t> repo
|
|
) const;
|
|
/// <summary>
|
|
/// Finds code in the caller org's index across three orthogonal retrieval tiers fused by reciprocal-rank fusion: lexical (FTS5 trigram over code-tokenized text), symbolic (real definition and reference edges), and semantic (embedding cosine over AST-boundary chunks).
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Finds code in the caller org's index across three orthogonal retrieval tiers fused by reciprocal-rank fusion: lexical (FTS5 trigram over code-tokenized text), symbolic (real definition and reference edges), and semantic (embedding cosine over AST-boundary chunks). Pick one tier with `type`, or leave it to run all three as hybrid, which is what a coding agent usually wants. It is FAIL-HONEST: a retrieval outage answers 200 with an empty result set and \"degraded\": true rather than a 5xx, so an agent degrades instead of stalling. A malformed regex is a 400.
|
|
/// </remarks>
|
|
/// <param name="q">Q is the search query. Required, max 4000 bytes. For type=regex it is a regular expression; for type=symbol it is a symbol name. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="type">Type selects the retrieval tier: \"text\" (FTS5 trigram), \"regex\", \"symbol\" (definitions), \"semantic\" (embeddings) or \"hybrid\". Anything else — including empty — reads as hybrid. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="repo">Repo narrows to one repository. Empty searches every repo the org has indexed. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="limit">Limit caps how many spans come back: default 20, maximum 100. A value that is not a positive integer reads as the default. (optional, default to 0L)</param>
|
|
pplx::task<std::shared_ptr<SearchResults>> getCodeSearch(
|
|
boost::optional<utility::string_t> q,
|
|
boost::optional<utility::string_t> type,
|
|
boost::optional<utility::string_t> repo,
|
|
boost::optional<int64_t> limit
|
|
) const;
|
|
/// <summary>
|
|
/// Returns one repository's file structure with a per-file symbol count — get_repo_structure over the org's own index, with no git checkout involved.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns one repository's file structure with a per-file symbol count — get_repo_structure over the org's own index, with no git checkout involved. A repository that has not been indexed answers an empty tree rather than an error, so an agent can tell \"nothing here\" without handling a failure.
|
|
/// </remarks>
|
|
/// <param name="repo">Repo is the repository to walk. REQUIRED — a tree is repo-scoped. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<RepoTree>> getCodeTree(
|
|
boost::optional<utility::string_t> repo
|
|
) const;
|
|
/// <summary>
|
|
/// Is askGet with the question in the request BODY, for a question too long or too awkward to put in a URL.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Is askGet with the question in the request BODY, for a question too long or too awkward to put in a URL. `query` and `repo` in the body take precedence over `?q=` and `?repo=`; either source works alone.
|
|
/// </remarks>
|
|
/// <param name="askPostIn"></param>
|
|
pplx::task<std::shared_ptr<AskAnswer>> postCodeAsk(
|
|
std::shared_ptr<AskPostIn> askPostIn
|
|
) const;
|
|
/// <summary>
|
|
/// Packs the most relevant code for a query into a token budget — THE primitive for a coding agent that has to decide what to put in a prompt.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Packs the most relevant code for a query into a token budget — THE primitive for a coding agent that has to decide what to put in a prompt. It retrieves seed spans, expands each with the definitions it calls and its key callers, then greedily fills the budget, so the answer is a coherent slice of the codebase rather than a list of disconnected matches. The top match is always included, truncated if it alone overflows, so a matched query never comes back empty. A retrieval outage answers 200 with an empty bundle rather than a 5xx.
|
|
/// </remarks>
|
|
/// <param name="contextIn"></param>
|
|
pplx::task<std::shared_ptr<ContextBundle>> postCodeContext(
|
|
std::shared_ptr<ContextIn> contextIn
|
|
) const;
|
|
/// <summary>
|
|
/// (re)indexes a repository for the caller's org, incrementally: files whose content hash is unchanged are skipped, so re-sending a whole tree is cheap.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// (re)indexes a repository for the caller's org, incrementally: files whose content hash is unchanged are skipped, so re-sending a whole tree is cheap. Each file is parsed for symbols, split at AST boundaries and — when the semantic tier is available — embedded, which is what makes it searchable across all three retrieval tiers. Pass `prune` to also DELETE indexed files absent from the request, which turns the call into a full sync; without it the call is an upsert. The index is written to the caller org's own physically separate database.
|
|
/// </remarks>
|
|
/// <param name="indexIn"></param>
|
|
pplx::task<std::shared_ptr<IndexResult>> postCodeIndex(
|
|
std::shared_ptr<IndexIn> indexIn
|
|
) const;
|
|
|
|
protected:
|
|
std::shared_ptr<const ApiClient> m_ApiClient;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* HANZO_API_CodeApi_H_ */
|
|
|