Skip to main content

a3s_code_core/release/
mod.rs

1//! Immutable, bounded Agent release manifests.
2//!
3//! This module owns admission and identity for `.a3s/asset.acl`. It does not
4//! start an Agent daemon or claim that a Runtime Service is ready.
5
6mod error;
7mod manifest;
8mod schema;
9mod types;
10mod validation;
11
12pub use error::{AgentReleaseError, AgentReleaseField};
13pub use manifest::AgentReleaseManifest;
14pub use types::{
15    AgentReleaseArtifact, AgentReleaseCacheMode, AgentReleaseCapability, AgentReleaseCompatibility,
16    AgentReleaseEntrypoint, AgentReleaseHealth, AgentReleasePersistentDataMode,
17    AgentReleaseProvenance, AgentReleaseSecretRequirement, AgentReleaseSecretTarget,
18    AgentReleaseStorage, AgentReleaseWorkspaceMode,
19};
20
21use a3s_acl::ParseLimits;
22
23/// Versioned ACL schema identifier accepted by this release contract.
24pub const AGENT_RELEASE_CONTRACT_V1: &str = "a3s.code.agent-release.v1";
25
26/// Version-one headless Agent request protocol identifier.
27pub const AGENT_PROTOCOL_V1: &str = "a3s.code.agent.v1";
28
29/// Capabilities supplied by the native `a3s code harness` process.
30pub const AGENT_HARNESS_CAPABILITIES_V1: [(&str, u32); 3] = [
31    ("runtime.service", 1),
32    ("secrets.external", 1),
33    ("workspace.local", 1),
34];
35
36/// Sole executable admitted by the version-one Agent release contract.
37pub const AGENT_RELEASE_ENTRYPOINT_COMMAND_V1: &str = "/usr/bin/a3s";
38
39/// Arguments that select the A3S Code Harness in a version-one Agent release.
40pub const AGENT_RELEASE_ENTRYPOINT_ARGS_V1: [&str; 4] =
41    ["code", "harness", "--manifest", "/app/.a3s/asset.acl"];
42
43/// Exact protocol and capability surface supplied by the native v1 Harness.
44///
45/// Keeping this in Core prevents executable hosts from independently copying
46/// capability names or levels when they admit an Agent release.
47pub fn agent_harness_compatibility_v1() -> AgentReleaseCompatibility {
48    AgentReleaseCompatibility {
49        protocol: AGENT_PROTOCOL_V1.to_string(),
50        capabilities: AGENT_HARNESS_CAPABILITIES_V1
51            .into_iter()
52            .map(|(name, level)| AgentReleaseCapability {
53                name: name.to_string(),
54                level,
55            })
56            .collect(),
57    }
58}
59
60/// OCI image-manifest media type accepted by the version-one artifact contract.
61pub const AGENT_RELEASE_OCI_MEDIA_TYPE: &str = "application/vnd.oci.image.manifest.v1+json";
62
63/// Limits applied before an untrusted Agent release manifest is admitted.
64pub const AGENT_RELEASE_LIMITS: ParseLimits = ParseLimits {
65    max_document_bytes: 64 * 1024,
66    max_nesting_depth: 8,
67    max_collection_items: 256,
68    max_token_bytes: 8 * 1024,
69    max_diagnostics: 20,
70};
71
72pub(crate) const MAX_CAPABILITY_LEVEL: u32 = 65_535;
73pub(crate) const MAX_ENTRYPOINT_ARGS: usize = 64;
74pub(crate) const MAX_SHUTDOWN_GRACE_SECONDS: u32 = 3_600;