asystant_core 0.6.0
asystant_core: ^0.6.0 copied to clipboard
Typed local tools, protocol models and the OpenRouter and Claude Code providers for embedded assistants.
0.6.0 #
- Business APIs (
business/, pure Dart): typed contracts of administrative APIs that an assistant can register and operate.BusinessContractwithdev/prodBusinessEndpoints andBusinessOperations whoseBusinessFields are typed (BusinessFieldKind) and located (BusinessFieldLocation: path, query, body or header).BusinessContract.parsereads untrusted JSON into aResult;validateContract()checks addresses, headers, sign-in, profiles and operations.- Sign-in as data:
BusinessAuthFlowlistsBusinessAuthSteps (request,verify,password,totp,refresh) with theBusinessAuthInputs the person types (email,password,code,totp,text), fixed editableparameters(such ascompany_idandapplication_id), headers, the token path in the answer and renewal. Named constructors build the common flows (bearer,apiKey,emailCode,emailCodeTotp,emailPassword,emailPasswordTotp,aulaMasOperator,sstOperator). - Several
BusinessCredentialProfiles per environment (for exampleadminandguest), each with its own session, keyed byBusinessCredentialScope. BusinessSignInruns a flow through aBusinessSignInPrompterand renews a session once at a time per scope;BusinessExecutorruns an operation, renews once on 401 and redacts the answer (BusinessRedaction).- Interfaces for the host:
BusinessHttp(defaultBusinessHttpClientoverpackage:http),BusinessCredentialStoreandBusinessContractStore. Failures areBusinessFailurevalues, never exceptions. - Source documents:
BusinessDocumentkeeps the document a business was registered from (such as its endpoints.md),BusinessDocumentStorestores one per business (InMemoryBusinessDocumentStoreby default), andBusinessDocumentReadingsplits it at its Markdown headings and returns the sections that match a query, ranked byAsystantKnowledgeand cut to a size. - Compatibility:
BusinessEndpoint.fromJsonalso reads the first contract format, whose flatauth_kindand routesBusinessAuthFlow.fromLegacyJsonturns into a flow.
0.5.2 #
PrivateInputField.initialValue: pre-fills a private input field (its own last value, or a known public default). Never applies toPrivateInputKind.secret,.password,.codeor.totp.- Add
PrivateInputKind.email: entered in clear liketext, with an email keyboard, and pre-filled frominitialValue. Exhaustiveswitches overPrivateInputKindneed the new case.
0.5.1 #
- Add
ToolContext.requestPrivateInputwith typed, ephemeral fields for local tools. Values are returned only to the tool.
0.5.0 #
- Extend
AsystantAttachmentPolicywith MIME types and host-supplied regular expressions for file names and text content.
0.4.0 #
- Add
OpenAICompatibleProviderfor user-supplied HTTPS Chat Completions endpoints. It shares the streaming and tool-call codec with OpenRouter while omitting OpenRouter-only request fields and metadata paths. - Allow
OpenRouterTransportto run in compatibility mode with an explicit preferred model; streamed inference requests do not follow redirects.
0.3.1 #
- Add
ToolField.acceptsSecretto declare the only fields eligible for a private chat reference during local execution. - Add an opt-in credential-content guard to
AsystantAttachmentPolicyand asensitiveContentattachment issue.
0.3.0 #
ToolContext.reportProgress(fraction, label: ...): a long tool reports how far it has come (0 to 1, clamped; non-finite values ignored) with an optional short label for the person. The context forwards it to an optionalonProgress(ToolProgressListener) given by whoever runs the tool; it never reaches the model and does nothing once the call is canceled.- Local knowledge (RAG):
AsystantKnowledge, a local index ofKnowledgeDocuments (id, title, text, optional collection, tags and metadata) withput(add or replace by id),putAll,removeandclear. It ranks with BM25 over title, tags and text, normalized for Spanish and English (lower case, accents folded, stop words of both languages, light plural and gender stemming, prefix matching for query words of four letters or more), filters by collection and tags, and returnsKnowledgeHits with the most relevant passage instead of the whole document.toJson/fromJsonsave and restore it; the app decides where. Lexical by design: no service, model or dependency, and deterministic. KnowledgeRetriever: the contract the search tool and apps depend on (search(KnowledgeQuery),collections), so a semantic or hybrid retriever can replace the lexical index later without changing the apps.KnowledgeSearchTool: an optional built-in, read-only tool (search_knowledgeby default, configurable) that the model calls withquery, an optionalcollectionandlimit, and that answers with compact JSON:id,title,collection,scoreandsnippetper hit. It works the same with every provider.ToolOutcome.images: a tool can return images (PNG, JPEG, GIF, WebP bytes asAsystantAttachments) for the model to look at, such as a rendered frame for visual self-review. They are kept as theattachmentsof the tool's result message, next to the person's own attachments.AssistantTransport.supportsImageInput(model): a provider-neutral capability, false by default. A transport that cannot send images sendsAsystantAttachment.imageUnavailableNoteinstead. Custom transports that send images override it.OpenRouterTransport: a tool's images follow its results as oneusermessage after the last consecutive tool result, labelled with thecall_id, because OpenRouter only accepts text intoolmessages. Images for a model without image input are sent as the note.ClaudeCliTransport: stdin is now one--input-format stream-jsonuser message, the transcript followed by base64imageblocks, so the person's images and a tool's images reach the model; previously images were only announced by name.ClaudeCliProtocol.inputbuilds it. Tools, context,endsTurn, cancellation and the isolation flags are unchanged.ToolOutcome.endsTurn: a tool can end the person's turn (for example, a product approval that only the person can answer). The chat does not call the model again and answers the other calls of that response without running them.ToolOutcome.summary(a one-line account of what was done, shown instead of the preview title once the tool completes) andToolOutcome.data(structured result for the host, never sent to the model).ToolField.optionsdeclares the accepted values of a string (schemaenum), andToolFieldKind.objectswithToolField.fieldsdeclares a list of objects with their own fields. Both providers send them in the tool schema.ToolRegistry.resolveexplains what is wrong in the failuredetail(unknown tool with the available ones, missing or unexpected argument, wrong type, a value outside its options), and treatsnullfor an optional argument as absent.AssistantTransport.inferreceivestools, the tools available for that request; both providers declare those instead of the ones registered atinitializewhen given. Custom transports must add the parameter.OpenRouterTransportreplaces the formerGatewayTransportandSessionSource: the host supplies anOpenRouterCredentialSource(for example a budget-limited key issued by asystant-api) and the transport talks to OpenRouter directly.- Security: a cached OpenRouter key is bound to the identity it was issued for; after a login change the transport requests a new key instead of reusing the previous user's.
ClaudeCliTransport: a desktop transport over the local Claude Code CLI, using the user's subscription without an API key. Tools are declared in the system prompt and returned as regularToolCalls; the CLI's own tools, MCP servers and user customizations are disabled. Compiles on the web, where it reports the platform as unsupported.- Providers: the sealed
AsystantProvider, withOpenRouterProviderandClaudeCodeProvider, is how an assistant chooses where answers come from. Each variant implementscreateTransport();verify()andmodelCatalog()work for any provider. Each provider lives insrc/providers/<name>/with everything it needs; adding one changes no other provider or common code (see "Adding a provider" indocs/public-api.md). Public imports are unchanged. AssistantTransport.verify()andAssistantTransport.modelCatalog(), with defaults that report them as unsupported, return the provider-neutralAsystantProviderStatusandAsystantModelCatalog.ClaudeCodeProvider/ClaudeCliTransport:verify()runsclaude --versionandclaude auth status --json(no inference) and reports version, sign-in and plan, never the email;modelCatalog()reads the models and effort levels fromclaude --help, falling back toClaudeCliCatalog.bundled. With no models,initializeoffers that catalog (ClaudeCliTransport.defaultModelsis replaced byClaudeCliCatalog.bundledModels). NewdefaultModel. The CLI runs with its own directory first onPATH, so an npm install findsnodefrom a Finder-launched app.ClaudeCliLauncher.runruns short commands that send no prompt; custom launchers must implement it.OpenRouterProvider/OpenRouterTransport:verify()checks the key withGET /api/v1/key(no inference);modelCatalog()lists the credential's allowed models.
0.2.0 #
- Deferred Flutter initialization:
init()stores configuration; the mounted chat connects after its first frame. Headless clients awaitensureInitialized()explicitly. - Injectable application/context prompts and baseline safety guidance in SDK and gateway.
- Typed genUI bar/line charts, bounded numeric tool arguments and English golden previews.
- Initialization retry, concurrent setup deduplication and lifecycle cleanup.
0.1.0 #
- Initial MIT-licensed release.
- Typed local tools, explicit permissions and cancellation-aware execution.
- Session-backed gateway authentication and server-assigned model policies.
- English examples and integration guidance for the reference Rust API.
- Flutter-independent models, transport contracts and SSE gateway client.