Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Rebuild provider selection as the providerService data face - #2490

Draft
eric8810 wants to merge 91 commits into
mainfrom
dim/2019-providers
Draft

eric8810 wants to merge 91 commits into
mainfrom
dim/2019-providers

Conversation

@eric8810

@eric8810 eric8810 commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Refs #2019

Adds the providerService data face to dim-agent-capabilities with nine owner operations: resolve, preferences, selectable, invoke, prepareStartup, retainStartup, releaseStartup, mediaRoute, credential.

Implements the face for Provider (product profile) and ConfiguredModels (API-key profile). Retires ModelSelectionHost, SelectableModelsHost and AuxiliaryModel with their provide points and hand-written dispatchers, migrates all production callers and tests, updates the TypeScript declarations and runtime fixture, and removes the three access-layer entries.

Remaining for later blocks of #2019: account faces (DimOAuth, Codex, Grok, ChatGPT), managedSearch, providerConnectionResolver, modalityConnectionHost, modelHost, ProviderService forwarding methods and the Rpc startup/management wording. Generated catalogs (catalog.md, npm/branch-services.d.ts) are stale and must be regenerated in the implementation phase.

Remove the Store wrapper and its forwarding methods; SessionStore now serves
the store host face and owns the Rust binding. Callers inject the owner type,
and the plugin registers one name for it.

Refs #2018
Drop the SqliteDispatch adapter; the engine type itself implements the host
face, so the plugin registers the same owner it provides to Rust callers.

Refs #2018
Remove the SessionMetadata wrapper and its separate face; SessionStore serves
title and setTitle, and Agents and SessionTitle read the same owner.

Refs #2018
The `prompt-suggestion` source reached PromptSuggestion through a
hand-written `HostDispatch` wrapper (`PromptSuggestionSettingsHost`), a
second interface beside the owner's read. The App Server's owner now serves
`promptSuggestionSettings.read` on the wire and the same read through the
`PromptSuggestionSettingsRead` port, the wrapper is deleted, and the Session
part declares the port instead of the wrapper type.

Refs #2017
Rename the SessionFiles wrapper and its trait to a SessionFilesHost port,
delegate its operations, and migrate the eight consumers plus the runtime
fixture call sites. App Server's file owner implements the port and the plugin
provides the port handle.

Refs #2018
Move the remaining App Server, image, attachment, MCP and flow-test callers
from the removed SessionFiles wrapper to the SessionFilesHost port.

Refs #2018
The execution switches reached HostPlatform, the `settings` tool and the
snapshot branch through a hand-written `HostDispatch` wrapper
(`ExecutionSettingsHost`) that also carried the document type. The App Server's
owner now serves `executionSettings.read` over the same value, the port is the
`ExecutionSettingsRead` trait, and the document type takes the contract's name
`Switches`. Assemblies without a stored source build the same value through
`execution_settings::fixed`.

Refs #2017
The owner now serves twelve operations on FileStorage itself:
add_root, root_path, stat, read, write, import, update,
create_directory, list, remove, claim and release. Reads are stateless
offset reads, write pulls its source by callback, update runs its change
under the file's key, and claim/release hold the published auth.json.lock
marker for an account row.

Delete the FsHost wrapper and its HostDispatch, the FileLease and
FileReader handles, FilePath, FsPermissions and FsRemove, the old
FileStorage object methods, and the fileStorage catalog row. Keep the
fsHost name on the FileStorage type. Replace FileStorageError's public
surface with FileError's eight codes.

Migrate the Hooks project read, ModelLog's root path, UiResources'
publish/page reads and UiExtensions' copy and read paths to the
operations. Update the owner page and the flow test.

Refs #2016
The port still serves sessionFiles through a hand-written HostDispatch; list
the new real type rather than dropping the entry by renaming. Converting it to
a service data face stays for the debug phase.

Refs #2018
Settings and WorkflowFiles use add_root, root_path, read, write,
create_directory and the compare-and-set update, with the document
revision checked inside change. SessionStore reads and writes Session
files through read, write, import, list, stat and remove. HostPlatform
and its exec-shell face read through read and replace through update.

