मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)8.5k · #12454

Capsule Development

यह क्या करती है

यह स्किल capsule बनाने का मार्गदर्शन देती है, जो Unicity AOS के भीतर चलने वाला छोटा सुरक्षित प्रोग्राम है। यह उन डेवलपर्स के लिए है जो अपने एजेंट सिस्टम के लिए नए प्रोग्राम हिस्से लिखना और इंस्टॉल करना चाहते हैं।

कब इस्तेमाल करें

  • ✓जब आप अपने Unicity AOS सेटअप के लिए नया capsule शुरू करना चाहते हैं।
  • ✓जब कोई capsule बिल्ड, link या इंस्टॉल न हो और उसे debug करना हो।
  • ✓जब आपको जांचना है कि capsule के access नियम सही सेट हैं।

Skill का लिंक

https://github.com/unicity-aos/aos-ce/blob/main/capsules/capsule-system/src/skills/capsule-development/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/unicity-aos/aos-ce/blob/main/capsules/capsule-system/src/skills/capsule-development/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“समर्थित टेम्पलेट से एक नया Unicity AOS capsule बनाइए, उसे build कीजिए, और टेस्ट के लिए इंस्टॉल कीजिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट आधिकारिक प्रोजेक्ट टेम्पलेट से शुरू करता है और manifest सेट करता है, जो नियंत्रित करता है कि capsule किस चीज़ तक पहुंच सकता है। फिर वह आवश्यक target के लिए build करता है और इंस्टॉल से पहले access सूची जांचता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Capsule Development

A capsule is a Rust WebAssembly component that runs inside the Astrid Runtime sandbox shipped by Unicity AOS. The runtime routes IPC, enforces capabilities, mediates host access, and audits execution. Business logic belongs in capsules.

The manifest is part of the security boundary. Its [publish] and [subscribe] tables are the IPC access-control list: a topic that is not declared is denied. Capsules target wasm32-unknown-unknown, not WASI, and reach the host only through the audited SDK/WIT imports granted by the manifest.

Start from the supported scaffold

aos capsule new my-capsule
cd my-capsule

The generated project contains:

my-capsule/
├── .cargo/config.toml
├── rust-toolchain.toml
├── Cargo.toml
├── Capsule.toml
└── src/lib.rs

Do not begin from an old [[interceptor]] manifest or an ipc_publish / ipc_subscribe capability array. Those formats are obsolete.

Compiler target

.cargo/config.toml selects the capsule target and activates the SDK's custom randomness backend:

[build]
target = "wasm32-unknown-unknown"

[target.wasm32-unknown-unknown]
rustflags = ["--cfg=getrandom_backend=\"custom\""]

The getrandom_backend setting must live in the final capsule crate. Without it, dependencies such as UUID generators or randomized hash maps can fail to link.

Pin the toolchain and target in rust-toolchain.toml:

[toolchain]
channel = "1.94.0"
targets = ["wasm32-unknown-unknown"]
components = ["rustfmt", "clippy"]

Cargo package

Use a cdylib and the current 0.7 SDK surface:

[package]
name = "my-capsule"
version = "0.1.0"
edition = "2024"
publish = false

[lib]
crate-type = ["cdylib"]

[dependencies]
astrid-sdk = { version = "0.7", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
strip = true
panic = "abort"

Capsule manifest

This minimal tool capsule exposes one hello tool:

[package]
name = "my-capsule"
version = "0.1.0"
description = "A small example capsule"
authors = ["Your Name <you@example.com>"]
astrid-version = ">=0.7.0"

[[component]]
id = "my-capsule"
file = "my_capsule.wasm"
type = "executable"

[capabilities]
fs_read = ["home://data/my-capsule/"]
fs_write = ["home://data/my-capsule/"]

[publish]
"tool.v1.execute.*.result" = { wit = "@unicity-astrid/wit/types/tool-call-result" }
"tool.v1.response.describe.*" = { wit = "@unicity-astrid/wit/tool/describe-response" }

[subscribe]
"tool.v1.execute.hello" = { wit = "@unicity-astrid/wit/types/tool-call", handler = "tool_execute_hello" }
"tool.v1.request.describe" = { wit = "@unicity-astrid/wit/tool/describe-request", handler = "tool_describe" }

Skills are agent user-space instructions, not a Capsule.toml protocol. Ship a trigger Skill through the host plugin or the agent-level Skills service, and expose capsule-owned reference material through typed IPC tools when useful. Do not add an agent Skill section to the manifest or request filesystem write authority merely to modify a host's instruction directory.

The published @unicity-astrid/wit/... strings and astrid:* WIT namespaces are stable runtime identifiers. Keep them exact even though the product CLI is aos.

For a tool capsule, both publish entries are required: one returns tool results, and the other answers the describe fan-out that makes tools visible to agents. Every tool needs its own concrete execute subscription. A subscribe wildcard may have one trailing *; publish permissions should be as narrow as practical.

Manifest data is untrusted input. Do not put operator authority, principal identity, or a secret scope in a capsule-controlled field. The kernel stamps the caller identity and decides operator-only policy.

Implement a tool

#![deny(unsafe_code)]
#![deny(clippy::all)]

use astrid_sdk::prelude::*;
use astrid_sdk::schemars;
use serde::Deserialize;

#[derive(Default)]
pub struct MyCapsule;

#[derive(Debug, Default, Deserialize, schemars::JsonSchema)]
pub struct HelloArgs {
    /// Person to greet.
    pub name: String,
}

#[capsule]
impl MyCapsule {
    /// Greet a person by name.
    #[astrid::tool("hello")]
    pub fn hello(&self, args: HelloArgs) -> Result<String, SysError> {
        Ok(format!("Hello, {}!", args.name))
    }
}

The tool macro derives the input schema from JsonSchema, uses the method's doc comment as the tool desc

अक्सर पूछे जाने वाले सवाल

manifest क्यों ज़रूरी है?

उसकी access सूची तय करती है कि capsule कौन से संदेश भेज और पा सकता है, और जो घोषित नहीं है वह अस्वीकार होता है।

क्या मैं पुराने उदाहरण से शुरू कर सकता हूं?

नहीं। पुराने manifest फ़ॉर्मेट अप्रचलित हैं, इसलिए स्किल मौजूदा टेम्पलेट से शुरू करती है।

क्या मुझे Rust जानना होगा?

स्किल Rust इस्तेमाल करती है, इसलिए इसे जानने वाला डेवलपर इसका सबसे अच्छा लाभ लेगा।

जानकारी

लेखक का मूल विवरण

Build, test, package, install, and debug a current Unicity AOS capsule

repo: unicity-aos/aos-ce

लोकप्रियता

GitHub स्टार
8.5k
रैंकिंग में स्थान
#12454
लाइसेंस
Apache-2.0
अपडेट की गई
22/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills