@owlmeans/viable-common 0.0.33 → 0.0.34

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 (80) hide show
  1. package/README.md +3 -3
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/agent-presentation/SKILL.md +1 -1
  4. package/agent-meta/skills/viable-common/SKILL.md +93 -62
  5. package/build/ba/index.d.ts +0 -1
  6. package/build/ba/index.d.ts.map +1 -1
  7. package/build/ba/index.js +0 -1
  8. package/build/ba/index.js.map +1 -1
  9. package/build/blueprint/consts.d.ts +38 -0
  10. package/build/blueprint/consts.d.ts.map +1 -1
  11. package/build/blueprint/consts.js +40 -0
  12. package/build/blueprint/consts.js.map +1 -1
  13. package/build/blueprint/index.d.ts +0 -3
  14. package/build/blueprint/index.d.ts.map +1 -1
  15. package/build/blueprint/index.js +0 -3
  16. package/build/blueprint/index.js.map +1 -1
  17. package/build/blueprint/types.d.ts +5 -5
  18. package/build/intent/consts.d.ts +57 -0
  19. package/build/intent/consts.d.ts.map +1 -0
  20. package/build/intent/consts.js +58 -0
  21. package/build/intent/consts.js.map +1 -0
  22. package/build/intent/entrypoints.d.ts +27 -0
  23. package/build/intent/entrypoints.d.ts.map +1 -0
  24. package/build/intent/entrypoints.js +28 -0
  25. package/build/intent/entrypoints.js.map +1 -0
  26. package/build/intent/errors.d.ts +20 -0
  27. package/build/intent/errors.d.ts.map +1 -0
  28. package/build/intent/errors.js +28 -0
  29. package/build/intent/errors.js.map +1 -0
  30. package/build/intent/flow.d.ts +17 -0
  31. package/build/intent/flow.d.ts.map +1 -0
  32. package/build/intent/flow.js +65 -0
  33. package/build/intent/flow.js.map +1 -0
  34. package/build/intent/index.d.ts +7 -0
  35. package/build/intent/index.d.ts.map +1 -0
  36. package/build/intent/index.js +6 -0
  37. package/build/intent/index.js.map +1 -0
  38. package/build/intent/schemas.d.ts +10 -0
  39. package/build/intent/schemas.d.ts.map +1 -0
  40. package/build/intent/schemas.js +24 -0
  41. package/build/intent/schemas.js.map +1 -0
  42. package/build/intent/types.d.ts +40 -0
  43. package/build/intent/types.d.ts.map +1 -0
  44. package/build/intent/types.js +2 -0
  45. package/build/intent/types.js.map +1 -0
  46. package/build/skills/consts.d.ts +0 -34
  47. package/build/skills/consts.d.ts.map +1 -1
  48. package/build/skills/consts.js +0 -106
  49. package/build/skills/consts.js.map +1 -1
  50. package/build/skills/index.d.ts +0 -1
  51. package/build/skills/index.d.ts.map +1 -1
  52. package/build/skills/index.js +0 -1
  53. package/build/skills/index.js.map +1 -1
  54. package/build/skills/roles.d.ts +0 -9
  55. package/build/skills/roles.d.ts.map +1 -1
  56. package/build/skills/roles.js +0 -226
  57. package/build/skills/roles.js.map +1 -1
  58. package/package.json +17 -7
  59. package/src/ba/index.ts +0 -1
  60. package/src/blueprint/consts.ts +40 -0
  61. package/src/blueprint/index.ts +0 -3
  62. package/src/blueprint/types.ts +5 -5
  63. package/src/intent/consts.ts +66 -0
  64. package/src/intent/entrypoints.ts +43 -0
  65. package/src/intent/errors.ts +33 -0
  66. package/src/intent/flow.ts +67 -0
  67. package/src/intent/index.ts +6 -0
  68. package/src/intent/schemas.ts +27 -0
  69. package/src/intent/types.ts +45 -0
  70. package/src/skills/consts.ts +0 -112
  71. package/src/skills/index.ts +0 -1
  72. package/src/skills/roles.ts +0 -267
  73. package/tests/blueprint.spec.ts +2 -66
  74. package/tests/intent.spec.ts +121 -0
  75. package/src/ba/schemas.ts +0 -196
  76. package/src/blueprint/case.ts +0 -320
  77. package/src/blueprint/resolve.ts +0 -136
  78. package/src/blueprint/schemas.ts +0 -44
  79. package/src/skills/catalogue.ts +0 -1864
  80. package/tests/skills.spec.ts +0 -125
@@ -1,4 +1,3 @@
1
- import { ViableSkill } from './consts.js';
2
1
  /**
3
2
  * Who the model is being asked to be.
4
3
  *
@@ -42,229 +41,4 @@ export var ViablePersona;
42
41
  ViablePersona["DeclarationLookup"] = "declaration-lookup";
43
42
  ViablePersona["FixAgent"] = "fix-agent";
44
43
  })(ViablePersona || (ViablePersona = {}));
45
- /** Shared by the two helpers that reason about domain models and shared types. */
46
- const DOMAIN_ARCHITECT = `
47
- You are a fullstack web developer architect specializing in state management, domain models,
48
- and typescript.
49
- `.trim();
50
- /** The rules every coder and the fixer need, whatever they are writing. */
51
- const CODING_BASE = [ViableSkill.OutputSourceOnly, ViableSkill.TsStyle, ViableSkill.TsImports];
52
- /**
53
- * The frontend stack, in the order a component is built up.
54
- *
55
- * `OwlmeansState` is here, not only on the state coder: the view models that READ the stores are
56
- * written by the view and nav coders and repaired by the fixer, and none of them carried it —
57
- * the traces show `useStoreList(...)` read as `.list` / `.items` / a plain `T[]` in 18 projects,
58
- * the second most frequent repair the fixer made.
59
- */
60
- const FRONTEND = [
61
- ViableSkill.ReactComponents, ViableSkill.OwlMeansEntrypoints, ViableSkill.OwlMeansNav,
62
- ViableSkill.OwlMeansServices, ViableSkill.ShadcnUi, ViableSkill.FormFeedback,
63
- ViableSkill.OwlmeansState, ViableSkill.StoreAccess, ViableSkill.ViewModelNaming,
64
- ViableSkill.LibrariesUi,
65
- ];
66
- /** The backend stack. */
67
- const BACKEND = [
68
- ViableSkill.ProjectLayout,
69
- ViableSkill.ResourceLayer, ViableSkill.ResourceResults, ViableSkill.ResourceMigrations,
70
- ViableSkill.OwlMeansEntrypoints, ViableSkill.OwlMeansServer, ViableSkill.OwlmeansContext,
71
- ViableSkill.OwlMeansServices, ViableSkill.LibrariesBackend,
72
- ];
73
- const persona = (role, skills) => ({ role: role.trim(), skills });
74
- /**
75
- * The role text and skill set behind every helper.
76
- *
77
- * This is the single place a persona is written down. Before it existed the same
78
- * sentences lived in thirteen helper files and seven near-identical coder factories, and
79
- * the Express-5, resource-layer and client-state rules were duplicated across three of them.
80
- */
81
- export const VIABLE_PERSONAS = {
82
- // --- Analysis and design ---
83
- [ViablePersona.BusinessAnalyst]: persona(`
84
- You are a professional business analyst and product manager specializing in figuring out
85
- user stories from requirements.
86
- `, [ViableSkill.OutputTextOnly, ViableSkill.MainFlowFocus]),
87
- [ViablePersona.ProductArchitect]: persona(`
88
- You are a product architect. You read what somebody wants built and say which KIND of
89
- application it is, out of a fixed list. You choose the least capable kind that can deliver
90
- what was asked for, because every capability above it is machinery a real user pays for.
91
- You never stretch a description to fit a more interesting answer.
92
- `, [ViableSkill.OutputTextOnly]),
93
- [ViablePersona.ProductNaming]: persona(`
94
- You are a professional product and brand manager specializing in naming.
95
- `, [ViableSkill.OutputTextOnly, ViableSkill.MainFlowFocus]),
96
- [ViablePersona.UxDesigner]: persona(`
97
- You are a professional UX designer specializing in user flow and interaction in web
98
- applications.
99
- This application serves four audiences — anonymous visitors, signed-in end users, the owner,
100
- and staff running the business process. Every screen you design belongs to exactly one of them,
101
- and you are told which one with each task.
102
- `, [ViableSkill.OutputTextOnly]),
103
- [ViablePersona.VisualDesigner]: persona(`
104
- You are a visual ui designer specializing in writing design guidelines and design systems
105
- for web applications, and your interfaces are calm, precise and unmistakably the product's own.
106
- Your house style: a white ground in light mode and a black one in dark mode; colour from ONE
107
- product accent and never from backgrounds; depth only from hairlines, neutral tiles and a single
108
- floating shadow; a heavy grotesk display face with tight tracking and generous whitespace carrying
109
- the brand; motion that is small and belongs to the picture. You never reach for gradients, glass,
110
- blur or glow, and the older decoration classes a project still defines are painted flat and are
111
- never your tools. You change any of this only when the customer's specification explicitly asks —
112
- it names a background colour, a dark-only or coloured theme, a brand palette, or gradients. The
113
- product's subject matter is not such a request: a bakery is not a warm background, a bank is not a
114
- blue one. What makes a design this product's is its accent, its type and its illustration — never
115
- an added effect.
116
- This application serves four audiences — anonymous visitors, signed-in end users, the owner,
117
- and staff running the business process. Every screen you style belongs to exactly one of them,
118
- and you are told which one with each task.
119
- `, [ViableSkill.OutputTextOnly]),
120
- // --- Architects ---
121
- [ViablePersona.LayoutArchitect]: persona(`
122
- You are a frontend developer architect working with typescript and react.
123
- You are specializing in screen layouts and their components.
124
- This application's layouts are the four AREA shells it already ships — guest, user, admin and
125
- operator — so you compose screens to sit inside one of them and you restyle a shell when it
126
- needs to look different. You never write a new layout and never rebuild its navigation.
127
- `, [ViableSkill.LayoutDefinition, ViableSkill.ScreenDefinition, ...FRONTEND]),
128
- [ViablePersona.ComponentArchitect]: persona(`
129
- You are a frontend developer architect specializing in typescript react components.
130
- `, [...FRONTEND]),
131
- [ViablePersona.StateArchitect]: persona(`
132
- You are a frontend developer architect specializing in state management and typescript.
133
- `, [ViableSkill.OwlmeansState, ViableSkill.StoreAccess, ViableSkill.ViewModelNaming,
134
- ViableSkill.LibrariesUiState]),
135
- [ViablePersona.NavigationArchitect]: persona(`
136
- You are a frontend developer architect working with typescript and react.
137
- You are specializing in UI navigation and transitioning.
138
- This application has four fixed AREAS — guest, user (front office), admin and operator (back
139
- office) — and two menu levels inside each: SECTIONS are the top menu, and the screens of the
140
- active section are the side menu. You place a screen by choosing its area and its section, never
141
- by editing a menu component and never by changing an address.
142
- `, [ViableSkill.OwlMeansEntrypoints, ViableSkill.OwlMeansNav, ViableSkill.ScreenDefinition,
143
- ViableSkill.LibrariesUi]),
144
- [ViablePersona.DomainTypesArchitect]: persona(DOMAIN_ARCHITECT, [ViableSkill.LibrariesCommon]),
145
- // Not DOMAIN_ARCHITECT. This helper decides the application's entire authorization model — the
146
- // least access each surface can be given, and one name per capability — and borrowing the
147
- // state-management architect's sentence was describing a different job to the model.
148
- [ViablePersona.AccessArchitect]: persona(`
149
- You are a web application security architect specializing in authorization.
150
- You decide the least access an endpoint or a screen can be given and still do its job, and you
151
- name permissions so that one capability has exactly one name across the whole application.
152
- `, [ViableSkill.OwlMeansEntrypoints, ViableSkill.PermissionModel, ViableSkill.LibrariesCommon]),
153
- [ViablePersona.ApiArchitect]: persona(`
154
- You are an expert backend architect specializing in designing RESTful APIs using
155
- TypeScript and the OwlMeans entrypoint framework.
156
- `, [ViableSkill.OwlMeansEntrypoints, ViableSkill.OwlMeansServer, ViableSkill.ResourceLayer,
157
- ViableSkill.ResourceResults, ViableSkill.OwlmeansContext, ViableSkill.LibrariesBackend]),
158
- [ViablePersona.DatalayerArchitect]: persona(`
159
- You are a backend developer architect specializing in TypeScript, PostgreSQL and Node.js,
160
- working with the OwlMeans resource layer over Postgres (@owlmeans/postgres-resource), which
161
- owns the schema.
162
- `, [ViableSkill.ResourceLayer, ViableSkill.ResourceResults, ViableSkill.ResourceMigrations,
163
- ViableSkill.OwlmeansContext, ViableSkill.LibrariesBackend]),
164
- [ViablePersona.BackendDomainArchitect]: persona(`
165
- You are a backend developer architect specializing in business logic development.
166
- If necessary you describe which integrations to use.
167
- You prefer to use LLM chats models to solve sophisticated problems.
168
- You are always specific when consider some integrations.
169
- You always start from the business logic flow description that needs to be implemented
170
- and focus on it.
171
- `, [ViableSkill.ProjectLayout, ViableSkill.OwlmeansContext, ViableSkill.ResourceResults,
172
- ViableSkill.LibrariesBackend]),
173
- // --- Coders ---
174
- // `PermissionModel` because this is the persona that WRITES the gate lines — `applyApiAccess`
175
- // and `applyScreenAccess` both run on it. Knowing where the `@` may and may not appear has to
176
- // reach the hand that types it, not only the one that chose the name.
177
- [ViablePersona.CommonCoder]: persona(`
178
- You are an expert fullstack developer specializing in typescript and domain models.
179
- `, [...CODING_BASE, ViableSkill.OwlMeansEntrypoints, ViableSkill.PermissionModel,
180
- ViableSkill.LibrariesCommon]),
181
- [ViablePersona.UiStateCoder]: persona(`
182
- You are an expert frontend developer specializing in typescript and state management.
183
- `, [...CODING_BASE, ViableSkill.OwlmeansState, ViableSkill.OwlMeansEntrypoints,
184
- ViableSkill.StoreAccess, ViableSkill.ViewModelNaming, ViableSkill.LibrariesUiState]),
185
- [ViablePersona.UiViewCoder]: persona(`
186
- You are an expert frontend developer specializing in typescript, html, css, and react
187
- development of visual components.
188
- `, [...CODING_BASE, ...FRONTEND]),
189
- [ViablePersona.UiNavCoder]: persona(`
190
- You are an expert frontend developer specializing in typescript, html, css, and react
191
- development of navigation and transitions.
192
- `, [...CODING_BASE, ...FRONTEND]),
193
- [ViablePersona.DatalayerCoder]: persona(`
194
- You are an expert fullstack developer specializing in typescript, node.js and the OwlMeans
195
- resource layer over Postgres (@owlmeans/postgres-resource).
196
- `, [...CODING_BASE, ...BACKEND]),
197
- [ViablePersona.ApiCoder]: persona(`
198
- You are an expert fullstack developer specializing in typescript, node.js, the OwlMeans
199
- entrypoint framework and its resource layer over Postgres (@owlmeans/postgres-resource).
200
- `, [...CODING_BASE, ...BACKEND]),
201
- [ViablePersona.BackendModelCoder]: persona(`
202
- You are an expert backend developer specializing in typescript and node.js.
203
- You focus on business logic and integrations implementation — you really implement them,
204
- not just mock them.
205
- `, [...CODING_BASE, ViableSkill.ProjectLayout, ViableSkill.OwlmeansContext,
206
- ViableSkill.ResourceResults, ViableSkill.LibrariesBackend]),
207
- [ViablePersona.RuntimeArchitect]: persona(`
208
- You are a pragmatic backend architect. You decide what a feature needs to RUN, and your
209
- default answer is "a request handler and a table". You reach for a queue, a separate worker
210
- process or an LLM agent only when the work cannot honestly be done inside a request, and you
211
- say plainly which it is when the answer is none of them.
212
- `, [ViableSkill.QueueDiscipline, ViableSkill.ProjectLayout, ViableSkill.OwlmeansContext]),
213
- [ViablePersona.WorkerCoder]: persona(`
214
- You are an expert backend developer specializing in typescript, queue processing and LLM
215
- agents. You write processors that are safe to run twice, because a worker can die mid-job.
216
- `, [...CODING_BASE, ViableSkill.ProjectLayout, ViableSkill.OwlmeansContext,
217
- ViableSkill.WorkerJobs, ViableSkill.TargetAgents, ViableSkill.ResourceResults,
218
- ViableSkill.LibrariesBackend]),
219
- [ViablePersona.FreeFlightCoder]: persona(`
220
- You are an expert fullstack developer specializing in typescript.
221
- `, [...CODING_BASE, ...FRONTEND, ...BACKEND, ViableSkill.PermissionModel]),
222
- // --- Everything else ---
223
- [ViablePersona.Fixer]: persona(`
224
- You are an expert typescript fullstack developer specializing in bugfixing of web
225
- applications. You change as little as the reported error requires.
226
- `, [...CODING_BASE, ...FRONTEND, ...BACKEND, ViableSkill.FixerHeuristics,
227
- ViableSkill.PermissionModel]),
228
- // `OwlMeansEntrypoints` is what makes this persona able to ROUTE a report: the four contract
229
- // files, and which of them a symptom belongs to. Without it a runtime `entrypoint.call is not a
230
- // function` reads as a broken component, and the orchestrator sends a coder to rewrite the view
231
- // model that is already correct.
232
- //
233
- // `OwlMeansServices` is here for the same reason one level down: this persona WRITES the
234
- // instruction the coder follows, so it is the one that decides a `Service not found` is
235
- // repaired by naming a different alias. It has to know which registry that name comes from
236
- // before it delegates, or the coder inherits the wrong premise along with the task.
237
- [ViablePersona.Orchestrator]: persona(`
238
- You are a senior fullstack typescript coding agent. You are orchestrating the
239
- development. Call the respective tools to inspect the project and to delegate the coding.
240
- `, [ViableSkill.ProjectLayout, ViableSkill.AgentTooling, ViableSkill.OwlmeansContext,
241
- ViableSkill.OwlMeansEntrypoints, ViableSkill.OwlMeansServices, ViableSkill.PermissionModel,
242
- ViableSkill.LayoutDefinition, ViableSkill.ScreenDefinition, ViableSkill.TsImports]),
243
- [ViablePersona.SourceExtractor]: persona(`
244
- You are a code-context extraction agent. You are NOT writing code. Do not summarise.
245
- Your only deliverable is the tool call selecting the relevant line ranges. Be frugal —
246
- every extra line costs the coder context.
247
- `, []),
248
- [ViablePersona.DeclarationLookup]: persona(`
249
- You are a TypeScript type-declaration lookup agent. You are NOT writing code and NOT
250
- fixing anything. Your only deliverable is the report_declarations tool call naming, for
251
- each requested type, the file that declares it. Be frugal — every tool call costs budget,
252
- and a wrong path is worse than an unresolved name.
253
- `, []),
254
- [ViablePersona.FixAgent]: persona(`
255
- You are a build-repair agent working on a TypeScript monorepo you can inspect with tools.
256
-
257
- You are called only after a scripted fix loop has already failed on this error, so the
258
- obvious edit has been tried and did not work. Investigate before you edit: read the file
259
- the error points at, look up the authoritative name in the registry, search for the other
260
- places a name is spelled. A build error that keeps coming back is almost always a name
261
- that exists in two spellings or one that was never declared — declare or create the
262
- missing thing at its registered name; renaming a reference to a new guess is what made
263
- the loop circle.
264
-
265
- Make the smallest edit that addresses the cause, verify with the build, and finish with
266
- report_fix. Never delete a feature to silence an error, and never stub a handler to make
267
- the build pass.
268
- `, []),
269
- };
270
44
  //# sourceMappingURL=roles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/skills/roles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,aAoCX;AApCD,WAAY,aAAa;IACvB,qDAAoC,CAAA;IACpC,iDAAgC,CAAA;IAChC,wFAAwF;IACxF,uDAAsC,CAAA;IACtC,2CAA0B,CAAA;IAC1B,mDAAkC,CAAA;IAElC,qDAAoC,CAAA;IACpC,2DAA0C,CAAA;IAC1C,mDAAkC,CAAA;IAClC,6DAA4C,CAAA;IAC5C,gEAA+C,CAAA;IAC/C,qDAAoC,CAAA;IACpC,+CAA8B,CAAA;IAC9B,2DAA0C,CAAA;IAC1C,oEAAmD,CAAA;IAEnD,6CAA4B,CAAA;IAC5B,gDAA+B,CAAA;IAC/B,8CAA6B,CAAA;IAC7B,4CAA2B,CAAA;IAC3B,mDAAkC,CAAA;IAClC,uCAAsB,CAAA;IACtB,0DAAyC,CAAA;IACzC,qGAAqG;IACrG,uDAAsC,CAAA;IACtC,kFAAkF;IAClF,6CAA4B,CAAA;IAC5B,sDAAqC,CAAA;IAErC,gCAAe,CAAA;IACf,8CAA6B,CAAA;IAC7B,qDAAoC,CAAA;IACpC,yDAAwC,CAAA;IACxC,uCAAsB,CAAA;AACxB,CAAC,EApCW,aAAa,KAAb,aAAa,QAoCxB;AAED,kFAAkF;AAClF,MAAM,gBAAgB,GAAG;;;CAGxB,CAAC,IAAI,EAAE,CAAA;AAER,2EAA2E;AAC3E,MAAM,WAAW,GAAG,CAAC,WAAW,CAAC,gBAAgB,EAAE,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;AAE9F;;;;;;;GAOG;AACH,MAAM,QAA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AsB,CAAA;IACtB,0DAAyC,CAAA;IACzC,qGAAqG;IACrG,uDAAsC,CAAA;IACtC,kFAAkF;IAClF,6CAA4B,CAAA;IAC5B,sDAAqC,CAAA;IAErC,gCAAe,CAAA;IACf,8CAA6B,CAAA;IAC7B,qDAAoC,CAAA;IACpC,yDAAwC,CAAA;IACxC,uCAAsB,CAAA;AACxB,CAAC,EApCW,aAAa,KAAb,aAAa,QAoCxB"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@owlmeans/viable-common",
3
- "version": "0.0.33",
3
+ "version": "0.0.34",
4
4
  "license": "MIT",
5
- "description": "Runtime-free contracts of the OwlMeans Viable platform — the analysis, design and metadata shapes of a generated project, its target-shape manifest, the slot command vocabulary, the connector protocol and the conversion vocabulary.",
5
+ "description": "Runtime-free contracts of the OwlMeans Viable platform — the analysis, design and metadata shapes of a generated project, its target-shape manifest, the slot command vocabulary, the connector protocol and the conversion vocabulary, and the intent-first hand-off from the public site to the platform.",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "tsc -b",
@@ -48,6 +48,13 @@
48
48
  "default": "./build/integrity/index.js",
49
49
  "module": "./build/integrity/index.js",
50
50
  "types": "./build/integrity/index.d.ts"
51
+ },
52
+ "./intent": {
53
+ "import": "./build/intent/index.js",
54
+ "require": "./build/intent/index.js",
55
+ "default": "./build/intent/index.js",
56
+ "module": "./build/intent/index.js",
57
+ "types": "./build/intent/index.d.ts"
51
58
  }
52
59
  },
53
60
  "devDependencies": {
@@ -59,12 +66,15 @@
59
66
  "typescript": "^7.0.2"
60
67
  },
61
68
  "dependencies": {
62
- "@owlmeans/agent-common": "^0.1.18-rc.40",
63
- "@owlmeans/entrypoint": "^0.1.18-rc.36",
64
- "@owlmeans/error": "^0.1.18-rc.35",
69
+ "@owlmeans/agent-common": "^0.1.18-rc.41",
70
+ "@owlmeans/auth": "^0.1.18-rc.36",
71
+ "@owlmeans/context": "^0.1.18-rc.32",
72
+ "@owlmeans/entrypoint": "^0.1.18-rc.37",
73
+ "@owlmeans/error": "^0.1.18-rc.36",
74
+ "@owlmeans/flow": "^0.1.18-rc.39",
65
75
  "@owlmeans/llm-common": "^0.1.18-rc.36",
66
- "@owlmeans/planning": "^0.1.18-rc.9",
67
- "@owlmeans/resource": "^0.1.18-rc.35",
76
+ "@owlmeans/planning": "^0.1.18-rc.10",
77
+ "@owlmeans/resource": "^0.1.18-rc.36",
68
78
  "@owlmeans/route": "^0.1.18-rc.33"
69
79
  },
70
80
  "publishConfig": {
package/src/ba/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
- export * from './schemas.js'
3
2
  export * from './helpers.js'
4
3
  export * from './consts.js'
5
4
  export type * from './types.js'
@@ -9,3 +9,43 @@ export const DEFAULT_BLUEPRINT_ID = 'owlmeans-fullstack-ts'
9
9
 
10
10
  /** Recorded on a project so a later run knows which blueprint drew it. */
11
11
  export const BLUEPRINT_META_KEY = 'blueprint'
12
+
13
+ /**
14
+ * WHICH KIND of product is being built on a blueprint.
15
+ *
16
+ * A blueprint says what the STACK is — the language, the framework, the topology, the seeds. A
17
+ * case says what is being built ON it, and that is a different question with different consumers:
18
+ * the analyst framing the brief, the architect deciding whether a story needs a queue, the coder
19
+ * choosing which packages it may import.
20
+ *
21
+ * Deliberately NOT a second blueprint. Everything a case has to say is already a blueprint field,
22
+ * so a case is a PATCH and the resolution order stays base → case → per-run overrides. That is
23
+ * also why adding one is a data change: nothing reads `BlueprintCase` except the case table
24
+ * (`BLUEPRINT_CASES` in `@owlmeans/viable`) and the prompt that classifies a project into it.
25
+ */
26
+ export enum BlueprintCase {
27
+ /** A web application whose every feature fits inside a request. No queue, no worker, no agents. */
28
+ Web = 'web',
29
+ /** A web application with work that genuinely belongs off the request path. */
30
+ Scalable = 'scalable',
31
+ /** The product's value comes from ordered, deterministic model-driven steps. */
32
+ AiPipeline = 'ai-pipeline',
33
+ /** The product's value comes from an agent that decides its own path through tools. */
34
+ AiAgent = 'ai-agent',
35
+ /** A browser game: a three.js scene with an ordinary React interface over it. */
36
+ Game = 'game',
37
+ }
38
+
39
+ /**
40
+ * How a game is played, which decides who owns its state.
41
+ *
42
+ * Recorded beside the case rather than folded into it, because it changes nothing about the
43
+ * dependencies and everything about where the logic goes. `OnlineTurn` is the default for
44
+ * anything multiplayer unless the brief plainly asks for live play — it is the shape that
45
+ * actually builds, and it needs no socket, no tick loop and no reconciliation.
46
+ */
47
+ export enum GameKind {
48
+ Casual = 'casual',
49
+ OnlineTurn = 'online-turn',
50
+ OnlineLive = 'online-live',
51
+ }
@@ -1,6 +1,3 @@
1
1
  export * from './types.js'
2
2
 
3
3
  export * from './consts.js'
4
- export * from './case.js'
5
- export * from './schemas.js'
6
- export * from './resolve.js'
@@ -201,11 +201,11 @@ export interface PackagesLayer {
201
201
  /**
202
202
  * Skills added to ONE persona, rather than to every prompt of the blueprint.
203
203
  *
204
- * The additive twin of {@link skillsForBlueprint}, which subtracts. `skills` above is what is
205
- * true of the whole stack; this is what is true of one performer — the analyst who has to know
206
- * that a game brief is a core loop rather than a numbered flow, the architect who has to know
207
- * when a tool loop is warranted. Without it a case could only change what a CODER is told, and
208
- * a case changes the product analysis first.
204
+ * The additive twin of `skillsForBlueprint` (in `@owlmeans/viable`), which subtracts. `skills`
205
+ * above is what is true of the whole stack; this is what is true of one performer — the analyst
206
+ * who has to know that a game brief is a core loop rather than a numbered flow, the architect who
207
+ * has to know when a tool loop is warranted. Without it a case could only change what a CODER is
208
+ * told, and a case changes the product analysis first.
209
209
  */
210
210
  personaSkills?: Partial<Record<ViablePersona, ViableSkill[]>>
211
211
  /** Extra dependencies a role's manifest carries, beyond what the overlay ships. */
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The intent-first hand-off — how a prompt typed on the public site reaches the platform.
3
+ *
4
+ * A visitor types the idea for a project on the marketing site before they have an account. The
5
+ * site cannot write into the platform's browser storage (IndexedDB is per origin) and must not put
6
+ * the prompt in a URL, so the prompt takes a short detour through the platform's own cache: the
7
+ * site stashes it behind an unguessable reference, sends the browser to the platform with only that
8
+ * reference, and the platform picks the prompt up once — after which it lives in the visitor's own
9
+ * browser until they decide what to do with it.
10
+ *
11
+ * Everything here is serializable and runtime-free: the site, the manager API and the manager web
12
+ * read the same declarations, and none of them may reinvent a name the others parse.
13
+ */
14
+
15
+ /** Every address of the hand-off. API routes are guest routes; the landing is a screen. */
16
+ export const intent = Object.freeze({
17
+ base: 'viable:manager-api:intent:base',
18
+ stash: 'viable:manager-api:intent:stash',
19
+ pickup: 'viable:manager-api:intent:pickup',
20
+ landing: 'viable:manager-web:intent:landing',
21
+ } as const)
22
+
23
+ /** Where the guest API lives, and the screen the visitor's browser is sent to. */
24
+ export const INTENT_API_PATH = '/public/intent'
25
+ export const INTENT_LANDING_PATH = '/start'
26
+
27
+ /** The flow the two sides walk. */
28
+ export const INTENT_FLOW = 'viable:intent'
29
+
30
+ /**
31
+ * How long the platform keeps a stashed prompt waiting for pickup. Short on purpose: the pickup
32
+ * happens the moment the browser lands, so anything older was abandoned, and a prompt is personal
33
+ * data the platform has no business holding once nobody is coming for it.
34
+ */
35
+ export const INTENT_TTL_SECONDS = 120
36
+
37
+ /** The longest prompt the platform will create a project from (`PromptSchema` in viable). */
38
+ export const INTENT_PROMPT_MAX = 8192
39
+
40
+ /**
41
+ * The reference's shape: `createIdOfLength(24)` — Base58, so no `0`, `O`, `I` or `l`. Anything else
42
+ * is refused before the cache is asked, which keeps a crafted reference from ever being a key.
43
+ */
44
+ export const INTENT_REF_LENGTH = 24
45
+ export const INTENT_REF_PATTERN = '^[1-9A-HJ-NP-Za-km-z]{24}$'
46
+
47
+ /** The flow payload key carrying the reference — short, because a payload is CSV-joined. */
48
+ export const INTENT_PAYLOAD_REF = 'ref'
49
+
50
+ /** How long the visitor's draft survives in their own browser waiting for a decision. */
51
+ export const INTENT_DRAFT_TTL_MS = 24 * 60 * 60 * 1000
52
+
53
+ /** How long a suspended landing waits while the visitor signs in or registers. */
54
+ export const INTENT_SUSPEND_TTL_MS = 30 * 60 * 1000
55
+
56
+ /** Steps of {@link intentFlow}, exported so a screen never spells one as a literal. */
57
+ export enum IntentFlowStep {
58
+ /** The public site: the prompt is typed and stashed. */
59
+ Compose = 'compose',
60
+ /** The platform's landing screen: the stash is picked up. */
61
+ Land = 'land',
62
+ /** The platform's own sign-in dispatcher. */
63
+ SignIn = 'sign-in',
64
+ /** The platform's home screen, where the draft is offered back. */
65
+ Review = 'review',
66
+ }
@@ -0,0 +1,43 @@
1
+ import { contract, openProtocol, protocol, typed } from '@owlmeans/entrypoint'
2
+ import { frontend, route, RouteMethod } from '@owlmeans/route'
3
+ import { INTENT_API_PATH, INTENT_LANDING_PATH, intent } from './consts.js'
4
+ import { IntentPickupBodySchema, IntentStashBodySchema } from './schemas.js'
5
+ import type {
6
+ IntentPickupBody, IntentPickupResult, IntentProtocolOptions, IntentStashBody, IntentStashResult,
7
+ } from './types.js'
8
+
9
+ /**
10
+ * Declare the intent-first hand-off: two GUEST API routes and the landing screen's address.
11
+ *
12
+ * No guard and no gate anywhere on the API — the caller is a visitor who has no account yet — and
13
+ * no `service` on any route: each consumer fills it in (the public site names the platform's
14
+ * services in its own configuration; the manager binds them to its own).
15
+ *
16
+ * TODO(cors): these routes ride the framework's global `origin: '*'` CORS policy (no credentials).
17
+ * If viable ever restricts allowed origins globally, this entrypoint must keep answering the public
18
+ * site's origins — owlmeans.com, owlmeans.pl and, in dev/stage, `http://localhost:4321`.
19
+ *
20
+ * The landing screen is `sticky`, like the OAuth consent screens: it is an ordinary in-app screen
21
+ * that a visitor arrives at directly from another origin.
22
+ */
23
+ export const makeIntentProtocols = (opts: IntentProtocolOptions = {}) => {
24
+ const base = openProtocol(route(intent.base, opts.path ?? INTENT_API_PATH))
25
+
26
+ return {
27
+ base,
28
+
29
+ stash: protocol(
30
+ route(intent.stash, '/', { parent: base, method: RouteMethod.POST }),
31
+ contract.request({ body: typed<IntentStashBody>(IntentStashBodySchema) }, typed<IntentStashResult>()),
32
+ ),
33
+
34
+ pickup: protocol(
35
+ route(intent.pickup, '/pickup', { parent: base, method: RouteMethod.POST }),
36
+ contract.request({ body: typed<IntentPickupBody>(IntentPickupBodySchema) }, typed<IntentPickupResult>()),
37
+ ),
38
+
39
+ landing: openProtocol(route(intent.landing, opts.landing ?? INTENT_LANDING_PATH, frontend()), { sticky: true }),
40
+ }
41
+ }
42
+
43
+ export type IntentProtocols = ReturnType<typeof makeIntentProtocols>
@@ -0,0 +1,33 @@
1
+ import { ResilientError } from '@owlmeans/error'
2
+
3
+ export class IntentError extends ResilientError {
4
+ public static override typeName = `ViableIntent${ResilientError.typeName}`
5
+
6
+ constructor(message: string = 'error') {
7
+ super(IntentError.typeName, `viable-intent:${message}`)
8
+ }
9
+ }
10
+
11
+ /** No stashed prompt under that reference — expired, already picked up, or never existed. */
12
+ export class IntentExpired extends IntentError {
13
+ public static override typeName = `Expired${IntentError.typeName}`
14
+ /** The reference answers nothing (any more): answered 404. */
15
+ public static httpStatus = 404
16
+
17
+ constructor(message: string = 'error') {
18
+ super(`expired:${message}`)
19
+ this.type = IntentExpired.typeName
20
+ }
21
+ }
22
+
23
+ /** Too many stashes or pickups from one address, or across everyone. */
24
+ export class IntentThrottled extends IntentError {
25
+ public static override typeName = `Throttled${IntentError.typeName}`
26
+ /** Answered 429. */
27
+ public static httpStatus = 429
28
+
29
+ constructor(message: string = 'error') {
30
+ super(`throttled:${message}`)
31
+ this.type = IntentThrottled.typeName
32
+ }
33
+ }
@@ -0,0 +1,67 @@
1
+ import { DISPATCHER } from '@owlmeans/auth'
2
+ import { HOME } from '@owlmeans/context'
3
+ import type { ShallowFlow } from '@owlmeans/flow'
4
+ import { INTENT_FLOW, INTENT_PAYLOAD_REF, intent, IntentFlowStep } from './consts.js'
5
+
6
+ const payloadMap = { [INTENT_PAYLOAD_REF]: 0 }
7
+
8
+ /**
9
+ * The hand-off flow both sides walk.
10
+ *
11
+ * `compose` runs on the public site: the prompt is stashed and `handoff` carries the reference to
12
+ * `land`, whose module is the platform's landing screen — so the site redirects to
13
+ * `land`'s address with the payload as query. The landing then enters at `land` FRESH (the
14
+ * reference arrives as `?ref=`, never as a serialized token, which the platform's own sign-in
15
+ * parses from `?flow=` on every page), and either goes on to `review` (signed in) or parks the flow
16
+ * with `suspendFlow` at `sign-in`, whose non-explicit way forward is `review` — the home screen —
17
+ * so whichever sign-in method finishes lands there.
18
+ *
19
+ * The steps address CONCRETE entrypoint aliases, never `$`-prefixed references: this flow is never
20
+ * the live `FlowService` model and nothing here needs `configureFlows`.
21
+ */
22
+ export const intentFlow: ShallowFlow = {
23
+ flow: INTENT_FLOW,
24
+ initialStep: IntentFlowStep.Compose,
25
+ steps: {
26
+ [IntentFlowStep.Compose]: {
27
+ index: 0,
28
+ step: IntentFlowStep.Compose,
29
+ service: '',
30
+ initial: true,
31
+ payloadMap,
32
+ transitions: {
33
+ handoff: { transition: 'handoff', step: IntentFlowStep.Land },
34
+ },
35
+ },
36
+ [IntentFlowStep.Land]: {
37
+ index: 1,
38
+ step: IntentFlowStep.Land,
39
+ service: '',
40
+ module: intent.landing,
41
+ initial: true,
42
+ payloadMap,
43
+ transitions: {
44
+ review: { transition: 'review', step: IntentFlowStep.Review },
45
+ 'sign-in': { transition: 'sign-in', step: IntentFlowStep.SignIn, explicit: true },
46
+ },
47
+ },
48
+ [IntentFlowStep.SignIn]: {
49
+ index: 2,
50
+ step: IntentFlowStep.SignIn,
51
+ service: '',
52
+ module: DISPATCHER,
53
+ payloadMap,
54
+ transitions: {
55
+ next: { transition: 'next', step: IntentFlowStep.Review },
56
+ },
57
+ },
58
+ [IntentFlowStep.Review]: {
59
+ index: 3,
60
+ step: IntentFlowStep.Review,
61
+ service: '',
62
+ module: HOME,
63
+ payloadMap,
64
+ transitions: {},
65
+ },
66
+ },
67
+ }
@@ -0,0 +1,6 @@
1
+ export * from './consts.js'
2
+ export * from './schemas.js'
3
+ export * from './errors.js'
4
+ export * from './entrypoints.js'
5
+ export * from './flow.js'
6
+ export type * from './types.js'
@@ -0,0 +1,27 @@
1
+ import type { JSONSchemaType } from 'ajv'
2
+ import { INTENT_PROMPT_MAX, INTENT_REF_LENGTH, INTENT_REF_PATTERN } from './consts.js'
3
+ import type { IntentPickupBody, IntentStashBody } from './types.js'
4
+
5
+ /**
6
+ * The stash body. `consent` is a constant `true`, not a boolean: the data-processing confirmation is
7
+ * a precondition of the request existing, so the wire refuses its absence instead of the handler
8
+ * having to remember to look.
9
+ */
10
+ export const IntentStashBodySchema: JSONSchemaType<IntentStashBody> = {
11
+ type: 'object',
12
+ properties: {
13
+ prompt: { type: 'string', minLength: 1, maxLength: INTENT_PROMPT_MAX },
14
+ consent: { type: 'boolean', const: true },
15
+ },
16
+ required: ['prompt', 'consent'],
17
+ additionalProperties: false,
18
+ }
19
+
20
+ export const IntentPickupBodySchema: JSONSchemaType<IntentPickupBody> = {
21
+ type: 'object',
22
+ properties: {
23
+ ref: { type: 'string', minLength: INTENT_REF_LENGTH, maxLength: INTENT_REF_LENGTH, pattern: INTENT_REF_PATTERN },
24
+ },
25
+ required: ['ref'],
26
+ additionalProperties: false,
27
+ }