Subagent sessions now render as a collapsed tree in the sidebar: parents with workers get an expand/collapse chevron, expanded child rows sit behind a guide line, and the parent keeps its worker count. The parent of the open subagent expands once so its child is visible. Subagent tool rows in the parent chat (subagent or task) are labeled 子代理, show the description and open the child session on tap; a child outside the loaded page is fetched by id first. Subagent chats are read-only by default with the first-party notice; allowPromptingSubagentSessions permits ordinary subagents, while a Lead's operator-child worker stays read-only until takeover. 0.4.10 (410).
31 lines
980 B
Dart
31 lines
980 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:openchamber/api/models.dart';
|
|
import 'package:openchamber/state.dart';
|
|
|
|
void main() {
|
|
test('subagent chats are read-only unless the server allows prompting them',
|
|
() {
|
|
final app = AppState();
|
|
addTearDown(app.dispose);
|
|
final child = Session(id: 'child', title: '输出 hello', parentID: 'parent');
|
|
|
|
expect(app.promptReadOnlyFor(child), isTrue);
|
|
app.allowPromptingSubagentSessions = true;
|
|
expect(app.promptReadOnlyFor(child), isFalse);
|
|
|
|
// A lead's operator worker stays read-only until taken over, whatever the
|
|
// subagent setting says.
|
|
final worker = Session(
|
|
id: 'worker',
|
|
title: 'worker',
|
|
metadata: {
|
|
'openchamber': {'kind': 'operator-child', 'parentID': 'lead'},
|
|
},
|
|
);
|
|
expect(app.promptReadOnlyFor(worker), isTrue);
|
|
|
|
final root = Session(id: 'root', title: 'root');
|
|
expect(app.promptReadOnlyFor(root), isFalse);
|
|
});
|
|
}
|