@adecore/agents-react 0.55.2 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/ui/WorkflowAgentLine.js +35 -44
- package/dist/host-hooks.d.ts +1 -0
- package/dist/host-hooks.js +4 -0
- package/dist/host.d.ts +1 -0
- package/dist/locales/en/agent-providers.d.ts +5 -0
- package/dist/locales/en/agent-providers.js +6 -1
- package/dist/locales/nl/agent-providers.d.ts +5 -0
- package/dist/locales/nl/agent-providers.js +6 -1
- package/dist/providers/AccountDetail.js +429 -378
- package/dist/providers/account-actions.d.ts +1 -0
- package/dist/providers/account-actions.js +18 -0
- package/package.json +9 -9
- package/src/chat/ui/WorkflowAgentLine.tsx +3 -3
- package/src/host-hooks.ts +6 -0
- package/src/host.ts +6 -0
- package/src/locales/en/agent-providers.ts +6 -1
- package/src/locales/nl/agent-providers.ts +6 -1
- package/src/providers/AccountDetail.tsx +27 -1
- package/src/providers/account-actions.ts +13 -0
|
@@ -5,5 +5,6 @@ export declare function saveAccounts(scope: ChatScope, host: Pick<ChatHost, 'not
|
|
|
5
5
|
export declare function saveAccount(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, account: ProviderAccount): Promise<boolean>;
|
|
6
6
|
export declare function removeAccount(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, kind: AgentKind): Promise<void>;
|
|
7
7
|
export declare function reorderAccounts(scope: ChatScope, host: Pick<ChatHost, 'notify'>, kind: AgentKind, ids: readonly string[]): Promise<void>;
|
|
8
|
+
export declare function shareAccountConfig(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, shared: boolean): Promise<boolean>;
|
|
8
9
|
export declare function createAccount(scope: ChatScope, kind: AgentKind, label: string, color: string): Promise<string>;
|
|
9
10
|
export declare function linkAccount(scope: ChatScope, id: string, account: ProviderAccount): Promise<void>;
|
|
@@ -91,6 +91,24 @@ export async function reorderAccounts(scope, host, kind, ids) {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
/* Turns the sharing of the default account's setup on or off for one account. Answers false when the host refused, which a toast then says. */
|
|
95
|
+
export async function shareAccountConfig(scope, host, id, shared) {
|
|
96
|
+
try {
|
|
97
|
+
useProviderAccountsStore.getState().set(scope.id, await linkTo(scope).request('accounts.shareConfig', {
|
|
98
|
+
id,
|
|
99
|
+
shared
|
|
100
|
+
}));
|
|
101
|
+
return true;
|
|
102
|
+
} catch (e) {
|
|
103
|
+
host.notify({
|
|
104
|
+
id: `providers-share-${scope.id}`,
|
|
105
|
+
kind: 'error',
|
|
106
|
+
title: words('account.shareConfigFailed'),
|
|
107
|
+
description: errorMessage(e)
|
|
108
|
+
});
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
94
112
|
/* An account in a folder the host makes for it; answers its id. Throws what the host said, for the form to show. */
|
|
95
113
|
export async function createAccount(scope, kind, label, color) {
|
|
96
114
|
const {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agents-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@adecore/agent-contracts": "0.
|
|
76
|
-
"@adecore/editor": "0.
|
|
77
|
-
"@adecore/editor-react": "0.
|
|
78
|
-
"@adecore/intelligent-ui": "0.
|
|
79
|
-
"@adecore/merge": "0.
|
|
80
|
-
"@adecore/utils": "0.
|
|
75
|
+
"@adecore/agent-contracts": "0.56.0",
|
|
76
|
+
"@adecore/editor": "0.56.0",
|
|
77
|
+
"@adecore/editor-react": "0.56.0",
|
|
78
|
+
"@adecore/intelligent-ui": "0.56.0",
|
|
79
|
+
"@adecore/merge": "0.56.0",
|
|
80
|
+
"@adecore/utils": "0.56.0",
|
|
81
81
|
"@codemirror/commands": "^6.11.1",
|
|
82
82
|
"@codemirror/language": "^6.13.1",
|
|
83
83
|
"@codemirror/state": "^6.7.6",
|
|
@@ -101,14 +101,14 @@
|
|
|
101
101
|
"zustand": "^5.0.16"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@adecore/ui": "^0.
|
|
104
|
+
"@adecore/ui": "^0.56.0",
|
|
105
105
|
"i18next": "^26.4.2",
|
|
106
106
|
"react": "^19.3.0",
|
|
107
107
|
"react-dom": "^19.3.0",
|
|
108
108
|
"react-i18next": "^17.0.15"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@adecore/ui": "0.
|
|
111
|
+
"@adecore/ui": "0.56.0",
|
|
112
112
|
"@types/bun": "^1.4.4",
|
|
113
113
|
"@types/react": "^19.3.0",
|
|
114
114
|
"@types/react-dom": "^19.3.0",
|
|
@@ -27,8 +27,8 @@ function Elapsed({ startedAt }: { startedAt: number }) {
|
|
|
27
27
|
|
|
28
28
|
/*
|
|
29
29
|
* One agent of a workflow: its label, what it does or did, and its time. It opens the agent's
|
|
30
|
-
* conversation when `onOpen` is given and the agent started; one still waiting has no transcript yet
|
|
31
|
-
* `selected` marks the agent whose conversation is open beside it.
|
|
30
|
+
* conversation when `onOpen` is given and the agent started; one still waiting has no transcript yet
|
|
31
|
+
* and, like a line without `onOpen`, draws no arrow. `selected` marks the agent whose conversation is open beside it.
|
|
32
32
|
*/
|
|
33
33
|
export function WorkflowAgentLine({
|
|
34
34
|
view,
|
|
@@ -87,7 +87,7 @@ export function WorkflowAgentLine({
|
|
|
87
87
|
time !== null && <span className={TIME}>{time}</span>
|
|
88
88
|
)}
|
|
89
89
|
{state === 'failed' && <Icon icon={X} size={12} className="shrink-0 text-status-error" />}
|
|
90
|
-
<Icon icon={ChevronRight} size={12} className=
|
|
90
|
+
{open !== undefined && <Icon icon={ChevronRight} size={12} className="shrink-0 text-text-faint" />}
|
|
91
91
|
</span>
|
|
92
92
|
</button>
|
|
93
93
|
);
|
package/src/host-hooks.ts
CHANGED
|
@@ -162,6 +162,12 @@ export function useHostCanReorderAccounts(scopeId: string): boolean {
|
|
|
162
162
|
return useCanReorder(scopeId);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
export function useHostCanShareAccountConfig(scopeId: string): boolean {
|
|
166
|
+
const useCanShare = useChatHost().useCanShareAccountConfig ?? (() => false);
|
|
167
|
+
|
|
168
|
+
return useCanShare(scopeId);
|
|
169
|
+
}
|
|
170
|
+
|
|
165
171
|
export function useHostAccountRule(scopeId: string, chatId: string): AccountRule | null {
|
|
166
172
|
const useRule = useChatHost().useAccountRule ?? (() => null);
|
|
167
173
|
|
package/src/host.ts
CHANGED
|
@@ -595,6 +595,12 @@ export interface ChatHost {
|
|
|
595
595
|
useLoginBlocked(scopeId: string): string | null;
|
|
596
596
|
/* Whether the machine in scope keeps a person's order of the accounts (`accounts.reorder`); left out, it does. */
|
|
597
597
|
useCanReorderAccounts?(scopeId: string): boolean;
|
|
598
|
+
/*
|
|
599
|
+
* Whether the machine in scope answers `accounts.shareConfig`, which shows a switch on an extra account
|
|
600
|
+
* to use the default account's instructions, skills, agents and commands. Left out, it does not: a
|
|
601
|
+
* machine from before the request would refuse it, so only a host that knows it says so.
|
|
602
|
+
*/
|
|
603
|
+
useCanShareAccountConfig?(scopeId: string): boolean;
|
|
598
604
|
/*
|
|
599
605
|
* What the project of a chat says about its accounts: per CLI the account its new chats start on and
|
|
600
606
|
* the accounts it never offers. Left out, or null, every account that is on is offered.
|
|
@@ -149,7 +149,12 @@ export default {
|
|
|
149
149
|
confirm: 'Remove account'
|
|
150
150
|
},
|
|
151
151
|
saveFailed: 'Could not save the account',
|
|
152
|
-
reorderFailed: 'Could not change the order of the accounts'
|
|
152
|
+
reorderFailed: 'Could not change the order of the accounts',
|
|
153
|
+
shareConfigFailed: 'Could not change what this account shares',
|
|
154
|
+
shareConfig: {
|
|
155
|
+
label: 'Use the setup of the default account',
|
|
156
|
+
description: 'Instructions, skills, agents and commands come from the default {{provider}} account. Sign-in and history stay apart.'
|
|
157
|
+
}
|
|
153
158
|
},
|
|
154
159
|
add: {
|
|
155
160
|
title: 'Add {{provider}} account',
|
|
@@ -149,7 +149,12 @@ export default {
|
|
|
149
149
|
confirm: 'Account verwijderen'
|
|
150
150
|
},
|
|
151
151
|
saveFailed: 'Kon het account niet opslaan',
|
|
152
|
-
reorderFailed: 'Kon de volgorde van de accounts niet wijzigen'
|
|
152
|
+
reorderFailed: 'Kon de volgorde van de accounts niet wijzigen',
|
|
153
|
+
shareConfigFailed: 'Kon niet wijzigen wat dit account deelt',
|
|
154
|
+
shareConfig: {
|
|
155
|
+
label: 'De opzet van het standaardaccount gebruiken',
|
|
156
|
+
description: "Instructies, skills, agents en commando's komen van het standaardaccount van {{provider}}. Inloggen en geschiedenis blijven apart."
|
|
157
|
+
}
|
|
153
158
|
},
|
|
154
159
|
add: {
|
|
155
160
|
title: '{{provider}}-account toevoegen',
|
|
@@ -7,8 +7,10 @@ import { Trans, useTranslation } from 'react-i18next';
|
|
|
7
7
|
import { AccountDot } from '../agents/AccountDot';
|
|
8
8
|
import { accountName, FOLDER_VARIABLES, type AccountEntry, type AccountLogin } from '../agents/accounts';
|
|
9
9
|
import { useChatHost } from '../host';
|
|
10
|
+
import { useHostCanShareAccountConfig } from '../host-hooks';
|
|
10
11
|
import { useChatScope } from '../scope';
|
|
11
|
-
import {
|
|
12
|
+
import { useProviderAccounts } from '../state/provider-accounts';
|
|
13
|
+
import { removeAccount, saveAccount, shareAccountConfig } from './account-actions';
|
|
12
14
|
import { AccountColors } from './AccountColors';
|
|
13
15
|
import { AccountVariables } from './AccountVariables';
|
|
14
16
|
import { CliMark } from './parts';
|
|
@@ -73,6 +75,10 @@ export function AccountDetail({ provider, entry, login, canOpenLogin, loginBlock
|
|
|
73
75
|
const folder = status?.home ?? '';
|
|
74
76
|
const variable = FOLDER_VARIABLES[provider.kind];
|
|
75
77
|
const signedIn = status?.state === 'ready';
|
|
78
|
+
const sharedConfigKinds = useProviderAccounts((row) => row.accounts?.sharedConfigKinds);
|
|
79
|
+
const canShareConfig = useHostCanShareAccountConfig(scope.id);
|
|
80
|
+
const sharesConfig = account.shareConfig === true;
|
|
81
|
+
const showShareConfig = canShareConfig && !isDefault && sharedConfigKinds?.includes(provider.kind) === true;
|
|
76
82
|
|
|
77
83
|
const showFolder = (): void => {
|
|
78
84
|
copyText(folder);
|
|
@@ -160,6 +166,26 @@ export function AccountDetail({ provider, entry, login, canOpenLogin, loginBlock
|
|
|
160
166
|
}
|
|
161
167
|
/>
|
|
162
168
|
</SettingsSection>
|
|
169
|
+
{showShareConfig && (
|
|
170
|
+
<SettingsSection>
|
|
171
|
+
<SettingsRow
|
|
172
|
+
label={t('account.shareConfig.label')}
|
|
173
|
+
description={
|
|
174
|
+
// What stayed the account's own, such as a CLAUDE.md it already had.
|
|
175
|
+
sharesConfig && !trouble && status?.message
|
|
176
|
+
? `${t('account.shareConfig.description', { provider: provider.name })} ${status.message}`
|
|
177
|
+
: t('account.shareConfig.description', { provider: provider.name })
|
|
178
|
+
}
|
|
179
|
+
control={
|
|
180
|
+
<Switch
|
|
181
|
+
checked={sharesConfig}
|
|
182
|
+
label={t('account.shareConfig.label')}
|
|
183
|
+
onCheckedChange={(checked) => void shareAccountConfig(scope, host, id, checked)}
|
|
184
|
+
/>
|
|
185
|
+
}
|
|
186
|
+
/>
|
|
187
|
+
</SettingsSection>
|
|
188
|
+
)}
|
|
163
189
|
{(login === 'chat' || (login === 'terminal' && canOpenLogin)) && (
|
|
164
190
|
<SettingsSection title={t('account.login.title')}>
|
|
165
191
|
{login === 'chat' ? (
|
|
@@ -84,6 +84,19 @@ export async function reorderAccounts(scope: ChatScope, host: Pick<ChatHost, 'no
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/* Turns the sharing of the default account's setup on or off for one account. Answers false when the host refused, which a toast then says. */
|
|
88
|
+
export async function shareAccountConfig(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, shared: boolean): Promise<boolean> {
|
|
89
|
+
try {
|
|
90
|
+
useProviderAccountsStore.getState().set(scope.id, await linkTo(scope).request('accounts.shareConfig', { id, shared }));
|
|
91
|
+
|
|
92
|
+
return true;
|
|
93
|
+
} catch (e) {
|
|
94
|
+
host.notify({ id: `providers-share-${scope.id}`, kind: 'error', title: words('account.shareConfigFailed'), description: errorMessage(e) });
|
|
95
|
+
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
/* An account in a folder the host makes for it; answers its id. Throws what the host said, for the form to show. */
|
|
88
101
|
export async function createAccount(scope: ChatScope, kind: AgentKind, label: string, color: string): Promise<string> {
|
|
89
102
|
const { id, ...accounts } = await linkTo(scope).request('accounts.create', { kind, label, color });
|