feat(base)!: one budget per person for all their assistants, the effort each takes, the operator's lists by page
A grant now says only which assistant a person may use, and keeps their agreement; the limits are the person's (assistant_budget): one per UTC day and month in money and in tokens, each optional, money counting the assistants with prices, tokens every one (Halkyon Learn's ADR 0021, D58, D59). assistantOperator.grant gives several people several assistants with one budget, change sets one person's exactly, revoke takes back everything; grantees and granteesOf list people with their assistants, budget and use, 50 at a time. The migration carries each person's grant limits into a budget: per unit, their sum, a grant without a limit making it none. assistants.env gives each assistant a default and a highest effort (_EFFORT, _MAX_EFFORT; refused at start where the provider takes none); ask takes one within that range, refusing another (invalidEffort), and caps the output at its ceiling (D63). instanceOperator.waiting and accounts come 50 at a time from an offset, and counts gives the rows of the operator's screen (D62). BREAKING CHANGE: the offer, the grants and the operator's lists changed shape; Learn's server now asks for build 25. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
0590a4b43d
commit
24ed63585e
68 changed files with 50672 additions and 1371 deletions
|
|
@ -0,0 +1,49 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// How much an assistant thinks before it answers (Halkyon Learn's ADR 0021,
|
||||
/// D63), from the least to the most: Anthropic's levels, each provider's
|
||||
/// own field sent in their place.
|
||||
enum AssistantEffort implements _isc.SerializableModel {
|
||||
low,
|
||||
medium,
|
||||
high,
|
||||
xhigh,
|
||||
max;
|
||||
|
||||
static AssistantEffort fromJson(String name) {
|
||||
switch (name) {
|
||||
case 'low':
|
||||
return AssistantEffort.low;
|
||||
case 'medium':
|
||||
return AssistantEffort.medium;
|
||||
case 'high':
|
||||
return AssistantEffort.high;
|
||||
case 'xhigh':
|
||||
return AssistantEffort.xhigh;
|
||||
case 'max':
|
||||
return AssistantEffort.max;
|
||||
default:
|
||||
throw ArgumentError(
|
||||
'Value "$name" cannot be converted to "AssistantEffort"',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toJson() => name;
|
||||
|
||||
@override
|
||||
String toString() => name;
|
||||
}
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../assistant/assistant_limit_unit.dart' as _il94nvme;
|
||||
|
||||
/// A grant as the operator sees it (Halkyon Learn's ADR 0021, point 6).
|
||||
abstract class AssistantGrantOverview
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
AssistantGrantOverview._({
|
||||
required this.account,
|
||||
this.handle,
|
||||
required this.assistant,
|
||||
required this.assistantSet,
|
||||
required this.grantedAt,
|
||||
required this.limitUnit,
|
||||
this.dailyLimit,
|
||||
this.monthlyLimit,
|
||||
this.agreedAt,
|
||||
required this.outdated,
|
||||
});
|
||||
|
||||
factory AssistantGrantOverview({
|
||||
required _isc.UuidValue account,
|
||||
String? handle,
|
||||
required String assistant,
|
||||
required bool assistantSet,
|
||||
required DateTime grantedAt,
|
||||
required _il94nvme.AssistantLimitUnit limitUnit,
|
||||
int? dailyLimit,
|
||||
int? monthlyLimit,
|
||||
DateTime? agreedAt,
|
||||
required bool outdated,
|
||||
}) = _AssistantGrantOverviewImpl;
|
||||
|
||||
factory AssistantGrantOverview.fromJson(
|
||||
Map<String, dynamic> jsonSerialization,
|
||||
) {
|
||||
return AssistantGrantOverview(
|
||||
account: _isc.UuidValueJsonExtension.fromJson(
|
||||
jsonSerialization['account'],
|
||||
),
|
||||
handle: jsonSerialization['handle'] as String?,
|
||||
assistant: jsonSerialization['assistant'] as String,
|
||||
assistantSet: _isc.BoolJsonExtension.fromJson(
|
||||
jsonSerialization['assistantSet'],
|
||||
),
|
||||
grantedAt: _isc.DateTimeJsonExtension.fromJson(
|
||||
jsonSerialization['grantedAt'],
|
||||
),
|
||||
limitUnit: _il94nvme.AssistantLimitUnit.fromJson(
|
||||
(jsonSerialization['limitUnit'] as String),
|
||||
),
|
||||
dailyLimit: jsonSerialization['dailyLimit'] as int?,
|
||||
monthlyLimit: jsonSerialization['monthlyLimit'] as int?,
|
||||
agreedAt: jsonSerialization['agreedAt'] == null
|
||||
? null
|
||||
: _isc.DateTimeJsonExtension.fromJson(jsonSerialization['agreedAt']),
|
||||
outdated: _isc.BoolJsonExtension.fromJson(jsonSerialization['outdated']),
|
||||
);
|
||||
}
|
||||
|
||||
/// The person's account.
|
||||
_isc.UuidValue account;
|
||||
|
||||
/// Their handle; null for an account without one.
|
||||
String? handle;
|
||||
|
||||
/// The assistant's ID.
|
||||
String assistant;
|
||||
|
||||
/// Whether the instance still sets that assistant (D44).
|
||||
bool assistantSet;
|
||||
|
||||
/// When it was granted, or its limits last changed.
|
||||
DateTime grantedAt;
|
||||
|
||||
/// What its limits count.
|
||||
_il94nvme.AssistantLimitUnit limitUnit;
|
||||
|
||||
/// The most a UTC day may use; null for none.
|
||||
int? dailyLimit;
|
||||
|
||||
/// The most a UTC month may use; null for none.
|
||||
int? monthlyLimit;
|
||||
|
||||
/// When the person agreed to the assistant's provider as it is now;
|
||||
/// null until they have.
|
||||
DateTime? agreedAt;
|
||||
|
||||
/// Whether the limits count what the assistant counts no more, as its
|
||||
/// prices came or went.
|
||||
bool outdated;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantGrantOverview]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
AssistantGrantOverview copyWith({
|
||||
_isc.UuidValue? account,
|
||||
String? handle,
|
||||
String? assistant,
|
||||
bool? assistantSet,
|
||||
DateTime? grantedAt,
|
||||
_il94nvme.AssistantLimitUnit? limitUnit,
|
||||
int? dailyLimit,
|
||||
int? monthlyLimit,
|
||||
DateTime? agreedAt,
|
||||
bool? outdated,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantGrantOverview',
|
||||
'account': account.toJson(),
|
||||
if (handle != null) 'handle': handle,
|
||||
'assistant': assistant,
|
||||
'assistantSet': assistantSet,
|
||||
'grantedAt': grantedAt.toJson(),
|
||||
'limitUnit': limitUnit.toJson(),
|
||||
if (dailyLimit != null) 'dailyLimit': dailyLimit,
|
||||
if (monthlyLimit != null) 'monthlyLimit': monthlyLimit,
|
||||
if (agreedAt != null) 'agreedAt': agreedAt?.toJson(),
|
||||
'outdated': outdated,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantGrantOverview',
|
||||
'account': account.toJson(),
|
||||
if (handle != null) 'handle': handle,
|
||||
'assistant': assistant,
|
||||
'assistantSet': assistantSet,
|
||||
'grantedAt': grantedAt.toJson(),
|
||||
'limitUnit': limitUnit.toJson(),
|
||||
if (dailyLimit != null) 'dailyLimit': dailyLimit,
|
||||
if (monthlyLimit != null) 'monthlyLimit': monthlyLimit,
|
||||
if (agreedAt != null) 'agreedAt': agreedAt?.toJson(),
|
||||
'outdated': outdated,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _AssistantGrantOverviewImpl extends AssistantGrantOverview {
|
||||
_AssistantGrantOverviewImpl({
|
||||
required _isc.UuidValue account,
|
||||
String? handle,
|
||||
required String assistant,
|
||||
required bool assistantSet,
|
||||
required DateTime grantedAt,
|
||||
required _il94nvme.AssistantLimitUnit limitUnit,
|
||||
int? dailyLimit,
|
||||
int? monthlyLimit,
|
||||
DateTime? agreedAt,
|
||||
required bool outdated,
|
||||
}) : super._(
|
||||
account: account,
|
||||
handle: handle,
|
||||
assistant: assistant,
|
||||
assistantSet: assistantSet,
|
||||
grantedAt: grantedAt,
|
||||
limitUnit: limitUnit,
|
||||
dailyLimit: dailyLimit,
|
||||
monthlyLimit: monthlyLimit,
|
||||
agreedAt: agreedAt,
|
||||
outdated: outdated,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantGrantOverview]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
AssistantGrantOverview copyWith({
|
||||
_isc.UuidValue? account,
|
||||
Object? handle = _Undefined,
|
||||
String? assistant,
|
||||
bool? assistantSet,
|
||||
DateTime? grantedAt,
|
||||
_il94nvme.AssistantLimitUnit? limitUnit,
|
||||
Object? dailyLimit = _Undefined,
|
||||
Object? monthlyLimit = _Undefined,
|
||||
Object? agreedAt = _Undefined,
|
||||
bool? outdated,
|
||||
}) {
|
||||
return AssistantGrantOverview(
|
||||
account: account ?? this.account,
|
||||
handle: handle is String? ? handle : this.handle,
|
||||
assistant: assistant ?? this.assistant,
|
||||
assistantSet: assistantSet ?? this.assistantSet,
|
||||
grantedAt: grantedAt ?? this.grantedAt,
|
||||
limitUnit: limitUnit ?? this.limitUnit,
|
||||
dailyLimit: dailyLimit is int? ? dailyLimit : this.dailyLimit,
|
||||
monthlyLimit: monthlyLimit is int? ? monthlyLimit : this.monthlyLimit,
|
||||
agreedAt: agreedAt is DateTime? ? agreedAt : this.agreedAt,
|
||||
outdated: outdated ?? this.outdated,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// An assistant granted to a person, as the operator sees it (Halkyon
|
||||
/// Learn's ADR 0021, point 6).
|
||||
abstract class AssistantGranted
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
AssistantGranted._({
|
||||
required this.assistant,
|
||||
required this.assistantSet,
|
||||
required this.grantedAt,
|
||||
this.agreedAt,
|
||||
});
|
||||
|
||||
factory AssistantGranted({
|
||||
required String assistant,
|
||||
required bool assistantSet,
|
||||
required DateTime grantedAt,
|
||||
DateTime? agreedAt,
|
||||
}) = _AssistantGrantedImpl;
|
||||
|
||||
factory AssistantGranted.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return AssistantGranted(
|
||||
assistant: jsonSerialization['assistant'] as String,
|
||||
assistantSet: _isc.BoolJsonExtension.fromJson(
|
||||
jsonSerialization['assistantSet'],
|
||||
),
|
||||
grantedAt: _isc.DateTimeJsonExtension.fromJson(
|
||||
jsonSerialization['grantedAt'],
|
||||
),
|
||||
agreedAt: jsonSerialization['agreedAt'] == null
|
||||
? null
|
||||
: _isc.DateTimeJsonExtension.fromJson(jsonSerialization['agreedAt']),
|
||||
);
|
||||
}
|
||||
|
||||
/// The assistant's ID.
|
||||
String assistant;
|
||||
|
||||
/// Whether the instance still sets that assistant (D44).
|
||||
bool assistantSet;
|
||||
|
||||
/// When it was granted.
|
||||
DateTime grantedAt;
|
||||
|
||||
/// When the person agreed to the assistant's provider as it is now;
|
||||
/// null until they have.
|
||||
DateTime? agreedAt;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantGranted]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
AssistantGranted copyWith({
|
||||
String? assistant,
|
||||
bool? assistantSet,
|
||||
DateTime? grantedAt,
|
||||
DateTime? agreedAt,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantGranted',
|
||||
'assistant': assistant,
|
||||
'assistantSet': assistantSet,
|
||||
'grantedAt': grantedAt.toJson(),
|
||||
if (agreedAt != null) 'agreedAt': agreedAt?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantGranted',
|
||||
'assistant': assistant,
|
||||
'assistantSet': assistantSet,
|
||||
'grantedAt': grantedAt.toJson(),
|
||||
if (agreedAt != null) 'agreedAt': agreedAt?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _AssistantGrantedImpl extends AssistantGranted {
|
||||
_AssistantGrantedImpl({
|
||||
required String assistant,
|
||||
required bool assistantSet,
|
||||
required DateTime grantedAt,
|
||||
DateTime? agreedAt,
|
||||
}) : super._(
|
||||
assistant: assistant,
|
||||
assistantSet: assistantSet,
|
||||
grantedAt: grantedAt,
|
||||
agreedAt: agreedAt,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantGranted]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
AssistantGranted copyWith({
|
||||
String? assistant,
|
||||
bool? assistantSet,
|
||||
DateTime? grantedAt,
|
||||
Object? agreedAt = _Undefined,
|
||||
}) {
|
||||
return AssistantGranted(
|
||||
assistant: assistant ?? this.assistant,
|
||||
assistantSet: assistantSet ?? this.assistantSet,
|
||||
grantedAt: grantedAt ?? this.grantedAt,
|
||||
agreedAt: agreedAt is DateTime? ? agreedAt : this.agreedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:halkyon_base_client/src/protocol/protocol.dart' as _iwgbpyo5;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../assistant/assistant_granted.dart' as _iycinscu;
|
||||
import '../assistant/assistant_limits.dart' as _inm8zjwk;
|
||||
import '../assistant/assistant_use.dart' as _i25whxul;
|
||||
|
||||
/// A person granted assistants, as the operator sees them (Halkyon Learn's
|
||||
/// ADR 0021, D58): which, their budget, and what they used of it.
|
||||
abstract class AssistantGrantee
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
AssistantGrantee._({
|
||||
required this.account,
|
||||
this.handle,
|
||||
required this.assistants,
|
||||
required this.budget,
|
||||
required this.usedToday,
|
||||
required this.usedThisMonth,
|
||||
});
|
||||
|
||||
factory AssistantGrantee({
|
||||
required _isc.UuidValue account,
|
||||
String? handle,
|
||||
required List<_iycinscu.AssistantGranted> assistants,
|
||||
required _inm8zjwk.AssistantLimits budget,
|
||||
required _i25whxul.AssistantUse usedToday,
|
||||
required _i25whxul.AssistantUse usedThisMonth,
|
||||
}) = _AssistantGranteeImpl;
|
||||
|
||||
factory AssistantGrantee.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return AssistantGrantee(
|
||||
account: _isc.UuidValueJsonExtension.fromJson(
|
||||
jsonSerialization['account'],
|
||||
),
|
||||
handle: jsonSerialization['handle'] as String?,
|
||||
assistants: _iwgbpyo5.Protocol()
|
||||
.deserialize<List<_iycinscu.AssistantGranted>>(
|
||||
jsonSerialization['assistants'],
|
||||
),
|
||||
budget: _iwgbpyo5.Protocol().deserialize<_inm8zjwk.AssistantLimits>(
|
||||
jsonSerialization['budget'],
|
||||
),
|
||||
usedToday: _iwgbpyo5.Protocol().deserialize<_i25whxul.AssistantUse>(
|
||||
jsonSerialization['usedToday'],
|
||||
),
|
||||
usedThisMonth: _iwgbpyo5.Protocol().deserialize<_i25whxul.AssistantUse>(
|
||||
jsonSerialization['usedThisMonth'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The person's account.
|
||||
_isc.UuidValue account;
|
||||
|
||||
/// Their handle; null for an account without one.
|
||||
String? handle;
|
||||
|
||||
/// Their assistants, in the operator's order (those set no more last).
|
||||
List<_iycinscu.AssistantGranted> assistants;
|
||||
|
||||
/// Their budget; every limit null for none.
|
||||
_inm8zjwk.AssistantLimits budget;
|
||||
|
||||
/// What this UTC day used so far.
|
||||
_i25whxul.AssistantUse usedToday;
|
||||
|
||||
/// What this UTC month used so far.
|
||||
_i25whxul.AssistantUse usedThisMonth;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantGrantee]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
AssistantGrantee copyWith({
|
||||
_isc.UuidValue? account,
|
||||
String? handle,
|
||||
List<_iycinscu.AssistantGranted>? assistants,
|
||||
_inm8zjwk.AssistantLimits? budget,
|
||||
_i25whxul.AssistantUse? usedToday,
|
||||
_i25whxul.AssistantUse? usedThisMonth,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantGrantee',
|
||||
'account': account.toJson(),
|
||||
if (handle != null) 'handle': handle,
|
||||
'assistants': assistants.toJson(valueToJson: (v) => v.toJson()),
|
||||
'budget': budget.toJson(),
|
||||
'usedToday': usedToday.toJson(),
|
||||
'usedThisMonth': usedThisMonth.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantGrantee',
|
||||
'account': account.toJson(),
|
||||
if (handle != null) 'handle': handle,
|
||||
'assistants': assistants.toJson(
|
||||
valueToJson: (v) => v.toJsonForProtocol(),
|
||||
),
|
||||
'budget': budget.toJsonForProtocol(),
|
||||
'usedToday': usedToday.toJsonForProtocol(),
|
||||
'usedThisMonth': usedThisMonth.toJsonForProtocol(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _AssistantGranteeImpl extends AssistantGrantee {
|
||||
_AssistantGranteeImpl({
|
||||
required _isc.UuidValue account,
|
||||
String? handle,
|
||||
required List<_iycinscu.AssistantGranted> assistants,
|
||||
required _inm8zjwk.AssistantLimits budget,
|
||||
required _i25whxul.AssistantUse usedToday,
|
||||
required _i25whxul.AssistantUse usedThisMonth,
|
||||
}) : super._(
|
||||
account: account,
|
||||
handle: handle,
|
||||
assistants: assistants,
|
||||
budget: budget,
|
||||
usedToday: usedToday,
|
||||
usedThisMonth: usedThisMonth,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantGrantee]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
AssistantGrantee copyWith({
|
||||
_isc.UuidValue? account,
|
||||
Object? handle = _Undefined,
|
||||
List<_iycinscu.AssistantGranted>? assistants,
|
||||
_inm8zjwk.AssistantLimits? budget,
|
||||
_i25whxul.AssistantUse? usedToday,
|
||||
_i25whxul.AssistantUse? usedThisMonth,
|
||||
}) {
|
||||
return AssistantGrantee(
|
||||
account: account ?? this.account,
|
||||
handle: handle is String? ? handle : this.handle,
|
||||
assistants:
|
||||
assistants ?? this.assistants.map((e0) => e0.copyWith()).toList(),
|
||||
budget: budget ?? this.budget.copyWith(),
|
||||
usedToday: usedToday ?? this.usedToday.copyWith(),
|
||||
usedThisMonth: usedThisMonth ?? this.usedThisMonth.copyWith(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../assistant/assistant_effort.dart' as _i1aa3af9;
|
||||
|
||||
/// An assistant as the operator set it (Halkyon Learn's ADR 0021, point
|
||||
/// 4), without its key: what their screen of grants shows.
|
||||
|
|
@ -25,6 +26,8 @@ abstract class AssistantInfo
|
|||
required this.images,
|
||||
this.priceInput,
|
||||
this.priceOutput,
|
||||
this.effort,
|
||||
this.maxEffort,
|
||||
});
|
||||
|
||||
factory AssistantInfo({
|
||||
|
|
@ -36,6 +39,8 @@ abstract class AssistantInfo
|
|||
required bool images,
|
||||
double? priceInput,
|
||||
double? priceOutput,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
_i1aa3af9.AssistantEffort? maxEffort,
|
||||
}) = _AssistantInfoImpl;
|
||||
|
||||
factory AssistantInfo.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
|
|
@ -48,6 +53,16 @@ abstract class AssistantInfo
|
|||
images: _isc.BoolJsonExtension.fromJson(jsonSerialization['images']),
|
||||
priceInput: (jsonSerialization['priceInput'] as num?)?.toDouble(),
|
||||
priceOutput: (jsonSerialization['priceOutput'] as num?)?.toDouble(),
|
||||
effort: jsonSerialization['effort'] == null
|
||||
? null
|
||||
: _i1aa3af9.AssistantEffort.fromJson(
|
||||
(jsonSerialization['effort'] as String),
|
||||
),
|
||||
maxEffort: jsonSerialization['maxEffort'] == null
|
||||
? null
|
||||
: _i1aa3af9.AssistantEffort.fromJson(
|
||||
(jsonSerialization['maxEffort'] as String),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -69,13 +84,20 @@ abstract class AssistantInfo
|
|||
/// Whether it reads images.
|
||||
bool images;
|
||||
|
||||
/// Its price per million input tokens; null where it has none, so its
|
||||
/// limits count tokens.
|
||||
/// Its price per million input tokens; null where it has none, so it
|
||||
/// counts against budgets' tokens alone.
|
||||
double? priceInput;
|
||||
|
||||
/// Its price per million output tokens.
|
||||
double? priceOutput;
|
||||
|
||||
/// The effort a question takes unless it names one (D63); null: the
|
||||
/// model's own.
|
||||
_i1aa3af9.AssistantEffort? effort;
|
||||
|
||||
/// The highest effort a question may name; null: none.
|
||||
_i1aa3af9.AssistantEffort? maxEffort;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantInfo]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
|
|
@ -88,6 +110,8 @@ abstract class AssistantInfo
|
|||
bool? images,
|
||||
double? priceInput,
|
||||
double? priceOutput,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
_i1aa3af9.AssistantEffort? maxEffort,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
|
|
@ -101,6 +125,8 @@ abstract class AssistantInfo
|
|||
'images': images,
|
||||
if (priceInput != null) 'priceInput': priceInput,
|
||||
if (priceOutput != null) 'priceOutput': priceOutput,
|
||||
if (effort != null) 'effort': effort?.toJson(),
|
||||
if (maxEffort != null) 'maxEffort': maxEffort?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -116,6 +142,8 @@ abstract class AssistantInfo
|
|||
'images': images,
|
||||
if (priceInput != null) 'priceInput': priceInput,
|
||||
if (priceOutput != null) 'priceOutput': priceOutput,
|
||||
if (effort != null) 'effort': effort?.toJson(),
|
||||
if (maxEffort != null) 'maxEffort': maxEffort?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +165,8 @@ class _AssistantInfoImpl extends AssistantInfo {
|
|||
required bool images,
|
||||
double? priceInput,
|
||||
double? priceOutput,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
_i1aa3af9.AssistantEffort? maxEffort,
|
||||
}) : super._(
|
||||
id: id,
|
||||
name: name,
|
||||
|
|
@ -146,6 +176,8 @@ class _AssistantInfoImpl extends AssistantInfo {
|
|||
images: images,
|
||||
priceInput: priceInput,
|
||||
priceOutput: priceOutput,
|
||||
effort: effort,
|
||||
maxEffort: maxEffort,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantInfo]
|
||||
|
|
@ -161,6 +193,8 @@ class _AssistantInfoImpl extends AssistantInfo {
|
|||
bool? images,
|
||||
Object? priceInput = _Undefined,
|
||||
Object? priceOutput = _Undefined,
|
||||
Object? effort = _Undefined,
|
||||
Object? maxEffort = _Undefined,
|
||||
}) {
|
||||
return AssistantInfo(
|
||||
id: id ?? this.id,
|
||||
|
|
@ -171,6 +205,10 @@ class _AssistantInfoImpl extends AssistantInfo {
|
|||
images: images ?? this.images,
|
||||
priceInput: priceInput is double? ? priceInput : this.priceInput,
|
||||
priceOutput: priceOutput is double? ? priceOutput : this.priceOutput,
|
||||
effort: effort is _i1aa3af9.AssistantEffort? ? effort : this.effort,
|
||||
maxEffort: maxEffort is _i1aa3af9.AssistantEffort?
|
||||
? maxEffort
|
||||
: this.maxEffort,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// A person's budget for all their assistants together (Halkyon Learn's ADR
|
||||
/// 0021, D58 and D59): a limit per UTC day and per UTC month, in money and
|
||||
/// in tokens, each null for none. Whichever runs out first stops them: the
|
||||
/// money the assistants with prices, the tokens every assistant.
|
||||
abstract class AssistantLimits
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
AssistantLimits._({
|
||||
this.dailyCostMicros,
|
||||
this.monthlyCostMicros,
|
||||
this.dailyTokens,
|
||||
this.monthlyTokens,
|
||||
});
|
||||
|
||||
factory AssistantLimits({
|
||||
int? dailyCostMicros,
|
||||
int? monthlyCostMicros,
|
||||
int? dailyTokens,
|
||||
int? monthlyTokens,
|
||||
}) = _AssistantLimitsImpl;
|
||||
|
||||
factory AssistantLimits.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return AssistantLimits(
|
||||
dailyCostMicros: jsonSerialization['dailyCostMicros'] as int?,
|
||||
monthlyCostMicros: jsonSerialization['monthlyCostMicros'] as int?,
|
||||
dailyTokens: jsonSerialization['dailyTokens'] as int?,
|
||||
monthlyTokens: jsonSerialization['monthlyTokens'] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
/// The most a UTC day may cost, in millionths of the instance's currency.
|
||||
int? dailyCostMicros;
|
||||
|
||||
/// The most a UTC month may cost, in millionths of the currency.
|
||||
int? monthlyCostMicros;
|
||||
|
||||
/// The most tokens a UTC day may use, input and output together.
|
||||
int? dailyTokens;
|
||||
|
||||
/// The most tokens a UTC month may use.
|
||||
int? monthlyTokens;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantLimits]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
AssistantLimits copyWith({
|
||||
int? dailyCostMicros,
|
||||
int? monthlyCostMicros,
|
||||
int? dailyTokens,
|
||||
int? monthlyTokens,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantLimits',
|
||||
if (dailyCostMicros != null) 'dailyCostMicros': dailyCostMicros,
|
||||
if (monthlyCostMicros != null) 'monthlyCostMicros': monthlyCostMicros,
|
||||
if (dailyTokens != null) 'dailyTokens': dailyTokens,
|
||||
if (monthlyTokens != null) 'monthlyTokens': monthlyTokens,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantLimits',
|
||||
if (dailyCostMicros != null) 'dailyCostMicros': dailyCostMicros,
|
||||
if (monthlyCostMicros != null) 'monthlyCostMicros': monthlyCostMicros,
|
||||
if (dailyTokens != null) 'dailyTokens': dailyTokens,
|
||||
if (monthlyTokens != null) 'monthlyTokens': monthlyTokens,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _AssistantLimitsImpl extends AssistantLimits {
|
||||
_AssistantLimitsImpl({
|
||||
int? dailyCostMicros,
|
||||
int? monthlyCostMicros,
|
||||
int? dailyTokens,
|
||||
int? monthlyTokens,
|
||||
}) : super._(
|
||||
dailyCostMicros: dailyCostMicros,
|
||||
monthlyCostMicros: monthlyCostMicros,
|
||||
dailyTokens: dailyTokens,
|
||||
monthlyTokens: monthlyTokens,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantLimits]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
AssistantLimits copyWith({
|
||||
Object? dailyCostMicros = _Undefined,
|
||||
Object? monthlyCostMicros = _Undefined,
|
||||
Object? dailyTokens = _Undefined,
|
||||
Object? monthlyTokens = _Undefined,
|
||||
}) {
|
||||
return AssistantLimits(
|
||||
dailyCostMicros: dailyCostMicros is int?
|
||||
? dailyCostMicros
|
||||
: this.dailyCostMicros,
|
||||
monthlyCostMicros: monthlyCostMicros is int?
|
||||
? monthlyCostMicros
|
||||
: this.monthlyCostMicros,
|
||||
dailyTokens: dailyTokens is int? ? dailyTokens : this.dailyTokens,
|
||||
monthlyTokens: monthlyTokens is int? ? monthlyTokens : this.monthlyTokens,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,11 +10,12 @@
|
|||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:halkyon_base_client/src/protocol/protocol.dart' as _iwgbpyo5;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../assistant/assistant_limit_unit.dart' as _il94nvme;
|
||||
import '../assistant/assistant_effort.dart' as _i1aa3af9;
|
||||
|
||||
/// An assistant granted to the person who asks (Halkyon Learn's ADR 0021,
|
||||
/// point 6 and D27): what it is, what goes where, and how much is left.
|
||||
/// point 6 and D27): what it is, what goes where, and how much it thinks.
|
||||
abstract class AssistantOffer
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
AssistantOffer._({
|
||||
|
|
@ -25,12 +26,8 @@ abstract class AssistantOffer
|
|||
required this.model,
|
||||
required this.images,
|
||||
this.agreedAt,
|
||||
required this.limitUnit,
|
||||
this.dailyLimit,
|
||||
this.monthlyLimit,
|
||||
required this.usedToday,
|
||||
required this.usedThisMonth,
|
||||
required this.outdated,
|
||||
this.effort,
|
||||
required this.efforts,
|
||||
});
|
||||
|
||||
factory AssistantOffer({
|
||||
|
|
@ -41,12 +38,8 @@ abstract class AssistantOffer
|
|||
required String model,
|
||||
required bool images,
|
||||
DateTime? agreedAt,
|
||||
required _il94nvme.AssistantLimitUnit limitUnit,
|
||||
int? dailyLimit,
|
||||
int? monthlyLimit,
|
||||
required int usedToday,
|
||||
required int usedThisMonth,
|
||||
required bool outdated,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
required List<_i1aa3af9.AssistantEffort> efforts,
|
||||
}) = _AssistantOfferImpl;
|
||||
|
||||
factory AssistantOffer.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
|
|
@ -60,14 +53,15 @@ abstract class AssistantOffer
|
|||
agreedAt: jsonSerialization['agreedAt'] == null
|
||||
? null
|
||||
: _isc.DateTimeJsonExtension.fromJson(jsonSerialization['agreedAt']),
|
||||
limitUnit: _il94nvme.AssistantLimitUnit.fromJson(
|
||||
(jsonSerialization['limitUnit'] as String),
|
||||
),
|
||||
dailyLimit: jsonSerialization['dailyLimit'] as int?,
|
||||
monthlyLimit: jsonSerialization['monthlyLimit'] as int?,
|
||||
usedToday: jsonSerialization['usedToday'] as int,
|
||||
usedThisMonth: jsonSerialization['usedThisMonth'] as int,
|
||||
outdated: _isc.BoolJsonExtension.fromJson(jsonSerialization['outdated']),
|
||||
effort: jsonSerialization['effort'] == null
|
||||
? null
|
||||
: _i1aa3af9.AssistantEffort.fromJson(
|
||||
(jsonSerialization['effort'] as String),
|
||||
),
|
||||
efforts: _iwgbpyo5.Protocol()
|
||||
.deserialize<List<_i1aa3af9.AssistantEffort>>(
|
||||
jsonSerialization['efforts'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -93,24 +87,12 @@ abstract class AssistantOffer
|
|||
/// another provider: then they are asked first (D40).
|
||||
DateTime? agreedAt;
|
||||
|
||||
/// What its limits count.
|
||||
_il94nvme.AssistantLimitUnit limitUnit;
|
||||
/// The effort a question takes unless it names one (D63); null: the
|
||||
/// model's own.
|
||||
_i1aa3af9.AssistantEffort? effort;
|
||||
|
||||
/// The most a UTC day may use; null for none.
|
||||
int? dailyLimit;
|
||||
|
||||
/// The most a UTC month may use; null for none.
|
||||
int? monthlyLimit;
|
||||
|
||||
/// What this UTC day used so far, in [limitUnit].
|
||||
int usedToday;
|
||||
|
||||
/// What this UTC month used so far, in [limitUnit].
|
||||
int usedThisMonth;
|
||||
|
||||
/// Whether the grant holds no more until the operator sets its limits
|
||||
/// again, as the assistant's prices came or went.
|
||||
bool outdated;
|
||||
/// The efforts a question may name, from the least; empty: none.
|
||||
List<_i1aa3af9.AssistantEffort> efforts;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantOffer]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
|
|
@ -123,12 +105,8 @@ abstract class AssistantOffer
|
|||
String? model,
|
||||
bool? images,
|
||||
DateTime? agreedAt,
|
||||
_il94nvme.AssistantLimitUnit? limitUnit,
|
||||
int? dailyLimit,
|
||||
int? monthlyLimit,
|
||||
int? usedToday,
|
||||
int? usedThisMonth,
|
||||
bool? outdated,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
List<_i1aa3af9.AssistantEffort>? efforts,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
|
|
@ -141,12 +119,8 @@ abstract class AssistantOffer
|
|||
'model': model,
|
||||
'images': images,
|
||||
if (agreedAt != null) 'agreedAt': agreedAt?.toJson(),
|
||||
'limitUnit': limitUnit.toJson(),
|
||||
if (dailyLimit != null) 'dailyLimit': dailyLimit,
|
||||
if (monthlyLimit != null) 'monthlyLimit': monthlyLimit,
|
||||
'usedToday': usedToday,
|
||||
'usedThisMonth': usedThisMonth,
|
||||
'outdated': outdated,
|
||||
if (effort != null) 'effort': effort?.toJson(),
|
||||
'efforts': efforts.toJson(valueToJson: (v) => v.toJson()),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -161,12 +135,8 @@ abstract class AssistantOffer
|
|||
'model': model,
|
||||
'images': images,
|
||||
if (agreedAt != null) 'agreedAt': agreedAt?.toJson(),
|
||||
'limitUnit': limitUnit.toJson(),
|
||||
if (dailyLimit != null) 'dailyLimit': dailyLimit,
|
||||
if (monthlyLimit != null) 'monthlyLimit': monthlyLimit,
|
||||
'usedToday': usedToday,
|
||||
'usedThisMonth': usedThisMonth,
|
||||
'outdated': outdated,
|
||||
if (effort != null) 'effort': effort?.toJson(),
|
||||
'efforts': efforts.toJson(valueToJson: (v) => v.toJson()),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -187,12 +157,8 @@ class _AssistantOfferImpl extends AssistantOffer {
|
|||
required String model,
|
||||
required bool images,
|
||||
DateTime? agreedAt,
|
||||
required _il94nvme.AssistantLimitUnit limitUnit,
|
||||
int? dailyLimit,
|
||||
int? monthlyLimit,
|
||||
required int usedToday,
|
||||
required int usedThisMonth,
|
||||
required bool outdated,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
required List<_i1aa3af9.AssistantEffort> efforts,
|
||||
}) : super._(
|
||||
id: id,
|
||||
name: name,
|
||||
|
|
@ -201,12 +167,8 @@ class _AssistantOfferImpl extends AssistantOffer {
|
|||
model: model,
|
||||
images: images,
|
||||
agreedAt: agreedAt,
|
||||
limitUnit: limitUnit,
|
||||
dailyLimit: dailyLimit,
|
||||
monthlyLimit: monthlyLimit,
|
||||
usedToday: usedToday,
|
||||
usedThisMonth: usedThisMonth,
|
||||
outdated: outdated,
|
||||
effort: effort,
|
||||
efforts: efforts,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantOffer]
|
||||
|
|
@ -221,12 +183,8 @@ class _AssistantOfferImpl extends AssistantOffer {
|
|||
String? model,
|
||||
bool? images,
|
||||
Object? agreedAt = _Undefined,
|
||||
_il94nvme.AssistantLimitUnit? limitUnit,
|
||||
Object? dailyLimit = _Undefined,
|
||||
Object? monthlyLimit = _Undefined,
|
||||
int? usedToday,
|
||||
int? usedThisMonth,
|
||||
bool? outdated,
|
||||
Object? effort = _Undefined,
|
||||
List<_i1aa3af9.AssistantEffort>? efforts,
|
||||
}) {
|
||||
return AssistantOffer(
|
||||
id: id ?? this.id,
|
||||
|
|
@ -236,12 +194,8 @@ class _AssistantOfferImpl extends AssistantOffer {
|
|||
model: model ?? this.model,
|
||||
images: images ?? this.images,
|
||||
agreedAt: agreedAt is DateTime? ? agreedAt : this.agreedAt,
|
||||
limitUnit: limitUnit ?? this.limitUnit,
|
||||
dailyLimit: dailyLimit is int? ? dailyLimit : this.dailyLimit,
|
||||
monthlyLimit: monthlyLimit is int? ? monthlyLimit : this.monthlyLimit,
|
||||
usedToday: usedToday ?? this.usedToday,
|
||||
usedThisMonth: usedThisMonth ?? this.usedThisMonth,
|
||||
outdated: outdated ?? this.outdated,
|
||||
effort: effort is _i1aa3af9.AssistantEffort? ? effort : this.effort,
|
||||
efforts: efforts ?? this.efforts.map((e0) => e0).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:halkyon_base_client/src/protocol/protocol.dart' as _iwgbpyo5;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../assistant/assistant_effort.dart' as _i1aa3af9;
|
||||
import '../assistant/assistant_message.dart' as _irryv85c;
|
||||
import '../assistant/assistant_tool.dart' as _ienotap4;
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ abstract class AssistantQuestion
|
|||
required this.messages,
|
||||
required this.tools,
|
||||
required this.maxOutputTokens,
|
||||
this.effort,
|
||||
});
|
||||
|
||||
factory AssistantQuestion({
|
||||
|
|
@ -33,6 +35,7 @@ abstract class AssistantQuestion
|
|||
required List<_irryv85c.AssistantMessage> messages,
|
||||
required List<_ienotap4.AssistantTool> tools,
|
||||
required int maxOutputTokens,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
}) = _AssistantQuestionImpl;
|
||||
|
||||
factory AssistantQuestion.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
|
|
@ -47,6 +50,11 @@ abstract class AssistantQuestion
|
|||
jsonSerialization['tools'],
|
||||
),
|
||||
maxOutputTokens: jsonSerialization['maxOutputTokens'] as int,
|
||||
effort: jsonSerialization['effort'] == null
|
||||
? null
|
||||
: _i1aa3af9.AssistantEffort.fromJson(
|
||||
(jsonSerialization['effort'] as String),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -62,10 +70,14 @@ abstract class AssistantQuestion
|
|||
/// The tools it may call.
|
||||
List<_ienotap4.AssistantTool> tools;
|
||||
|
||||
/// The ceiling on the answer's tokens, the instance's own ceiling at
|
||||
/// most.
|
||||
/// The ceiling on the answer's tokens, the effort's at most
|
||||
/// (`LlmEffort.outputCeiling`).
|
||||
int maxOutputTokens;
|
||||
|
||||
/// How much the assistant thinks first, among those it offers
|
||||
/// (`AssistantOffer.efforts`, D63); null: the operator's default for it.
|
||||
_i1aa3af9.AssistantEffort? effort;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantQuestion]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
|
|
@ -75,6 +87,7 @@ abstract class AssistantQuestion
|
|||
List<_irryv85c.AssistantMessage>? messages,
|
||||
List<_ienotap4.AssistantTool>? tools,
|
||||
int? maxOutputTokens,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
|
|
@ -85,6 +98,7 @@ abstract class AssistantQuestion
|
|||
'messages': messages.toJson(valueToJson: (v) => v.toJson()),
|
||||
'tools': tools.toJson(valueToJson: (v) => v.toJson()),
|
||||
'maxOutputTokens': maxOutputTokens,
|
||||
if (effort != null) 'effort': effort?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -97,6 +111,7 @@ abstract class AssistantQuestion
|
|||
'messages': messages.toJson(valueToJson: (v) => v.toJsonForProtocol()),
|
||||
'tools': tools.toJson(valueToJson: (v) => v.toJsonForProtocol()),
|
||||
'maxOutputTokens': maxOutputTokens,
|
||||
if (effort != null) 'effort': effort?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -106,6 +121,8 @@ abstract class AssistantQuestion
|
|||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _AssistantQuestionImpl extends AssistantQuestion {
|
||||
_AssistantQuestionImpl({
|
||||
required String assistant,
|
||||
|
|
@ -113,12 +130,14 @@ class _AssistantQuestionImpl extends AssistantQuestion {
|
|||
required List<_irryv85c.AssistantMessage> messages,
|
||||
required List<_ienotap4.AssistantTool> tools,
|
||||
required int maxOutputTokens,
|
||||
_i1aa3af9.AssistantEffort? effort,
|
||||
}) : super._(
|
||||
assistant: assistant,
|
||||
system: system,
|
||||
messages: messages,
|
||||
tools: tools,
|
||||
maxOutputTokens: maxOutputTokens,
|
||||
effort: effort,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantQuestion]
|
||||
|
|
@ -131,6 +150,7 @@ class _AssistantQuestionImpl extends AssistantQuestion {
|
|||
List<_irryv85c.AssistantMessage>? messages,
|
||||
List<_ienotap4.AssistantTool>? tools,
|
||||
int? maxOutputTokens,
|
||||
Object? effort = _Undefined,
|
||||
}) {
|
||||
return AssistantQuestion(
|
||||
assistant: assistant ?? this.assistant,
|
||||
|
|
@ -138,6 +158,7 @@ class _AssistantQuestionImpl extends AssistantQuestion {
|
|||
messages: messages ?? this.messages.map((e0) => e0.copyWith()).toList(),
|
||||
tools: tools ?? this.tools.map((e0) => e0.copyWith()).toList(),
|
||||
maxOutputTokens: maxOutputTokens ?? this.maxOutputTokens,
|
||||
effort: effort is _i1aa3af9.AssistantEffort? ? effort : this.effort,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ enum AssistantRefusal implements _isc.SerializableModel {
|
|||
/// provider since (D40).
|
||||
notAgreed,
|
||||
|
||||
/// A day's or a month's limit is reached;
|
||||
/// A day's or a month's limit of the person's budget is reached (D58);
|
||||
/// [AssistantRefusedException.resetsAt] says when it resets.
|
||||
limitReached,
|
||||
|
||||
/// The grant's limits count what the assistant counts no more, as its
|
||||
/// prices came or went: the operator sets them again.
|
||||
limitOutdated,
|
||||
/// The question names an effort the assistant doesn't offer: above the
|
||||
/// operator's highest, or where it has none to choose (D63).
|
||||
invalidEffort,
|
||||
|
||||
/// The question holds an image, and the assistant reads none.
|
||||
imagesNotRead,
|
||||
|
|
@ -65,8 +65,8 @@ enum AssistantRefusal implements _isc.SerializableModel {
|
|||
return AssistantRefusal.notAgreed;
|
||||
case 'limitReached':
|
||||
return AssistantRefusal.limitReached;
|
||||
case 'limitOutdated':
|
||||
return AssistantRefusal.limitOutdated;
|
||||
case 'invalidEffort':
|
||||
return AssistantRefusal.invalidEffort;
|
||||
case 'imagesNotRead':
|
||||
return AssistantRefusal.imagesNotRead;
|
||||
case 'malformed':
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// What a person used of all their assistants together in a UTC day or
|
||||
/// month (Halkyon Learn's ADR 0021, D58), as their budget counts it.
|
||||
abstract class AssistantUse
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
AssistantUse._({
|
||||
required this.costMicros,
|
||||
required this.tokens,
|
||||
});
|
||||
|
||||
factory AssistantUse({
|
||||
required int costMicros,
|
||||
required int tokens,
|
||||
}) = _AssistantUseImpl;
|
||||
|
||||
factory AssistantUse.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return AssistantUse(
|
||||
costMicros: jsonSerialization['costMicros'] as int,
|
||||
tokens: jsonSerialization['tokens'] as int,
|
||||
);
|
||||
}
|
||||
|
||||
/// What it cost, in millionths of the instance's currency; nothing for
|
||||
/// the assistants without prices.
|
||||
int costMicros;
|
||||
|
||||
/// The tokens, input and output together, of every assistant.
|
||||
int tokens;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantUse]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
AssistantUse copyWith({
|
||||
int? costMicros,
|
||||
int? tokens,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantUse',
|
||||
'costMicros': costMicros,
|
||||
'tokens': tokens,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.AssistantUse',
|
||||
'costMicros': costMicros,
|
||||
'tokens': tokens,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _AssistantUseImpl extends AssistantUse {
|
||||
_AssistantUseImpl({
|
||||
required int costMicros,
|
||||
required int tokens,
|
||||
}) : super._(
|
||||
costMicros: costMicros,
|
||||
tokens: tokens,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantUse]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
AssistantUse copyWith({
|
||||
int? costMicros,
|
||||
int? tokens,
|
||||
}) {
|
||||
return AssistantUse(
|
||||
costMicros: costMicros ?? this.costMicros,
|
||||
tokens: tokens ?? this.tokens,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,23 +12,31 @@
|
|||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:halkyon_base_client/src/protocol/protocol.dart' as _iwgbpyo5;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../assistant/assistant_limits.dart' as _inm8zjwk;
|
||||
import '../assistant/assistant_offer.dart' as _ify4died;
|
||||
import '../assistant/assistant_use.dart' as _i25whxul;
|
||||
|
||||
/// What an instance offers the person who asks, of assistants (Halkyon
|
||||
/// Learn's ADR 0021): those granted to them, and whether they may add their
|
||||
/// own keys.
|
||||
/// Learn's ADR 0021): those granted to them, their budget and what is used
|
||||
/// of it, and whether they may add their own keys.
|
||||
abstract class AssistantsOffered
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
AssistantsOffered._({
|
||||
required this.assistants,
|
||||
required this.ownKeys,
|
||||
required this.currency,
|
||||
required this.budget,
|
||||
required this.usedToday,
|
||||
required this.usedThisMonth,
|
||||
});
|
||||
|
||||
factory AssistantsOffered({
|
||||
required List<_ify4died.AssistantOffer> assistants,
|
||||
required bool ownKeys,
|
||||
required String currency,
|
||||
required _inm8zjwk.AssistantLimits budget,
|
||||
required _i25whxul.AssistantUse usedToday,
|
||||
required _i25whxul.AssistantUse usedThisMonth,
|
||||
}) = _AssistantsOfferedImpl;
|
||||
|
||||
factory AssistantsOffered.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
|
|
@ -39,6 +47,15 @@ abstract class AssistantsOffered
|
|||
),
|
||||
ownKeys: _isc.BoolJsonExtension.fromJson(jsonSerialization['ownKeys']),
|
||||
currency: jsonSerialization['currency'] as String,
|
||||
budget: _iwgbpyo5.Protocol().deserialize<_inm8zjwk.AssistantLimits>(
|
||||
jsonSerialization['budget'],
|
||||
),
|
||||
usedToday: _iwgbpyo5.Protocol().deserialize<_i25whxul.AssistantUse>(
|
||||
jsonSerialization['usedToday'],
|
||||
),
|
||||
usedThisMonth: _iwgbpyo5.Protocol().deserialize<_i25whxul.AssistantUse>(
|
||||
jsonSerialization['usedThisMonth'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -51,6 +68,16 @@ abstract class AssistantsOffered
|
|||
/// The currency costs are in (ISO 4217).
|
||||
String currency;
|
||||
|
||||
/// Their budget for all of them together (D58); every limit null for
|
||||
/// none.
|
||||
_inm8zjwk.AssistantLimits budget;
|
||||
|
||||
/// What this UTC day used so far.
|
||||
_i25whxul.AssistantUse usedToday;
|
||||
|
||||
/// What this UTC month used so far.
|
||||
_i25whxul.AssistantUse usedThisMonth;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantsOffered]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
|
|
@ -58,6 +85,9 @@ abstract class AssistantsOffered
|
|||
List<_ify4died.AssistantOffer>? assistants,
|
||||
bool? ownKeys,
|
||||
String? currency,
|
||||
_inm8zjwk.AssistantLimits? budget,
|
||||
_i25whxul.AssistantUse? usedToday,
|
||||
_i25whxul.AssistantUse? usedThisMonth,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
|
|
@ -66,6 +96,9 @@ abstract class AssistantsOffered
|
|||
'assistants': assistants.toJson(valueToJson: (v) => v.toJson()),
|
||||
'ownKeys': ownKeys,
|
||||
'currency': currency,
|
||||
'budget': budget.toJson(),
|
||||
'usedToday': usedToday.toJson(),
|
||||
'usedThisMonth': usedThisMonth.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +111,9 @@ abstract class AssistantsOffered
|
|||
),
|
||||
'ownKeys': ownKeys,
|
||||
'currency': currency,
|
||||
'budget': budget.toJsonForProtocol(),
|
||||
'usedToday': usedToday.toJsonForProtocol(),
|
||||
'usedThisMonth': usedThisMonth.toJsonForProtocol(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -92,10 +128,16 @@ class _AssistantsOfferedImpl extends AssistantsOffered {
|
|||
required List<_ify4died.AssistantOffer> assistants,
|
||||
required bool ownKeys,
|
||||
required String currency,
|
||||
required _inm8zjwk.AssistantLimits budget,
|
||||
required _i25whxul.AssistantUse usedToday,
|
||||
required _i25whxul.AssistantUse usedThisMonth,
|
||||
}) : super._(
|
||||
assistants: assistants,
|
||||
ownKeys: ownKeys,
|
||||
currency: currency,
|
||||
budget: budget,
|
||||
usedToday: usedToday,
|
||||
usedThisMonth: usedThisMonth,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantsOffered]
|
||||
|
|
@ -106,12 +148,18 @@ class _AssistantsOfferedImpl extends AssistantsOffered {
|
|||
List<_ify4died.AssistantOffer>? assistants,
|
||||
bool? ownKeys,
|
||||
String? currency,
|
||||
_inm8zjwk.AssistantLimits? budget,
|
||||
_i25whxul.AssistantUse? usedToday,
|
||||
_i25whxul.AssistantUse? usedThisMonth,
|
||||
}) {
|
||||
return AssistantsOffered(
|
||||
assistants:
|
||||
assistants ?? this.assistants.map((e0) => e0.copyWith()).toList(),
|
||||
ownKeys: ownKeys ?? this.ownKeys,
|
||||
currency: currency ?? this.currency,
|
||||
budget: budget ?? this.budget.copyWith(),
|
||||
usedToday: usedToday ?? this.usedToday.copyWith(),
|
||||
usedThisMonth: usedThisMonth ?? this.usedThisMonth.copyWith(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,12 +22,14 @@ abstract class AssistantsSetUp
|
|||
required this.assistants,
|
||||
required this.currency,
|
||||
required this.ownKeys,
|
||||
required this.people,
|
||||
});
|
||||
|
||||
factory AssistantsSetUp({
|
||||
required List<_iuj14wfe.AssistantInfo> assistants,
|
||||
required String currency,
|
||||
required bool ownKeys,
|
||||
required int people,
|
||||
}) = _AssistantsSetUpImpl;
|
||||
|
||||
factory AssistantsSetUp.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
|
|
@ -38,6 +40,7 @@ abstract class AssistantsSetUp
|
|||
),
|
||||
currency: jsonSerialization['currency'] as String,
|
||||
ownKeys: _isc.BoolJsonExtension.fromJson(jsonSerialization['ownKeys']),
|
||||
people: jsonSerialization['people'] as int,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -50,6 +53,9 @@ abstract class AssistantsSetUp
|
|||
/// Whether people may add their own keys.
|
||||
bool ownKeys;
|
||||
|
||||
/// How many people have an assistant granted.
|
||||
int people;
|
||||
|
||||
/// Returns a shallow copy of this [AssistantsSetUp]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
|
|
@ -57,6 +63,7 @@ abstract class AssistantsSetUp
|
|||
List<_iuj14wfe.AssistantInfo>? assistants,
|
||||
String? currency,
|
||||
bool? ownKeys,
|
||||
int? people,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
|
|
@ -65,6 +72,7 @@ abstract class AssistantsSetUp
|
|||
'assistants': assistants.toJson(valueToJson: (v) => v.toJson()),
|
||||
'currency': currency,
|
||||
'ownKeys': ownKeys,
|
||||
'people': people,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +85,7 @@ abstract class AssistantsSetUp
|
|||
),
|
||||
'currency': currency,
|
||||
'ownKeys': ownKeys,
|
||||
'people': people,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -91,10 +100,12 @@ class _AssistantsSetUpImpl extends AssistantsSetUp {
|
|||
required List<_iuj14wfe.AssistantInfo> assistants,
|
||||
required String currency,
|
||||
required bool ownKeys,
|
||||
required int people,
|
||||
}) : super._(
|
||||
assistants: assistants,
|
||||
currency: currency,
|
||||
ownKeys: ownKeys,
|
||||
people: people,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [AssistantsSetUp]
|
||||
|
|
@ -105,12 +116,14 @@ class _AssistantsSetUpImpl extends AssistantsSetUp {
|
|||
List<_iuj14wfe.AssistantInfo>? assistants,
|
||||
String? currency,
|
||||
bool? ownKeys,
|
||||
int? people,
|
||||
}) {
|
||||
return AssistantsSetUp(
|
||||
assistants:
|
||||
assistants ?? this.assistants.map((e0) => e0.copyWith()).toList(),
|
||||
currency: currency ?? this.currency,
|
||||
ownKeys: ownKeys ?? this.ownKeys,
|
||||
people: people ?? this.people,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@ import 'package:halkyon_base_client/src/protocol/admission/waiting_state.dart'
|
|||
as _i1sx1z35;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_answer.dart'
|
||||
as _il9lgl6t;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_grant_overview.dart'
|
||||
as _iddnouvb;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_grantee.dart'
|
||||
as _irq97saf;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_limits.dart'
|
||||
as _imbc626c;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_month_figures.dart'
|
||||
as _igllc81w;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_question.dart'
|
||||
|
|
@ -46,6 +48,8 @@ import 'package:halkyon_base_client/src/protocol/keys/keys_setup.dart'
|
|||
as _iec2fqr0;
|
||||
import 'package:halkyon_base_client/src/protocol/operator/account_overview.dart'
|
||||
as _ijg5xrj3;
|
||||
import 'package:halkyon_base_client/src/protocol/operator/operator_counts.dart'
|
||||
as _i6zs23jc;
|
||||
import 'package:halkyon_base_client/src/protocol/password/authenticator.dart'
|
||||
as _ivfmflch;
|
||||
import 'package:halkyon_base_client/src/protocol/password/authenticator_enrolment.dart'
|
||||
|
|
@ -133,8 +137,8 @@ class EndpointAssistant extends _isc.EndpointRef {
|
|||
String get name => 'halkyon_base.assistant';
|
||||
|
||||
/// The assistants granted to the caller that are set, with what goes
|
||||
/// where and what is left of their limits, and whether they may add their
|
||||
/// own keys; none on a member (D43).
|
||||
/// where and their effort, the caller's budget and what is used of it,
|
||||
/// and whether they may add their own keys; none on a member (D43).
|
||||
_ida.Future<_ig7pm61n.AssistantsOffered> offered() =>
|
||||
caller.callServerEndpoint<_ig7pm61n.AssistantsOffered>(
|
||||
'halkyon_base.assistant',
|
||||
|
|
@ -155,9 +159,10 @@ class EndpointAssistant extends _isc.EndpointRef {
|
|||
/// Forwards [question] to its assistant and streams the answer: the text
|
||||
/// as the model writes it, then the whole turn with what was counted.
|
||||
/// Refused before anything goes without a grant, an agreement or room
|
||||
/// within the limits, for a question that can't be sent, and with more
|
||||
/// than `maxQuestionsAtOnce` on their way; then for the provider's
|
||||
/// failure. Cancelled, the answer is still read to its end and counted.
|
||||
/// within the budget, for an effort not offered or a question that can't
|
||||
/// be sent, and with more than `maxQuestionsAtOnce` on their way; then for
|
||||
/// the provider's failure. Cancelled, the answer is still read to its end
|
||||
/// and counted.
|
||||
_ida.Stream<_il9lgl6t.AssistantAnswer> ask({
|
||||
required _imspm6kl.AssistantQuestion question,
|
||||
}) =>
|
||||
|
|
@ -181,10 +186,10 @@ class EndpointAssistant extends _isc.EndpointRef {
|
|||
}
|
||||
|
||||
/// The operator's assistants as the operator grants them (Halkyon Learn's
|
||||
/// ADR 0021, points 6 and 8): the assistants set, the grants with their
|
||||
/// limits, and everyone's figures, never what was asked. The operator's
|
||||
/// scope only the register's sessions carry. Refusals are
|
||||
/// `OperatorRefusedException`s.
|
||||
/// ADR 0021, points 6 and 8, D58): the assistants set, who has which with
|
||||
/// their budget, and everyone's figures, never what was asked. The
|
||||
/// operator's scope only the register's sessions carry. Refusals are
|
||||
/// `OperatorRefusedException`s; nothing changes then.
|
||||
/// {@category Endpoint}
|
||||
class EndpointAssistantOperator extends _isc.EndpointRef {
|
||||
EndpointAssistantOperator(_isc.EndpointCaller caller) : super(caller);
|
||||
|
|
@ -192,7 +197,8 @@ class EndpointAssistantOperator extends _isc.EndpointRef {
|
|||
@override
|
||||
String get name => 'halkyon_base.assistantOperator';
|
||||
|
||||
/// The assistants set in `deploy/assistants.env`, without their keys.
|
||||
/// The assistants set in `deploy/assistants.env`, without their keys, and
|
||||
/// how many people have any.
|
||||
_ida.Future<_ie204iej.AssistantsSetUp> setUp() =>
|
||||
caller.callServerEndpoint<_ie204iej.AssistantsSetUp>(
|
||||
'halkyon_base.assistantOperator',
|
||||
|
|
@ -200,50 +206,77 @@ class EndpointAssistantOperator extends _isc.EndpointRef {
|
|||
{},
|
||||
);
|
||||
|
||||
/// Every grant, by handle.
|
||||
_ida.Future<List<_iddnouvb.AssistantGrantOverview>> grants() =>
|
||||
caller.callServerEndpoint<List<_iddnouvb.AssistantGrantOverview>>(
|
||||
'halkyon_base.assistantOperator',
|
||||
'grants',
|
||||
{},
|
||||
);
|
||||
/// The people with an assistant granted whose handle starts with
|
||||
/// [startingWith], whatever its case, by handle, 50 from [offset] on,
|
||||
/// each with their assistants, budget and what they used.
|
||||
_ida.Future<List<_irq97saf.AssistantGrantee>> grantees({
|
||||
required String startingWith,
|
||||
required int offset,
|
||||
}) => caller.callServerEndpoint<List<_irq97saf.AssistantGrantee>>(
|
||||
'halkyon_base.assistantOperator',
|
||||
'grantees',
|
||||
{
|
||||
'startingWith': startingWith,
|
||||
'offset': offset,
|
||||
},
|
||||
);
|
||||
|
||||
/// Grants [account] [assistant] with [dailyLimit] and [monthlyLimit] (null:
|
||||
/// none), in the unit of its pricing; granted already, the limits change
|
||||
/// and the agreement stays. Refused for an assistant not set
|
||||
/// Those of [accounts] with an assistant or a budget, as [grantees] has
|
||||
/// them.
|
||||
_ida.Future<List<_irq97saf.AssistantGrantee>> granteesOf({
|
||||
required List<_isc.UuidValue> accounts,
|
||||
}) => caller.callServerEndpoint<List<_irq97saf.AssistantGrantee>>(
|
||||
'halkyon_base.assistantOperator',
|
||||
'granteesOf',
|
||||
{'accounts': accounts},
|
||||
);
|
||||
|
||||
/// Grants each of [accounts] each of [assistants] they don't have yet,
|
||||
/// keeping the agreements of those they have, and sets each one's budget
|
||||
/// to [budget]. Refused for an assistant not set
|
||||
/// (`OperatorRefusal.assistantNotSet`), a limit below 0
|
||||
/// (`OperatorRefusal.invalidLimit`) and an account unknown
|
||||
/// (`OperatorRefusal.notFound`).
|
||||
_ida.Future<void> grant({
|
||||
required _isc.UuidValue account,
|
||||
required String assistant,
|
||||
required int? dailyLimit,
|
||||
required int? monthlyLimit,
|
||||
required List<_isc.UuidValue> accounts,
|
||||
required List<String> assistants,
|
||||
required _imbc626c.AssistantLimits budget,
|
||||
}) => caller.callServerEndpoint<void>(
|
||||
'halkyon_base.assistantOperator',
|
||||
'grant',
|
||||
{
|
||||
'account': account,
|
||||
'assistant': assistant,
|
||||
'dailyLimit': dailyLimit,
|
||||
'monthlyLimit': monthlyLimit,
|
||||
'accounts': accounts,
|
||||
'assistants': assistants,
|
||||
'budget': budget,
|
||||
},
|
||||
);
|
||||
|
||||
/// Takes [assistant] back from [account]; refused where it isn't granted
|
||||
/// (`OperatorRefusal.notFound`).
|
||||
_ida.Future<void> revoke({
|
||||
/// Gives [account] exactly [assistants] and [budget], taking back the
|
||||
/// assistants left out; with none, the budget goes too. Refused as
|
||||
/// [grant] is.
|
||||
_ida.Future<void> change({
|
||||
required _isc.UuidValue account,
|
||||
required String assistant,
|
||||
required List<String> assistants,
|
||||
required _imbc626c.AssistantLimits budget,
|
||||
}) => caller.callServerEndpoint<void>(
|
||||
'halkyon_base.assistantOperator',
|
||||
'revoke',
|
||||
'change',
|
||||
{
|
||||
'account': account,
|
||||
'assistant': assistant,
|
||||
'assistants': assistants,
|
||||
'budget': budget,
|
||||
},
|
||||
);
|
||||
|
||||
/// Takes every assistant and the budget back from [account]; refused for
|
||||
/// one with neither (`OperatorRefusal.notFound`).
|
||||
_ida.Future<void> revoke({required _isc.UuidValue account}) =>
|
||||
caller.callServerEndpoint<void>(
|
||||
'halkyon_base.assistantOperator',
|
||||
'revoke',
|
||||
{'account': account},
|
||||
);
|
||||
|
||||
/// Everyone's figures of the UTC month [month] is in, per person and
|
||||
/// assistant.
|
||||
_ida.Future<List<_igllc81w.AssistantMonthFigures>> figures({
|
||||
|
|
@ -556,13 +589,21 @@ class EndpointInstanceOperator extends _isc.EndpointRef {
|
|||
@override
|
||||
String get name => 'halkyon_base.instanceOperator';
|
||||
|
||||
/// How many wait, operate and have an account (D62).
|
||||
_ida.Future<_i6zs23jc.OperatorCounts> counts() =>
|
||||
caller.callServerEndpoint<_i6zs23jc.OperatorCounts>(
|
||||
'halkyon_base.instanceOperator',
|
||||
'counts',
|
||||
{},
|
||||
);
|
||||
|
||||
/// The accounts that wait, new or suspended, the longest waiting first,
|
||||
/// each with its handle and matching code.
|
||||
_ida.Future<List<_ijg5xrj3.AccountOverview>> waiting() =>
|
||||
/// 50 from [offset] on, each with its handle and matching code.
|
||||
_ida.Future<List<_ijg5xrj3.AccountOverview>> waiting({required int offset}) =>
|
||||
caller.callServerEndpoint<List<_ijg5xrj3.AccountOverview>>(
|
||||
'halkyon_base.instanceOperator',
|
||||
'waiting',
|
||||
{},
|
||||
{'offset': offset},
|
||||
);
|
||||
|
||||
/// Approves [account], new or suspended; refused for one that doesn't
|
||||
|
|
@ -584,13 +625,17 @@ class EndpointInstanceOperator extends _isc.EndpointRef {
|
|||
);
|
||||
|
||||
/// The accounts whose handle starts with [startingWith], whatever its
|
||||
/// case, by handle, at most 50.
|
||||
/// case, by handle, 50 from [offset] on.
|
||||
_ida.Future<List<_ijg5xrj3.AccountOverview>> accounts({
|
||||
required String startingWith,
|
||||
required int offset,
|
||||
}) => caller.callServerEndpoint<List<_ijg5xrj3.AccountOverview>>(
|
||||
'halkyon_base.instanceOperator',
|
||||
'accounts',
|
||||
{'startingWith': startingWith},
|
||||
{
|
||||
'startingWith': startingWith,
|
||||
'offset': offset,
|
||||
},
|
||||
);
|
||||
|
||||
/// Suspends [account]: its sessions end everywhere, and it waits until
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// How many accounts an operator's screen lists (Halkyon Learn's ADR 0021,
|
||||
/// D62): each row of its overview.
|
||||
abstract class OperatorCounts
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
OperatorCounts._({
|
||||
required this.waiting,
|
||||
required this.operators,
|
||||
required this.accounts,
|
||||
});
|
||||
|
||||
factory OperatorCounts({
|
||||
required int waiting,
|
||||
required int operators,
|
||||
required int accounts,
|
||||
}) = _OperatorCountsImpl;
|
||||
|
||||
factory OperatorCounts.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return OperatorCounts(
|
||||
waiting: jsonSerialization['waiting'] as int,
|
||||
operators: jsonSerialization['operators'] as int,
|
||||
accounts: jsonSerialization['accounts'] as int,
|
||||
);
|
||||
}
|
||||
|
||||
/// The accounts that wait, new or suspended.
|
||||
int waiting;
|
||||
|
||||
/// The instance's operators.
|
||||
int operators;
|
||||
|
||||
/// Every account.
|
||||
int accounts;
|
||||
|
||||
/// Returns a shallow copy of this [OperatorCounts]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
OperatorCounts copyWith({
|
||||
int? waiting,
|
||||
int? operators,
|
||||
int? accounts,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.OperatorCounts',
|
||||
'waiting': waiting,
|
||||
'operators': operators,
|
||||
'accounts': accounts,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.OperatorCounts',
|
||||
'waiting': waiting,
|
||||
'operators': operators,
|
||||
'accounts': accounts,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _OperatorCountsImpl extends OperatorCounts {
|
||||
_OperatorCountsImpl({
|
||||
required int waiting,
|
||||
required int operators,
|
||||
required int accounts,
|
||||
}) : super._(
|
||||
waiting: waiting,
|
||||
operators: operators,
|
||||
accounts: accounts,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [OperatorCounts]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
OperatorCounts copyWith({
|
||||
int? waiting,
|
||||
int? operators,
|
||||
int? accounts,
|
||||
}) {
|
||||
return OperatorCounts(
|
||||
waiting: waiting ?? this.waiting,
|
||||
operators: operators ?? this.operators,
|
||||
accounts: accounts ?? this.accounts,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,8 +11,8 @@
|
|||
// ignore_for_file: dead_code, unnecessary_type_check
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_grant_overview.dart'
|
||||
as _iddnouvb;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_grantee.dart'
|
||||
as _irq97saf;
|
||||
import 'package:halkyon_base_client/src/protocol/assistant/assistant_month_figures.dart'
|
||||
as _igllc81w;
|
||||
import 'package:halkyon_base_client/src/protocol/operator/account_overview.dart'
|
||||
|
|
@ -31,9 +31,11 @@ import 'admission/sign_up_refusal.dart' as _i3fmyy9u;
|
|||
import 'admission/sign_up_refused_exception.dart' as _ihsvd1xl;
|
||||
import 'admission/waiting_state.dart' as _ia0s7l9v;
|
||||
import 'assistant/assistant_answer.dart' as _i4xvagvh;
|
||||
import 'assistant/assistant_grant_overview.dart' as _if1wqxlo;
|
||||
import 'assistant/assistant_effort.dart' as _iy0r1pfb;
|
||||
import 'assistant/assistant_granted.dart' as _iask2wp0;
|
||||
import 'assistant/assistant_grantee.dart' as _iv98w8yz;
|
||||
import 'assistant/assistant_info.dart' as _icgnmpgo;
|
||||
import 'assistant/assistant_limit_unit.dart' as _i2tar4hy;
|
||||
import 'assistant/assistant_limits.dart' as _izf9yrqz;
|
||||
import 'assistant/assistant_message.dart' as _ix3wp1gt;
|
||||
import 'assistant/assistant_month_figures.dart' as _iwtv7nqb;
|
||||
import 'assistant/assistant_offer.dart' as _ixkxcfp6;
|
||||
|
|
@ -45,6 +47,7 @@ import 'assistant/assistant_refused_exception.dart' as _isesir8y;
|
|||
import 'assistant/assistant_role.dart' as _i03wxav7;
|
||||
import 'assistant/assistant_stop.dart' as _iar7xpcj;
|
||||
import 'assistant/assistant_tool.dart' as _ipg2scd3;
|
||||
import 'assistant/assistant_use.dart' as _i1y5mek2;
|
||||
import 'assistant/assistants_offered.dart' as _iaf7r0va;
|
||||
import 'assistant/assistants_set_up.dart' as _i9n90xnx;
|
||||
import 'auth/email_code_purpose.dart' as _ifpka2on;
|
||||
|
|
@ -59,6 +62,7 @@ import 'keys/keys_password.dart' as _i70xpmnz;
|
|||
import 'keys/keys_proof.dart' as _iviximyh;
|
||||
import 'keys/keys_setup.dart' as _iqdhlx3t;
|
||||
import 'operator/account_overview.dart' as _i80faifx;
|
||||
import 'operator/operator_counts.dart' as _ipa83975;
|
||||
import 'operator/operator_refusal.dart' as _i3wnysru;
|
||||
import 'operator/operator_refused_exception.dart' as _iicg8rjf;
|
||||
import 'password/account_reset_kind.dart' as _i91ka1it;
|
||||
|
|
@ -91,9 +95,11 @@ export 'admission/sign_up_refusal.dart';
|
|||
export 'admission/sign_up_refused_exception.dart';
|
||||
export 'admission/waiting_state.dart';
|
||||
export 'assistant/assistant_answer.dart';
|
||||
export 'assistant/assistant_grant_overview.dart';
|
||||
export 'assistant/assistant_effort.dart';
|
||||
export 'assistant/assistant_granted.dart';
|
||||
export 'assistant/assistant_grantee.dart';
|
||||
export 'assistant/assistant_info.dart';
|
||||
export 'assistant/assistant_limit_unit.dart';
|
||||
export 'assistant/assistant_limits.dart';
|
||||
export 'assistant/assistant_message.dart';
|
||||
export 'assistant/assistant_month_figures.dart';
|
||||
export 'assistant/assistant_offer.dart';
|
||||
|
|
@ -105,6 +111,7 @@ export 'assistant/assistant_refused_exception.dart';
|
|||
export 'assistant/assistant_role.dart';
|
||||
export 'assistant/assistant_stop.dart';
|
||||
export 'assistant/assistant_tool.dart';
|
||||
export 'assistant/assistant_use.dart';
|
||||
export 'assistant/assistants_offered.dart';
|
||||
export 'assistant/assistants_set_up.dart';
|
||||
export 'auth/email_code_purpose.dart';
|
||||
|
|
@ -119,6 +126,7 @@ export 'keys/keys_password.dart';
|
|||
export 'keys/keys_proof.dart';
|
||||
export 'keys/keys_setup.dart';
|
||||
export 'operator/account_overview.dart';
|
||||
export 'operator/operator_counts.dart';
|
||||
export 'operator/operator_refusal.dart';
|
||||
export 'operator/operator_refused_exception.dart';
|
||||
export 'password/account_reset_kind.dart';
|
||||
|
|
@ -210,14 +218,20 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (t == _i4xvagvh.AssistantAnswer) {
|
||||
return _i4xvagvh.AssistantAnswer.fromJson(data) as T;
|
||||
}
|
||||
if (t == _if1wqxlo.AssistantGrantOverview) {
|
||||
return _if1wqxlo.AssistantGrantOverview.fromJson(data) as T;
|
||||
if (t == _iy0r1pfb.AssistantEffort) {
|
||||
return _iy0r1pfb.AssistantEffort.fromJson(data) as T;
|
||||
}
|
||||
if (t == _iask2wp0.AssistantGranted) {
|
||||
return _iask2wp0.AssistantGranted.fromJson(data) as T;
|
||||
}
|
||||
if (t == _iv98w8yz.AssistantGrantee) {
|
||||
return _iv98w8yz.AssistantGrantee.fromJson(data) as T;
|
||||
}
|
||||
if (t == _icgnmpgo.AssistantInfo) {
|
||||
return _icgnmpgo.AssistantInfo.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i2tar4hy.AssistantLimitUnit) {
|
||||
return _i2tar4hy.AssistantLimitUnit.fromJson(data) as T;
|
||||
if (t == _izf9yrqz.AssistantLimits) {
|
||||
return _izf9yrqz.AssistantLimits.fromJson(data) as T;
|
||||
}
|
||||
if (t == _ix3wp1gt.AssistantMessage) {
|
||||
return _ix3wp1gt.AssistantMessage.fromJson(data) as T;
|
||||
|
|
@ -252,6 +266,9 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (t == _ipg2scd3.AssistantTool) {
|
||||
return _ipg2scd3.AssistantTool.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i1y5mek2.AssistantUse) {
|
||||
return _i1y5mek2.AssistantUse.fromJson(data) as T;
|
||||
}
|
||||
if (t == _iaf7r0va.AssistantsOffered) {
|
||||
return _iaf7r0va.AssistantsOffered.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -294,6 +311,9 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (t == _i80faifx.AccountOverview) {
|
||||
return _i80faifx.AccountOverview.fromJson(data) as T;
|
||||
}
|
||||
if (t == _ipa83975.OperatorCounts) {
|
||||
return _ipa83975.OperatorCounts.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i3wnysru.OperatorRefusal) {
|
||||
return _i3wnysru.OperatorRefusal.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -398,18 +418,24 @@ class Protocol extends _isc.SerializationManager {
|
|||
return (data != null ? _i4xvagvh.AssistantAnswer.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_if1wqxlo.AssistantGrantOverview?>()) {
|
||||
return (data != null
|
||||
? _if1wqxlo.AssistantGrantOverview.fromJson(data)
|
||||
: null)
|
||||
if (t == _isc.getType<_iy0r1pfb.AssistantEffort?>()) {
|
||||
return (data != null ? _iy0r1pfb.AssistantEffort.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_iask2wp0.AssistantGranted?>()) {
|
||||
return (data != null ? _iask2wp0.AssistantGranted.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_iv98w8yz.AssistantGrantee?>()) {
|
||||
return (data != null ? _iv98w8yz.AssistantGrantee.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_icgnmpgo.AssistantInfo?>()) {
|
||||
return (data != null ? _icgnmpgo.AssistantInfo.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_i2tar4hy.AssistantLimitUnit?>()) {
|
||||
return (data != null ? _i2tar4hy.AssistantLimitUnit.fromJson(data) : null)
|
||||
if (t == _isc.getType<_izf9yrqz.AssistantLimits?>()) {
|
||||
return (data != null ? _izf9yrqz.AssistantLimits.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_ix3wp1gt.AssistantMessage?>()) {
|
||||
|
|
@ -460,6 +486,9 @@ class Protocol extends _isc.SerializationManager {
|
|||
return (data != null ? _ipg2scd3.AssistantTool.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_i1y5mek2.AssistantUse?>()) {
|
||||
return (data != null ? _i1y5mek2.AssistantUse.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _isc.getType<_iaf7r0va.AssistantsOffered?>()) {
|
||||
return (data != null ? _iaf7r0va.AssistantsOffered.fromJson(data) : null)
|
||||
as T;
|
||||
|
|
@ -513,6 +542,10 @@ class Protocol extends _isc.SerializationManager {
|
|||
return (data != null ? _i80faifx.AccountOverview.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_ipa83975.OperatorCounts?>()) {
|
||||
return (data != null ? _ipa83975.OperatorCounts.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_i3wnysru.OperatorRefusal?>()) {
|
||||
return (data != null ? _i3wnysru.OperatorRefusal.fromJson(data) : null)
|
||||
as T;
|
||||
|
|
@ -626,12 +659,24 @@ class Protocol extends _isc.SerializationManager {
|
|||
return (data != null ? _i8dcjd27.SimpleLoginReturn.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == List<_iask2wp0.AssistantGranted>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_iask2wp0.AssistantGranted>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_ikru952l.AssistantPart>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_ikru952l.AssistantPart>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_iy0r1pfb.AssistantEffort>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_iy0r1pfb.AssistantEffort>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_ix3wp1gt.AssistantMessage>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_ix3wp1gt.AssistantMessage>(e))
|
||||
|
|
@ -674,21 +719,25 @@ class Protocol extends _isc.SerializationManager {
|
|||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_iddnouvb.AssistantGrantOverview>) {
|
||||
if (t == List<_irq97saf.AssistantGrantee>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_iddnouvb.AssistantGrantOverview>(e))
|
||||
.map((e) => deserialize<_irq97saf.AssistantGrantee>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_isc.UuidValue>) {
|
||||
return (data as List).map((e) => deserialize<_isc.UuidValue>(e)).toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<String>) {
|
||||
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
|
||||
}
|
||||
if (t == List<_ijg5xrj3.AccountOverview>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_ijg5xrj3.AccountOverview>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<String>) {
|
||||
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
|
||||
}
|
||||
if (t == List<_ivfmflch.Authenticator>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_ivfmflch.Authenticator>(e))
|
||||
|
|
@ -715,9 +764,11 @@ class Protocol extends _isc.SerializationManager {
|
|||
_ihsvd1xl.SignUpRefusedException => 'SignUpRefusedException',
|
||||
_ia0s7l9v.WaitingState => 'WaitingState',
|
||||
_i4xvagvh.AssistantAnswer => 'AssistantAnswer',
|
||||
_if1wqxlo.AssistantGrantOverview => 'AssistantGrantOverview',
|
||||
_iy0r1pfb.AssistantEffort => 'AssistantEffort',
|
||||
_iask2wp0.AssistantGranted => 'AssistantGranted',
|
||||
_iv98w8yz.AssistantGrantee => 'AssistantGrantee',
|
||||
_icgnmpgo.AssistantInfo => 'AssistantInfo',
|
||||
_i2tar4hy.AssistantLimitUnit => 'AssistantLimitUnit',
|
||||
_izf9yrqz.AssistantLimits => 'AssistantLimits',
|
||||
_ix3wp1gt.AssistantMessage => 'AssistantMessage',
|
||||
_iwtv7nqb.AssistantMonthFigures => 'AssistantMonthFigures',
|
||||
_ixkxcfp6.AssistantOffer => 'AssistantOffer',
|
||||
|
|
@ -729,6 +780,7 @@ class Protocol extends _isc.SerializationManager {
|
|||
_i03wxav7.AssistantRole => 'AssistantRole',
|
||||
_iar7xpcj.AssistantStop => 'AssistantStop',
|
||||
_ipg2scd3.AssistantTool => 'AssistantTool',
|
||||
_i1y5mek2.AssistantUse => 'AssistantUse',
|
||||
_iaf7r0va.AssistantsOffered => 'AssistantsOffered',
|
||||
_i9n90xnx.AssistantsSetUp => 'AssistantsSetUp',
|
||||
_ifpka2on.EmailCodePurpose => 'EmailCodePurpose',
|
||||
|
|
@ -743,6 +795,7 @@ class Protocol extends _isc.SerializationManager {
|
|||
_iviximyh.KeysProof => 'KeysProof',
|
||||
_iqdhlx3t.KeysSetup => 'KeysSetup',
|
||||
_i80faifx.AccountOverview => 'AccountOverview',
|
||||
_ipa83975.OperatorCounts => 'OperatorCounts',
|
||||
_i3wnysru.OperatorRefusal => 'OperatorRefusal',
|
||||
_iicg8rjf.OperatorRefusedException => 'OperatorRefusedException',
|
||||
_i91ka1it.AccountResetKind => 'AccountResetKind',
|
||||
|
|
@ -798,12 +851,16 @@ class Protocol extends _isc.SerializationManager {
|
|||
return 'WaitingState';
|
||||
case _i4xvagvh.AssistantAnswer():
|
||||
return 'AssistantAnswer';
|
||||
case _if1wqxlo.AssistantGrantOverview():
|
||||
return 'AssistantGrantOverview';
|
||||
case _iy0r1pfb.AssistantEffort():
|
||||
return 'AssistantEffort';
|
||||
case _iask2wp0.AssistantGranted():
|
||||
return 'AssistantGranted';
|
||||
case _iv98w8yz.AssistantGrantee():
|
||||
return 'AssistantGrantee';
|
||||
case _icgnmpgo.AssistantInfo():
|
||||
return 'AssistantInfo';
|
||||
case _i2tar4hy.AssistantLimitUnit():
|
||||
return 'AssistantLimitUnit';
|
||||
case _izf9yrqz.AssistantLimits():
|
||||
return 'AssistantLimits';
|
||||
case _ix3wp1gt.AssistantMessage():
|
||||
return 'AssistantMessage';
|
||||
case _iwtv7nqb.AssistantMonthFigures():
|
||||
|
|
@ -826,6 +883,8 @@ class Protocol extends _isc.SerializationManager {
|
|||
return 'AssistantStop';
|
||||
case _ipg2scd3.AssistantTool():
|
||||
return 'AssistantTool';
|
||||
case _i1y5mek2.AssistantUse():
|
||||
return 'AssistantUse';
|
||||
case _iaf7r0va.AssistantsOffered():
|
||||
return 'AssistantsOffered';
|
||||
case _i9n90xnx.AssistantsSetUp():
|
||||
|
|
@ -854,6 +913,8 @@ class Protocol extends _isc.SerializationManager {
|
|||
return 'KeysSetup';
|
||||
case _i80faifx.AccountOverview():
|
||||
return 'AccountOverview';
|
||||
case _ipa83975.OperatorCounts():
|
||||
return 'OperatorCounts';
|
||||
case _i3wnysru.OperatorRefusal():
|
||||
return 'OperatorRefusal';
|
||||
case _iicg8rjf.OperatorRefusedException():
|
||||
|
|
@ -934,14 +995,20 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (dataClassName == 'AssistantAnswer') {
|
||||
return deserialize<_i4xvagvh.AssistantAnswer>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantGrantOverview') {
|
||||
return deserialize<_if1wqxlo.AssistantGrantOverview>(data['data']);
|
||||
if (dataClassName == 'AssistantEffort') {
|
||||
return deserialize<_iy0r1pfb.AssistantEffort>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantGranted') {
|
||||
return deserialize<_iask2wp0.AssistantGranted>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantGrantee') {
|
||||
return deserialize<_iv98w8yz.AssistantGrantee>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantInfo') {
|
||||
return deserialize<_icgnmpgo.AssistantInfo>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantLimitUnit') {
|
||||
return deserialize<_i2tar4hy.AssistantLimitUnit>(data['data']);
|
||||
if (dataClassName == 'AssistantLimits') {
|
||||
return deserialize<_izf9yrqz.AssistantLimits>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantMessage') {
|
||||
return deserialize<_ix3wp1gt.AssistantMessage>(data['data']);
|
||||
|
|
@ -976,6 +1043,9 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (dataClassName == 'AssistantTool') {
|
||||
return deserialize<_ipg2scd3.AssistantTool>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantUse') {
|
||||
return deserialize<_i1y5mek2.AssistantUse>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'AssistantsOffered') {
|
||||
return deserialize<_iaf7r0va.AssistantsOffered>(data['data']);
|
||||
}
|
||||
|
|
@ -1018,6 +1088,9 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (dataClassName == 'AccountOverview') {
|
||||
return deserialize<_i80faifx.AccountOverview>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'OperatorCounts') {
|
||||
return deserialize<_ipa83975.OperatorCounts>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'OperatorRefusal') {
|
||||
return deserialize<_i3wnysru.OperatorRefusal>(data['data']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ Endpoints, under the nickname `base` in a host's client (`client.modules.base.em
|
|||
| `emailCode` | `sendCode`: a code by mail, which proves the address and signs nobody in | anyone |
|
||||
| `account` | `delete` (with the password's proof where the account has one, `keysProof` for one that signs in with SimpleLogin), `signInWays`, `operating`: how many accounts wait, for an operator (Halkyon Learn's ADR 0021, D34; null for anyone else) | signed in |
|
||||
| `waiting` | with a waiting account's pass (Halkyon Learn's ADR 0021, D31): `look` (waiting, suspended, approved, which takes the pass, or unknown), `deleteAccount` (a new account never approved), `forget` | without a session |
|
||||
| `instanceOperator` | `waiting`, `approve`, `refuse` (a new account, deleted), `accounts` (by the start of a handle, at most 50), `suspend` (every session ending, the account waiting anew; never an operator), `operators`, `appoint` (by handle, approving one that waits), `takeBack` (never the last operator) | `identified` and `operator`, on the register |
|
||||
| `instanceOperator` | `counts` (who waits, operates, has an account: D62), `waiting` (50 from an offset), `approve`, `refuse` (a new account, deleted), `accounts` (by the start of a handle, 50 from an offset), `suspend` (every session ending, the account waiting anew; never an operator), `operators`, `appoint` (by handle, approving one that waits), `takeBack` (never the last operator) | `identified` and `operator`, on the register |
|
||||
| `instance` | `basics`: the app it serves, whether codes by mail, password sign-in and SimpleLogin are on, who may sign up (`SIGN_UP`), the source link, the oldest app build, where data and backups are, whether people may add assistants with their own keys | anyone |
|
||||
| `assistant` | Halkyon Learn's ADR 0021, step 2: `offered`, the assistants granted to the caller that are set, with what goes where, what is left of their limits and whether they agreed (none on a member, D43); `agree(assistant)`, to what goes where, its provider as it is now (D40); `ask(question)`, a stream: the answer's text as the model writes it, then the whole turn with why it stopped and its tokens, once counted (D35, D38); `figures`, the caller's own, month by month | `identified` |
|
||||
| `assistantOperator` | `setUp`: the assistants set, without their keys; `grants`, by handle; `grant(account, assistant, dailyLimit, monthlyLimit)`, in money with prices, else tokens, the agreement kept when the limits change; `revoke`; `figures(month)`: everyone's of a UTC month, per person and assistant | `identified` and `operator`, on the register |
|
||||
| `assistant` | Halkyon Learn's ADR 0021, step 2: `offered`, the assistants granted to the caller that are set, with what goes where, their effort and whether they agreed, and the caller's budget with what is used of it (none on a member, D43); `agree(assistant)`, to what goes where, its provider as it is now (D40); `ask(question)`, at an effort offered or the operator's default (D63), a stream: the answer's text as the model writes it, then the whole turn with why it stopped and its tokens, once counted (D35, D38); `figures`, the caller's own, month by month | `identified` |
|
||||
| `assistantOperator` | `setUp`: the assistants set, without their keys, with their effort, and how many people have any; `grantees` (by the start of a handle, 50 from an offset) and `granteesOf(accounts)`: each person's assistants, budget and what they used; `grant(accounts, assistants, budget)`: each person the assistants they lack, the agreements of the others kept, and the budget (D58); `change(account, assistants, budget)`: exactly those; `revoke(account)`: every assistant and the budget; `figures(month)`: everyone's of a UTC month, per person and assistant | `identified` and `operator`, on the register |
|
||||
| `profile` | `mine`, `save`, `checkHandle` (with every answer about a new handle, at most 30 an hour per person and 60 per network), `checkLinks` (at most 10 an hour), `setAvatar`, `removeAvatar`, `remove` (what it shows goes, the handle stays, private again: Halkyon Learn's ADR 0020, D27): the caller's own public profile | `identified` |
|
||||
| `profiles` | `byHandle`: anyone's public profile once they went public, whatever the handle's case | signed in |
|
||||
|
||||
|
|
@ -128,14 +128,19 @@ Endpoints, under the nickname `base` in a host's client (`client.modules.base.em
|
|||
- **Assistants** (Halkyon Learn's ADR 0021, points 4 to 8, D27 to D46): the operator's
|
||||
language models, set in `deploy/assistants.env` (`assistantsFrom`, read as the server
|
||||
starts, anything it can't use stopping it), each through halkyon_llm with the
|
||||
operator's key; nobody has one until an operator grants it, with limits per UTC day
|
||||
and month (`assistant_grant`). `ask` checks, in order: at most `maxQuestionsAtOnce`
|
||||
(2) on their way per person (`tooManyAtOnce`), the grant (`notGranted`), the
|
||||
agreement (`notAgreed`), limits set in the unit the assistant's pricing has now
|
||||
(`limitOutdated`), the month's limit, the day's (`limitReached`, with when it
|
||||
resets), then the question itself (`requestOf`: `malformed`, `imagesNotRead`,
|
||||
`tooLarge` past `assistantQuestionMaxCharacters`, `assistantImageMaxBytes` or
|
||||
`assistantQuestionMaxImages`); the output is capped at `assistantOutputCeiling`. Each
|
||||
operator's key; nobody has one until an operator grants it (`assistant_grant`), and
|
||||
each person has one budget for all their assistants together (`assistant_budget`,
|
||||
D58, D59): a limit per UTC day and month in money and in tokens, each optional,
|
||||
money counting the assistants with prices, tokens every one. `ask` checks, in order:
|
||||
at most `maxQuestionsAtOnce` (2) on their way per person (`tooManyAtOnce`), the grant
|
||||
(`notGranted`), the agreement (`notAgreed`), the budget's month, then its day
|
||||
(`limitReached`, with when it resets), then the question itself (`requestOf`:
|
||||
`invalidEffort` for an effort above the operator's highest or where there is none to
|
||||
choose, `malformed`, `imagesNotRead`, `tooLarge` past
|
||||
`assistantQuestionMaxCharacters`, `assistantImageMaxBytes` or
|
||||
`assistantQuestionMaxImages`). The effort is the question's or the operator's default
|
||||
(`_EFFORT`, `_MAX_EFFORT`, D63), and the output is capped at that effort's ceiling
|
||||
(halkyon_llm's `LlmEffort.outputCeiling`, 16,384 without one). Each
|
||||
request carries the person's opaque ID (HMAC-SHA256 under `ASSISTANT_ID_KEY`,
|
||||
`personIdOf`, D30), never their account. Once sent, the provider's reply is read to
|
||||
its end whatever the app does and counted on a session of its own
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
### A person's budget for all their assistants together (Halkyon Learn's ADR
|
||||
### 0021, D58 and D59), as `AssistantLimits` holds it; none: no limits. Kept
|
||||
### by the register alone, deleted with the person or their last grant.
|
||||
class: AssistantBudget
|
||||
serverOnly: true
|
||||
table: assistant_budget
|
||||
fields:
|
||||
### The person: their ID (deleted with them, `deletePerson`).
|
||||
authUserId: UuidValue
|
||||
### The most a UTC day may cost, in millionths of the currency; null for
|
||||
### none.
|
||||
dailyCostMicros: int?
|
||||
### The most a UTC month may cost, in millionths of the currency.
|
||||
monthlyCostMicros: int?
|
||||
### The most tokens a UTC day may use, input and output together.
|
||||
dailyTokens: int?
|
||||
### The most tokens a UTC month may use.
|
||||
monthlyTokens: int?
|
||||
indexes:
|
||||
### One budget per person.
|
||||
assistant_budget_person_idx:
|
||||
fields: authUserId
|
||||
unique: true
|
||||
|
|
@ -13,7 +13,7 @@ import 'package:halkyon_llm/halkyon_llm.dart';
|
|||
/// The most characters a question holds, all its text together (the system
|
||||
/// prompt, the turns, the tools' results and calls, the tools' schemas):
|
||||
/// about 100,000 tokens, which bounds what one question costs, as the
|
||||
/// output's ceiling bounds the answer (D38).
|
||||
/// output's ceiling bounds the answer (D38, `outputCeilingAt`).
|
||||
const assistantQuestionMaxCharacters = 400000;
|
||||
|
||||
/// The most bytes of one image: 5 MiB once in base64, the most Anthropic
|
||||
|
|
@ -35,14 +35,22 @@ Never _refused(AssistantRefusal refusal) =>
|
|||
/// The request [question] stands for, to [assistant], with [personId] as the
|
||||
/// provider's opaque ID of the person (D30). Refused
|
||||
/// ([AssistantRefusedException]) for a turn out of place or a part without
|
||||
/// what its kind needs ([AssistantRefusal.malformed]), an image to an
|
||||
/// assistant that reads none ([AssistantRefusal.imagesNotRead]) and a
|
||||
/// what its kind needs ([AssistantRefusal.malformed]), an effort the
|
||||
/// assistant doesn't offer ([AssistantRefusal.invalidEffort], D63), an image
|
||||
/// to an assistant that reads none ([AssistantRefusal.imagesNotRead]) and a
|
||||
/// question past the limits above ([AssistantRefusal.tooLarge]).
|
||||
LlmRequest requestOf(
|
||||
AssistantQuestion question,
|
||||
AssistantSetting assistant, {
|
||||
required String personId,
|
||||
}) {
|
||||
final asked = switch (question.effort) {
|
||||
null => null,
|
||||
final effort => LlmEffort.named(effort.name),
|
||||
};
|
||||
if (question.effort != null && !assistant.efforts.contains(asked)) {
|
||||
_refused(AssistantRefusal.invalidEffort);
|
||||
}
|
||||
var characters = question.system.length;
|
||||
var images = 0;
|
||||
final messages = <LlmMessage>[];
|
||||
|
|
@ -99,7 +107,11 @@ LlmRequest requestOf(
|
|||
system: question.system,
|
||||
messages: messages,
|
||||
tools: tools,
|
||||
maxOutputTokens: question.maxOutputTokens.clamp(1, assistantOutputCeiling),
|
||||
maxOutputTokens: question.maxOutputTokens.clamp(
|
||||
1,
|
||||
assistant.outputCeilingAt(asked),
|
||||
),
|
||||
effort: asked ?? assistant.effort,
|
||||
personId: personId,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
### How much an assistant thinks before it answers (Halkyon Learn's ADR 0021,
|
||||
### D63), from the least to the most: Anthropic's levels, each provider's
|
||||
### own field sent in their place.
|
||||
enum: AssistantEffort
|
||||
serialized: byName
|
||||
values:
|
||||
- low
|
||||
- medium
|
||||
- high
|
||||
- xhigh
|
||||
- max
|
||||
|
|
@ -14,8 +14,8 @@ class AssistantEndpoint extends Endpoint {
|
|||
Set<Scope> get requiredScopes => {identified};
|
||||
|
||||
/// The assistants granted to the caller that are set, with what goes
|
||||
/// where and what is left of their limits, and whether they may add their
|
||||
/// own keys; none on a member (D43).
|
||||
/// where and their effort, the caller's budget and what is used of it,
|
||||
/// and whether they may add their own keys; none on a member (D43).
|
||||
Future<AssistantsOffered> offered(Session session) =>
|
||||
assistantsOffered(session, _caller(session));
|
||||
|
||||
|
|
@ -28,9 +28,10 @@ class AssistantEndpoint extends Endpoint {
|
|||
/// Forwards [question] to its assistant and streams the answer: the text
|
||||
/// as the model writes it, then the whole turn with what was counted.
|
||||
/// Refused before anything goes without a grant, an agreement or room
|
||||
/// within the limits, for a question that can't be sent, and with more
|
||||
/// than `maxQuestionsAtOnce` on their way; then for the provider's
|
||||
/// failure. Cancelled, the answer is still read to its end and counted.
|
||||
/// within the budget, for an effort not offered or a question that can't
|
||||
/// be sent, and with more than `maxQuestionsAtOnce` on their way; then for
|
||||
/// the provider's failure. Cancelled, the answer is still read to its end
|
||||
/// and counted.
|
||||
Stream<AssistantAnswer> ask(
|
||||
Session session, {
|
||||
required AssistantQuestion question,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue