mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-12 08:52:32 +00:00
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.
31 lines
1.4 KiB
Markdown
31 lines
1.4 KiB
Markdown
# 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`, `panic` and friends, and the workspace
|
|
forbids `unsafe`.
|
|
- No secrets: a connection holds a reference to a secret (`SecretRef`), never the value.
|
|
`SecretString` does not print.
|
|
- No app code: an app is only an `AppId` string. The contract is described in
|
|
[docs/ai-shared-layer.md](../../docs/ai-shared-layer.md) and the declarative route spec in
|
|
[docs/ai-declarative-adapter.md](../../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](../../docs/ai-shared-layer.md).
|