@jskit-ai/agent-docs 0.1.353 → 0.1.355

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.
Files changed (66) hide show
  1. package/guide/agent/app-extras/assistant.md +70 -0
  2. package/guide/agent/app-setup/authentication.md +157 -2
  3. package/guide/agent/app-setup/database-layer.md +49 -15
  4. package/guide/agent/app-setup/service-keys.md +103 -0
  5. package/guide/agent/app-setup/upgrading-jskit.md +17 -5
  6. package/guide/agent/framework/data-access.md +13 -0
  7. package/guide/agent/framework/material-3.md +3 -4
  8. package/guide/agent/framework/speed-pass.md +7 -1
  9. package/guide/agent/framework/typed-features.md +56 -25
  10. package/guide/agent/index.md +2 -0
  11. package/package.json +1 -1
  12. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  13. package/patterns/minimal-foundation/example/package.json +6 -6
  14. package/patterns/shell-foundation/example/package.json +7 -7
  15. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  16. package/patterns/shell-foundation/example/src/components/menus/TabLinkItem.vue +5 -0
  17. package/reference/autogen/PATTERN_INDEX.md +49 -38
  18. package/reference/autogen/packages/agent-runtime.md +1 -1
  19. package/reference/autogen/packages/assistant-core.md +44 -8
  20. package/reference/autogen/packages/assistant-runtime.md +25 -0
  21. package/reference/autogen/packages/assistant-voice-sherpa.md +2 -1
  22. package/reference/autogen/packages/auth-core.md +4 -0
  23. package/reference/autogen/packages/auth-provider-local-core.md +13 -0
  24. package/reference/autogen/packages/auth-web.md +60 -16
  25. package/reference/autogen/packages/crud-core.md +3 -1
  26. package/reference/autogen/packages/database-runtime.md +1 -0
  27. package/reference/autogen/packages/http-web.md +1 -0
  28. package/reference/autogen/packages/kernel.md +1 -1
  29. package/reference/autogen/packages/material-web.md +2 -0
  30. package/reference/autogen/packages/realtime.md +2 -1
  31. package/reference/autogen/packages/resource-runtime.md +9 -0
  32. package/reference/autogen/packages/shell-web.md +35 -0
  33. package/reference/autogen/tooling/jskit-catalog.md +21 -8
  34. package/reference/autogen/tooling/testUtils.md +1 -0
  35. package/skills/jskit/references/data-access.md +13 -0
  36. package/skills/jskit/references/database-layer.md +49 -15
  37. package/skills/jskit/references/heuristics/placements.md +1 -0
  38. package/skills/jskit/references/heuristics/row-policies.md +1 -1
  39. package/skills/jskit/references/heuristics/ui-testing.md +3 -3
  40. package/skills/jskit/references/material-3.md +3 -4
  41. package/skills/jskit/references/pattern-index.md +49 -38
  42. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +6 -6
  43. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +7 -7
  44. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  45. package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/TabLinkItem.vue +5 -0
  46. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  47. package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +3 -0
  48. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  49. package/skills/jskit/references/patterns/auth/own-design-sign-in/PATTERN.md +141 -0
  50. package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/components/ConfirmItsYouDialog.vue +182 -0
  51. package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/theme/tokens.css +35 -0
  52. package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/views/auth/LoginView.vue +473 -0
  53. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  54. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  55. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  56. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +1 -1
  57. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  58. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  59. package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +5 -1
  60. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  61. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  62. package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/TabLinkItem.vue +5 -0
  63. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  64. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  65. package/skills/jskit/references/speed-pass.md +7 -1
  66. package/skills/jskit/references/typed-features.md +56 -25
