Skip to content

About

Runnable AIKernel examples for .NET and WebAssembly. See the README for the package versions used by each example. / AIKernelの実行サンプル集。

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AIKernel.Demo

The examples in this repository target .NET 10 and pin the 0.1.3 package series. For a .NET 11 project, follow the SDK 0.4.0 installation guide.

日本語 README

AIKernel.Demo is the user-facing sample workspace for the AIKernel 0.1.3 package family. It makes AIKernel.Core abstractions visible through runnable console, API-host, browser, VFS, PDP, pipeline, and replay-inspection demos.

In the AIOS SDK, AIKernel.Demo is the official examples workspace, similar to an OS /usr/share/examples tree. It shows how users can assemble kernel runtime, providers, control, WASM, GPU, and tools layers into their own AIOS distribution.

Install the AIKernel.Monolith 0.0.0 preview for Linux x64 from the official signed catalog using aik CLI 0.4.0.

Repository Role

AIKernel.Demo demonstrates how applications compose Core, Kernel, Capability modules, VFS, PDP, pipelines, and Replay inspection without putting demo-only code into contract or runtime repositories.

The repository marks the transition from the completed 0.1.0 prototype validation phase to the 0.1.3 release line, where Demo consumes the canonical Core, Control, Providers, Wasm, Tools, CUDA, and GPU DTO contracts.

Demo is a consumer. Runtime execution engines belong in AIKernel.Control. External Provider and Capability modules belong in AIKernel.Providers or their own dedicated runtime repositories. CLI, replay, inspectors, and instrumentation belong in AIKernel.Tools.

Release notes:

Projects

  • AIKernel.Demo.Console - minimal CLI demo for one inference pipeline using Kernel/Provider DI, IInputNormalizer -> StructurePhase -> Provider -> OutputPolisher, deterministic replay logging, and selectable Mock/OpenAI/Local providers.
  • AIKernel.Demo.WebApi - minimal ASP.NET Core host exposing a fixed pipeline summary as JSON at GET /demo/pipeline. See Web API Demo.
  • AIKernel.Demo.Wasm - browser Playground for Context, Execution, VFS visualization, WebAssembly provider calls, WebGPU CPU fallback, canonical GPU canonical HUD/Aisthesis/spatial passes, DAG step animation, and PromptRules signature verification.
  • AIKernel.Demo.Gpu - direct console demo for the canonical GPU raw-framebuffer Aisthesis, spatial reasoning, and offscreen HUD composition pass vocabulary. It runs deterministically through CPU fallback while keeping the shared WebGPU/Dawn/CUDA DTO path visible.
  • AIKernel.Demo.Os - standard OS provider demo that consumes AIKernel.Providers.Standard for CPU compute, process supervision, and safe scheduler examples.
  • AIKernel.Demo.CoreRuntime - Core runtime demo for routing, capability registry, clock, VFS, Hosting, and Kernel helper surfaces.
  • AIKernel.Demo.Contracts - public Contracts, DTOs, Enums, and execution HashChain DTOs as data-only boundary objects.
  • AIKernel.Demo.Control - Control/Bonsai emulator demo for deterministic governance execution.
  • AIKernel.Demo.Providers - official external Provider dry-run demo for ChatHistory, ChatOpenAI, CudaCompute, LocalLlm, MicrosoftAI, and DynamicPipelineCompiler.
  • AIKernel.Demo.StandardProviders - standard OS driver demo for file system, logging, event bus, network metadata, and profiler surfaces.
  • AIKernel.Demo.Tools - instrumentation, canonical formatting, replay, inspector, ROM, and export helper demo.
  • AIKernel.Demo.Cuda - VRAM round trip through the CUDA Driver bundled with AIKernel.Kernel.
  • AIKernel.Demo.Providers.Mock - deterministic mock Provider for contract tests, capability declarations such as chat/embedding, fixed responses, and ProviderRouter behavior checks.
  • AIKernel.Demo.Vfs.Git - Git-backed VFS demo that mounts a Git repository as a virtual file system and demonstrates RAG MaterialContext separation.
  • AIKernel.Demo.Pipelines - purpose-built Chat, RAG, Reasoning, and Multi-step/Multi-model routing pipeline examples.
  • AIKernel.Demo.PDP - PDP visualization for Allow, Deny, Require-Review, cost limit policies, external-send guards, and audit logs.
  • AIKernel.Demo.ReplayInspector - deterministic replay inspection surface for ReplayLog loading, provider selection replay, PromptRules version comparison, and ExecutionState diffs.
  • AIKernel.Demo.Python - Python teaching/demo port of the same contract semantics: DSL parsing, monad-style pipelines, VFS snapshots, semantic deltas, deterministic replay, and one-to-one release surfaces for the nine 0.1.3 C# golden-path demos, including the Wasm GPU canonical teaching path.

Documentation

Japanese:

Quick Start

Start with the release build, then run the smallest demos that prove the public 0.1.3 package surfaces are available. These commands do not require external network access, secrets, model downloads, or native CUDA hardware.

First demo to run: AIKernel.Demo.CoreRuntime.

dotnet build AIKernel.Demo.slnx -c Release
dotnet run --project src/AIKernel.Demo.CoreRuntime/AIKernel.Demo.CoreRuntime.csproj -c Release
dotnet run --project src/AIKernel.Demo.Contracts/AIKernel.Demo.Contracts.csproj -c Release
dotnet run --project src/AIKernel.Demo.StandardProviders/AIKernel.Demo.StandardProviders.csproj -c Release

Common project properties are centralized in Directory.Build.props.

Web API Demo

After the Release build above, start the host from the repository root:

dotnet run --project src/AIKernel.Demo.WebApi/AIKernel.Demo.WebApi.csproj -c Release --no-build --no-launch-profile -- --urls http://127.0.0.1:5080

The host exposes two GET routes. These requests produce the following responses:

Request Status Behavior
GET / 302 Redirects to /demo/pipeline.
GET /demo/pipeline 200 Returns the fixed pipeline summary below as JSON.
POST /v1/chat/completions 404 Not implemented.

In another terminal, read the summary:

Invoke-RestMethod -Uri http://127.0.0.1:5080/demo/pipeline | ConvertTo-Json -Depth 5
{
  "pipelineId": "demo.pipeline.default",
  "decision": 0,
  "contractAlignment": {
    "routingProviderId": "demo.mock",
    "routingModelId": "mock-fixed",
    "dslRootType": "Pipeline",
    "dslFirstStepName": "normalize"
  },
  "stepCount": 4,
  "replay": "steps=4; hash=demo-rep"
}

This is fixed teaching data from DemoPipelineCatalog.CreateDefaultRun(). decision: 0 represents the sample DemoPolicyCode.Allow; the host does not evaluate a request-specific policy, route a request to a provider, or run model inference. replay is a sample summary in the JSON body; the host does not add ReplayLog HTTP headers. An OpenAI-compatible gateway is separate work under DM4. Stop the host with Ctrl+C.

To check both README response examples against the built host, run:

python tests/webapi_docs_smoke.py

This standard-library Python test starts its own host on an ephemeral loopback port and stops it after the checks. It does not require the host above to be running.

Run the Demo Map

Use this order when you want to understand the 0.1.3 package family as an OS-shaped runtime rather than as isolated samples.

Step Demo What the user should learn
1 AIKernel.Demo.CoreRuntime How routing, capability registration, VFS, clock, hosting, and kernel helper surfaces fit together.
2 AIKernel.Demo.Contracts How DTOs, enums, orchestration context, policy results, and execution hash-chain values stay data-only.
3 AIKernel.Demo.Control How deterministic governance execution is represented through Control and Bonsai surfaces.
4 AIKernel.Demo.Providers How official extension Providers expose descriptors, IDs, and invokers without performing live external calls.
5 AIKernel.Demo.StandardProviders How standard OS drivers cover file system, logging, event bus, network metadata, and profiler surfaces.
6 AIKernel.Demo.Tools How canonical formatting, inspection, replay, ROM, and export helpers support reproducible diagnostics.
7 AIKernel.Demo.Wasm How the browser/WASM runtime surface is tested through process lifecycle, deterministic WebGPU fallback paths, and canonical GPU HUD/Aisthesis/spatial passes.
8 AIKernel.Demo.Gpu How the canonical GPU pass vocabulary is exercised directly from a console demo without requiring browser GPU hardware.
9 AIKernel.Demo.Cuda Verify a VRAM round trip on Windows x64 or Linux x64 with the NVIDIA driver.

Run the console demos in one pass:

dotnet run --project src/AIKernel.Demo.Control/AIKernel.Demo.Control.csproj -c Release
dotnet run --project src/AIKernel.Demo.Providers/AIKernel.Demo.Providers.csproj -c Release
dotnet run --project src/AIKernel.Demo.Tools/AIKernel.Demo.Tools.csproj -c Release
dotnet run --project src/AIKernel.Demo.Gpu/AIKernel.Demo.Gpu.csproj -c Release
dotnet run --project src/AIKernel.Demo.Cuda/AIKernel.Demo.Cuda.csproj -c Release

Run the canonical GPU executable documentation:

dotnet test tests/AIKernel.Demo.Tests/AIKernel.Demo.Tests.csproj -c Release --filter RunGpuCanonicalPipeline

Run the validation tests:

dotnet test AIKernel.Demo.slnx -c Release --no-build
py -m pytest tests/AIKernel.Demo.Python.Tests

CLI Tool

AIKernel.Tools.CLI is published as a .NET tool package, so it is not consumed through PackageReference by the in-process demo projects. Install it as the aik command and run the OS command surface directly:

dotnet tool install -g AIKernel.Tools.CLI --version 0.1.3
aik runtime ping
aik system info
aik system vfs --vfs-root .
aik capabilities list

Source Alignment

The demos mirror the Core design decisions: pipelines are DAGs controlled deterministically by the TaskManager, Providers declare replaceable Capabilities, LLMs propose while PDP makes final decisions, and replay captures all material needed to rerun the same execution.

The 0.1.3 release includes contract-alignment smoke paths in AIKernel.Demo.Contracts and AIKernel.Demo.Pipelines: they construct execution hash-chain data through AIKernel.Dtos.Execution.HashChain, routing data through AIKernel.Dtos.Routing.KernelProviderRoutingDecision, and DSL semantic IR through AIKernel.Dtos.Dsl. Demo code remains a consumer of AIKernel.NET contracts and does not depend on Core internal DSL/History runtime types.

For the 0.1.3 release, AIKernelPackageVersion and the Core, Control, Cuda, Providers, Wasm, and Tools package version properties point to the canonical 0.1.3 package family. Demo remains a release validation workspace rather than a package that is published independently. The GPU canonical demo path specifically validates raw-framebuffer Aisthesis, spatial matrix order topos,route,threat,zoe, and offscreen HUD composition through public DTOs.

Contributor Guidelines

Demo changes must follow the shared AIKernel development discipline:

Demos should remain consumers of public contracts, avoid depending on internal runtime types, preserve deterministic replay examples, and document any package version assumptions used for local validation.

License

Apache License 2.0.

About

Runnable AIKernel examples for .NET and WebAssembly. See the README for the package versions used by each example. / AIKernelの実行サンプル集。

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages