[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83034":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":15,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":15,"lastSyncTime":27,"discoverSource":28},83034,"sdk-js","unicity-astrid\u002Fsdk-js","unicity-astrid","JavaScript \u002F TypeScript SDK for building Astrid OS capsules. Companion to unicity-astrid\u002Fsdk-rust.","https:\u002F\u002Fgithub.com\u002Funicity-astrid\u002Fastrid",null,"TypeScript",8256,36,7,2,0,647,169,35.7,false,"main",true,[],"2026-06-12 02:04:30","# sdk-js\n\n[![License: MIT OR Apache-2.0](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT%20OR%20Apache--2.0-blue.svg)](LICENSE-MIT)\n[![Node: >=20](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode-%3E%3D20-blue)](https:\u002F\u002Fnodejs.org)\n[![TypeScript: 5.2+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-5.2%2B-blue)](https:\u002F\u002Fwww.typescriptlang.org)\n\n**The JavaScript \u002F TypeScript SDK for building [Astrid](https:\u002F\u002Fgithub.com\u002Funicity-astrid\u002Fastrid) capsules.**\n\nCompanion to [sdk-rust](https:\u002F\u002Fgithub.com\u002Funicity-astrid\u002Fsdk-rust). Same WIT contract, same wasip2 Component Model output, same `.capsule` archive format — your kernel can't tell which language built the binary. Where the Rust SDK feels like writing against `std`, this one feels like writing against `node:fs\u002Fpromises` \u002F WHATWG \u002F Node's `EventEmitter`. Same host ABI, idiom translated.\n\n## Packages\n\n| Package | Role |\n|---|---|\n| `@unicity-astrid\u002Fsdk` | The capsule author API. Module-by-module mirror of `astrid-sdk`'s `prelude` — `fs`, `net`, `process`, `env`, `time`, `log`, plus Astrid-specific `ipc`, `kv`, `http`, `hooks`, `uplink`, `identity`, `approval`, `runtime`, `elicit`, `capabilities`, `interceptors`. TypeScript decorators (`@capsule`, `@tool`, `@interceptor`, `@command`, `@install`, `@upgrade`, `@run`) replace `#[capsule]`. |\n| `@unicity-astrid\u002Fbuild` | Build orchestrator. Runs `tsc` + esbuild + ComponentizeJS programmatic API. Emits a `wasm32-wasip2` component that the Rust-side `astrid-build` packs into a `.capsule` archive. |\n| `@unicity-astrid\u002Fsdk\u002Fcontracts` | Auto-generated TS types from `astrid-contracts.wit` — IPC event types (`Message`, `ToolCall`, `GenerateRequest`, `StreamEvent`, etc.) usable on both ends of cross-capsule IPC. |\n\n## Quick start\n\n```bash\nmkdir my-capsule && cd my-capsule\nnpm init -y\nnpm install @unicity-astrid\u002Fsdk\nnpm install --save-dev @unicity-astrid\u002Fbuild typescript\n```\n\n`Capsule.toml`:\n\n```toml\n[package]\nname = \"my-capsule\"\nversion = \"0.1.0\"\n\n[[component]]\nid = \"my-capsule\"\nfile = \"my-capsule.wasm\"\ntype = \"executable\"\n\n[capabilities]\nipc_publish = [\"tool.v1.execute.*\"]\nkv = [\"*\"]\n```\n\n`src\u002Findex.ts`:\n\n```typescript\nimport { capsule, tool, install, log, kv } from \"@unicity-astrid\u002Fsdk\";\n\n@capsule\nexport class MyCapsule {\n  greetings = 0;\n\n  @tool(\"greet\", { mutable: true })\n  greet({ name }: { name: string }): { message: string; count: number } {\n    this.greetings++;\n    log.info(`greeting ${name} (#${this.greetings})`);\n    return { message: `Hello, ${name}!`, count: this.greetings };\n  }\n\n  @install\n  onInstall(): void {\n    log.info(\"my-capsule installed\");\n  }\n}\n```\n\nBuild:\n\n```bash\nastrid build           # or: astrid capsule install .\n```\n\nThat's it. `tsc` compiles your TypeScript, esbuild bundles in the SDK, ComponentizeJS produces a `wasip2` component, the Rust-side `astrid-build` packs it into `dist\u002Fmy-capsule.capsule`.\n\n## Building capsules\n\nEnd-to-end pipeline:\n\n```\nsrc\u002F*.ts\n   ↓  tsc (typecheck + emit dist\u002F*.js)\n   ↓  esbuild (bundle dist\u002F + @unicity-astrid\u002Fsdk into one ESM, mark astrid:* WIT specifiers external)\n   ↓  ComponentizeJS programmatic API (StarlingMonkey + your bundle → wasip2 Component)\ntarget\u002F\u003Cname>.wasm\n   ↓  pack_capsule_archive (Rust side)\ndist\u002F\u003Cname>.capsule (Capsule.toml + .wasm + wit\u002F, gzipped tar)\n```\n\n`tsc` and esbuild run from `@unicity-astrid\u002Fbuild\u002Fsrc\u002Findex.mjs` — a small Node CLI invoked by Rust's `astrid build` when it detects a `package.json + Capsule.toml` project.\n\n## Trade-off: binary size\n\nJS capsules cost ~11 MB raw (3.5 MB gzipped in the `.capsule` archive). That's the StarlingMonkey embed. Rust capsules are ~200 KB. Acceptable for daemon-mode workloads (capsules load once); if size matters more than ergonomics, write Rust.\n\nThe host ABI is identical, so a hot capsule can be ported between languages without kernel changes.\n\n## Repository layout\n\n```\nsdk-js\u002F\n├── packages\u002F\n│   ├── astrid-sdk\u002F        @unicity-astrid\u002Fsdk — public API\n│   ├── astrid-build\u002F      @unicity-astrid\u002Fbuild — build orchestrator\n│   └── ...\n├── examples\u002F\n│   └── test-capsule\u002F      Minimal end-to-end example mirroring sdk-rust\u002Fexamples\u002Ftest-capsule\n├── notes\u002F                 Phase-by-phase development notes (Phase 0–3)\n├── package.json           npm workspace root\n└── tsconfig.base.json\n```\n\n## Development\n\n```bash\nnpm install\nnpm --workspace @unicity-astrid\u002Fsdk run build\nnode packages\u002Fastrid-build\u002Fsrc\u002Findex.mjs examples\u002Ftest-capsule\n```\n\nOr, from a kernel checkout with the JS dispatch wired into `astrid-build`:\n\n```bash\ncd core\ncargo build -p astrid-build\n.\u002Ftarget\u002Fdebug\u002Fastrid-build ..\u002Fsdk-js\u002Fexamples\u002Ftest-capsule\n```\n\n## Status\n\nAlpha. The vertical slice (TypeScript → wasip2 component → `.capsule` → installed by `astrid capsule install` → kernel lifecycle hook execution) is proven end-to-end. Daemon-mode tool-dispatch round-trip (`\u002Ftool greet { \"name\": \"world\" }`) is on the same code path as install — same wasmtime instantiation, same linker contract — and ready for human-operator smoke testing.\n\nSee `notes\u002Fphase-{0,1,2,3-install}.md` for development history, design decisions, and known follow-ups.\n\n## License\n\nDual-licensed under [MIT](LICENSE-MIT) and [Apache 2.0](LICENSE-APACHE).\n\nCopyright (c) 2025-2026 Joshua J. Bouw and Unicity Labs.\n","该项目是用于构建Astrid OS胶囊的JavaScript\u002FTypeScript SDK，与Rust版本SDK配套使用。其核心功能包括提供了一系列模块如`fs`、`net`、`process`等，以及Astrid特有的`ipc`、`kv`等功能，并通过TypeScript装饰器简化了胶囊开发流程。技术特点在于支持Node.js风格的编程体验，同时保持与Rust SDK相同的WIT合约和输出格式。适用于需要在Astrid OS上快速开发跨语言兼容的应用场景，特别是对于熟悉Node.js环境但希望利用WebAssembly技术优势的开发者来说非常友好。","2026-06-11 04:09:58","CREATED_QUERY"]