Files
plugins/packages/aelios/page/i18n.js
T
sakisakisa-design 33027a8fb8 aelios 0.1.0: Aelios memory recall and opt-in recording as gateway hooks (#549)
New package @magpie-community/gateway-aelios 0.1.0: asynchronous gateway hooks for Aelios memory, by sakisakisa-design (Aelios's author).

- Recall before each human turn, appended after the last user message. Recording of completed turns is opt-in (record: false by default).
- Traffic goes only to the user's own serverUrl (HTTPS or loopback HTTP, redirects refused, a key required). Only local and magpie-key origins by default.
- Local admission: an authenticated, dialogue-free GET /v1/hook/identities decides which model maps to which identity. Unmatched turns, or an unavailable list, send no dialogue.
- The request is slimmed (system prompts, thinking and tool results dropped, historical credentials masked). The recorded reply is slimmed to text and tool calls before the secret check and the send.
- Settings page served by a loopback Bun service (Host, Origin null and per-process token checks).
- The cleanMessageText/appendMemory logic ported from AGPL Aelios is relicensed MIT by its sole author (PR thread).

Run at the reviewed head 620cd47 on mote (macOS, Bun 1.4.2):
- bun test packages/aelios: 178 pass. Full HOME=$(mktemp -d) bun test: 4176 pass, 0 fail. Merged onto main 39de030: 4179 pass, 0 fail. check.mjs: exit 0 at both.
- Broken by hand: recording the raw reply turns 5 tests red; admitting every model turns 11 red.
- Probe against a fake Aelios: no thinking, reasoning, signature or encrypted_content is recorded for Anthropic, Responses or Chat. A secret in visible text skips the record. An unmatched model, or an identities endpoint answering 404, malformed JSON or a network error, sends only the GET.
- Real magpie Bun host (origin/main ceeb73a0f, GatewayBegin/Finish): recall injected, the slimmed record sent, nothing for an unmatched model or a remote origin.
- PR CI: test red only on gcp-ai's browser test 40s timeout (#471, unrelated, passes on mote).

Not tried: a real Aelios deployment, or a real agent behind a running magpie.
2026-10-31 14:52:01 +08:00

33 lines
9.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* Classic scripts keep the page compatible with Magpie's sandbox. */
const aeliosI18n = (() => {
const en = {
intro: 'Memory that follows your agents.', loading: 'Loading…', loaded: 'Saved settings', unsaved: 'Unsaved changes', saving: 'Saving…', saved: 'Settings saved',
connection: 'Connection', configuredHelp: 'Configured settings do not confirm a verified connection. View the matching list to test permissions and model matching.', changeConnection: 'Change connection', connect: 'Connect and test', assignment: 'Assistant assignment', automaticAssignment: 'Automatic · Filters locally using Aelios’s authorized main-model matching list. Unmatched turns are not sent. If the list is unavailable, recall and recording pause (unavailable).', customAssignment: 'Custom · Uses the configured identity / routes.', fallback: 'Default / fallback', connectionIntro: 'Connect to your Aelios service.', url: 'Server URL', urlHelp: 'HTTPS, or HTTP on localhost. No credentials, query or fragment.',
key: 'API key', keyHelp: 'Stored in Magpie’s local plugin settings. Leave blank to use the environment variable.', keyEnv: 'API key environment variable', keyEnvHelp: 'Optional. Read from the Magpie host, never from this page.',
show: 'Show', hide: 'Hide', identity: 'Default identity / fallback', identityHelp: 'Leave blank for Aelios to select by model when no routes are configured. With routes, this is the fallback for unmatched requests.',
behavior: 'Memory behavior', behaviorIntro: 'Choose what Aelios recalls and remembers.', recall: 'Recall memory', recallHelp: 'Send the latest turn to Aelios and include relevant memory. On by default.', record: 'Record conversations', recordHelp: 'Send completed turns and replies to Aelios to remember. Off by default.',
agents: 'Limit to agents', agentsHelp: 'Optional, comma separated. Blank includes all agents allowed by the request scope.', routes: 'Identity routes', routesIntro: 'First match wins. Move a route up to give it priority.',
routeHelp: 'Match models and/or agents with comma-separated selectors. Models support * and ignore case; agents match exactly. If both are set, both must match. Unmatched requests are skipped unless a default identity is set.',
emptyRoutes: 'No routes. Aelios uses the default identity, or selects by model automatically.', addRoute: '+ Add route', routeLimit: 'Up to 64 routes. Each route needs an identity and at least one selector.', routeIdentity: 'Identity', models: 'Models', routeAgents: 'Agents', up: 'Move up', down: 'Move down', remove: 'Delete route', priority: 'Priority',
advanced: 'Advanced settings', allowRemote: 'Allow remote requests', allowRemoteHelp: 'Off by default. Enable recall and recording for remote requests and other gateway keys, subject to the agent filter. Normally only local requests and this computer’s Magpie key are included.',
saveHelp: 'Other advanced settings are preserved. Connection tests use saved settings.', test: 'View matching list / retest', save: 'Save settings', privacy: 'Recall sends conversation context to your configured Aelios service even when recording is off. Connection testing opens Magpie’s local service page.',
loadFailed: 'Could not read settings. Reopen this page to retry.', bridgeFailed: 'The Magpie bridge is unavailable. Open this page inside Magpie.', saveFailed: 'Saving failed. Your edits are still here; saved settings were checked again. Try saving again.', reconcileFailed: 'Could not confirm the saved settings. Your edits are still here; save again before testing.', saveFirst: 'Save your changes before testing. The connection test only reads saved settings.', testFailed: 'Could not read saved settings for the connection test. Try again.',
invalidUrl: 'Enter a valid HTTPS URL, or a localhost HTTP URL, without credentials, query or fragment.', invalidKey: 'The API key must not contain whitespace or control characters. A leading Bearer prefix is optional.', invalidIdentity: 'The default identity must be at most 128 characters.', invalidSelectors: 'Enter nonempty comma-separated selectors; each model selector must be at most 200 characters.', invalidRoute: 'Route identities need 1–64 letters, digits, dots, underscores or hyphens, starting with a letter or digit. Reserved service names are not allowed.', missingSelector: 'Each route needs at least one model or agent selector.', tooManyRoutes: 'Use at most 64 routes.', invalidAdvanced: 'An existing advanced option is invalid. gatewayTimeoutMs must be an integer from 100–10000, requestTimeoutMs from 50–9000, and recallBackoffMs from 0–3600000.', invalidOptions: 'The saved configuration has an unsupported field value. Correct it in Magpie before saving this form.'
};
const zh = {
intro: '让记忆跟随每一个智能体。', loading: '正在加载…', loaded: '已读取设置', unsaved: '有未保存的更改', saving: '正在保存…', saved: '设置已保存',
connection: '连接', configuredHelp: '已配置不代表已验证连接。查看匹配列表可测试授权和主模型匹配。', changeConnection: '更改连接', connect: '连接并测试', assignment: '助手分配', automaticAssignment: '自动 · 按 Aelios 授权列表的主模型匹配规则在本地筛选,未匹配时不发送对话。列表不可用时暂停回忆和记录,显示 unavailable。', customAssignment: '自定义 · 使用已配置的身份 / 路由。', fallback: '默认 / 兜底身份', connectionIntro: '连接你的 Aelios 服务。', url: '服务地址', urlHelp: '使用 HTTPS,或本机 HTTP 地址。不能含账号密码、查询参数或片段。',
key: 'API 密钥', keyHelp: '保存在 Magpie 本地插件设置中。留空时使用环境变量中的密钥。', keyEnv: '密钥环境变量', keyEnvHelp: '选填。从 Magpie 所在主机读取,不会由此页面读取。',
show: '显示', hide: '隐藏', identity: '默认身份 / 兜底身份', identityHelp: '未配置路由时,留空由 Aelios 按模型自动选择。配置路由后,此身份用于未匹配的请求。',
behavior: '记忆行为', behaviorIntro: '选择 Aelios 如何回忆和记录。', recall: '回忆记忆', recallHelp: '将当前对话轮次发送给 Aelios,并加入相关记忆。默认开启。', record: '记录对话', recordHelp: '将完成的对话轮次和回复发送给 Aelios 形成记忆。默认关闭。',
agents: '限定智能体', agentsHelp: '选填,以英文逗号分隔。留空包含请求范围内的所有智能体。', routes: '身份路由', routesIntro: '按顺序匹配,首个命中生效。上移可提高优先级。',
routeHelp: '模型和智能体选择器以英文逗号分隔。模型支持 * 通配符且忽略大小写;智能体精确匹配。两项都填写时须同时命中。未匹配的请求会跳过,除非已设置默认身份。',
emptyRoutes: '暂无路由。Aelios 使用默认身份,或按模型自动选择。', addRoute: '+ 添加路由', routeLimit: '最多 64 条路由。每条路由须填写身份及至少一种选择器。', routeIdentity: '身份', models: '模型', routeAgents: '智能体', up: '上移', down: '下移', remove: '删除路由', priority: '优先级',
advanced: '高级设置', allowRemote: '允许远程请求', allowRemoteHelp: '默认关闭。开启后,远程请求及其他网关密钥也可回忆和记录,仍受智能体筛选限制。通常只处理本机请求和本机的 Magpie 密钥。',
saveHelp: '其他高级设置会保留。连接测试仅使用已保存的设置。', test: '查看匹配列表 / 重新测试', save: '保存设置', privacy: '即使关闭记录,回忆功能仍会将对话上下文发送至配置的 Aelios 服务。测试连接将打开 Magpie 的本地服务页面。',
loadFailed: '无法读取设置。请重新打开此页面重试。', bridgeFailed: 'Magpie 桥接不可用。请在 Magpie 内打开此页面。', saveFailed: '保存失败。已重新检查保存状态,你的编辑仍保留,请再次保存。', reconcileFailed: '无法确认已保存的设置。你的编辑仍保留,请再次保存后再测试。', saveFirst: '请先保存更改再测试。连接测试只读取已保存的设置。', testFailed: '无法读取用于连接测试的已保存设置,请重试。',
invalidUrl: '请输入有效的 HTTPS 地址或本机 HTTP 地址,且不能含账号密码、查询参数或片段。', invalidKey: '密钥不能含空白或控制字符。可带 Bearer 前缀。', invalidIdentity: '默认身份不能超过 128 个字符。', invalidSelectors: '请填写非空的逗号分隔选择器;每个模型选择器不能超过 200 个字符。', invalidRoute: '路由身份须为 1–64 个字母、数字、点、下划线或连字符,以字母或数字开头,且不能使用服务保留名称。', missingSelector: '每条路由须填写至少一个模型或智能体选择器。', tooManyRoutes: '路由最多 64 条。', invalidAdvanced: '已有高级设置无效。gatewayTimeoutMs 须为 100–10000 的整数,requestTimeoutMs 为 50–9000,recallBackoffMs 为 0–3600000。', invalidOptions: '已保存配置中存在不支持的字段值,请先在 Magpie 中修正后再保存此表单。'
};
return { languageFor: (value) => /^zh\b/i.test(value || '') ? 'zh' : 'en', translate: (lang, key) => (lang === 'zh' ? zh : en)[key] || en[key] || key };
})();