@openreachtech/hora-skills-ort-renchan 0.2.2 → 0.4.0

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 (54) hide show
  1. package/dist/skills/hor-backend-testing/SKILL.md +4 -3
  2. package/dist/skills/hor-backend-testing/references/running-tests.md +9 -1
  3. package/dist/skills/hor-build-e2e-test-environment/SKILL.md +24 -9
  4. package/dist/skills/hor-build-e2e-test-environment/references/compose-definition.md +11 -7
  5. package/dist/skills/hor-build-e2e-test-environment/references/runner-and-lifecycle.md +1 -1
  6. package/dist/skills/hor-cookie-authentication/SKILL.md +4 -2
  7. package/dist/skills/hor-cookie-authentication/references/environment.md +4 -2
  8. package/dist/skills/hor-database-design/references/column-types.md +25 -9
  9. package/dist/skills/hor-database-design/references/datetimes.md +7 -3
  10. package/dist/skills/hor-graphql-schema/SKILL.md +10 -8
  11. package/dist/skills/hor-graphql-server-engine/SKILL.md +376 -44
  12. package/dist/skills/hor-light-rag/SKILL.md +6 -1
  13. package/dist/skills/hor-light-rag/references/retrieval-internals.md +3 -1
  14. package/dist/skills/hor-multi-llm-provider/SKILL.md +158 -20
  15. package/dist/skills/hor-multi-llm-provider/references/access-routes.md +230 -0
  16. package/dist/skills/hor-multi-llm-provider/references/provider-internals.md +9 -3
  17. package/dist/skills/hor-mutation-resolver/SKILL.md +13 -9
  18. package/dist/skills/hor-mutation-resolver/references/errors.md +15 -18
  19. package/dist/skills/hor-mutation-resolver/references/resolve-flow.md +10 -6
  20. package/dist/skills/hor-oidc-sign-in/SKILL.md +61 -0
  21. package/dist/skills/hor-oidc-sign-in/references/environment.md +94 -0
  22. package/dist/skills/hor-oidc-sign-in/references/id-token-verification.md +98 -0
  23. package/dist/skills/hor-oidc-sign-in/references/resolvers.md +134 -0
  24. package/dist/skills/hor-oidc-sign-in/references/storage.md +118 -0
  25. package/dist/skills/hor-query-resolver/SKILL.md +6 -5
  26. package/dist/skills/hor-query-resolver/references/anatomy.md +7 -7
  27. package/dist/skills/hor-query-resolver/references/data-access.md +17 -0
  28. package/dist/skills/hor-query-resolver/references/errors-and-context.md +12 -16
  29. package/dist/skills/hor-renchan-job-bullmq/SKILL.md +15 -6
  30. package/dist/skills/hor-renchan-job-bullmq/references/daemon-and-scheduler.md +4 -2
  31. package/dist/skills/hor-renchan-job-bullmq/references/engine-and-infra.md +39 -5
  32. package/dist/skills/hor-renchan-job-bullmq/references/job-triple.md +57 -0
  33. package/dist/skills/hor-resolver-validator/SKILL.md +5 -6
  34. package/dist/skills/hor-resolver-validator/references/validator-pattern.md +5 -5
  35. package/dist/skills/hor-restfulapi-architecture/SKILL.md +33 -7
  36. package/dist/skills/hor-restfulapi-architecture/references/behind-iap.md +116 -0
  37. package/dist/skills/hor-restfulapi-architecture/references/credential-routes.md +173 -0
  38. package/dist/skills/hor-restfulapi-architecture/references/engine-and-context.md +11 -5
  39. package/dist/skills/hor-restfulapi-architecture/references/renderers.md +4 -0
  40. package/dist/skills/hor-security-audit/SKILL.md +2 -2
  41. package/dist/skills/hor-security-audit/references/secrets.md +62 -36
  42. package/dist/skills/hor-sequelize-migration/SKILL.md +30 -15
  43. package/dist/skills/hor-sequelize-migration/references/alter-table.md +26 -13
  44. package/dist/skills/hor-sequelize-migration/references/foreign-keys.md +5 -2
  45. package/dist/skills/hor-sequelize-migration/references/indexes.md +41 -2
  46. package/dist/skills/hor-sequelize-migration/references/notation.md +1 -1
  47. package/dist/skills/hor-sequelize-model/references/associations.md +2 -1
  48. package/dist/skills/hor-sequelize-model/references/notation.md +1 -1
  49. package/dist/skills/hor-sequelize-seeder/SKILL.md +9 -4
  50. package/dist/skills/hor-sequelize-seeder/references/notation.md +59 -0
  51. package/dist/skills/hor-type-interface/SKILL.md +48 -32
  52. package/docs/skills.ja.md +5 -4
  53. package/docs/skills.md +5 -4
  54. package/package.json +4 -1
@@ -177,7 +177,7 @@ role: {
177
177
  | `TEXT` / `TEXT('medium')` | long text (body, message, error). For an item that can grow long, use `TEXT('medium')` |
178
178
  | `DATE(3)` | millisecond-precision datetime (`registeredAt` / `expiresAt`, etc.) |
179
179
  | `BOOLEAN` | truth value (`isActive`, etc.) |
180
- | `JSON` | structured data (`resultJson`; an FK-less id array `optionIdsJson`) |
180
+ | `JSON` | structured data (`resultJson`; an FK-less id array `optionIdsJson`). On PostgreSQL use `JSONB`, because `json` has no equality operator |
181
181
  | `DECIMAL(p, s)` | money / rate (`dailyRate` as `DECIMAL(14, 2)`, etc.) |
182
182
  | `BLOB('long')` | binary (uploaded file body) |
183
183
  | `ENUM(...)` | **avoid by default**; use a domain constant + `STRING(n)` |
@@ -214,5 +214,6 @@ Express relations with Sequelize associations **only**. Do not add DB foreign-ke
214
214
  (`hor-sequelize-migration`).
215
215
 
216
216
  - **Why**: referential integrity is enforced in the app layer (transactions, existence checks).
217
- Not adding constraints keeps migration ordering, record deletion, and sqlite tests simple. A
217
+ Not adding constraints keeps migration ordering, record deletion, and sqlite tests simple. The
218
+ rule is the same on MariaDB, MySQL and PostgreSQL; sqlite is only the test database. A
218
219
  model's `belongsTo` etc. are **declarations for JOIN and include**, independent of DB constraints.
@@ -116,7 +116,7 @@ Use the `DataTypes` in the table below.
116
116
  | `TEXT` | long text (body, message) |
117
117
  | `DATE(3)` | millisecond-precision datetime (`registeredAt` / `savedAt`, etc.) |
118
118
  | `BOOLEAN` | truth value (`isActive`, etc.) |
119
- | `JSON` | structured data (`questionsJson` / `resultJson`) |
119
+ | `JSON` | structured data (`questionsJson` / `resultJson`). On PostgreSQL use `DataTypes.JSONB`, matching the migration |
120
120
  | `DECIMAL(p, s)` | money / rate (`dailyRate`, etc.) |
121
121
  | `BLOB('long')` | binary (uploaded file body) |
122
122
  | `ENUM(...)` | **avoid by default**. Use a domain constant + `STRING(n)` instead |
@@ -122,12 +122,17 @@ example — are in [directory-structure.md](./references/directory-structure.md)
122
122
  always sees its parent row, and deletes don't orphan. (There are no DB FK constraints —
123
123
  `hor-sequelize-migration` — but ordering still keeps the data
124
124
  coherent and mirrors real usage.)
125
+ - **On PostgreSQL, advance the id sequence after `bulkInsert`.** Explicit ids do not move a
126
+ PostgreSQL sequence (MariaDB, MySQL and SQLite do move their counter), so run
127
+ `setval(pg_get_serial_sequence(<table>, 'id'), MAX(id))` right after the insert, guarded by
128
+ `getDialect() === 'postgres'`.
125
129
  - **Async fulfillment**: when a value must be computed (e.g. hashing a password via `Encipher`),
126
130
  build the fulfilled array with `await Promise.all(seeds.map(fulfillX))` inside `up` before
127
131
  `bulkInsert`; keep the plain `seeds` array for `down`'s id list.
128
132
 
