howone 0.1.22 → 0.1.25

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 (26) hide show
  1. package/package.json +1 -1
  2. package/templates/nextjs/lib/sdk.ts +3 -0
  3. package/templates/vite/.howone/skills/howone-sdk/01-architect/01-app-generation.md +183 -69
  4. package/templates/vite/.howone/skills/howone-sdk/01-architect/02-manifest-codegen.md +98 -23
  5. package/templates/vite/.howone/skills/howone-sdk/02-database/01-schema-design.md +463 -69
  6. package/templates/vite/.howone/skills/howone-sdk/02-database/02-schema-operations.md +366 -64
  7. package/templates/vite/.howone/skills/howone-sdk/02-database/03-data-access-patterns.md +204 -67
  8. package/templates/vite/.howone/skills/howone-sdk/02-database/04-query-dsl-and-responses.md +237 -0
  9. package/templates/vite/.howone/skills/howone-sdk/02-database/05-ai-persistence-patterns.md +372 -0
  10. package/templates/vite/.howone/skills/howone-sdk/03-sdk/01-client-setup.md +58 -36
  11. package/templates/vite/.howone/skills/howone-sdk/03-sdk/02-entity-operations.md +67 -0
  12. package/templates/vite/.howone/skills/howone-sdk/03-sdk/03-auth.md +267 -469
  13. package/templates/vite/.howone/skills/howone-sdk/03-sdk/04-react-integration.md +113 -322
  14. package/templates/vite/.howone/skills/howone-sdk/03-sdk/07-ai-action-calls.md +95 -48
  15. package/templates/vite/.howone/skills/howone-sdk/03-sdk/08-extension-boundaries.md +226 -0
  16. package/templates/vite/.howone/skills/howone-sdk/04-ai/01-ai-capability-architecture.md +205 -0
  17. package/templates/vite/.howone/skills/howone-sdk/04-ai/02-workflow-contract-rules.md +426 -0
  18. package/templates/vite/.howone/skills/howone-sdk/04-ai/03-ai-sdk-handoff.md +219 -0
  19. package/templates/vite/.howone/skills/howone-sdk/04-ai/04-service-capability-catalog.md +281 -0
  20. package/templates/vite/.howone/skills/howone-sdk/04-ai/05-workflow-operations.md +256 -0
  21. package/templates/vite/.howone/skills/howone-sdk/04-ai/06-ai-feature-playbooks.md +296 -0
  22. package/templates/vite/.howone/skills/howone-sdk/SKILL.md +83 -15
  23. package/templates/vite/.howone/skills/howone-sdk/agents/openai.yaml +2 -2
  24. package/templates/vite/package.json +1 -1
  25. package/templates/vite/src/lib/sdk.ts +3 -0
  26. package/templates/vite/.howone/skills/howone-sdk/04-ai/.gitkeep +0 -1
@@ -0,0 +1,281 @@
1
+ # Service Capability Catalog
2
+
3
+ Use this reference before designing an AI workflow. It tells the agent what the current workflow
4
+ service can actually do and what input/output shapes are expected.
5
+
6
+ Source: `docs/ai-capability.md`.
7
+
8
+ ## Quick Selection Table
9
+
10
+ | User asks for | Use capability family | Typical inputs | Typical outputs |
11
+ |---|---|---|---|
12
+ | Latest info, research, source-backed answer | Web search / crawling | `topic`, `prompt`, `url`, `search_level` | `answer`, `sources`, `page_content` |
13
+ | Generate artwork/photo/logo/mockup | Image generation | `image_description`, `style_preference`, optional references | `generated_image_url` |
14
+ | Edit an image | Image editing | `source_image_url`, `edit_instruction` | `edited_image_url` |
15
+ | OCR or visual analysis | Image analysis / OCR | `image_urls`, `analysis_prompt` | `analysis_result` or `extracted_text` |
16
+ | Generate short video | Video generation | `video_prompt`, aspect/duration/frame URLs | `video_url` |
17
+ | Join clips / extract frames | Video editing | `video_urls` or `video_url` | `video_url` or `image_url` |
18
+ | Text to speech | Audio generation | `text_to_generate`, `language`, `voice_hint` | `audio_url` |
19
+ | Speech to text | Audio recognition | `source_audio_url`, `language` | `transcript_text`, optional `utterances` |
20
+ | Merge audio | Audio merging | `audio_urls` | `merged_audio_url` |
21
+ | Stock/index history | Financial data retrieval | `trading_symbol`, `unit`, `start`, `end` | `price_history` |
22
+ | Literature search/citations | Academic research | `query` | `papers`, `bibtex` |
23
+ | Save generated file | File storage | `file_type`, `content` | `file_url` |
24
+
25
+ If the requested behavior is not in this table or the detailed sections below, do not invent it.
26
+
27
+ ## Web Search And Crawling
28
+
29
+ Use for latest information, news, market context, source-backed answers, web page extraction.
30
+
31
+ Inputs:
32
+
33
+ - `prompt`: query or detailed research instruction;
34
+ - `search_level`: `low`, `medium`, or `high`; default to medium;
35
+ - `offset`: pagination for low-level search;
36
+ - page crawl input should be a URL.
37
+
38
+ Outputs:
39
+
40
+ - synthesized answer or raw search result;
41
+ - `sources` array of URLs;
42
+ - crawled page text/markdown when crawling.
43
+
44
+ Rules:
45
+
46
+ - Use web search when the user asks for current/latest information.
47
+ - Use page crawling when the product needs content from a specific URL.
48
+ - Do not use search as an outbound API caller.
49
+ - Include source links in output when the product promises research.
50
+
51
+ ## Image Generation
52
+
53
+ Use for new images from prompts or prompt + reference URLs.
54
+
55
+ Inputs:
56
+
57
+ - `image_description`: detailed prompt;
58
+ - `style_preference`: optional;
59
+ - `reference_image_urls`: optional URL array;
60
+ - size/format options only when product exposes them.
61
+
62
+ Outputs:
63
+
64
+ - `generated_image_url` or `image_urls`;
65
+ - avoid metadata unless product needs it.
66
+
67
+ Rules:
68
+
69
+ - One image per request is usually more reliable.
70
+ - Do not put resolution text into the prompt when a size parameter exists.
71
+ - Reference images must be URLs and should be described by position/content.
72
+ - Subject to moderation; do not promise forbidden content.
73
+
74
+ ## Image Editing
75
+
76
+ Use for modifying existing images.
77
+
78
+ Inputs:
79
+
80
+ - `source_image_url` or `source_image_urls`;
81
+ - `edit_instruction`;
82
+ - optional output size/format.
83
+
84
+ Outputs:
85
+
86
+ - `edited_image_url`.
87
+
88
+ Supported edits include resize/crop/rotate, background removal/replacement, object removal/addition,
89
+ style transfer, enhancement, merge/composite, lighting/color changes.
90
+
91
+ Rules:
92
+
93
+ - At least one image URL is required.
94
+ - Keep edit instructions focused.
95
+ - For complex multi-step edits, describe the final desired result.
96
+
97
+ ## Image Analysis And OCR
98
+
99
+ Use for visual understanding, image comparison, text extraction, quality review.
100
+
101
+ Inputs:
102
+
103
+ - `image_urls`;
104
+ - `analysis_prompt` or `ocr_instruction`.
105
+
106
+ Outputs:
107
+
108
+ - `analysis_result` for semantic analysis;
109
+ - `extracted_text` for OCR.
110
+
111
+ Rules:
112
+
113
+ - Ask for the exact information needed.
114
+ - Do not include confidence/bounding boxes unless user asks.
115
+ - OCR quality depends on image quality.
116
+
117
+ ## Video Generation
118
+
119
+ Use for short video clips from text or image frames.
120
+
121
+ Inputs:
122
+
123
+ - `video_prompt`;
124
+ - optional `first_frame_url`, `last_frame_url`, `reference_image_urls`;
125
+ - optional `aspect_ratio`, `duration`, `negative_prompt`, `generate_audio`.
126
+
127
+ Outputs:
128
+
129
+ - `video_url`.
130
+
131
+ Rules:
132
+
133
+ - Keep individual clips short, generally 5-10 seconds.
134
+ - For consistency, generate/use a first-frame image.
135
+ - For longer videos, generate clips and concatenate via video editing.
136
+ - Audio in video works best with one speaker per clip.
137
+
138
+ ## Video Editing
139
+
140
+ Use for concatenating clips or extracting first/last frames.
141
+
142
+ Inputs:
143
+
144
+ - concatenate: `video_urls` with at least two URLs;
145
+ - frame extraction: `source_video_url`.
146
+
147
+ Outputs:
148
+
149
+ - `merged_video_url` or `frame_image_url`.
150
+
151
+ Rules:
152
+
153
+ - Inputs must be accessible URLs.
154
+ - Best results when clips share resolution/aspect ratio.
155
+
156
+ ## Audio Generation
157
+
158
+ Use for text-to-speech.
159
+
160
+ Inputs:
161
+
162
+ - `text_to_generate`;
163
+ - `language` or `languages`;
164
+ - `gender`;
165
+ - `audio_hint`;
166
+ - optional output format/name.
167
+
168
+ Outputs:
169
+
170
+ - `audio_url`.
171
+
172
+ Rules:
173
+
174
+ - Single speaker per call.
175
+ - For dialogue, generate each speaker line and merge audio.
176
+ - `audio_hint` should describe voice in English.
177
+
178
+ ## Audio Recognition
179
+
180
+ Use for speech-to-text.
181
+
182
+ Inputs:
183
+
184
+ - `source_audio_url`;
185
+ - optional `language`;
186
+ - optional speaker diarization setting.
187
+
188
+ Outputs:
189
+
190
+ - `transcript_text`;
191
+ - optional `utterances` when speaker info is requested.
192
+
193
+ Rules:
194
+
195
+ - Audio must be URL-accessible.
196
+ - Silent or low-quality audio can produce empty/poor transcript.
197
+
198
+ ## Financial Data Retrieval
199
+
200
+ Use for historical stock/index price data.
201
+
202
+ Inputs:
203
+
204
+ - `trading_symbol`;
205
+ - `unit`: `daily` or `minute`;
206
+ - `start`;
207
+ - `end`.
208
+
209
+ Outputs:
210
+
211
+ - `price_history` array;
212
+ - `trading_symbol`;
213
+ - optional warning.
214
+
215
+ Rules:
216
+
217
+ - Historical data only; no real-time streaming.
218
+ - Indices usually support daily data only.
219
+ - Ask for exact tickers when possible.
220
+ - Does not provide fundamentals, earnings, or live news unless combined with web search.
221
+
222
+ ## Academic Research
223
+
224
+ Use for literature search, paper metadata, BibTeX.
225
+
226
+ Inputs:
227
+
228
+ - `query`.
229
+
230
+ Outputs:
231
+
232
+ - `papers`;
233
+ - `bibtex` when citation output is requested.
234
+
235
+ Rules:
236
+
237
+ - Search quality depends on query specificity.
238
+ - Availability varies by academic source.
239
+ - PDF assets should be handled as URLs.
240
+
241
+ ## File Storage
242
+
243
+ Use when workflow needs to save generated content into a file.
244
+
245
+ Inputs:
246
+
247
+ - `file_type`: `json`, `yaml`, `csv`, `pdf`, `md`, or `txt`;
248
+ - `content`: string content to save.
249
+
250
+ Outputs:
251
+
252
+ - `file_url`.
253
+
254
+ Rules:
255
+
256
+ - Structured content must be serialized to string before saving.
257
+ - Do not use file storage as a database.
258
+ - If app needs records/history, persist file URL through entities.
259
+
260
+ ## Composition Patterns
261
+
262
+ | Pattern | Workflow design |
263
+ |---|---|
264
+ | Image -> Video | generate first-frame image, pass as `first_frame_url` to video generation |
265
+ | Multi-clip video | generate short clips, concatenate via video editing |
266
+ | Dialogue audio | generate each speaker line, merge audio |
267
+ | Search -> Report | web search/crawl, synthesize structured report, optionally save file |
268
+ | Video -> Image edit -> Video | extract frame, edit frame, use as next reference |
269
+ | RAG document chat | indexing workflow + query workflow |
270
+
271
+ ## Capability Rejection Checklist
272
+
273
+ Stop or narrow scope if user requires:
274
+
275
+ - real-time streaming market data;
276
+ - arbitrary external API calls not listed;
277
+ - raw file bytes/base64 in workflow;
278
+ - database CRUD inside workflow;
279
+ - unsupported provider-specific model guarantees;
280
+ - content disallowed by moderation;
281
+ - long video generation in one call beyond service limits.
@@ -0,0 +1,256 @@
1
+ # Workflow Operations
2
+
3
+ Use this reference when submitting or checking external workflow create/update operations.
4
+
5
+ Source: `docs/ai-worlfow-guide-schema.md`.
6
+
7
+ ## Endpoints
8
+
9
+ | Purpose | Method | Path |
10
+ |---|---|---|
11
+ | Submit create/update operations | `POST` | `/workflow/{project_short_id}/operate` |
12
+ | Check operation status | `GET` | `/workflow/status_check/{request_id}` |
13
+
14
+ All requests require `Authorization: Bearer <token>`.
15
+
16
+ ## Operation Object
17
+
18
+ ```json
19
+ {
20
+ "appId": "proj_docs",
21
+ "workflowId": "550e8400-e29b-41d4-a716-446655440000",
22
+ "mode": "create",
23
+ "capability": {
24
+ "name": "summarizeDocument",
25
+ "description": "Reads an uploaded document and produces a concise summary highlighting the key points.",
26
+ "inputSchema": {},
27
+ "outputSchema": {},
28
+ "outputEntityName": "DocumentSummary"
29
+ },
30
+ "requestMeta": {}
31
+ }
32
+ ```
33
+
34
+ Field rules:
35
+
36
+ | Field | Required | Notes |
37
+ |---|---:|---|
38
+ | `appId` | yes | Must match path project short ID. |
39
+ | `workflowId` | yes | UUID v4 from manifest/capability contract. |
40
+ | `mode` | yes | `"create"` or `"update"`. |
41
+ | `capability` | yes | Synced capability contract. |
42
+ | `workflowConfigID` | update only | Comes from completed status result. |
43
+ | `updatePrompt` | update only | Natural language behavior change request. |
44
+ | `requestMeta` | no | Optional execution metadata. |
45
+
46
+ Do not hand-copy stale schemas. Submit from synced `.howone/ai/manifest.json` whenever possible.
47
+
48
+ ## Create Request
49
+
50
+ ```json
51
+ {
52
+ "operations": [
53
+ {
54
+ "appId": "proj_docs",
55
+ "workflowId": "550e8400-e29b-41d4-a716-446655440000",
56
+ "mode": "create",
57
+ "capability": {
58
+ "name": "summarizeDocument",
59
+ "description": "Reads an uploaded document and produces a concise summary highlighting the key points.",
60
+ "inputSchema": {
61
+ "type": "object",
62
+ "properties": {
63
+ "document_url": {
64
+ "type": "string",
65
+ "format": "uri",
66
+ "description": "Supabase Storage URL of the uploaded document."
67
+ },
68
+ "summary_length": {
69
+ "type": "string",
70
+ "description": "Desired summary length, e.g. short, medium, long, or a specific sentence count."
71
+ }
72
+ },
73
+ "required": ["document_url"]
74
+ },
75
+ "outputSchema": {
76
+ "type": "object",
77
+ "properties": {
78
+ "summary": {
79
+ "type": "string",
80
+ "description": "The generated summary in the same language as the source document."
81
+ }
82
+ },
83
+ "required": ["summary"]
84
+ },
85
+ "outputEntityName": "DocumentSummary"
86
+ },
87
+ "requestMeta": {}
88
+ }
89
+ ]
90
+ }
91
+ ```
92
+
93
+ Create response:
94
+
95
+ ```json
96
+ {
97
+ "request_ids": [
98
+ {
99
+ "request_id": "req_abc123",
100
+ "workflow_id": "550e8400-e29b-41d4-a716-446655440000",
101
+ "workflow_config_id": null,
102
+ "operation_type": "generate"
103
+ }
104
+ ]
105
+ }
106
+ ```
107
+
108
+ Store every `request_id`.
109
+
110
+ ## Update Request
111
+
112
+ Use update when the external workflow implementation already exists.
113
+
114
+ ```json
115
+ {
116
+ "operations": [
117
+ {
118
+ "appId": "proj_docs",
119
+ "workflowId": "550e8400-e29b-41d4-a716-446655440000",
120
+ "workflowConfigID": "cfg_xyz789",
121
+ "mode": "update",
122
+ "capability": {
123
+ "name": "summarizeDocument",
124
+ "description": "Reads an uploaded document and produces a concise summary. Supports paragraph or bullet-point format.",
125
+ "inputSchema": {
126
+ "type": "object",
127
+ "properties": {
128
+ "document_url": {
129
+ "type": "string",
130
+ "format": "uri",
131
+ "description": "Supabase Storage URL of the uploaded document."
132
+ },
133
+ "output_format": {
134
+ "type": "string",
135
+ "description": "Format of the summary output: paragraphs or bullet_points."
136
+ }
137
+ },
138
+ "required": ["document_url"]
139
+ },
140
+ "outputSchema": {
141
+ "type": "object",
142
+ "properties": {
143
+ "summary": {
144
+ "type": "string",
145
+ "description": "The generated summary in the requested format and same language as the source document."
146
+ }
147
+ },
148
+ "required": ["summary"]
149
+ },
150
+ "outputEntityName": "DocumentSummary"
151
+ },
152
+ "updatePrompt": "Add support for optional bullet-point summary output through output_format.",
153
+ "requestMeta": {}
154
+ }
155
+ ]
156
+ }
157
+ ```
158
+
159
+ Update response has `operation_type: "edit"`.
160
+
161
+ ## Status Polling
162
+
163
+ ```text
164
+ POST /workflow/{project_short_id}/operate
165
+ -> request_ids[]
166
+
167
+ GET /workflow/status_check/{request_id}
168
+ -> queued/running/completed/failed
169
+ ```
170
+
171
+ Poll every 2-5 seconds until terminal.
172
+
173
+ Status values:
174
+
175
+ | Status | Meaning | Action |
176
+ |---|---|---|
177
+ | `queued` | waiting | continue polling |
178
+ | `running` | being generated/edited | continue polling |
179
+ | `completed` | operation finished | inspect `payload.success` |
180
+ | `failed` | system failure | report/display error |
181
+
182
+ Completed success:
183
+
184
+ ```json
185
+ {
186
+ "success": true,
187
+ "jobId": "req_abc123",
188
+ "status": "completed",
189
+ "payload": {
190
+ "success": true,
191
+ "workflow_details": {
192
+ "workflow_graph": {},
193
+ "new_workflow_config_id": "cfg_xyz789"
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ Completed business failure:
200
+
201
+ ```json
202
+ {
203
+ "success": true,
204
+ "status": "completed",
205
+ "payload": {
206
+ "success": false,
207
+ "display_error_message": "Unable to generate workflow: the requested capability is not supported.",
208
+ "full_error_message": "Detailed internal error..."
209
+ }
210
+ }
211
+ ```
212
+
213
+ System failure:
214
+
215
+ ```json
216
+ {
217
+ "success": true,
218
+ "status": "failed",
219
+ "payload": {
220
+ "success": false,
221
+ "display_error_message": "Service temporarily unavailable.",
222
+ "full_error_message": "Timeout after 120s waiting for LLM response."
223
+ }
224
+ }
225
+ ```
226
+
227
+ On success, persist:
228
+
229
+ - `request_id`;
230
+ - `workflowId`;
231
+ - `new_workflow_config_id`;
232
+ - capability name;
233
+ - mode;
234
+ - any status/error useful for future update.
235
+
236
+ ## Agent Handoff Notes
237
+
238
+ When another tool/layer owns submission:
239
+
240
+ - provide the synced capability name and manifest path;
241
+ - do not rewrite raw schemas if the tool can load manifest;
242
+ - preserve returned request IDs;
243
+ - after status success, preserve `workflowConfigID` for future edits;
244
+ - regenerate SDK only after manifest changes, not after behavior-only workflow edits.
245
+
246
+ ## Operation Checklist
247
+
248
+ - Manifest is synced before submit.
249
+ - `appId` matches path project ID.
250
+ - `workflowId` is a UUID.
251
+ - `mode=create` omits `workflowConfigID`.
252
+ - `mode=update` includes confirmed `workflowConfigID`.
253
+ - `updatePrompt` says what to change, not a whole new fake schema.
254
+ - Request IDs are stored.
255
+ - Status is polled to terminal.
256
+ - Business failure and system failure are handled differently.