@jskit-ai/agent-docs 0.1.331 → 0.1.333
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/realtime.md +11 -3
- package/guide/agent/app-setup/authentication.md +135 -32
- package/guide/agent/app-setup/initial-scaffolding.md +10 -9
- package/guide/agent/app-setup/more-than-one-server.md +111 -0
- package/guide/agent/app-setup/multi-homing.md +2 -2
- package/guide/agent/app-setup/package-with-nix.md +60 -15
- package/guide/agent/app-setup/upgrading-jskit.md +36 -1
- package/guide/agent/framework/crud-form-actions.md +18 -7
- package/guide/agent/framework/environments.md +174 -0
- package/guide/agent/framework/material-3.md +9 -3
- package/guide/agent/framework/quality-pass.md +8 -2
- package/guide/agent/framework/sanity-checks.md +3 -3
- package/guide/agent/framework/security-pass.md +7 -5
- package/guide/agent/index.md +6 -2
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/example/.env.example +8 -0
- package/patterns/minimal-foundation/example/AGENTS.md +7 -5
- package/patterns/minimal-foundation/example/bin/develop.js +2 -0
- package/patterns/minimal-foundation/example/package.json +7 -7
- package/patterns/shell-foundation/example/.env.example +8 -0
- package/patterns/shell-foundation/example/AGENTS.md +7 -5
- package/patterns/shell-foundation/example/bin/develop.js +2 -0
- package/patterns/shell-foundation/example/package.json +8 -8
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/reference/autogen/KERNEL_MAP.md +10 -11
- package/reference/autogen/PATTERN_INDEX.md +38 -38
- package/reference/autogen/packages/auth-core.md +15 -2
- package/reference/autogen/packages/auth-provider-local-core.md +48 -13
- package/reference/autogen/packages/auth-provider-local-db-core.md +15 -0
- package/reference/autogen/packages/auth-provider-oidc-core.md +1 -1
- package/reference/autogen/packages/auth-provider-supabase-core.md +2 -2
- package/reference/autogen/packages/auth-web.md +26 -0
- package/reference/autogen/packages/connectors-core.md +2 -2
- package/reference/autogen/packages/http-web.md +2 -0
- package/reference/autogen/packages/kernel.md +32 -27
- package/reference/autogen/packages/oidc-issuer-core.md +4 -4
- package/reference/autogen/packages/payments-core.md +1 -1
- package/reference/autogen/packages/shell-web.md +40 -13
- package/reference/autogen/packages/storage-runtime.md +6 -0
- package/reference/autogen/packages/workspaces-core.md +4 -4
- package/reference/autogen/tooling/jskit-catalog.md +6 -1
- package/skills/jskit/SKILL.md +2 -1
- package/skills/jskit/references/crud-form-actions.md +18 -7
- package/skills/jskit/references/environments.md +169 -0
- package/skills/jskit/references/heuristics/INDEX.md +1 -1
- package/skills/jskit/references/heuristics/client-requests.md +1 -1
- package/skills/jskit/references/heuristics/crud-authoring.md +3 -2
- package/skills/jskit/references/heuristics/live-actions.md +4 -1
- package/skills/jskit/references/heuristics/ui-contract.md +9 -1
- package/skills/jskit/references/material-3.md +9 -3
- package/skills/jskit/references/multi-homing.md +2 -2
- package/skills/jskit/references/package-with-nix.md +60 -15
- package/skills/jskit/references/pattern-index.md +38 -38
- package/skills/jskit/references/patterns/app/minimal-foundation/example/.env.example +8 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +7 -5
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/develop.js +2 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +7 -7
- package/skills/jskit/references/patterns/app/shell-foundation/example/.env.example +8 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +7 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/develop.js +2 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +8 -8
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
- package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +10 -8
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/email-change.vue +17 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/views/auth/EmailChangeView.vue +12 -0
- 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/api-key-connection/PATTERN.md +4 -1
- package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js +3 -3
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/.env.example +1 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -4
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/scripts/calendar.js +3 -1
- package/skills/jskit/references/patterns/connectors/firebase-messaging/example/server/notifications.js +3 -3
- package/skills/jskit/references/patterns/connectors/oauth-connection/PATTERN.md +3 -1
- 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/realtime/realtime-application/example/.env.example +1 -0
- 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/users/account-settings/example/src/components/account/settings/AccountSettingsNotificationsSection.vue +3 -1
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsPreferencesSection.vue +3 -1
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsProfileSection.vue +4 -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
- package/skills/jskit/references/quality-pass.md +8 -2
- package/skills/jskit/references/sanity-checks.md +3 -3
- package/skills/jskit/references/security-pass.md +7 -5
- package/guide/agent/framework/side-effects.md +0 -77
- package/skills/jskit/references/side-effects.md +0 -72
|
@@ -27,6 +27,8 @@ function waitForChild(child) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
// The development launcher runs the app in development, whatever .env or the shell says (the Environments guide).
|
|
31
|
+
process.env.APP_ENV = "development";
|
|
30
32
|
const previewHost = String(process.env.HOST || "").trim() || "0.0.0.0";
|
|
31
33
|
const previewPort = requiredPort(process.env.PORT || String(DEFAULT_PORT));
|
|
32
34
|
let apiServer = null;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"server:home": "SERVER_SURFACE=home node ./bin/server.js",
|
|
17
17
|
"start": "node ./bin/server.js",
|
|
18
18
|
"develop": "node ./bin/develop.js",
|
|
19
|
-
"dev": "vite",
|
|
20
|
-
"dev:all": "vite",
|
|
21
|
-
"dev:home": "VITE_SURFACE=home vite",
|
|
19
|
+
"dev": "APP_ENV=development vite",
|
|
20
|
+
"dev:all": "APP_ENV=development vite",
|
|
21
|
+
"dev:home": "APP_ENV=development VITE_SURFACE=home vite",
|
|
22
22
|
"build": "vite build",
|
|
23
23
|
"build:all": "vite build",
|
|
24
24
|
"build:home": "VITE_SURFACE=home vite build",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@local/main": "0.1.0",
|
|
36
36
|
"@fastify/static": "^10.1.3",
|
|
37
|
-
"@jskit-ai/kernel": "0.2.
|
|
38
|
-
"@jskit-ai/material-web": "0.1.
|
|
37
|
+
"@jskit-ai/kernel": "0.2.27",
|
|
38
|
+
"@jskit-ai/material-web": "0.1.9",
|
|
39
39
|
"@tanstack/vue-query": "^5.101.0",
|
|
40
40
|
"fastify": "^5.12.7",
|
|
41
41
|
"pino": "^10.3.1",
|
|
@@ -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.27",
|
|
48
|
+
"@jskit-ai/shell-web": "0.2.39",
|
|
49
49
|
"@fastify/fast-json-stringify-compiler": "^5.1.0",
|
|
50
50
|
"@vue/devtools-api": "^8.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@jskit-ai/config-eslint": "0.1.252",
|
|
54
|
-
"@jskit-ai/jskit-catalog": "0.2.
|
|
54
|
+
"@jskit-ai/jskit-catalog": "0.2.85",
|
|
55
55
|
"@playwright/test": "1.61.1",
|
|
56
56
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
57
57
|
"eslint": "^10.8.0",
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"private": true,
|
|
3
3
|
"type": "module",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
6
|
-
"@jskit-ai/database-runtime-mysql": "0.1.
|
|
7
|
-
"@jskit-ai/oidc-issuer-core": "0.1.
|
|
5
|
+
"@jskit-ai/database-runtime": "0.1.276",
|
|
6
|
+
"@jskit-ai/database-runtime-mysql": "0.1.274",
|
|
7
|
+
"@jskit-ai/oidc-issuer-core": "0.1.43"
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -27,8 +27,8 @@ Those choices must be known before adapting the example.
|
|
|
27
27
|
## Framework APIs
|
|
28
28
|
|
|
29
29
|
Use the views, auth guard, HTTP client integration, sign-out runtime, providers,
|
|
30
|
-
and Playwright auth helper exported by `@jskit-ai/auth-web`. The sign-in, reset
|
|
31
|
-
and sign-out screens show the app's identity: the pages render the app's view
|
|
30
|
+
and Playwright auth helper exported by `@jskit-ai/auth-web`. The sign-in, reset,
|
|
31
|
+
email change and sign-out screens show the app's identity: the pages render the app's view
|
|
32
32
|
wrappers (`src/views/auth/`), and each wrapper fills the default view's `brand`
|
|
33
33
|
slot (given `{ compact }`) with `src/components/AppBrand.vue`, the app's name
|
|
34
34
|
as `index.html`'s `<title>` spells it. JSKIT lays the slot out as a pane beside
|
|
@@ -107,9 +107,10 @@ a user as a side effect.
|
|
|
107
107
|
exercised.
|
|
108
108
|
- Public auth routes do not require an existing session.
|
|
109
109
|
- Protected routes use the framework auth policy rather than page-local checks.
|
|
110
|
-
- Login, sign-out, and
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
- Login, sign-out, reset and email change views use the public auth
|
|
111
|
+
components/composables.
|
|
112
|
+
- The sign-in, reset, email change and sign-out pages render the app's view
|
|
113
|
+
wrappers, which fill the `brand` slot with the app's identity (`AppBrand.vue`): a person
|
|
113
114
|
always sees which app they are signing in to. Renaming the app renames
|
|
114
115
|
`AppBrand.vue` with `index.html`'s `<title>`; the brand adds no heading.
|
|
115
116
|
- A custom login view must preserve the default view's initial session check:
|
|
@@ -152,9 +153,10 @@ placements, and post-auth destinations while retaining the runtime contracts.
|
|
|
152
153
|
|
|
153
154
|
## Verification
|
|
154
155
|
|
|
155
|
-
Check that the sign-in, reset and sign-out screens show the
|
|
156
|
-
pane on a wide window and in the row on a phone. Exercise
|
|
157
|
-
login, sign-out, reset,
|
|
156
|
+
Check that the sign-in, reset, email change and sign-out screens show the
|
|
157
|
+
app's name, in the pane on a wide window and in the row on a phone. Exercise
|
|
158
|
+
failed and successful login, sign-out, reset, an email change link, protected
|
|
159
|
+
navigation,
|
|
158
160
|
keyboard interaction, warm-cache return navigation, and browser refresh.
|
|
159
161
|
Open the login route with an existing authenticated session and confirm it
|
|
160
162
|
returns to the requested screen; repeat signed out and confirm the form remains.
|
package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/email-change.vue
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<route lang="json">
|
|
2
|
+
{
|
|
3
|
+
"meta": {
|
|
4
|
+
"guard": {
|
|
5
|
+
"policy": "public"
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
</route>
|
|
10
|
+
|
|
11
|
+
<script setup>
|
|
12
|
+
import EmailChangeView from "@/views/auth/EmailChangeView.vue";
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<EmailChangeView />
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import DefaultEmailChangeView from "@jskit-ai/auth-web/client/views/DefaultEmailChangeView";
|
|
3
|
+
import AppBrand from "@/components/AppBrand.vue";
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<DefaultEmailChangeView>
|
|
8
|
+
<template #brand="{ compact }">
|
|
9
|
+
<AppBrand :compact="compact" />
|
|
10
|
+
</template>
|
|
11
|
+
</DefaultEmailChangeView>
|
|
12
|
+
</template>
|
|
@@ -161,6 +161,7 @@ A server module or manually written CLI composes the same library calls:
|
|
|
161
161
|
import { readFile } from "node:fs/promises";
|
|
162
162
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
163
163
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
164
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
164
165
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
165
166
|
import { resendProvider } from "@jskit-ai/connectors-catalog/server/resend";
|
|
166
167
|
import { firecrawlProvider } from "@jskit-ai/connectors-catalog/server/firecrawl";
|
|
@@ -175,7 +176,9 @@ const store = createFileConnectionStore({ directory: process.env.CONNECTOR_STATE
|
|
|
175
176
|
const connections = createConnectionService({
|
|
176
177
|
configuration, providers, store,
|
|
177
178
|
resolveReference: createEnvironmentReferenceResolver(process.env),
|
|
178
|
-
authorize: applicationConnectionPolicy
|
|
179
|
+
authorize: applicationConnectionPolicy,
|
|
180
|
+
// Only production (APP_ENV) sends side-effect operations, such as an email; elsewhere they are logged.
|
|
181
|
+
appEnv: appEnvironment(process.env)
|
|
179
182
|
});
|
|
180
183
|
|
|
181
184
|
// context comes from the existing application's authentication or local operator policy.
|
package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
3
3
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
4
|
-
import {
|
|
4
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
5
5
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
6
6
|
import { resendProvider } from "@jskit-ai/connectors-catalog/server/resend";
|
|
7
7
|
import { firecrawlProvider } from "@jskit-ai/connectors-catalog/server/firecrawl";
|
|
@@ -18,7 +18,7 @@ export async function applicationConnections({ authorize, env = process.env, con
|
|
|
18
18
|
keys: { current: Buffer.from(env.CONNECTOR_STORAGE_KEY, "base64") }, activeKeyId: "current"
|
|
19
19
|
});
|
|
20
20
|
const store = createFileConnectionStore({ directory: env.CONNECTOR_STATE_DIRECTORY, protection });
|
|
21
|
-
// Sending email is a side effect:
|
|
21
|
+
// Sending email is a side effect: only production (APP_ENV) sends it; elsewhere it is logged and answers { simulated: true }.
|
|
22
22
|
return createConnectionService({ configuration, providers, store, authorize, resolveReference: createEnvironmentReferenceResolver(env),
|
|
23
|
-
|
|
23
|
+
appEnv: appEnvironment(env) });
|
|
24
24
|
}
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
"db:migrate:status": "knex --knexfile ./knexfile.js migrate:list"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@jskit-ai/connectors-core": "0.2.
|
|
11
|
-
"@jskit-ai/connector-google-calendar": "0.2.
|
|
12
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
13
|
-
"@jskit-ai/database-runtime-mysql": "0.1.
|
|
10
|
+
"@jskit-ai/connectors-core": "0.2.40",
|
|
11
|
+
"@jskit-ai/connector-google-calendar": "0.2.40",
|
|
12
|
+
"@jskit-ai/database-runtime": "0.1.276",
|
|
13
|
+
"@jskit-ai/database-runtime-mysql": "0.1.274",
|
|
14
|
+
"@jskit-ai/kernel": "0.2.27",
|
|
14
15
|
"knex": "^3.1.0"
|
|
15
16
|
}
|
|
16
17
|
}
|
package/skills/jskit/references/patterns/connectors/calendar-cli/example/scripts/calendar.js
CHANGED
|
@@ -6,6 +6,7 @@ import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/
|
|
|
6
6
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
7
7
|
import { createCredentialProtection, createKnexConnectionStore } from "@jskit-ai/connectors-core/server/storage";
|
|
8
8
|
import { googleCalendarProvider } from "@jskit-ai/connector-google-calendar/server";
|
|
9
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* A local operator command owns this HTTP listener; web apps use authenticated routes.
|
|
@@ -86,7 +87,8 @@ async function main() {
|
|
|
86
87
|
configuration, providers: [googleCalendarProvider],
|
|
87
88
|
store: createKnexConnectionStore({ knex, protection }),
|
|
88
89
|
resolveReference: createEnvironmentReferenceResolver(process.env),
|
|
89
|
-
authorize: async () => context
|
|
90
|
+
authorize: async () => context,
|
|
91
|
+
appEnv: appEnvironment(process.env)
|
|
90
92
|
});
|
|
91
93
|
const request = { context, integrationId: "calendar" };
|
|
92
94
|
let result;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
3
3
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
4
|
-
import {
|
|
4
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
5
5
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
6
6
|
import { firebaseCloudMessagingProvider } from "@jskit-ai/connectors-catalog/server/firebase-cloud-messaging";
|
|
7
7
|
|
|
@@ -28,7 +28,7 @@ export async function openNotificationConnections({
|
|
|
28
28
|
return createConnectionService({ configuration, providers, store,
|
|
29
29
|
resolveReference: createEnvironmentReferenceResolver(environment),
|
|
30
30
|
authorize: authorizeConnectionOperation,
|
|
31
|
-
// A push notification is a side effect:
|
|
32
|
-
|
|
31
|
+
// A push notification is a side effect: only production (APP_ENV) sends it; elsewhere it is logged.
|
|
32
|
+
appEnv: appEnvironment(environment)
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -58,6 +58,7 @@ package APIs in an application module:
|
|
|
58
58
|
import { readFile } from "node:fs/promises";
|
|
59
59
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
60
60
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
61
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
61
62
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
62
63
|
import { wordpressComProvider } from "@jskit-ai/connectors-catalog/server/wordpress-com";
|
|
63
64
|
|
|
@@ -69,7 +70,8 @@ const protection = createCredentialProtection({
|
|
|
69
70
|
const connections = createConnectionService({
|
|
70
71
|
configuration, providers,
|
|
71
72
|
store: createFileConnectionStore({ directory: process.env.CONNECTOR_STATE_DIRECTORY, protection }),
|
|
72
|
-
resolveReference: createEnvironmentReferenceResolver(process.env), authorize: applicationConnectionPolicy
|
|
73
|
+
resolveReference: createEnvironmentReferenceResolver(process.env), authorize: applicationConnectionPolicy,
|
|
74
|
+
appEnv: appEnvironment(process.env)
|
|
73
75
|
});
|
|
74
76
|
```
|
|
75
77
|
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"./shared": "./src/shared/index.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@jskit-ai/crud-core": "0.2.
|
|
13
|
-
"@jskit-ai/resource-core": "0.1.
|
|
14
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
12
|
+
"@jskit-ai/crud-core": "0.2.41",
|
|
13
|
+
"@jskit-ai/resource-core": "0.1.218",
|
|
14
|
+
"@jskit-ai/resource-crud-core": "0.1.220"
|
|
15
15
|
},
|
|
16
16
|
"jskit": {
|
|
17
17
|
"kind": "runtime",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "jskit test --databases"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
13
|
-
"@jskit-ai/database-runtime-postgres": "0.1.
|
|
12
|
+
"@jskit-ai/database-runtime": "0.1.276",
|
|
13
|
+
"@jskit-ai/database-runtime-postgres": "0.1.273"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { vPending } from "@jskit-ai/shell-web/client/directives/vPending";
|
|
3
|
+
|
|
2
4
|
const props = defineProps({
|
|
3
5
|
runtime: {
|
|
4
6
|
type: Object,
|
|
@@ -41,7 +43,7 @@ const notifications = props.runtime.notifications;
|
|
|
41
43
|
color="primary"
|
|
42
44
|
class="mt-4"
|
|
43
45
|
:loading="notifications.isSaving.value"
|
|
44
|
-
|
|
46
|
+
v-pending="notifications.isSaving.value || notifications.isRefreshing.value"
|
|
45
47
|
>
|
|
46
48
|
Save notification settings
|
|
47
49
|
</v-btn>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { vPending } from "@jskit-ai/shell-web/client/directives/vPending";
|
|
3
|
+
|
|
2
4
|
const props = defineProps({
|
|
3
5
|
runtime: {
|
|
4
6
|
type: Object,
|
|
@@ -119,7 +121,7 @@ const preferences = props.runtime.preferences;
|
|
|
119
121
|
color="primary"
|
|
120
122
|
class="mt-4"
|
|
121
123
|
:loading="preferences.isSaving.value"
|
|
122
|
-
|
|
124
|
+
v-pending="preferences.isSaving.value || preferences.isRefreshing.value"
|
|
123
125
|
>
|
|
124
126
|
Save preferences
|
|
125
127
|
</v-btn>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { vPending } from "@jskit-ai/shell-web/client/directives/vPending";
|
|
3
|
+
|
|
2
4
|
const props = defineProps({
|
|
3
5
|
runtime: {
|
|
4
6
|
type: Object,
|
|
@@ -81,7 +83,8 @@ const profile = props.runtime.profile;
|
|
|
81
83
|
color="primary"
|
|
82
84
|
class="mt-4"
|
|
83
85
|
:loading="profile.isSaving.value"
|
|
84
|
-
|
|
86
|
+
v-pending="profile.isSaving.value || profile.isRefreshing.value"
|
|
87
|
+
:disabled="profile.isDeletingAvatar.value"
|
|
85
88
|
>
|
|
86
89
|
Save profile
|
|
87
90
|
</v-btn>
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"./shared": "./src/shared/index.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@jskit-ai/crud-core": "0.2.
|
|
14
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
15
|
-
"@jskit-ai/users-core": "0.2.
|
|
13
|
+
"@jskit-ai/crud-core": "0.2.41",
|
|
14
|
+
"@jskit-ai/resource-crud-core": "0.1.220",
|
|
15
|
+
"@jskit-ai/users-core": "0.2.50"
|
|
16
16
|
},
|
|
17
17
|
"jskit": {
|
|
18
18
|
"kind": "runtime",
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"./shared": "./src/shared/index.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@jskit-ai/crud-core": "0.2.
|
|
14
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
15
|
-
"@jskit-ai/users-core": "0.2.
|
|
16
|
-
"@jskit-ai/workspaces-core": "0.2.
|
|
13
|
+
"@jskit-ai/crud-core": "0.2.41",
|
|
14
|
+
"@jskit-ai/resource-crud-core": "0.1.220",
|
|
15
|
+
"@jskit-ai/users-core": "0.2.50",
|
|
16
|
+
"@jskit-ai/workspaces-core": "0.2.50"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@jskit-ai/kernel": "0.2.
|
|
20
|
-
"@jskit-ai/resource-runtime": "0.2.
|
|
19
|
+
"@jskit-ai/kernel": "0.2.27",
|
|
20
|
+
"@jskit-ai/resource-runtime": "0.2.37"
|
|
21
21
|
},
|
|
22
22
|
"jskit": {
|
|
23
23
|
"kind": "runtime",
|
|
@@ -12,8 +12,8 @@ in a JSKIT app. The rules it applies are already in [Material 3](material-3.md),
|
|
|
12
12
|
## States on every screen
|
|
13
13
|
|
|
14
14
|
- **Loading:** Material skeletons with the geometry of the content they stand
|
|
15
|
-
for, never a spinner; an action keeps a stable label
|
|
16
|
-
cannot be sent twice ([Components, state, and feedback](material-3.md#components-state-and-feedback)).
|
|
15
|
+
for, never a spinner; an action keeps a stable label and its keyboard focus
|
|
16
|
+
while it runs, and cannot be sent twice ([Components, state, and feedback](material-3.md#components-state-and-feedback)).
|
|
17
17
|
Ordinary reads stop after 30 seconds, so a slow read ends in its error state.
|
|
18
18
|
- **Empty:** a list's empty state carries an icon, a line saying what would be
|
|
19
19
|
there and one action, such as New; with filters or a search applied it
|
|
@@ -55,6 +55,12 @@ in a JSKIT app. The rules it applies are already in [Material 3](material-3.md),
|
|
|
55
55
|
width.
|
|
56
56
|
- **Double submit:** click Save twice quickly; the command's pending state
|
|
57
57
|
must send one request.
|
|
58
|
+
- **Keyboard through a running command:** Tab to Save (or Send, "Load more",
|
|
59
|
+
a dialog's confirm), press Enter and answer the request late
|
|
60
|
+
(`page.route`). Focus should stay on the button while it runs, and move to
|
|
61
|
+
the field a refusal marks. Focus on the page body there usually means the
|
|
62
|
+
button was `disabled` while it ran; mark it pending instead when possible
|
|
63
|
+
([Material 3 rules](material-3.md#components-state-and-feedback)).
|
|
58
64
|
- **Session and tabs:** sign out in another tab and come back; let the session
|
|
59
65
|
expire mid-form. The auth guard sends the person to sign-in and back.
|
|
60
66
|
- **Time:** dates follow [strict temporal values](crud-operations.md#strict-temporal-values);
|
|
@@ -167,9 +167,9 @@ A consolidation drops behaviour there without a failing build.
|
|
|
167
167
|
|
|
168
168
|
### Production settings
|
|
169
169
|
|
|
170
|
-
- `
|
|
171
|
-
|
|
172
|
-
development
|
|
170
|
+
- A deployed server sets `APP_ENV=staging` or `production` and
|
|
171
|
+
`NODE_ENV=production` ([Environments](environments.md)); only
|
|
172
|
+
then does local auth ask for a setup code and refuse development settings.
|
|
173
173
|
- On an empty production database, local auth asks for the first account's
|
|
174
174
|
setup code, so whoever reaches a new deployment first cannot own it ([The
|
|
175
175
|
first account in
|
|
@@ -89,10 +89,12 @@ a JSKIT app. The rules it applies are already in [Typed features](typed-features
|
|
|
89
89
|
|
|
90
90
|
## Production settings and secrets
|
|
91
91
|
|
|
92
|
-
- `NODE_ENV=production`, set by
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
refuses
|
|
92
|
+
- `APP_ENV=staging` or `APP_ENV=production`, with `NODE_ENV=production`, set by
|
|
93
|
+
the Deployment's Serve step, makes a server deployed
|
|
94
|
+
([Environments](environments.md)). There local auth requires
|
|
95
|
+
`AUTH_LOCAL_SESSION_SECRET`, refuses `AUTH_DEV_BYPASS_ENABLED` and
|
|
96
|
+
`AUTH_LOCAL_RECOVERY_DEV_OUTPUT`, and refuses to start without a confirmation
|
|
97
|
+
sender while anyone may register
|
|
96
98
|
([Production settings](sanity-checks.md#production-settings)).
|
|
97
99
|
- On an empty production database the first account needs the setup code
|
|
98
100
|
(403 `auth.local.setup.codeRequired`), so whoever reaches a new deployment
|
|
@@ -125,7 +127,7 @@ a JSKIT app. The rules it applies are already in [Typed features](typed-features
|
|
|
125
127
|
workspace), a write without `csrf-token`, and one request past each
|
|
126
128
|
`rateLimit` (429). A body that does not validate, sent without a session,
|
|
127
129
|
must get the refusal, not field errors.
|
|
128
|
-
- Production settings: start the server with `NODE_ENV=production` and the
|
|
130
|
+
- Production settings: start the server with `APP_ENV=staging`, `NODE_ENV=production` and the
|
|
129
131
|
test database, and check that it stops without `AUTH_LOCAL_SESSION_SECRET`,
|
|
130
132
|
that registering asks for the setup code, and the response headers.
|
|
131
133
|
- Run `npm audit` and `npm run verify`.
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<!-- Generated by `npm run agent-docs:build` from `packages/agent-docs/site/guide/framework/side-effects.md`. Do not edit manually. -->
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
title: Side effects and test copies
|
|
5
|
-
description: Follow SIDE_EFFECTS so a test copy never sends real email, messages or payments.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Side effects and test copies
|
|
9
|
-
|
|
10
|
-
An application reads one environment variable, `SIDE_EFFECTS`:
|
|
11
|
-
|
|
12
|
-
- `live`: the application acts for real.
|
|
13
|
-
- Anything else, including unset, means `simulate`: the copy is a **test
|
|
14
|
-
copy**. It sends no real email, SMS, push notification, payment or
|
|
15
|
-
third-party webhook. It simulates each one, writes it to the log, and every
|
|
16
|
-
page shows a small "Test copy" banner.
|
|
17
|
-
|
|
18
|
-
Only the copy that serves real people sets `SIDE_EFFECTS=live`. Development,
|
|
19
|
-
previews, tests and staging leave it unset. The name has no platform prefix on
|
|
20
|
-
purpose: any host can set it. The host sets it; a request never chooses it.
|
|
21
|
-
|
|
22
|
-
## What JSKIT does
|
|
23
|
-
|
|
24
|
-
- Every HTML page the server sends, and every page the Vite development server
|
|
25
|
-
sends, names the setting in a `jskit-side-effects` meta tag. The shell
|
|
26
|
-
(`@jskit-ai/shell-web`) shows the "Test copy" banner from it, with no
|
|
27
|
-
application code. The banner never takes a click or a tap. Screen readers
|
|
28
|
-
read it as a note, with "emails, messages and payments are simulated, not
|
|
29
|
-
sent" as its description. It has no label, so a browser test's
|
|
30
|
-
`getByLabel("Email")` never finds it.
|
|
31
|
-
- The server logs once at startup whether it acts for real. A production server
|
|
32
|
-
that simulates logs a warning.
|
|
33
|
-
- Local-password emails (confirmation and password reset) with an installed
|
|
34
|
-
sender are logged, not sent: local auth uses its own simulated sender in
|
|
35
|
-
place of the application's, which never runs in a test copy. An application
|
|
36
|
-
that confirms new accounts at once while its email isn't set up uses
|
|
37
|
-
`auth.local.confirmation-mode`, which a test copy keeps (see
|
|
38
|
-
[Authentication](/guide/app-setup/authentication)).
|
|
39
|
-
- Workspace invitations with a provided mailer are logged. The invitation
|
|
40
|
-
answers `status: "simulated"`, and the inviter copies the link.
|
|
41
|
-
- Accounts-hub email is logged, not sent.
|
|
42
|
-
- Connector operations that act on the world (send an email or message, post,
|
|
43
|
-
book or cancel, charge, invoice, trigger another system's events) are marked
|
|
44
|
-
`sideEffect`. They are checked like real ones, then logged, and `invoke`
|
|
45
|
-
answers `{ simulated: true }`. Reads run for real. `createConnectorsFeature`
|
|
46
|
-
reads the setting itself; give `createConnectionService` and
|
|
47
|
-
`createPaymentCheckoutService` `sideEffects: resolveSideEffectsMode(env)`.
|
|
48
|
-
- Payment checkout and the billing portal in the live payment environment are
|
|
49
|
-
refused with `payment_test_copy`; the sandbox environment works either way.
|
|
50
|
-
|
|
51
|
-
Supabase sends its own authentication emails from Supabase's servers; JSKIT
|
|
52
|
-
cannot simulate them. Point a test copy at a separate Supabase project.
|
|
53
|
-
|
|
54
|
-
## The application's own side effects
|
|
55
|
-
|
|
56
|
-
Code the application writes that reaches the world follows the same rule.
|
|
57
|
-
Decide at the point of the effect: log what would happen and answer as if it
|
|
58
|
-
were done.
|
|
59
|
-
|
|
60
|
-
```js
|
|
61
|
-
import { sideEffectsAreLive } from "@jskit-ai/kernel/shared/support/sideEffects";
|
|
62
|
-
import { logSimulatedSideEffect } from "@jskit-ai/kernel/server/runtime/sideEffects";
|
|
63
|
-
|
|
64
|
-
async function sendReminder({ env, logger, mailer }, message) {
|
|
65
|
-
if (!sideEffectsAreLive(env)) {
|
|
66
|
-
logSimulatedSideEffect(logger, { kind: "email", summary: `the reminder to ${message.to}`, details: { to: message.to } });
|
|
67
|
-
return { simulated: true };
|
|
68
|
-
}
|
|
69
|
-
return mailer.send(message);
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
- Read `env` from the `runtime.env` capability, never a request.
|
|
74
|
-
- A configured driver or key (`EMAIL_DRIVER=ses`, a live payment key) does not
|
|
75
|
-
make a test copy live; only `SIDE_EFFECTS=live` does.
|
|
76
|
-
- Test both modes. A test that proves a real sender against a fake transport
|
|
77
|
-
sets `SIDE_EFFECTS: "live"` in its environment.
|