129
- The full skeleton, the suite example (parent → child insert / child → parent delete), and the
130
- async-fulfillment example (e.g. password hashing) are in [notation.md](./references/notation.md).
133
+ The full skeleton, the suite example (parent → child insert / child → parent delete), the
134
+ `setval` step for PostgreSQL, and the async-fulfillment example (e.g. password hashing) are in
135
+ [notation.md](./references/notation.md).
131
136
 
132
137
  ## 3. Naming
133
138
 
@@ -264,8 +269,8 @@ the matching script directly (`npm run db:seed:dev-master`, `db:seed:dev`, or `d
264
269
  / development, `.directorykeeper`, the `db:seed:*` scripts and `db:refresh` flow, the re-export
265
270
  DRY pattern (§1)
266
271
  - [notation.md](./references/notation.md) — file skeleton, `TimestampSeedsSupplier`, `TABLE_NAME`
267
- string vs object, `seeds` arrays, `bulkInsert` / `bulkDelete`, suites and insert/delete order,
268
- async fulfillment, timestamps (§2, §5)
272
+ string vs object, `seeds` arrays, `bulkInsert` / `bulkDelete`, the PostgreSQL `setval` step,
273
+ suites and insert/delete order, async fulfillment, timestamps (§2, §5)
269
274
  - [naming.md](./references/naming.md) — `{timestamp}-{6-digit-seq}-{table_name}.cjs`, timestamp /
270
275
  creation-order ordering, `_suite`, release-dir naming (§3)
271
276
  - [id-numbering.md](./references/id-numbering.md) — the 10,000-wide id-block rule, the block tables,
@@ -91,6 +91,65 @@ module.exports = {
91
91
  - `down` deletes exactly the rows `up` inserted, by their explicit id list
92
92
  (`{ id: seeds.map(it => it.id) }`). This is why every row needs a stable, explicit `id`.
93
93
 
94
+ ## PostgreSQL: advance the id sequence after seeding explicit ids
95
+
96
+ MariaDB, MySQL and SQLite move an `AUTO_INCREMENT` counter past an explicit id on insert.
97
+ **PostgreSQL does not**: the sequence behind a `BIGSERIAL` id stays at its start, because
98
+ `bulkInsert` with explicit ids never calls `nextval()`. The first row the app creates then asks the
99
+ sequence for `1`, which seeded row `1` already holds, and the insert fails with
100
+ `duplicate key value violates unique constraint "<table>_pkey"`. Master ids `1`...`7` collide at
101
+ once; a `100001` block collides after 100,000 inserts. Advance the sequence for every seeded table.
102
+
103
+ ```js
104
+ module.exports = {
105
+ up: async (queryInterface, Sequelize) => {
106
+ await queryInterface.bulkInsert(TABLE_NAME, TimestampSeedsSupplier.supplyAll(seeds), {})
107
+
108
+ if (queryInterface.sequelize.getDialect() === 'postgres') {
109
+ await queryInterface.sequelize.query(`
110
+ SELECT setval(
111
+ pg_get_serial_sequence('${queryInterface.quoteIdentifier(TABLE_NAME)}', 'id'),
112
+ (SELECT MAX(id) FROM ${queryInterface.quoteIdentifier(TABLE_NAME)})
113
+ )
114
+ `)
115
+ }
116
+ },
117
+
118
+ down: async (queryInterface, Sequelize) => {
119
+ await queryInterface.bulkDelete(TABLE_NAME, { id: seeds.map(it => it.id) })
120
+ },
121
+ }
122
+ ```
123
+
124
+ - **`MAX(id)` of the whole table, not of `seeds`**, so a table that already holds a larger id is not
125
+ moved backwards. The next generated id is `MAX(id) + 1`.
126
+ - **The sequence name is passed as quoted identifier text** (`'"Table"'`), so a mixed-case table name
127
+ resolves the same way as it does in the `MAX(id)` subquery.
128
+ - **A suite repeats the statement once per table**, right after that table's `bulkInsert`. Its
129
+ `TABLE_NAME` is an object of table names, so each table passes its own entry:
130
+
131
+ ```js
132
+ const TABLE_NAME = {
133
+ customer: 'Customers',
134
+ order: 'Orders',
135
+ }
136
+
137
+ const tableNames = Object.values(TABLE_NAME)
138
+
139
+ await Promise.all(
140
+ tableNames.map(tableName =>
141
+ queryInterface.sequelize.query(`
142
+ SELECT setval(
143
+ pg_get_serial_sequence('${queryInterface.quoteIdentifier(tableName)}', 'id'),
144
+ (SELECT MAX(id) FROM ${queryInterface.quoteIdentifier(tableName)})
145
+ )
146
+ `)),
147
+ )
148
+ ```
149
+ - **`down` does nothing to the sequence.** Deleted ids are simply skipped; no id is reused.
150
+ - **The guard keeps one file valid on every database.** A project that runs only on PostgreSQL may
151
+ drop the `if`; the dialects without sequences must not run the statement.
152
+
94
153
  ## Suites: insert parent → child, delete child → parent
95
154
 
96
155
  When a file fills several related tables, insert **parent before child** in `up` (a child's FK
@@ -3,19 +3,19 @@ name: hor-type-interface
3
3
  description: >
4
4
  Define TypeScript type interfaces in .d.ts declaration files: model interfaces (one file per
5
5
  model/table under types/models/, in the global `model` namespace) and resolver input/output
6
- types (one file per resolver under types/resolvers/<category>/, in the global
7
- `graphql.<category>` namespace, as <Resolver>Input and <Resolver>Result). Use this skill
8
- whenever the user asks to add or change a model interface, a resolver's Input/Result types, or
9
- another shared global type.
6
+ types (all in types/graphql.d.ts, in the global `graphql.<category>` namespace, as
7
+ <Resolver>Input and <Resolver>Result). Use this skill whenever the user asks to add or change a
8
+ model interface, a resolver's Input/Result types, or another shared global type.
10
9
  ---
11
10
 
12
11
  # Type Interface Definition
13
12
 
14
13
  A skill for the **`.d.ts` type declarations** that describe an app's data shapes: the **model
15
- interfaces** (one per table) and the **resolver input/output types** (one per resolver). Both are
16
- declared as **ambient global namespaces**, so any JSDoc can reference them (`model.User`,
17
- `graphql.user.CreateOrderInput`) without an import. The core rule is **one file per entity** — one
18
- model, one resolver — merged into a single namespace by TypeScript's declaration merging.
14
+ interfaces** (one per table) and the **resolver input/output types** (a pair per resolver). Both
15
+ are declared as **ambient global namespaces**, so any JSDoc can reference them (`model.User`,
16
+ `graphql.user.CreateOrderInput`) without an import. Each model gets **its own file**, merged into
17
+ one namespace by TypeScript's declaration merging, and every resolver type lives in the one file
18
+ `types/graphql.d.ts`.
19
19
 
20
20
  > This skill states a **general, project-independent rule** — a refined best practice, not a
21
21
  > description of any one project's code, so it need not match a given repo's existing notation. The
@@ -24,16 +24,20 @@ model, one resolver — merged into a single namespace by TypeScript's declarati
24
24
  > project's own model and resolver names and never bake its domain concepts or file paths into the
25
25
  > rule.
26
26
 
27
- ## Grand principle: one file per entity, merged into one global namespace
27
+ ## Grand principle: one file per model, one file for resolver types, all in global namespaces
28
28
 
29
- Every model and every resolver gets its **own `.d.ts` file**, each declaring types into a **shared
30
- global namespace**. TypeScript's **declaration merging** combines the same-named `namespace` blocks
31
- from every file into one, so the split costs nothing at the access site.
29
+ Every model gets its **own `.d.ts` file**, and every resolver type goes into the single file
30
+ `types/graphql.d.ts`. Each file declares types into a **shared global namespace**. TypeScript's
31
+ **declaration merging** combines the same-named `namespace` blocks into one, so the split costs
32
+ nothing at the access site.
32
33
 
33
- - **Why one file per entity.** A monolithic `model.d.ts` / `graphql.d.ts` is a constant merge-conflict
34
- point — every model or resolver change touches the same file. Splitting to `types/models/<ModelName>.d.ts`
35
- and `types/resolvers/<category>/<resolverName>.d.ts` means two changes collide **only when they
36
- touch the same entity**. Adding a model = adding a file.
34
+ - **Why one file per model.** A monolithic `model.d.ts` is a constant merge-conflict point, because
35
+ every model change touches the same file. Splitting to `types/models/<ModelName>.d.ts` means two
36
+ changes collide **only when they touch the same model**. Adding a model = adding a file.
37
+ - **Why one file for resolver types.** A resolver's `Input` / `Result` pair mirrors the schema
38
+ (SDL) one-to-one, so it is written in the same change as the SDL and read beside the other
39
+ resolver types of its category. One file, `types/graphql.d.ts`, is the place to look, and there is
40
+ no per-resolver path to keep in step with the resolver's own file name.
37
41
  - **Why it still reads as one namespace.** `declare global { namespace model { … } }` in
38
42
  `User.d.ts` and the same block in `Order.d.ts` **merge** into a single `model` namespace. Consumers
39
43
  write `model.User` / `model.Order` regardless of which file declared them — the file split is
@@ -67,7 +71,7 @@ declare global {
67
71
  - **`declare global { … }`** puts the namespace in the ambient global scope — visible everywhere with
68
72
  no import.
69
73
  - The **namespace name is fixed by kind**: `model` for model interfaces ([§2](#2-model-interfaces-one-file-per-table)),
70
- `graphql.<category>` for resolver types ([§3](#3-resolver-inputoutput-types-one-file-per-resolver)).
74
+ `graphql.<category>` for resolver types ([§3](#3-resolver-inputoutput-types-in-typesgraphqldts)).
71
75
 
72
76
  ## 2. Model interfaces (one file per table)
73
77
 
@@ -118,15 +122,15 @@ declare global {
118
122
  - Optionally, a model interface may `extend` a framework base-model interface (if the architecture
119
123
  provides one for the common columns); keep that base generic, not a hard-coded app path.
120
124
 
121
- ## 3. Resolver input/output types (one file per resolver)
125
+ ## 3. Resolver input/output types (in `types/graphql.d.ts`)
122
126
 
123
- A resolver's types map **1:1 to the resolver**. Put them in
124
- `types/resolvers/<category>/<resolverName>.d.ts`, declaring into `namespace graphql.<category>` —
125
- where `<category>` is the API/endpoint group (`user`, `admin`, `portal`, …). Each resolver declares
126
- its **`<Resolver>Input`** and its **`<Resolver>Result`** (the output / response).
127
+ Every resolver's types go into the one file `types/graphql.d.ts`, declared into
128
+ `namespace graphql.<category>`, where `<category>` is the API/endpoint group (`user`, `admin`,
129
+ `portal`, …). Each resolver declares its **`<Resolver>Input`** and its **`<Resolver>Result`** (the
130
+ output / response), written as a pair.
127
131
 
128
132
  ```ts
129
- // types/resolvers/user/createOrder.d.ts
133
+ // types/graphql.d.ts
130
134
  export {}
131
135
 
132
136
  declare global {
@@ -140,18 +144,31 @@ declare global {
140
144
  order: model.Order
141
145
  }
142
146
  }
147
+
148
+ namespace graphql.admin {
149
+ interface OrdersInput {
150
+ limit: number
151
+ offset: number
152
+ }
153
+
154
+ interface OrdersResult {
155
+ orders: model.Order[]
156
+ }
157
+ }
143
158
  }
