AIKernel.Common 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package AIKernel.Common --version 0.1.1
                    
NuGet\Install-Package AIKernel.Common -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AIKernel.Common" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AIKernel.Common" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="AIKernel.Common" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AIKernel.Common --version 0.1.1
                    
#r "nuget: AIKernel.Common, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AIKernel.Common@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AIKernel.Common&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=AIKernel.Common&version=0.1.1
                    
Install as a Cake Tool

AIKernel.Common

日本語

English | 日本語


Overview / 概要

AIKernel.Common provides foundational utility components shared across the entire AIKernel ecosystem.
This library contains cross-cutting features such as JSON serialization helpers, file and path utilities, logging primitives, common exception types, and functional result primitives.

AIKernel.Common is designed as a lightweight, implementation-level support module used by:

  • AIKernel.Core
  • AIKernel.Tools
  • AIKernel.CLI
  • AIKernel.Foundation (optional)

It does not include domain logic or kernel abstractions.
Instead, it offers standardized behaviors and reusable helpers that ensure consistency across all AIKernel modules.


Features / 主な機能

Functional Results

  • Result<T> for fail-closed computation
  • Option<T> for pure optional values
  • Either<L,R> for pure left/right branching
  • ResultStep<TState,TValue> for deterministic step identity, semantic deltas, and replay logs
  • PipelineStep for deterministic finite loops, timeout-style loops, suspend, and resume points
  • LINQ query syntax support through Select, SelectMany, Where, Bind, Map, and Tap

PipelineStep keeps agent-style user-land control flow finite and observable. Each loop iteration, suspend point, and resume point is represented as a ResultStepReplayLogEntry; Map remains a pure projection and does not add a replay node. Use PipelineStepMetadataKeys when reading loop, suspend, and resume metadata from external capability modules. For ResultStep, passing where predicates also remain projections; rejected or throwing predicates append deterministic reject / fail-closed replay nodes.

JSON Utilities

  • Unified JsonSerializerOptions
  • Helper methods for serialization/deserialization
  • JSON file load/save utilities

File & Path Utilities

  • Safe file read/write
  • Path normalization
  • Directory helpers

Logging Primitives

  • Lightweight logging helpers
  • Common log formatting utilities

Common Exceptions

  • Shared exception types
  • Error handling helpers

Shared Helpers

  • Try helpers for exception-to-result conversion
  • Cross-module reusable utilities

Design Philosophy / 設計思想

AIKernel.Common follows the Interface-Led Architecture (ILA) principles:

  • No domain logic
  • No kernel abstractions
  • No dependency on AIKernel.NET (abstractions)
  • Pure implementation-level utilities
  • Stable, reusable, cross-cutting components

This ensures that all AIKernel modules behave consistently while keeping the architecture clean and layered.


Repository Structure / リポジトリ構成

AIKernel.Common/ 
├─ Results/
│ ├─ Result.cs
│ ├─ Option.cs
│ ├─ Either.cs
│ ├─ ResultStep.cs
│ ├─ PipelineStep.cs
│ └─ ErrorContext.cs
├─ Json/ 
│ ├─ JsonOptions.cs 
│ ├─ JsonUtil.cs 
│ └─ JsonFile.cs 
├─ IO/ 
│ ├─ FileUtil.cs 
│ └─ PathUtil.cs 
├─ Logging/ 
│ └─ LogUtil.cs 
├─ Exceptions/ 
│ └─ CommonException.cs 
└─ README.md

Usage Examples / 使用例

JSON Serialization

var json = JsonUtil.ToJson(obj);
var obj2 = JsonUtil.FromJson<MyType>(json);

JSON File I/O

await JsonFile.SaveAsync("data.json", obj);
var loaded = await JsonFile.LoadAsync<MyType>("data.json");

Path Utilities

var full = PathUtil.Normalize("~/data/output.txt");

Deterministic Pipeline Control

var suspended = PipelineStep.Suspend<string, int>(
    "awaiting-approval",
    "Needs user approval.");

var resumed =
    from approval in PipelineStep.Resume(
        suspended.ReplayLog,
        "approved",
        1,
        "User approved.")
    from looped in PipelineStep.Loop(
        ResultStep<string, int>.Success("agent", approval),
        maxIterations: 2,
        static (iteration, value) => ResultStep<string, int>
            .Success($"agent:{iteration}", value + 1))
    select looped;

License / ライセンス

Apache License 2.0

Contributing / コントリビュート

Contributions are welcome. Please follow the AIKernel ecosystem’s coding style and architectural guidelines.

AIKernel 全体のアーキテクチャガイドラインに従ってください。

Common owns the monadic primitives used by the rest of the ecosystem, so changes here must preserve LINQ composition, fail-closed semantics, deterministic identity metadata, and bilingual public documentation comments.

Common は ecosystem 全体で利用される monadic primitive を所有します。そのため、 ここでの変更は LINQ composition、fail-closed semantics、deterministic identity metadata、public API の bilingual documentation comment を維持してください。

Maintainer / メンテナー

AIKernel Project Maintained by Takuya.S

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (15)

Showing the top 5 NuGet packages that depend on AIKernel.Common:

Package Downloads
AIKernel.Core

EN: Core runtime engine for AIKernel.NET. Provides the foundational execution logic for VFS, ROM, Context construction, and inference execution in a deterministic Knowledge OS. JA: AIKernel.NET の Core ランタイムエンジンです。決定論的な Knowledge OS における VFS、ROM、Context 構築、推論実行の基礎ロジックを提供します。

AIKernel.Providers.MicrosoftAI

EN: Microsoft.Extensions.AI based provider implementation for AIKernel.NET. Enables OpenAI-compatible model execution while preserving AIKernel's capability-based provider model. JA: Microsoft.Extensions.AI を利用した AIKernel.NET 向け Provider 実装です。AIKernel の Capability ベース Provider モデルを維持しながら、OpenAI 互換モデル実行を可能にします。

AIKernel.Control.Core

Control-plane runtime entry package for AIKernel.Control. Provides Bonsai provider contracts, model config/tokenizer/model-state wrappers, provider capabilities, and the public governance execution boundary built on AIKernel.NET contracts.

AIKernel.Providers.ChatOpenAI

EN: Official AIKernel.NET extension provider for OpenAI-compatible ChatCompletion, Embedding, and Moderation endpoints. JA: OpenAI 互換 ChatCompletion、Embedding、Moderation endpoint 向けの AIKernel.NET 公式拡張 Provider です。

AIKernel.Providers.DynamicPipelineCompiler

EN: Official AIKernel.NET extension provider for dynamic semantic pipeline compilation. JA: 動的 semantic pipeline compile を AIKernel 上で扱うための AIKernel.NET 公式拡張 Provider です。

GitHub repositories

This package is not used by any popular GitHub repositories.

AIKernel.Core package family v0.1.1 - Release build aligned with official AIKernel.NET contract packages v0.1.1. Adds Core-owned ROM storage and VFS Git capability contracts, built-in SkillProvider, LocalExecutionProvider, MinimalRuntimeProvider, VfsProvider, SystemInfoProvider, dynamic provider registry surfaces, matching Python descriptors, broader monadic DSL/ROM/VFS parsing, validation, invocation, metadata boundaries, ResultStep Match projection, safer DSL/ROM/Kernel execution branching, and additional Result/Either/Option adapter projection cleanup.