feat(web): Document/Endpoint/Resource artifact rewrite (ADR 0007)
Replace the monolithic compose_*/configure author surface with file-level
web|endpoint artifacts, split ext/{web,data,security,net}, and lock
no-degrade rules so the model cannot regress to God-object APIs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
33f8b94bb0
commit
67bac1bf02
54 files changed
+4642
-2505
No files matched your search
@@ -201,6 +201,7 @@ pub enum HostFn {
|
||||
Meta = 192,
|
||||
MetaGet = 193,
|
||||
ModuleSource = 194,
|
||||
ArtifactKind = 195,
|
||||
}
|
||||
|
||||
|
||||
@@ -392,6 +393,7 @@ impl HostFn {
|
||||
192 => Self::Meta,
|
||||
193 => Self::MetaGet,
|
||||
194 => Self::ModuleSource,
|
||||
195 => Self::ArtifactKind,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -586,6 +588,7 @@ impl HostFn {
|
||||
"host_meta" | "meta" => Self::Meta,
|
||||
"host_meta_get" | "meta_get" => Self::MetaGet,
|
||||
"host_module_source" | "module_source" => Self::ModuleSource,
|
||||
"host_artifact_kind" | "artifact_kind" => Self::ArtifactKind,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -767,6 +770,7 @@ impl HostFn {
|
||||
Self::Meta => "host_meta",
|
||||
Self::MetaGet => "host_meta_get",
|
||||
Self::ModuleSource => "host_module_source",
|
||||
Self::ArtifactKind => "host_artifact_kind",
|
||||
Self::WritebackRecord => "host_writeback_record",
|
||||
Self::WritebackGet => "host_writeback_get",
|
||||
Self::WritebackClear => "host_writeback_clear",
|
||||
@@ -790,7 +794,7 @@ impl HostFn {
|
||||
&["path"]
|
||||
}
|
||||
Self::WriteText | Self::AppendText => &["path", "text"],
|
||||
Self::NowUnix | Self::NowMs | Self::Args | Self::Cwd | Self::Meta | Self::ModuleSource => {
|
||||
Self::NowUnix | Self::NowMs | Self::Args | Self::Cwd | Self::Meta | Self::ModuleSource | Self::ArtifactKind => {
|
||||
&[]
|
||||
}
|
||||
Self::FormatTime => &["unix", "pattern"],
|
||||
@@ -998,6 +1002,7 @@ pub fn call_host(
|
||||
HostFn::Meta => sys::meta(ctx),
|
||||
HostFn::MetaGet => sys::meta_get(ctx, require(bound, "key")?),
|
||||
HostFn::ModuleSource => crate::host::agent_rt::module_source(ctx),
|
||||
HostFn::ArtifactKind => sys::artifact_kind(ctx),
|
||||
HostFn::Exit => sys::exit(ctx, require(bound, "code")?),
|
||||
HostFn::Exec => sys::exec(
|
||||
ctx,
|
||||
|
||||
@@ -109,6 +109,17 @@ pub fn meta_get(ctx: &HostContext, key: &Value) -> Result<Value, String> {
|
||||
.unwrap_or(Value::None))
|
||||
}
|
||||
|
||||
/// Classify entry Artifact (`web` / `endpoint` / `prompt` / `other`); missing type → None.
|
||||
pub fn artifact_kind(ctx: &HostContext) -> Result<Value, String> {
|
||||
Ok(match crate::artifact::classify(&ctx.entry_metadata) {
|
||||
None => Value::None,
|
||||
Some(crate::artifact::ArtifactKind::Web) => Value::Text("web".into()),
|
||||
Some(crate::artifact::ArtifactKind::Endpoint) => Value::Text("endpoint".into()),
|
||||
Some(crate::artifact::ArtifactKind::Prompt) => Value::Text("prompt".into()),
|
||||
Some(crate::artifact::ArtifactKind::Other) => Value::Text("other".into()),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn exit(ctx: &HostContext, code: &Value) -> Result<Value, String> {
|
||||
let c = as_i64(code, "code")?;
|
||||
if ctx.soft_side_effects {
|
||||
|
||||
Reference in new issue
Block a user