feat(learn): LanguageTool as a sidecar, reached through the server

compose.languagetool.yaml runs LanguageTool's open-source server
(meyay/languagetool 6.8-13, pinned by digest) on `edge` with no site and
no published port, as user 61081 on a read-only filesystem, without a
log. The server alone reaches it (LANGUAGETOOL_URL): grammar.check is
for those signed in, takes 20,000 characters, 60 checks a minute each
(counted in memory), maps a studyset's language to LanguageTool's code
and keeps nothing. instance.info() names the languages it checks; the
privacy page says what goes there. sidecars/README.md has the steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-25 23:13:46 +01:00
commit f766a880ac
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -48,6 +48,8 @@ import 'package:halkyon_learn_server/src/generated/feedback/feedback_view.dart'
as _iulci38e;
import 'package:halkyon_learn_server/src/generated/future_calls.dart'
as _iip9210p;
import 'package:halkyon_learn_server/src/generated/grammar/grammar_check.dart'
as _ijxfg6y9;
import 'package:halkyon_learn_server/src/generated/instance/instance_info.dart'
as _iof1vv19;
import 'package:halkyon_learn_server/src/generated/publish/publication.dart'
@ -207,6 +209,8 @@ class TestEndpoints {
late final _InboxEndpoint inbox;
late final _GrammarEndpoint grammar;
late final _InstanceEndpoint instance;
late final _PublishEndpoint publish;
@ -255,6 +259,10 @@ class _InternalTestEndpoints extends TestEndpoints
endpoints,
serializationManager,
);
grammar = _GrammarEndpoint(
endpoints,
serializationManager,
);
instance = _InstanceEndpoint(
endpoints,
serializationManager,
@ -1807,6 +1815,52 @@ class _InboxEndpoint {
}
}
class _GrammarEndpoint {
_GrammarEndpoint(
this._endpointDispatch,
this._serializationManager,
);
final _is.EndpointDispatch _endpointDispatch;
final _is.SerializationManager _serializationManager;
_ida.Future<_ijxfg6y9.GrammarCheck> check(
_ist.TestSessionBuilder sessionBuilder, {
required String text,
String? language,
}) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'grammar',
method: 'check',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'grammar',
methodName: 'check',
parameters: _ist.testObjectToJson({
'text': text,
'language': language,
}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_ijxfg6y9.GrammarCheck>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
}
class _InstanceEndpoint {
_InstanceEndpoint(
this._endpointDispatch,