@@ -0,0 +1,141 @@
1
+ ---
2
+ id: auth/own-design-sign-in
3
+ title: Sign-in screens in an app's own design
4
+ summary: Write the sign-in screen and the second-factor prompt in an application's own design system, with plain markup and the app's CSS, on the composables behind JSKIT's Material views, keeping every sign-in behavior.
5
+ keywords: auth, custom design, design system, login, own look, second factor, sign in, step up, style, without vuetify
6
+ requires: @jskit-ai/auth-web, @jskit-ai/kernel
7
+ ---
8
+
9
+ # Sign-in screens in an app's own design
10
+
11
+ ## Use when
12
+
13
+ Use this pattern when an application has its own design system, not Material
14
+ 3, and its sign-in screens must look like the rest of it: its own markup, its
15
+ own CSS, its own components. It builds on `auth/auth-surface`, which still
16
+ supplies the auth surface, the pages, the app's brand and the managed-preview
17
+ login; this pattern replaces the views those pages render.
18
+
19
+ ## Do not use when
20
+
21
+ Do not use this pattern to restyle JSKIT's Material views: an app on Material
22
+ 3 keeps `DefaultLoginView` and the other `Default*View`s and shows its identity
23
+ in their `brand` slot (`auth/auth-surface`), and an app on Vuetify that only
24
+ wants JSKIT's views drawn with its own button, dialog frame and text classes
25
+ provides them through shell-web's UI kit (`provideShellUi()` of
26
+ `@jskit-ai/shell-web/client/ui`; the authentication guide's "JSKIT's screens
27
+ with an app's own buttons, dialog and type"). Do not use it to change what
28
+ sign-in does: the behavior belongs to `@jskit-ai/auth-web`, and a screen that
29
+ needs different behavior asks for it there.
30
+
31
+ ## Product decisions
32
+
33
+ Choose the design system's tokens and components, the words where JSKIT's
34
+ messages do not fit, and which screens get the app's own look: sign-in, the
35
+ second-factor prompt, and, the same way, password reset, email change and
36
+ sign-out. Material stays JSKIT's default for every screen the app does not
37
+ replace.
38
+
39
+ ## Framework APIs
40
+
41
+ An app with its own design system writes its own sign-in screens with these
42
+ composables; Material stays JSKIT's default. Each is the very composable a
43
+ Material view renders, imported from its own path so a page loads only what it
44
+ uses, and none of them reads Vuetify:
45
+
46
+ - `useLoginView({ fallbackReturnTo })` from
47
+ `@jskit-ai/auth-web/client/composables/useLoginView`: the modes (sign in,
48
+ register, forgot password, one-time code, confirm your email), the fields
49
+ with their error messages, `submitAuth`, the provider buttons
50
+ (`oauthProviders`, `oauthProviderButtonLabel`, `startOAuthSignIn`), the
51
+ remembered account, invitations, the paused sign-in, the returnTo landing
52
+ and the session checks on mount and on return to the page. A refusal sets
53
+ `errorMessage` (and `infoMessage` for news such as a sent code), which the
54
+ view shows beside the form; the shell's error runtime hears it too.
55
+ `oauthProviderIcon` is a Material Symbols alias for the Material view; an
56
+ app's own view picks its icon from `provider.id`.
57
+ - `useResetPasswordView()`, `useEmailChangeView()` and `useSignOutView()`
58
+ from `@jskit-ai/auth-web/client/composables/<name>`: the other auth pages,
59
+ each with its `status` and actions.
60
+ - `useSecondFactorStepUp()` from
61
+ `@jskit-ai/auth-web/client/composables/useSecondFactorStepUp`: runs a
62
+ request again after the person proves the second factor; bind its `open`,
63
+ `verified` and `cancel` to the app's own prompt.
64
+ - `useSecondFactorProof({ submit, onDone })` from
65
+ `@jskit-ai/auth-web/client/composables/useSecondFactorProof`: the code or
66
+ recovery code form, its refusal beside the field and its submission. The
67
+ prompt submits `verifySecondFactor` from
68
+ `@jskit-ai/auth-web/client/runtime/secondFactorRequests`;
69
+ `useSecondFactorSettings()` and that module's other requests build an
70
+ account's authenticator settings the same way.
71
+ - `useJskitText()` from `@jskit-ai/kernel/client`: JSKIT's auth messages
72
+ (`jskit.auth.*`), so the app's translations apply to its own screens.
73
+
74
+ ## Invariants
75
+
76
+ - Every sign-in behavior comes from the composables: the view renders their
77
+ state and calls their actions, and never sends an auth request, reads a
78
+ returnTo, or stores an account itself.
79
+ - The view shows each field's error and `errorMessage` beside the form, keeps
80
+ each field's error line so nothing moves when one appears, and labels every
81
+ field.
82
+ - A browser already signed in (`redirectingSignedIn`) is shown no form.
83
+ - The screens keep the app's identity: the view renders `AppBrand.vue`, the
84
+ app's name as `index.html`'s `<title>` spells it, in the app's own style.
85
+ - Colours, radii and fonts are the design system's tokens, kept in
86
+ `src/theme/`; the screens read the token names.
87
+ - Pages and routes stay `auth/auth-surface`'s: `src/pages/auth/login.vue`
88
+ renders `src/views/auth/LoginView.vue`, now the app's own view.
89
+
90
+ ## Example files
91
+
92
+ `example/src/views/auth/LoginView.vue` is the sign-in view in plain HTML and
93
+ CSS on `useLoginView()`, with every mode the Material view has; it replaces
94
+ `auth/auth-surface`'s view wrapper of the same path.
95
+ `example/src/components/ConfirmItsYouDialog.vue` is the second-factor prompt,
96
+ a native `<dialog>` on `useSecondFactorProof()`, which a page shows for
97
+ `useSecondFactorStepUp()`:
98
+
99
+ ```vue
100
+ <script setup>
101
+ import { useSecondFactorStepUp } from "@jskit-ai/auth-web/client/composables/useSecondFactorStepUp";
102
+ import ConfirmItsYouDialog from "@/components/ConfirmItsYouDialog.vue";
103
+
104
+ const { open, run, verified, cancel } = useSecondFactorStepUp();
105
+ const refund = () => run(() => api.refund(orderId));
106
+ </script>
107
+
108
+ <template>
109
+ <button type="button" @click="refund">Refund</button>
110
+ <ConfirmItsYouDialog :open="open" @verified="verified" @cancel="cancel" />
111
+ </template>
112
+ ```
113
+
114
+ `example/src/theme/tokens.css` holds the design tokens, light and dark, which
115
+ the app's entry imports once.
116
+
117
+ ## Variation points
118
+
119
+ Change the markup, the CSS, the design system's components, the layout, the
120
+ words and which modes the screen shows; add a show-password control on
121
+ `showPassword`. Write `ResetPasswordView.vue`, `EmailChangeView.vue` and
122
+ `SignOutView.vue` the same way on their composables, or keep the Material
123
+ views for them.
124
+
125
+ ## Verification
126
+
127
+ Exercise the app's own screens as the Material ones are exercised: a password
128
+ sign-in that lands on the page its `returnTo` names, a refused sign-in that
129
+ shows the server's message beside the form and leaves it usable, a field
130
+ error on blur, the provider buttons, the remembered account and a route that
131
+ asks for the second factor, refused and accepted codes in the app's own
132
+ prompt. Open sign-in already signed in and confirm the form never shows.
133
+ `@jskit-ai/auth-web`'s `ownDesignSignIn.browser.test.js` drives this example
134
+ in an app without Vuetify.
135
+
136
+ ## Avoid
137
+
138
+ - copying the composables' logic, or the Material views, into the app
139
+ - auth requests, returnTo handling or session checks written in the view
140
+ - Vuetify components or Material classes on these screens
141
+ - raw colours outside `src/theme/`
@@ -0,0 +1,182 @@
1
+ <script setup>
2
+ import { nextTick, ref, useId, watch } from "vue";
3
+ import { useJskitText } from "@jskit-ai/kernel/client";
4
+ import { useSecondFactorProof } from "@jskit-ai/auth-web/client/composables/useSecondFactorProof";
5
+ import { verifySecondFactor } from "@jskit-ai/auth-web/client/runtime/secondFactorRequests";
6
+
7
+ // The step-up prompt in the app's own design: a native <dialog>, whose page behind it is inert while it is open and
8
+ // whose Escape cancels, over the form useSecondFactorProof() runs, the one JSKIT's SecondFactorDialog renders in
9
+ // Material 3. Bind `open`, `verified` and `cancel` to useSecondFactorStepUp()'s. A refused code shows beside the field.
10
+ const props = defineProps({
11
+ open: { type: Boolean, required: true }
12
+ });
13
+ const emit = defineEmits(["verified", "cancel"]);
14
+ const { t } = useJskitText();
15
+ const id = useId();
16
+ const dialog = ref(null);
17
+ const field = ref(null);
18
+ const { usingRecoveryCode, code, recoveryCode, fieldError, canSubmit, toggleRecoveryCode, submitProof } = useSecondFactorProof({
19
+ submit: verifySecondFactor,
20
+ onDone: (result) => emit("verified", result)
21
+ });
22
+
23
+ watch(() => props.open, (open) => {
24
+ if (open) {
25
+ dialog.value?.showModal();
26
+ } else {
27
+ dialog.value?.close();
28
+ }
29
+ }, { flush: "post" });
30
+
31
+ async function switchCodeKind() {
32
+ toggleRecoveryCode();
33
+ await nextTick();
34
+ field.value?.focus();
35
+ }
36
+ </script>
37
+
38
+ <template>
39
+ <!-- Escape asks the page to cancel; the dialog closes when `open` turns false, so the page decides. -->
40
+ <dialog ref="dialog" class="confirm-dialog" :aria-labelledby="`${id}-title`" @cancel.prevent="emit('cancel')">
41
+ <form class="confirm-dialog__form" novalidate @submit.prevent="submitProof">
42
+ <h2 :id="`${id}-title`" class="confirm-dialog__title">{{ t("jskit.auth.secondFactor.prompt.title") }}</h2>
43
+ <p class="confirm-dialog__muted">{{ t("jskit.auth.secondFactor.prompt.explain") }}</p>
44
+ <label :for="`${id}-code`">
45
+ {{ usingRecoveryCode ? t("jskit.auth.secondFactor.form.recoveryCode") : t("jskit.auth.secondFactor.form.code") }}
46
+ </label>
47
+ <input
48
+ v-if="usingRecoveryCode"
49
+ :id="`${id}-code`"
50
+ key="recovery-code"
51
+ ref="field"
52
+ v-model="recoveryCode"
53
+ autocomplete="off"
54
+ autocapitalize="off"
55
+ spellcheck="false"
56
+ :aria-invalid="Boolean(fieldError)"
57
+ :aria-describedby="`${id}-error`"
58
+ autofocus
59
+ >
60
+ <input
61
+ v-else
62
+ :id="`${id}-code`"
63
+ key="code"
64
+ ref="field"
65
+ v-model="code"
66
+ inputmode="numeric"
67
+ autocomplete="one-time-code"
68
+ :aria-invalid="Boolean(fieldError)"
69
+ :aria-describedby="`${id}-error`"
70
+ autofocus
71
+ >
72
+ <p :id="`${id}-error`" class="confirm-dialog__error">{{ fieldError }}</p>
73
+ <button class="confirm-dialog__link" type="button" @click="switchCodeKind">
74
+ {{ usingRecoveryCode ? t("jskit.auth.secondFactor.form.useCode") : t("jskit.auth.secondFactor.form.useRecoveryCode") }}
75
+ </button>
76
+ <div class="confirm-dialog__actions">
77
+ <button class="confirm-dialog__button" type="button" @click="emit('cancel')">{{ t("jskit.auth.secondFactor.cancel") }}</button>
78
+ <button class="confirm-dialog__button confirm-dialog__button--primary" type="submit" :disabled="!canSubmit">
79
+ {{ t("jskit.auth.secondFactor.confirm") }}
80
+ </button>
81
+ </div>
82
+ </form>
83
+ </dialog>
84
+ </template>
85
+
86
+ <style scoped>
87
+ .confirm-dialog {
88
+ width: min(400px, calc(100vw - 32px));
89
+ padding: 24px;
90
+ border: 0;
91
+ border-radius: var(--ds-radius-large);
92
+ background: var(--ds-panel);
93
+ color: var(--ds-text);
94
+ font-family: var(--ds-font);
95
+ }
96
+
97
+ .confirm-dialog::backdrop {
98
+ background: var(--ds-scrim);
99
+ }
100
+
101
+ .confirm-dialog__form {
102
+ display: grid;
103
+ gap: 8px;
104
+ }
105
+
106
+ .confirm-dialog__title {
107
+ margin: 0;
108
+ font-size: 1.25rem;
109
+ }
110
+
111
+ .confirm-dialog__muted,
112
+ .confirm-dialog__error {
113
+ margin: 0;
114
+ }
115
+
116
+ .confirm-dialog__muted {
117
+ color: var(--ds-text-muted);
118
+ }
119
+
120
+ .confirm-dialog__form label {
121
+ font-weight: 600;
122
+ }
123
+
124
+ .confirm-dialog__form input {
125
+ padding: 10px 12px;
126
+ border: 1px solid var(--ds-line);
127
+ border-radius: var(--ds-radius);
128
+ background: var(--ds-panel);
129
+ color: inherit;
130
+ font: inherit;
131
+ }
132
+
133
+ .confirm-dialog__form input[aria-invalid="true"] {
134
+ border-color: var(--ds-danger);
135
+ }
136
+
137
+ .confirm-dialog__error {
138
+ min-height: 1.25em;
139
+ color: var(--ds-danger);
140
+ font-size: 0.875rem;
141
+ }
142
+
143
+ .confirm-dialog__link {
144
+ justify-self: start;
145
+ padding: 4px 0;
146
+ border: 0;
147
+ background: none;
148
+ color: var(--ds-accent);
149
+ font: inherit;
150
+ cursor: pointer;
151
+ }
152
+
153
+ .confirm-dialog__actions {
154
+ display: flex;
155
+ flex-wrap: wrap;
156
+ gap: 8px;
157
+ justify-content: flex-end;
158
+ }
159
+
160
+ .confirm-dialog__button {
161
+ min-height: 44px;
162
+ padding: 10px 16px;
163
+ border: 1px solid var(--ds-line);
164
+ border-radius: var(--ds-radius);
165
+ background: var(--ds-panel);
166
+ color: inherit;
167
+ font: inherit;
168
+ font-weight: 600;
169
+ cursor: pointer;
170
+ }
171
+
172
+ .confirm-dialog__button--primary {
173
+ border-color: var(--ds-accent);
174
+ background: var(--ds-accent);
175
+ color: var(--ds-on-accent);
176
+ }
177
+
178
+ .confirm-dialog__button:disabled {
179
+ opacity: 0.5;
180
+ cursor: default;
181
+ }
182
+ </style>
@@ -0,0 +1,35 @@
1
+ /*
2
+ * The app's own design tokens, imported once by its entry (src/main.js). Its screens, the sign-in screen among them,
3
+ * read these names and never a colour of their own. src/theme/ is where an app keeps its colour values; the light
4
+ * values apply by default and the dark ones when the person's system asks for dark.
5
+ */
6
+ :root {
7
+ --ds-font: "Inter", system-ui, sans-serif;
8
+ --ds-radius: 8px;
9
+ --ds-radius-large: 16px;
10
+ --ds-page: #f4f1ea;
11
+ --ds-panel: #fffdf8;
12
+ --ds-text: #1f1b16;
13
+ --ds-text-muted: #5c544a;
14
+ --ds-line: #cbc2b5;
15
+ --ds-accent: #a4380f;
16
+ --ds-on-accent: #ffffff;
17
+ --ds-danger: #a1121f;
18
+ --ds-danger-soft: #fde7e7;
19
+ --ds-scrim: #1f1b1699;
20
+ }
21
+
22
+ @media (prefers-color-scheme: dark) {
23
+ :root {
24
+ --ds-page: #17140f;
25
+ --ds-panel: #221e18;
26
+ --ds-text: #eee7dc;
27
+ --ds-text-muted: #c1b8ab;
28
+ --ds-line: #554d42;
29
+ --ds-accent: #ffb59a;
30
+ --ds-on-accent: #5a1a00;
31
+ --ds-danger: #ffb4ab;
32
+ --ds-danger-soft: #3d1210;
33
+ --ds-scrim: #000000b3;
34
+ }
35
+ }