@jskit-ai/agent-docs 0.1.154 → 0.1.156
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-setup/authentication.md +68 -0
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/example/package.json +4 -4
- package/patterns/shell-foundation/example/package.json +5 -5
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/reference/autogen/PATTERN_INDEX.md +185 -20
- package/reference/autogen/README.md +8 -2
- package/reference/autogen/packages/auth-provider-local-core.md +3 -5
- package/reference/autogen/packages/connector-google-calendar.md +42 -0
- package/reference/autogen/packages/connectors-catalog.md +1320 -0
- package/reference/autogen/packages/connectors-core.md +85 -0
- package/reference/autogen/packages/connectors-web.md +31 -0
- package/reference/autogen/packages/payments-core.md +79 -0
- package/reference/autogen/packages/payments-web.md +37 -0
- package/reference/autogen/packages/{google-rewarded-core.md → rewarded-core.md} +36 -36
- package/reference/autogen/packages/rewarded-web.md +75 -0
- package/skills/jskit/references/pattern-index.md +185 -20
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/auth/supabase-auth/PATTERN.md +25 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
- package/skills/jskit/references/patterns/connectors/ai-connections/PATTERN.md +84 -0
- package/skills/jskit/references/patterns/connectors/ai-connections/example/ai-model.js +11 -0
- package/skills/jskit/references/patterns/connectors/ai-connections/example/perplexity-answer.js +29 -0
- package/skills/jskit/references/patterns/connectors/api-key-connection/PATTERN.md +368 -0
- package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js +18 -0
- package/skills/jskit/references/patterns/connectors/api-key-connection/example/integrations.json +19 -0
- package/skills/jskit/references/patterns/connectors/assistant-mcp/PATTERN.md +110 -0
- package/skills/jskit/references/patterns/connectors/assistant-mcp/example/integrations.json +13 -0
- package/skills/jskit/references/patterns/connectors/assistant-mcp-oauth/PATTERN.md +235 -0
- package/skills/jskit/references/patterns/connectors/assistant-mcp-oauth/example/integrations.json +102 -0
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/PATTERN.md +169 -0
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/formats/data-formats.js +35 -0
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/formats/package-lock.json +49 -0
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/formats/package.json +12 -0
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/formats/verify-formats.mjs +37 -0
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/integrations.json +38 -0
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/s3-transfer.js +34 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/PATTERN.md +106 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/.env.example +6 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/integrations.json +23 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/knexfile.js +5 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +16 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/scripts/calendar.js +102 -0
- package/skills/jskit/references/patterns/connectors/event-delivery/PATTERN.md +151 -0
- package/skills/jskit/references/patterns/connectors/event-delivery/example/integrations.json +17 -0
- package/skills/jskit/references/patterns/connectors/firebase-messaging/PATTERN.md +156 -0
- package/skills/jskit/references/patterns/connectors/firebase-messaging/example/server/notifications.js +23 -0
- package/skills/jskit/references/patterns/connectors/google-ads-search/PATTERN.md +92 -0
- package/skills/jskit/references/patterns/connectors/google-ads-search/example/ads-setup.js +25 -0
- package/skills/jskit/references/patterns/connectors/oauth-connection/PATTERN.md +724 -0
- package/skills/jskit/references/patterns/connectors/oauth-connection/example/integrations.json +20 -0
- package/skills/jskit/references/patterns/connectors/paddle-catalogue/PATTERN.md +78 -0
- package/skills/jskit/references/patterns/connectors/paddle-catalogue/example/create-products.js +38 -0
- package/skills/jskit/references/patterns/connectors/public-image/PATTERN.md +84 -0
- package/skills/jskit/references/patterns/connectors/public-image/example/integrations.json +13 -0
- package/skills/jskit/references/patterns/connectors/public-image/example/logo-url.js +16 -0
- package/skills/jskit/references/patterns/connectors/redshift-queries/PATTERN.md +150 -0
- package/skills/jskit/references/patterns/connectors/redshift-queries/example/integrations.json +33 -0
- package/skills/jskit/references/patterns/connectors/source-scanning/PATTERN.md +83 -0
- package/skills/jskit/references/patterns/connectors/source-scanning/example/source-scanner.js +13 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/package.json +2 -2
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/rewards/google-rewarded/PATTERN.md +69 -0
- package/skills/jskit/references/patterns/rewards/google-rewarded/example/GoogleRewardedDeliveryProvider.js +12 -0
- package/skills/jskit/references/patterns/rewards/google-rewarded/example/googlePublisherTag.js +142 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +2 -2
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +3 -3
- package/reference/autogen/packages/google-rewarded-web.md +0 -65
|
@@ -15,7 +15,7 @@ A concrete Fastify, Vue, and JSKIT application foundation for products that do n
|
|
|
15
15
|
|
|
16
16
|
- Id: `app/minimal-foundation`
|
|
17
17
|
- Keywords: `app`, `fastify`, `foundation`, `minimal`, `server`, `vite`, `vue`
|
|
18
|
-
- Owner: `@jskit-ai/agent-docs@0.1.
|
|
18
|
+
- Owner: `@jskit-ai/agent-docs@0.1.156`
|
|
19
19
|
- Read: [PATTERN.md](patterns/app/minimal-foundation/PATTERN.md)
|
|
20
20
|
- Examples: [example/](patterns/app/minimal-foundation/example/)
|
|
21
21
|
- Requires: `@jskit-ai/http-runtime`, `@jskit-ai/kernel`
|
|
@@ -26,7 +26,7 @@ A concrete JSKIT web application foundation with responsive shell navigation, se
|
|
|
26
26
|
|
|
27
27
|
- Id: `app/shell-foundation`
|
|
28
28
|
- Keywords: `app`, `foundation`, `material`, `navigation`, `placements`, `shell`, `vite`, `vue`
|
|
29
|
-
- Owner: `@jskit-ai/agent-docs@0.1.
|
|
29
|
+
- Owner: `@jskit-ai/agent-docs@0.1.156`
|
|
30
30
|
- Read: [PATTERN.md](patterns/app/shell-foundation/PATTERN.md)
|
|
31
31
|
- Examples: [example/](patterns/app/shell-foundation/example/)
|
|
32
32
|
- Requires: `@jskit-ai/http-runtime`, `@jskit-ai/kernel`, `@jskit-ai/shell-web`
|
|
@@ -37,7 +37,7 @@ Configure an assistant runtime for one application surface and expose its chat a
|
|
|
37
37
|
|
|
38
38
|
- Id: `assistant/assistant-surface`
|
|
39
39
|
- Keywords: `ai`, `assistant`, `chat`, `config`, `environment`, `page`, `placement`, `settings`, `surface`
|
|
40
|
-
- Owner: `@jskit-ai/assistant-runtime@0.1.
|
|
40
|
+
- Owner: `@jskit-ai/assistant-runtime@0.1.155`
|
|
41
41
|
- Read: [PATTERN.md](patterns/assistant/assistant-surface/PATTERN.md)
|
|
42
42
|
- Examples: [example/](patterns/assistant/assistant-surface/example/)
|
|
43
43
|
- Requires: `@jskit-ai/assistant-runtime`, `@jskit-ai/shell-web`
|
|
@@ -48,7 +48,7 @@ Compose JSKIT authentication routes, views, profile controls, and public surface
|
|
|
48
48
|
|
|
49
49
|
- Id: `auth/auth-surface`
|
|
50
50
|
- Keywords: `account`, `auth`, `login`, `logout`, `password`, `placement`, `profile`, `reset`, `surface`
|
|
51
|
-
- Owner: `@jskit-ai/auth-web@0.1.
|
|
51
|
+
- Owner: `@jskit-ai/auth-web@0.1.184`
|
|
52
52
|
- Read: [PATTERN.md](patterns/auth/auth-surface/PATTERN.md)
|
|
53
53
|
- Examples: [example/](patterns/auth/auth-surface/example/)
|
|
54
54
|
- Requires: `@jskit-ai/auth-core`, `@jskit-ai/auth-web`, `@jskit-ai/shell-web`
|
|
@@ -59,18 +59,172 @@ Add Supabase authentication through normal npm composition, explicit environment
|
|
|
59
59
|
|
|
60
60
|
- Id: `auth/supabase-auth`
|
|
61
61
|
- Keywords: `auth`, `authentication`, `oauth`, `sessions`, `supabase`
|
|
62
|
-
- Owner: `@jskit-ai/auth-provider-supabase-core@0.1.
|
|
62
|
+
- Owner: `@jskit-ai/auth-provider-supabase-core@0.1.181`
|
|
63
63
|
- Read: [PATTERN.md](patterns/auth/supabase-auth/PATTERN.md)
|
|
64
64
|
- Examples: [example/](patterns/auth/supabase-auth/example/)
|
|
65
65
|
- Requires: `@jskit-ai/auth-provider-supabase-core`
|
|
66
66
|
|
|
67
|
+
## App-owned AI connections and static model selection
|
|
68
|
+
|
|
69
|
+
Resolve an administrator environment key or an individual user's grant, then use the application's chosen AI SDK directly.
|
|
70
|
+
|
|
71
|
+
- Id: `connectors/ai-connections`
|
|
72
|
+
- Keywords: `ai`, `api-key`, `big-pickle`, `cli`, `environment`, `free`, `models`, `ownership`, `zai`, `zen`
|
|
73
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
74
|
+
- Read: [PATTERN.md](patterns/connectors/ai-connections/PATTERN.md)
|
|
75
|
+
- Examples: [example/](patterns/connectors/ai-connections/example/)
|
|
76
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
77
|
+
|
|
78
|
+
## API-key connections with portable JSON configuration
|
|
79
|
+
|
|
80
|
+
Compose provider operations, authorization and encrypted file storage from a CLI or application server.
|
|
81
|
+
|
|
82
|
+
- Id: `connectors/api-key-connection`
|
|
83
|
+
- Keywords: `api-key`, `clay`, `cli`, `clickhouse`, `connectors`, `dbt`, `files`, `firecrawl`, `granola`, `integrations`, `metrics`, `prestashop`, `resend`, `semantic-layer`, `semrush`, `x-twitter`
|
|
84
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
85
|
+
- Read: [PATTERN.md](patterns/connectors/api-key-connection/PATTERN.md)
|
|
86
|
+
- Examples: [example/](patterns/connectors/api-key-connection/example/)
|
|
87
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
88
|
+
|
|
89
|
+
## Assistant MCP connections with portable files
|
|
90
|
+
|
|
91
|
+
Compose token-based MCP discovery and explicitly authorized tool calls using the shared connector runtime.
|
|
92
|
+
|
|
93
|
+
- Id: `connectors/assistant-mcp`
|
|
94
|
+
- Keywords: `assistant`, `cli`, `connectors`, `files`, `integrations`, `mcp`, `n8n`, `sanity`
|
|
95
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
96
|
+
- Read: [PATTERN.md](patterns/connectors/assistant-mcp/PATTERN.md)
|
|
97
|
+
- Examples: [example/](patterns/connectors/assistant-mcp/example/)
|
|
98
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
99
|
+
|
|
100
|
+
## Assistant MCP OAuth with portable files
|
|
101
|
+
|
|
102
|
+
Configure assistant OAuth clients, then compose existing state, encrypted file grants and authorized MCP calls.
|
|
103
|
+
|
|
104
|
+
- Id: `connectors/assistant-mcp-oauth`
|
|
105
|
+
- Keywords: `amplitude`, `assistant`, `atlassian`, `canva`, `cli`, `client metadata`, `confidence`, `connectors`, `figma`, `files`, `granola`, `hex`, `mcp`, `miro`, `oauth`
|
|
106
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
107
|
+
- Read: [PATTERN.md](patterns/connectors/assistant-mcp-oauth/PATTERN.md)
|
|
108
|
+
- Examples: [example/](patterns/connectors/assistant-mcp-oauth/example/)
|
|
109
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
110
|
+
|
|
111
|
+
## AWS object storage and Athena queries with explicit credentials
|
|
112
|
+
|
|
113
|
+
Compose signed AWS operations, file configuration and application authorization from CLI or server code.
|
|
114
|
+
|
|
115
|
+
- Id: `connectors/aws-storage-queries`
|
|
116
|
+
- Keywords: `athena`, `aws`, `cli`, `connectors`, `files`, `iam`, `queries`, `s3`, `storage`, `sts`
|
|
117
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
118
|
+
- Read: [PATTERN.md](patterns/connectors/aws-storage-queries/PATTERN.md)
|
|
119
|
+
- Examples: [example/](patterns/connectors/aws-storage-queries/example/)
|
|
120
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
121
|
+
|
|
122
|
+
## Google Calendar from an application-owned CLI
|
|
123
|
+
|
|
124
|
+
Compose reusable connection libraries with portable configuration, application ownership and durable storage.
|
|
125
|
+
|
|
126
|
+
- Id: `connectors/calendar-cli`
|
|
127
|
+
- Keywords: `calendar`, `cli`, `connectors`, `google`, `integrations`, `oauth`, `permissions`
|
|
128
|
+
- Owner: `@jskit-ai/connector-google-calendar@0.1.1`
|
|
129
|
+
- Read: [PATTERN.md](patterns/connectors/calendar-cli/PATTERN.md)
|
|
130
|
+
- Examples: [example/](patterns/connectors/calendar-cli/example/)
|
|
131
|
+
- Requires: `@jskit-ai/connector-google-calendar`, `@jskit-ai/connectors-core`, `@jskit-ai/database-runtime-mysql`
|
|
132
|
+
|
|
133
|
+
## Authorized Inngest event delivery with portable files
|
|
134
|
+
|
|
135
|
+
Compose the shared connector runtime for event delivery while leaving workflow code and event policy with the application.
|
|
136
|
+
|
|
137
|
+
- Id: `connectors/event-delivery`
|
|
138
|
+
- Keywords: `cli`, `connectors`, `events`, `files`, `inngest`, `integrations`, `workflows`
|
|
139
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
140
|
+
- Read: [PATTERN.md](patterns/connectors/event-delivery/PATTERN.md)
|
|
141
|
+
- Examples: [example/](patterns/connectors/event-delivery/example/)
|
|
142
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
143
|
+
|
|
144
|
+
## Firebase messaging from a CLI or application backend
|
|
145
|
+
|
|
146
|
+
Wire service-account grants, file storage, explicit message actions and public browser settings without generating an application.
|
|
147
|
+
|
|
148
|
+
- Id: `connectors/firebase-messaging`
|
|
149
|
+
- Keywords: `cli`, `connectors`, `fcm`, `files`, `firebase`, `integrations`, `jwt`, `notifications`, `push`, `service-account`, `vapid`
|
|
150
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
151
|
+
- Read: [PATTERN.md](patterns/connectors/firebase-messaging/PATTERN.md)
|
|
152
|
+
- Examples: [example/](patterns/connectors/firebase-messaging/example/)
|
|
153
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
154
|
+
|
|
155
|
+
## Existing-account Google Ads Search
|
|
156
|
+
|
|
157
|
+
Compose reviewed Search campaigns with project-owned Google OAuth and portable saved plans.
|
|
158
|
+
|
|
159
|
+
- Id: `connectors/google-ads-search`
|
|
160
|
+
- Keywords: `ads`, `campaigns`, `cli`, `connectors`, `conversion`, `google`, `search`
|
|
161
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
162
|
+
- Read: [PATTERN.md](patterns/connectors/google-ads-search/PATTERN.md)
|
|
163
|
+
- Examples: [example/](patterns/connectors/google-ads-search/example/)
|
|
164
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
165
|
+
|
|
166
|
+
## OAuth connections with portable files
|
|
167
|
+
|
|
168
|
+
Compose provider consent, verification and encrypted file persistence from an application server or CLI.
|
|
169
|
+
|
|
170
|
+
- Id: `connectors/oauth-connection`
|
|
171
|
+
- Keywords: `accounting`, `assistant permissions`, `books`, `cli`, `client credentials`, `connectors`, `consent`, `crm`, `databricks`, `developer token`, `fabric`, `files`, `gaql`, `google ads`, `graphql`, `integrations`, `linkedin`, `microsoft`, `oauth`, `powerpoint`, `salesforce`, `service principal`, `shopify`, `soql`, `staffing`, `tiktok`, `twitch`, `wave`, `word`, `wordpress`, `workday`, `xero`, `zoho`
|
|
172
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
173
|
+
- Read: [PATTERN.md](patterns/connectors/oauth-connection/PATTERN.md)
|
|
174
|
+
- Examples: [example/](patterns/connectors/oauth-connection/example/)
|
|
175
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
176
|
+
|
|
177
|
+
## Create Paddle products with prices
|
|
178
|
+
|
|
179
|
+
Compose a sequential catalogue batch and preserve partial success for application-owned recovery.
|
|
180
|
+
|
|
181
|
+
- Id: `connectors/paddle-catalogue`
|
|
182
|
+
- Keywords: `batch`, `paddle`, `payments`, `prices`, `products`
|
|
183
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
184
|
+
- Read: [PATTERN.md](patterns/connectors/paddle-catalogue/PATTERN.md)
|
|
185
|
+
- Examples: [example/](patterns/connectors/paddle-catalogue/example/)
|
|
186
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
187
|
+
|
|
188
|
+
## Public logo images from portable integration configuration
|
|
189
|
+
|
|
190
|
+
Resolve a publishable image key deliberately and use the shared URL library in a browser, backend or CLI.
|
|
191
|
+
|
|
192
|
+
- Id: `connectors/public-image`
|
|
193
|
+
- Keywords: `cli`, `connectors`, `files`, `images`, `integrations`, `logo-dev`, `public-key`
|
|
194
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
195
|
+
- Read: [PATTERN.md](patterns/connectors/public-image/PATTERN.md)
|
|
196
|
+
- Examples: [example/](patterns/connectors/public-image/example/)
|
|
197
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
198
|
+
|
|
199
|
+
## Redshift queries with shared AWS credentials
|
|
200
|
+
|
|
201
|
+
Compose file configuration, Redshift Data API operations and application query ownership.
|
|
202
|
+
|
|
203
|
+
- Id: `connectors/redshift-queries`
|
|
204
|
+
- Keywords: `aws`, `cli`, `connectors`, `files`, `iam`, `provisioned`, `redshift`, `serverless`, `sql`, `warehouse`
|
|
205
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
206
|
+
- Read: [PATTERN.md](patterns/connectors/redshift-queries/PATTERN.md)
|
|
207
|
+
- Examples: [example/](patterns/connectors/redshift-queries/example/)
|
|
208
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
209
|
+
|
|
210
|
+
## Authorised project source scans with Wiz
|
|
211
|
+
|
|
212
|
+
Use the shared scanner runtime from a CLI or a host worker with portable configuration and explicit source ownership.
|
|
213
|
+
|
|
214
|
+
- Id: `connectors/source-scanning`
|
|
215
|
+
- Keywords: `cancellation`, `cli`, `connectors`, `integrations`, `scanning`, `security`, `source`, `wiz`, `worker`
|
|
216
|
+
- Owner: `@jskit-ai/connectors-catalog@0.1.1`
|
|
217
|
+
- Read: [PATTERN.md](patterns/connectors/source-scanning/PATTERN.md)
|
|
218
|
+
- Examples: [example/](patterns/connectors/source-scanning/example/)
|
|
219
|
+
- Requires: `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`
|
|
220
|
+
|
|
67
221
|
## Owner console surface
|
|
68
222
|
|
|
69
223
|
Add a protected administration surface, settings shell, and semantic navigation through JSKIT console and shell APIs.
|
|
70
224
|
|
|
71
225
|
- Id: `console/console-surface`
|
|
72
226
|
- Keywords: `admin`, `console`, `navigation`, `owner`, `placement`, `settings`, `surface`
|
|
73
|
-
- Owner: `@jskit-ai/console-web@0.1.
|
|
227
|
+
- Owner: `@jskit-ai/console-web@0.1.152`
|
|
74
228
|
- Read: [PATTERN.md](patterns/console/console-surface/PATTERN.md)
|
|
75
229
|
- Examples: [example/](patterns/console/console-surface/example/)
|
|
76
230
|
- Requires: `@jskit-ai/console-core`, `@jskit-ai/console-web`, `@jskit-ai/shell-web`
|
|
@@ -81,7 +235,7 @@ Build a routed CRUD user interface as thin application pages over JSKIT's shared
|
|
|
81
235
|
|
|
82
236
|
- Id: `crud/crud-screen-set`
|
|
83
237
|
- Keywords: `actions`, `add`, `crud`, `delete`, `edit`, `filters`, `list`, `material`, `routes`, `view`, `vue`
|
|
84
|
-
- Owner: `@jskit-ai/http-web@0.1.
|
|
238
|
+
- Owner: `@jskit-ai/http-web@0.1.29`
|
|
85
239
|
- Read: [PATTERN.md](patterns/crud/crud-screen-set/PATTERN.md)
|
|
86
240
|
- Examples: [example/](patterns/crud/crud-screen-set/example/)
|
|
87
241
|
- Requires: `@jskit-ai/http-web`, `@jskit-ai/resource-crud-core`
|
|
@@ -92,7 +246,7 @@ Build a complete application-owned CRUD server package from a migration, resourc
|
|
|
92
246
|
|
|
93
247
|
- Id: `crud/json-api-resource-package`
|
|
94
248
|
- Keywords: `actions`, `crud`, `database`, `json-api`, `migration`, `permissions`, `provider`, `repository`, `routes`, `service`
|
|
95
|
-
- Owner: `@jskit-ai/crud-core@0.1.
|
|
249
|
+
- Owner: `@jskit-ai/crud-core@0.1.195`
|
|
96
250
|
- Read: [PATTERN.md](patterns/crud/json-api-resource-package/PATTERN.md)
|
|
97
251
|
- Examples: [example/](patterns/crud/json-api-resource-package/example/)
|
|
98
252
|
- Requires: `@jskit-ai/crud-core`, `@jskit-ai/resource-crud-core`
|
|
@@ -103,7 +257,7 @@ Define an authenticated application resource whose records belong to the current
|
|
|
103
257
|
|
|
104
258
|
- Id: `crud/resource-contract`
|
|
105
259
|
- Keywords: `authenticated`, `crud`, `database`, `owner-scoped`, `resource`, `user`
|
|
106
|
-
- Owner: `@jskit-ai/resource-crud-core@0.1.
|
|
260
|
+
- Owner: `@jskit-ai/resource-crud-core@0.1.126`
|
|
107
261
|
- Read: [PATTERN.md](patterns/crud/resource-contract/PATTERN.md)
|
|
108
262
|
- Examples: [example/](patterns/crud/resource-contract/example/)
|
|
109
263
|
- Requires: `@jskit-ai/resource-crud-core`
|
|
@@ -114,7 +268,7 @@ Configure a JSKIT application for MySQL with a fixed driver, ordinary environmen
|
|
|
114
268
|
|
|
115
269
|
- Id: `database/mysql-application`
|
|
116
270
|
- Keywords: `database`, `knex`, `mariadb`, `migrations`, `mysql`, `mysql2`
|
|
117
|
-
- Owner: `@jskit-ai/database-runtime-mysql@0.1.
|
|
271
|
+
- Owner: `@jskit-ai/database-runtime-mysql@0.1.182`
|
|
118
272
|
- Read: [PATTERN.md](patterns/database/mysql-application/PATTERN.md)
|
|
119
273
|
- Examples: [example/](patterns/database/mysql-application/example/)
|
|
120
274
|
- Requires: `@jskit-ai/database-runtime-mysql`
|
|
@@ -125,7 +279,7 @@ Configure a JSKIT application for PostgreSQL with a fixed driver, ordinary envir
|
|
|
125
279
|
|
|
126
280
|
- Id: `database/postgres-application`
|
|
127
281
|
- Keywords: `database`, `knex`, `migrations`, `pg`, `postgres`, `postgresql`
|
|
128
|
-
- Owner: `@jskit-ai/database-runtime-postgres@0.1.
|
|
282
|
+
- Owner: `@jskit-ai/database-runtime-postgres@0.1.181`
|
|
129
283
|
- Read: [PATTERN.md](patterns/database/postgres-application/PATTERN.md)
|
|
130
284
|
- Examples: [example/](patterns/database/postgres-application/example/)
|
|
131
285
|
- Requires: `@jskit-ai/database-runtime-postgres`
|
|
@@ -136,7 +290,7 @@ Wrap a JSKIT web application in a Capacitor Android shell using native Capacitor
|
|
|
136
290
|
|
|
137
291
|
- Id: `mobile/android-application`
|
|
138
292
|
- Keywords: `android`, `capacitor`, `device`, `mobile`, `native`, `shell`, `webview`
|
|
139
|
-
- Owner: `@jskit-ai/mobile-capacitor@0.1.
|
|
293
|
+
- Owner: `@jskit-ai/mobile-capacitor@0.1.119`
|
|
140
294
|
- Read: [PATTERN.md](patterns/mobile/android-application/PATTERN.md)
|
|
141
295
|
- Examples: [example/](patterns/mobile/android-application/example/)
|
|
142
296
|
- Requires: `@capacitor/android`, `@capacitor/app`, `@capacitor/cli`, `@jskit-ai/mobile-capacitor`
|
|
@@ -147,18 +301,29 @@ Add JSKIT realtime events with an optional Redis backplane and an explicit shell
|
|
|
147
301
|
|
|
148
302
|
- Id: `realtime/realtime-application`
|
|
149
303
|
- Keywords: `realtime`, `redis`, `socket.io`, `sockets`, `status`, `websocket`
|
|
150
|
-
- Owner: `@jskit-ai/realtime@0.1.
|
|
304
|
+
- Owner: `@jskit-ai/realtime@0.1.181`
|
|
151
305
|
- Read: [PATTERN.md](patterns/realtime/realtime-application/PATTERN.md)
|
|
152
306
|
- Examples: [example/](patterns/realtime/realtime-application/example/)
|
|
153
307
|
- Requires: `@jskit-ai/realtime`, `@jskit-ai/shell-web`
|
|
154
308
|
|
|
309
|
+
## Google rewarded delivery
|
|
310
|
+
|
|
311
|
+
Compose application-owned Google Publisher Tag delivery with the generic rewarded workflow.
|
|
312
|
+
|
|
313
|
+
- Id: `rewards/google-rewarded`
|
|
314
|
+
- Keywords: `ads`, `google`, `publisher tag`, `rewarded`, `unlock`
|
|
315
|
+
- Owner: `@jskit-ai/rewarded-web@0.1.120`
|
|
316
|
+
- Read: [PATTERN.md](patterns/rewards/google-rewarded/PATTERN.md)
|
|
317
|
+
- Examples: [example/](patterns/rewards/google-rewarded/example/)
|
|
318
|
+
- Requires: `@jskit-ai/rewarded-web`
|
|
319
|
+
|
|
155
320
|
## App-local server feature package
|
|
156
321
|
|
|
157
322
|
Define a server feature through explicit capabilities and first-class actions, adding services or repositories only when its domain earns them.
|
|
158
323
|
|
|
159
324
|
- Id: `server/feature-package`
|
|
160
325
|
- Keywords: `actions`, `feature`, `json-rest`, `knex`, `orchestration`, `package`, `provider`, `repository`, `routes`, `server`
|
|
161
|
-
- Owner: `@jskit-ai/agent-docs@0.1.
|
|
326
|
+
- Owner: `@jskit-ai/agent-docs@0.1.156`
|
|
162
327
|
- Read: [PATTERN.md](patterns/server/feature-package/PATTERN.md)
|
|
163
328
|
- Examples: [example/](patterns/server/feature-package/example/)
|
|
164
329
|
- Requires: `@jskit-ai/kernel`
|
|
@@ -169,7 +334,7 @@ Compose the JSKIT responsive shell, semantic placements, settings navigation, an
|
|
|
169
334
|
|
|
170
335
|
- Id: `shell/application-shell`
|
|
171
336
|
- Keywords: `adaptive`, `app`, `layout`, `navigation`, `placement`, `responsive`, `settings`, `shell`
|
|
172
|
-
- Owner: `@jskit-ai/shell-web@0.1.
|
|
337
|
+
- Owner: `@jskit-ai/shell-web@0.1.188`
|
|
173
338
|
- Read: [PATTERN.md](patterns/shell/application-shell/PATTERN.md)
|
|
174
339
|
- Examples: [example/](patterns/shell/application-shell/example/)
|
|
175
340
|
- Requires: `@jskit-ai/kernel`, `@jskit-ai/shell-web`
|
|
@@ -180,7 +345,7 @@ Add product routes and shell extensions through file routing, semantic placement
|
|
|
180
345
|
|
|
181
346
|
- Id: `ui/page-and-placement`
|
|
182
347
|
- Keywords: `component`, `navigation`, `outlet`, `page`, `placement`, `routes`, `section`, `shell`, `subpages`, `vue`
|
|
183
|
-
- Owner: `@jskit-ai/shell-web@0.1.
|
|
348
|
+
- Owner: `@jskit-ai/shell-web@0.1.188`
|
|
184
349
|
- Read: [PATTERN.md](patterns/ui/page-and-placement/PATTERN.md)
|
|
185
350
|
- Examples: [example/](patterns/ui/page-and-placement/example/)
|
|
186
351
|
- Requires: `@jskit-ai/kernel`, `@jskit-ai/shell-web`
|
|
@@ -191,7 +356,7 @@ Compose an account settings route and profile, preference, and notification sect
|
|
|
191
356
|
|
|
192
357
|
- Id: `users/account-settings`
|
|
193
358
|
- Keywords: `account`, `notifications`, `preferences`, `profile`, `settings`, `user`, `vue`
|
|
194
|
-
- Owner: `@jskit-ai/users-web@0.1.
|
|
359
|
+
- Owner: `@jskit-ai/users-web@0.1.202`
|
|
195
360
|
- Read: [PATTERN.md](patterns/users/account-settings/PATTERN.md)
|
|
196
361
|
- Examples: [example/](patterns/users/account-settings/example/)
|
|
197
362
|
- Requires: `@jskit-ai/shell-web`, `@jskit-ai/users-core`, `@jskit-ai/users-web`
|
|
@@ -202,7 +367,7 @@ Expose user administration and workspace-scoped member operations through app-ow
|
|
|
202
367
|
|
|
203
368
|
- Id: `users/user-administration-server`
|
|
204
369
|
- Keywords: `account`, `admin`, `member`, `repository`, `resource`, `routes`, `service`, `user`, `workspace`
|
|
205
|
-
- Owner: `@jskit-ai/users-core@0.1.
|
|
370
|
+
- Owner: `@jskit-ai/users-core@0.1.197`
|
|
206
371
|
- Read: [PATTERN.md](patterns/users/user-administration-server/PATTERN.md)
|
|
207
372
|
- Examples: [example/](patterns/users/user-administration-server/example/)
|
|
208
373
|
- Requires: `@jskit-ai/crud-core`, `@jskit-ai/users-core`
|
|
@@ -213,7 +378,7 @@ Configure roles, workspace access policy, invitations, and app-owned invitation
|
|
|
213
378
|
|
|
214
379
|
- Id: `workspaces/workspace-server`
|
|
215
380
|
- Keywords: `access`, `invite`, `membership`, `multitenancy`, `policy`, `role`, `tenancy`, `workspace`
|
|
216
|
-
- Owner: `@jskit-ai/workspaces-core@0.1.
|
|
381
|
+
- Owner: `@jskit-ai/workspaces-core@0.1.162`
|
|
217
382
|
- Read: [PATTERN.md](patterns/workspaces/workspace-server/PATTERN.md)
|
|
218
383
|
- Examples: [example/](patterns/workspaces/workspace-server/example/)
|
|
219
384
|
- Requires: `@jskit-ai/users-core`, `@jskit-ai/workspaces-core`
|
|
@@ -224,7 +389,7 @@ Compose workspace selection, invitation, member administration, settings, and re
|
|
|
224
389
|
|
|
225
390
|
- Id: `workspaces/workspace-surfaces`
|
|
226
391
|
- Keywords: `admin`, `invite`, `member`, `navigation`, `settings`, `surface`, `switcher`, `workspace`
|
|
227
|
-
- Owner: `@jskit-ai/workspaces-web@0.1.
|
|
392
|
+
- Owner: `@jskit-ai/workspaces-web@0.1.163`
|
|
228
393
|
- Read: [PATTERN.md](patterns/workspaces/workspace-surfaces/PATTERN.md)
|
|
229
394
|
- Examples: [example/](patterns/workspaces/workspace-surfaces/example/)
|
|
230
395
|
- Requires: `@jskit-ai/shell-web`, `@jskit-ai/workspaces-core`, `@jskit-ai/workspaces-web`
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@local/main": "0.1.0",
|
|
36
36
|
"@fastify/static": "^10.1.3",
|
|
37
|
-
"@jskit-ai/kernel": "0.1.
|
|
37
|
+
"@jskit-ai/kernel": "0.1.184",
|
|
38
38
|
"@tanstack/vue-query": "^5.101.0",
|
|
39
39
|
"fastify": "^5.8.5",
|
|
40
40
|
"json-rest-schema": "^1.0.17",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"vue": "^3.5.38",
|
|
43
43
|
"vue-router": "^5.1.0",
|
|
44
44
|
"vuetify": "^4.1.2",
|
|
45
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
45
|
+
"@jskit-ai/http-runtime": "0.1.182"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@jskit-ai/config-eslint": "0.1.
|
|
49
|
-
"@jskit-ai/jskit-catalog": "0.1.
|
|
48
|
+
"@jskit-ai/config-eslint": "0.1.181",
|
|
49
|
+
"@jskit-ai/jskit-catalog": "0.1.209",
|
|
50
50
|
"@playwright/test": "1.61.1",
|
|
51
51
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
52
52
|
"eslint": "^10.8.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@local/main": "0.1.0",
|
|
36
36
|
"@fastify/static": "^10.1.3",
|
|
37
|
-
"@jskit-ai/kernel": "0.1.
|
|
37
|
+
"@jskit-ai/kernel": "0.1.184",
|
|
38
38
|
"@tanstack/vue-query": "^5.101.0",
|
|
39
39
|
"fastify": "^5.8.5",
|
|
40
40
|
"json-rest-schema": "^1.0.17",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"vue": "^3.5.38",
|
|
43
43
|
"vue-router": "^5.1.0",
|
|
44
44
|
"vuetify": "^4.1.2",
|
|
45
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
45
|
+
"@jskit-ai/http-runtime": "0.1.182",
|
|
46
46
|
"@mdi/js": "^7.4.47",
|
|
47
|
-
"@jskit-ai/shell-web": "0.1.
|
|
47
|
+
"@jskit-ai/shell-web": "0.1.188"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@jskit-ai/config-eslint": "0.1.
|
|
51
|
-
"@jskit-ai/jskit-catalog": "0.1.
|
|
50
|
+
"@jskit-ai/config-eslint": "0.1.181",
|
|
51
|
+
"@jskit-ai/jskit-catalog": "0.1.209",
|
|
52
52
|
"@playwright/test": "1.61.1",
|
|
53
53
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
54
54
|
"eslint": "^10.8.0",
|
|
@@ -40,6 +40,31 @@ Use `@jskit-ai/auth-provider-supabase-core` for the provider and
|
|
|
40
40
|
`@jskit-ai/auth-core` policy contracts. Configure `config.auth` through the
|
|
41
41
|
application's ordinary server configuration.
|
|
42
42
|
|
|
43
|
+
## Provider login policy and prerelease migration
|
|
44
|
+
|
|
45
|
+
Provider-specific login query parameters belong to the application. For example,
|
|
46
|
+
an application choosing Google's account picker can configure:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
const config = {
|
|
50
|
+
auth: {
|
|
51
|
+
oauth: {
|
|
52
|
+
providers: ["google"],
|
|
53
|
+
defaultProvider: "google",
|
|
54
|
+
queryParams: { google: { prompt: "select_account" } }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Pre-release applications that relied on the previous implicit Google
|
|
61
|
+
`select_account` parameter must add this configuration if they want to retain
|
|
62
|
+
that behavior. The runtime no longer supplies it automatically. This is a manual
|
|
63
|
+
V0 migration; there is no fallback to the old policy. These values control the
|
|
64
|
+
Supabase login flow. They do not configure a Gmail API connection or confer
|
|
65
|
+
mailbox permissions. The application still owns its identity and account-linking
|
|
66
|
+
policy, while connectors manage separately authorized provider access.
|
|
67
|
+
|
|
43
68
|
## Example files
|
|
44
69
|
|
|
45
70
|
`example/package.json` declares the selected provider. `example/.env.example`
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: connectors/ai-connections
|
|
3
|
+
title: App-owned AI connections and static model selection
|
|
4
|
+
summary: Resolve an administrator environment key or an individual user's grant, then use the application's chosen AI SDK directly.
|
|
5
|
+
keywords: ai, models, free, big-pickle, zen, zai, environment, api-key, ownership, cli
|
|
6
|
+
requires: @jskit-ai/connectors-core, @jskit-ai/connectors-catalog
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# App-owned AI connections and static model selection
|
|
10
|
+
|
|
11
|
+
## Use when
|
|
12
|
+
|
|
13
|
+
Use the [AI guide](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/connectors-catalog/docs/ai.md) to choose the model, account owner and
|
|
14
|
+
framework SDK before wiring requests. The shared catalogue is a deliberate
|
|
15
|
+
static extraction, not an OpenCode runtime integration. The default Big Pickle
|
|
16
|
+
route needs no account, user key or environment setup.
|
|
17
|
+
|
|
18
|
+
## Framework APIs
|
|
19
|
+
|
|
20
|
+
The imported library validates configuration and resolves authorized server-side
|
|
21
|
+
parameters. The example only composes those parameters with an **app-supplied**
|
|
22
|
+
model factory. It does not implement inference or install an SDK. Pass a factory
|
|
23
|
+
for the returned provider/protocol; do not treat every model as chat completions.
|
|
24
|
+
|
|
25
|
+
## Product decisions
|
|
26
|
+
|
|
27
|
+
For a CLI app, read and validate `integrations.json`, use a trusted local
|
|
28
|
+
operator policy and your normal private environment. For a web app, derive
|
|
29
|
+
identity from its authenticated server session and explicitly authorize shared
|
|
30
|
+
account use. Never adapt a permissive CLI policy into a public HTTP endpoint.
|
|
31
|
+
|
|
32
|
+
## Invariants
|
|
33
|
+
|
|
34
|
+
Administrator keys use `env:APP_AI_API_KEY`; the existing environment resolver
|
|
35
|
+
is the default. Individual keys use an app-owned reference and a resolver scoped
|
|
36
|
+
to authorized application, user, provider and integration. The application owns
|
|
37
|
+
key-entry and disconnect screens. Never return connection parameters to a
|
|
38
|
+
browser or share coding-agent subscription credentials.
|
|
39
|
+
|
|
40
|
+
## Do not use when
|
|
41
|
+
|
|
42
|
+
Frameworks outside Node follow their own configuration and AI client patterns.
|
|
43
|
+
These provider facts and the text file are portable; this JavaScript example is
|
|
44
|
+
not a dependency that Laravel or another framework must install.
|
|
45
|
+
|
|
46
|
+
## Example files
|
|
47
|
+
|
|
48
|
+
- `example/ai-model.js` composes the connection resolver with an app-owned SDK factory.
|
|
49
|
+
|
|
50
|
+
## Variation points
|
|
51
|
+
|
|
52
|
+
Choose shared Env or an authenticated individual-key resolver, then provide the
|
|
53
|
+
SDK factory for the selected provider. The application owns prompts, request
|
|
54
|
+
limits, streaming, tools and user-visible provider failures.
|
|
55
|
+
|
|
56
|
+
## Verification
|
|
57
|
+
|
|
58
|
+
Verify with controlled SDK factories and private test keys. Do not call live
|
|
59
|
+
inference or generate/deploy a sample application to prove configuration wiring.
|
|
60
|
+
|
|
61
|
+
## Avoid
|
|
62
|
+
|
|
63
|
+
Do not add a runtime catalogue fetch, token billing, an inference proxy, a
|
|
64
|
+
cross-language runtime or a silent paid fallback. Never infer that a model
|
|
65
|
+
marked free can be used without the authentication its provider requires.
|
|
66
|
+
|
|
67
|
+
## Existing Perplexity connector slots
|
|
68
|
+
|
|
69
|
+
Use `example/perplexity-answer.js` when configuration already has provider
|
|
70
|
+
`perplexity`. It reads that exact slot, authorizes the caller, resolves its private
|
|
71
|
+
reference and passes it to an app-supplied OpenAI-compatible SDK factory.
|
|
72
|
+
It neither creates another `ai` slot nor stores another copy of the key.
|
|
73
|
+
The app installs its own native SDK, for example `openai`, and supplies
|
|
74
|
+
`createClient: options => new OpenAI(options)`. No SDK is a dependency of this
|
|
75
|
+
connector package. Call the returned function with context, integrationId,
|
|
76
|
+
question, current provider model name and optional stream/signal.
|
|
77
|
+
For a normal result render choices[0].message.content with citations and
|
|
78
|
+
search_results. For stream=true consume the async iterator, rendering deltas
|
|
79
|
+
and retaining final citations/search_results; cancel with AbortSignal.
|
|
80
|
+
Allow only safe HTTP(S) links in rendered citations. Never send the API key/client
|
|
81
|
+
to a browser. A public route must sanitize SDK failures and enforce app budgets.
|
|
82
|
+
This is direct app-to-provider traffic, with no Vibe64 token sales or proxy.
|
|
83
|
+
A trusted CLI operator can use the same JSON/Env and factory. Other frameworks
|
|
84
|
+
use their own native Perplexity/OpenAI-compatible clients and the same slot.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createAiConnectionResolver } from "@jskit-ai/connectors-catalog/server/ai";
|
|
2
|
+
|
|
3
|
+
// App-owned composition. Supply the authenticated authorization policy and the
|
|
4
|
+
// SDK model factory used by this application. Omit resolveReference for Env.
|
|
5
|
+
export function createConfiguredAiModel({ configuration, authorize, resolveReference, createModel }) {
|
|
6
|
+
const connections = createAiConnectionResolver({ configuration, authorize, resolveReference });
|
|
7
|
+
return async ({ context, integrationId }) => {
|
|
8
|
+
const parameters = await connections.resolve({ context, integrationId });
|
|
9
|
+
return createModel(parameters); // Backend only; the app owns subsequent inference.
|
|
10
|
+
};
|
|
11
|
+
}
|
package/skills/jskit/references/patterns/connectors/ai-connections/example/perplexity-answer.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ConnectorError, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
2
|
+
import { validateIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
3
|
+
import { perplexityProvider } from "@jskit-ai/connectors-catalog/server/perplexity";
|
|
4
|
+
|
|
5
|
+
// App-owned composition, not an inference service. Supply the application's native
|
|
6
|
+
// OpenAI-compatible client factory. Credentials and the returned client stay server-side.
|
|
7
|
+
export function createPerplexityAnswers({ configuration, authorize, createClient,
|
|
8
|
+
resolveReference = createEnvironmentReferenceResolver() }) {
|
|
9
|
+
if (typeof authorize !== "function" || typeof createClient !== "function") throw new TypeError("Supply application authorization and its native client factory.");
|
|
10
|
+
const config = validateIntegrationConfiguration(configuration, { providers: [perplexityProvider], allowUnknownProviders: true });
|
|
11
|
+
return async ({ context, integrationId, question, model, stream = false, signal }) => {
|
|
12
|
+
const slot = Object.hasOwn(config.integrations, integrationId) ? config.integrations[integrationId] : null;
|
|
13
|
+
if (slot?.provider !== "perplexity") throw new ConnectorError("connector_not_found", "Configure a Perplexity slot.", { statusCode: 404 });
|
|
14
|
+
const owner = await authorize(context, { integrationId, accountMode: slot.accountMode, operation: "perplexity.answer", input: { question, model, stream } });
|
|
15
|
+
if (!owner?.applicationId || !owner?.subjectId) throw new ConnectorError("connector_access_denied", "Perplexity access was denied.", { statusCode: 403 });
|
|
16
|
+
if (typeof question !== "string" || !question.trim() || question.length > 20000 || typeof model !== "string" || !model.trim() || model.length > 200 || typeof stream !== "boolean")
|
|
17
|
+
throw new ConnectorError("connector_input_invalid", "Supply a question, provider model name and boolean stream flag.", { statusCode: 422 });
|
|
18
|
+
signal?.throwIfAborted();
|
|
19
|
+
let apiKey;
|
|
20
|
+
try {
|
|
21
|
+
apiKey = await resolveReference(slot.authentication.secretRef, owner, { integrationId, accountMode: slot.accountMode, providerId: "perplexity" });
|
|
22
|
+
if (typeof apiKey !== "string" || !apiKey.trim() || apiKey.trim() === "MISSING" || /[\r\n\0]/.test(apiKey) || apiKey.length > 16384) throw new Error();
|
|
23
|
+
} catch { throw new ConnectorError("connector_binding_missing", "Set this Perplexity credential in the application's private Env.", { statusCode: 422 }); }
|
|
24
|
+
const client = createClient({ apiKey, baseURL: "https://api.perplexity.ai", maxRetries: 0, timeout: 60000 });
|
|
25
|
+
// Preserve citations/search_results/usage and streaming chunks. The application
|
|
26
|
+
// renders them, accounts for usage and sanitizes failures at its HTTP boundary.
|
|
27
|
+
return client.chat.completions.create({ model, messages: [{ role: "user", content: question }], stream }, { signal });
|
|
28
|
+
};
|
|
29
|
+
}
|