@specverse/engines 5.2.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/prompts/core/standard/default/analyse.prompt.yaml +12 -3
- package/assets/prompts/core/standard/default/behavior.prompt.yaml +37 -30
- package/assets/prompts/core/standard/default/create.prompt.yaml +11 -3
- package/assets/prompts/core/standard/v9/analyse.prompt.yaml +12 -3
- package/assets/prompts/core/standard/v9/behavior.prompt.yaml +37 -30
- package/assets/prompts/core/standard/v9/create.prompt.yaml +11 -3
- package/dist/ai/behavior-ai-service.d.ts +35 -28
- package/dist/ai/behavior-ai-service.d.ts.map +1 -1
- package/dist/ai/behavior-ai-service.js +95 -128
- package/dist/ai/behavior-ai-service.js.map +1 -1
- package/dist/ai/index.d.ts +26 -26
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +40 -29
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/model-resolver.d.ts +15 -0
- package/dist/ai/model-resolver.d.ts.map +1 -0
- package/dist/ai/model-resolver.js +87 -0
- package/dist/ai/model-resolver.js.map +1 -0
- package/dist/ai/providers/claude-cli.d.ts +25 -0
- package/dist/ai/providers/claude-cli.d.ts.map +1 -0
- package/dist/ai/providers/claude-cli.js +187 -0
- package/dist/ai/providers/claude-cli.js.map +1 -0
- package/dist/ai/providers/index.d.ts +8 -5
- package/dist/ai/providers/index.d.ts.map +1 -1
- package/dist/ai/providers/index.js +7 -5
- package/dist/ai/providers/index.js.map +1 -1
- package/dist/ai/providers/stub.d.ts +15 -0
- package/dist/ai/providers/stub.d.ts.map +1 -0
- package/dist/ai/providers/stub.js +64 -0
- package/dist/ai/providers/stub.js.map +1 -0
- package/dist/ai/skill-detection.d.ts +5 -0
- package/dist/ai/skill-detection.d.ts.map +1 -0
- package/dist/ai/skill-detection.js +27 -0
- package/dist/ai/skill-detection.js.map +1 -0
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +2 -2
- package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +2 -2
- package/package.json +8 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: analyse
|
|
2
|
-
version: "9.
|
|
2
|
+
version: "9.2.0"
|
|
3
3
|
description: Extract SpecVerse specifications from existing code with deployment policy recognition
|
|
4
4
|
author: SpecVerse Team
|
|
5
5
|
tags: [analysis, reverse-engineering, implementation, v9, deployment-policies, validate-fix-loop]
|
|
@@ -21,6 +21,15 @@ system:
|
|
|
21
21
|
- a deployments section showing the logical instances with operational policies
|
|
22
22
|
- a manifest section with the physical details about the deployment
|
|
23
23
|
|
|
24
|
+
OUTPUT FORMAT (critical):
|
|
25
|
+
- Emit the complete .specly content as YAML directly in your response,
|
|
26
|
+
wrapped in a single ```specly ... ``` code block.
|
|
27
|
+
- Do NOT use Write, Edit, or any file-saving tools — even if available.
|
|
28
|
+
The caller harvests the spec text from your response, not from disk.
|
|
29
|
+
- Do NOT prefix with prose, explanations, or status updates. Reply with
|
|
30
|
+
the code block as the primary output. Brief commentary AFTER the
|
|
31
|
+
block is OK.
|
|
32
|
+
|
|
24
33
|
context: |
|
|
25
34
|
Generate a FULL SpecVerse specification that represents the actual implementation
|
|
26
35
|
- this specification will be validated so must be syntactically correct
|
|
@@ -388,7 +397,7 @@ user:
|
|
|
388
397
|
- Use components: (plural) at top level
|
|
389
398
|
- Use snake_case for lifecycle states (NOT kebab-case)
|
|
390
399
|
- Include components, deployments (with policies), and manifest sections
|
|
391
|
-
-
|
|
400
|
+
- Output the spec inside a ```specly``` code block in your response (do not write to disk)
|
|
392
401
|
|
|
393
402
|
Step 2: VALIDATE
|
|
394
403
|
- Run: spv validate spec.specly --json
|
|
@@ -419,7 +428,7 @@ user:
|
|
|
419
428
|
- incorrect operation policy nesting
|
|
420
429
|
- invalid policy property names or values
|
|
421
430
|
- missing 'policies' wrapper in operations
|
|
422
|
-
*
|
|
431
|
+
* Update the spec inline in your response (do not edit a file on disk)
|
|
423
432
|
* Go back to Step 2
|
|
424
433
|
|
|
425
434
|
Continue the validate-fix loop until validation passes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: behavior
|
|
2
|
-
version: "9.
|
|
2
|
+
version: "9.2.0"
|
|
3
3
|
description: Generate pure TypeScript function bodies for SpecVerse behavior steps that don't match convention patterns
|
|
4
4
|
author: SpecVerse Team
|
|
5
5
|
tags: [behavior, code-generation, pure-function, typescript, realize]
|
|
@@ -10,58 +10,65 @@ system:
|
|
|
10
10
|
function bodies for behavior steps that couldn't be matched by the realize
|
|
11
11
|
engine's convention patterns.
|
|
12
12
|
|
|
13
|
+
minimalContext: |
|
|
13
14
|
PURE FUNCTION RULES (critical — violating these breaks the architecture):
|
|
14
15
|
1. NO database access (no prisma, no queries)
|
|
15
16
|
2. NO event publishing (no eventBus)
|
|
16
17
|
3. NO external services (no fetch, no email providers, no payment gateways)
|
|
17
18
|
4. NO imports, no require, no fs, no process
|
|
18
|
-
5. All data you need comes in via the `input` object parameter
|
|
19
|
+
5. All data you need comes in via the `input` object parameter (already destructured — you have the fields directly)
|
|
19
20
|
6. Return a plain result value (object, number, string) — the caller uses it
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
OUTPUT RULES:
|
|
23
|
+
1. Output ONLY the function body code (between { and })
|
|
24
|
+
2. First line: short comment summarising what the function does
|
|
25
|
+
3. No markdown fences, no explanation before or after
|
|
26
|
+
4. Throw Error('...') for failure cases with descriptive messages
|
|
27
|
+
5. If a step fundamentally requires external side effects, throw an error indicating that — do not fake it
|
|
28
|
+
|
|
29
|
+
fullContext: |
|
|
30
|
+
# SpecVerse context (for LLMs that don't have the SpecVerse skill loaded)
|
|
31
|
+
|
|
32
|
+
SpecVerse is a declarative specification language. You describe WHAT a
|
|
33
|
+
system does in a .specly file, and the engines generate HOW — backend
|
|
34
|
+
(Fastify/Prisma), frontend (React/Tailwind), CLI, tools, diagrams. The
|
|
35
|
+
behavior-generation step you're being asked to perform plugs a
|
|
36
|
+
specific gap: the realize engine matches most spec behavior steps
|
|
37
|
+
against convention patterns ("Find {Model}", "Set {field}",
|
|
38
|
+
"Send {event}") and emits them directly; for the rest, you fill in
|
|
39
|
+
the pure-function body.
|
|
40
|
+
|
|
41
|
+
Where your function fits:
|
|
24
42
|
|
|
25
|
-
Example flow:
|
|
26
43
|
```
|
|
27
|
-
// Controller (convention code)
|
|
44
|
+
// Controller (convention-generated code — NOT your job)
|
|
28
45
|
const order = await prisma.order.findUniqueOrThrow(...);
|
|
29
46
|
const customer = await prisma.customer.findUniqueOrThrow(...);
|
|
30
47
|
|
|
31
|
-
// Your function
|
|
48
|
+
// Your function — PURE calculation or transformation
|
|
32
49
|
const discount = await applyDiscountBasedOnLoyaltyTier({ order, customer });
|
|
33
50
|
// discount = { amount: 42, rate: 0.10 }
|
|
34
51
|
|
|
35
|
-
// Controller (convention code)
|
|
52
|
+
// Controller (convention-generated code — NOT your job)
|
|
36
53
|
await prisma.order.update({ where: { id }, data: { total: order.total - discount.amount } });
|
|
37
54
|
await eventBus.publish('OrderDiscounted', { orderId, discount });
|
|
38
55
|
```
|
|
39
56
|
|
|
40
|
-
Convention patterns
|
|
57
|
+
Convention patterns ALREADY auto-generated (don't re-implement these):
|
|
41
58
|
- "Find {Model} by {field}", "Create {Model}", "Update {Model}..."
|
|
42
59
|
- "Delete {Model}", "Transition {Model} to {state}"
|
|
43
60
|
- "Set/Increment/Decrement {field}", "Send {event} event"
|
|
44
61
|
|
|
45
|
-
You handle domain-specific
|
|
46
|
-
scoring, categorisation, validation.
|
|
62
|
+
You handle: domain-specific calculations, transformations, rules,
|
|
63
|
+
scoring, categorisation, validation logic. Anything where the behavior
|
|
64
|
+
step text doesn't match a convention pattern.
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
4. Return a meaningful result object
|
|
55
|
-
5. Throw Error('...') for failure cases with descriptive messages
|
|
56
|
-
6. NO await prisma.*, NO await eventBus.*, NO fetch, NO external calls
|
|
57
|
-
7. If the step fundamentally requires external side effects, throw an
|
|
58
|
-
error indicating that — do not fake it
|
|
59
|
-
|
|
60
|
-
OUTPUT FORMAT:
|
|
61
|
-
- No markdown fences
|
|
62
|
-
- No explanation before or after
|
|
63
|
-
- Just the function body code
|
|
64
|
-
- First line should be a comment summarizing what the function does
|
|
66
|
+
SpecVerse uses CURVED operations (Create, Update, Retrieve, Validate,
|
|
67
|
+
Evolve, Delete) on controllers. Validate is dry-run; Evolve handles
|
|
68
|
+
lifecycle state transitions. Models declare attributes, relationships,
|
|
69
|
+
and lifecycles. Full reference lives in the SpecVerse canonical guide
|
|
70
|
+
(`specverse://guide` resource, or `~/.claude/skills/specverse/reference/guide.md`
|
|
71
|
+
if the skill is installed).
|
|
65
72
|
|
|
66
73
|
examples:
|
|
67
74
|
- step: "Apply discount based on loyalty tier"
|
|
@@ -107,7 +114,7 @@ user:
|
|
|
107
114
|
|
|
108
115
|
The function MUST return {{returnType}}. If that's `any`, return a
|
|
109
116
|
reasonable result object describing what was computed. If it's a specific
|
|
110
|
-
type (e.g., { cost: number; days: number }), return an object matching
|
|
117
|
+
type (e.g., "{ cost: number; days: number }"), return an object matching
|
|
111
118
|
that shape exactly — the caller depends on those field names.
|
|
112
119
|
|
|
113
120
|
Output ONLY the function body (the code that goes between { and }).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: create
|
|
2
|
-
version: "9.
|
|
2
|
+
version: "9.2.0"
|
|
3
3
|
description: Generate minimal SpecVerse specifications from natural language requirements with deployment policies
|
|
4
4
|
author: SpecVerse Team
|
|
5
5
|
tags: [creation, requirements, minimal-spec, v9, deployment-policies, validate-fix-loop]
|
|
@@ -15,6 +15,14 @@ system:
|
|
|
15
15
|
Your task: Analyze requirements and generate the smallest possible valid specification that captures core business logic.
|
|
16
16
|
The SpecVerse inference engine will later expand these minimal specs into complete architectures.
|
|
17
17
|
|
|
18
|
+
OUTPUT FORMAT (critical):
|
|
19
|
+
- Emit the complete .specly content as YAML directly in your response,
|
|
20
|
+
wrapped in a single ```specly ... ``` code block.
|
|
21
|
+
- Do NOT use Write, Edit, or any file-saving tools — even if available.
|
|
22
|
+
The caller harvests the spec text from your response, not from disk.
|
|
23
|
+
- Do NOT prefix with prose or status updates. Reply with the code block
|
|
24
|
+
as the primary output. Brief commentary AFTER the block is OK.
|
|
25
|
+
|
|
18
26
|
context: |
|
|
19
27
|
CORE PRINCIPLES:
|
|
20
28
|
1. Extract core business entities and their relationships
|
|
@@ -310,7 +318,7 @@ user:
|
|
|
310
318
|
- Use components: (plural) at top level
|
|
311
319
|
- Use snake_case for lifecycle states (NOT kebab-case)
|
|
312
320
|
- Add deployment policies appropriate for scale
|
|
313
|
-
-
|
|
321
|
+
- Output the spec inside a ```specly``` code block in your response (do not write to disk)
|
|
314
322
|
|
|
315
323
|
Step 2: VALIDATE
|
|
316
324
|
- Run: spv validate spec.specly --json
|
|
@@ -336,7 +344,7 @@ user:
|
|
|
336
344
|
- invalid relationship syntax
|
|
337
345
|
- invalid deployment policy structure
|
|
338
346
|
- incorrect operation policy nesting
|
|
339
|
-
*
|
|
347
|
+
* Update the spec inline in your response (do not edit a file on disk)
|
|
340
348
|
* Go back to Step 2
|
|
341
349
|
|
|
342
350
|
Continue the validate-fix loop until validation passes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: analyse
|
|
2
|
-
version: "9.
|
|
2
|
+
version: "9.2.0"
|
|
3
3
|
description: Extract SpecVerse specifications from existing code with deployment policy recognition
|
|
4
4
|
author: SpecVerse Team
|
|
5
5
|
tags: [analysis, reverse-engineering, implementation, v9, deployment-policies, validate-fix-loop]
|
|
@@ -21,6 +21,15 @@ system:
|
|
|
21
21
|
- a deployments section showing the logical instances with operational policies
|
|
22
22
|
- a manifest section with the physical details about the deployment
|
|
23
23
|
|
|
24
|
+
OUTPUT FORMAT (critical):
|
|
25
|
+
- Emit the complete .specly content as YAML directly in your response,
|
|
26
|
+
wrapped in a single ```specly ... ``` code block.
|
|
27
|
+
- Do NOT use Write, Edit, or any file-saving tools — even if available.
|
|
28
|
+
The caller harvests the spec text from your response, not from disk.
|
|
29
|
+
- Do NOT prefix with prose, explanations, or status updates. Reply with
|
|
30
|
+
the code block as the primary output. Brief commentary AFTER the
|
|
31
|
+
block is OK.
|
|
32
|
+
|
|
24
33
|
context: |
|
|
25
34
|
Generate a FULL SpecVerse specification that represents the actual implementation
|
|
26
35
|
- this specification will be validated so must be syntactically correct
|
|
@@ -388,7 +397,7 @@ user:
|
|
|
388
397
|
- Use components: (plural) at top level
|
|
389
398
|
- Use snake_case for lifecycle states (NOT kebab-case)
|
|
390
399
|
- Include components, deployments (with policies), and manifest sections
|
|
391
|
-
-
|
|
400
|
+
- Output the spec inside a ```specly``` code block in your response (do not write to disk)
|
|
392
401
|
|
|
393
402
|
Step 2: VALIDATE
|
|
394
403
|
- Run: spv validate spec.specly --json
|
|
@@ -419,7 +428,7 @@ user:
|
|
|
419
428
|
- incorrect operation policy nesting
|
|
420
429
|
- invalid policy property names or values
|
|
421
430
|
- missing 'policies' wrapper in operations
|
|
422
|
-
*
|
|
431
|
+
* Update the spec inline in your response (do not edit a file on disk)
|
|
423
432
|
* Go back to Step 2
|
|
424
433
|
|
|
425
434
|
Continue the validate-fix loop until validation passes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: behavior
|
|
2
|
-
version: "9.
|
|
2
|
+
version: "9.2.0"
|
|
3
3
|
description: Generate pure TypeScript function bodies for SpecVerse behavior steps that don't match convention patterns
|
|
4
4
|
author: SpecVerse Team
|
|
5
5
|
tags: [behavior, code-generation, pure-function, typescript, realize]
|
|
@@ -10,58 +10,65 @@ system:
|
|
|
10
10
|
function bodies for behavior steps that couldn't be matched by the realize
|
|
11
11
|
engine's convention patterns.
|
|
12
12
|
|
|
13
|
+
minimalContext: |
|
|
13
14
|
PURE FUNCTION RULES (critical — violating these breaks the architecture):
|
|
14
15
|
1. NO database access (no prisma, no queries)
|
|
15
16
|
2. NO event publishing (no eventBus)
|
|
16
17
|
3. NO external services (no fetch, no email providers, no payment gateways)
|
|
17
18
|
4. NO imports, no require, no fs, no process
|
|
18
|
-
5. All data you need comes in via the `input` object parameter
|
|
19
|
+
5. All data you need comes in via the `input` object parameter (already destructured — you have the fields directly)
|
|
19
20
|
6. Return a plain result value (object, number, string) — the caller uses it
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
OUTPUT RULES:
|
|
23
|
+
1. Output ONLY the function body code (between { and })
|
|
24
|
+
2. First line: short comment summarising what the function does
|
|
25
|
+
3. No markdown fences, no explanation before or after
|
|
26
|
+
4. Throw Error('...') for failure cases with descriptive messages
|
|
27
|
+
5. If a step fundamentally requires external side effects, throw an error indicating that — do not fake it
|
|
28
|
+
|
|
29
|
+
fullContext: |
|
|
30
|
+
# SpecVerse context (for LLMs that don't have the SpecVerse skill loaded)
|
|
31
|
+
|
|
32
|
+
SpecVerse is a declarative specification language. You describe WHAT a
|
|
33
|
+
system does in a .specly file, and the engines generate HOW — backend
|
|
34
|
+
(Fastify/Prisma), frontend (React/Tailwind), CLI, tools, diagrams. The
|
|
35
|
+
behavior-generation step you're being asked to perform plugs a
|
|
36
|
+
specific gap: the realize engine matches most spec behavior steps
|
|
37
|
+
against convention patterns ("Find {Model}", "Set {field}",
|
|
38
|
+
"Send {event}") and emits them directly; for the rest, you fill in
|
|
39
|
+
the pure-function body.
|
|
40
|
+
|
|
41
|
+
Where your function fits:
|
|
24
42
|
|
|
25
|
-
Example flow:
|
|
26
43
|
```
|
|
27
|
-
// Controller (convention code)
|
|
44
|
+
// Controller (convention-generated code — NOT your job)
|
|
28
45
|
const order = await prisma.order.findUniqueOrThrow(...);
|
|
29
46
|
const customer = await prisma.customer.findUniqueOrThrow(...);
|
|
30
47
|
|
|
31
|
-
// Your function
|
|
48
|
+
// Your function — PURE calculation or transformation
|
|
32
49
|
const discount = await applyDiscountBasedOnLoyaltyTier({ order, customer });
|
|
33
50
|
// discount = { amount: 42, rate: 0.10 }
|
|
34
51
|
|
|
35
|
-
// Controller (convention code)
|
|
52
|
+
// Controller (convention-generated code — NOT your job)
|
|
36
53
|
await prisma.order.update({ where: { id }, data: { total: order.total - discount.amount } });
|
|
37
54
|
await eventBus.publish('OrderDiscounted', { orderId, discount });
|
|
38
55
|
```
|
|
39
56
|
|
|
40
|
-
Convention patterns
|
|
57
|
+
Convention patterns ALREADY auto-generated (don't re-implement these):
|
|
41
58
|
- "Find {Model} by {field}", "Create {Model}", "Update {Model}..."
|
|
42
59
|
- "Delete {Model}", "Transition {Model} to {state}"
|
|
43
60
|
- "Set/Increment/Decrement {field}", "Send {event} event"
|
|
44
61
|
|
|
45
|
-
You handle domain-specific
|
|
46
|
-
scoring, categorisation, validation.
|
|
62
|
+
You handle: domain-specific calculations, transformations, rules,
|
|
63
|
+
scoring, categorisation, validation logic. Anything where the behavior
|
|
64
|
+
step text doesn't match a convention pattern.
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
4. Return a meaningful result object
|
|
55
|
-
5. Throw Error('...') for failure cases with descriptive messages
|
|
56
|
-
6. NO await prisma.*, NO await eventBus.*, NO fetch, NO external calls
|
|
57
|
-
7. If the step fundamentally requires external side effects, throw an
|
|
58
|
-
error indicating that — do not fake it
|
|
59
|
-
|
|
60
|
-
OUTPUT FORMAT:
|
|
61
|
-
- No markdown fences
|
|
62
|
-
- No explanation before or after
|
|
63
|
-
- Just the function body code
|
|
64
|
-
- First line should be a comment summarizing what the function does
|
|
66
|
+
SpecVerse uses CURVED operations (Create, Update, Retrieve, Validate,
|
|
67
|
+
Evolve, Delete) on controllers. Validate is dry-run; Evolve handles
|
|
68
|
+
lifecycle state transitions. Models declare attributes, relationships,
|
|
69
|
+
and lifecycles. Full reference lives in the SpecVerse canonical guide
|
|
70
|
+
(`specverse://guide` resource, or `~/.claude/skills/specverse/reference/guide.md`
|
|
71
|
+
if the skill is installed).
|
|
65
72
|
|
|
66
73
|
examples:
|
|
67
74
|
- step: "Apply discount based on loyalty tier"
|
|
@@ -107,7 +114,7 @@ user:
|
|
|
107
114
|
|
|
108
115
|
The function MUST return {{returnType}}. If that's `any`, return a
|
|
109
116
|
reasonable result object describing what was computed. If it's a specific
|
|
110
|
-
type (e.g., { cost: number; days: number }), return an object matching
|
|
117
|
+
type (e.g., "{ cost: number; days: number }"), return an object matching
|
|
111
118
|
that shape exactly — the caller depends on those field names.
|
|
112
119
|
|
|
113
120
|
Output ONLY the function body (the code that goes between { and }).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: create
|
|
2
|
-
version: "9.
|
|
2
|
+
version: "9.2.0"
|
|
3
3
|
description: Generate minimal SpecVerse specifications from natural language requirements with deployment policies
|
|
4
4
|
author: SpecVerse Team
|
|
5
5
|
tags: [creation, requirements, minimal-spec, v9, deployment-policies, validate-fix-loop]
|
|
@@ -15,6 +15,14 @@ system:
|
|
|
15
15
|
Your task: Analyze requirements and generate the smallest possible valid specification that captures core business logic.
|
|
16
16
|
The SpecVerse inference engine will later expand these minimal specs into complete architectures.
|
|
17
17
|
|
|
18
|
+
OUTPUT FORMAT (critical):
|
|
19
|
+
- Emit the complete .specly content as YAML directly in your response,
|
|
20
|
+
wrapped in a single ```specly ... ``` code block.
|
|
21
|
+
- Do NOT use Write, Edit, or any file-saving tools — even if available.
|
|
22
|
+
The caller harvests the spec text from your response, not from disk.
|
|
23
|
+
- Do NOT prefix with prose or status updates. Reply with the code block
|
|
24
|
+
as the primary output. Brief commentary AFTER the block is OK.
|
|
25
|
+
|
|
18
26
|
context: |
|
|
19
27
|
CORE PRINCIPLES:
|
|
20
28
|
1. Extract core business entities and their relationships
|
|
@@ -310,7 +318,7 @@ user:
|
|
|
310
318
|
- Use components: (plural) at top level
|
|
311
319
|
- Use snake_case for lifecycle states (NOT kebab-case)
|
|
312
320
|
- Add deployment policies appropriate for scale
|
|
313
|
-
-
|
|
321
|
+
- Output the spec inside a ```specly``` code block in your response (do not write to disk)
|
|
314
322
|
|
|
315
323
|
Step 2: VALIDATE
|
|
316
324
|
- Run: spv validate spec.specly --json
|
|
@@ -336,7 +344,7 @@ user:
|
|
|
336
344
|
- invalid relationship syntax
|
|
337
345
|
- invalid deployment policy structure
|
|
338
346
|
- incorrect operation policy nesting
|
|
339
|
-
*
|
|
347
|
+
* Update the spec inline in your response (do not edit a file on disk)
|
|
340
348
|
* Go back to Step 2
|
|
341
349
|
|
|
342
350
|
Continue the validate-fix loop until validation passes.
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Behavior AI Service —
|
|
3
|
-
*
|
|
2
|
+
* Behavior AI Service — generates pure TypeScript function bodies for
|
|
3
|
+
* behavior steps that weren't matched by the realize engine's convention
|
|
4
|
+
* patterns.
|
|
4
5
|
*
|
|
5
|
-
* Architecture (
|
|
6
|
-
* -
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Architecture (post AI-SDK replatform, 2026-04):
|
|
7
|
+
* - Delegates to the Vercel AI SDK via the model resolver. Provider choice
|
|
8
|
+
* is driven by SPECVERSE_AI_PROVIDER (claude-cli | anthropic |
|
|
9
|
+
* openai-compatible | stub) with sensible defaults per environment.
|
|
10
|
+
* - Claude-CLI provider preserves the Max-subscription zero-cost path
|
|
11
|
+
* (spawn claude --print --session-id/--resume). API provider uses
|
|
12
|
+
* Anthropic prompt caching for equivalent savings.
|
|
13
|
+
* - When claude-cli is active AND the SpecVerse skill is installed,
|
|
14
|
+
* Claude Code auto-loads the skill — we skip the fullContext block
|
|
15
|
+
* (saves ~2K tokens per session init).
|
|
16
|
+
* - For providers that don't have skill auto-load (anthropic, openai-
|
|
17
|
+
* compatible), we include the fullContext block in the system prompt
|
|
18
|
+
* so the model has the same grounding.
|
|
11
19
|
*
|
|
12
20
|
* Used by ai-behaviors-generator at realize time.
|
|
13
21
|
*/
|
|
14
22
|
export interface BehaviorAIServiceOptions {
|
|
15
|
-
|
|
23
|
+
/** Model override. Passed through to the resolver; interpretation is provider-specific. */
|
|
16
24
|
model?: string;
|
|
25
|
+
/** Per-call timeout (ms). Default 120_000. Only honoured by the claude-cli provider. */
|
|
17
26
|
timeout?: number;
|
|
18
27
|
}
|
|
19
28
|
export interface BehaviorGenerateContext {
|
|
@@ -28,36 +37,34 @@ export interface BehaviorGenerateContext {
|
|
|
28
37
|
returnType?: string;
|
|
29
38
|
}
|
|
30
39
|
/**
|
|
31
|
-
*
|
|
40
|
+
* Service class kept for API compatibility with ai-behaviors-generator.
|
|
41
|
+
* Internally delegates to the AI SDK via the model resolver.
|
|
32
42
|
*/
|
|
33
43
|
export declare class BehaviorAIService {
|
|
34
|
-
private claudePath;
|
|
35
44
|
private model;
|
|
45
|
+
private providerId;
|
|
46
|
+
private prompt;
|
|
47
|
+
private system;
|
|
36
48
|
private timeout;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
private currentProcess;
|
|
40
|
-
private systemPrompt;
|
|
41
|
-
private userTemplate;
|
|
49
|
+
/** Non-null after generateBehavior() succeeds once. */
|
|
50
|
+
get isAvailable(): boolean;
|
|
42
51
|
constructor(options?: BehaviorAIServiceOptions);
|
|
43
|
-
private detectClaudePath;
|
|
44
52
|
/**
|
|
45
|
-
*
|
|
53
|
+
* Build the system prompt. When the active provider can auto-load the
|
|
54
|
+
* SpecVerse skill (claude-cli + installed skill), we emit role +
|
|
55
|
+
* minimalContext only. Otherwise we include fullContext for grounding.
|
|
46
56
|
*/
|
|
47
|
-
|
|
57
|
+
private assembleSystemPrompt;
|
|
48
58
|
/**
|
|
49
|
-
* Start a new session for a controller.
|
|
50
|
-
*
|
|
59
|
+
* Start a new session for a controller. Session semantics are now owned
|
|
60
|
+
* by the provider — for claude-cli that's the spawn-with-session-id
|
|
61
|
+
* mechanism; for anthropic API it's the prompt-cache marker. We just
|
|
62
|
+
* record a no-op for callers that expect a session id to log.
|
|
51
63
|
*/
|
|
52
64
|
startSession(controllerName: string): string;
|
|
53
|
-
/**
|
|
54
|
-
* Generate a function body for a behavior step.
|
|
55
|
-
* First call creates the session with system prompt; subsequent calls resume.
|
|
56
|
-
*/
|
|
65
|
+
/** Generate a function body for a behavior step. */
|
|
57
66
|
generateBehavior(ctx: BehaviorGenerateContext): Promise<string | null>;
|
|
58
|
-
/**
|
|
59
|
-
* End the current session.
|
|
60
|
-
*/
|
|
67
|
+
/** End the current session — no-op now that session state lives in the provider. */
|
|
61
68
|
endSession(): void;
|
|
62
69
|
private buildUserPrompt;
|
|
63
70
|
private extractCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"behavior-ai-service.d.ts","sourceRoot":"","sources":["../../src/ai/behavior-ai-service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"behavior-ai-service.d.ts","sourceRoot":"","sources":["../../src/ai/behavior-ai-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAUH,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAwCD;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAAC;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IAExB,uDAAuD;IACvD,IAAI,WAAW,IAAI,OAAO,CAEzB;gBAEW,OAAO,GAAE,wBAA6B;IAQlD;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAY5B;;;;;OAKG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;IAI5C,oDAAoD;IAC9C,gBAAgB,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA0B5E,oFAAoF;IACpF,UAAU,IAAI,IAAI;IAIlB,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,WAAW;CAQpB"}
|