MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / get_vault_entry

Method get_vault_entry

libatomic/src/daemon/services_agent.rs:1824–1992  ·  view source on GitHub ↗
(
        &self,
        request: Request<GetVaultEntryRequest>,
    )

Source from the content-addressed store, hash-verified

1822 }
1823
1824 async fn get_vault_entry(
1825 &self,
1826 request: Request<GetVaultEntryRequest>,
1827 ) -> Result<Response<GetVaultEntryResponse>, Status> {
1828 let request = request.into_inner();
1829 reject_scoped_vault_read(&request.view)?;
1830 let kind = Kind::try_from(request.kind)
1831 .map_err(|_| domain_status(ErrorCode::InvalidArgument, "unknown vault entity kind"))?;
1832 let reference = request
1833 .repository
1834 .as_ref()
1835 .ok_or_else(|| Status::invalid_argument("repository required"))?;
1836 let handle = self.state.resolve(reference)?;
1837 self.state.log_rpc("GetVaultEntry", Some(&handle));
1838 let gate_handle = handle.clone();
1839 let _gate = gate_handle.exclusive().await;
1840 let id = request.id.clone();
1841 let path = request.path.clone();
1842 let include_bundle = request.include_bundle;
1843 let response = tokio::task::spawn_blocking(move || {
1844 // Path-first resolution (add-only): `vault show <path>` names
1845 // ANY vault entry by its vault-relative path — no kind
1846 // inference. The bundle carries the stored entry (plus no
1847 // attestation: the vault-show projection never consults one).
1848 if let Some(path) = path.as_deref().filter(|path| !path.is_empty()) {
1849 // A query: read-only open with the read-concurrency wait.
1850 let repo = handle.repository_readonly()?;
1851 let entry = repo
1852 .vault_retrieve(path)
1853 .map_err(repository_error)?
1854 .ok_or_else(|| {
1855 domain_status(
1856 ErrorCode::NotFound,
1857 format!("vault entry '{path}' not found"),
1858 )
1859 })?;
1860 let bundle = include_bundle
1861 .then(|| vault_entry_bundle(&repo, None, path, &entry))
1862 .transpose()?;
1863 return Ok::<_, Status>(GetVaultEntryResponse {
1864 entry: Some(VaultEntry {
1865 kind: Kind::Unspecified as i32,
1866 id: path.to_string(),
1867 title: String::new(),
1868 status: None,
1869 body: Some(body_of(&entry)),
1870 created_at: None,
1871 updated_at: None,
1872 linked: Vec::new(),
1873 vault_path: Some(path.to_string()),
1874 priority: None,
1875 entry_type: Some(entry.entry_type.to_string()),
1876 updated_at_label: Some(entry.updated_at.clone()),
1877 ..Default::default()
1878 }),
1879 snapshot: None,
1880 entry_bundle: bundle,
1881 });

Callers 1

callMethod · 0.45

Calls 15

reject_scoped_vault_readFunction · 0.85
domain_statusFunction · 0.85
vault_entry_bundleFunction · 0.85
body_ofFunction · 0.85
parse_frontmatterFunction · 0.85
as_refMethod · 0.80
log_rpcMethod · 0.80
exclusiveMethod · 0.80
repository_readonlyMethod · 0.80
vault_retrieveMethod · 0.80
vault_intent_showMethod · 0.80
vault_goal_showMethod · 0.80

Tested by

no test coverage detected