@jskit-ai/agent-docs 0.1.283 → 0.1.285

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 (152) hide show
  1. package/guide/agent/app-extras/assistant.md +14 -2
  2. package/guide/agent/app-extras/realtime.md +38 -1
  3. package/guide/agent/app-setup/authentication.md +76 -14
  4. package/guide/agent/app-setup/console.md +8 -0
  5. package/guide/agent/app-setup/database-layer.md +23 -103
  6. package/guide/agent/app-setup/existing-application-migration.md +134 -72
  7. package/guide/agent/app-setup/multi-homing.md +94 -32
  8. package/guide/agent/app-setup/quickstart.md +1 -1
  9. package/guide/agent/app-setup/run-an-accounts-hub.md +1 -1
  10. package/guide/agent/app-setup/upgrading-jskit.md +17 -3
  11. package/guide/agent/app-setup/users.md +8 -5
  12. package/guide/agent/framework/application-operations.md +1 -1
  13. package/guide/agent/framework/crud-operations.md +63 -45
  14. package/guide/agent/framework/data-access.md +1207 -0
  15. package/guide/agent/framework/sanity-checks.md +26 -27
  16. package/guide/agent/framework/typed-features.md +117 -248
  17. package/guide/agent/index.md +2 -0
  18. package/package.json +6 -3
  19. package/patterns/feature-package/PATTERN.md +25 -17
  20. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  21. package/patterns/feature-package/example/variations/InvoiceRollupFeature.js +6 -7
  22. package/patterns/feature-package/example/variations/invoiceResource.js +15 -0
  23. package/patterns/feature-package/example/variations/invoiceRollupActions.js +4 -4
  24. package/patterns/feature-package/example/variations/ownedTableRepository.js +27 -0
  25. package/patterns/feature-package/example/variations/types.js +1 -1
  26. package/patterns/minimal-foundation/example/AGENTS.md +4 -0
  27. package/patterns/minimal-foundation/example/package.json +4 -4
  28. package/patterns/minimal-foundation/example/server.js +4 -1
  29. package/patterns/shell-foundation/example/AGENTS.md +4 -0
  30. package/patterns/shell-foundation/example/package.json +5 -5
  31. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  32. package/patterns/shell-foundation/example/server.js +4 -1
  33. package/reference/autogen/KERNEL_MAP.md +3 -1
  34. package/reference/autogen/PATTERN_INDEX.md +70 -59
  35. package/reference/autogen/README.md +1 -1
  36. package/reference/autogen/packages/agent-docs.md +7 -3
  37. package/reference/autogen/packages/agent-runtime.md +48 -11
  38. package/reference/autogen/packages/architecture-inspector.md +6 -2
  39. package/reference/autogen/packages/assistant-core.md +4 -4
  40. package/reference/autogen/packages/assistant-runtime.md +33 -13
  41. package/reference/autogen/packages/auth-provider-local-core.md +3 -1
  42. package/reference/autogen/packages/auth-provider-local-db-core.md +69 -14
  43. package/reference/autogen/packages/auth-provider-oidc-core.md +5 -1
  44. package/reference/autogen/packages/auth-provider-supabase-core.md +1 -1
  45. package/reference/autogen/packages/connectors-core.md +22 -2
  46. package/reference/autogen/packages/console-core.md +9 -5
  47. package/reference/autogen/packages/crud-core.md +45 -175
  48. package/reference/autogen/packages/database-runtime-mysql.md +0 -26
  49. package/reference/autogen/packages/database-runtime.md +11 -33
  50. package/reference/autogen/packages/http-runtime.md +3 -3
  51. package/reference/autogen/packages/http-web.md +12 -0
  52. package/reference/autogen/packages/kernel.md +27 -2
  53. package/reference/autogen/packages/oidc-issuer-core.md +4 -0
  54. package/reference/autogen/packages/payments-core.md +28 -6
  55. package/reference/autogen/packages/realtime.md +15 -6
  56. package/reference/autogen/packages/resource-core.md +32 -5
  57. package/reference/autogen/packages/resource-crud-core.md +30 -34
  58. package/reference/autogen/packages/resource-runtime.md +220 -0
  59. package/reference/autogen/packages/rewarded-core.md +16 -10
  60. package/reference/autogen/packages/shell-web.md +1 -0
  61. package/reference/autogen/packages/users-core.md +33 -14
  62. package/reference/autogen/packages/workspaces-core.md +17 -10
  63. package/reference/autogen/tooling/config-eslint.md +74 -0
  64. package/reference/autogen/tooling/jskit-catalog.md +50 -1
  65. package/reference/autogen/tooling/jskit-release.md +5 -0
  66. package/skills/jskit/SKILL.md +4 -1
  67. package/skills/jskit/references/app-operations.md +1 -1
  68. package/skills/jskit/references/crud-operations.md +62 -44
  69. package/skills/jskit/references/data-access.md +1202 -0
  70. package/skills/jskit/references/database-layer.md +411 -0
  71. package/skills/jskit/references/existing-application-migration.md +134 -72
  72. package/skills/jskit/references/heuristics/INDEX.md +6 -4
  73. package/skills/jskit/references/heuristics/crud-authoring.md +26 -15
  74. package/skills/jskit/references/heuristics/data-access.md +19 -0
  75. package/skills/jskit/references/heuristics/filters.md +6 -6
  76. package/skills/jskit/references/heuristics/row-policies.md +40 -16
  77. package/skills/jskit/references/heuristics/server-search.md +30 -42
  78. package/skills/jskit/references/heuristics/table-resource-fields.md +78 -0
  79. package/skills/jskit/references/heuristics/typed-features.md +3 -3
  80. package/skills/jskit/references/multi-homing.md +94 -32
  81. package/skills/jskit/references/pattern-index.md +70 -59
  82. package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +4 -0
  83. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
  84. package/skills/jskit/references/patterns/app/minimal-foundation/example/server.js +4 -1
  85. package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +4 -0
  86. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
  87. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  88. package/skills/jskit/references/patterns/app/shell-foundation/example/server.js +4 -1
  89. package/skills/jskit/references/patterns/assistant/assistant-surface/PATTERN.md +5 -2
  90. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -2
  91. package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +15 -0
  92. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  93. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  94. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
  95. package/skills/jskit/references/patterns/crud/crud-contract/PATTERN.md +133 -0
  96. package/skills/jskit/references/patterns/crud/crud-contract/example/bookResource.js +74 -0
  97. package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/PATTERN.md +69 -37
  98. package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/packages/books/package.json +5 -4
  99. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/server/BooksFeature.js +13 -0
  100. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/shared/bookResource.js +74 -0
  101. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/shared/index.js +1 -0
  102. package/skills/jskit/references/patterns/crud/crud-screen-set/PATTERN.md +26 -8
  103. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookEditPage.vue +2 -2
  104. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +2 -2
  105. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookNewPage.vue +2 -2
  106. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookViewPage.vue +3 -3
  107. package/skills/jskit/references/patterns/database/mysql-application/PATTERN.md +9 -4
  108. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -1
  109. package/skills/jskit/references/patterns/database/mysql-application/example/scripts/prepare-database.js +8 -0
  110. package/skills/jskit/references/patterns/database/postgres-application/PATTERN.md +8 -4
  111. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -1
  112. package/skills/jskit/references/patterns/database/postgres-application/example/scripts/prepare-database.js +8 -0
  113. package/skills/jskit/references/patterns/database/table-resource/PATTERN.md +120 -0
  114. package/skills/jskit/references/patterns/database/table-resource/example/orderResource.js +25 -0
  115. package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +7 -0
  116. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  117. package/skills/jskit/references/patterns/rewards/google-rewarded/PATTERN.md +1 -1
  118. package/skills/jskit/references/patterns/server/feature-package/PATTERN.md +25 -17
  119. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  120. package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupFeature.js +6 -7
  121. package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceResource.js +15 -0
  122. package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceRollupActions.js +4 -4
  123. package/skills/jskit/references/patterns/server/feature-package/example/variations/ownedTableRepository.js +27 -0
  124. package/skills/jskit/references/patterns/server/feature-package/example/variations/types.js +1 -1
  125. package/skills/jskit/references/patterns/users/user-administration-server/PATTERN.md +63 -10
  126. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +5 -4
  127. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/server/UsersFeature.js +7 -5
  128. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/index.js +1 -1
  129. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userCrud.js +21 -0
  130. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +11 -5
  131. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/UsersWorkspaceFeature.js +14 -5
  132. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/workspaceMembersOnly.js +52 -0
  133. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/index.js +1 -1
  134. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userCrud.js +21 -0
  135. package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +9 -9
  136. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/PATTERN.md +16 -0
  137. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/home/workspaces/index.vue +2 -0
  138. package/skills/jskit/references/sanity-checks.md +27 -28
  139. package/skills/jskit/references/typed-features.md +117 -248
  140. package/patterns/feature-package/example/variations/customKnexRepository.js +0 -40
  141. package/reference/autogen/packages/json-rest-api-core.md +0 -66
  142. package/skills/jskit/references/heuristics/crud-repository-mapping.md +0 -140
  143. package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/server/BooksFeature.js +0 -13
  144. package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/bookResource.js +0 -83
  145. package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/index.js +0 -1
  146. package/skills/jskit/references/patterns/crud/resource-contract/PATTERN.md +0 -155
  147. package/skills/jskit/references/patterns/crud/resource-contract/example/bookResource.js +0 -87
  148. package/skills/jskit/references/patterns/server/feature-package/example/variations/customKnexRepository.js +0 -40
  149. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userResource.js +0 -69
  150. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userResource.js +0 -56
  151. /package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/migrations/20260815000000_books.cjs +0 -0
  152. /package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/packages/books/src/server/types.js +0 -0
