@opengroundplan/core 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-runtime.d.ts +81 -0
  3. package/dist/agent-runtime.js +108 -0
  4. package/dist/agent-runtime.js.map +1 -0
  5. package/dist/analysis.d.ts +36 -0
  6. package/dist/analysis.js +106 -0
  7. package/dist/analysis.js.map +1 -0
  8. package/dist/analyze.d.ts +26 -0
  9. package/dist/analyze.js +155 -0
  10. package/dist/analyze.js.map +1 -0
  11. package/dist/assessment.d.ts +39 -0
  12. package/dist/assessment.js +81 -0
  13. package/dist/assessment.js.map +1 -0
  14. package/dist/autoplan.d.ts +60 -0
  15. package/dist/autoplan.js +219 -0
  16. package/dist/autoplan.js.map +1 -0
  17. package/dist/blueprint.d.ts +102 -0
  18. package/dist/blueprint.js +490 -0
  19. package/dist/blueprint.js.map +1 -0
  20. package/dist/config.d.ts +11 -0
  21. package/dist/config.js +18 -0
  22. package/dist/config.js.map +1 -1
  23. package/dist/graph.d.ts +20 -0
  24. package/dist/graph.js +84 -0
  25. package/dist/graph.js.map +1 -0
  26. package/dist/improve.d.ts +20 -0
  27. package/dist/improve.js +50 -0
  28. package/dist/improve.js.map +1 -0
  29. package/dist/index.d.ts +15 -0
  30. package/dist/index.js +15 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/infer-llm.d.ts +29 -0
  33. package/dist/infer-llm.js +114 -0
  34. package/dist/infer-llm.js.map +1 -0
  35. package/dist/intent.js +24 -1
  36. package/dist/intent.js.map +1 -1
  37. package/dist/knowledge.d.ts +23 -0
  38. package/dist/knowledge.js +61 -0
  39. package/dist/knowledge.js.map +1 -0
  40. package/dist/library.d.ts +25 -0
  41. package/dist/library.js +89 -0
  42. package/dist/library.js.map +1 -0
  43. package/dist/loader.js +23 -5
  44. package/dist/loader.js.map +1 -1
  45. package/dist/pipeline.d.ts +25 -0
  46. package/dist/pipeline.js +37 -0
  47. package/dist/pipeline.js.map +1 -0
  48. package/dist/schema.d.ts +113 -113
  49. package/dist/simulate.d.ts +15 -0
  50. package/dist/simulate.js +89 -0
  51. package/dist/simulate.js.map +1 -0
  52. package/dist/variables.d.ts +7 -0
  53. package/dist/variables.js +37 -0
  54. package/dist/variables.js.map +1 -0
  55. package/dist/verification.d.ts +23 -0
  56. package/dist/verification.js +61 -0
  57. package/dist/verification.js.map +1 -0
  58. package/package.json +7 -4
  59. package/templates/bases/fastapi-service/blueprint.yaml +2 -3
  60. package/templates/layers/auth-jwt/blueprint.yaml +3 -0
  61. package/templates/layers/auth-oidc/blueprint.yaml +1 -0
  62. package/templates/layers/db-mongo/blueprint.yaml +1 -0
  63. package/templates/layers/db-postgres/blueprint.yaml +3 -0
  64. package/templates/layers/db-sqlite/blueprint.yaml +1 -0
package/dist/schema.d.ts CHANGED
@@ -48,73 +48,73 @@ export declare const ArchitectureEntry: z.ZodEffects<z.ZodObject<{
48
48
  }, "strip", z.ZodTypeAny, {
49
49
  id: string;
50
50
  name: string;
51
+ sources: string[];
52
+ teamSize: {
53
+ min: number;
54
+ max: number;
55
+ };
51
56
  family: "application" | "system" | "frontend" | "data" | "ai";
52
57
  oneLine: string;
53
58
  bestFor: string[];
54
59
  avoidWhen: string[];
55
60
  complexity: "low" | "medium" | "high" | "very-high";
56
- teamSize: {
57
- min: number;
58
- max: number;
59
- };
60
61
  scores: Partial<Record<"maintainability" | "testability" | "deployability" | "simplicity" | "scalability" | "elasticity" | "responsiveness" | "fault-tolerance" | "evolvability" | "abstraction" | "interoperability" | "cost", number>>;
61
- stackFit: Partial<Record<"typescript" | "python" | "dotnet" | "node" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
62
+ stackFit: Partial<Record<"typescript" | "node" | "python" | "dotnet" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
62
63
  keyTradeoff: string;
63
- sources: string[];
64
64
  overlay?: string | undefined;
65
65
  guidance?: string | undefined;
66
66
  }, {
67
67
  id: string;
68
68
  name: string;
69
+ sources: string[];
70
+ teamSize: {
71
+ min: number;
72
+ max: number;
73
+ };
69
74
  family: "application" | "system" | "frontend" | "data" | "ai";
70
75
  oneLine: string;
71
76
  bestFor: string[];
72
77
  avoidWhen: string[];
73
78
  complexity: "low" | "medium" | "high" | "very-high";
74
- teamSize: {
75
- min: number;
76
- max: number;
77
- };
78
79
  scores: Partial<Record<"maintainability" | "testability" | "deployability" | "simplicity" | "scalability" | "elasticity" | "responsiveness" | "fault-tolerance" | "evolvability" | "abstraction" | "interoperability" | "cost", number>>;
79
- stackFit: Partial<Record<"typescript" | "python" | "dotnet" | "node" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
80
+ stackFit: Partial<Record<"typescript" | "node" | "python" | "dotnet" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
80
81
  keyTradeoff: string;
81
- sources: string[];
82
82
  overlay?: string | undefined;
83
83
  guidance?: string | undefined;
84
84
  }>, {
85
85
  id: string;
86
86
  name: string;
87
+ sources: string[];
88
+ teamSize: {
89
+ min: number;
90
+ max: number;
91
+ };
87
92
  family: "application" | "system" | "frontend" | "data" | "ai";
88
93
  oneLine: string;
89
94
  bestFor: string[];
90
95
  avoidWhen: string[];
91
96
  complexity: "low" | "medium" | "high" | "very-high";
92
- teamSize: {
93
- min: number;
94
- max: number;
95
- };
96
97
  scores: Partial<Record<"maintainability" | "testability" | "deployability" | "simplicity" | "scalability" | "elasticity" | "responsiveness" | "fault-tolerance" | "evolvability" | "abstraction" | "interoperability" | "cost", number>>;
97
- stackFit: Partial<Record<"typescript" | "python" | "dotnet" | "node" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
98
+ stackFit: Partial<Record<"typescript" | "node" | "python" | "dotnet" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
98
99
  keyTradeoff: string;
99
- sources: string[];
100
100
  overlay?: string | undefined;
101
101
  guidance?: string | undefined;
102
102
  }, {
103
103
  id: string;
104
104
  name: string;
105
+ sources: string[];
106
+ teamSize: {
107
+ min: number;
108
+ max: number;
109
+ };
105
110
  family: "application" | "system" | "frontend" | "data" | "ai";
106
111
  oneLine: string;
107
112
  bestFor: string[];
108
113
  avoidWhen: string[];
109
114
  complexity: "low" | "medium" | "high" | "very-high";
110
- teamSize: {
111
- min: number;
112
- max: number;
113
- };
114
115
  scores: Partial<Record<"maintainability" | "testability" | "deployability" | "simplicity" | "scalability" | "elasticity" | "responsiveness" | "fault-tolerance" | "evolvability" | "abstraction" | "interoperability" | "cost", number>>;
115
- stackFit: Partial<Record<"typescript" | "python" | "dotnet" | "node" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
116
+ stackFit: Partial<Record<"typescript" | "node" | "python" | "dotnet" | "go" | "rust" | "java" | "polyglot", "excellent" | "good" | "workable" | "awkward" | "n/a">>;
116
117
  keyTradeoff: string;
117
- sources: string[];
118
118
  overlay?: string | undefined;
119
119
  guidance?: string | undefined;
120
120
  }>;
@@ -137,8 +137,8 @@ export declare const Variable: z.ZodObject<{
137
137
  /** Only ask when this holds — keeps the interview short. */
138
138
  when: z.ZodOptional<z.ZodString>;
139
139
  }, "strip", z.ZodTypeAny, {
140
- name: string;
141
140
  type: "string" | "number" | "boolean" | "select" | "multiselect";
141
+ name: string;
142
142
  prompt: string;
143
143
  required: boolean;
144
144
  choices?: {
@@ -148,8 +148,8 @@ export declare const Variable: z.ZodObject<{
148
148
  default?: unknown;
149
149
  when?: string | undefined;
150
150
  }, {
151
- name: string;
152
151
  type: "string" | "number" | "boolean" | "select" | "multiselect";
152
+ name: string;
153
153
  prompt: string;
154
154
  choices?: {
155
155
  value: string;
@@ -176,14 +176,14 @@ export declare const FileRule: z.ZodObject<{
176
176
  from: string;
177
177
  to: string;
178
178
  raw: boolean;
179
- onConflict: "skip" | "overwrite" | "merge" | "merge-json" | "append" | "fail";
179
+ onConflict: "overwrite" | "merge" | "skip" | "merge-json" | "append" | "fail";
180
180
  when?: string | undefined;
181
181
  }, {
182
182
  from: string;
183
183
  when?: string | undefined;
184
184
  to?: string | undefined;
185
185
  raw?: boolean | undefined;
186
- onConflict?: "skip" | "overwrite" | "merge" | "merge-json" | "append" | "fail" | undefined;
186
+ onConflict?: "overwrite" | "merge" | "skip" | "merge-json" | "append" | "fail" | undefined;
187
187
  }>;
188
188
  /**
189
189
  * Licenses we may copy and adapt code from. Permissive only — anything copyleft would
@@ -303,8 +303,8 @@ export declare const Blueprint: z.ZodObject<{
303
303
  /** Only ask when this holds — keeps the interview short. */
304
304
  when: z.ZodOptional<z.ZodString>;
305
305
  }, "strip", z.ZodTypeAny, {
306
- name: string;
307
306
  type: "string" | "number" | "boolean" | "select" | "multiselect";
307
+ name: string;
308
308
  prompt: string;
309
309
  required: boolean;
310
310
  choices?: {
@@ -314,8 +314,8 @@ export declare const Blueprint: z.ZodObject<{
314
314
  default?: unknown;
315
315
  when?: string | undefined;
316
316
  }, {
317
- name: string;
318
317
  type: "string" | "number" | "boolean" | "select" | "multiselect";
318
+ name: string;
319
319
  prompt: string;
320
320
  choices?: {
321
321
  value: string;
@@ -336,14 +336,14 @@ export declare const Blueprint: z.ZodObject<{
336
336
  from: string;
337
337
  to: string;
338
338
  raw: boolean;
339
- onConflict: "skip" | "overwrite" | "merge" | "merge-json" | "append" | "fail";
339
+ onConflict: "overwrite" | "merge" | "skip" | "merge-json" | "append" | "fail";
340
340
  when?: string | undefined;
341
341
  }, {
342
342
  from: string;
343
343
  when?: string | undefined;
344
344
  to?: string | undefined;
345
345
  raw?: boolean | undefined;
346
- onConflict?: "skip" | "overwrite" | "merge" | "merge-json" | "append" | "fail" | undefined;
346
+ onConflict?: "overwrite" | "merge" | "skip" | "merge-json" | "append" | "fail" | undefined;
347
347
  }>, "many">>;
348
348
  /** Shell steps run after apply; each declares why it is safe to run unattended. */
349
349
  postApply: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -356,30 +356,20 @@ export declare const Blueprint: z.ZodObject<{
356
356
  when?: string | undefined;
357
357
  }, {
358
358
  run: string;
359
- when?: string | undefined;
360
359
  optional?: boolean | undefined;
360
+ when?: string | undefined;
361
361
  }>, "many">>;
362
362
  }, "strip", z.ZodTypeAny, {
363
- id: string;
364
- name: string;
365
- sources: {
366
- name: string;
367
- url: string;
368
- license: "MIT" | "Apache-2.0" | "BSD-2-Clause" | "BSD-3-Clause" | "ISC" | "Unlicense" | "0BSD" | "CC0-1.0";
369
- adapted: string;
363
+ files: {
364
+ from: string;
365
+ to: string;
366
+ raw: boolean;
367
+ onConflict: "overwrite" | "merge" | "skip" | "merge-json" | "append" | "fail";
368
+ when?: string | undefined;
370
369
  }[];
371
- kind: "base" | "layer" | "architecture" | "agent-kit";
372
- description: string;
373
- tags: string[];
374
- requires: string[];
375
- conflicts: string[];
376
- provides: string[];
377
- supportsArchitectures: string[];
378
- peerProvidedBy: string[];
379
- choiceDefault: boolean;
380
370
  variables: {
381
- name: string;
382
371
  type: "string" | "number" | "boolean" | "select" | "multiselect";
372
+ name: string;
383
373
  prompt: string;
384
374
  required: boolean;
385
375
  choices?: {
@@ -389,18 +379,28 @@ export declare const Blueprint: z.ZodObject<{
389
379
  default?: unknown;
390
380
  when?: string | undefined;
391
381
  }[];
392
- files: {
393
- from: string;
394
- to: string;
395
- raw: boolean;
396
- onConflict: "skip" | "overwrite" | "merge" | "merge-json" | "append" | "fail";
397
- when?: string | undefined;
398
- }[];
399
382
  postApply: {
400
383
  run: string;
401
384
  optional: boolean;
402
385
  when?: string | undefined;
403
386
  }[];
387
+ id: string;
388
+ kind: "architecture" | "base" | "layer" | "agent-kit";
389
+ name: string;
390
+ description: string;
391
+ sources: {
392
+ name: string;
393
+ url: string;
394
+ license: "MIT" | "Apache-2.0" | "BSD-2-Clause" | "BSD-3-Clause" | "ISC" | "Unlicense" | "0BSD" | "CC0-1.0";
395
+ adapted: string;
396
+ }[];
397
+ tags: string[];
398
+ requires: string[];
399
+ conflicts: string[];
400
+ provides: string[];
401
+ supportsArchitectures: string[];
402
+ peerProvidedBy: string[];
403
+ choiceDefault: boolean;
404
404
  commands?: {
405
405
  build: string;
406
406
  test: string;
@@ -408,13 +408,37 @@ export declare const Blueprint: z.ZodObject<{
408
408
  typecheck?: string | undefined;
409
409
  dev?: string | undefined;
410
410
  } | undefined;
411
- stack?: "typescript" | "python" | "dotnet" | "node" | "go" | "rust" | "java" | "polyglot" | undefined;
411
+ stack?: "typescript" | "node" | "python" | "dotnet" | "go" | "rust" | "java" | "polyglot" | undefined;
412
412
  choiceSet?: string | undefined;
413
413
  }, {
414
414
  id: string;
415
+ kind: "architecture" | "base" | "layer" | "agent-kit";
415
416
  name: string;
416
- kind: "base" | "layer" | "architecture" | "agent-kit";
417
417
  description: string;
418
+ files?: {
419
+ from: string;
420
+ when?: string | undefined;
421
+ to?: string | undefined;
422
+ raw?: boolean | undefined;
423
+ onConflict?: "overwrite" | "merge" | "skip" | "merge-json" | "append" | "fail" | undefined;
424
+ }[] | undefined;
425
+ variables?: {
426
+ type: "string" | "number" | "boolean" | "select" | "multiselect";
427
+ name: string;
428
+ prompt: string;
429
+ choices?: {
430
+ value: string;
431
+ label: string;
432
+ }[] | undefined;
433
+ default?: unknown;
434
+ required?: boolean | undefined;
435
+ when?: string | undefined;
436
+ }[] | undefined;
437
+ postApply?: {
438
+ run: string;
439
+ optional?: boolean | undefined;
440
+ when?: string | undefined;
441
+ }[] | undefined;
418
442
  sources?: {
419
443
  name: string;
420
444
  url: string;
@@ -428,7 +452,7 @@ export declare const Blueprint: z.ZodObject<{
428
452
  typecheck?: string | undefined;
429
453
  dev?: string | undefined;
430
454
  } | undefined;
431
- stack?: "typescript" | "python" | "dotnet" | "node" | "go" | "rust" | "java" | "polyglot" | undefined;
455
+ stack?: "typescript" | "node" | "python" | "dotnet" | "go" | "rust" | "java" | "polyglot" | undefined;
432
456
  tags?: string[] | undefined;
433
457
  requires?: string[] | undefined;
434
458
  conflicts?: string[] | undefined;
@@ -437,30 +461,6 @@ export declare const Blueprint: z.ZodObject<{
437
461
  choiceSet?: string | undefined;
438
462
  peerProvidedBy?: string[] | undefined;
439
463
  choiceDefault?: boolean | undefined;
440
- variables?: {
441
- name: string;
442
- type: "string" | "number" | "boolean" | "select" | "multiselect";
443
- prompt: string;
444
- choices?: {
445
- value: string;
446
- label: string;
447
- }[] | undefined;
448
- default?: unknown;
449
- required?: boolean | undefined;
450
- when?: string | undefined;
451
- }[] | undefined;
452
- files?: {
453
- from: string;
454
- when?: string | undefined;
455
- to?: string | undefined;
456
- raw?: boolean | undefined;
457
- onConflict?: "skip" | "overwrite" | "merge" | "merge-json" | "append" | "fail" | undefined;
458
- }[] | undefined;
459
- postApply?: {
460
- run: string;
461
- when?: string | undefined;
462
- optional?: boolean | undefined;
463
- }[] | undefined;
464
464
  }>;
465
465
  export declare const AdapterCapability: z.ZodEnum<["instructions", "nested-instructions", "glob-scoped-rules", "slash-commands", "subagents", "hooks", "skills", "mcp"]>;
466
466
  /**
@@ -503,14 +503,14 @@ export declare const Invocation: z.ZodObject<{
503
503
  successor: z.ZodOptional<z.ZodString>;
504
504
  source: z.ZodString;
505
505
  }, "strip", z.ZodTypeAny, {
506
+ source: string;
506
507
  since: string;
507
508
  note: string;
508
- source: string;
509
509
  successor?: string | undefined;
510
510
  }, {
511
+ source: string;
511
512
  since: string;
512
513
  note: string;
513
- source: string;
514
514
  successor?: string | undefined;
515
515
  }>>;
516
516
  }, "strip", z.ZodTypeAny, {
@@ -524,9 +524,9 @@ export declare const Invocation: z.ZodObject<{
524
524
  verifiedOn: string;
525
525
  verified: string;
526
526
  deprecated?: {
527
+ source: string;
527
528
  since: string;
528
529
  note: string;
529
- source: string;
530
530
  successor?: string | undefined;
531
531
  } | undefined;
532
532
  }, {
@@ -540,9 +540,9 @@ export declare const Invocation: z.ZodObject<{
540
540
  modelFlag?: string[] | undefined;
541
541
  detect?: string[] | undefined;
542
542
  deprecated?: {
543
+ source: string;
543
544
  since: string;
544
545
  note: string;
545
- source: string;
546
546
  successor?: string | undefined;
547
547
  } | undefined;
548
548
  }>;
@@ -585,14 +585,14 @@ export declare const Adapter: z.ZodObject<{
585
585
  successor: z.ZodOptional<z.ZodString>;
586
586
  source: z.ZodString;
587
587
  }, "strip", z.ZodTypeAny, {
588
+ source: string;
588
589
  since: string;
589
590
  note: string;
590
- source: string;
591
591
  successor?: string | undefined;
592
592
  }, {
593
+ source: string;
593
594
  since: string;
594
595
  note: string;
595
- source: string;
596
596
  successor?: string | undefined;
597
597
  }>>;
598
598
  }, "strip", z.ZodTypeAny, {
@@ -606,9 +606,9 @@ export declare const Adapter: z.ZodObject<{
606
606
  verifiedOn: string;
607
607
  verified: string;
608
608
  deprecated?: {
609
+ source: string;
609
610
  since: string;
610
611
  note: string;
611
- source: string;
612
612
  successor?: string | undefined;
613
613
  } | undefined;
614
614
  }, {
@@ -622,9 +622,9 @@ export declare const Adapter: z.ZodObject<{
622
622
  modelFlag?: string[] | undefined;
623
623
  detect?: string[] | undefined;
624
624
  deprecated?: {
625
+ source: string;
625
626
  since: string;
626
627
  note: string;
627
- source: string;
628
628
  successor?: string | undefined;
629
629
  } | undefined;
630
630
  }>>;
@@ -682,9 +682,9 @@ export declare const Adapter: z.ZodObject<{
682
682
  verifiedOn: string;
683
683
  verified: string;
684
684
  deprecated?: {
685
+ source: string;
685
686
  since: string;
686
687
  note: string;
687
- source: string;
688
688
  successor?: string | undefined;
689
689
  } | undefined;
690
690
  } | undefined;
@@ -704,9 +704,9 @@ export declare const Adapter: z.ZodObject<{
704
704
  modelFlag?: string[] | undefined;
705
705
  detect?: string[] | undefined;
706
706
  deprecated?: {
707
+ source: string;
707
708
  since: string;
708
709
  note: string;
709
- source: string;
710
710
  successor?: string | undefined;
711
711
  } | undefined;
712
712
  } | undefined;
@@ -745,8 +745,8 @@ export declare const RegistryItem: z.ZodObject<{
745
745
  body: z.ZodDefault<z.ZodString>;
746
746
  }, "strip", z.ZodTypeAny, {
747
747
  id: string;
748
- name: string;
749
748
  kind: "command" | "agent" | "hook" | "skill";
749
+ name: string;
750
750
  description: string;
751
751
  tags: string[];
752
752
  targets: string[];
@@ -755,12 +755,12 @@ export declare const RegistryItem: z.ZodObject<{
755
755
  when?: string | undefined;
756
756
  }, {
757
757
  id: string;
758
- name: string;
759
758
  kind: "command" | "agent" | "hook" | "skill";
759
+ name: string;
760
760
  description: string;
761
761
  targets: string[];
762
- when?: string | undefined;
763
762
  tags?: string[] | undefined;
763
+ when?: string | undefined;
764
764
  requiresCapability?: ("instructions" | "nested-instructions" | "glob-scoped-rules" | "slash-commands" | "subagents" | "hooks" | "skills" | "mcp")[] | undefined;
765
765
  body?: string | undefined;
766
766
  }>;
@@ -773,13 +773,13 @@ export declare const PlannedFile: z.ZodObject<{
773
773
  }, "strip", z.ZodTypeAny, {
774
774
  path: string;
775
775
  source: string;
776
- action: "skip" | "overwrite" | "merge" | "create";
776
+ action: "create" | "overwrite" | "merge" | "skip";
777
777
  bytes: number;
778
778
  fromBlueprint: string;
779
779
  }, {
780
780
  path: string;
781
781
  source: string;
782
- action: "skip" | "overwrite" | "merge" | "create";
782
+ action: "create" | "overwrite" | "merge" | "skip";
783
783
  bytes: number;
784
784
  fromBlueprint: string;
785
785
  }>;
@@ -799,13 +799,13 @@ export declare const Plan: z.ZodObject<{
799
799
  }, "strip", z.ZodTypeAny, {
800
800
  path: string;
801
801
  source: string;
802
- action: "skip" | "overwrite" | "merge" | "create";
802
+ action: "create" | "overwrite" | "merge" | "skip";
803
803
  bytes: number;
804
804
  fromBlueprint: string;
805
805
  }, {
806
806
  path: string;
807
807
  source: string;
808
- action: "skip" | "overwrite" | "merge" | "create";
808
+ action: "create" | "overwrite" | "merge" | "skip";
809
809
  bytes: number;
810
810
  fromBlueprint: string;
811
811
  }>, "many">;
@@ -824,42 +824,42 @@ export declare const Plan: z.ZodObject<{
824
824
  /** Rendered NOTICE content when any blueprint adapts upstream code; absent otherwise. */
825
825
  notice: z.ZodOptional<z.ZodString>;
826
826
  }, "strip", z.ZodTypeAny, {
827
- variables: Record<string, unknown>;
827
+ adapters: string[];
828
828
  files: {
829
829
  path: string;
830
830
  source: string;
831
- action: "skip" | "overwrite" | "merge" | "create";
831
+ action: "create" | "overwrite" | "merge" | "skip";
832
832
  bytes: number;
833
833
  fromBlueprint: string;
834
834
  }[];
835
+ solution: string;
836
+ target: string;
837
+ blueprints: string[];
838
+ variables: Record<string, unknown>;
835
839
  postApply: {
836
840
  run: string;
837
841
  optional: boolean;
838
842
  }[];
839
- solution: string;
840
- target: string;
841
- blueprints: string[];
842
- adapters: string[];
843
843
  warnings: string[];
844
844
  architecture?: string | undefined;
845
845
  notice?: string | undefined;
846
846
  }, {
847
- variables: Record<string, unknown>;
847
+ adapters: string[];
848
848
  files: {
849
849
  path: string;
850
850
  source: string;
851
- action: "skip" | "overwrite" | "merge" | "create";
851
+ action: "create" | "overwrite" | "merge" | "skip";
852
852
  bytes: number;
853
853
  fromBlueprint: string;
854
854
  }[];
855
+ solution: string;
856
+ target: string;
857
+ blueprints: string[];
858
+ variables: Record<string, unknown>;
855
859
  postApply: {
856
860
  run: string;
857
861
  optional?: boolean | undefined;
858
862
  }[];
859
- solution: string;
860
- target: string;
861
- blueprints: string[];
862
- adapters: string[];
863
863
  architecture?: string | undefined;
864
864
  warnings?: string[] | undefined;
865
865
  notice?: string | undefined;
@@ -0,0 +1,15 @@
1
+ import type { AutoSelection } from './autoplan.js';
2
+ export type Scale = 'small' | 'growing' | 'large';
3
+ export interface Simulation {
4
+ scale: Scale;
5
+ requestsPerDay: string;
6
+ peakConcurrency: string;
7
+ instances: string;
8
+ dbQueriesPerSecond: string;
9
+ storageGrowth: string;
10
+ monthlyCost: string;
11
+ bottlenecks: string[];
12
+ scalingLimits: string[];
13
+ }
14
+ export declare function simulate(selection: AutoSelection): Simulation;
15
+ export declare function renderSimulation(sim: Simulation): string;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Simulation — a back-of-envelope projection of what the system will face before a line is
3
+ * written: traffic, concurrency, infrastructure, database load, storage growth, the bottlenecks
4
+ * that will appear, and the monthly cost. Deterministic bands keyed on the inferred scale and the
5
+ * selected layers — not a benchmark, a sanity check that the architecture matches the load.
6
+ */
7
+ import { costEstimate } from './analysis.js';
8
+ const has = (layers, prefix) => layers.some((l) => l === prefix || l.startsWith(prefix));
9
+ /** Deterministic bands per scale — a defensible order of magnitude, not a precise number. */
10
+ const BANDS = {
11
+ small: { requestsPerDay: '~1k', peakConcurrency: '~5', instances: '1', dbQueriesPerSecond: '~1', storageGrowth: '~1 GB/mo' },
12
+ growing: { requestsPerDay: '~100k', peakConcurrency: '~50', instances: '2–3', dbQueriesPerSecond: '~20', storageGrowth: '~10 GB/mo' },
13
+ large: { requestsPerDay: '~10M', peakConcurrency: '~1,000', instances: 'autoscaling', dbQueriesPerSecond: '~500', storageGrowth: '~100 GB/mo' },
14
+ };
15
+ function inferScale(s) {
16
+ const sig = (id) => s.intent.matched.some((m) => m.signal === id);
17
+ if (sig('high-traffic'))
18
+ return 'large';
19
+ if (sig('multi-tenant') || (s.intent.priorities.scalability ?? 0) >= 3)
20
+ return 'growing';
21
+ return 'small';
22
+ }
23
+ export function simulate(selection) {
24
+ const scale = inferScale(selection);
25
+ const layers = selection.layers;
26
+ const bottlenecks = [];
27
+ const scalingLimits = [];
28
+ if (scale !== 'small' && !has(layers, 'cache')) {
29
+ bottlenecks.push('Database read load — every request hits the datastore with no cache in front.');
30
+ }
31
+ if (scale !== 'small' && !has(layers, 'queue')) {
32
+ bottlenecks.push('Synchronous request path — slow work (email, exports, webhooks) blocks the response with no queue.');
33
+ }
34
+ if (layers.includes('db-sqlite')) {
35
+ bottlenecks.push('Single writer — SQLite serialises writes; concurrent writes will contend.');
36
+ scalingLimits.push('SQLite is single-node — you cannot scale the datastore horizontally.');
37
+ }
38
+ if (!has(layers, 'observability') && scale !== 'small') {
39
+ bottlenecks.push('Blind spots — without observability you will not see the bottleneck when it appears.');
40
+ }
41
+ if (scale === 'large')
42
+ scalingLimits.push('At this scale, stateless app tiers and a read-replica or sharded datastore are assumed.');
43
+ const cost = costEstimate(selection);
44
+ const multiplier = scale === 'large' ? 30 : scale === 'growing' ? 4 : 1;
45
+ const range = cost.reduce((acc, band) => {
46
+ const [lo, hi] = parseBand(band.monthly);
47
+ return { lo: acc.lo + lo * multiplier, hi: acc.hi + hi * multiplier };
48
+ }, { lo: 0, hi: 0 });
49
+ return {
50
+ scale,
51
+ ...BANDS[scale],
52
+ monthlyCost: `$${Math.round(range.lo)}–${Math.round(range.hi)}${scale === 'large' ? '+' : ''}`,
53
+ bottlenecks,
54
+ scalingLimits,
55
+ };
56
+ }
57
+ /** Parse a "$15–60" style band into [low, high]; the variable "+" bands read as their low bound. */
58
+ function parseBand(text) {
59
+ const nums = text.replace(/[$,+]/g, '').split(/[–-]/).map((n) => Number(n.trim()));
60
+ const lo = Number.isFinite(nums[0]) ? nums[0] : 0;
61
+ const hi = Number.isFinite(nums[1]) ? nums[1] : lo;
62
+ return [lo, hi];
63
+ }
64
+ export function renderSimulation(sim) {
65
+ return [
66
+ `# Simulation`,
67
+ ``,
68
+ `Projected load at **${sim.scale}** scale — an order-of-magnitude sanity check, not a benchmark.`,
69
+ ``,
70
+ `| | |`,
71
+ `|---|---|`,
72
+ `| Requests/day | ${sim.requestsPerDay} |`,
73
+ `| Peak concurrency | ${sim.peakConcurrency} |`,
74
+ `| App instances | ${sim.instances} |`,
75
+ `| DB queries/sec | ${sim.dbQueriesPerSecond} |`,
76
+ `| Storage growth | ${sim.storageGrowth} |`,
77
+ `| Est. monthly cost | ${sim.monthlyCost} |`,
78
+ ``,
79
+ `## Expected bottlenecks`,
80
+ ``,
81
+ ...(sim.bottlenecks.length ? sim.bottlenecks.map((b) => `- ${b}`) : ['- None at this scale with the selected layers.']),
82
+ ``,
83
+ `## Scaling limits`,
84
+ ``,
85
+ ...(sim.scalingLimits.length ? sim.scalingLimits.map((l) => `- ${l}`) : ['- No hard limits identified for this selection.']),
86
+ ``,
87
+ ].join('\n');
88
+ }
89
+ //# sourceMappingURL=simulate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate.js","sourceRoot":"","sources":["../src/simulate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB7C,MAAM,GAAG,GAAG,CAAC,MAAgB,EAAE,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AAE3G,6FAA6F;AAC7F,MAAM,KAAK,GAA+F;IACxG,KAAK,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE;IAC5H,OAAO,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE;IACrI,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE;CAChJ,CAAC;AAEF,SAAS,UAAU,CAAC,CAAgB;IAClC,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC;IAC1E,IAAI,GAAG,CAAC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/** Active variables with no default — a blueprint bug, surfaced rather than silently blanked. */
5
+ missing: string[];
6
+ }
7
+ export declare function resolveVariableDefaults(blueprints: Blueprint[], context: Record<string, unknown>, overrides?: Record<string, unknown>): ResolvedVariables;