Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build test validate dist release-dry-run clean
.PHONY: build test validate validate-portable-ai dist release-dry-run clean

BIN := sourceos-ai
DIST_DIR := dist
Expand All @@ -17,7 +17,10 @@ build:
test:
go test ./...

validate: build
validate-portable-ai:
python3 tools/validate_portable_ai_packs.py

validate: build validate-portable-ai
python3 tools/validate_carry_refs.py
bin/$(BIN) carry validate --refs examples
bin/$(BIN) validate --refs examples
Expand Down
163 changes: 163 additions & 0 deletions contracts/model-carry-pack.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.srcos.ai/model-carry/model-carry-pack.schema.json",
"title": "SourceOS Model Carry Pack",
"description": "A governed portable model pack manifest for SourceOS Portable AI Kit and Local Model Door profile families.",
"type": "object",
"additionalProperties": false,
"required": [
"schemaVersion",
"kind",
"packId",
"displayName",
"profileKey",
"model",
"runtimeCompatibility",
"footprint",
"provenance",
"taskClasses",
"labels",
"policy",
"evidence"
],
"properties": {
"schemaVersion": { "const": "v0.1" },
"kind": { "const": "ModelCarryPack" },
"packId": { "type": "string", "pattern": "^urn:srcos:model-carry-pack:" },
"displayName": { "type": "string", "minLength": 1 },
"profileKey": {
"type": "string",
"enum": ["tiny-router", "laptop-safe", "office-local", "code-local", "field-kit", "byom-gguf"]
},
"model": {
"type": "object",
"additionalProperties": false,
"required": ["name", "family", "parameterClass", "quantization", "format"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"family": { "type": "string", "minLength": 1 },
"parameterClass": { "type": "string", "enum": ["sub-1b", "1b", "3b", "4b", "7b", "8b", "12b", "other"] },
"quantization": { "type": "string", "minLength": 1 },
"format": { "type": "string", "enum": ["ollama-ref", "gguf", "runtime-managed", "openai-compatible-local", "other"] },
"contextWindowHint": { "type": ["integer", "null"], "minimum": 1 },
"diskSizeHintMb": { "type": ["integer", "null"], "minimum": 1 },
"memoryHintMb": { "type": ["integer", "null"], "minimum": 1 }
}
},
"runtimeCompatibility": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"enum": ["ollama-compatible", "llama.cpp", "openai-compatible-local", "vllm", "sglang", "mlx", "other"]
}
},
"footprint": {
"type": "object",
"additionalProperties": false,
"required": ["minimumFreeGb", "recommendedFreeGb", "minimumRamGb", "recommendedRamGb"],
"properties": {
"minimumFreeGb": { "type": "integer", "minimum": 1 },
"recommendedFreeGb": { "type": "integer", "minimum": 1 },
"minimumRamGb": { "type": "integer", "minimum": 1 },
"recommendedRamGb": { "type": "integer", "minimum": 1 }
}
},
"provenance": {
"type": "object",
"additionalProperties": false,
"required": ["sourceKind", "sourceUrl", "licenseRef", "sha256RequiredBeforeEligibility"],
"properties": {
"sourceKind": { "type": "string", "enum": ["runtime-catalog", "huggingface", "local-file", "vendor", "unknown"] },
"sourceUrl": { "type": ["string", "null"] },
"licenseRef": { "type": "string", "minLength": 1 },
"modelCardRef": { "type": ["string", "null"] },
"sha256": { "type": ["string", "null"], "pattern": "^[a-fA-F0-9]{64}$" },
"sha256RequiredBeforeEligibility": { "type": "boolean" }
}
},
"taskClasses": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"enum": [
"router",
"triage",
"summarization",
"rewrite",
"office-assist",
"artifact-drafting",
"coding-assist",
"repo-triage",
"privacy-first-chat",
"offline-fallback",
"operator-assist",
"evidence-inspection",
"workroom-local",
"field-workroom",
"operator-selected"
]
}
},
"labels": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"enum": [
"local-only",
"offline-fallback",
"coding",
"office",
"multilingual",
"low-memory",
"quality-fallback",
"field-kit",
"byom-unverified",
"byom-verified",
"runtime-managed"
]
}
},
"policy": {
"type": "object",
"additionalProperties": false,
"required": [
"localOnlyDefault",
"promptEgressDefault",
"allowToolUseDefault",
"allowNetworkDefault",
"requiresExplicitImport",
"requiresEvidence"
],
"properties": {
"localOnlyDefault": { "type": "boolean" },
"promptEgressDefault": { "type": "string", "enum": ["deny", "policy-gated"] },
"allowToolUseDefault": { "type": "boolean" },
"allowNetworkDefault": { "type": "boolean" },
"requiresExplicitImport": { "type": "boolean" },
"requiresEvidence": { "type": "boolean" },
"eligibleForRoutingBeforeHash": { "type": "boolean", "default": false },
"maxPromptChars": { "type": ["integer", "null"], "minimum": 1 }
}
},
"evidence": {
"type": "object",
"additionalProperties": false,
"required": [
"emitPackVerification",
"emitRuntimeHealth",
"emitRouteDecision",
"emitPromptHashOnly"
],
"properties": {
"emitPackVerification": { "type": "boolean" },
"emitRuntimeHealth": { "type": "boolean" },
"emitRouteDecision": { "type": "boolean" },
"emitPromptHashOnly": { "type": "boolean" }
}
},
"notes": { "type": "string" }
}
}
93 changes: 93 additions & 0 deletions contracts/portable-ai-root.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.srcos.ai/model-carry/portable-ai-root.schema.json",
"title": "SourceOS Portable AI Root",
"description": "A portable USB/SSD root manifest for a governed SourceOS local AI kit.",
"type": "object",
"additionalProperties": false,
"required": [
"schemaVersion",
"kind",
"rootId",
"displayName",
"layoutVersion",
"profileKey",
"directories",
"surfaces",
"modelPackRefs",
"policy",
"evidence"
],
"properties": {
"schemaVersion": { "const": "v0.1" },
"kind": { "const": "PortableAIRoot" },
"rootId": { "type": "string", "pattern": "^urn:srcos:portable-ai-root:" },
"displayName": { "type": "string", "minLength": 1 },
"layoutVersion": { "type": "string", "pattern": "^sourceos.portable-ai/" },
"profileKey": {
"type": "string",
"enum": ["tiny-router", "laptop-safe", "office-local", "code-local", "field-kit", "byom-gguf"]
},
"directories": {
"type": "object",
"additionalProperties": false,
"required": ["manifests", "runtimes", "models", "cache", "state", "surfaces", "evidence", "tmp"],
"properties": {
"manifests": { "type": "string" },
"runtimes": { "type": "string" },
"models": { "type": "string" },
"cache": { "type": "string" },
"state": { "type": "string" },
"surfaces": { "type": "string" },
"evidence": { "type": "string" },
"tmp": { "type": "string" }
}
},
"surfaces": {
"type": "array",
"minItems": 1,
"items": { "type": "string", "enum": ["turtleterm", "agent-term", "bearbrowser", "local-web", "anythingllm-adapter"] }
},
"modelPackRefs": {
"type": "array",
"items": { "type": "string", "pattern": "^urn:srcos:model-carry-pack:" }
},
"policy": {
"type": "object",
"additionalProperties": false,
"required": [
"promptEgressDefault",
"hostWritesDefault",
"toolUseDefault",
"networkDefault",
"runtimeActivation",
"modelDownloads",
"bindAddressDefault",
"zeroTraceSupported"
],
"properties": {
"promptEgressDefault": { "type": "string", "enum": ["deny", "policy-gated"] },
"hostWritesDefault": { "type": "string", "enum": ["deny", "workroom-scoped", "repo-scoped", "evidence-scoped"] },
"toolUseDefault": { "type": "string", "enum": ["deny", "policy-gated"] },
"networkDefault": { "type": "string", "enum": ["deny", "loopback-only", "policy-gated"] },
"runtimeActivation": { "type": "string", "enum": ["agent-machine-gated"] },
"modelDownloads": { "type": "string", "enum": ["explicit-only"] },
"bindAddressDefault": { "type": "string", "enum": ["127.0.0.1"] },
"zeroTraceSupported": { "type": "boolean" }
}
},
"evidence": {
"type": "object",
"additionalProperties": false,
"required": ["preflightDir", "materializationDir", "activationDir", "wipeDir", "promptBodiesStored"],
"properties": {
"preflightDir": { "type": "string" },
"materializationDir": { "type": "string" },
"activationDir": { "type": "string" },
"wipeDir": { "type": "string" },
"promptBodiesStored": { "type": "boolean" }
}
},
"notes": { "type": "string" }
}
}
Loading
Loading