Refs #2016
Make the internal error and result crate-private, correct the streaming
replacement's error kinds and cleanup, and point Hooks' owner page at
read.

Refs #2016
Add the capabilities ProviderService face with the nine owner operations
(resolve, preferences, selectable, invoke, prepareStartup, retainStartup,
releaseStartup, mediaRoute, credential) and implement it for Provider and
ConfiguredModels.

Retire ModelSelectionHost, SelectableModelsHost and AuxiliaryModel with their
provide points and hand-written dispatchers. Migrate Modality, Agents, Rpc,
Collaboration, SessionTitle, ImageUnderstanding, scenario evaluation, the
TypeScript declarations and runtime fixtures, and remove the three access-layer
entries. Startup declaration types move to the face so the operations share one
definition.

Refs #2019
The three prompt texts reached PromptSources, Skills and the summary strategy
through three hand-written `HostDispatch` wrappers, and the Permission
decision read the user's command rules through a fourth. The App Server's
`prompts` owner now serves `promptSettings.base/summary/skills` while the
capabilities traits stay the Rust port, and the `permissionRules.rules` owner
serves the rules the decision reads through `ReadCommandRules`. The wrappers,
their face names and the `commandRules` service are deleted.

Refs #2017
Update the provider-management, auxiliary-model, image-understanding, single-tree,
Modality and SessionTitle pages to the data face and its operations, and replace
the retired binding names with accepted migration references. Regenerate no
generated catalog in this phase.

Refs #2019
`Settings` carried a hand-written `HostDispatch` beside its Rust methods, so
the same operations had two spellings and the access layer kept an exception
for it. The face is now a `#[rutis::service(name = "settings")]` block over the
same owner: `register`, `read`, `update`, `projects` and `declaredBy` cross as
data, the envelope and its codes stay the client's reply, and the hand-written
dispatch and its allowlist entry are gone.

Refs #2017
pluginFiles now exposes with_lock, read, read_bytes, replace_bytes,
write, create_directory, list and remove on PluginFiles itself. Text
transactions run through FileStorage's update, so a change sees the
current text under the file's key and returns the replacement or none.
Reads are stateless 64 KiB pages; there is no scope, lease or reader
handle. The wire face drops open and the callback objects.

Scheduler, EventHub, Workflow and Modality call the operations directly.
Modality's result publication and query read PluginFiles pages instead
of a pinned FileStorage reader, and its task store uses with_lock.

Refs #2016
Both stores claim auth.json instead of taking a FileLease. A refresh or
token exchange runs under the claim, reads the current record, and writes
back through update(claimId); a concurrent writer gets the marker wait
or a rejected write. A dropped handle releases the claim.

Refs #2016
The account file uses FileStorage claim/read/update/release instead of a
lease. Reset reads the original file, writes the published
dim-reset-backup once, then updates the record. The device id is written
through update under its key.

Refs #2016
The ChatGPT provider claims chatgpt-account.json for each read-modify-write,
reads the current store, and writes through update(claimId). A held claim
is released when its handle drops.

Refs #2016
Keep the authorized SqliteDispatch wrapper while the engine face needs an Arc,
restore the lease/admission fields, and finish the consumer and test imports.
Expose the store catalog read needed by the typed transport flow.

Refs #2018
List the real host-dispatch types after the owner merge and update plugin
dependency docs to SessionFilesHost. xtask check passes at 98 entries.

Refs #2018
ModelProvider only takes the optional SessionFilesHost key when its name is in
the catalog; register the owner type alongside the wire name. Also clean the
merged title imports.

Refs #2018
The duplicate owner key made Session assembly wait for the same type twice and
fail. Keep one store key and one SqliteStorage key.

Refs #2018
Move the title consumer from sessionMetadata to store.title/setTitle, keep the
test envelope helper over the raw replies, and preserve the metadata error
codes in the store dispatch.