144
159
  ```
145
160
 
146
161
  - **Input** is the resolver's argument shape; **Result** is what it returns (the response). A
147
162
  query uses the same `Input` / `Result` pairing.
163
+ - **One `namespace graphql.<category>` block per category**, inside the single `declare global`.
164
+ Keep a resolver's `Input` and `Result` next to each other.
148
165
  - **Reuse model interfaces in the output** — a Result field is typed as `model.<ModelName>`
149
166
  (`order: model.Order`). The `model` and `graphql.<category>` namespaces are both global, so one
150
167
  references the other with no import.
151
- - **Resolver-local helper types** (a nested filter input, a row sub-shape) live in the **same file**
152
- as the resolver they belong to — they are part of that resolver's 1:1 slice, not shared globals.
153
- - **Category = the resolver's endpoint group.** The same resolver name under a different endpoint is a
154
- different file and a different namespace (`graphql.user.FooInput` vs `graphql.admin.FooInput`).
168
+ - **Resolver-local helper types** (a nested filter input, a row sub-shape) sit in the same block,
169
+ beside the pair they belong to, named so they cannot collide with another resolver's.
170
+ - **Category = the resolver's endpoint group.** The same resolver name under a different endpoint is
171
+ a different namespace (`graphql.user.FooInput` vs `graphql.admin.FooInput`), in the same file.
155
172
 
156
173
  ## 4. Accessing the types
157
174
 
@@ -184,17 +201,16 @@ async resolve ({
184
201
  | Kind | File | Namespace | Interface names | Access |
185
202
  | --- | --- | --- | --- | --- |
186
203
  | Model | `types/models/<ModelName>.d.ts` | `model` | `<ModelName>` | `model.<ModelName>` |
187
- | Resolver | `types/resolvers/<category>/<resolverName>.d.ts` | `graphql.<category>` | `<Resolver>Input`, `<Resolver>Result` | `graphql.<category>.<Resolver>Input` |
204
+ | Resolver | `types/graphql.d.ts` | `graphql.<category>` | `<Resolver>Input`, `<Resolver>Result` | `graphql.<category>.<Resolver>Input` |
188
205
 
189
- - File base names match the entity: `<ModelName>` (PascalCase) for models, `<resolverName>`
190
- (matching the resolver, camelCase) for resolvers.
206
+ - A model's file base name is `<ModelName>` (PascalCase); resolver types share the one file.
191
207
  - Avoid the denied vague identifiers in field names (`data` / `info` / `list` / …); name a field for
192
208
  what it holds.
193
209
 
194
210
  ## Finishing checklist
195
211
 
196
- - [ ] The type lives in its **own file** — one model → `types/models/<ModelName>.d.ts`; one resolver → `types/resolvers/<category>/<resolverName>.d.ts` ([§1](#1-the-dts-scaffold)).
212
+ - [ ] The type lives in the right file: one model → its own `types/models/<ModelName>.d.ts`; a resolver's types → `types/graphql.d.ts` ([§1](#1-the-dts-scaffold)).
197
213
  - [ ] File envelope is `export {}` → `declare global` → the correct `namespace` (`model` or `graphql.<category>`).
198
214
  - [ ] Model interface is 1:1 with a table; fields mirror columns; nullable is `| null`; a foreign-key field starts uppercase ([§2](#2-model-interfaces-one-file-per-table)).
199
- - [ ] Resolver file declares `<Resolver>Input` + `<Resolver>Result`, reuses `model.<ModelName>` in outputs, and keeps resolver-local helper types in the same file ([§3](#3-resolver-inputoutput-types-one-file-per-resolver)).
215
+ - [ ] `types/graphql.d.ts` declares `<Resolver>Input` + `<Resolver>Result` in the resolver's `graphql.<category>` block, reuses `model.<ModelName>` in outputs, and keeps resolver-local helper types beside the pair ([§3](#3-resolver-inputoutput-types-in-typesgraphqldts)).
200
216
  - [ ] The `types/**` directory is included in the project's TS config so the ambient declarations resolve.
package/docs/skills.ja.md CHANGED
@@ -34,13 +34,14 @@
34
34
 
35
35
  | スキル | 概要 |
36
36
  | :-- | :-- |
37
- | `hor-restfulapi-architecture` | renchan バックエンドの REST 層。`server/restfulapi/` 配下のレンダラーアーキテクチャ、ルートとバージョン、`render()`、レスポンス/エラーハッシュ、認証フィルタ、フラッシャー。 |
37
+ | `hor-restfulapi-architecture` | renchan バックエンドの REST 層。`server/restfulapi/` 配下のレンダラーアーキテクチャ、ルートとバージョン、`render()`、レスポンス/エラーハッシュ、認証フィルタ、フラッシャー、リクエストが運ぶ認証情報の読み取り(Cookie、Bearer、IAP JWT、HMAC)、IAP の背後で動くアプリケーション。 |
38
38
 
39
39
  ### 認証
40
40
 
41
41
  | スキル | 概要 |
42
42
  | :-- | :-- |
43
- | `hor-cookie-authentication` | renchan バックエンドのアクター別 Cookie 認証。認証情報とトークンのモデル、アクセストークンとローテーションするリフレッシュトークン(再利用検知つき)、HttpOnly のリフレッシュ Cookie、signIn / signUp / signOut / renewAccessToken の各リゾルバー。 |
43
+ | `hor-cookie-authentication` | renchan バックエンドのアクター別のパスワードサインインと Cookie ベースのセッション。認証情報とトークンのモデル、アクセストークンとローテーションするリフレッシュトークン(再利用検知つき)、HttpOnly のリフレッシュ Cookie、signIn / signUp / signOut / renewAccessToken の各リゾルバー。 |
44
+ | `hor-oidc-sign-in` | 外部の OpenID Connect プロバイダ経由でアクターをサインインさせます。PKCE つき認可コードフロー、state と nonce、ID トークンの検証、セッションを開く前のプロバイダの subject とアクターの紐付け。 |
44
45
 
45
46
  ### 実行場所
46
47
 
@@ -56,7 +57,7 @@
56
57
  | :-- | :-- |
57
58
  | `hor-ai-agent-structure` | `mentsu-agent-loop-core` 上にアプリ側 AI エージェントを構成します。`app/agents/<name>/` に `ProceduralAgentLoop` サブクラスとステップごとの `BaseAgentAction` サブクラスを置きます。 |
58
59
  | `hor-agent-loop` | `@openreachtech/mentsu-agent-loop` の 3 パッケージで LLM エージェントループを構築します。core(反復エンジン)、BullMQ ジョブ実行、GraphQL の起動 mutation と進捗 subscription。 |
59
- | `hor-multi-llm-provider` | Claude / OpenAI / Gemini を 1 つの抽象の下で扱います。抽象モデルプロセッサ、ベンダーごとの基底、モデルごとの具象クラス、モデル名で選択するローダー。 |
60
+ | `hor-multi-llm-provider` | Claude / OpenAI / Gemini を 1 つの抽象の下で扱います。抽象モデルプロセッサ、ベンダーごとの基底、モデルごとの具象クラス、モデル名で選択するローダー、モデルへの到達方法ごとのアクセスルート(ベンダー API キー、サービスアカウントによる Vertex AI、Amazon Bedrock)。 |
60
61
  | `hor-light-rag` | ベクタ DB なしで AI エージェント向けの軽量 RAG を追加します。ローカル埋め込みによる vector-first / LLM フォールバックのランキングと、MySQL の n-gram 全文検索インデックス。 |
61
62
  | `hor-ai-prompt-document-store` | エージェントの設定・指示文・ドキュメント・ツールスキーマをコードに埋め込まず DB に保持し、リクエスト時にプロンプトへ組み立て、バックアップテーブルでバージョン管理します。 |
62
63
 
@@ -70,7 +71,7 @@
70
71
 
71
72
  | スキル | 概要 |
72
73
  | :-- | :-- |
73
- | `hor-type-interface` | `.d.ts` で型インターフェースを定義します。`types/models/` のモデルインターフェース(global `model`)と、`types/resolvers/<category>/` のリゾルバ Input/Result 型。 |
74
+ | `hor-type-interface` | `.d.ts` で型インターフェースを定義します。`types/models/` のモデルインターフェース(global `model`)と、`types/graphql.d.ts` のリゾルバ Input/Result 型(global `graphql.<category>`)。 |
74
75
  | `hor-constant-definition` | アプリ定数は必ず 2 ファイルで定義します。`constants/` の CommonJS マスター(単一の情報源)と、それを再 export する `app/constants/` の ESM ブリッジ。 |
75
76
 
76
77
  ### 設計パターン
package/docs/skills.md CHANGED
@@ -34,13 +34,14 @@ Each skill lives at `kit/skills/<name>/`, directly under the skills directory, a
34
34
 
35
35
  | Skill | Summary |
36
36
  | :-- | :-- |
37
- | `hor-restfulapi-architecture` | The REST layer of a renchan backend — the renderer architecture under `server/restfulapi/`, routes and versions, `render()`, response/error hashes, the auth filter, and flushers. |
37
+ | `hor-restfulapi-architecture` | The REST layer of a renchan backend: the renderer architecture under `server/restfulapi/`, routes and versions, `render()`, response/error hashes, the auth filter, flushers, the credential a request carries (cookie, Bearer, IAP JWT, HMAC), and an application behind IAP. |
38
38
 
39
39
  ### Authentication
40
40
 
41
41
  | Skill | Summary |
42
42
  | :-- | :-- |
43
- | `hor-cookie-authentication` | Cookie-based authentication for a renchan backend, per actor — the credential and token models, access plus rotating refresh tokens with reuse detection, the HttpOnly refresh cookie, and the signIn / signUp / signOut / renewAccessToken resolvers. |
43
+ | `hor-cookie-authentication` | Password sign-in with cookie-based sessions for a renchan backend, per actor: the credential and token models, access plus rotating refresh tokens with reuse detection, the HttpOnly refresh cookie, and the signIn / signUp / signOut / renewAccessToken resolvers. |
44
+ | `hor-oidc-sign-in` | Sign an actor in through an external OpenID Connect provider: the authorization code flow with PKCE, state and nonce, ID token verification, and linking the provider's subject to an actor before the session opens. |
44
45
 
45
46
  ### Execution placement
46
47
 
@@ -56,7 +57,7 @@ Each skill lives at `kit/skills/<name>/`, directly under the skills directory, a
56
57
  | :-- | :-- |
57
58
  | `hor-ai-agent-structure` | Structure an app-side AI agent on `mentsu-agent-loop-core`: a `ProceduralAgentLoop` subclass plus per-step `BaseAgentAction` subclasses under `app/agents/<name>/`. |
58
59
  | `hor-agent-loop` | Build an LLM agent loop with the three `@openreachtech/mentsu-agent-loop` packages — the core iteration engine, a BullMQ job runner, and a GraphQL mutation plus progress subscription. |
59
- | `hor-multi-llm-provider` | Support Claude / OpenAI / Gemini behind one abstraction — an abstract model processor, a base per vendor, a concrete class per model, and a loader that picks one by model name. |
60
+ | `hor-multi-llm-provider` | Support Claude / OpenAI / Gemini behind one abstraction: an abstract model processor, a base per vendor, a concrete class per model, a loader that picks one by model name, and an access route per way of reaching it (vendor API key, Vertex AI service account, Amazon Bedrock). |
60
61
  | `hor-light-rag` | Add lightweight RAG for agent documents without a vector database — a vector-first / LLM-fallback ranker over stored `Document` rows, plus a MySQL n-gram fulltext keyword index. |
61
62
  | `hor-ai-prompt-document-store` | Hold agent config, instructions, documents and tool schemas in the database rather than in code, assembling the runtime prompt at request time and versioning through backup tables. |
62
63
 
@@ -70,7 +71,7 @@ Each skill lives at `kit/skills/<name>/`, directly under the skills directory, a
70
71
 
71
72
  | Skill | Summary |
72
73
  | :-- | :-- |
73
- | `hor-type-interface` | Define `.d.ts` type interfaces — model interfaces under `types/models/` (global `model`) and resolver Input/Result types under `types/resolvers/<category>/`. |
74
+ | `hor-type-interface` | Define `.d.ts` type interfaces, with model interfaces under `types/models/` (global `model`) and resolver Input/Result types in `types/graphql.d.ts` (global `graphql.<category>`). |
74
75
  | `hor-constant-definition` | Define an application constant as two files: a CommonJS master under `constants/` (the source of truth) plus an ESM bridge under `app/constants/` that re-exports it. |
75
76
 
76
77
  ### Design patterns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openreachtech/hora-skills-ort-renchan",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "Distributes the renchan backend skills used to develop with Hora Kit.",
5
5
  "type": "module",
6
6
  "files": [
@@ -53,6 +53,9 @@
53
53
  },
54
54
  "overrides": {
55
55
  "@humanfs/node": "^0.16.8",
56
+ "@istanbuljs/load-nyc-config": {
57
+ "js-yaml": "^4.3.2"
58
+ },
56
59
  "brace-expansion@1": "^1.1.21",
57
60
  "brace-expansion@5": "^5.0.12",
58
61
  "flatted": "^3.4.4"