AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
Swift 기반 CBOR‑LD 구현으로 결정적 인코딩·엄격 디코딩·다언어 검증·선택적 SemanticCompute 어댑터를 제공합니다
A native Swift CBOR-LD implementation with deterministic encoding, strict decoding, cross-language verification, and an optional SemanticCompute adapter.
개발 도구Swift · ShellGitHub @entertrainmentuk온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기A native Swift implementation of CBOR-LD with deterministic encoding, strict decoding, integrity primitives, and cross-language interoperability evidence.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
Swift-CBORLD is a native Swift implementation of the CBOR-LD processor. It
encodes and decodes JSON-LD-shaped values, preserves the established
JavaScript-compatible wire representation by default, exposes deterministic
serialization profiles explicitly, validates untrusted envelopes, and keeps
integrity evidence separate from authentication.
It is also the neutral host for the CBOR-LD Interop Lab: public fixtures,
portable CPU references, immutable comparator pins, and machine-readable
evidence contracts that any implementation or compute provider can use.README 전문 보기 ↗Swift-CBORLD is a native Swift implementation of the CBOR-LD processor. It encodes and decodes JSON-LD-shaped values, preserves the established JavaScript-compatible wire representation by default, exposes deterministic serialization profiles explicitly, validates untrusted envelopes, and keeps integrity evidence separate from authentication.
It is also the neutral host for the CBOR-LD Interop Lab: public fixtures, portable CPU references, immutable comparator pins, and machine-readable evidence contracts that any implementation or compute provider can use.
This is an independent implementation. It is not an official Digital Bazaar or W3C project and is not endorsed by either organization.
Release status:
0.1.0is a source-first preview. The module and product are namedCBORLD; the repository and package identity areswift-cborld.
Apple platforms listed in Package.swift are source compatibility floors, not
a claim that every OS/toolchain combination has been runtime tested. macOS and
Linux release builds are CI gates for the preview.
Add the 0.1.0 preview as a source package:
dependencies: [
.package(
url: "https://github.com/entertrainmentuk/swift-cborld.git",
from: "0.1.0")
]
Then add the library product to your target:
.product(name: "CBORLD", package: "swift-cborld")
Import the module with:
import CBORLD
JSONValue represents the complete JSON data model and supports Swift
literals:
import CBORLD
let document: JSONValue = [
"@context": [
"type": "@type",
"Note": "https://www.w3.org/ns/activitystreams#Note",
"summary": "https://www.w3.org/ns/activitystreams#summary"
],
"type": "Note",
"summary": "CBOR-LD from Swift"
]
let bytes = try await CBORLDEncoder().encode(document)
let restored = try await CBORLDDecoder().decode(bytes)
precondition(restored == document)
The static API also accepts Encodable & Sendable values and materializes
Decodable & Sendable models directly.
Compression and expansion must use the same JSON-LD context. A controlled registry can pin the parsed context structure before it is used:
let contextURL = "https://example.com/contexts/notes-v1"
let context: JSONValue = [
"@context": [
"type": "@type",
"Note": "https://example.com/Note",
"summary": "https://example.com/summary"
]
]
let expected = try CBORLD.contextFingerprint(of: context)
let registry = CBORLDContextRegistry(
documents: [contextURL: context],
expectedFingerprints: [contextURL: expected]
)
let encoder = CBORLDEncoder(documentLoader: registry.documentLoader)
Applications should explicitly decide whether a network fallback is allowed. The registry verifies fallback results against configured pins before the processor consumes them.
Compatibility encoding remains the default so established JavaScript byte fixtures do not move:
let compatible = try await CBORLDEncoder().encode(document)
let deterministic = try await CBORLDEncoder(
serializationMode: .lengthFirstDeterministic
).encode(document)
Serialization modes are separate contracts:
| Mode | Contract |
|---|---|
.compatibility | Existing JavaScript-compatible representation; default |
.deterministic | Original package length-first deterministic behavior |
.lengthFirstDeterministic | RFC 8949 section 4.2.3 key ordering |
.coreDeterministic | RFC 8949 section 4.2.1 bytewise lexical ordering |
The named deterministic profiles emit floating-point values in the shortest exact width and normalize NaN to the preferred half-precision representation.
Transport bytes and parsed structure have different meanings and therefore different hash domains:
let transport = CBORLD.transportDigest(of: bytes, algorithm: .sha256)
try CBORLD.verify(bytes, against: transport)
let structure = try CBORLD.structuralFingerprint(
of: document,
algorithm: .sha512
)
try CBORLD.verifyDocument(document, against: structure)
encoded-bytes is an ordinary hash of the exact transport bytes.document-structure, context-document, and document-dictionary use
deterministic CBOR with a versioned, domain-separated prefix.CBORLDDigest carries and validates its algorithm, domain, version, and
digest bytes.The optional integrity manifest is a versioned sidecar and never changes the CBOR-LD envelope. It contains no signature, key, certificate, or authentication material. Authenticate a transport digest in the enclosing protocol when producer identity matters.
let limits = CBORLDDecodingLimits(
maximumInputBytes: 8 * 1_024 * 1_024,
maximumNestingDepth: 64,
maximumContainerItems: 100_000,
rejectDuplicateMapKeys: true,
allowsIndefiniteLengthItems: false
)
let inspection = try CBORLD.inspect(bytes, limits: limits)
print(inspection.format)
print(inspection.transportDigest)
Inspection parses the complete envelope without loading contexts. Strict decoding can additionally reject non-preferred integer, length, and floating point widths and require a named deterministic representation.
The core package defines versioned provider protocols and deterministic CPU references for SHA-256 batches, byte diff, CBOR structural scan, integer prefix scan and compaction, byte statistics, canonical key ordering, UTF-8 validation, multibase, unsigned varint, immutable dictionary probes, bounded whole-document transform, and CDDL validation through an injected independent oracle.
These contracts let an application validate results from SemanticCompute, MCP, or another backend one family at a time. The CPU provider is reference evidence only; it does not prove accelerator catalogue registration, legality, lowering, compilation, hardware execution, or doctor parity.
The SemanticCompute adapter is intentionally not included in the 0.1.0 core
tree. The intended companion distribution is
swift-cborld-semanticcompute, after SemanticCompute 1.23.0 is publicly
resolvable and independently verified. Importing that future package will add
a separately licensed commercial binary dependency and newer Apple deployment
floors; neither is required to build, test, or use Swift-CBORLD.
The public family identifiers and acceptance rules remain owned by CBORLD. There are 12 conceptual additions and 13 stable identifiers because prefix scan and byte compaction are represented separately. Another implementation is free to provide the same protocols without SemanticCompute.
The retained Swift fixtures cover CBOR-LD envelope bytes asserted by independent Rust and Python processors and a small RFC 8949 CBOR corpus. Source, version, and license metadata live beside the vectors.
On the recorded Apple-silicon test setup, the Swift and Rust implementations both passed all 11 measured fixtures with byte-identical encoding. Swift had the lower in-process round-trip median in 11 of 11 fixtures and a 2.22x aggregate round-trip speedup for that corpus. This is fixture-, machine-, toolchain-, and measurement-bound evidence—not a universal performance claim and not a claim about cold CLI startup. It is a Swift CPU result: SemanticCompute did not cause the recorded 2.22x speedup.
Future acceleration reports use three separately labelled lanes: Rust CPU, Swift CPU, and Swift plus an optional provider. A conforming report states the backend, hardware, toolchains, batch and byte counts, dispatch overhead, crossover point, memory boundary, exact parity result, and whether execution used hardware or fell back to the CPU. Unmeasured or unavailable lanes remain explicitly unavailable rather than inheriting a result from another lane.
Swift-CBORLD performs the CBOR-LD transform used by the reference processor. It is not a complete JSON-LD expansion, compaction, framing, or RDF dataset canonicalization engine.
A structural fingerprint proves equality of JSON-shaped structure under the package's deterministic ordering. It does not prove that two different JSON-LD documents describe the same RDF dataset. Use an appropriate JSON-LD/RDF canonicalization algorithm before signing semantic claims.
The package does not provide digital signatures, certificate trust, Merkle proofs, or content-addressed persistence.
Run the local release gates:
Scripts/validate-release.sh
Or invoke the principal checks separately:
swift format lint --recursive Sources Tests Package.swift
swift build -c release -Xswiftc -warnings-as-errors \
--explicit-target-dependency-import-check error
swift test -c release --disable-swift-testing
The default suite remains offline. An additional opt-in, digest-only SemanticCompute Live byte-parity check is documented in SEMANTICCOMPUTE_LIVE.md; it is integration evidence, not an authentication or accelerator-execution claim.
See CONTRIBUTING.md, SECURITY.md, and RELEASING.md before proposing changes or a tag.
Swift-CBORLD is distributed under the BSD-3-Clause license. Portions of the
implementation, interoperability fixtures, and reference material originate
from or are derived from Digital Bazaar's cborld project and retain the
required notices. Independent fixture sources retain their own license and
attribution.
See LICENSE, PROVENANCE.md, and THIRD_PARTY_NOTICES.md.