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,296 @@
1
+ # AI Feature Playbooks
2
+
3
+ Use this reference when turning a user request into concrete HowOne AI capabilities, database
4
+ entities, and SDK calls.
5
+
6
+ ## Playbook: Document Summary
7
+
8
+ Use when user uploads or links a document and wants a summary.
9
+
10
+ Capability:
11
+
12
+ ```json
13
+ {
14
+ "name": "summarizeDocument",
15
+ "description": "Reads an uploaded document and produces a concise summary highlighting the key points.",
16
+ "inputSchema": {
17
+ "type": "object",
18
+ "properties": {
19
+ "document_url": {
20
+ "type": "string",
21
+ "format": "uri",
22
+ "description": "Supabase Storage URL of the uploaded document."
23
+ },
24
+ "summary_length": {
25
+ "type": "string",
26
+ "description": "Desired summary length, e.g. short, medium, long, or a specific sentence count."
27
+ }
28
+ },
29
+ "required": ["document_url"]
30
+ },
31
+ "outputSchema": {
32
+ "type": "object",
33
+ "properties": {
34
+ "summary": {
35
+ "type": "string",
36
+ "description": "Summary in the same language as the source document."
37
+ }
38
+ },
39
+ "required": ["summary"]
40
+ },
41
+ "outputEntityName": "DocumentSummary"
42
+ }
43
+ ```
44
+
45
+ Persistence:
46
+
47
+ - private `DocumentSummary` if user history is needed;
48
+ - fields: `documentUrl`, `summary`, `status`, `errorMessage`, `requestedAt`, `completedAt`.
49
+
50
+ SDK:
51
+
52
+ ```ts
53
+ const output = await howone.ai.summarizeDocument.run({ document_url: fileUrl })
54
+ ```
55
+
56
+ ## Playbook: Image Generator
57
+
58
+ Use for prompt-to-image products.
59
+
60
+ Capability:
61
+
62
+ ```json
63
+ {
64
+ "name": "generateImage",
65
+ "description": "Generates an image based on a natural language description provided by the user.",
66
+ "inputSchema": {
67
+ "type": "object",
68
+ "properties": {
69
+ "image_description": {
70
+ "type": "string",
71
+ "description": "Detailed description of the image to generate, including subject, style, mood, and composition."
72
+ },
73
+ "style_preference": {
74
+ "type": "string",
75
+ "description": "Optional style preference such as watercolor, photorealistic, anime, or flat design."
76
+ }
77
+ },
78
+ "required": ["image_description"]
79
+ },
80
+ "outputSchema": {
81
+ "type": "object",
82
+ "properties": {
83
+ "generated_image_url": {
84
+ "type": "string",
85
+ "format": "uri",
86
+ "description": "Public URL of the generated image."
87
+ }
88
+ },
89
+ "required": ["generated_image_url"]
90
+ },
91
+ "outputEntityName": "GeneratedImage"
92
+ }
93
+ ```
94
+
95
+ Persistence:
96
+
97
+ - use `Generation` for private history;
98
+ - public share requires separate `SharedGeneration`.
99
+
100
+ SDK:
101
+
102
+ ```ts
103
+ await runAiActionAndPersist({
104
+ entity: howone.entities.Generation,
105
+ input: { image_description, style_preference },
106
+ createPending: (input) => ({
107
+ prompt: input.image_description,
108
+ style: input.style_preference ?? null,
109
+ status: 'pending',
110
+ requestedAt: new Date().toISOString(),
111
+ }),
112
+ run: (input) => howone.ai.generateImage.run(input),
113
+ mapCompleted: ({ output }) => ({
114
+ status: 'completed',
115
+ resultUrl: output.generated_image_url,
116
+ completedAt: new Date().toISOString(),
117
+ }),
118
+ })
119
+ ```
120
+
121
+ ## Playbook: Image Editor
122
+
123
+ Use when user uploads/selects an image and describes edits.
124
+
125
+ Inputs:
126
+
127
+ - `source_image_url`;
128
+ - `edit_instruction`.
129
+
130
+ Output:
131
+
132
+ - `edited_image_url`.
133
+
134
+ Rules:
135
+
136
+ - app uploads source file first;
137
+ - workflow receives URL only;
138
+ - keep edit instruction focused;
139
+ - persist both original and edited URLs if history matters.
140
+
141
+ ## Playbook: News/Research Briefing
142
+
143
+ Use for latest info or source-backed research.
144
+
145
+ Inputs:
146
+
147
+ - `topic`;
148
+ - optional `language`;
149
+ - optional `depth` as loose string, not strict enum unless UI really has fixed modes.
150
+
151
+ Output:
152
+
153
+ - structured `briefing` object with `summary` and `sources`.
154
+
155
+ Rules:
156
+
157
+ - use web search/crawling capability;
158
+ - include source URLs;
159
+ - output descriptions must specify language;
160
+ - if user asks for latest/current, this workflow must retrieve data internally.
161
+
162
+ ## Playbook: Stock Analysis
163
+
164
+ Use for historical price analysis.
165
+
166
+ Inputs:
167
+
168
+ - `trading_symbol`;
169
+ - `start`;
170
+ - `end`;
171
+ - `unit`: daily/minute when UI exposes it.
172
+
173
+ Output:
174
+
175
+ - `analysis`;
176
+ - optional `price_history` only if app renders chart from workflow output.
177
+
178
+ Rules:
179
+
180
+ - do not ask user for CSV unless they explicitly have data;
181
+ - historical only, no real-time streaming;
182
+ - combine with web search only if user asks for news/context.
183
+
184
+ ## Playbook: Academic Literature Review
185
+
186
+ Use for paper search and bibliography.
187
+
188
+ Inputs:
189
+
190
+ - `query`;
191
+ - optional `language` for synthesized review;
192
+ - optional `citation_style`.
193
+
194
+ Outputs:
195
+
196
+ - `papers`;
197
+ - `review_summary`;
198
+ - `bibtex` if citations are needed.
199
+
200
+ Rules:
201
+
202
+ - do not promise full PDF availability;
203
+ - keep paper metadata fields useful and minimal;
204
+ - use source URLs/DOIs when returned.
205
+
206
+ ## Playbook: Audio Transcription
207
+
208
+ Use for speech-to-text.
209
+
210
+ Inputs:
211
+
212
+ - `source_audio_url`;
213
+ - optional `language`;
214
+ - optional `with_speaker_info`.
215
+
216
+ Outputs:
217
+
218
+ - `transcript_text`;
219
+ - optional `utterances`.
220
+
221
+ Rules:
222
+
223
+ - app uploads audio first;
224
+ - workflow receives URL;
225
+ - if speaker diarization is not required, do not add utterances.
226
+
227
+ ## Playbook: Text To Speech
228
+
229
+ Use for generating spoken audio from text.
230
+
231
+ Inputs:
232
+
233
+ - `text_to_generate`;
234
+ - `language`;
235
+ - optional `gender`;
236
+ - optional `audio_hint`.
237
+
238
+ Output:
239
+
240
+ - `audio_url`.
241
+
242
+ Rules:
243
+
244
+ - single speaker per call;
245
+ - dialogue should generate multiple clips and merge;
246
+ - persist audio URL through entity if user needs library/history.
247
+
248
+ ## Playbook: Video Generator
249
+
250
+ Use for short video creation.
251
+
252
+ Inputs:
253
+
254
+ - `video_prompt`;
255
+ - optional `first_frame_url`;
256
+ - optional `aspect_ratio`;
257
+ - optional `duration`.
258
+
259
+ Output:
260
+
261
+ - `video_url`.
262
+
263
+ Rules:
264
+
265
+ - keep one clip short;
266
+ - for longer output, compose multiple clips and concatenate;
267
+ - first-frame image helps consistency.
268
+
269
+ ## RAG Playbook
270
+
271
+ Use only when app needs question answering over user/project documents.
272
+
273
+ Workflows:
274
+
275
+ 1. `indexDocuments`
276
+ - input: document URLs or collection reference;
277
+ - output: indexing result/status.
278
+ 2. `queryKnowledgeBase`
279
+ - input: question + knowledge base reference;
280
+ - output: answer + sources.
281
+
282
+ Rules:
283
+
284
+ - RAG is the only standard two-workflow exception.
285
+ - Do not re-index on every question.
286
+ - Persist document/index status in entities if app needs history or dashboard.
287
+
288
+ ## Feature Design Checklist
289
+
290
+ - Choose one playbook or clearly combine compatible playbooks.
291
+ - Verify capability exists in `04-service-capability-catalog.md`.
292
+ - Use URL inputs for files/media.
293
+ - Keep outputs minimal and product-facing.
294
+ - Decide persistence separately.
295
+ - Generate SDK bindings only after manifest sync.
296
+ - Use app-owned UI for progress/errors.
@@ -1,43 +1,83 @@
1
1
  ---
2
2
  name: howone-sdk
3
- description: Design and implement HowOne generated apps correctly. Use when planning HowOne app architecture, designing backend entity schema/access, wiring @howone/sdk in src/lib/sdk.ts, implementing auth flows, calling howone.entities.* or howone.public.entities.*, generating SDK bindings from .howone manifests, or reviewing HowOne app runtime integration.
3
+ description: Required operating manual for HowOne generated apps. Use for backend schema/API design, frontend UI implementation that reads or writes HowOne data, AI capability/workflow design, SDK binding/codegen from .howone manifests, auth, uploads, public/private access, and any code that calls @howone/sdk, howone.entities.*, howone.public.entities.*, or howone.ai.*.
4
4
  ---
5
5
 
6
6
  # HowOne App Architecture Skill
7
7
 
8
- This skill is one HowOne app-building skill with numbered internal tracks. Load the smallest track
9
- that matches the task; do not read every file by default.
8
+ This skill is the operating manual for generated HowOne apps. Use it before making platform
9
+ decisions for backend data, frontend data access, auth, AI capabilities, SDK bindings, or generated
10
+ app code that depends on HowOne runtime behavior.
11
+
12
+ Load the smallest set of numbered references that match the task, but do not skip this skill for
13
+ backend schema design, frontend implementation, or AI features. The references define the contracts
14
+ that app code must follow.
10
15
 
11
16
  ## Active Tracks
12
17
 
13
18
  | Track | Folder | Use For |
14
19
  |---|---|---|
15
20
  | `01-architect/` | App generation + manifest flow | End-to-end HowOne app generation flow: when to design backend, when to sync manifests, when to update SDK bindings, and how to choose auth/data posture. |
16
- | `02-database/` | Backend schema + data access design | Entity schema contract, schema operations, access modes, owner/public data posture, indexes, versions, and guardrails. |
21
+ | `02-database/` | Backend schema + data access design | Entity schema contract, schema operations, access modes, owner/public data posture, indexes, query DSL, AI output persistence, versions, and guardrails. |
17
22
  | `03-sdk/` | Frontend SDK usage | `src/lib/sdk.ts`, auth, React provider, entity calls, public data, uploads, raw HTTP, AI action calls. |
18
-
19
- Reserved directory:
20
-
21
- - `04-ai/` is intentionally present for future AI capability design. Do not use it yet. For now,
22
- only use `03-sdk/07-ai-action-calls.md` when wiring an already-synced AI action into app code.
23
+ | `04-ai/` | AI capability + workflow design | HowOne AI capability contracts, service capability selection, workflow create/update/status, schema rules, playbooks, persistence boundaries, and SDK handoff. |
23
24
 
24
25
  ## Routing
25
26
 
26
- Read references by task shape:
27
+ Read references by task shape. Prefer exact references over generic examples.
27
28
 
28
29
  - New HowOne app or broad feature planning: read `01-architect/01-app-generation.md`.
30
+ - Any feature touching backend data, frontend data access, or saved records: read the architect
31
+ flow first, then the relevant database and SDK references below.
32
+ - Any feature touching AI generation, AI workflow behavior, or AI outputs: read the AI references
33
+ first, then the SDK handoff/action-call references.
34
+ - AI capability, AI workflow generation/editing, or full-stack AI feature planning: read
35
+ `04-ai/01-ai-capability-architecture.md`, `04-ai/04-service-capability-catalog.md`, and
36
+ `04-ai/02-workflow-contract-rules.md`.
29
37
  - Backend database/schema creation or change: read `02-database/01-schema-design.md` and
30
38
  `02-database/02-schema-operations.md`.
39
+ - AI output persistence, generation history, retry/resume, or saved AI results: read the `04-ai/`
40
+ files first, then `02-database/05-ai-persistence-patterns.md` and
41
+ `02-database/01-schema-design.md`.
31
42
  - After schema sync, when app code must call the entity: read
32
43
  `01-architect/02-manifest-codegen.md` and `03-sdk/02-entity-operations.md`.
33
- - Custom login page, Email OTP, Phone OTP, Google, GitHub, token persistence, repeated login,
34
- or missing token: read `03-sdk/03-auth.md` and `03-sdk/04-react-integration.md`.
44
+ - Custom login page (your UI, HowOne APIs): `auth: 'custom'` in `createClient` (see `03-sdk/03-auth.md`),
45
+ `HowOneProvider auth="none"` and keep the default bottom-right HowOne logo unless explicitly hidden. Default without `auth` = hosted HowOne login.
35
46
  - `src/lib/sdk.ts`, `createClient`, env vars, or generated bindings: read
36
47
  `03-sdk/01-client-setup.md` and `01-architect/02-manifest-codegen.md`.
37
48
  - Public landing pages or share URLs: read `02-database/03-data-access-patterns.md`,
38
49
  `03-sdk/02-entity-operations.md`, and `01-architect/02-manifest-codegen.md`.
39
50
  - File upload: read `03-sdk/05-file-upload.md`.
40
51
  - Raw HTTP escape hatch: read `03-sdk/06-raw-http.md`.
52
+ - App-side AI action calls after `.howone/ai/manifest.json` exists: read
53
+ `03-sdk/07-ai-action-calls.md`.
54
+ - External workflow create/update/status: read `04-ai/05-workflow-operations.md`.
55
+ - Common AI feature templates: read `04-ai/06-ai-feature-playbooks.md`.
56
+
57
+ ## Reference Selection Protocol
58
+
59
+ Before writing code, classify the touched surfaces:
60
+
61
+ | Touched surface | Required references |
62
+ |---|---|
63
+ | New app, feature architecture, or uncertain data posture | `01-architect/01-app-generation.md` |
64
+ | Entity/schema/access/index change | `02-database/01-schema-design.md`, `02-database/02-schema-operations.md` |
65
+ | Existing synced manifest to TypeScript bindings | `01-architect/02-manifest-codegen.md` |
66
+ | UI reads/writes entities | `03-sdk/01-client-setup.md`, `03-sdk/02-entity-operations.md` |
67
+ | Public read/share flow | `02-database/03-data-access-patterns.md`, `03-sdk/02-entity-operations.md` |
68
+ | Query filters/sort/pagination/response mapping | `02-database/04-query-dsl-and-responses.md` |
69
+ | AI output persistence / generation history | `02-database/05-ai-persistence-patterns.md`, `04-ai/01-ai-capability-architecture.md` |
70
+ | Auth/session/login behavior | `03-sdk/03-auth.md`, `03-sdk/04-react-integration.md` |
71
+ | AI capability or workflow design | `04-ai/01-ai-capability-architecture.md`, `04-ai/04-service-capability-catalog.md`, `04-ai/02-workflow-contract-rules.md` |
72
+ | External workflow create/update/status | `04-ai/05-workflow-operations.md` |
73
+ | Common AI feature examples | `04-ai/06-ai-feature-playbooks.md` |
74
+ | AI manifest handoff to app code | `04-ai/03-ai-sdk-handoff.md`, `03-sdk/07-ai-action-calls.md` |
75
+ | File upload | `03-sdk/05-file-upload.md` |
76
+ | Raw HTTP escape hatch | `03-sdk/06-raw-http.md` |
77
+ | SDK extensibility / adapter boundaries | `03-sdk/08-extension-boundaries.md` |
78
+
79
+ If a task spans multiple surfaces, read one reference from each surface before editing. Do not
80
+ invent API parameters, response shapes, owner fields, workflow IDs, or output paths from memory.
41
81
 
42
82
  ## Core Workflow
43
83
 
@@ -52,6 +92,20 @@ For app features that touch backend data:
52
92
  6. Implement frontend calls using the SDK track.
53
93
  7. Validate with the app's typecheck/build.
54
94
 
95
+ For app features that touch AI:
96
+
97
+ 1. Decide the AI feature boundary in the AI track: one workflow per feature, except RAG uses
98
+ indexing and query workflows.
99
+ 2. Design or update the AI capability contract with `ai-capability-design`.
100
+ 3. Preview/apply the same AI patch, then sync AI artifacts.
101
+ 4. Submit external workflow create/update with `external-ai-capability`.
102
+ 5. Preserve returned request IDs for the workflow status/background-task layer.
103
+ 6. Read `.howone/ai/manifest.json`.
104
+ 7. Generate or update app SDK bindings from the manifest.
105
+ 8. Implement frontend calls using `howone.ai.*`.
106
+ 9. If outputs are saved, map only durable product fields from the AI result into an entity schema,
107
+ then follow the database workflow.
108
+
55
109
  For frontend-only SDK work:
56
110
 
57
111
  1. Read existing `src/lib/sdk.ts`.
@@ -63,7 +117,8 @@ For frontend-only SDK work:
63
117
 
64
118
  - Generate SDK bindings from synced manifests, not from memory.
65
119
  - Keep `.howone/` as manifest storage only; do not write generated source files there.
66
- - Configure `projectId` and `env` only in `createClient`.
120
+ - Configure `projectId` and `env` only in `createClient`. Auth APIs follow the same `env` (dev → `api.howone.dev`, not `api.howone.ai`).
121
+ - Import `src/lib/sdk.ts` before any `@howone/sdk` auth call so environment is pinned.
67
122
  - Use `import.meta.env.VITE_HOWONE_PROJECT_ID` and `import.meta.env.VITE_HOWONE_ENV`; do not
68
123
  hardcode project IDs or add fallback env values.
69
124
  - For private user-owned data, authenticated APIs derive owner from JWT. Do not pass
@@ -71,5 +126,18 @@ For frontend-only SDK work:
71
126
  - For `access.authenticated.read = "own"`, prefer `howone.entities.Entity.query.mine(...)`.
72
127
  - Public pages use `howone.public.entities.*` only when manifest access explicitly allows public
73
128
  reads or writes.
74
- - For custom in-app login, use `HowOneProvider auth="none"`, call
75
- `howone.auth.setToken(token)` on success, and verify startup session with `await howone.me()`.
129
+ - Default `createClient({ projectId, env })` uses **HowOne hosted login**. For a custom `/login` UI
130
+ that still calls HowOne OTP/OAuth APIs, add `auth: 'custom'` and `HowOneProvider auth="none"`.
131
+ - `HowOneProvider` may render the bottom-right HowOne `FloatingButton` logo by default. Do not remove
132
+ it unless the user explicitly asks for `brand="hidden"` or `showBrandButton={false}`.
133
+ - Do not add SDK-owned toast APIs, redirect overlays, or app-specific UI. Expose data, state, events,
134
+ and callbacks; implement visible feedback in the generated frontend app.
135
+ - SDK extensibility rule: default behavior must work without configuration, and custom behavior must
136
+ enter through typed adapters/callbacks instead of hardcoded app UI or provider-specific branches.
137
+ - AI workflows are implementation, not persistence. Never put CRUD, auth, upload handling, or app
138
+ state management into the workflow capability contract.
139
+ - For external workflow edits, pass `workflowConfigID` from a confirmed workflow status result; do
140
+ not invent it or omit it.
141
+ - If the user explicitly requires AI behavior that the available workflow service cannot support,
142
+ stop that AI implementation path and report the unsupported requirement instead of faking,
143
+ silently omitting, or replacing the AI capability with static behavior.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "HowOne App Architecture"
3
- short_description: "Design HowOne app schema, SDK bindings, and auth/data integration."
4
- default_prompt: "Use this skill to choose the HowOne app architecture track, then implement schema, SDK bindings, or frontend SDK calls correctly."
3
+ short_description: "Design HowOne database schemas, AI workflows, SDK bindings, auth, and app integration."
4
+ default_prompt: "Use this skill to choose the right HowOne architecture track, then implement database schema, AI capability/workflow, SDK bindings, auth, or frontend SDK calls from synced manifests."
@@ -14,7 +14,7 @@
14
14
  "dependencies": {
15
15
  "@base-ui/react": "^1.4.1",
16
16
  "@fontsource-variable/inter": "^5.2.8",
17
- "@howone/sdk": "2.0.0-beta.17",
17
+ "@howone/sdk": "2.0.0-beta.18",
18
18
  "@tailwindcss/vite": "^4.2.1",
19
19
  "class-variance-authority": "^0.7.1",
20
20
  "clsx": "^2.1.1",
@@ -18,6 +18,9 @@ export const entities = defineEntities({
18
18
 
19
19
  export const ai = defineAiActions({
20
20
  // Add generated AI action bindings here, for example:
21
+ // import { z } from "zod" and define Zod schemas before using defineAiAction.
22
+ // Do not paste JSON Schema objects from .howone/ai/manifest.json here directly.
23
+ // With outputSchema configured, howone.ai.<action>.run() returns the validated finalResult payload.
21
24
  // generateImage: defineAiAction("generateImage", {
22
25
  // workflowId: "<workflow-uuid>", // workflow ID for this capability
23
26
  // inputSchema: generateImageInputSchema,