@@ -13,10 +13,15 @@ Take database, surface, access, ownership, operations, and fields from product
13
13
  intent and current source. Ask when a material choice is missing. Do not
14
14
  translate the work into generator options.
15
15
 
16
- Read the narrow package-owned pattern in the [source pattern
17
- library](/patterns/): `crud/resource-contract` for the resource,
18
- `crud/json-api-resource-package` for the server, and `crud/crud-screen-set`
19
- for routed UI. Child-resource and row-policy patterns own those variations.
16
+ Read the package-owned pattern in the [source pattern
17
+ library](/patterns/): `database/table-resource` for the table,
18
+ `crud/crud-contract` for its HTTP surface,
19
+ `crud/crud-feature-package` for the server, and `crud/crud-screen-set`
20
+ for routed UI; the [row
21
+ policies](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/heuristics/row-policies.md)
22
+ and [child
23
+ CRUDs](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/heuristics/child-cruds.md)
24
+ heuristics cover those variations.
20
25
 
21
26
  Normal CRUD tables use one non-null integer primary key. Foreign keys are
22
27
  single-column; composite unique indexes are business constraints, not
@@ -26,26 +31,38 @@ Match visibility to real ownership and test allowed plus cross-owner cases.
26
31
  ## Author the resource normally
27
32
 
28
33
  1. Write an immutable app-owned migration.
29
- 2. Define the shared resource contract through `defineCrudResource()`.
30
- 3. Use `defineCrudJsonApiFeature()` for standard repository, service, action,
31
- permission, resource-host, and route mechanics.
34
+ 2. Define the table resource with `defineTableResource()` and its HTTP surface
35
+ with `defineCrudContract()`, which names its `namespace`: the routes',
36
+ messages' and events' public name, never taken from the resource.
37
+ 3. Use `defineCrudFeature()` for standard table ownership, service, action,
38
+ permission, and route mechanics.
32
39
  4. Customize through `decorateRepository`, `decorateService`,
33
40
  `operationLifecycle`, and named `actions`; do not copy the standard CRUD
34
41
  repository/action/route stack.
35
42
  5. Build routed screens from the matching `http-web`/CRUD UI pattern.
36
43
 
37
- The resource is canonical for fields, operations, validation, transport,
38
- messages, and route parameters. Do not duplicate its schema or serializers.
44
+ The table resource is canonical for fields, columns, ownership and search; the
45
+ CRUD contract for operations, validation, transport, messages and route
46
+ parameters. A contract shows and accepts only the fields its `fields` names (stored
47
+ `createdAt` and `updatedAt` show without an entry; `createdAt: { output:
48
+ false }` hides one), so a column added later stays out of every API until a
49
+ contract names it. A CRUD feature's answers follow the same rule: an unnamed
50
+ relationship is left out, and an included record shows only its id, its
51
+ relation's `labelKey` and the fields the including contract lists in that
52
+ field's `output.includeFields` (`{ breed: ["name"] }` in the list shows a
53
+ record it links to, as deep as listed), never another contract's output.
54
+ A package with a CRUD feature lists `crud.contracts` in its descriptor's
55
+ `capabilities.requires`. Do not duplicate their schema or serializers.
39
56
  Prefer `useCrudListScreen()`, `useCrudViewScreen()`, and
40
57
  `useCrudAddEditScreen()`; use `useCommand()` or `useEndpointResource()` for
41
58
  non-standard operations.
42
59
 
43
60
  Add resource service methods with `decorateService`; expose commands such as
44
- `confirm`, `publish`, or `cancel` through named `actions`. With `operationLifecycle`, mutation `before`,
45
- `execute`, and `after` share one repository transaction, `execute` receives
46
- `standard(nextInput)`, and `afterCommit` follows commit. Repositories persist;
47
- services and hooks orchestrate. Use a transactional outbox for durable
48
- external work.
61
+ `confirm` or `cancel` through named `actions`. With `operationLifecycle`, mutation `before`,
62
+ `execute`, and `after` share one transaction, rerun on deadlock, so they touch
63
+ only the database; `execute` receives `standard(nextInput)`. Outside effects go
64
+ in `afterCommit`, run once after commit, or an outbox when durable.
65
+ Repositories persist; services and hooks orchestrate.
49
66
 
50
67
  ## Choose ownership, API access and client access independently
51
68
 
@@ -53,37 +70,31 @@ These controls answer different questions:
53
70
 
54
71
  | Control | Purpose | Public records | Owner-scoped records |
55
72
  | --- | --- | --- | --- |
56
- | Resource `autofilter` | Which rows belong to the request scope | `"public"`; no ownership column | `"user"`; real non-null `userId` column |
57
- | Resource `apiAccess` | Who may call the API | `"public"` | `"authenticated"` |
58
- | Feature `ownershipFilter` | Server route/action ownership scope | `"public"` | `"user"` |
73
+ | Table resource `ownership` | Which rows belong to the request scope | `"public"`; no ownership column | `"user"`; real non-null `userId` column |
74
+ | CRUD contract `apiAccess` | Who may call the API | `"public"` | `"authenticated"` |
75
+ | Feature route visibility | Server route/action scope: the table's `ownership` unless the feature names `visibility` | `"public"` | `"user"` |
59
76
  | Client `access` | Whether to require bootstrap permissions | Default `"auto"` with no permission requirements | Default `"auto"`; declare permissions when required |
60
77
 
61
- `access` accepts `auto`, `always`, or `never`, not `public`. With `auto`, a
62
- screen with no permission requirements does not require a permissions bootstrap.
63
- `always` does require it. Do not add authentication or workspace machinery to
64
- compensate for an unnecessary `always` override. Server access and ownership
78
+ `access` accepts `auto`, `always`, or `never`, not `public`. `auto` requires a
79
+ permissions bootstrap only for a screen with permission requirements; `always`
80
+ always does. Do not add authentication or workspace machinery to
81
+ make up for an unneeded `always` override. Server access and ownership
65
82
  remain authoritative.
66
83
 
67
- The Books source patterns demonstrate user ownership. For an intentionally
68
- public create/list resource, use the same patterns with this resource contract:
84
+ The Books source patterns show user ownership. For a public create/list
85
+ resource, use them with this table resource and CRUD contract:
69
86
 
70
87
  ```js
71
- const bookResource = defineCrudResource({
72
- namespace: "books",
88
+ const bookResource = defineTableResource({
89
+ name: "books",
73
90
  tableName: "books",
74
- apiAccess: "public",
75
- autofilter: "public",
76
- crudOperations: ["list", "view", "create"],
91
+ ownership: "public",
77
92
  schema: {
78
93
  title: {
79
94
  type: "string",
80
95
  required: true,
81
96
  minLength: 1,
82
- maxLength: 255,
83
- operations: {
84
- output: { required: true },
85
- create: { required: true }
86
- }
97
+ maxLength: 255
87
98
  }
88
99
  },
89
100
  searchSchema: {
@@ -96,20 +107,27 @@ const bookResource = defineCrudResource({
96
107
  }
97
108
  }
98
109
  });
110
+
111
+ const bookCrud = defineCrudContract(bookResource, {
112
+ namespace: "books",
113
+ apiAccess: "public",
114
+ operations: ["list", "view", "create"],
115
+ fields: { title: { output: "required", create: "required" } }
116
+ });
99
117
  ```
100
118
 
101
- Import `defineCrudResource` from
102
- `@jskit-ai/resource-crud-core/shared/crudResource`. Its app-owned migration
103
- creates `books` with an integer primary key `id` and non-null `title`; omit
104
- `userId` and its foreign key for this public variant. `list` requires `view`
105
- in the shared resource contract, even when the UI has no detail page. A create
106
- response uses the resource output contract. Keep operation names such as
107
- `list`, `view` and `create`; do not invent output-operation aliases.
108
-
109
- Bind `defineCrudJsonApiFeature()` with this resource, `ownershipFilter:
110
- "public"`, `relativePath: "/books"` and the application's configured public
111
- surface. Keep the existing package/provider and migration registration from
112
- `crud/json-api-resource-package`.
119
+ Import `defineTableResource` from `@jskit-ai/resource-core/shared/tableResource`
120
+ and `defineCrudContract` from `@jskit-ai/resource-crud-core/shared/crudContract`.
121
+ Its migration creates `books` with an integer `id` and non-null `title`; omit
122
+ `userId` and its foreign key.
123
+ `list` requires `view` in the CRUD contract, even when the UI has no detail
124
+ page. A create response uses the CRUD contract's output. Keep operation names
125
+ such as `list`, `view` and `create`; do not invent output-operation aliases.
126
+
127
+ Bind `defineCrudFeature()` with `crud: bookCrud`, `relativePath: "/books"`
128
+ and the application's configured public surface; the table's `"public"`
129
+ ownership makes its routes public. Keep the existing package/provider and migration registration from
130
+ `crud/crud-feature-package`.
113
131
 
114
132
  For the list, keep `BookListPage.vue` thin: use `resourceNamespace: "books"`
115
133
  in `useCrudListScreen()` on the configured public surface, remove unsupported