@jini-ai/chat 0.5.5 → 0.5.6
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/CHANGELOG.md
CHANGED
|
@@ -115,7 +115,14 @@ export function useChatPane(options) {
|
|
|
115
115
|
workingDirectoryAccess: options.workingDirectoryAccess,
|
|
116
116
|
} }));
|
|
117
117
|
const requestedSelection = options.selection ?? internalSelection;
|
|
118
|
-
const
|
|
118
|
+
const resolvedSelection = useMemo(() => resolveChatPaneSelection({ agents: options.agents, requested: requestedSelection }), [options.agents, requestedSelection]);
|
|
119
|
+
// Inline inventories and controlled selections can be new objects on every render. Keep the
|
|
120
|
+
// normalized value stable so synchronizing it into composer state cannot feed a render loop.
|
|
121
|
+
const selection = useMemo(() => definedProps({ source: {
|
|
122
|
+
agentId: resolvedSelection.agentId,
|
|
123
|
+
model: resolvedSelection.model,
|
|
124
|
+
reasoning: resolvedSelection.reasoning,
|
|
125
|
+
} }), [resolvedSelection.agentId, resolvedSelection.model, resolvedSelection.reasoning]);
|
|
119
126
|
const selectedAgent = options.agents.find((agent) => agent.id === selection.agentId);
|
|
120
127
|
const conversation = useConversation(definedProps({ source: {
|
|
121
128
|
transport: options.transport,
|
|
@@ -153,6 +160,8 @@ export function useChatPane(options) {
|
|
|
153
160
|
activeUploadsRef.current.clear();
|
|
154
161
|
};
|
|
155
162
|
}, []);
|
|
163
|
+
const selectionControlled = options.selection !== undefined;
|
|
164
|
+
const setComposerAgent = composer.setAgent;
|
|
156
165
|
useEffect(() => {
|
|
157
166
|
if (!selection.agentId)
|
|
158
167
|
return;
|
|
@@ -160,14 +169,14 @@ export function useChatPane(options) {
|
|
|
160
169
|
&& requestedSelection.model === selection.model
|
|
161
170
|
&& requestedSelection.reasoning === selection.reasoning)
|
|
162
171
|
return;
|
|
163
|
-
if (
|
|
172
|
+
if (!selectionControlled)
|
|
164
173
|
setInternalSelection(selection);
|
|
165
|
-
|
|
174
|
+
setComposerAgent(selection);
|
|
166
175
|
options.onSelectionChange?.(selection);
|
|
167
176
|
}, [
|
|
168
|
-
|
|
177
|
+
setComposerAgent,
|
|
169
178
|
options.onSelectionChange,
|
|
170
|
-
|
|
179
|
+
selectionControlled,
|
|
171
180
|
requestedSelection.agentId,
|
|
172
181
|
requestedSelection.model,
|
|
173
182
|
requestedSelection.reasoning,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { I18nAdapter } from '../../slots.js';
|
|
2
2
|
import type { ChatPaneAgent, ChatPaneAgentOption } from './types.js';
|
|
3
3
|
export declare function isConcretePickerModel(id: string): boolean;
|
|
4
|
-
/** Aliases are selectable only as their evidence-backed concrete ID. Never render a Default row.
|
|
4
|
+
/** Aliases are selectable only as their evidence-backed concrete ID. Never render a Default row.
|
|
5
|
+
* @complexity O(n) time and space in catalog rows, with set-based deduplication.
|
|
6
|
+
*/
|
|
5
7
|
export declare function pickerModelOptions(agent: ChatPaneAgent): ChatPaneAgentOption[];
|
|
6
8
|
export declare function configuredPickerModel(agent: ChatPaneAgent): string | undefined;
|
|
7
9
|
export declare function pickerModelLabel(agent: ChatPaneAgent | undefined, requested?: string, t?: I18nAdapter['t']): string;
|
|
@@ -4,7 +4,9 @@ export function isConcretePickerModel(id) {
|
|
|
4
4
|
const token = id.slice(id.lastIndexOf('/') + 1);
|
|
5
5
|
return !/^(?:opus|sonnet|haiku|fable|best|latest|claude|gemini|gpt|codex|swe)(?:\[.*\])?$/i.test(token) && !/^(default|auto|adaptive|smart|deep|rush|ultimate|premium|balanced|fast|grok-build|vercel-ai-gateway)$/i.test(token) && !/(?:^|[-/])(gateway|latest)$/i.test(id);
|
|
6
6
|
}
|
|
7
|
-
/** Aliases are selectable only as their evidence-backed concrete ID. Never render a Default row.
|
|
7
|
+
/** Aliases are selectable only as their evidence-backed concrete ID. Never render a Default row.
|
|
8
|
+
* @complexity O(n) time and space in catalog rows, with set-based deduplication.
|
|
9
|
+
*/
|
|
8
10
|
export function pickerModelOptions(agent) {
|
|
9
11
|
if (agent.supportsConcreteModelSelection === false)
|
|
10
12
|
return [];
|
|
@@ -14,7 +16,9 @@ export function pickerModelOptions(agent) {
|
|
|
14
16
|
if (!id || !isConcretePickerModel(id) || seen.has(id))
|
|
15
17
|
return [];
|
|
16
18
|
seen.add(id);
|
|
17
|
-
|
|
19
|
+
// Older cached inventories can attach a default-policy label to a resolved concrete ID.
|
|
20
|
+
const label = row.id === 'default' || /^default\b/i.test(row.label) ? id : row.label;
|
|
21
|
+
return [{ ...row, id, label, identityKind: 'concrete' }];
|
|
18
22
|
});
|
|
19
23
|
const resolution = agent.defaultModelResolution;
|
|
20
24
|
// A host may publish a resolved default outside its visible catalog. Preserve its concrete ID.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/chat",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Jini's chat/artifact frontend, consolidated into one package with two subpaths: framework-free chat vocabulary and pure parsers in `/core`, headless hooks + presentational components + slots in `/react`. Import only the layer you need.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -286,13 +286,13 @@
|
|
|
286
286
|
"@electric-sql/pglite": "0.5.8",
|
|
287
287
|
"pg": "8.23.0",
|
|
288
288
|
"@ag-ui/core": "0.0.58",
|
|
289
|
+
"@jini-ai/protocol": "^0.4.2",
|
|
290
|
+
"@jini-ai/agent-runtime": "0.4.3",
|
|
291
|
+
"@jini-ai/ui": "^0.4.6",
|
|
289
292
|
"@jini-ai/db": "0.3.1",
|
|
290
|
-
"@jini-ai/agent-runtime": "0.4.2",
|
|
291
293
|
"@jini-ai/agentic": "^0.4.3",
|
|
292
|
-
"@jini-ai/
|
|
293
|
-
"@jini-ai/
|
|
294
|
-
"@jini-ai/core": "^0.4.2",
|
|
295
|
-
"@jini-ai/diagnostics": "^0.5.1"
|
|
294
|
+
"@jini-ai/diagnostics": "^0.5.1",
|
|
295
|
+
"@jini-ai/core": "^0.4.2"
|
|
296
296
|
},
|
|
297
297
|
"typesVersions": {
|
|
298
298
|
"*": {
|