feat(cordis): 接入上下文组合与模组事务热替换

This commit is contained in:
2026-08-16 23:20:40 +08:00
commit ad256f109b
676 changed files with 52168 additions and 0 deletions
@@ -0,0 +1,57 @@
#nullable enable
using System;
namespace ShrinkContext
{
/// <summary>共享存储中的一条依赖绑定:键解析到 realm 后对应的值与提供者纤程。</summary>
public sealed class ShrinkBinding
{
public ShrinkBinding(object? value, ShrinkFiber? provider, string key)
{
Value = value;
Provider = provider;
Key = key;
}
public object? Value { get; }
public ShrinkFiber? Provider { get; }
public string Key { get; }
}
/// <summary>访问了纤程链上没有任何一方声明的依赖键(论文算法 6 的 UNDECLARED_ACCESS)。</summary>
public sealed class ShrinkUndeclaredAccessException : Exception
{
public ShrinkUndeclaredAccessException(string key)
: base($"Undeclared coeffect access: '{key}'. Declare it in the component's Inject list.")
{
Key = key;
}
public string Key { get; }
}
/// <summary>纤程声明了依赖键但尚未激活就访问(论文算法 6 的 INACTIVE_ACCESS)。</summary>
public sealed class ShrinkInactiveAccessException : Exception
{
public ShrinkInactiveAccessException(string key, string fiberName)
: base($"Inactive coeffect access: '{key}' declared by fiber '{fiberName}' but not committed yet.")
{
Key = key;
}
public string Key { get; }
}
/// <summary>两个活跃纤程试图供给同一个 realm(论文定义 45 的供给不相交约束)。</summary>
public sealed class ShrinkSupplyConflictException : Exception
{
public ShrinkSupplyConflictException(string key, ShrinkFiber? existing, ShrinkFiber? setter)
: base($"Supply conflict on key '{key}': existing provider " +
$"'{existing?.Name ?? "<ambient>"}' conflicts with '{setter?.Name ?? "<ambient>"}'.")
{
Key = key;
}
public string Key { get; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2dcad9bdadb1607498dc233cfc1b5a06
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: