Skip to content

accounts

Connected accounts: a person connects an outside account once, and agents working for them use it.

On this page 7
TypeScript
import { accounts } from "copilotz/plugins/access";

What it keeps

It keeps 3 collections, 1 of them on the record.

CollectionKept asFields
accountdocumentsperson, provider, status, label, plan, problem, connected, refreshed, expires, rev; private: tokens
accountFlowin memory, gone on restartperson, provider, verifier, redirect, expires
modelKeydocumentshint, person, provider, by, at; private: sealed

Its named queries read for callers, as the rules let them:

QueryWho outside runs it
account.providerspeople, agents for a person, keys and routines
modelKey.minepeople, agents for a person, keys and routines

What it lets callers do

Of its 12 Actions, people may call 7; agents may call 1; contacts and someone signed out may call none.

ActionPersonAgentContactAnyoneKeyRoutineWhat it does
account.callbackyesnononononoFinishes connecting an account, once its provider sent the person back.
account.completeyesnononononoFinishes connecting an account from the address its sign-in ended at.
account.connectyesnononononoStarts connecting one of your accounts: where to sign in.
account.disconnectyesnononononoDisconnects one of your accounts, and asks its provider to end its sign-in.
modelKey.mayyesyesnonoyesyesWhether you may change the org's keys for model providers.
modelKey.removeyesnononononoRemoves the org's own key for a model provider.
modelKey.setyesnononononoAdds or replaces a key for a model provider: the org's, or your own (mine).

An agent works for a person, and calls what both may. A key calls only what its scope names. A routine is work done for a person, which they set going.

Only the app's own code calls account.connected, account.refresh, account.token, modelKey.list and modelKey.open: its plugins, its schedules and the system.

It answers 1 route over HTTP:

MethodPath
GET/accounts/callback/:provider

It also adds rules every read and write keeps to (guard).

Where it shows

It has no Views of its own: its front ends show it, accounts-web.

  • What it adds to resources: accountProviders (chatgpt), connectedPlans (accounts), cost (chatgpt/*), modelKeys (list, may, open), provider (chatgpt).

What it needs

You set it in resources.accounts, and 1 is a secret, kept out of your code.

SettingTypeRequiredWhat it is
accounts.keystringnoSecret.
accounts.urlstringno

It also reads accountProviders and org, resource kinds the app and other plugins fill.

What it requires

It builds on no other plugin.

It ships with copilotz@1.0.0-rc.66.

What it does on its own

Some of its work starts without a caller: an event, or the time.

  • It emits account.changed. An account was connected, lost or disconnected.

Listing

It keeps every listing rule.