@soleri/core 2.12.0 → 7.0.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.
- package/data/flows/build.flow.yaml +128 -0
- package/data/flows/deliver.flow.yaml +110 -0
- package/data/flows/design.flow.yaml +108 -0
- package/data/flows/enhance.flow.yaml +90 -0
- package/data/flows/explore.flow.yaml +84 -0
- package/data/flows/fix.flow.yaml +90 -0
- package/data/flows/plan.flow.yaml +87 -0
- package/data/flows/review.flow.yaml +90 -0
- package/dist/brain/intelligence.d.ts.map +1 -1
- package/dist/brain/intelligence.js +16 -2
- package/dist/brain/intelligence.js.map +1 -1
- package/dist/capabilities/chain-mapping.d.ts +21 -0
- package/dist/capabilities/chain-mapping.d.ts.map +1 -0
- package/dist/capabilities/chain-mapping.js +86 -0
- package/dist/capabilities/chain-mapping.js.map +1 -0
- package/dist/capabilities/index.d.ts +10 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +8 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/registry.d.ts +95 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +227 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/capabilities/types.d.ts +106 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +12 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/control/intent-router.d.ts.map +1 -1
- package/dist/control/intent-router.js +58 -2
- package/dist/control/intent-router.js.map +1 -1
- package/dist/domain-packs/index.d.ts +8 -0
- package/dist/domain-packs/index.d.ts.map +1 -0
- package/dist/domain-packs/index.js +8 -0
- package/dist/domain-packs/index.js.map +1 -0
- package/dist/domain-packs/inject-rules.d.ts +24 -0
- package/dist/domain-packs/inject-rules.d.ts.map +1 -0
- package/dist/domain-packs/inject-rules.js +65 -0
- package/dist/domain-packs/inject-rules.js.map +1 -0
- package/dist/domain-packs/knowledge-installer.d.ts +27 -0
- package/dist/domain-packs/knowledge-installer.d.ts.map +1 -0
- package/dist/domain-packs/knowledge-installer.js +89 -0
- package/dist/domain-packs/knowledge-installer.js.map +1 -0
- package/dist/domain-packs/loader.d.ts +28 -0
- package/dist/domain-packs/loader.d.ts.map +1 -0
- package/dist/domain-packs/loader.js +105 -0
- package/dist/domain-packs/loader.js.map +1 -0
- package/dist/domain-packs/pack-runtime.d.ts +80 -0
- package/dist/domain-packs/pack-runtime.d.ts.map +1 -0
- package/dist/domain-packs/pack-runtime.js +36 -0
- package/dist/domain-packs/pack-runtime.js.map +1 -0
- package/dist/domain-packs/skills-installer.d.ts +21 -0
- package/dist/domain-packs/skills-installer.d.ts.map +1 -0
- package/dist/domain-packs/skills-installer.js +38 -0
- package/dist/domain-packs/skills-installer.js.map +1 -0
- package/dist/domain-packs/token-resolver.d.ts +37 -0
- package/dist/domain-packs/token-resolver.d.ts.map +1 -0
- package/dist/domain-packs/token-resolver.js +109 -0
- package/dist/domain-packs/token-resolver.js.map +1 -0
- package/dist/domain-packs/types.d.ts +91 -0
- package/dist/domain-packs/types.d.ts.map +1 -0
- package/dist/domain-packs/types.js +122 -0
- package/dist/domain-packs/types.js.map +1 -0
- package/dist/engine/bin/soleri-engine.d.ts +12 -0
- package/dist/engine/bin/soleri-engine.d.ts.map +1 -0
- package/dist/engine/bin/soleri-engine.js +183 -0
- package/dist/engine/bin/soleri-engine.js.map +1 -0
- package/dist/engine/core-ops.d.ts +27 -0
- package/dist/engine/core-ops.d.ts.map +1 -0
- package/dist/engine/core-ops.js +159 -0
- package/dist/engine/core-ops.js.map +1 -0
- package/dist/engine/index.d.ts +19 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +17 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/register-engine.d.ts +54 -0
- package/dist/engine/register-engine.d.ts.map +1 -0
- package/dist/engine/register-engine.js +270 -0
- package/dist/engine/register-engine.js.map +1 -0
- package/dist/engine/test-helpers.d.ts +30 -0
- package/dist/engine/test-helpers.d.ts.map +1 -0
- package/dist/engine/test-helpers.js +59 -0
- package/dist/engine/test-helpers.js.map +1 -0
- package/dist/flows/context-router.d.ts +39 -0
- package/dist/flows/context-router.d.ts.map +1 -0
- package/dist/flows/context-router.js +206 -0
- package/dist/flows/context-router.js.map +1 -0
- package/dist/flows/dispatch-registry.d.ts +24 -0
- package/dist/flows/dispatch-registry.d.ts.map +1 -0
- package/dist/flows/dispatch-registry.js +70 -0
- package/dist/flows/dispatch-registry.js.map +1 -0
- package/dist/flows/epilogue.d.ts +24 -0
- package/dist/flows/epilogue.d.ts.map +1 -0
- package/dist/flows/epilogue.js +52 -0
- package/dist/flows/epilogue.js.map +1 -0
- package/dist/flows/executor.d.ts +25 -0
- package/dist/flows/executor.d.ts.map +1 -0
- package/dist/flows/executor.js +153 -0
- package/dist/flows/executor.js.map +1 -0
- package/dist/flows/gate-evaluator.d.ts +26 -0
- package/dist/flows/gate-evaluator.d.ts.map +1 -0
- package/dist/flows/gate-evaluator.js +162 -0
- package/dist/flows/gate-evaluator.js.map +1 -0
- package/dist/flows/index.d.ts +14 -0
- package/dist/flows/index.d.ts.map +1 -0
- package/dist/flows/index.js +20 -0
- package/dist/flows/index.js.map +1 -0
- package/dist/flows/loader.d.ts +17 -0
- package/dist/flows/loader.d.ts.map +1 -0
- package/dist/flows/loader.js +61 -0
- package/dist/flows/loader.js.map +1 -0
- package/dist/flows/plan-builder.d.ts +40 -0
- package/dist/flows/plan-builder.d.ts.map +1 -0
- package/dist/flows/plan-builder.js +213 -0
- package/dist/flows/plan-builder.js.map +1 -0
- package/dist/flows/probes.d.ts +11 -0
- package/dist/flows/probes.d.ts.map +1 -0
- package/dist/flows/probes.js +62 -0
- package/dist/flows/probes.js.map +1 -0
- package/dist/flows/types.d.ts +950 -0
- package/dist/flows/types.d.ts.map +1 -0
- package/dist/flows/types.js +105 -0
- package/dist/flows/types.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/intelligence/loader.d.ts +19 -0
- package/dist/intelligence/loader.d.ts.map +1 -1
- package/dist/intelligence/loader.js +35 -0
- package/dist/intelligence/loader.js.map +1 -1
- package/dist/intelligence/types.d.ts +1 -0
- package/dist/intelligence/types.d.ts.map +1 -1
- package/dist/packs/types.d.ts +58 -19
- package/dist/packs/types.d.ts.map +1 -1
- package/dist/packs/types.js +14 -0
- package/dist/packs/types.js.map +1 -1
- package/dist/playbooks/generic/onboarding.d.ts +9 -0
- package/dist/playbooks/generic/onboarding.d.ts.map +1 -0
- package/dist/playbooks/generic/onboarding.js +74 -0
- package/dist/playbooks/generic/onboarding.js.map +1 -0
- package/dist/playbooks/playbook-registry.d.ts.map +1 -1
- package/dist/playbooks/playbook-registry.js +2 -0
- package/dist/playbooks/playbook-registry.js.map +1 -1
- package/dist/runtime/admin-extra-ops.d.ts.map +1 -1
- package/dist/runtime/admin-extra-ops.js +15 -9
- package/dist/runtime/admin-extra-ops.js.map +1 -1
- package/dist/runtime/admin-ops.js +4 -4
- package/dist/runtime/admin-ops.js.map +1 -1
- package/dist/runtime/capture-ops.d.ts.map +1 -1
- package/dist/runtime/capture-ops.js +33 -1
- package/dist/runtime/capture-ops.js.map +1 -1
- package/dist/runtime/domain-ops.d.ts +21 -5
- package/dist/runtime/domain-ops.d.ts.map +1 -1
- package/dist/runtime/domain-ops.js +64 -6
- package/dist/runtime/domain-ops.js.map +1 -1
- package/dist/runtime/facades/cognee-facade.d.ts.map +1 -1
- package/dist/runtime/facades/cognee-facade.js +3 -1
- package/dist/runtime/facades/cognee-facade.js.map +1 -1
- package/dist/runtime/facades/index.d.ts.map +1 -1
- package/dist/runtime/facades/index.js +10 -6
- package/dist/runtime/facades/index.js.map +1 -1
- package/dist/runtime/facades/vault-facade.d.ts.map +1 -1
- package/dist/runtime/facades/vault-facade.js +2 -0
- package/dist/runtime/facades/vault-facade.js.map +1 -1
- package/dist/runtime/orchestrate-ops.d.ts +8 -7
- package/dist/runtime/orchestrate-ops.d.ts.map +1 -1
- package/dist/runtime/orchestrate-ops.js +217 -61
- package/dist/runtime/orchestrate-ops.js.map +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +23 -17
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +6 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/vault-linking-ops.d.ts +13 -0
- package/dist/runtime/vault-linking-ops.d.ts.map +1 -0
- package/dist/runtime/vault-linking-ops.js +367 -0
- package/dist/runtime/vault-linking-ops.js.map +1 -0
- package/dist/vault/linking.d.ts +46 -0
- package/dist/vault/linking.d.ts.map +1 -0
- package/dist/vault/linking.js +275 -0
- package/dist/vault/linking.js.map +1 -0
- package/dist/vault/vault-types.d.ts +37 -0
- package/dist/vault/vault-types.d.ts.map +1 -1
- package/dist/vault/vault.d.ts +12 -0
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/vault/vault.js +85 -6
- package/dist/vault/vault.js.map +1 -1
- package/package.json +4 -1
- package/src/__tests__/admin-extra-ops.test.ts +1 -1
- package/src/__tests__/admin-ops.test.ts +2 -1
- package/src/__tests__/cognee-client-gaps.test.ts +470 -0
- package/src/__tests__/cognee-hybrid-search.test.ts +478 -0
- package/src/__tests__/cognee-sync-manager-deep.test.ts +630 -0
- package/src/__tests__/cognee-sync-manager.test.ts +1 -0
- package/src/__tests__/core-ops.test.ts +9 -61
- package/src/__tests__/domain-packs.test.ts +421 -0
- package/src/__tests__/flows.test.ts +604 -0
- package/src/__tests__/playbook-registry.test.ts +2 -2
- package/src/__tests__/playbook-seeder.test.ts +8 -8
- package/src/__tests__/playbook.test.ts +5 -5
- package/src/__tests__/token-resolver.test.ts +79 -0
- package/src/brain/intelligence.ts +21 -2
- package/src/capabilities/chain-mapping.ts +93 -0
- package/src/capabilities/index.ts +21 -0
- package/src/capabilities/registry.ts +290 -0
- package/src/capabilities/types.ts +143 -0
- package/src/control/intent-router.ts +46 -2
- package/src/domain-packs/index.ts +27 -0
- package/src/domain-packs/inject-rules.ts +74 -0
- package/src/domain-packs/knowledge-installer.ts +116 -0
- package/src/domain-packs/loader.ts +124 -0
- package/src/domain-packs/pack-runtime.ts +99 -0
- package/src/domain-packs/skills-installer.ts +56 -0
- package/src/domain-packs/token-resolver.ts +126 -0
- package/src/domain-packs/types.ts +229 -0
- package/src/engine/__tests__/register-engine.test.ts +104 -0
- package/src/engine/bin/soleri-engine.ts +217 -0
- package/src/engine/core-ops.ts +178 -0
- package/src/engine/index.ts +19 -0
- package/src/engine/register-engine.ts +385 -0
- package/src/engine/test-helpers.ts +83 -0
- package/src/flows/context-router.ts +257 -0
- package/src/flows/dispatch-registry.ts +80 -0
- package/src/flows/epilogue.ts +65 -0
- package/src/flows/executor.ts +182 -0
- package/src/flows/gate-evaluator.ts +171 -0
- package/src/flows/index.ts +52 -0
- package/src/flows/loader.ts +63 -0
- package/src/flows/plan-builder.ts +250 -0
- package/src/flows/probes.ts +70 -0
- package/src/flows/types.ts +217 -0
- package/src/index.ts +68 -1
- package/src/intelligence/loader.ts +38 -0
- package/src/intelligence/types.ts +1 -0
- package/src/packs/types.ts +19 -0
- package/src/playbooks/generic/onboarding.ts +79 -0
- package/src/playbooks/playbook-registry.ts +2 -0
- package/src/runtime/admin-extra-ops.ts +14 -8
- package/src/runtime/admin-ops.ts +4 -4
- package/src/runtime/capture-ops.ts +40 -1
- package/src/runtime/domain-ops.ts +71 -5
- package/src/runtime/facades/cognee-facade.ts +3 -1
- package/src/runtime/facades/index.ts +12 -6
- package/src/runtime/facades/vault-facade.ts +2 -0
- package/src/runtime/orchestrate-ops.ts +261 -65
- package/src/runtime/runtime.ts +27 -18
- package/src/runtime/types.ts +6 -2
- package/src/runtime/vault-linking-ops.ts +454 -0
- package/src/vault/linking.ts +333 -0
- package/src/vault/vault-types.ts +46 -0
- package/src/vault/vault.ts +94 -7
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow engine types — YAML-driven workflow orchestration.
|
|
3
|
+
*
|
|
4
|
+
* Flow → Steps → Chains (ops) → Gates → Execution
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Gate types
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
export const gateActionSchema = z.object({
|
|
14
|
+
action: z.enum(['STOP', 'BRANCH', 'CONTINUE']),
|
|
15
|
+
goto: z.string().optional(),
|
|
16
|
+
message: z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const gateSchema = z.discriminatedUnion('type', [
|
|
20
|
+
z.object({
|
|
21
|
+
type: z.literal('GATE'),
|
|
22
|
+
condition: z.string(),
|
|
23
|
+
'on-false': gateActionSchema,
|
|
24
|
+
}),
|
|
25
|
+
z.object({
|
|
26
|
+
type: z.literal('SCORE'),
|
|
27
|
+
min: z.number(),
|
|
28
|
+
'grade-thresholds': z.record(z.number()).optional(),
|
|
29
|
+
'on-false': gateActionSchema,
|
|
30
|
+
}),
|
|
31
|
+
z.object({
|
|
32
|
+
type: z.literal('CHECKPOINT'),
|
|
33
|
+
condition: z.string().optional(),
|
|
34
|
+
save: z.array(z.string()).optional(),
|
|
35
|
+
'on-false': gateActionSchema,
|
|
36
|
+
}),
|
|
37
|
+
z.object({
|
|
38
|
+
type: z.literal('BRANCH'),
|
|
39
|
+
'on-false': gateActionSchema.optional(),
|
|
40
|
+
}),
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Step
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
export const flowStepSchema = z.object({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
name: z.string().optional(),
|
|
50
|
+
description: z.string().optional(),
|
|
51
|
+
chains: z.array(z.string()).optional(),
|
|
52
|
+
parallel: z.boolean().optional(),
|
|
53
|
+
output: z.array(z.string()).optional(),
|
|
54
|
+
gate: gateSchema.optional(),
|
|
55
|
+
/** Capability IDs required by this step (v2) */
|
|
56
|
+
needs: z.array(z.string()).optional(),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Flow (root YAML structure)
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
export const flowSchema = z.object({
|
|
64
|
+
id: z.string(),
|
|
65
|
+
name: z.string().optional(),
|
|
66
|
+
description: z.string().optional(),
|
|
67
|
+
version: z.string().optional(),
|
|
68
|
+
triggers: z.object({
|
|
69
|
+
modes: z.array(z.string()),
|
|
70
|
+
contexts: z.array(z.string()).optional(),
|
|
71
|
+
'min-confidence': z.enum(['HIGH', 'MEDIUM', 'LOW']).optional(),
|
|
72
|
+
}),
|
|
73
|
+
steps: z.array(flowStepSchema),
|
|
74
|
+
scoring: z
|
|
75
|
+
.object({
|
|
76
|
+
weights: z.record(z.number()),
|
|
77
|
+
formula: z.string().optional(),
|
|
78
|
+
})
|
|
79
|
+
.optional(),
|
|
80
|
+
'on-error': z
|
|
81
|
+
.object({
|
|
82
|
+
default: z
|
|
83
|
+
.object({
|
|
84
|
+
action: z.string(),
|
|
85
|
+
message: z.string().optional(),
|
|
86
|
+
recovery: z.string().optional(),
|
|
87
|
+
})
|
|
88
|
+
.optional(),
|
|
89
|
+
'max-retries': z.number().optional(),
|
|
90
|
+
escalation: z
|
|
91
|
+
.object({
|
|
92
|
+
action: z.string(),
|
|
93
|
+
message: z.string().optional(),
|
|
94
|
+
})
|
|
95
|
+
.optional(),
|
|
96
|
+
})
|
|
97
|
+
.optional(),
|
|
98
|
+
/** Strategy when a step's capability requirement is not satisfied */
|
|
99
|
+
onMissingCapability: z
|
|
100
|
+
.object({
|
|
101
|
+
default: z.enum(['skip-with-warning', 'fail', 'ask-user']).default('skip-with-warning'),
|
|
102
|
+
blocking: z.array(z.string()).optional().default([]),
|
|
103
|
+
})
|
|
104
|
+
.optional(),
|
|
105
|
+
metadata: z
|
|
106
|
+
.object({
|
|
107
|
+
author: z.string().optional(),
|
|
108
|
+
domain: z.string().optional(),
|
|
109
|
+
tags: z.array(z.string()).optional(),
|
|
110
|
+
})
|
|
111
|
+
.optional(),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export type Flow = z.infer<typeof flowSchema>;
|
|
115
|
+
export type FlowStep = z.infer<typeof flowStepSchema>;
|
|
116
|
+
export type Gate = z.infer<typeof gateSchema>;
|
|
117
|
+
export type GateAction = z.infer<typeof gateActionSchema>;
|
|
118
|
+
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// Probes
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
export type ProbeName =
|
|
124
|
+
| 'vault'
|
|
125
|
+
| 'brain'
|
|
126
|
+
| 'designSystem'
|
|
127
|
+
| 'sessionStore'
|
|
128
|
+
| 'projectRules'
|
|
129
|
+
| 'active';
|
|
130
|
+
|
|
131
|
+
export interface ProbeResults {
|
|
132
|
+
vault: boolean;
|
|
133
|
+
brain: boolean;
|
|
134
|
+
designSystem: boolean;
|
|
135
|
+
sessionStore: boolean;
|
|
136
|
+
projectRules: boolean;
|
|
137
|
+
active: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
// Plan (built from flow + probes)
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
|
|
144
|
+
export interface PlanStep {
|
|
145
|
+
id: string;
|
|
146
|
+
name: string;
|
|
147
|
+
tools: string[];
|
|
148
|
+
parallel: boolean;
|
|
149
|
+
requires: ProbeName[];
|
|
150
|
+
gate?: {
|
|
151
|
+
type: string;
|
|
152
|
+
condition?: string;
|
|
153
|
+
min?: number;
|
|
154
|
+
onFail?: { action: string; goto?: string; message?: string };
|
|
155
|
+
};
|
|
156
|
+
status: 'pending' | 'running' | 'passed' | 'failed' | 'skipped' | 'gate-paused';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface SkippedStep {
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
reason: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface OrchestrationPlan {
|
|
166
|
+
planId: string;
|
|
167
|
+
intent: string;
|
|
168
|
+
flowId: string;
|
|
169
|
+
steps: PlanStep[];
|
|
170
|
+
skipped: SkippedStep[];
|
|
171
|
+
epilogue: string[];
|
|
172
|
+
warnings: string[];
|
|
173
|
+
summary: string;
|
|
174
|
+
estimatedTools: number;
|
|
175
|
+
context: OrchestrationContext;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface OrchestrationContext {
|
|
179
|
+
intent: string;
|
|
180
|
+
probes: ProbeResults;
|
|
181
|
+
entities: { components: string[]; actions: string[]; technologies?: string[] };
|
|
182
|
+
projectPath: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
// Execution
|
|
187
|
+
// ---------------------------------------------------------------------------
|
|
188
|
+
|
|
189
|
+
export interface StepResult {
|
|
190
|
+
stepId: string;
|
|
191
|
+
status: 'passed' | 'failed' | 'skipped' | 'gate-paused';
|
|
192
|
+
toolResults: Record<string, { tool: string; status: string; data?: unknown; error?: string }>;
|
|
193
|
+
durationMs: number;
|
|
194
|
+
gateResult?: { action: string; message?: string };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface ExecutionResult {
|
|
198
|
+
planId: string;
|
|
199
|
+
status: 'completed' | 'partial' | 'failed';
|
|
200
|
+
stepsCompleted: number;
|
|
201
|
+
totalSteps: number;
|
|
202
|
+
toolsCalled: string[];
|
|
203
|
+
durationMs: number;
|
|
204
|
+
stepResults: StepResult[];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
// Gate verdict
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
|
|
211
|
+
export interface GateVerdict {
|
|
212
|
+
passed: boolean;
|
|
213
|
+
action: 'CONTINUE' | 'STOP' | 'BRANCH';
|
|
214
|
+
goto?: string;
|
|
215
|
+
message?: string;
|
|
216
|
+
score?: number;
|
|
217
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ─── Intelligence ────────────────────────────────────────────────────
|
|
2
2
|
export type { IntelligenceEntry, IntelligenceBundle } from './intelligence/types.js';
|
|
3
|
-
export { loadIntelligenceData } from './intelligence/loader.js';
|
|
3
|
+
export { loadIntelligenceData, loadPacks } from './intelligence/loader.js';
|
|
4
4
|
|
|
5
5
|
// ─── Vault ───────────────────────────────────────────────────────────
|
|
6
6
|
export { Vault } from './vault/vault.js';
|
|
@@ -503,6 +503,15 @@ export {
|
|
|
503
503
|
} from './runtime/deprecation.js';
|
|
504
504
|
export type { DeprecationInfo } from './runtime/deprecation.js';
|
|
505
505
|
|
|
506
|
+
// ─── Engine (v7 — direct registration, replaces facade factory) ───────
|
|
507
|
+
export { registerEngine } from './engine/register-engine.js';
|
|
508
|
+
export type {
|
|
509
|
+
EngineRegistrationOptions,
|
|
510
|
+
EngineRegistrationResult,
|
|
511
|
+
} from './engine/register-engine.js';
|
|
512
|
+
export { captureOps, executeOp } from './engine/test-helpers.js';
|
|
513
|
+
export type { CapturedOp } from './engine/test-helpers.js';
|
|
514
|
+
|
|
506
515
|
// ─── Migrations ────────────────────────────────────────────────────────
|
|
507
516
|
export { MigrationRunner } from './migrations/index.js';
|
|
508
517
|
export type { Migration, MigrationResult, MigrationState } from './migrations/index.js';
|
|
@@ -629,3 +638,61 @@ export type {
|
|
|
629
638
|
// ─── Prompts ───────────────────────────────────────────────────────────
|
|
630
639
|
export { TemplateManager, parseVariables, resolveIncludes } from './prompts/index.js';
|
|
631
640
|
export type { PromptTemplate, TemplateVariable, RenderOptions } from './prompts/index.js';
|
|
641
|
+
|
|
642
|
+
// ─── Domain Packs ──────────────────────────────────────────────────────
|
|
643
|
+
export {
|
|
644
|
+
validateDomainPack,
|
|
645
|
+
SEMANTIC_FACADE_NAMES,
|
|
646
|
+
loadDomainPack,
|
|
647
|
+
loadDomainPacksFromConfig,
|
|
648
|
+
resolveDependencies,
|
|
649
|
+
} from './domain-packs/index.js';
|
|
650
|
+
export type {
|
|
651
|
+
DomainPack,
|
|
652
|
+
DomainPackManifest,
|
|
653
|
+
DomainPackRef,
|
|
654
|
+
KnowledgeManifest,
|
|
655
|
+
PackSkillDefinition,
|
|
656
|
+
ValidateResult as DomainPackValidateResult,
|
|
657
|
+
PackRuntime,
|
|
658
|
+
PackProjectContext,
|
|
659
|
+
PackCheckContext,
|
|
660
|
+
} from './domain-packs/index.js';
|
|
661
|
+
export {
|
|
662
|
+
createPackRuntime,
|
|
663
|
+
resolveToken,
|
|
664
|
+
listProjectTokens,
|
|
665
|
+
buildReverseIndex,
|
|
666
|
+
} from './domain-packs/index.js';
|
|
667
|
+
|
|
668
|
+
// ─── Capabilities ───────────────────────────────────────────────────────
|
|
669
|
+
export * from './capabilities/index.js';
|
|
670
|
+
|
|
671
|
+
// ─── Flow Engine ───────────────────────────────────────────────────────
|
|
672
|
+
export type {
|
|
673
|
+
Flow,
|
|
674
|
+
FlowStep,
|
|
675
|
+
ProbeName,
|
|
676
|
+
ProbeResults,
|
|
677
|
+
PlanStep,
|
|
678
|
+
SkippedStep,
|
|
679
|
+
OrchestrationPlan,
|
|
680
|
+
OrchestrationContext,
|
|
681
|
+
StepResult as FlowStepResult,
|
|
682
|
+
ExecutionResult,
|
|
683
|
+
GateVerdict,
|
|
684
|
+
} from './flows/index.js';
|
|
685
|
+
export {
|
|
686
|
+
loadFlowById,
|
|
687
|
+
loadAllFlows,
|
|
688
|
+
runProbes,
|
|
689
|
+
INTENT_TO_FLOW,
|
|
690
|
+
chainToToolName,
|
|
691
|
+
buildPlan,
|
|
692
|
+
pruneSteps,
|
|
693
|
+
evaluateGate,
|
|
694
|
+
evaluateCondition,
|
|
695
|
+
FlowExecutor,
|
|
696
|
+
createDispatcher,
|
|
697
|
+
runEpilogue,
|
|
698
|
+
} from './flows/index.js';
|
|
@@ -93,3 +93,41 @@ function validateEntry(entry: IntelligenceEntry): boolean {
|
|
|
93
93
|
Array.isArray(entry.tags)
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Load all knowledge packs from a packs directory.
|
|
99
|
+
* Each subdirectory is a pack with JSON bundle files and an optional soleri-pack.json manifest.
|
|
100
|
+
*
|
|
101
|
+
* Structure:
|
|
102
|
+
* packsDir/
|
|
103
|
+
* design-system/
|
|
104
|
+
* soleri-pack.json ← optional manifest
|
|
105
|
+
* design-tokens.json ← IntelligenceBundle
|
|
106
|
+
* components.json ← IntelligenceBundle
|
|
107
|
+
* clean-code/
|
|
108
|
+
* refactoring.json ← IntelligenceBundle
|
|
109
|
+
*
|
|
110
|
+
* Returns entries grouped by pack name for installPack() calls.
|
|
111
|
+
*/
|
|
112
|
+
export function loadPacks(
|
|
113
|
+
packsDir: string,
|
|
114
|
+
): Array<{ packName: string; entries: IntelligenceEntry[] }> {
|
|
115
|
+
const result: Array<{ packName: string; entries: IntelligenceEntry[] }> = [];
|
|
116
|
+
let dirs: string[];
|
|
117
|
+
try {
|
|
118
|
+
dirs = readdirSync(packsDir, { withFileTypes: true })
|
|
119
|
+
.filter((d) => d.isDirectory() && !d.name.startsWith('.'))
|
|
120
|
+
.map((d) => d.name);
|
|
121
|
+
} catch {
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
for (const dir of dirs) {
|
|
126
|
+
const packPath = join(packsDir, dir);
|
|
127
|
+
const entries = loadIntelligenceData(packPath);
|
|
128
|
+
if (entries.length > 0) {
|
|
129
|
+
result.push({ packName: dir, entries });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
@@ -12,6 +12,7 @@ export interface IntelligenceEntry {
|
|
|
12
12
|
tags: string[];
|
|
13
13
|
appliesTo?: string[];
|
|
14
14
|
tier?: 'agent' | 'project' | 'team'; // scope tier — auto-detected or manually set
|
|
15
|
+
origin?: 'agent' | 'pack' | 'user'; // knowledge origin — 'agent' = engine, 'pack' = installable knowledge pack, 'user' = personal capture
|
|
15
16
|
validFrom?: number; // unix epoch — when entry becomes active
|
|
16
17
|
validUntil?: number; // unix epoch — when entry expires (null = never)
|
|
17
18
|
}
|
package/src/packs/types.ts
CHANGED
|
@@ -34,6 +34,25 @@ export const packManifestSchema = z.object({
|
|
|
34
34
|
engine: z.string().optional(),
|
|
35
35
|
/** Pack dependencies (other pack IDs) */
|
|
36
36
|
dependencies: z.array(z.string()).optional().default([]),
|
|
37
|
+
/** Capability declarations — what this pack can do and what it needs */
|
|
38
|
+
capabilities: z
|
|
39
|
+
.array(
|
|
40
|
+
z.object({
|
|
41
|
+
id: z
|
|
42
|
+
.string()
|
|
43
|
+
.regex(
|
|
44
|
+
/^[a-z][a-z0-9]*\.[a-z][a-z0-9]*$/,
|
|
45
|
+
'Capability ID must be domain.action format (e.g., color.validate)',
|
|
46
|
+
),
|
|
47
|
+
description: z.string().min(1),
|
|
48
|
+
provides: z.array(z.string()),
|
|
49
|
+
requires: z.array(z.string()),
|
|
50
|
+
depends: z.array(z.string()).optional().default([]),
|
|
51
|
+
knowledge: z.array(z.string()).optional().default([]),
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
.optional()
|
|
55
|
+
.default([]),
|
|
37
56
|
/** Facade definitions (same as plugin manifest) */
|
|
38
57
|
facades: z
|
|
39
58
|
.array(
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Playbook: New User Onboarding
|
|
3
|
+
*
|
|
4
|
+
* Guides first-time users through the agent's capabilities.
|
|
5
|
+
* Activates when vault is empty or user asks "what can you do?"
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { PlaybookDefinition } from '../playbook-types.js';
|
|
9
|
+
|
|
10
|
+
export const onboardingPlaybook: PlaybookDefinition = {
|
|
11
|
+
id: 'generic-onboarding',
|
|
12
|
+
tier: 'generic',
|
|
13
|
+
title: 'New User Onboarding',
|
|
14
|
+
trigger:
|
|
15
|
+
'Use when the user is new (vault is empty, no session history) or when they ask "what can you do?", "how do I use you?", "help", "getting started", "what is this?", "features", "capabilities".',
|
|
16
|
+
description:
|
|
17
|
+
"Walks a new user through the agent's capabilities in a friendly, progressive way. Shows what's available, demonstrates the 5-step rhythm with a quick example, and suggests next actions based on the user's goals.",
|
|
18
|
+
steps: `1. INTRODUCE — Explain who you are
|
|
19
|
+
- Your name, role, and current domains (from activation context)
|
|
20
|
+
- What makes you different: you learn, remember, and improve
|
|
21
|
+
- Your installed packs and what they enable
|
|
22
|
+
|
|
23
|
+
2. SHOW CAPABILITIES — Walk through what you can do
|
|
24
|
+
- Vault: "I search my knowledge base before every decision"
|
|
25
|
+
- Planning: "I create structured plans with approval gates"
|
|
26
|
+
- Brain: "I learn from past sessions and recommend patterns"
|
|
27
|
+
- Memory: "I remember across conversations and projects"
|
|
28
|
+
- Domains: list each domain and what it covers
|
|
29
|
+
- If packs are missing: "You can add more capabilities with soleri pack install"
|
|
30
|
+
|
|
31
|
+
3. DEMONSTRATE — Quick live example
|
|
32
|
+
- Run a vault search on something relevant to the user's project
|
|
33
|
+
- Show the result: "This is what I already know about your domain"
|
|
34
|
+
- If vault is empty: "Let's capture our first pattern together"
|
|
35
|
+
|
|
36
|
+
4. ORIENT — Help the user find their starting point
|
|
37
|
+
- Ask: "What are you working on?" or "What problem are you trying to solve?"
|
|
38
|
+
- Based on their answer, suggest the right workflow:
|
|
39
|
+
- Building something new → "Let me create a plan"
|
|
40
|
+
- Fixing a bug → "Let me search for known patterns"
|
|
41
|
+
- Learning the codebase → "Let me explore and capture what I find"
|
|
42
|
+
- Setting up → "Let me run a health check: op:admin_health"
|
|
43
|
+
|
|
44
|
+
5. HANDOFF — Set expectations
|
|
45
|
+
- "From now on, just describe what you need — I'll figure out the workflow"
|
|
46
|
+
- "If you want me to remember something, say 'capture this' or 'remember'"
|
|
47
|
+
- "Say 'what do you know about X?' to search my vault anytime"`,
|
|
48
|
+
expectedOutcome:
|
|
49
|
+
'User understands what the agent can do, has seen a live demonstration, and has a clear first task to work on. The agent transitions from onboarding to productive work.',
|
|
50
|
+
category: 'methodology',
|
|
51
|
+
tags: ['onboarding', 'getting-started', 'help', 'capabilities', 'generic'],
|
|
52
|
+
matchIntents: ['PLAN'],
|
|
53
|
+
matchKeywords: [
|
|
54
|
+
'what can you do',
|
|
55
|
+
'help',
|
|
56
|
+
'getting started',
|
|
57
|
+
'how do I use',
|
|
58
|
+
'features',
|
|
59
|
+
'capabilities',
|
|
60
|
+
'onboarding',
|
|
61
|
+
'introduce',
|
|
62
|
+
'what is this',
|
|
63
|
+
'new here',
|
|
64
|
+
'first time',
|
|
65
|
+
],
|
|
66
|
+
gates: [],
|
|
67
|
+
taskTemplates: [],
|
|
68
|
+
toolInjections: [
|
|
69
|
+
'op:activate — show current capabilities and system status',
|
|
70
|
+
'op:admin_health — demonstrate health check',
|
|
71
|
+
'op:search_intelligent — live demo of vault search',
|
|
72
|
+
'op:brain_recommend — show brain recommendations',
|
|
73
|
+
],
|
|
74
|
+
verificationCriteria: [
|
|
75
|
+
'User received a clear overview of agent capabilities',
|
|
76
|
+
'User saw a live demonstration of at least one capability',
|
|
77
|
+
'User expressed a first task or area of interest',
|
|
78
|
+
],
|
|
79
|
+
};
|
|
@@ -23,6 +23,7 @@ import { codeReviewPlaybook } from './generic/code-review.js';
|
|
|
23
23
|
import { subagentExecutionPlaybook } from './generic/subagent-execution.js';
|
|
24
24
|
import { systematicDebuggingPlaybook } from './generic/systematic-debugging.js';
|
|
25
25
|
import { verificationPlaybook } from './generic/verification.js';
|
|
26
|
+
import { onboardingPlaybook } from './generic/onboarding.js';
|
|
26
27
|
|
|
27
28
|
// =============================================================================
|
|
28
29
|
// SCORING WEIGHTS
|
|
@@ -49,6 +50,7 @@ const BUILTIN_PLAYBOOKS: PlaybookDefinition[] = [
|
|
|
49
50
|
subagentExecutionPlaybook,
|
|
50
51
|
systematicDebuggingPlaybook,
|
|
51
52
|
verificationPlaybook,
|
|
53
|
+
onboardingPlaybook,
|
|
52
54
|
];
|
|
53
55
|
|
|
54
56
|
/**
|
|
@@ -240,7 +240,7 @@ export function createAdminExtraOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
240
240
|
description: 'Status of all runtime modules — check each is initialized.',
|
|
241
241
|
auth: 'read',
|
|
242
242
|
handler: async () => {
|
|
243
|
-
const cogneeStatus = cognee
|
|
243
|
+
const cogneeStatus = cognee?.getStatus() ?? null;
|
|
244
244
|
const llmAvailable = runtime.llmClient.isAvailable();
|
|
245
245
|
const loopStatus = runtime.loop.getStatus();
|
|
246
246
|
|
|
@@ -292,11 +292,13 @@ export function createAdminExtraOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
292
292
|
// Brain rebuild failed — graceful degradation
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
if (cognee) {
|
|
296
|
+
try {
|
|
297
|
+
cognee.resetPendingCognify();
|
|
298
|
+
cleared.push('cognee');
|
|
299
|
+
} catch {
|
|
300
|
+
// Cognee reset failed — graceful degradation
|
|
301
|
+
}
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
try {
|
|
@@ -798,10 +800,14 @@ export function createAdminExtraOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
798
800
|
}
|
|
799
801
|
|
|
800
802
|
// Cognee
|
|
801
|
-
const cogneeStatus = cognee
|
|
803
|
+
const cogneeStatus = cognee?.getStatus() ?? null;
|
|
802
804
|
checks.cognee = {
|
|
803
805
|
ok: cogneeStatus?.available ?? false,
|
|
804
|
-
detail:
|
|
806
|
+
detail: cognee
|
|
807
|
+
? cogneeStatus?.available
|
|
808
|
+
? 'Connected'
|
|
809
|
+
: 'Not available (optional)'
|
|
810
|
+
: 'Disabled',
|
|
805
811
|
};
|
|
806
812
|
|
|
807
813
|
// LLM keys
|
package/src/runtime/admin-ops.ts
CHANGED
|
@@ -51,7 +51,7 @@ export function createAdminOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
51
51
|
auth: 'read',
|
|
52
52
|
handler: async () => {
|
|
53
53
|
const vaultStats = vault.stats();
|
|
54
|
-
const cogneeStatus = cognee
|
|
54
|
+
const cogneeStatus = cognee?.getStatus() ?? null;
|
|
55
55
|
const llmAvailable = llmClient.isAvailable();
|
|
56
56
|
const brainStats = brain.getStats();
|
|
57
57
|
const curatorStatus = curator.getStatus();
|
|
@@ -183,10 +183,10 @@ export function createAdminOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
183
183
|
|
|
184
184
|
// Reset cognee health cache by checking health again (no direct reset method)
|
|
185
185
|
// The next isAvailable check will need a fresh health probe
|
|
186
|
-
const cogneeHealth = await cognee.healthCheck().catch(() => null);
|
|
186
|
+
const cogneeHealth = cognee ? await cognee.healthCheck().catch(() => null) : null;
|
|
187
187
|
|
|
188
188
|
return {
|
|
189
|
-
cleared: ['brain_vocabulary', 'cognee_health_cache'],
|
|
189
|
+
cleared: ['brain_vocabulary', ...(cognee ? ['cognee_health_cache'] : [])],
|
|
190
190
|
brainVocabularySize: brain.getStats().vocabularySize,
|
|
191
191
|
cogneeAvailable: cogneeHealth?.available ?? false,
|
|
192
192
|
};
|
|
@@ -252,7 +252,7 @@ export function createAdminOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
252
252
|
|
|
253
253
|
// 4. Cognee availability
|
|
254
254
|
try {
|
|
255
|
-
const cogneeStatus = cognee
|
|
255
|
+
const cogneeStatus = cognee?.getStatus() ?? null;
|
|
256
256
|
if (cogneeStatus?.available) {
|
|
257
257
|
checks.push({
|
|
258
258
|
name: 'cognee',
|
|
@@ -136,6 +136,7 @@ export function createCaptureOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
136
136
|
counterExample: entry.counterExample,
|
|
137
137
|
why: entry.why,
|
|
138
138
|
tier: finalTier,
|
|
139
|
+
origin: 'user',
|
|
139
140
|
});
|
|
140
141
|
const scopeMeta = scopeResult
|
|
141
142
|
? {
|
|
@@ -227,7 +228,44 @@ export function createCaptureOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
|
|
231
|
+
// Auto-suggest links for captured entries (Zettelkasten enrichment)
|
|
232
|
+
let suggestedLinks: Array<{
|
|
233
|
+
entryId: string;
|
|
234
|
+
title: string;
|
|
235
|
+
suggestedType: string;
|
|
236
|
+
score: number;
|
|
237
|
+
}> = [];
|
|
238
|
+
try {
|
|
239
|
+
if (captured > 0) {
|
|
240
|
+
const firstCaptured = results.find((r) => r.action === 'capture');
|
|
241
|
+
if (firstCaptured) {
|
|
242
|
+
const { LinkManager } = await import('../vault/linking.js');
|
|
243
|
+
const lm = new LinkManager(vault.getProvider());
|
|
244
|
+
const suggestions = lm.suggestLinks(firstCaptured.id, 3);
|
|
245
|
+
suggestedLinks = suggestions
|
|
246
|
+
.filter(
|
|
247
|
+
(s) => s.entryId !== firstCaptured.id && !s.entryId.endsWith(firstCaptured.id),
|
|
248
|
+
)
|
|
249
|
+
.map((s) => ({
|
|
250
|
+
entryId: s.entryId,
|
|
251
|
+
title: s.title,
|
|
252
|
+
suggestedType: s.suggestedType,
|
|
253
|
+
score: s.score,
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
} catch {
|
|
258
|
+
/* never break capture for suggestions */
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return {
|
|
262
|
+
captured,
|
|
263
|
+
proposed,
|
|
264
|
+
rejected,
|
|
265
|
+
duplicated,
|
|
266
|
+
results,
|
|
267
|
+
...(suggestedLinks.length > 0 ? { suggestedLinks } : {}),
|
|
268
|
+
};
|
|
231
269
|
},
|
|
232
270
|
},
|
|
233
271
|
|
|
@@ -307,6 +345,7 @@ export function createCaptureOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
307
345
|
description,
|
|
308
346
|
tags,
|
|
309
347
|
tier: finalTier,
|
|
348
|
+
origin: 'user',
|
|
310
349
|
});
|
|
311
350
|
if (captureResult.blocked) {
|
|
312
351
|
return {
|