@skaile/forge-layer-core 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,6 +45,30 @@ export const en = {
45
45
  'core.login.accountGone': 'This account no longer exists',
46
46
  'core.login.passkeyUnknown': 'This passkey is not known here',
47
47
  'core.login.passkeyCheckFailed': 'The passkey check failed',
48
+ 'core.login.emailModeHint': 'We mail you a code and a link to sign in.',
49
+ 'core.login.sendCode': 'Send code',
50
+ 'core.login.codeTitle': 'Enter the code',
51
+ 'core.login.codeHint': 'We sent a code to {email}. It is valid for {minutes} minutes.',
52
+ 'core.login.code': 'Code',
53
+ 'core.login.otherAddress': 'Other address',
54
+ 'core.login.resendCode': 'Send the code again',
55
+ 'core.login.resendCodeIn': 'Send again in {time}',
56
+ 'core.login.codeSent': 'If the address is known, an email is on its way.',
57
+ 'core.login.wrongCode': 'The code is wrong.',
58
+ 'core.login.expiredCode': 'The code has expired.',
59
+ 'core.login.tooManyAttempts': 'Too many attempts. Ask for a new code.',
60
+ 'core.login.tooManyCodes': 'Too many codes requested. Try again in an hour.',
61
+ 'core.login.mailFailed': 'The email could not be sent. Try again later.',
62
+ 'core.login.invalidLink': 'The sign-in link is no longer valid. Ask for a new code.',
63
+ 'core.login.expiredLink': 'The sign-in link has expired. Ask for a new code.',
64
+ 'core.login.tooManyLinks': 'Too many sign-in links for this person. Try again in an hour.',
65
+ 'core.login.mailSubject': 'Your sign-in code for {app}',
66
+ 'core.login.mailCode': 'Your sign-in code for {app}: {code}',
67
+ 'core.login.mailCodeIntro': 'Your sign-in code for {app}:',
68
+ 'core.login.mailValidity': 'It is valid for {minutes} minutes and works once. Or sign in with this link:',
69
+ 'core.login.mailValidityOneClick': 'It is valid for {minutes} minutes and works once. Or sign in with one click:',
70
+ 'core.login.mailLinkLabel': 'Sign in to {app}',
71
+ 'core.login.mailIgnore': 'If you did not ask for a code, you can ignore this email.',
48
72
 
49
73
  'core.appearance.system': 'System',
50
74
  'core.appearance.light': 'Light',
@@ -86,11 +110,18 @@ export const en = {
86
110
  'core.settings.app.timezone': 'IANA time zone for dates and digests, e.g. Europe/Berlin',
87
111
  'core.settings.app.appName.title': 'App name',
88
112
  'core.settings.app.timezone.title': 'Time zone',
89
- 'core.settings.assistantPolicy.label': 'Assistant: models',
90
- 'core.settings.assistantPolicy.description': 'Which models people may run the assistant on',
113
+ 'core.settings.assistantPolicy.label': 'Assistant: models and engine',
114
+ 'core.settings.assistantPolicy.description':
115
+ 'Which models people may run the assistant on, what a conversation runs on and what it reaches',
91
116
  'core.settings.assistantPolicy.ownModels':
92
117
  "People can use the assistant with their own provider, model and key in their profile. Off: everyone uses the app's model.",
93
118
  'core.settings.assistantPolicy.ownModels.title': 'Allow own models',
119
+ 'core.settings.assistantPolicy.engine':
120
+ 'What a new conversation runs on when both can: the chat in the app server (app) or the SKAILE agent (skaile). The other one steps in when the chosen one cannot run.',
121
+ 'core.settings.assistantPolicy.engine.title': 'Engine',
122
+ 'core.settings.assistantPolicy.chatAccess':
123
+ 'What the chat in the app server reaches. actions: every action a model may call, with the rights of the person. document: only the record the page shows, and changes are proposals the person applies.',
124
+ 'core.settings.assistantPolicy.chatAccess.title': 'Access of the chat',
94
125
 
95
126
  'core.agents.title': 'Agents',
96
127
  'core.agents.empty': 'No agents installed',
@@ -162,11 +193,10 @@ export const en = {
162
193
  'core.assistant.mode': 'Model',
163
194
  'core.assistant.mode.skaile': "App's model",
164
195
  'core.assistant.mode.byok': 'Own key',
165
- 'core.assistant.modeHint.skaile':
166
- 'Runs on the model the app provides, with full access to the app and your rights. Deleting asks you first in the Inbox.',
196
+ 'core.assistant.modeHint.skaile': 'Runs on the model the app provides and acts in the app with your rights.',
167
197
  'core.assistant.modeHint.byok':
168
198
  'Runs the same assistant on your own provider, model and key: the same tools, your rights.',
169
- 'core.assistant.modeHint.byokChat': 'Runs on your own provider key and sees only the page you have open.',
199
+ 'core.assistant.modeHint.byokChat': 'Runs on your own provider, model and key, with your rights.',
170
200
  'core.assistant.notInstalled': 'Not installed in this app.',
171
201
  'core.assistant.appModelOnly': "The assistant uses the app's model.",
172
202
  'core.assistant.ownModelsOff': 'Own models are switched off in this app.',
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Sign-in by mail (`APP_AUTH_MODE=email`): the limits the server enforces and
3
+ * the login page shows. The texts are `core.login.*` in `shared/messages/`.
4
+ */
5
+
6
+ /** A code and its link are valid this long. */
7
+ export const LOGIN_CODE_TTL_MINUTES = 10
8
+ /** At most this many codes per address, and sign-in links per person, within an hour. */
9
+ export const MAX_CODES_PER_HOUR = 5
10
+ /** The fifth wrong entry kills the code. */
11
+ export const MAX_CODE_ATTEMPTS = 5
12
+ /** The login page offers "Send the code again" this long after each send. */
13
+ export const RESEND_AFTER_SECONDS = 60
14
+ export const LOGIN_CODE_LENGTH = 6
15
+
16
+ /**
17
+ * Where a sign-in may lead: an app-relative path (`/projects/42`), never
18
+ * another origin (`//evil.example`, `/\evil.example`, `https://…`). Anything
19
+ * else becomes `/`.
20
+ */
21
+ export function safeNextPath(next: unknown): string {
22
+ if (typeof next !== 'string' || !next.startsWith('/') || next.startsWith('//') || next.startsWith('/\\')) return '/'
23
+ for (let i = 0; i < next.length; i++) {
24
+ const code = next.charCodeAt(i)
25
+ if (code < 0x20 || code === 0x7f) return '/'
26
+ }
27
+ return next
28
+ }