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: ObjectIdreusesHandleIdrather than a new id space —ObjectDescriptoris framed throughout spc_006 §4-§5 as the same addressable-object conceptHandlealready 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: Stringandpayload_ref: Option<String>mirrorResidency::External’s own field types exactly (spc_006-05’s own instruction: “复用 Residency::External 里已有的 digest 类 型”) — noDigest/PayloadRefnewtype 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
impl ObjectDescriptor
Sourcepub fn from_handle(owner: TaskId, handle: &Handle, version: u64) -> Self
pub fn from_handle(owner: TaskId, handle: &Handle, version: u64) -> Self
Project an existing handle into the unified object registry without copying its body.
Sourcepub fn external(
id: ObjectId,
kind: ObjectKind,
owner: TaskId,
version: u64,
residency: Residency,
preview: impl Into<CompactString>,
) -> Self
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
impl Clone for ObjectDescriptor
Source§fn clone(&self) -> ObjectDescriptor
fn clone(&self) -> ObjectDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more