@jskit-ai/agent-docs 0.1.398 → 0.1.400
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.
- package/guide/agent/app-extras/assistant-conversation.md +4 -1
- package/guide/agent/app-setup/users.md +32 -0
- package/guide/agent/framework/client-features.md +124 -0
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/example/package.json +4 -4
- package/patterns/shell-foundation/example/package.json +5 -5
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/patterns/shell-foundation/example/src/pages/home/index.vue +2 -1
- package/reference/autogen/PATTERN_INDEX.md +47 -47
- package/reference/autogen/packages/assistant-voice.md +1 -1
- package/reference/autogen/packages/auth-provider-local-core.md +8 -1
- package/reference/autogen/packages/auth-provider-local-db-core.md +1 -0
- package/reference/autogen/packages/auth-web.md +4 -2
- package/reference/autogen/packages/http-runtime.md +2 -0
- package/reference/autogen/packages/http-web.md +3 -3
- package/reference/autogen/packages/kernel.md +1 -1
- package/reference/autogen/packages/mobile-capacitor.md +7 -4
- package/reference/autogen/packages/push-core.md +8 -0
- package/reference/autogen/packages/shell-web.md +1 -1
- package/reference/autogen/packages/store-purchases-core.md +8 -0
- package/reference/autogen/packages/uploads-image-web.md +1 -1
- package/reference/autogen/packages/users-core.md +4 -2
- package/reference/autogen/packages/users-web.md +7 -0
- package/reference/autogen/tooling/config-eslint.md +36 -0
- package/reference/autogen/tooling/jskit-catalog.md +12 -0
- package/skills/jskit/references/client-features.md +124 -0
- package/skills/jskit/references/pattern-index.md +47 -47
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/index.vue +2 -1
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
- package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
- package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/mobile/ios-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
- package/skills/jskit/references/patterns/shell/application-shell/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/index.vue +2 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
|
@@ -2812,7 +2812,10 @@ return their recorded result; conflicting arguments are rejected. A later user
|
|
|
2812
2812
|
or application turn owns separate call identities, even if the model reuses an
|
|
2813
2813
|
ID. An interrupted reservation without a
|
|
2814
2814
|
result or a server failure after execution stops the turn with an unknown-outcome
|
|
2815
|
-
error instead of executing again.
|
|
2815
|
+
error instead of executing again. A `query` action changes nothing by its
|
|
2816
|
+
declared kind, so its own failure, whatever its status, is a known outcome: its
|
|
2817
|
+
result says `changedNothing: true`, the call is complete, and the model is told
|
|
2818
|
+
of the failure and carries on. Applications
|
|
2816
2819
|
still make each action tolerate a repeated request in its own domain, and
|
|
2817
2820
|
inspect uncertain external effects.
|
|
2818
2821
|
The runtime cannot infer whether two different call IDs mean the same mutation.
|
|
@@ -63,3 +63,35 @@ records, pagination, and workspace isolation where relevant.
|
|
|
63
63
|
|
|
64
64
|
Do not copy users-core tables or services into the application. Do not add
|
|
65
65
|
field questionnaires, generated-file markers, migration copies, or receipts.
|
|
66
|
+
|
|
67
|
+
## Deleting an account
|
|
68
|
+
|
|
69
|
+
People delete their own account from the account settings, as the App Store requires of an app that lets them make
|
|
70
|
+
one (guideline 5.1.1(v)). Place `users-web`'s section, `users.web.account.delete`, at `account-settings:sections` with
|
|
71
|
+
`value: "delete-account"`; it is two taps from the account screen, and it says that a subscription bought in the App
|
|
72
|
+
Store or Google Play is the store's to cancel, linking the stores' subscription pages.
|
|
73
|
+
|
|
74
|
+
`DELETE /api/account` (`settings.security.account.delete`, the signed-in person only) deletes the account once they
|
|
75
|
+
prove it is them:
|
|
76
|
+
|
|
77
|
+
- an account with a second factor proves it within the last ten minutes (`auth.secondFactor.required` otherwise);
|
|
78
|
+
- the auth provider then asks for the password (`password` in the body), or, for an account without one (it signs in
|
|
79
|
+
with Google or Apple), a sign-in within the last ten minutes;
|
|
80
|
+
- an account linked to Sign in with Apple also brings a fresh Apple authorization code (`appleAuthorizationCode`;
|
|
81
|
+
inside the app the section gets it from the phone's Apple sheet), which the server exchanges and revokes at Apple
|
|
82
|
+
(`/auth/revoke`), as Apple requires.
|
|
83
|
+
|
|
84
|
+
Only after that proof, `users-core` publishes `account.deleting` (`{ userId, email }`) on `runtime.events`, so every
|
|
85
|
+
package and the application delete their own records of that user (`push-core` forgets the user's devices and
|
|
86
|
+
settings), and deletes the user's profile and settings; then the provider deletes the sign-in account with its
|
|
87
|
+
sessions, app tokens, identities and second factor, and the session's cookies are cleared. A refused proof deletes
|
|
88
|
+
nothing. A provider without `deleteAccount` answers 501 `users.account.deletionUnsupported`.
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
// An application's own records of a deleted account, in a feature that requires runtime.events.
|
|
92
|
+
events.register({
|
|
93
|
+
id: "app.account-deleting",
|
|
94
|
+
matches: (event) => event.type === "account.deleting",
|
|
95
|
+
handle: ({ userId }) => notes.deleteWhere({ authorId: userId }, { context: systemContext("delete a deleted account's notes") })
|
|
96
|
+
});
|
|
97
|
+
```
|
|
@@ -628,13 +628,80 @@ another site's address.
|
|
|
628
628
|
Why: a bundled app's page is not on the server's site, so a bare `"/api/..."`
|
|
629
629
|
reaches nothing there, and only one resolver knows where the server is.
|
|
630
630
|
|
|
631
|
+
`jskit/no-server-path-string` reports a server path written in the code (a
|
|
632
|
+
string or template starting with `/api`) that goes to the browser as it is:
|
|
633
|
+
given to `location.assign`, `location.replace` or `window.open`, assigned to
|
|
634
|
+
`location`, `href`, `src` or `action`, resolved with `new URL`, set with
|
|
635
|
+
`setAttribute` as an address, or joined to an address by hand
|
|
636
|
+
(`${origin}/api/...`). A path given to the HTTP client, to `serverUrl()`, or
|
|
637
|
+
kept in a constant is fine: http-web resolves it.
|
|
638
|
+
|
|
631
639
|
```js
|
|
632
640
|
// good
|
|
633
641
|
import { serverUrl } from "@jskit-ai/http-web/client";
|
|
634
642
|
const href = serverUrl(`/api/invoices/${id}/pdf`);
|
|
643
|
+
window.location.assign(serverUrl(`/api/exports/${id}`));
|
|
635
644
|
|
|
636
645
|
// bad: works on the web, reaches nothing inside the app
|
|
637
646
|
const href = `/api/invoices/${id}/pdf`;
|
|
647
|
+
window.location.assign(`/api/exports/${id}`);
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
### Network calls
|
|
651
|
+
|
|
652
|
+
**Client code reaches the server through http-web, never through the
|
|
653
|
+
browser's own network objects: `fetch`, `EventSource`, `WebSocket`,
|
|
654
|
+
`XMLHttpRequest` and `navigator.sendBeacon`.** Requests go through the HTTP
|
|
655
|
+
client (`getHttpWebClient().request`), streams through
|
|
656
|
+
`openEventStream` and `openWebSocket`.
|
|
657
|
+
|
|
658
|
+
Why: the browser's objects send the page's cookies on the web only. Inside a
|
|
659
|
+
Capacitor app the page is on another site: it sends no cookie and the
|
|
660
|
+
browser's objects carry no app token, so the call works in the browser and
|
|
661
|
+
fails on the phone. The HTTP client adds the app's token and refreshes it.
|
|
662
|
+
|
|
663
|
+
`jskit/no-raw-network` reports those globals wherever client code reaches
|
|
664
|
+
them, also read from `globalThis`, `window` or `self`, and also as a default
|
|
665
|
+
value (`fetchImpl = globalThis.fetch`). JSKIT's own helpers, which wrap them,
|
|
666
|
+
carry an exception with the reason. Code that must read a response itself
|
|
667
|
+
(its status, its headers) takes `appFetch` from
|
|
668
|
+
`@jskit-ai/http-runtime/client`: `fetch` on the web, and inside an app the
|
|
669
|
+
same request with the app's headers and token, no cookie, and one retry after
|
|
670
|
+
refreshing the tokens on a 401.
|
|
671
|
+
|
|
672
|
+
```js
|
|
673
|
+
// good
|
|
674
|
+
import { getHttpWebClient, openEventStream } from "@jskit-ai/http-web/client";
|
|
675
|
+
const invoice = await getHttpWebClient().request(`/api/invoices/${id}`);
|
|
676
|
+
const progress = openEventStream(`/api/imports/${id}/events`);
|
|
677
|
+
|
|
678
|
+
// bad: signed in on the web, signed out inside the app
|
|
679
|
+
const invoice = await (await fetch(`/api/invoices/${id}`)).json();
|
|
680
|
+
const progress = new EventSource(`/api/imports/${id}/events`);
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
### Server addresses in templates
|
|
684
|
+
|
|
685
|
+
**A template's `src`, `href`, `action`, `poster`, `data`, `formaction` or
|
|
686
|
+
`srcset` that names a server path goes through `serverUrl()`, or `signedUrl()`
|
|
687
|
+
/ `frameUrl()` when the server checks who asks.**
|
|
688
|
+
|
|
689
|
+
Why: the browser loads those addresses by itself, against the page's site,
|
|
690
|
+
which inside an app is the app.
|
|
691
|
+
|
|
692
|
+
`jskit/server-path-binding` reports such an attribute written with a server
|
|
693
|
+
path (`src="/api/..."`), or bound to an expression holding a server path that
|
|
694
|
+
none of the three helpers wraps. An address the script already resolved
|
|
695
|
+
(`:src="photoAddress"`) is the script's to get right.
|
|
696
|
+
|
|
697
|
+
```vue
|
|
698
|
+
<!-- good -->
|
|
699
|
+
<img :src="serverUrl(`/api/photos/${photo.id}`)" />
|
|
700
|
+
<iframe :src="reportFrame" /> <!-- reportFrame = await frameUrl("/api/reports/embed") -->
|
|
701
|
+
|
|
702
|
+
<!-- bad: loads from the app inside the app -->
|
|
703
|
+
<img :src="`/api/photos/${photo.id}`" />
|
|
704
|
+
<a href="/api/report">Report</a>
|
|
638
705
|
```
|
|
639
706
|
|
|
640
707
|
### Streams, sockets and signed links
|
|
@@ -658,6 +725,10 @@ no `Authorization` header, and inside a Capacitor app no cookie either.
|
|
|
658
725
|
stream goes without a ticket, as a public one does. Tickets live in the
|
|
659
726
|
server's process, so a deployment of several servers routes a stream to the
|
|
660
727
|
server that issued its ticket (sticky routing).
|
|
728
|
+
- `openWebSocket(path, { reconnect: false })` is one socket for a protocol that
|
|
729
|
+
recovers itself (assistant voice, with its own handshake): it signs in with a
|
|
730
|
+
ticket the same way, its `close` listeners hear it drop, nothing opens it
|
|
731
|
+
again, and `close(code, reason)` ends it.
|
|
661
732
|
- `signedUrl(path, { ttl })` asks `POST /api/session/link` for a link to that
|
|
662
733
|
server path, signed (HMAC) for this session and user: 5 minutes, at most an
|
|
663
734
|
hour (`ttl` in seconds). It opens that path alone, by GET, and only while the
|
|
@@ -681,6 +752,54 @@ const src = await signedUrl(`/api/photos/${id}`);
|
|
|
681
752
|
const source = new EventSource(`/api/imports/${id}/events`);
|
|
682
753
|
```
|
|
683
754
|
|
|
755
|
+
### Service workers
|
|
756
|
+
|
|
757
|
+
**An application registers no service worker of its own: push-web registers
|
|
758
|
+
the page's one worker, which shows web push notifications.** What a worker
|
|
759
|
+
must do goes into push-web's worker.
|
|
760
|
+
|
|
761
|
+
Why: a page has one worker per scope, so a second registration replaces
|
|
762
|
+
push-web's and notifications stop; inside a Capacitor app no worker runs at
|
|
763
|
+
all.
|
|
764
|
+
|
|
765
|
+
`jskit/no-service-worker` reports `serviceWorker.register(...)` anywhere but in
|
|
766
|
+
`@jskit-ai/push-web`.
|
|
767
|
+
|
|
768
|
+
```js
|
|
769
|
+
// good: push-web registers its worker when the person turns notifications on,
|
|
770
|
+
// from its settings section or usePushClient()
|
|
771
|
+
import { usePushClient } from "@jskit-ai/push-web/client";
|
|
772
|
+
|
|
773
|
+
// bad: replaces the worker that shows notifications
|
|
774
|
+
navigator.serviceWorker.register("/offline-worker.js");
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
### Device plugins
|
|
778
|
+
|
|
779
|
+
**An application reaches the phone through JSKIT's interfaces, registered as
|
|
780
|
+
client services (`mobile.secureStore`, `uploads.nativeSource`, `push.device`,
|
|
781
|
+
`storePurchases.device`, `mobile.sharedStore` and the rest), never by
|
|
782
|
+
importing a Capacitor plugin.** Each interface loads its plugin lazily, maps
|
|
783
|
+
its answers to JSKIT's shapes and errors, and answers "unavailable" on the
|
|
784
|
+
web.
|
|
785
|
+
|
|
786
|
+
Why: an imported plugin breaks the page on the web, answers differently from
|
|
787
|
+
one plugin version to the next, and stays linked into the app when the
|
|
788
|
+
feature that used it goes.
|
|
789
|
+
|
|
790
|
+
`jskit/no-native-plugin-import` reports an import of `@capacitor/*`,
|
|
791
|
+
`@capgo/*`, `@capawesome/*`, `@capacitor-mlkit/*` or `capacitor-widget-bridge`
|
|
792
|
+
(static, dynamic or re-exported) outside JSKIT's own packages. A plugin no
|
|
793
|
+
JSKIT interface wraps is imported with an exception naming what it is for.
|
|
794
|
+
|
|
795
|
+
```js
|
|
796
|
+
// good: an upload field offers the camera through the uploads.nativeSource service
|
|
797
|
+
const [photo] = await nativeSource.pick("camera");
|
|
798
|
+
|
|
799
|
+
// bad
|
|
800
|
+
import { Camera } from "@capacitor/camera";
|
|
801
|
+
```
|
|
802
|
+
|
|
684
803
|
### One helper per package
|
|
685
804
|
|
|
686
805
|
**A pure helper exists once in a package and is imported; one the kernel owns
|
|
@@ -749,6 +868,11 @@ client-only rules below. The server's action and error rules do not apply.
|
|
|
749
868
|
| `jskit/selection-field` | a `v-select`, `v-autocomplete` or `v-combobox` whose items are not fixed, and a `SelectField` whose items are not fixed that binds no `loading` | [Selection fields](#selection-fields) |
|
|
750
869
|
| `jskit/search-on-server` | a `computed()` that filters a list composable's items by a search ref; an autocomplete over a list's items or a lookup's options without `no-filter` or an `update:search` handler | [Search on the server](#search-on-the-server) |
|
|
751
870
|
| `jskit/request-recovery-label` | `requestRecoveryLabel` given to a screen read (`useList`, `useView`, `useAddEdit`, the CRUD composables) without `requestRecovery: true` | [Screen read failures](#screen-read-failures) |
|
|
871
|
+
| `jskit/no-raw-network` | `fetch`, `EventSource`, `WebSocket`, `XMLHttpRequest` or `navigator.sendBeacon` reached from client code | [Network calls](#network-calls) |
|
|
872
|
+
| `jskit/no-server-path-string` | a server path (`/api...`) given to the browser as it is: navigated to, assigned as an address, resolved with `new URL`, or joined to an address by hand | [Server paths](#server-paths) |
|
|
873
|
+
| `jskit/server-path-binding` | a template `src`, `href`, `action`, `poster`, `data`, `formaction` or `srcset` naming a server path outside `serverUrl()`, `signedUrl()` or `frameUrl()` | [Server addresses in templates](#server-addresses-in-templates) |
|
|
874
|
+
| `jskit/no-service-worker` | `serviceWorker.register(...)` outside `@jskit-ai/push-web` | [Service workers](#service-workers) |
|
|
875
|
+
| `jskit/no-native-plugin-import` | an import of a device plugin (`@capacitor/*`, `@capgo/*`, `@capawesome/*`, `@capacitor-mlkit/*`, `capacitor-widget-bridge`) outside JSKIT's packages | [Device plugins](#device-plugins) |
|
|
752
876
|
| `vue/require-prop-types`, `vue/require-default-prop`, `vue/require-valid-default-prop`, `vue/no-required-prop-with-default` | a prop without a type, optional without a default, or both | [Collaborator props](#collaborator-props) |
|
|
753
877
|
| `vue/require-explicit-emits` | an emitted event the component does not declare | [Declared emits](#declared-emits) |
|
|
754
878
|
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@local/main": "0.1.0",
|
|
36
36
|
"@fastify/static": "^10.1.3",
|
|
37
|
-
"@jskit-ai/kernel": "0.2.
|
|
37
|
+
"@jskit-ai/kernel": "0.2.42",
|
|
38
38
|
"@jskit-ai/material-web": "0.1.20",
|
|
39
39
|
"@tanstack/vue-query": "^5.101.0",
|
|
40
40
|
"fastify": "^5.12.7",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"vue": "^3.5.44",
|
|
45
45
|
"vue-router": "^5.3.1",
|
|
46
46
|
"vuetify": "^4.3.0",
|
|
47
|
-
"@jskit-ai/http-runtime": "0.2.
|
|
47
|
+
"@jskit-ai/http-runtime": "0.2.44",
|
|
48
48
|
"@fastify/fast-json-stringify-compiler": "^5.1.0",
|
|
49
49
|
"@vue/devtools-api": "^8.2.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@jskit-ai/config-eslint": "0.1.
|
|
53
|
-
"@jskit-ai/jskit-catalog": "0.2.
|
|
52
|
+
"@jskit-ai/config-eslint": "0.1.259",
|
|
53
|
+
"@jskit-ai/jskit-catalog": "0.2.152",
|
|
54
54
|
"@playwright/test": "1.61.1",
|
|
55
55
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
56
56
|
"eslint": "^10.8.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@local/main": "0.1.0",
|
|
36
36
|
"@fastify/static": "^10.1.3",
|
|
37
|
-
"@jskit-ai/kernel": "0.2.
|
|
37
|
+
"@jskit-ai/kernel": "0.2.42",
|
|
38
38
|
"@jskit-ai/material-web": "0.1.20",
|
|
39
39
|
"@tanstack/vue-query": "^5.101.0",
|
|
40
40
|
"fastify": "^5.12.7",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"vue": "^3.5.44",
|
|
45
45
|
"vue-router": "^5.3.1",
|
|
46
46
|
"vuetify": "^4.3.0",
|
|
47
|
-
"@jskit-ai/http-runtime": "0.2.
|
|
48
|
-
"@jskit-ai/shell-web": "0.2.
|
|
47
|
+
"@jskit-ai/http-runtime": "0.2.44",
|
|
48
|
+
"@jskit-ai/shell-web": "0.2.74",
|
|
49
49
|
"@fastify/fast-json-stringify-compiler": "^5.1.0",
|
|
50
50
|
"@vue/devtools-api": "^8.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@jskit-ai/config-eslint": "0.1.
|
|
54
|
-
"@jskit-ai/jskit-catalog": "0.2.
|
|
53
|
+
"@jskit-ai/config-eslint": "0.1.259",
|
|
54
|
+
"@jskit-ai/jskit-catalog": "0.2.152",
|
|
55
55
|
"@playwright/test": "1.61.1",
|
|
56
56
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
57
57
|
"eslint": "^10.8.0",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { useQuery } from "@tanstack/vue-query";
|
|
4
|
+
import { appFetch } from "@jskit-ai/http-runtime/client";
|
|
4
5
|
import { usePaths } from "@jskit-ai/shell-web/client/navigation/usePaths";
|
|
5
6
|
|
|
6
7
|
const paths = usePaths();
|
|
7
8
|
const healthQuery = useQuery({
|
|
8
9
|
queryKey: ["shell-web", "health"],
|
|
9
10
|
queryFn: async () => {
|
|
10
|
-
const response = await
|
|
11
|
+
const response = await appFetch("/api/health");
|
|
11
12
|
if (!response.ok) {
|
|
12
13
|
throw new Error("Health request failed.");
|
|
13
14
|
}
|