Skip to main content

ObjectDescriptor

Struct ObjectDescriptor 

Source
pub struct ObjectDescriptor {
    pub id: ObjectId,
    pub kind: ObjectKind,
    pub owner: TaskId,
    pub digest: String,
    pub size: u64,
    pub residency: Residency,
    pub payload_ref: Option<String>,
    pub version: u64,
    pub preview: Option<CompactString>,
}
Expand description

spc_006-05: the unified Kernel-internal descriptor spc_006 §4 targets for ToolResult/Memory/Knowledge/Artifact/AgentResult (and the three IPC-facing kinds Dataset/File/WorkflowOutput ObjectKind adds room for). Additive and parallel to Handle/HandleTable — this card does not replace or migrate either.

Field type choices (spec left both open, resolved here):

  • id: ObjectId reuses HandleId rather than a new id space — ObjectDescriptor is framed throughout spc_006 §4-§5 as the same addressable-object concept Handle already is, just generalized beyond in-context residency (this file’s own header already anticipates the context manager becoming “a view over” the handle table); a second parallel id space would fight that convergence instead of serving it.
  • digest: String and payload_ref: Option<String> mirror Residency::External’s own field types exactly (spc_006-05’s own instruction: “复用 Residency::External 里已有的 digest 类 型”) — no Digest/PayloadRef newtype exists anywhere in this codebase to reuse, and inventing one here would be exactly the “重新发明” the card says not to do.

Fields§

§id: ObjectId§kind: ObjectKind§owner: TaskId§digest: String§size: u64§residency: Residency§payload_ref: Option<String>§version: u64§preview: Option<CompactString>

spc_006-06: a short excerpt a cross-task reader sees by default — never the full body. None for descriptors with no externally-stored content (e.g. small Resident objects short enough that the whole thing already fits, per Residency::occupies_context).

Implementations§

Source§

impl ObjectDescriptor

Source

pub fn from_handle(owner: TaskId, handle: &Handle, version: u64) -> Self

Project an existing handle into the unified object registry without copying its body.

Source

pub fn external( id: ObjectId, kind: ObjectKind, owner: TaskId, version: u64, residency: Residency, preview: impl Into<CompactString>, ) -> Self

spc_006-06: build the descriptor a cross-task reader (Agent B) receives for an object whose full body lives outside working context (Agent A’s large Artifact/ToolResult/etc.). By construction — ObjectDescriptor has no payload/content field at all — a caller holding one physically cannot read the full body without a separate, explicit page-in (spc_006 §5: “Pass handles, not prompts”).

Takes an already-built Residency::External (rather than its three fields individually) so payload_ref/digest are entered once, not twice over — a caller passing the wrong Residency variant gets a clear panic rather than a descriptor silently missing its locator.

Trait Implementations§

Source§

impl Clone for ObjectDescriptor

Source§

fn clone(&self) -> ObjectDescriptor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ObjectDescriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ObjectDescriptor

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ObjectDescriptor

Source§

impl PartialEq for ObjectDescriptor

Source§

fn eq(&self, other: &ObjectDescriptor) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ObjectDescriptor

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ObjectDescriptor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.