@jskit-ai/agent-docs 0.1.299 → 0.1.300

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 (39) hide show
  1. package/guide/agent/framework/side-effects.md +70 -0
  2. package/guide/agent/index.md +2 -0
  3. package/package.json +1 -1
  4. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  5. package/patterns/minimal-foundation/example/AGENTS.md +6 -0
  6. package/patterns/minimal-foundation/example/package.json +3 -3
  7. package/patterns/shell-foundation/example/AGENTS.md +6 -0
  8. package/patterns/shell-foundation/example/package.json +4 -4
  9. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  10. package/reference/autogen/KERNEL_MAP.md +11 -0
  11. package/reference/autogen/PATTERN_INDEX.md +38 -38
  12. package/reference/autogen/packages/auth-provider-local-core.md +2 -0
  13. package/reference/autogen/packages/connectors-catalog.md +4 -0
  14. package/reference/autogen/packages/connectors-core.md +3 -2
  15. package/reference/autogen/packages/kernel.md +22 -0
  16. package/reference/autogen/packages/payments-core.md +1 -1
  17. package/reference/autogen/packages/shell-web.md +16 -0
  18. package/reference/autogen/packages/workspaces-core.md +4 -0
  19. package/skills/jskit/SKILL.md +1 -0
  20. package/skills/jskit/references/pattern-index.md +38 -38
  21. package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +6 -0
  22. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +3 -3
  23. package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +6 -0
  24. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +4 -4
  25. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  26. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  27. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  28. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  29. package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js +4 -1
  30. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
  31. package/skills/jskit/references/patterns/connectors/firebase-messaging/example/server/notifications.js +4 -1
  32. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  33. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  34. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  35. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  36. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  37. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  38. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  39. package/skills/jskit/references/side-effects.md +65 -0
@@ -10,9 +10,9 @@
10
10
  "./shared": "./src/shared/index.js"
11
11
  },
12
12
  "dependencies": {
13
- "@jskit-ai/crud-core": "0.2.27",
14
- "@jskit-ai/resource-crud-core": "0.1.212",
15
- "@jskit-ai/users-core": "0.2.29"
13
+ "@jskit-ai/crud-core": "0.2.28",
14
+ "@jskit-ai/resource-crud-core": "0.1.213",
15
+ "@jskit-ai/users-core": "0.2.30"
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.27",
14
- "@jskit-ai/resource-crud-core": "0.1.212",
15
- "@jskit-ai/users-core": "0.2.29",
16
- "@jskit-ai/workspaces-core": "0.2.29"
13
+ "@jskit-ai/crud-core": "0.2.28",
14
+ "@jskit-ai/resource-crud-core": "0.1.213",
15
+ "@jskit-ai/users-core": "0.2.30",
16
+ "@jskit-ai/workspaces-core": "0.2.30"
17
17
  },
18
18
  "peerDependencies": {
19
- "@jskit-ai/kernel": "0.2.19",
20
- "@jskit-ai/resource-runtime": "0.2.24"
19
+ "@jskit-ai/kernel": "0.2.20",
20
+ "@jskit-ai/resource-runtime": "0.2.25"
21
21
  },
22
22
  "jskit": {
23
23
  "kind": "runtime",
@@ -0,0 +1,65 @@
1
+ <!-- Generated from `packages/agent-docs/site/guide/framework/side-effects.md`. -->
2
+
3
+ # Side effects and test copies
4
+
5
+ An application reads one environment variable, `SIDE_EFFECTS`:
6
+
7
+ - `live`: the application acts for real.
8
+ - Anything else, including unset, means `simulate`: the copy is a **test
9
+ copy**. It sends no real email, SMS, push notification, payment or
10
+ third-party webhook. It simulates each one, writes it to the log, and every
11
+ page shows a small "Test copy" banner.
12
+
13
+ Only the copy that serves real people sets `SIDE_EFFECTS=live`. Development,
14
+ previews, tests and staging leave it unset. The name has no platform prefix on
15
+ purpose: any host can set it. The host sets it; a request never chooses it.
16
+
17
+ ## What JSKIT does
18
+
19
+ - Every HTML page the server sends, and every page the Vite development server
20
+ sends, names the setting in a `jskit-side-effects` meta tag. The shell
21
+ (`@jskit-ai/shell-web`) shows the "Test copy" banner from it, with no
22
+ application code. The banner never takes a click or a tap.
23
+ - The server logs once at startup whether it acts for real. A production server
24
+ that simulates logs a warning.
25
+ - Local-password emails (confirmation and password reset) with an installed
26
+ sender are logged, not sent.
27
+ - Workspace invitations with a provided mailer are logged. The invitation
28
+ answers `status: "simulated"`, and the inviter copies the link.
29
+ - Accounts-hub email is logged, not sent.
30
+ - Connector operations that act on the world (send an email or message, post,
31
+ book or cancel, charge, invoice, trigger another system's events) are marked
32
+ `sideEffect`. They are checked like real ones, then logged, and `invoke`
33
+ answers `{ simulated: true }`. Reads run for real. `createConnectorsFeature`
34
+ reads the setting itself; give `createConnectionService` and
35
+ `createPaymentCheckoutService` `sideEffects: resolveSideEffectsMode(env)`.
36
+ - Payment checkout and the billing portal in the live payment environment are
37
+ refused with `payment_test_copy`; the sandbox environment works either way.
38
+
39
+ Supabase sends its own authentication emails from Supabase's servers; JSKIT
40
+ cannot simulate them. Point a test copy at a separate Supabase project.
41
+
42
+ ## The application's own side effects
43
+
44
+ Code the application writes that reaches the world follows the same rule.
45
+ Decide at the point of the effect: log what would happen and answer as if it
46
+ were done.
47
+
48
+ ```js
49
+ import { sideEffectsAreLive } from "@jskit-ai/kernel/shared/support/sideEffects";
50
+ import { logSimulatedSideEffect } from "@jskit-ai/kernel/server/runtime/sideEffects";
51
+
52
+ async function sendReminder({ env, logger, mailer }, message) {
53
+ if (!sideEffectsAreLive(env)) {
54
+ logSimulatedSideEffect(logger, { kind: "email", summary: `the reminder to ${message.to}`, details: { to: message.to } });
55
+ return { simulated: true };
56
+ }
57
+ return mailer.send(message);
58
+ }
59
+ ```
60
+
61
+ - Read `env` from the `runtime.env` capability, never a request.
62
+ - A configured driver or key (`EMAIL_DRIVER=ses`, a live payment key) does not
63
+ make a test copy live; only `SIDE_EFFECTS=live` does.
64
+ - Test both modes. A test that proves a real sender against a fake transport
65
+ sets `SIDE_EFFECTS: "live"` in its environment.