Refs #2018
publication_state answers the published tail and whether the Timeline
closed, next_publication waits for the next change, and published waits
for a position; every part and fixture that used to hold the channel
receiver reads these instead, and Publication keeps the receiver for the
owner handle that serves it.
TimelineStoreBinding's hand-written HostDispatch becomes a service block
named timelineStore: every store operation is a typed request and reply,
and a commit subscription takes the listener the calling row owns.
TimelineStoreFace is the face over the binding that keeps implementing
the TimelineStore port; the Session scope provides it where the
hand-written dispatch was provided.
…code/dim-wt/train into dim/2025-session-host

# Conflicts:
#	crates/dim-agent-capabilities/src/shell_session.rs
The merge keeps the train's store and Session-file hosts and brings the
line-handle, session-activity and data-face changes together: the faces
answer data, SessionFault renders and clones where a face reports it, and
the parts and fixtures convert at their own boundary.
The timelineStore name stays a shared instance name, so the graph keeps
resolving the store port while the face answers the same wire name. The
Prompt page names the scope it reports through, and the branch lifecycle
rows lose the merge's duplicate.
A listener now receives the committed event's own Arc, so a broadcast
holds the instance the timeline wrote instead of a copy, and the store
face reports its refusals as an enum whose variant is the wire code. The
collaboration request releases its hold on the busy early return instead
of leaking it, and the store wire test reads the face's data replies.
The train moved Settings onto the FileStorage data face (string paths,
AddRoot/ReadRequest/UpdateRequest), renamed the Session storage names and
retired the hand-written command-rules and prompt-host dispatchers. The merge
takes those shapes: the settings engine reads and writes through the new
FileStorage operations, the prompt, suggestion and command-rule ports are Rust
traits marked internal in the catalog, and every caller and test reads and
writes through the face's Rust bindings. The graph regenerates, the access
layer holds 64 entries with none of this PR's seven, and the execution and
PromptSuggestion ports answer HostValue errors.

Refs #2017
The prompt, execution-suggestion and command-rule ports are Rust names in the
catalog again, so a test assembly can bind them by type; the host-platform and
approval fixtures provide and consume the same values. The settings flow tests
call the face's Rust bindings (the wire dispatch of a `&`Ctx` operation needs a
caller row) and a client write may change a user-only member while the owner
change may not.

Refs #2017
# Conflicts:
#	crates/dim-agent-capabilities/tests/host_port_faces.rs
#	crates/dim-app-server/src/collaboration.rs
#	crates/dim-app-server/src/lib.rs
#	crates/dim-app-server/src/provider.rs
#	crates/dim-app-server/tests/transport_flow/process_typescript.rs
#	crates/dim-image-understanding/src/lib.rs
#	crates/dim-modality/src/engine.rs
#	crates/dim-modality/src/lib.rs
#	crates/dim-session-title/src/lib.rs
#	docs/architecture/rust-agent/single-tree.md
#	xtask/access-layer.json
Regenerate branch service declarations, drop the temporary providerOwner
catalog name, and settle the test fixtures against the new faces.

Refs #2019
Use the owner's account watch before an account read, wake consumers on any
watch move, validate invoke requests at the owner boundary, keep one credential
recovery under `once`, and link invocation cancellation to the owner lifetime.
Update the flow fixtures and the Web replacement expectation to the owner-face
contract.

Refs #2019
@eric8810

eric8810 commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator Author

#2019 改了启动连接的决定:三步(prepareStartup / retainStartup / releaseStartup 加 admission id)改成一次 adoptStartup(request, adopt)(https://github.com/arcships/dim/issues/2019#issuecomment-7442146744)。

现在 PR 里 prepareStartup / releaseStartup 没有调用方,Rpc 入口还在直接调用 Rust 内的 startup_configuration。请按迁移表把 Rpc 的 session.create 和 session.model.update 改用 adoptStartup,同时删掉 admission id 和这两个操作。aimux 的实现跟着改。retain_startup({session, model}) 不变。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant