Consent expiry is now per kind of data: renewing text no longer renews an expired image permission. A connection edit keeps models found by a test at the new address, and drops only the ones saved for the old one.
1.4 KiB
Craft AI model
craft-ai-core is the data model and contract for AI in the Craft Apps: connections, models,
capabilities, roles (tools), requests, jobs, consent, request history, the shared store's file
format, and the declarative route spec. It has no I/O, no async runtime and compiles for
wasm32-unknown-unknown. It depends only on serde and serde_json.
One connection is set up once (in the launcher or any app) and every app that has the tool uses it. Each app keeps its own interface for each tool.
Boundaries
- Never crashes: the crate denies
unwrap,expect,panicand friends, and the workspace forbidsunsafe. - No secrets: a connection holds a reference to a secret (
SecretRef), never the value.SecretStringdoes not print. - No app code: an app is only an
AppIdstring. The contract is described in docs/ai-shared-layer.md and the declarative route spec in docs/ai-declarative-adapter.md.
Later pull requests add the desktop half (secret stores and the shared store file), the client, the provider adapters and egui widgets as separate crates.
Platforms
All platforms, including wasm32-unknown-unknown (checked in CI). No I/O.
Usage
Depend on it for the types. Worked examples: tests/custom_tools.rs, tests/mock_conformance.rs, tests/spec_calls.rs; the contract is in docs/ai-shared-layer.md.